Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: after v0.9.0 upgrade eth_call failed on old blocks #713

Merged
merged 7 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ go 1.18
require (
cosmossdk.io/math v1.0.0-beta.3
github.com/armon/go-metrics v0.4.1
github.com/cosmos/cosmos-sdk v0.46.2-0.20220831122102-a95c62680975
github.com/cosmos/cosmos-sdk v0.46.2-0.20220923192627-95948f6692bb
github.com/cosmos/ibc-go/v5 v5.0.0-rc2
github.com/ethereum/go-ethereum v1.10.19
github.com/evmos/ethermint v0.6.1-0.20220919141022-34226aa7b1fa
github.com/evmos/ethermint v0.6.1-0.20220923160625-35850e620d28
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
Expand Down Expand Up @@ -189,7 +189,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.46.2-0.20220920160224-9454b97ccb77
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.46.2-0.20220923192627-95948f6692bb
github.com/ethereum/go-ethereum => github.com/ethereum/go-ethereum v1.10.19

// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,8 @@ 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-sdk v0.46.2-0.20220920160224-9454b97ccb77 h1:uYNxojyADGcjw5zg7PFyUJ8wxT9rWB4e30CDDy0yicE=
github.com/cosmos/cosmos-sdk v0.46.2-0.20220920160224-9454b97ccb77/go.mod h1:0aUPGPU6PWaDEaHNjtgrpNhgxo9bAUrQ7BO7XCvFOfs=
github.com/cosmos/cosmos-sdk v0.46.2-0.20220923192627-95948f6692bb h1:BZ+NMjSWrPKPi7UHWBu+hsnzMkIhWJ40++QzPv822Do=
github.com/cosmos/cosmos-sdk v0.46.2-0.20220923192627-95948f6692bb/go.mod h1:0aUPGPU6PWaDEaHNjtgrpNhgxo9bAUrQ7BO7XCvFOfs=
github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1/go.mod h1:JUMM2MxF9wuwzRWZJjb8BjXsn1BmPmdBd3a75pIct4I=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
Expand Down Expand Up @@ -784,8 +784,8 @@ github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evmos/ethermint v0.6.1-0.20220919141022-34226aa7b1fa h1:bpvKBR28IiB5XccRBih6zHK6p83YAddhVuovuVbtfJg=
github.com/evmos/ethermint v0.6.1-0.20220919141022-34226aa7b1fa/go.mod h1:BMNkMffNTcrpv/kG52aZtHBnQpeiVyX5+Gr3tlt3Faw=
github.com/evmos/ethermint v0.6.1-0.20220923160625-35850e620d28 h1:ZYXdDq801x2+FNC1SojiUDV57FFf5x2zpj4Ewwbhf58=
github.com/evmos/ethermint v0.6.1-0.20220923160625-35850e620d28/go.mod h1:uub8CJvVIyW/4oPYXGiWImrRoR4phbh3l5kxxXZRJ6w=
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0=
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
Expand Down
8 changes: 4 additions & 4 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ schema = 3
version = "v1.0.0-alpha7"
hash = "sha256-2wCH+toTF2A6MfFjOa13muEH5oBCcxAhZEqirNOrBA0="
[mod."github.com/cosmos/cosmos-sdk"]
version = "v0.46.2-0.20220920160224-9454b97ccb77"
hash = "sha256-zwOsdcoPbEzn+q/UmW6/CauW65V6a4z/7k8DXPCvKb0="
version = "v0.46.2-0.20220923192627-95948f6692bb"
hash = "sha256-lQNzZRHH91AIAFoCHlzvZQfipC/2GktaazPfxVs4aEg="
replaced = "github.com/cosmos/cosmos-sdk"
[mod."github.com/cosmos/go-bip39"]
version = "v1.0.0"
Expand Down Expand Up @@ -165,8 +165,8 @@ schema = 3
version = "v1.10.19"
hash = "sha256-7FPnTGcCb8Xd1QVR+6PmGTaHdTY1mm/8osFTW1JLuG8="
[mod."github.com/evmos/ethermint"]
version = "v0.6.1-0.20220919141022-34226aa7b1fa"
hash = "sha256-nB33iGrT+i6jB9qBLRhcSKyMsDuqzRj4WKv3XfNmOyI="
version = "v0.6.1-0.20220923160625-35850e620d28"
hash = "sha256-vm0U1fl+C59CijYjZURo5tk5sLdnjjOdBMwqWxc22x8="
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.2"
hash = "sha256-hj6FZQ1fDAV+1wGIViAt8XaAkWZ1I5vJzgjIJa7XRBA="
Expand Down
8 changes: 5 additions & 3 deletions integration_tests/configs/cosmovisor.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ config {
},
genesis+: {
app_state+: {
feemarket: {
params: {
no_base_fee: true,
feemarket+: {
params+: {
no_base_fee: false,
base_fee:: super.base_fee,
initial_base_fee: super.base_fee,
},
},
},
Expand Down
18 changes: 18 additions & 0 deletions integration_tests/configs/cosmovisor_gravity.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
local config = import 'default.jsonnet';

config {
'cronos_777-1'+: {
'app-config'+: {
'minimum-gas-prices': '100000000000basetcro',
},
genesis+: {
app_state+: {
feemarket+: {
params+: {
no_base_fee: true,
},
},
},
},
},
}
18 changes: 18 additions & 0 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from .network import Cronos, setup_custom_cronos
from .utils import (
ADDRS,
CONTRACTS,
deploy_contract,
parse_events,
send_transaction,
wait_for_block,
Expand Down Expand Up @@ -91,6 +93,13 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos):
target_height = height + 15
print("upgrade height", target_height)

w3 = custom_cronos.w3
contract = deploy_contract(w3, CONTRACTS["TestERC20A"])
old_height = w3.eth.block_number
old_balance = w3.eth.get_balance(ADDRS["validator"], block_identifier=old_height)
old_base_fee = w3.eth.get_block(old_height).baseFeePerGas
print("old values", old_height, old_balance, old_base_fee)

plan_name = "v0.9.0"
rsp = cli.gov_propose_v0_7(
"community",
Expand Down Expand Up @@ -146,3 +155,12 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos):
},
)
assert receipt.status == 1

# query json-rpc on older blocks should success
assert old_balance == w3.eth.get_balance(
ADDRS["validator"], block_identifier=old_height
)
assert old_base_fee == w3.eth.get_block(old_height).baseFeePerGas

# check eth_call works on older blocks
contract.caller(block_identifier=target_height - 2).balanceOf(ADDRS["validator"])
2 changes: 1 addition & 1 deletion integration_tests/test_upgrade_gravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def custom_cronos(tmp_path_factory):
yield from setup_custom_cronos(
path,
26100,
Path(__file__).parent / "configs/cosmovisor.jsonnet",
Path(__file__).parent / "configs/cosmovisor_gravity.jsonnet",
post_init=post_init,
chain_binary=str(path / "upgrades/genesis/bin/cronosd"),
)
Expand Down