-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(cheatcodes): base implementation of cheatcode system #58
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).
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ?
fvm/src/utils.rs
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
lib/src/lib.rs
Outdated
@@ -26,7 +27,7 @@ mod state_tree; | |||
|
|||
/// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the builtin actors test actors?
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.
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>
fvm/src/utils.rs
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-fvm
repo 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-fvm
KytheraMachine
: Stores override values.KytheraCallManager
: Set override values when detects asend()
syscall to actor Id 98 (cheatcodes actor).KytheraKernel
: Actually override values at call time.OverrideContext
structure that allows us to store at theKytheraMachine
level 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-lib
without actually building everything everytime.Minor
Links to any relevant issues or pull requests
Closes #22
Change checklist