-
Notifications
You must be signed in to change notification settings - Fork 6
add vm.prank/startPrank/stopPrank support #334
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
Signed-off-by: Alexandru Gheorghe <[email protected]>
Signed-off-by: Alexandru Gheorghe <[email protected]>
|
||
fn fund_pranked_accounts(prank_enabled: bool, account: Address) { | ||
// Fuzzed prank addresses have no balance, so they won't exist in revive, and | ||
// calls will fail, this is not a problem when running in REVM. |
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.
how is it done that account without funds can be used to trigger call in REVM - how is gas charged in this case?
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.
Yeah, that's something I want to investigate.
trace::<Runtime, _, _>(|| { | ||
let origin = OriginFor::<Runtime>::signed(AccountId::to_fallback_account_id( | ||
&H160::from_slice(input.caller().as_slice()), | ||
&H160::from_slice(ecx.tx.caller.as_slice()), |
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.
From this what I see zksync support pranks for origin and sender only on top level call. your solution looks better but requires pallet-revive modification.
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 how zksync sets it: https://github.com/matter-labs/foundry-zksync/blob/9a3a6b7fb65ea9fb9589c7e4b3a5416ad8c742fa/crates/zksync/core/src/vm/runner.rs#L292.
We do need pallet-revive modification no-matter what because we can control only origin with the current interface.
For pranking, couldn't you use an approach like we do in Anvil? #332 Overriding the host functions that do the account recovery |
Unless, I'm misunderstanding #332, these are two different things |
Depends on: paritytech/polkadot-sdk#9909
Fixes: #324
There are a few problems with the way we currently do calls:
ecx.tx.caller.
, when calling bare_call/bare_instantiate.bare_call
for all type of calls, and that does not allow setting any delegate call info.For 1 and 2 I added a extra argument to bare_call/bare_instantiate and plumb its way through pallet_revive in paritytech/polkadot-sdk#9909