Skip to content

Commit

Permalink
bump geth to pull in gas refund changes (#1871)
Browse files Browse the repository at this point in the history
* bump geth to pull in gas refund changes

* fix unit tests

* remove all balance checks

* skip some failing block tests

* skip some failing block tests

* fix bank_test.go

* remove commented out balance checks
  • Loading branch information
jewei1997 authored Sep 25, 2024
1 parent 6c8b336 commit 71711a1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ replace (
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.37-0.20240923023912-aa7a702d42cc
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.2.0
github.com/cosmos/ibc-go/v3 => github.com/sei-protocol/sei-ibc-go/v3 v3.3.2
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923025222-815b87dde97b
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923122925-0050f0abba7b
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/sei-protocol/sei-db => github.com/sei-protocol/sei-db v0.0.44
// Latest goleveldb is broken, we have to stick to this version
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,8 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod
github.com/securego/gosec/v2 v2.11.0 h1:+PDkpzR41OI2jrw1q6AdXZCbsNGNGT7pQjal0H0cArI=
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923025222-815b87dde97b h1:mVNX02TN7XlxkZliA752umeOB5MegtMroeIzdFGbgBk=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923025222-815b87dde97b/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923122925-0050f0abba7b h1:cxonMwt+Ry3ovjncQCBI6XqT/RWiU0N8dBNi6WJtY04=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923122925-0050f0abba7b/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
github.com/sei-protocol/goutils v0.0.2 h1:Bfa7Sv+4CVLNM20QcpvGb81B8C5HkQC/kW1CQpIbXDA=
github.com/sei-protocol/goutils v0.0.2/go.mod h1:iYE2DuJfEnM+APPehr2gOUXfuLuPsVxorcDO+Tzq9q8=
github.com/sei-protocol/sei-cosmos v0.3.37-0.20240923023912-aa7a702d42cc h1:srWLbsoS0NYBIl8OjZOFuPmIeqf+fJTkfsK39MmG3+k=
Expand Down
4 changes: 2 additions & 2 deletions precompiles/bank/bank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func TestRun(t *testing.T) {
sdk.NewAttribute(banktypes.AttributeKeySender, senderAddr.String()),
),
// gas refund to the sender
banktypes.NewCoinReceivedEvent(senderAddr, sdk.NewCoins(sdk.NewCoin("usei", sdk.NewInt(172056)))),
banktypes.NewCoinReceivedEvent(senderAddr, sdk.NewCoins(sdk.NewCoin("usei", sdk.NewInt(41916)))),
// tip is paid to the validator
banktypes.NewCoinReceivedEvent(sdk.MustAccAddressFromBech32("sei1v4mx6hmrda5kucnpwdjsqqqqqqqqqqqqlve8dv"), sdk.NewCoins(sdk.NewCoin("usei", sdk.NewInt(27944)))),
}
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestRun(t *testing.T) {
Denom: "ufoo",
}, bank.CoinBalance(parsedBalances[0]))
require.Equal(t, bank.CoinBalance{
Amount: big.NewInt(9972045),
Amount: big.NewInt(9841905),
Denom: "usei",
}, bank.CoinBalance(parsedBalances[1]))

Expand Down
3 changes: 3 additions & 0 deletions run_blocktests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ declare -a test_name_skip_list=(
"BLOCKHASH_Bounds" # failing
"logRevert" # uses an invalid opcode (0xBA)
"blockWithAllTransactionTypes" # recently started failing
"multimpleBalanceInstruction" # failing from 150% max gas refund change
"burnVerify" # failing from 150% max gas refund change
"refundReset" # failing from 150% max gas refund change

# invalid block tests - state tests
"gasLimitTooHigh" # block header gas limit doesn't apply to us
Expand Down
8 changes: 1 addition & 7 deletions x/evm/keeper/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,18 @@ func (k *Keeper) VerifyTxResult(ctx sdk.Context, hash common.Hash) {
}

func (k *Keeper) VerifyAccount(ctx sdk.Context, addr common.Address, accountData core.GenesisAccount) {
// we no longer check eth balance due to limiting EVM max refund to 150% of used gas (https://github.com/sei-protocol/go-ethereum/pull/32)
code := accountData.Code
for key, expectedState := range accountData.Storage {
actualState := k.GetState(ctx, addr, key)
if !bytes.Equal(actualState.Bytes(), expectedState.Bytes()) {
panic(fmt.Sprintf("storage mismatch for address %s: expected %X, got %X", addr.Hex(), expectedState, actualState))
}
}
balance := accountData.Balance
nonce := accountData.Nonce
if !bytes.Equal(code, k.GetCode(ctx, addr)) {
panic(fmt.Sprintf("code mismatch for address %s", addr))
}
useiBalance := k.BankKeeper().GetBalance(ctx, k.GetSeiAddressOrDefault(ctx, addr), "usei").Amount
weiBalance := k.bankKeeper.GetWeiBalance(ctx, k.GetSeiAddressOrDefault(ctx, addr))
totalSeiBalance := useiBalance.Mul(sdk.NewInt(1_000_000_000_000)).Add(weiBalance).BigInt()
if balance.Cmp(totalSeiBalance) != 0 {
panic(fmt.Sprintf("balance mismatch for address %s: expected %s, got %s", addr.Hex(), balance, totalSeiBalance))
}
if nonce != k.GetNonce(ctx, addr) {
panic(fmt.Sprintf("nonce mismatch for address %s: expected %d, got %d", addr.Hex(), nonce, k.GetNonce(ctx, addr)))
}
Expand Down

0 comments on commit 71711a1

Please sign in to comment.