Skip to content

Commit

Permalink
chore: remove obsolete gas test (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-llimos authored Nov 9, 2023
1 parent a8a8d29 commit f993570
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions tests/unit/vault/test_executexSwapAndCall.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,53 +290,3 @@ def test_executexSwapAndCallToken(
]


def test_executexSwapAndCallToken_gasTest400(
cf,
cfTester,
token,
):
# Hardcode variables to speed up the test
srcChain = 1
amount = TEST_AMNT
st_srcAddress = bytes.fromhex(cf.ALICE.address[2:])

token.transfer(cf.vault, amount * 2, {"from": cf.SAFEKEEPER})

# Currently the gasLimit is hardcoded at 400k in the state chain.

## GasTest 270k makes the whole transaction consume 392k with ccmTestGasUsed: 272k
# => overhead = 120k, that's including a bunch of logic in the receiver contract.
# With no code in the receiver (except checking the vault address) it's 112k
# Depending on the tx number it reverts between 270 and 300k.
message = encode_abi(["string", "uint256"], ["GasTest", 270000])
args = [
[token, cfTester.address, amount],
srcChain,
st_srcAddress,
message,
]
sigData = AGG_SIGNER_1.getSigDataWithNonces(
cf.keyManager, cf.vault.executexSwapAndCall, nonces, *args
)
tx = cf.vault.executexSwapAndCall(
sigData,
*args,
{"from": cf.ALICE, "gas": 400000},
)

assert tx.events["ReceivedxSwapAndCall"]["ccmTestGasUsed"] >= 270000

# overhead = tx.gas_used - tx.events["ReceivedxSwapAndCall"]["ccmTestGasUsed"]
message = encode_abi(["string", "uint256"], ["GasTest", 300000])
args[3] = message
sigData = AGG_SIGNER_1.getSigDataWithNonces(
cf.keyManager, cf.vault.executexSwapAndCall, nonces, *args
)

# Reverts - run out of gas
with reverts(""):
cf.vault.executexSwapAndCall(
sigData,
*args,
{"from": cf.ALICE, "gas": 400000},
)

0 comments on commit f993570

Please sign in to comment.