Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into fedekunze/block-gas
Browse files Browse the repository at this point in the history
  • Loading branch information
facs95 committed Nov 18, 2022
2 parents 2d1929c + e2939a3 commit 395de1d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/armon/go-metrics v0.4.1
github.com/btcsuite/btcd v0.22.1
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cosmos/cosmos-proto v1.0.0-alpha7
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.5-0.20221114064055-2114ec42dfa1
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.3
Expand Down
7 changes: 3 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44=
github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU=
github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0=
github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw=
github.com/cosmos/cosmos-proto v1.0.0-alpha8 h1:d3pCRuMYYvGA5bM0ZbbjKn+AoQD4A7dyNG2wzwWalUw=
github.com/cosmos/cosmos-proto v1.0.0-alpha8/go.mod h1:6/p+Bc4O8JKeZqe0VqUGTX31eoYqemTT4C1hLCWsO7I=
github.com/cosmos/cosmos-sdk v0.46.5-0.20221114064055-2114ec42dfa1 h1:FZKpSzMv+hZAgjzm3rXiZMx00HkBn2AnzQBsfF0jTJg=
github.com/cosmos/cosmos-sdk v0.46.5-0.20221114064055-2114ec42dfa1/go.mod h1:JNklMfXo7MhDF1j/jxZCmDyOYyqhVoKB22e8p1ATEqA=
github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 h1:iKclrn3YEOwk4jQHT2ulgzuXyxmzmPczUalMwW4XH9k=
Expand Down Expand Up @@ -1743,8 +1743,7 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
pgregory.net/rapid v0.4.7 h1:MTNRktPuv5FNqOO151TM9mDTa+XHcX6ypYeISDVD14g=
pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
pgregory.net/rapid v0.5.3 h1:163N50IHFqr1phZens4FQOdPgfJscR7a562mjQqeo4M=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
Expand Down
37 changes: 37 additions & 0 deletions tests/integration_tests/test_gas.py
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

0 comments on commit 395de1d

Please sign in to comment.