Reduced gas cost for static calls made to precompiles EIP2046/1352 (#11583)
* Implemented eip2046 * Update ethcore/builtin/src/lib.rs Co-Authored-By: Wei Tang <accounts@that.world> * Update ethcore/builtin/src/lib.rs Co-Authored-By: Wei Tang <accounts@that.world> * Update ethcore/builtin/src/lib.rs Co-Authored-By: Andronik Ordian <write@reusable.software> * Update ethcore/builtin/src/lib.rs Co-Authored-By: Wei Tang <accounts@that.world> * move precompile address limit def to gasometer * use const instead lazy_static Co-authored-by: Wei Tang <accounts@that.world> Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -71,8 +71,10 @@ pub struct Schedule {
|
||||
pub log_topic_gas: usize,
|
||||
/// Gas price for `CREATE` opcode
|
||||
pub create_gas: usize,
|
||||
/// Gas price for `*CALL*` opcodes
|
||||
/// Gas price for `*CALL*` opcodes, EXCEPT for staticcall to precompiles
|
||||
pub call_gas: usize,
|
||||
/// Gas price for staticcall to precompiles
|
||||
pub staticcall_precompile_gas: usize,
|
||||
/// Stipend for transfer for `CALL|CALLCODE` opcode when `value>0`
|
||||
pub call_stipend: usize,
|
||||
/// Additional gas required for value transfer (`CALL|CALLCODE`)
|
||||
@@ -250,6 +252,7 @@ impl Schedule {
|
||||
log_topic_gas: 375,
|
||||
create_gas: 32000,
|
||||
call_gas: 700,
|
||||
staticcall_precompile_gas: 700,
|
||||
call_stipend: 2300,
|
||||
call_value_transfer_gas: 9000,
|
||||
call_new_account_gas: 25000,
|
||||
@@ -312,6 +315,13 @@ impl Schedule {
|
||||
schedule
|
||||
}
|
||||
|
||||
/// Schedule for the Berlin fork of the Ethereum main net.
|
||||
pub fn new_berlin() -> Schedule {
|
||||
let mut schedule = Self::new_istanbul();
|
||||
schedule.staticcall_precompile_gas = 40; // EIPs 2046 1352
|
||||
schedule
|
||||
}
|
||||
|
||||
fn new(efcd: bool, hdc: bool, tcg: usize) -> Schedule {
|
||||
Schedule {
|
||||
exceptional_failed_code_deposit: efcd,
|
||||
@@ -341,6 +351,7 @@ impl Schedule {
|
||||
log_topic_gas: 375,
|
||||
create_gas: 32000,
|
||||
call_gas: 40,
|
||||
staticcall_precompile_gas: 40,
|
||||
call_stipend: 2300,
|
||||
call_value_transfer_gas: 9000,
|
||||
call_new_account_gas: 25000,
|
||||
|
||||
@@ -107,6 +107,13 @@ impl FakeExt {
|
||||
ext
|
||||
}
|
||||
|
||||
/// New fake externalities with Berlin schedule rules
|
||||
pub fn new_berlin() -> Self {
|
||||
let mut ext = FakeExt::default();
|
||||
ext.schedule = Schedule::new_berlin();
|
||||
ext
|
||||
}
|
||||
|
||||
/// Alter fake externalities to allow wasm
|
||||
pub fn with_wasm(mut self) -> Self {
|
||||
self.schedule.wasm = Some(Default::default());
|
||||
|
||||
Reference in New Issue
Block a user