Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.connect() doesn't change both the caller and signer #197

Open
matevz opened this issue Sep 29, 2023 · 0 comments
Open

.connect() doesn't change both the caller and signer #197

matevz opened this issue Sep 29, 2023 · 0 comments
Labels
client javascript Pull requests that update Javascript code

Comments

@matevz
Copy link
Member

matevz commented Sep 29, 2023

If you want to switch the signer of a wrapped object, for example:

const myContract2 = myContract.connect(await ethers.getSigner(1));

or more explicitly:

const myContract2 = await ethers.getContractAt("MyContract", myContract.address, (await ethers.getSigner(1)));

(see https://github.com/oasisprotocol/demo-quiz/blob/3c6c15038f75fc96bf706a7a0d5ecdbca3b6f46d/backend/test/Quiz.ts#L87-L89 for live example).

Then when calling a signed view call await myContract.foo();, the query fails:

 Error: missing revert data (action="call", data=null, reason=null, transaction={ "data": "0xa36464617461a264626f6479a462706b5820db9991c1c0383bef811444a78e0aca7f32a0c954cac1258b6552812e3f0008446464617461587cb50cdb41f69a75661fc483742c66ee68cf63839ae6b352f9ca405b6dcd5a6ca3a418abc4d788187b565e8ba0175fd31463b469da08b7963d413ba5761d2fb06e5dbedda8a981c1f3afa5de1050d035d44c23e92ee6303497ce146a62eef395c3c8f9b60922284fc87efe266ee2582a58a7dec4d9f05b9537d1c930146565706f63681819656e6f6e63654ff37b5557ce282341c092b719d6351966666f726d617401656c65617368a4656e6f6e6365184f6a626c6f636b5f6861736858209228a8b1d0f4d7d119cb54783a7fed5fcebfa60d686bcb0f370793030cd1bce06b626c6f636b5f72616e6765190fa06c626c6f636b5f6e756d6265721905df697369676e61747572655841abb4f3db8290484acf2ccb1a2eb0bebe847daea6c94b86866e4b96f4240e0bf5134c417d4b41c29c41a5c3f319845e44197a0b45482bc542ebb32c7d4c8fcec51c", "from": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", "to": "0xc351628EB244ec633d5f21fBD6621e1a683B1181" }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.10.0)

I tracked down the error in the web3 gateway logs and Sapphire runtime complains:

{"block_or_hash":{"blockNumber":"latest"},"caller":"revert_errors.go:103","err":"invalid signed simulate call query: signer != caller","level":"debug","method":"eth_call","module":"eth_rpc","msg":"failed to execute SimulateCall","ts":"2024-06-03T12:08:07.840799449Z"}

Tested using sapphire-localnet 2024-05-28-git37b7166 (oasis-core: 24.0-gitfb49717, sapphire-paratime: 0.7.3-testnet, oasis-web3-gateway: 5.1.0). Running it on Sapphire Testnet also fails.

@matevz matevz added client javascript Pull requests that update Javascript code labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

1 participant