warp-contracts/warp

[BUG] Failed to load contract source/definition using arweave gateway

xiaojay opened this issue · 0 comments

Describe the bug
want to get contract state of stamp contract (https://sonar.warp.cc/?#/app/contract/TlqASNDLA1Uh8yFiH-BzR_1FDag4s735F3PoUFEv2Mo) using arweave gateway.

the script is here
https://gist.github.com/xiaojay/12659c6b91f306e8c76dc543e95b2d6d

Got error:
2023-05-23T03:04:02.135Z INFO [LevelDbCache] Using location ./cache/warp/state [] readState error: Error: Unable to retrieve tx TlqASNDLA1Uh8yFiH-BzR_1FDag4s735F3PoUFEv2Mo. 404. undefined at /home/ubuntu/smartcontracts-cache/node_modules/warp-contracts/src/utils/ArweaveWrapper.ts:79:15 at processTicksAndRejections (node:internal/process/task_queues:95:5) at async ArweaveWrapper.tx (/home/ubuntu/smartcontracts-cache/node_modules/warp-contracts/src/utils/ArweaveWrapper.ts:71:22) at async ContractDefinitionLoader.doLoad (/home/ubuntu/smartcontracts-cache/node_modules/warp-contracts/src/core/modules/impl/ContractDefinitionLoader.ts:43:24) at async ContractDefinitionLoader.load (/home/ubuntu/smartcontracts-cache/node_modules/warp-contracts/src/core/modules/impl/ContractDefinitionLoader.ts:34:22) at async HandlerBasedContract.createExecutionContext (/home/ubuntu/smartcontracts-cache/node_modules/warp-contracts/src/contract/HandlerBasedContract.ts:479:28) at async HandlerBasedContract.readState (/home/ubuntu/smartcontracts-cache/node_modules/warp-contracts/src/contract/HandlerBasedContract.ts:164:32) at async getState (/home/ubuntu/smartcontracts-cache/src/stamp.ts:13:38) contractId: TlqASNDLA1Uh8yFiH-BzR_1FDag4s735F3PoUFEv2Mo

it works fine use warp gateway .

I believe the reason of this error is the warp sdk lack support for loading contract source which is deployed using bundle tx from arweave gateway.

To Reproduce
the script:
https://gist.github.com/xiaojay/12659c6b91f306e8c76dc543e95b2d6d

Expected behavior
get the right contract state

Desktop (please complete the following information):

  • OS: ubuntu 20.04
  • Node.js: v18.14.2
  • warp-contracts SDK version: "^1.2.33"
  • warp-contracts plugins being used (+ versions)
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]