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

[pallet-revive] Strange behavior if map_account is used via system_dryRun #7305

Open
2 tasks done
cmichi opened this issue Jan 23, 2025 · 5 comments
Open
2 tasks done
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@cmichi
Copy link
Contributor

cmichi commented Jan 23, 2025

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

The RPC system_dryRun fails for pallet_revive::map_account on a fresh node (e.g. for Alice). The dry-run starts succeeding as soon as one map_account extrinsic has been executed (e.g. for the unrelated account Bob).

cc @athei @pgherveou

Steps to reproduce

(1) Start a fresh node process.

(2) Open https://polkadot.js.org/apps/. Go to Developer → RPC → Select system + dryRun.
Enter 0xa1018400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01e6411e16395d06cc47a747a8bed9caa1a3445b765a2adc95a9a4248d4ba0395c38ab172e642a45369d6a965f795d964f921f29f40b7fb455294b599d188751850000000807

That's a signed extrinsic for pallet_revive::map_account (//Alice with nonce 0). Submit the RPC call. You will get BadProof.

(3) Open another https://polkadot.js.org/apps/ window. Go to Developer → Extrinsics → Submit Transaction with Bob + revive + map_account.

(4) In the window from Step (2) click "Submit RPC call" again. You'll then receive an Ok.

Image

Important:
In Step (2) I got BadProof for the extrinsic in system_dryRun. But: If I ignore this and nevertheless submit the extrinsic at that time it will succeed.

@cmichi cmichi added I10-unconfirmed Issue might be valid, but it's not yet known. I2-bug The node fails to follow expected behavior. labels Jan 23, 2025
@pgherveou
Copy link
Contributor

Enter 0xa1018400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01e6411e16395d06cc47a747a8bed9caa1a3445b765a2adc95a9a4248d4ba0395c38ab172e642a45369d6a965f795d964f921f29f40b7fb455294b599d188751850000000807

I think this has to be generated fresh for every new restart, I couldn't used yours.
How do you generate the extrinsic without submitting it?

@athei
Copy link
Member

athei commented Jan 23, 2025

You can copy out the encoded call from the extrinsic tab in Polkadot.js. But I think it is chain specific. So please try against Westend AssetHub so we can reproduce.

Wallets and other tooling need read access to the mapping state so show the others whether their account is mapped or not. I assume that is the reason for the dry running.

So I suggest we either add a runtime api or we wait for the view functions to be merged and use those (their are just syntax sugar for runtime APIs though).

@pgherveou
Copy link
Contributor

You can copy out the encoded call from the extrinsic tab in Polkadot.js

that's for the extrinsic payload not the signed call

@athei
Copy link
Member

athei commented Jan 23, 2025

I think dryRun just expects the encoded call. But I am not sure.

@cmichi
Copy link
Contributor Author

cmichi commented Jan 23, 2025

@pgherveou I did sign the call with subxt in cargo-contract, it has a lot of surrounding code though. AFAIK the easiest way to get to the signed call is to

(1) Start your local node.
(2) Go to https://polkadot.js.org/apps/ → Developer → Extrinsics → Submit Transaction with Alice + revive + map_account → Submit Transaction → Sign & Submit.
(3) Open your web dev console. You'll see an entry a la sending 0xa5….
(4) Copy this bytecode and shut down the node.

If you then replace the bytecode in my first issue with the copied one you can follow the steps to reproduce.

Note that the bug does not appear on nodes that already have mapped accounts present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

No branches or pull requests

3 participants