-
Notifications
You must be signed in to change notification settings - Fork 10
Automatically boot a chopsticks instance on the given network after creating a referendum #49
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
base: master
Are you sure you want to change the base?
Conversation
src/chopsticks.rs
Outdated
| await injectWhitelistedCallerCall('{}', {}, '{}'); | ||
| console.log('🧪 Running user-defined tests...'); | ||
| {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What sort of tests are you looking to have here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, I should have fixed it with the last commits
src/chopsticks.rs
Outdated
| // Inject fellowship call into scheduler | ||
| await rpcCall('dev_setStorage', [{{ | ||
| scheduler: {{ | ||
| agenda: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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