feat(cheatcodes): base implementation of cheatcode system#58
feat(cheatcodes): base implementation of cheatcode system#58tchataigner merged 48 commits intodevelopfrom
Conversation
* Upgrade builtins dependencies to revision for release 10.0 (M2.1 of FVM)
* Using code_by_id() method to retrieve builtins code CID from Manifest * Get builtins actor ID from builtin crate
from the rest of the methods.
* Removed dependencies to builtin actors to rely on Chainsafe repo instead as per filecoin-project/builtin-actors#194 (comment)
* Setup all necessary builtins in our local development environment
* Adding actor to test builtins deployment in Kythera
* Adding actor to test constructor and setup being called in test flow
* Updating the builtin test actor to test that all builtins code are deployed at their address * Fix clippy
- introduce constructor_setup_test_actor crate to test Setup and Constructor functions
Co-authored-by: PhilippeMts <1371613+PhilippeMts@users.noreply.github.com>
Co-authored-by: João Oliveira <hello@jxs.pt>
…ra into feature/builtins-genesis
…e-constructor-setup
* Needed to have a Cheatcodes actor incorporated in our library so re-used the kythera_test_actors crate logic to generate it. kythera_test_actors have been renamed to kythera_actors. * Created a testing feature for kythera_actors to only build test_actors when we need them (mostly during tests of our kythera_lib).
jxs
left a comment
There was a problem hiding this comment.
Thanks for this Thomas, first Round of review, I still need to read the actors and the handle_cheatcode function
| { | ||
| Self { | ||
| inner: K::new( | ||
| KytheraCallManager(mgr), |
There was a problem hiding this comment.
This file needs all these overrides mainly because of this right? I.e to be able to abstract the CallManager, can we make a comment stating that with a TODO to fix this upstream?
There was a problem hiding this comment.
This is one of the reasons along with overriding of context in msg_context() and network_context(). So I'm not 100% sure that changing the upstream to remove the passing of the call manager will actually have an impact on our need to do what's currently being implemented (as we are actually overriding the logic of some methods).
What's your take on that ?
| pub(crate) const PRANK_METHOD: &str = "Prank"; | ||
| pub(crate) const TRICK_METHOD: &str = "Trick"; | ||
|
|
||
| lazy_static::lazy_static! { |
There was a problem hiding this comment.
nit: OnceCell is going to be stable soon so it probably makes sense to use its crate instead
There was a problem hiding this comment.
wdyt of actually calculating them and hardcoding them? We can then have tests for them on this module to assert that they correspond to the strings and then we could match on them with u64's on handle_cheatcode
| /// Main interface to test `Actor`s with Kythera. | ||
| pub struct Tester { | ||
| // Builtin actors root Cid used in the Machine | ||
| // Builtin test_actors root Cid used in the Machine |
There was a problem hiding this comment.
are the builtin actors test actors?
There was a problem hiding this comment.
No ! Good one, must have been a wrong update on my side. Thanks for that 🙏
Co-authored-by: João Oliveira <hello@jxs.pt>
Co-authored-by: João Oliveira <hello@jxs.pt>
| pub(crate) const PRANK_METHOD: &str = "Prank"; | ||
| pub(crate) const TRICK_METHOD: &str = "Trick"; | ||
|
|
||
| lazy_static::lazy_static! { |
There was a problem hiding this comment.
wdyt of actually calculating them and hardcoding them? We can then have tests for them on this module to assert that they correspond to the strings and then we could match on them with u64's on handle_cheatcode
Co-authored-by: João Oliveira <hello@jxs.pt>
Co-authored-by: João Oliveira <hello@jxs.pt>
fix(cheatcodes): typo fix(cheatcodes): typo
…kythera into feature/cheatcodes-foundation
jxs
left a comment
There was a problem hiding this comment.
LGTM Thomas, only two minor comments left.
| /// Deploy a new Actor at a given address, provided with a given token balance | ||
| /// and returns the CodeCID of the installed actor | ||
| pub fn deploy_actor_from_bin( | ||
| fn deploy_actor_from_bin_at_address( |
There was a problem hiding this comment.
this should still have a comment no?
Co-authored-by: João Oliveira <hello@jxs.pt>
Description
This PR introduces cheatcodes in Kythera. The inspiration for what the system allows is heavily inspired from Foundry's cheatcodes.
Changelog
Major
ref-fvmrepo as we need to have granular control over them for the cheatcode system to work. This implementation is heavily inspired from the conformance test framework from @Stebalian on theref-fvmKytheraMachine: Stores override values.KytheraCallManager: Set override values when detects asend()syscall to actor Id 98 (cheatcodes actor).KytheraKernel: Actually override values at call time.OverrideContextstructure that allows us to store at theKytheraMachinelevel different value to alter information when cheatcodes are invoked.<project-root>/actors. In this folder we find bothactors(available at all time) andtest-actors(only available iffeature=["testing"]is enabled). This allows to have some binaries built and used in ourkythera-libwithout actually building everything everytime.Minor
Links to any relevant issues or pull requests
Closes #22
Change checklist