From 12c3a24e534fb5ad690c1f02d52e0a2bc1761dfc Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Mon, 2 Nov 2020 18:29:55 +0200 Subject: [PATCH 1/7] Upgrade OpenEthereum from 2.6.2 to 2.6.3. (#3506) --- Cargo.lock | 12 ++++++------ runtime/near-evm-runner/Cargo.toml | 4 ++-- runtime/near-evm-runner/src/near_ext.rs | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0473e2440ea..c1334725d12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "ethjson" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.2#25936ae0f6d48f5ac6fb93cd467c15f4f8a631c2" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" dependencies = [ "ethereum-types", "rustc-hex 1.0.0", @@ -1512,7 +1512,7 @@ dependencies = [ [[package]] name = "evm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.2#25936ae0f6d48f5ac6fb93cd467c15f4f8a631c2" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" dependencies = [ "bit-set", "ethereum-types", @@ -2366,7 +2366,7 @@ dependencies = [ [[package]] name = "keccak-hasher" version = "0.1.1" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.2#25936ae0f6d48f5ac6fb93cd467c15f4f8a631c2" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" dependencies = [ "ethereum-types", "hash-db", @@ -2648,7 +2648,7 @@ dependencies = [ [[package]] name = "memory-cache" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.2#25936ae0f6d48f5ac6fb93cd467c15f4f8a631c2" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" dependencies = [ "lru-cache", "parity-util-mem", @@ -3830,7 +3830,7 @@ dependencies = [ [[package]] name = "patricia-trie-ethereum" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.2#25936ae0f6d48f5ac6fb93cd467c15f4f8a631c2" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" dependencies = [ "elastic-array 0.10.3", "ethereum-types", @@ -5656,7 +5656,7 @@ checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "vm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.2#25936ae0f6d48f5ac6fb93cd467c15f4f8a631c2" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" dependencies = [ "ethereum-types", "ethjson", diff --git a/runtime/near-evm-runner/Cargo.toml b/runtime/near-evm-runner/Cargo.toml index 604fad9eb2d..7033c5dae20 100644 --- a/runtime/near-evm-runner/Cargo.toml +++ b/runtime/near-evm-runner/Cargo.toml @@ -24,8 +24,8 @@ keccak-hash = "0.2.0" ripemd160 = "0.9.0" libsecp256k1 = "0.3.5" -evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.2" } -vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.2" } +evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.3" } +vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.3" } bn = { git = "https://github.com/paritytech/bn", default-features = false } parity-bytes = "0.1.0" ethereum-types = "0.6.0" diff --git a/runtime/near-evm-runner/src/near_ext.rs b/runtime/near-evm-runner/src/near_ext.rs index 409a6220330..2807ae3ca7a 100644 --- a/runtime/near-evm-runner/src/near_ext.rs +++ b/runtime/near-evm-runner/src/near_ext.rs @@ -64,6 +64,10 @@ impl<'a> NearExt<'a> { } impl<'a> vm::Ext for NearExt<'a> { + /// EIP-1344: Returns the current chain's EIP-155 unique identifier. + /// See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1344.md + fn chain_id(&self) -> u64 { todo!() } + /// Returns the storage value for a given key if reversion happens on the current transaction. fn initial_storage_at(&self, key: &H256) -> EvmResult { let raw_val = self From 88dfcb095374d732fc9af28644201bbeb075500d Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Mon, 2 Nov 2020 18:40:31 +0200 Subject: [PATCH 2/7] Upgrade OpenEthereum from 2.6.3 to 2.6.4. (#3506) --- Cargo.lock | 13 ++++++------- runtime/near-evm-runner/Cargo.toml | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c1334725d12..c04ec37d352 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1500,19 +1500,18 @@ dependencies = [ [[package]] name = "ethjson" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" dependencies = [ "ethereum-types", "rustc-hex 1.0.0", "serde", - "serde_derive", "serde_json", ] [[package]] name = "evm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" dependencies = [ "bit-set", "ethereum-types", @@ -2366,7 +2365,7 @@ dependencies = [ [[package]] name = "keccak-hasher" version = "0.1.1" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" dependencies = [ "ethereum-types", "hash-db", @@ -2648,7 +2647,7 @@ dependencies = [ [[package]] name = "memory-cache" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" dependencies = [ "lru-cache", "parity-util-mem", @@ -3830,7 +3829,7 @@ dependencies = [ [[package]] name = "patricia-trie-ethereum" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" dependencies = [ "elastic-array 0.10.3", "ethereum-types", @@ -5656,7 +5655,7 @@ checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "vm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.3#b7b1484f2e4b81641b0c1375ce9c88e4843796f1" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" dependencies = [ "ethereum-types", "ethjson", diff --git a/runtime/near-evm-runner/Cargo.toml b/runtime/near-evm-runner/Cargo.toml index 7033c5dae20..7673d58359b 100644 --- a/runtime/near-evm-runner/Cargo.toml +++ b/runtime/near-evm-runner/Cargo.toml @@ -24,8 +24,8 @@ keccak-hash = "0.2.0" ripemd160 = "0.9.0" libsecp256k1 = "0.3.5" -evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.3" } -vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.3" } +evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.4" } +vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.4" } bn = { git = "https://github.com/paritytech/bn", default-features = false } parity-bytes = "0.1.0" ethereum-types = "0.6.0" From cc5de319d6554ac6735d27da513325282e33d167 Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Mon, 2 Nov 2020 18:51:35 +0200 Subject: [PATCH 3/7] Upgrade OpenEthereum from 2.6.4 to 2.6.5. (#3506) --- Cargo.lock | 40 ++++++++++++++++++++++++------ runtime/near-evm-runner/Cargo.toml | 4 +-- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c04ec37d352..8e342e60efc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "ethjson" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" dependencies = [ "ethereum-types", "rustc-hex 1.0.0", @@ -1511,7 +1511,7 @@ dependencies = [ [[package]] name = "evm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" dependencies = [ "bit-set", "ethereum-types", @@ -1521,7 +1521,7 @@ dependencies = [ "memory-cache", "parity-bytes", "parity-util-mem", - "parking_lot 0.7.1", + "parking_lot 0.9.0", "vm", ] @@ -2365,7 +2365,7 @@ dependencies = [ [[package]] name = "keccak-hasher" version = "0.1.1" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" dependencies = [ "ethereum-types", "hash-db", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "memory-cache" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" dependencies = [ "lru-cache", "parity-util-mem", @@ -3763,6 +3763,17 @@ dependencies = [ "parking_lot_core 0.4.0", ] +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.2", + "rustc_version", +] + [[package]] name = "parking_lot" version = "0.10.2" @@ -3797,6 +3808,21 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +dependencies = [ + "cfg-if", + "cloudabi 0.0.3", + "libc", + "redox_syscall", + "rustc_version", + "smallvec 0.6.13", + "winapi 0.3.8", +] + [[package]] name = "parking_lot_core" version = "0.7.2" @@ -3829,7 +3855,7 @@ dependencies = [ [[package]] name = "patricia-trie-ethereum" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" dependencies = [ "elastic-array 0.10.3", "ethereum-types", @@ -5655,7 +5681,7 @@ checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "vm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.4#badb04502f425008d04b27802c5f30c681609a29" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" dependencies = [ "ethereum-types", "ethjson", diff --git a/runtime/near-evm-runner/Cargo.toml b/runtime/near-evm-runner/Cargo.toml index 7673d58359b..91ad6079df0 100644 --- a/runtime/near-evm-runner/Cargo.toml +++ b/runtime/near-evm-runner/Cargo.toml @@ -24,8 +24,8 @@ keccak-hash = "0.2.0" ripemd160 = "0.9.0" libsecp256k1 = "0.3.5" -evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.4" } -vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.4" } +evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.5" } +vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.5" } bn = { git = "https://github.com/paritytech/bn", default-features = false } parity-bytes = "0.1.0" ethereum-types = "0.6.0" From 66516743e60d9c7aed7fb97603a198188d4609e7 Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Mon, 2 Nov 2020 19:02:26 +0200 Subject: [PATCH 4/7] Upgrade OpenEthereum from 2.6.5 to 2.6.6. (#3506) --- Cargo.lock | 12 ++++++------ runtime/near-evm-runner/Cargo.toml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e342e60efc..d19dbbdf136 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "ethjson" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" dependencies = [ "ethereum-types", "rustc-hex 1.0.0", @@ -1511,7 +1511,7 @@ dependencies = [ [[package]] name = "evm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" dependencies = [ "bit-set", "ethereum-types", @@ -2365,7 +2365,7 @@ dependencies = [ [[package]] name = "keccak-hasher" version = "0.1.1" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" dependencies = [ "ethereum-types", "hash-db", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "memory-cache" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" dependencies = [ "lru-cache", "parity-util-mem", @@ -3855,7 +3855,7 @@ dependencies = [ [[package]] name = "patricia-trie-ethereum" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" dependencies = [ "elastic-array 0.10.3", "ethereum-types", @@ -5681,7 +5681,7 @@ checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "vm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.5#753b923ee9fe8c59e3a8464a5754456e80dffe1e" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" dependencies = [ "ethereum-types", "ethjson", diff --git a/runtime/near-evm-runner/Cargo.toml b/runtime/near-evm-runner/Cargo.toml index 91ad6079df0..6fb160e5680 100644 --- a/runtime/near-evm-runner/Cargo.toml +++ b/runtime/near-evm-runner/Cargo.toml @@ -24,8 +24,8 @@ keccak-hash = "0.2.0" ripemd160 = "0.9.0" libsecp256k1 = "0.3.5" -evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.5" } -vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.5" } +evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.6" } +vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.6" } bn = { git = "https://github.com/paritytech/bn", default-features = false } parity-bytes = "0.1.0" ethereum-types = "0.6.0" From d47c695b84fefa4e9a8b865aadcc870e0f099069 Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Mon, 2 Nov 2020 19:09:50 +0200 Subject: [PATCH 5/7] Upgrade OpenEthereum from 2.6.6 to 2.6.7. (#3506) --- Cargo.lock | 12 ++++++------ runtime/near-evm-runner/Cargo.toml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d19dbbdf136..8f236c80c3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "ethjson" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" dependencies = [ "ethereum-types", "rustc-hex 1.0.0", @@ -1511,7 +1511,7 @@ dependencies = [ [[package]] name = "evm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" dependencies = [ "bit-set", "ethereum-types", @@ -2365,7 +2365,7 @@ dependencies = [ [[package]] name = "keccak-hasher" version = "0.1.1" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" dependencies = [ "ethereum-types", "hash-db", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "memory-cache" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" dependencies = [ "lru-cache", "parity-util-mem", @@ -3855,7 +3855,7 @@ dependencies = [ [[package]] name = "patricia-trie-ethereum" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" dependencies = [ "elastic-array 0.10.3", "ethereum-types", @@ -5681,7 +5681,7 @@ checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "vm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.6#5162bc2c882e9210b74131e65145cc725a8b6a35" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" dependencies = [ "ethereum-types", "ethjson", diff --git a/runtime/near-evm-runner/Cargo.toml b/runtime/near-evm-runner/Cargo.toml index 6fb160e5680..6bb010b0b3e 100644 --- a/runtime/near-evm-runner/Cargo.toml +++ b/runtime/near-evm-runner/Cargo.toml @@ -24,8 +24,8 @@ keccak-hash = "0.2.0" ripemd160 = "0.9.0" libsecp256k1 = "0.3.5" -evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.6" } -vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.6" } +evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.7" } +vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.7" } bn = { git = "https://github.com/paritytech/bn", default-features = false } parity-bytes = "0.1.0" ethereum-types = "0.6.0" From 9e0b4f7943a2b776c4b3be59dbf7d36463e11dbb Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Mon, 2 Nov 2020 19:16:44 +0200 Subject: [PATCH 6/7] Upgrade OpenEthereum from 2.6.7 to 2.6.8. (#3506) --- Cargo.lock | 12 ++++++------ runtime/near-evm-runner/Cargo.toml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f236c80c3d..887b6e70a1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "ethjson" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.8#9bf6ed8450ec2eb61f14b362574c453ed68bd761" dependencies = [ "ethereum-types", "rustc-hex 1.0.0", @@ -1511,7 +1511,7 @@ dependencies = [ [[package]] name = "evm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.8#9bf6ed8450ec2eb61f14b362574c453ed68bd761" dependencies = [ "bit-set", "ethereum-types", @@ -2365,7 +2365,7 @@ dependencies = [ [[package]] name = "keccak-hasher" version = "0.1.1" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.8#9bf6ed8450ec2eb61f14b362574c453ed68bd761" dependencies = [ "ethereum-types", "hash-db", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "memory-cache" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.8#9bf6ed8450ec2eb61f14b362574c453ed68bd761" dependencies = [ "lru-cache", "parity-util-mem", @@ -3855,7 +3855,7 @@ dependencies = [ [[package]] name = "patricia-trie-ethereum" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.8#9bf6ed8450ec2eb61f14b362574c453ed68bd761" dependencies = [ "elastic-array 0.10.3", "ethereum-types", @@ -5681,7 +5681,7 @@ checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "vm" version = "0.1.0" -source = "git+https://github.com/openethereum/openethereum?rev=v2.6.7#ba1b879e9f9aae0e949c1530268d0ff7c0347cca" +source = "git+https://github.com/openethereum/openethereum?rev=v2.6.8#9bf6ed8450ec2eb61f14b362574c453ed68bd761" dependencies = [ "ethereum-types", "ethjson", diff --git a/runtime/near-evm-runner/Cargo.toml b/runtime/near-evm-runner/Cargo.toml index 6bb010b0b3e..b8a93874762 100644 --- a/runtime/near-evm-runner/Cargo.toml +++ b/runtime/near-evm-runner/Cargo.toml @@ -24,8 +24,8 @@ keccak-hash = "0.2.0" ripemd160 = "0.9.0" libsecp256k1 = "0.3.5" -evm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.7" } -vm = { git = "https://github.com/openethereum/openethereum", rev = "v2.6.7" } +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 } parity-bytes = "0.1.0" ethereum-types = "0.6.0" From baeb9d9baab8bdc83b50de16c364a7b2b71cbc59 Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Thu, 5 Nov 2020 17:25:21 +0200 Subject: [PATCH 7/7] Implement EIP-1344's CHAINID opcode. (#3506) --- runtime/near-evm-runner/src/interpreter.rs | 14 ++++++++++++++ runtime/near-evm-runner/src/lib.rs | 6 ++++++ runtime/near-evm-runner/src/near_ext.rs | 13 ++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/runtime/near-evm-runner/src/interpreter.rs b/runtime/near-evm-runner/src/interpreter.rs index f767cf85e55..554a0599acc 100644 --- a/runtime/near-evm-runner/src/interpreter.rs +++ b/runtime/near-evm-runner/src/interpreter.rs @@ -26,6 +26,7 @@ pub fn deploy_code( code: &[u8], gas: &U256, evm_gas_config: &EvmCostConfig, + chain_id: u128, ) -> Result { let mut nonce = U256::zero(); if address_type == CreateContractAddress::FromSenderAndNonce { @@ -49,6 +50,7 @@ pub fn deploy_code( code, gas, evm_gas_config, + chain_id, )?; // Apply known gas amount changes (all reverts are NeedsReturn) @@ -82,6 +84,7 @@ pub fn _create( code: &[u8], gas: &U256, evm_gas_config: &EvmCostConfig, + chain_id: u128, ) -> Result<(ExecTrapResult, Option)> { let mut store = StateStore::default(); let mut sub_state = SubState::new(sender, &mut store, state); @@ -110,6 +113,7 @@ pub fn _create( call_stack_depth + 1, false, evm_gas_config, + chain_id, ); ext.info.gas_limit = U256::from(gas); ext.schedule = Schedule::new_constantinople(); @@ -133,6 +137,7 @@ pub fn call( should_commit: bool, gas: &U256, evm_gas_config: &EvmCostConfig, + chain_id: u128, ) -> Result { run_and_commit_if_success( state, @@ -148,6 +153,7 @@ pub fn call( should_commit, gas, evm_gas_config, + chain_id, ) } @@ -161,6 +167,7 @@ pub fn delegate_call( input: &[u8], gas: &U256, evm_gas_config: &EvmCostConfig, + chain_id: u128, ) -> Result { run_and_commit_if_success( state, @@ -176,6 +183,7 @@ pub fn delegate_call( true, gas, evm_gas_config, + chain_id, ) } @@ -188,6 +196,7 @@ pub fn static_call( input: &[u8], gas: &U256, evm_gas_config: &EvmCostConfig, + chain_id: u128, ) -> Result { run_and_commit_if_success( state, @@ -203,6 +212,7 @@ pub fn static_call( false, gas, evm_gas_config, + chain_id, ) } @@ -221,6 +231,7 @@ fn run_and_commit_if_success( should_commit: bool, gas: &U256, evm_gas_config: &EvmCostConfig, + chain_id: u128, ) -> Result { // run the interpreter and let (result, state_updates) = run_against_state( @@ -236,6 +247,7 @@ fn run_and_commit_if_success( is_static, gas, evm_gas_config, + chain_id, )?; // Apply known gas amount changes (all reverts are NeedsReturn) @@ -279,6 +291,7 @@ fn run_against_state( is_static: bool, gas: &U256, evm_gas_config: &EvmCostConfig, + chain_id: u128, ) -> Result<(ExecTrapResult, Option)> { let code = state.code_at(code_address)?.unwrap_or_else(Vec::new); @@ -319,6 +332,7 @@ fn run_against_state( call_stack_depth + 1, is_static, evm_gas_config, + chain_id, ); // Gas limit is evm block gas limit, should at least prepaid gas. ext.info.gas_limit = *gas; diff --git a/runtime/near-evm-runner/src/lib.rs b/runtime/near-evm-runner/src/lib.rs index 13b5ccd8296..b1b3f2fa9f2 100644 --- a/runtime/near-evm-runner/src/lib.rs +++ b/runtime/near-evm-runner/src/lib.rs @@ -39,6 +39,7 @@ pub struct EvmContext<'a> { gas_counter: GasCounter, pub evm_gas_counter: EvmGasCounter, fees_config: &'a RuntimeFeesConfig, + chain_id: u128, domain_separator: RawU256, } @@ -181,6 +182,7 @@ impl<'a> EvmContext<'a> { ), evm_gas_counter: EvmGasCounter::new(0.into(), evm_gas), fees_config, + chain_id, domain_separator, } } @@ -203,6 +205,7 @@ impl<'a> EvmContext<'a> { &bytecode, &self.evm_gas_counter.gas_left(), &self.fees_config.evm_config, + self.chain_id, )? { ContractCreateResult::Created(address, gas_left) => { self.evm_gas_counter.set_gas_left(gas_left); @@ -241,6 +244,7 @@ impl<'a> EvmContext<'a> { true, &self.evm_gas_counter.gas_left(), &self.fees_config.evm_config, + self.chain_id, )?; match result { MessageCallResult::Success(gas_left, data) => { @@ -277,6 +281,7 @@ impl<'a> EvmContext<'a> { true, &self.evm_gas_counter.gas_left(), &self.fees_config.evm_config, + self.chain_id, )?; match result { MessageCallResult::Success(gas_left, data) => { @@ -313,6 +318,7 @@ impl<'a> EvmContext<'a> { false, &self.evm_gas_counter.gas_left(), &self.fees_config.evm_config, + self.chain_id, )?; let result = match result { MessageCallResult::Success(gas_left, data) => { diff --git a/runtime/near-evm-runner/src/near_ext.rs b/runtime/near-evm-runner/src/near_ext.rs index 2807ae3ca7a..29ea2ee3331 100644 --- a/runtime/near-evm-runner/src/near_ext.rs +++ b/runtime/near-evm-runner/src/near_ext.rs @@ -1,3 +1,4 @@ +use std::convert::TryInto; use std::sync::Arc; use ethereum_types::{Address, H256, U256}; @@ -26,6 +27,7 @@ pub struct NearExt<'a> { pub static_flag: bool, pub depth: usize, pub evm_gas_config: &'a EvmCostConfig, + pub chain_id: u128, } impl std::fmt::Debug for NearExt<'_> { @@ -36,6 +38,7 @@ impl std::fmt::Debug for NearExt<'_> { write!(f, "\n\tcontext_addr: {:?}", self.context_addr)?; write!(f, "\n\tstatic_flag: {:?}", self.static_flag)?; write!(f, "\n\tdepth: {:?}", self.depth)?; + write!(f, "\n\tchain_id: {:?}", self.chain_id)?; write!(f, "\n}}") } } @@ -48,6 +51,7 @@ impl<'a> NearExt<'a> { depth: usize, static_flag: bool, evm_gas_config: &'a EvmCostConfig, + chain_id: u128, ) -> Self { Self { info: Default::default(), @@ -59,6 +63,7 @@ impl<'a> NearExt<'a> { static_flag, depth, evm_gas_config, + chain_id, } } } @@ -66,7 +71,9 @@ impl<'a> NearExt<'a> { impl<'a> vm::Ext for NearExt<'a> { /// EIP-1344: Returns the current chain's EIP-155 unique identifier. /// See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1344.md - fn chain_id(&self) -> u64 { todo!() } + fn chain_id(&self) -> u64 { + self.chain_id.try_into().unwrap() + } /// Returns the storage value for a given key if reversion happens on the current transaction. fn initial_storage_at(&self, key: &H256) -> EvmResult { @@ -154,6 +161,7 @@ impl<'a> vm::Ext for NearExt<'a> { &code.to_vec(), gas, &self.evm_gas_config, + self.chain_id, ) .map_err(|_| TrapKind::Call(ActionParams::default())) } @@ -204,6 +212,7 @@ impl<'a> vm::Ext for NearExt<'a> { true, // should_commit gas, &self.evm_gas_config, + self.chain_id, ), CallType::StaticCall => interpreter::static_call( self.sub_state, @@ -214,6 +223,7 @@ impl<'a> vm::Ext for NearExt<'a> { &data.to_vec(), gas, &self.evm_gas_config, + self.chain_id, ), CallType::CallCode => { // Call another contract using storage of the current contract. No longer used. @@ -229,6 +239,7 @@ impl<'a> vm::Ext for NearExt<'a> { &data.to_vec(), gas, &self.evm_gas_config, + self.chain_id, ), }; result.map_err(|_| TrapKind::Call(ActionParams::default()))