-
Notifications
You must be signed in to change notification settings - Fork 6
[issues/318] Added support for cheat code 'vm.fee' in PVM mode #331
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
}); | ||
} | ||
|
||
fn set_basefee(new_basefee: U256, ecx: Ecx<'_, '_, '_>) { |
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.
okay, so i assume it's not possible to modify the value of Weights::seal_base_fee
on pallet-revive?
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.
and do we have anyone who's up to date on gas mapping?
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.
Not really
import "./Vm.sol"; | ||
import {console} from "./console.sol"; | ||
contract Fee is DSTest { |
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.
try calling block.basefee
from a contract that's deployed on pvm side
|
||
fn set_basefee(new_basefee: U256, ecx: Ecx<'_, '_, '_>) { | ||
// Set basefee in EVM context. | ||
ecx.block.basefee = new_basefee.try_into().expect("Basefee exceeds u64"); |
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.
did you check how zksync is handling it?
I think they keep it consistent between vm calls.
- Single Source of Truth
// vm.fee() cheatcode sets this:
ccx.ecx.block.basefee =
newBasefee.saturating_to(); // Line 459 in
evm.rs
- Shared Through EthEvmContext
When zkVM is called, it receives the same
EthEvmContext that EVM uses:
// In zksync_try_call (strategy/zksync):
foundry_zksync_core::vm::call(call,
factory_deps, ecx, ccx)
- zkVM Extracts Basefee from Shared Context
// In runner.rs:303 - zkVM reads basefee from
the shared ecx.block:
block_basefee: min(max_fee_per_gas.to_ru256(),
rU256::from(ecx.block.basefee)),
Why do we use different approach?
TL;DR
This pull request implements the
vm.fee
cheatcode for polkadot-foundry's PVM mode, following the same pattern as existing cheatcodes likevm.roll
andvm.warp
.Changes
vm.fee
handler inrevive-strategy
to updateblock.basefee
in EVM contextvm.fee
functionality in PVM modeCloses #318