Automatically boot a chopsticks instance on the given network after creating a referendum#49
Automatically boot a chopsticks instance on the given network after creating a referendum#49eugypalu wants to merge 15 commits intojoepetrowski:masterfrom
Conversation
src/chopsticks.rs
Outdated
| await injectWhitelistedCallerCall('{}', {}, '{}'); | ||
|
|
||
| console.log('🧪 Running user-defined tests...'); | ||
| {} |
There was a problem hiding this comment.
What sort of tests are you looking to have here?
There was a problem hiding this comment.
my idea was to validates that the WhitelistedCaller origin can successfully dispatch the preimage-lookup call and that the proposal executes without runtime errors once the Fellowship whitelist and public referendum phases are complete.
There was a problem hiding this comment.
Great; in open-web3-stack/polkadot-ecosystem-tests#335, something similar will be done.
In essence, the critical point is that it is not necessary to fully await for a referendum's time periods to fully elapse when testing:
- simply extract them from storage with
chopsticks, - modify data to make it look like they've been in decision/confirmation for a while, with the appropriate amount of votes, and
- then place them back into memory
- don't forget the associated scheduler call
There was a problem hiding this comment.
Thanks a lot, I should have fixed it with the last commits
| // Inject fellowship call into scheduler | ||
| await rpcCall('dev_setStorage', [{{ | ||
| scheduler: {{ | ||
| agenda: [ |
There was a problem hiding this comment.
Great, I see you already know how to do this!
This isn't immediately relevant, but post-AHM, the manner in which you choose the target block will change.
There was a problem hiding this comment.
Thanks for pointing that out! Is there anything you think I should adjust in the current implementation to better prepare for post-AHM changes?
There was a problem hiding this comment.
Sorry for the latency;
Here's a HackMD I wrote while working on PET; I wrote a section recently about what you just asked, since I had a scheduler E2E test suite that required a very large refactor.
There was a problem hiding this comment.
Thanks, I should have fixed it with the last commits
Co-authored-by: Alexandre R. Baldé <alexandrer_b@outlook.com>
Closes #38
This PR implements the chopsticks testing integration requested in issue #38, enabling automated testing of OpenGov referenda through network forking and simulation.
Enhanced submit-referendum command:
opengov-cli submit-referendum \ --proposal "./upgrade-kusama-1.4.1/kusama-1.4.1.call" \ --network "kusama" --track "whitelistedcaller" \ --test testfile.jsNew scaffold-tests command
opengov-cli scaffold-tests --network polkadot