Skip to content

Commit

Permalink
Fix gas costs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuajbouw committed Jul 1, 2022
1 parent ca53a1d commit 89f0cc3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ testnet-test-build: testnet-test.wasm etc/eth-contracts/artifacts/contracts/test
testnet-test.wasm: target/wasm32-unknown-unknown/release/aurora_engine.wasm
cp $< $@

target/wasm32-unknown-unknown/release/aurora_engine.wasm: Cargo.toml Cargo.lock $(shell find src -name "*.rs") etc/eth-contracts/res/EvmErc20.bin
target/wasm32-unknown-unknown/release/aurora_engine.wasm: Cargo.toml Cargo.lock $(shell find engine -name "*.rs") etc/eth-contracts/res/EvmErc20.bin
RUSTFLAGS='-C link-arg=-s' $(CARGO) build \
--target wasm32-unknown-unknown \
--release \
Expand All @@ -67,7 +67,7 @@ target/wasm32-unknown-unknown/release/aurora_engine.wasm: Cargo.toml Cargo.lock
--features=$(FEATURES)$(ADDITIONAL_FEATURES) \
-Z avoid-dev-deps

target/wasm32-unknown-unknown/debug/aurora_engine.wasm: Cargo.toml Cargo.lock $(wildcard src/*.rs) etc/eth-contracts/res/EvmErc20.bin
target/wasm32-unknown-unknown/debug/aurora_engine.wasm: Cargo.toml Cargo.lock $(wildcard engine/*.rs) etc/eth-contracts/res/EvmErc20.bin
$(CARGO) build \
--target wasm32-unknown-unknown \
-p aurora-engine \
Expand Down
4 changes: 2 additions & 2 deletions engine-tests/src/tests/one_inch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(), 26);
assert_gas_bound(profile.all_gas(), 25);

let (result, profile) = helper.pool_withdraw(
&pool,
Expand Down Expand Up @@ -101,7 +101,7 @@ fn test_1_inch_limit_order_deploy() {
// more than 3.5 million Ethereum gas used
assert!(result.gas_used > 3_500_000);
// less than 10 NEAR Tgas used
assert_gas_bound(profile.all_gas(), 9);
assert_gas_bound(profile.all_gas(), 10);
// at least 45% of which is from wasm execution
let wasm_fraction = 100 * profile.wasm_gas() / profile.all_gas();
assert!(
Expand Down
2 changes: 1 addition & 1 deletion engine-tests/src/tests/uniswap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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(), 19);
test_utils::assert_gas_bound(profile.all_gas(), 18);
let wasm_fraction = 100 * profile.wasm_gas() / profile.all_gas();
assert!(
45 <= wasm_fraction && wasm_fraction <= 55,
Expand Down

0 comments on commit 89f0cc3

Please sign in to comment.