v2.5.8-stable (#11041)
* add more tx tests (#11038) * Fix parallel transactions race-condition (#10995) * Add blake2_f precompile (#11017) * [trace] introduce trace failed to Ext (#11019) * Edit publish-onchain.sh to use https (#11016) * Fix deadlock in network-devp2p (#11013) * EIP 1108: Reduce alt_bn128 precompile gas costs (#11008) * xDai chain support and nodes list update (#10989) * EIP 2028: transaction gas lowered from 68 to 16 (#10987) * EIP-1344 Add CHAINID op-code (#10983) * manual publish jobs for releases, no changes for nightlies (#10977) * [blooms-db] Fix benchmarks (#10974) * Verify transaction against its block during import (#10954) * Better error message for rpc gas price errors (#10931) * tx-pool: accept local tx with higher gas price when pool full (#10901) * Fix fork choice (#10837) * Cleanup unused vm dependencies (#10787) * Fix compilation on recent nightlies (#10991)
This commit is contained in:
@@ -65,7 +65,7 @@ impl From<ethjson::vm::Env> for EnvInfo {
|
||||
fn from(e: ethjson::vm::Env) -> Self {
|
||||
let number = e.number.into();
|
||||
EnvInfo {
|
||||
number: number,
|
||||
number,
|
||||
author: e.author.into(),
|
||||
difficulty: e.difficulty.into(),
|
||||
gas_limit: e.gas_limit.into(),
|
||||
|
||||
@@ -144,6 +144,9 @@ pub trait Ext {
|
||||
/// Returns environment info.
|
||||
fn env_info(&self) -> &EnvInfo;
|
||||
|
||||
/// Returns the chain ID of the blockchain
|
||||
fn chain_id(&self) -> u64;
|
||||
|
||||
/// Returns current depth of execution.
|
||||
///
|
||||
/// If contract A calls contract B, and contract B calls C,
|
||||
@@ -160,8 +163,12 @@ pub trait Ext {
|
||||
fn trace_next_instruction(&mut self, _pc: usize, _instruction: u8, _current_gas: U256) -> bool { false }
|
||||
|
||||
/// Prepare to trace an operation. Passthrough for the VM trace.
|
||||
/// For each call of `trace_prepare_execute` either `trace_failed` or `trace_executed` MUST be called.
|
||||
fn trace_prepare_execute(&mut self, _pc: usize, _instruction: u8, _gas_cost: U256, _mem_written: Option<(usize, usize)>, _store_written: Option<(U256, U256)>) {}
|
||||
|
||||
/// Trace the execution failure of a single instruction.
|
||||
fn trace_failed(&mut self) {}
|
||||
|
||||
/// Trace the finalised execution of a single instruction.
|
||||
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem: &[u8]) {}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ extern crate ethjson;
|
||||
extern crate rlp;
|
||||
extern crate keccak_hash as hash;
|
||||
extern crate patricia_trie_ethereum as ethtrie;
|
||||
extern crate trie_db as trie;
|
||||
|
||||
mod action_params;
|
||||
mod call_type;
|
||||
|
||||
@@ -84,7 +84,7 @@ pub struct Schedule {
|
||||
pub tx_create_gas: usize,
|
||||
/// Additional cost for empty data transaction
|
||||
pub tx_data_zero_gas: usize,
|
||||
/// Aditional cost for non-empty data transaction
|
||||
/// Additional cost for non-empty data transaction
|
||||
pub tx_data_non_zero_gas: usize,
|
||||
/// Gas price for copying memory
|
||||
pub copy_gas: usize,
|
||||
@@ -115,6 +115,8 @@ pub struct Schedule {
|
||||
pub have_return_data: bool,
|
||||
/// SHL, SHR, SAR opcodes enabled.
|
||||
pub have_bitwise_shifting: bool,
|
||||
/// CHAINID opcode enabled.
|
||||
pub have_chain_id: bool,
|
||||
/// Kill basic accounts below this balance if touched.
|
||||
pub kill_dust: CleanDustMode,
|
||||
/// Enable EIP-1283 rules
|
||||
@@ -209,6 +211,7 @@ impl Schedule {
|
||||
have_revert: false,
|
||||
have_return_data: false,
|
||||
have_bitwise_shifting: false,
|
||||
have_chain_id: false,
|
||||
have_extcodehash: false,
|
||||
stack_limit: 1024,
|
||||
max_depth: 1024,
|
||||
@@ -275,6 +278,14 @@ impl Schedule {
|
||||
schedule
|
||||
}
|
||||
|
||||
/// Schedule for the Istanbul fork of the Ethereum main net.
|
||||
pub fn new_istanbul() -> Schedule {
|
||||
let mut schedule = Self::new_constantinople();
|
||||
schedule.have_chain_id = true;
|
||||
schedule.tx_data_non_zero_gas = 16;
|
||||
schedule
|
||||
}
|
||||
|
||||
fn new(efcd: bool, hdc: bool, tcg: usize) -> Schedule {
|
||||
Schedule {
|
||||
exceptional_failed_code_deposit: efcd,
|
||||
@@ -283,6 +294,7 @@ impl Schedule {
|
||||
have_revert: false,
|
||||
have_return_data: false,
|
||||
have_bitwise_shifting: false,
|
||||
have_chain_id: false,
|
||||
have_extcodehash: false,
|
||||
stack_limit: 1024,
|
||||
max_depth: 1024,
|
||||
|
||||
@@ -67,6 +67,8 @@ pub struct FakeExt {
|
||||
pub balances: HashMap<Address, U256>,
|
||||
pub tracing: bool,
|
||||
pub is_static: bool,
|
||||
|
||||
chain_id: u64,
|
||||
}
|
||||
|
||||
// similar to the normal `finalize` function, but ignoring NeedsReturn.
|
||||
@@ -98,11 +100,24 @@ impl FakeExt {
|
||||
ext
|
||||
}
|
||||
|
||||
/// New fake externalities with Istanbul schedule rules
|
||||
pub fn new_istanbul() -> Self {
|
||||
let mut ext = FakeExt::default();
|
||||
ext.schedule = Schedule::new_istanbul();
|
||||
ext
|
||||
}
|
||||
|
||||
/// Alter fake externalities to allow wasm
|
||||
pub fn with_wasm(mut self) -> Self {
|
||||
self.schedule.wasm = Some(Default::default());
|
||||
self
|
||||
}
|
||||
|
||||
/// Set chain ID
|
||||
pub fn with_chain_id(mut self, chain_id: u64) -> Self {
|
||||
self.chain_id = chain_id;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Ext for FakeExt {
|
||||
@@ -200,7 +215,7 @@ impl Ext for FakeExt {
|
||||
|
||||
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> Result<()> {
|
||||
self.logs.push(FakeLogEntry {
|
||||
topics: topics,
|
||||
topics,
|
||||
data: data.to_vec()
|
||||
});
|
||||
Ok(())
|
||||
@@ -223,6 +238,10 @@ impl Ext for FakeExt {
|
||||
&self.info
|
||||
}
|
||||
|
||||
fn chain_id(&self) -> u64 {
|
||||
self.chain_id
|
||||
}
|
||||
|
||||
fn depth(&self) -> usize {
|
||||
self.depth
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user