AcalaNetwork / chopsticks

Create parallel reality of your Substrate network.
Apache License 2.0
133 stars 80 forks source link

Fix `--preimage` storage value #675

Closed serban300 closed 7 months ago

serban300 commented 7 months ago

Related to: https://github.com/AcalaNetwork/chopsticks/issues/630 and https://github.com/paritytech/polkadot-sdk/issues/3522

I'm trying to simulate some bridge-initialization calls using chopsticks. I used the code found in dry-run-preimage.ts as an example for crafting my own dev_setStorage call for simulating an approved preimage. The initial version didn't work (it was failing with CallUnavailable) and it took quite a while to find the solution presented in #630. Not sure if this is the best fix, but I think it would bring value to have this fixed. At least it would have saved a lot of time for me.

ermalkaleci commented 7 months ago

dry-run-preimage works fine. what are you trying to fix?

ermalkaleci commented 7 months ago

ok I see. in your case it didn't work because compactAddLength returns u8a and your using rpc method dev_setStorage which will stringily params and sending invalid data. that's why u8aToHex fixes your issue.

serban300 commented 7 months ago

Oh, I see. Sorry, I didn't realize. Ok. I'll close the PR then.