Skip to content

Commit

Permalink
Engine: Upgrade to latest SputnikVM changes (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
birchmd committed Mar 7, 2022
1 parent d2d3073 commit d94acac
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 31 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions engine-precompiles/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ base64 = { version = "0.13.0", default-features = false, features = ["alloc"] }
near-blake2 = { git = "https://github.com/near/near-blake2.git", version = "0.9.1", default-features = false }
borsh = { version = "0.8.2", default-features = false }
bn = { package = "aurora-bn", git = "https://github.com/aurora-is-near/aurora-bn.git", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false }
libsecp256k1 = { version = "0.3.5", default-features = false }
num = { version = "0.4.0", default-features = false, features = ["alloc"] }
primitive-types = { version = "0.10.0", default-features = false, features = ["rlp"] }
Expand Down
2 changes: 1 addition & 1 deletion engine-standalone-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ aurora-engine-types = { path = "../engine-types", default-features = false, feat
aurora-engine-sdk = { path = "../engine-sdk", default-features = false, features = ["std"] }
aurora-engine-transactions = { path = "../engine-transactions", default-features = false, features = ["std"] }
borsh = { version = "0.8.2" }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false }
rocksdb = "0.16.0"
postgres = "0.19.2"
serde = "1.0.130"
Expand Down
8 changes: 4 additions & 4 deletions engine-standalone-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ crate-type = ["lib"]
aurora-engine = { path = "../engine", default-features = false, features = ["std"] }
aurora-engine-types = { path = "../engine-types", default-features = false, features = ["std"] }
aurora-engine-sdk = { path = "../engine-sdk", default-features = false, features = ["std"] }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false, features = ["std"] }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false, features = ["std", "tracing"] }
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false, features = ["std", "tracing"] }
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false, features = ["std", "tracing"] }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false, features = ["std"] }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false, features = ["std", "tracing"] }
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false, features = ["std", "tracing"] }
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false, features = ["std", "tracing"] }

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion engine-standalone-tracing/src/sputnik.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl evm_runtime::tracing::EventListener for TransactionTraceBuilder {
use evm_runtime::tracing::Event;
match event {
Event::Step {
context: _,
address: _,
opcode,
position,
stack,
Expand Down
6 changes: 3 additions & 3 deletions engine-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ engine-standalone-storage = { path = "../engine-standalone-storage", default-fea
engine-standalone-tracing = { path = "../engine-standalone-tracing", default-features = false }
borsh = { version = "0.8.2", default-features = false }
sha3 = { version = "0.9.1", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false, features = ["std", "tracing"] }
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false, features = ["std", "tracing"] }
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false, features = ["std", "tracing"] }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false, features = ["std", "tracing"] }
evm-runtime = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false, features = ["std", "tracing"] }
evm-gasometer = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false, features = ["std", "tracing"] }
rlp = { version = "0.5.0", default-features = false }

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions engine-tests/src/tests/one_inch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn test_1inch_liquidity_protocol() {
let (result, profile, pool) =
helper.create_pool(&pool_factory, token_a.0.address, token_b.0.address);
assert!(result.gas_used >= 4_500_000); // more than 4.5M EVM gas used
assert_gas_bound(profile.all_gas(), 34); // less than 34 NEAR Tgas used
assert_gas_bound(profile.all_gas(), 33); // less than 33 NEAR Tgas used

// Approve giving ERC-20 tokens to the pool
helper.approve_erc20_tokens(&token_a, pool.address());
Expand All @@ -58,7 +58,7 @@ fn test_1inch_liquidity_protocol() {
},
);
assert!(result.gas_used >= 302_000); // more than 302k EVM gas used
assert_gas_bound(profile.all_gas(), 45); // less than 45 NEAR Tgas used
assert_gas_bound(profile.all_gas(), 44); // less than 44 NEAR Tgas used

// Same here
helper.runner.context.block_timestamp += 10_000_000 * 1_000_000_000;
Expand All @@ -73,7 +73,7 @@ fn test_1inch_liquidity_protocol() {
},
);
assert!(result.gas_used >= 210_000); // more than 210k EVM gas used
assert_gas_bound(profile.all_gas(), 48); // less than 48 NEAR Tgas used
assert_gas_bound(profile.all_gas(), 46); // less than 46 NEAR Tgas used

let (result, profile) = helper.pool_withdraw(
&pool,
Expand All @@ -84,7 +84,7 @@ fn test_1inch_liquidity_protocol() {
},
);
assert!(result.gas_used >= 150_000); // more than 150k EVM gas used
assert_gas_bound(profile.all_gas(), 39); // less than 39 NEAR Tgas used
assert_gas_bound(profile.all_gas(), 38); // less than 38 NEAR Tgas used
}

#[test]
Expand Down
6 changes: 4 additions & 2 deletions engine-tests/src/tests/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ fn test_solidity_pure_bench() {
result.gas_used > 38_000_000,
"Over 38 million EVM gas is used"
);
let near_gas = profile.all_gas();
assert!(
profile.all_gas() > 2200 * 1_000_000_000_000,
"Over 2200 NEAR Tgas is used"
near_gas > 1500 * 1_000_000_000_000,
"Expected 1500 NEAR Tgas to be used, but only consumed {}",
near_gas / 1_000_000_000_000,
);
}

Expand Down
6 changes: 3 additions & 3 deletions engine-tests/src/tests/uniswap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn test_uniswap_input_multihop() {
let mut context = UniswapTestContext::new("uniswap");

// evm_gas = 970k
// near total gas = 214 Tgas
// near total gas = 204 Tgas
// Wish: optimize so that this transaction costs less than 200 Tgas.
// For now we just have to increase the burnt gas limit to make it run to completion.
context.runner.wasm_config.limit_config.max_gas_burnt = 500_000_000_000_000;
Expand All @@ -54,7 +54,7 @@ fn test_uniswap_exact_output() {

let (_result, profile) =
context.add_equal_liquidity(LIQUIDITY_AMOUNT.into(), &token_a, &token_b);
test_utils::assert_gas_bound(profile.all_gas(), 58);
test_utils::assert_gas_bound(profile.all_gas(), 57);
let wasm_fraction = 100 * profile.wasm_gas() / profile.all_gas();
assert!(
20 <= wasm_fraction && wasm_fraction <= 30,
Expand All @@ -64,7 +64,7 @@ fn test_uniswap_exact_output() {

let (_amount_in, profile) =
context.exact_output_single(&token_a, &token_b, OUTPUT_AMOUNT.into());
test_utils::assert_gas_bound(profile.all_gas(), 32);
test_utils::assert_gas_bound(profile.all_gas(), 31);
let wasm_fraction = 100 * profile.wasm_gas() / profile.all_gas();
assert!(
25 <= wasm_fraction && wasm_fraction <= 35,
Expand Down
2 changes: 1 addition & 1 deletion engine-transactions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ autobenches = false
aurora-engine-types = { path = "../engine-types", default-features = false }
aurora-engine-sdk = { path = "../engine-sdk", default-features = false }
aurora-engine-precompiles = { path = "../engine-precompiles", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false }
rlp = { version = "0.5.0", default-features = false }
hex = { version = "0.4", default-features = false, features = ["alloc"] }

Expand Down
4 changes: 2 additions & 2 deletions engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ base64 = { version = "0.13.0", default-features = false, features = ["alloc"] }
near-blake2 = { git = "https://github.com/near/near-blake2.git", version = "0.9.1", default-features = false }
borsh = { version = "0.8.2", default-features = false }
bn = { package = "aurora-bn", git = "https://github.com/aurora-is-near/aurora-bn.git", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "f4ee520254856898d451c7225851520a35c97cea", default-features = false }
evm = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false }
evm-core = { git = "https://github.com/aurora-is-near/sputnikvm.git", rev = "37448b6cacd98b06282cff5a559684505c29bd2b", default-features = false }
libsecp256k1 = { version = "0.3.5", default-features = false }
num = { version = "0.4.0", default-features = false, features = ["alloc"] }
primitive-types = { version = "0.10.0", default-features = false, features = ["rlp"] }
Expand Down
8 changes: 4 additions & 4 deletions etc/state-migration-test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d94acac

Please sign in to comment.