Skip to content

Commit

Permalink
Upgrade OpenEthereum from 2.6.8 to 2.7.2. (#3506)
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Nov 12, 2020
1 parent 2b3583a commit fe379b5
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 173 deletions.
239 changes: 103 additions & 136 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chain/epoch_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rand = "0.7"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
smart-default = "0.6"
primitive-types = { version = "0.7", default-features = false }
primitive-types = "0.6"
num-rational = "0.2.4"

near-crypto = { path = "../../core/crypto" }
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ reed-solomon-erasure = "4"
jemallocator = { version = "0.3", optional = true }
hex = "0.4"
num-rational = "0.2.4"
primitive-types = { version = "0.7", default-features = false }
primitive-types = "0.6"
lazy_static = "1.4"

borsh = "0.7.1"
Expand Down
16 changes: 8 additions & 8 deletions runtime/near-evm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ enum-primitive-derive = "0.2"
sha2 = ">=0.8,<0.10"
sha3 = "0.8"
rlp = "0.4.2"
keccak-hash = "0.2.0"
keccak-hash = "0.4.1"
ripemd160 = "0.9.0"
libsecp256k1 = "0.3.5"

evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.8" }
vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.8" }
bn = { git = "https://github.com/paritytech/bn", default-features = false }
evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.7.2" }
vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.7.2" }
bn = { git = "https://github.com/near/bn", branch = "upgrade-rand" }
parity-bytes = "0.1.0"
ethereum-types = "0.6.0"
ethereum-types = "0.8.0"

near-vm-logic = { path = "../near-vm-logic" }
near-vm-errors = { path = "../near-vm-errors" }
Expand All @@ -38,9 +38,9 @@ near-runtime-fees = { path = "../near-runtime-fees" }
derivative = "2.1.1"

[dev-dependencies]
ethabi = "8.0.0"
ethabi-contract = "8.0.0"
ethabi-derive = "8.0.0"
ethabi = "9.0.1"
ethabi-contract = "9.0.0"
ethabi-derive = "9.0.1"
lazy_static = "1.4"
lazy-static-include = "2.2.2"

Expand Down
20 changes: 11 additions & 9 deletions runtime/near-evm-runner/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ethereum_types::{Address, U256};
use evm::{CreateContractAddress, Factory};
use near_runtime_fees::EvmCostConfig;
use vm::{
ActionParams, ActionValue, CallType, ContractCreateResult, ExecTrapResult, Ext, GasLeft,
ActionParams, ActionType, ActionValue, ContractCreateResult, ExecTrapResult, Ext, GasLeft,
MessageCallResult, ParamsType, ReturnData, Schedule,
};

Expand Down Expand Up @@ -91,16 +91,17 @@ pub fn _create<T: EvmState>(

let params = ActionParams {
code_address: *address,
code_hash: None,
code_version: U256::zero(),
address: *address,
sender: *sender,
origin: *origin,
gas: *gas,
gas_price: 1.into(),
value: ActionValue::Transfer(value),
code: Some(Arc::new(code.to_vec())),
code_hash: None,
data: None,
call_type: CallType::None,
action_type: ActionType::Create,
params_type: vm::ParamsType::Embedded,
};

Expand Down Expand Up @@ -145,7 +146,7 @@ pub fn call<T: EvmState>(
sender,
value,
call_stack_depth,
CallType::Call,
ActionType::Call,
contract_address,
contract_address,
input,
Expand Down Expand Up @@ -175,7 +176,7 @@ pub fn delegate_call<T: EvmState>(
sender,
None,
call_stack_depth,
CallType::DelegateCall,
ActionType::DelegateCall,
context,
delegee,
input,
Expand Down Expand Up @@ -204,7 +205,7 @@ pub fn static_call<T: EvmState>(
sender,
None,
call_stack_depth,
CallType::StaticCall,
ActionType::StaticCall,
contract_address,
contract_address,
input,
Expand All @@ -223,7 +224,7 @@ fn run_and_commit_if_success<T: EvmState>(
sender: &Address,
value: Option<U256>,
call_stack_depth: usize,
call_type: CallType,
call_type: ActionType,
state_address: &Address,
code_address: &Address,
input: &[u8],
Expand Down Expand Up @@ -284,7 +285,7 @@ fn run_against_state<T: EvmState>(
sender: &Address,
value: Option<U256>,
call_stack_depth: usize,
call_type: CallType,
call_type: ActionType,
state_address: &Address,
code_address: &Address,
input: &[u8],
Expand All @@ -307,6 +308,7 @@ fn run_against_state<T: EvmState>(
let mut params = ActionParams {
code_address: *code_address,
code_hash: None,
code_version: U256::zero(),
address: *state_address,
sender: *sender,
origin: *origin,
Expand All @@ -315,7 +317,7 @@ fn run_against_state<T: EvmState>(
value: ActionValue::Apparent(0.into()),
code: Some(Arc::new(code)),
data: Some(input.to_vec()),
call_type,
action_type: call_type,
params_type: ParamsType::Separate,
};

Expand Down
17 changes: 9 additions & 8 deletions runtime/near-evm-runner/src/near_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use keccak_hash::keccak;
use near_runtime_fees::EvmCostConfig;
use parity_bytes::Bytes;
use vm::{
CallType, ContractCreateResult, CreateContractAddress, EnvInfo, Error as VmError,
ActionType, ContractCreateResult, CreateContractAddress, EnvInfo, Error as VmError,
MessageCallResult, Result as EvmResult, ReturnData, Schedule, TrapKind,
};

Expand Down Expand Up @@ -142,6 +142,7 @@ impl<'a> vm::Ext for NearExt<'a> {
gas: &U256,
value: &U256,
code: &[u8],
_parent_version: &U256,
address_type: CreateContractAddress,
_trap: bool,
) -> Result<ContractCreateResult, TrapKind> {
Expand Down Expand Up @@ -179,10 +180,10 @@ impl<'a> vm::Ext for NearExt<'a> {
value: Option<U256>,
data: &[u8],
code_address: &Address,
call_type: CallType,
call_type: ActionType,
_trap: bool,
) -> Result<MessageCallResult, TrapKind> {
if self.is_static() && call_type != CallType::StaticCall {
if self.is_static() && call_type != ActionType::StaticCall {
panic!("MutableCallInStaticContext")
}

Expand All @@ -197,11 +198,11 @@ impl<'a> vm::Ext for NearExt<'a> {
}

let result = match call_type {
CallType::None => {
ActionType::Create | ActionType::Create2 => {
// Is not used.
return Err(TrapKind::Call(ActionParams::default()));
}
CallType::Call => interpreter::call(
ActionType::Call => interpreter::call(
self.sub_state,
&self.origin,
sender_address,
Expand All @@ -214,7 +215,7 @@ impl<'a> vm::Ext for NearExt<'a> {
&self.evm_gas_config,
self.chain_id,
),
CallType::StaticCall => interpreter::static_call(
ActionType::StaticCall => interpreter::static_call(
self.sub_state,
&self.origin,
sender_address,
Expand All @@ -225,11 +226,11 @@ impl<'a> vm::Ext for NearExt<'a> {
&self.evm_gas_config,
self.chain_id,
),
CallType::CallCode => {
ActionType::CallCode => {
// Call another contract using storage of the current contract. No longer used.
return Err(TrapKind::Call(ActionParams::default()));
}
CallType::DelegateCall => interpreter::delegate_call(
ActionType::DelegateCall => interpreter::delegate_call(
self.sub_state,
&self.origin,
sender_address,
Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm-errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ borsh = "0.7.1"

near-rpc-error-macro = { path = "../../tools/rpctypegen/macro", version = "0.1.0" }

ethereum-types = "0.6.0"
ethereum-types = "0.8.0"

[features]
dump_errors_schema = ["near-rpc-error-macro/dump_errors_schema"]
8 changes: 4 additions & 4 deletions runtime/runtime-params-estimator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ glob = "0.3.0"
walrus = "0.18.0"
near-evm-runner = { path = "../../runtime/near-evm-runner", features = ["costs_counting"] }
hex = "0.4"
ethabi = "8.0.0"
ethabi-contract = "8.0.0"
ethabi-derive = "8.0.0"
ethereum-types = "0.6.0"
ethabi = "9.0.1"
ethabi-contract = "9.0.0"
ethabi-derive = "9.0.1"
ethereum-types = "0.8.0"
lazy-static-include = "2.2.2"
num-traits = "0.2.12"

Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ num-rational = "0.2.4"
num-bigint = "0.2.6"
num-traits = "0.2.11"
hex = "0.4.2"
ethereum-types = "0.6.0"
ethereum-types = "0.8.0"

borsh = "0.7.1"

Expand Down
8 changes: 4 additions & 4 deletions test-utils/testlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ tempfile = "3"
assert_matches = "1.3"
num-rational = "0.2.4"
hex = "0.4"
ethabi = "8.0.0"
ethabi-contract = "8.0.0"
ethabi-derive = "8.0.0"
ethereum-types = "0.6.0"
ethabi = "9.0.1"
ethabi-contract = "9.0.0"
ethabi-derive = "9.0.1"
ethereum-types = "0.8.0"

borsh = "0.7.1"

Expand Down

0 comments on commit fe379b5

Please sign in to comment.