This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 558
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6455785
commit 58c756e
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from .utils import ( | ||
ADDRS, | ||
CONTRACTS, | ||
KEYS, | ||
deploy_contract, | ||
send_transaction, | ||
w3_wait_for_new_blocks, | ||
) | ||
|
||
|
||
def test_equivalent_gas_consumption(geth, ethermint): | ||
tx_value = 10 | ||
|
||
# send a transaction with geth | ||
geth_gas_price = geth.w3.eth.gas_price | ||
tx = {"to": ADDRS["community"], "value": tx_value, "gasPrice": geth_gas_price} | ||
geth_reciept = send_transaction(geth.w3, tx, KEYS["validator"]) | ||
|
||
# send an equivalent transaction with ethermint | ||
ethermint_gas_price = ethermint.w3.eth.gas_price | ||
tx = {"to": ADDRS["community"], "value": tx_value, "gasPrice": ethermint_gas_price} | ||
ethermint_reciept = send_transaction(ethermint.w3, tx, KEYS["validator"]) | ||
|
||
# ensure that the gasUsed is equivalent | ||
assert geth_reciept.gasUsed == ethermint_reciept.gasUsed | ||
|
||
w3_wait_for_new_blocks(geth.w3, 5) | ||
w3_wait_for_new_blocks(ethermint.w3, 5) | ||
|
||
# repeat the above process with contract deployment | ||
_, geth_contract_reciept = deploy_contract( | ||
geth.w3, | ||
CONTRACTS["TestERC20A"]) | ||
_, ethermint_contract_reciept = deploy_contract( | ||
ethermint.w3, | ||
CONTRACTS["TestERC20A"]) | ||
assert geth_contract_reciept.gasUsed == ethermint_contract_reciept.gasUsed |