graph-node icon indicating copy to clipboard operation
graph-node copied to clipboard

Code example gives `unexpected upcast`

Open pscott opened this issue 2 years ago • 3 comments

Hi,

I'm getting some errors while trying to run the example code on my environment. This code here: https://github.com/graphprotocol/graph-node/blob/6a7806cc465949ebb9e5b8269eeb763857797efc/tests/integration-tests/host-exports/src/mapping.ts#L73-L88

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"
  }

pscott avatar Dec 21 '23 10:12 pscott

Why don't you simply do something like

 let tupleArray: ethereum.Tuple = [ 
   fixedSizedArray, 
   bool 
 ]; 

this?

I believe casting only changes how the type is interpreted by the compiler but the runtime type remains the same, maybe thats the reason it fails.

incrypto32 avatar Jan 04 '24 07:01 incrypto32

@incrypto32 thx for your input.

The reason I created an issue was not to find a solution to my problem, but rather to point out the fact that the example given in the documentation is wrong. I believe the documentation should be updated (as for the exact way it should be updated, I will let someone with more experience than me jump in :))

pscott avatar Jan 09 '24 01:01 pscott

Looks like this issue has been open for 6 months with no activity. Is it still relevant? If not, please remember to close it.

github-actions[bot] avatar Jul 10 '24 00:07 github-actions[bot]