warp-contracts / warp

An implementation of the Arweave SmartWeave smart contracts protocol.
MIT License
159 stars 44 forks source link

[BUG]: Mismatching blockheight on evaluation #487

Closed atticusofsparta closed 12 months ago

atticusofsparta commented 12 months ago

Description Currently the callContract method in HandleBasedContract defaults to use warp gateway when the warp environment is mainnet - this can differ from the interactionsLoader gateway type resulting in retrieving transactions of a higher blockheight than the gateway believes is the current blockheight.

To Reproduce When the warp gateway is behind in blocks, execute a read interaction on contract bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U (arns registry) with a warp client that uses the arweave.net gateway and useArweaveGateway set to true.

contract.viewState({ function:"priceForInteraction", name:"shiboopity-boop" })

this will result in you recieving an error along the lines of "Interaction height 1312126 is less than last ticked height 1312511"

Expected behavior When passing a custom arweave instance in and setting useArweaveGateway to true, its expected that all information is retrieved from the same gateway.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context This was found when debugging the ArNS registry contract, executing read states on the arns-service as well as locally in the browser.

Currently have a fix for it here: https://github.com/warp-contracts/warp/pull/486

ppedziwiatr commented 12 months ago

The root cause what an issue with the arweave info update task in our gateway - described here: https://discord.com/channels/1103577987007397919/1105204380350816277/1179860603012132946

image

But the proposed fix seems to make the SDK to behave in a bit more coherent way.

Just keep in mind https://github.com/warp-contracts/warp/issues/137#issuecomment-1118655665