Skip to content

Code example gives unexpected upcast #5088

@pscott

Description

@pscott

Hi,

I'm getting some errors while trying to run the example code on my environment.
This code here:

let address = ethereum.Value.fromAddress(Address.fromString("0x0000000000000000000000000000000000000420"));
let bigInt1 = ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(62));
let bigInt2 = ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(63));
let bool = ethereum.Value.fromBoolean(true);
let fixedSizedArray = ethereum.Value.fromFixedSizedArray([
bigInt1,
bigInt2
]);
let tupleArray: Array<ethereum.Value> = [
fixedSizedArray,
bool
];
let tuple = ethereum.Value.fromTuple(tupleArray as ethereum.Tuple);

Gives:

  Describe entity assertions:
thread 'main' panicked at '🆘 Unexpected error upon calling hook: Mapping aborted at tests/boost.test.ts, line 40, column 42, with message: unexpected upcast
wasm backtrace:
    0: 0x1c63 - <unknown>!start:tests/boost.test~anonymous|0~anonymous|0

The problem comes from the as ethereum.Tuple casting. I've tried other examples, they all give the same result.

My setup:
mac m1
running with graph test -d
versions:

  "dependencies": {
    "@graphprotocol/graph-cli": "0.64.0",
    "@graphprotocol/graph-ts": "0.32.0"
  },
  "devDependencies": {
    "matchstick-as": "^0.6.0"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions