From b13818b457b73bddc8c0e5beae7a5c499fb3ce68 Mon Sep 17 00:00:00 2001 From: Philip Su Date: Mon, 25 Nov 2024 19:19:03 -0800 Subject: [PATCH 1/6] v6.0.1 release --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ go.mod | 6 ++---- go.sum | 11 ++++------- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index feaf9502c9..3fa1a77dc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,33 @@ Ref: https://keepachangelog.com/en/1.0.0/ --> # Changelog +## v6.0.1 +sei-chain +* [#1956](https://github.com/sei-protocol/sei-chain/pull/1956) Assign owner correctly when there are multiple transfers +* [#1955](https://github.com/sei-protocol/sei-chain/pull/1955) Add missing modules to migration and add command to export IAVL +* [#1954](https://github.com/sei-protocol/sei-chain/pull/1954) Enable Queries to IAVL for Non-Migrating Nodes +* [#1952](https://github.com/sei-protocol/sei-chain/pull/1952) Fix for failed txs in block +* [#1951](https://github.com/sei-protocol/sei-chain/pull/1951) Add max base fee as a param +* [#1949](https://github.com/sei-protocol/sei-chain/pull/1949) Be resilient to failing txs in debug trace block +* [#1941](https://github.com/sei-protocol/sei-chain/pull/1941) Fix eth_getLogs missing events early return +* [#1932](https://github.com/sei-protocol/sei-chain/pull/1932) Use owner event to populate ERC721 transfer topic +* [#1930](https://github.com/sei-protocol/sei-chain/pull/1930) Exclude cosmos txs from base fee calculation +* [#1926](https://github.com/sei-protocol/sei-chain/pull/1926) Refactor x/bank precompile to use dynamic gas +* [#1922](https://github.com/sei-protocol/sei-chain/pull/1922) Use msg server send in bank precompile +* [#1913](https://github.com/sei-protocol/sei-chain/pull/1913) Use tendermint store to get Tx hashes instead of storing explicitly +* [#1906](https://github.com/sei-protocol/sei-chain/pull/1906) Remove vue code +* [#1908](https://github.com/sei-protocol/sei-chain/pull/1908) QuerySmart to always use cached ctx + + +sei-cosmos +* [#551](https://github.com/sei-protocol/sei-cosmos/pull/551) Param change verification +* [#553](https://github.com/sei-protocol/sei-cosmos/pull/553) Remove unnecessary serving logs + +sei-wasmd +* [#67](https://github.com/sei-protocol/sei-wasmd/pull/67) Emit CW721 token owner before transfer +* [#65](https://github.com/sei-protocol/sei-wasmd/pull/65) Add QuerySmartSafe in WasmViewKeeper + + ## v6.0.0 sei-chain * [#1905](https://github.com/sei-protocol/sei-chain/pull/1905) Use limited wasm gas meter diff --git a/go.mod b/go.mod index 3b2e906fd6..2637699b90 100644 --- a/go.mod +++ b/go.mod @@ -125,7 +125,6 @@ require ( github.com/fzipp/gocyclo v0.5.1 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect - github.com/ghodss/yaml v1.0.0 // indirect github.com/go-critic/go-critic v0.6.3 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect @@ -173,7 +172,6 @@ require ( github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-bexpr v0.1.10 // indirect @@ -346,9 +344,9 @@ require ( ) replace ( - github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.2.8 + github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.2.9 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.45 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.47 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.20241120141252-bf6b5923d7d7 diff --git a/go.sum b/go.sum index 237eacc4af..9038a56c8d 100644 --- a/go.sum +++ b/go.sum @@ -457,7 +457,6 @@ github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2Gihuqh github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -766,8 +765,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/guptarohit/asciigraph v0.5.5/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtXM6x7SRWZ3KGag= @@ -1350,8 +1347,8 @@ github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241120141252-bf6b5923d7d7 github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241120141252-bf6b5923d7d7/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.45 h1:l6ss5Y4OC+vvu+74lWz8EUBJN68x0CRuaEYtqA+TvOs= -github.com/sei-protocol/sei-cosmos v0.3.45/go.mod h1:ZwWxF/69WlcLEn4BzVjPPToTFkE2sjPanU8PNNyKoOk= +github.com/sei-protocol/sei-cosmos v0.3.47 h1:EOwbEEGiozCqfU5NnA9thdL6LGJjKWkoKs+b+EkMe0Y= +github.com/sei-protocol/sei-cosmos v0.3.47/go.mod h1:ZwWxF/69WlcLEn4BzVjPPToTFkE2sjPanU8PNNyKoOk= github.com/sei-protocol/sei-db v0.0.45 h1:95ygzGFMyvaGwEUmzlKi8MxwXfbluoNzbaIjy9zOG6o= github.com/sei-protocol/sei-db v0.0.45/go.mod h1:m5g7p0QeAS3dNJHIl28zQpzOgxQmvYqPb7t4hwgIOCA= github.com/sei-protocol/sei-iavl v0.2.0 h1:OisPjXiDT+oe+aeckzDEFgkZCYuUjHgs/PP8DPicN+I= @@ -1362,8 +1359,8 @@ github.com/sei-protocol/sei-tendermint v0.4.3 h1:/Nx3Q309B4N61P3e6ScYiVuHgBRdapc github.com/sei-protocol/sei-tendermint v0.4.3/go.mod h1:4LSlJdhl3nf3OmohliwRNUFLOB1XWlrmSodrIP7fLh4= github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY= github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY= -github.com/sei-protocol/sei-wasmd v0.2.8 h1:b7tnn3quY1msT0smbXIFdz83NXn8eYn5ARE0ShC6+1o= -github.com/sei-protocol/sei-wasmd v0.2.8/go.mod h1:gcBpeDTCqCscmYq5/rYuRZW0r3pGSO3rs5MUlPucSDY= +github.com/sei-protocol/sei-wasmd v0.2.9 h1:fqWITa0I8EIhk4oCpM+KIzKUJHH/2+zTgAPX8v1WaYY= +github.com/sei-protocol/sei-wasmd v0.2.9/go.mod h1:gcBpeDTCqCscmYq5/rYuRZW0r3pGSO3rs5MUlPucSDY= github.com/sei-protocol/tm-db v0.0.4 h1:7Y4EU62Xzzg6wKAHEotm7SXQR0aPLcGhKHkh3qd0tnk= github.com/sei-protocol/tm-db v0.0.4/go.mod h1:PWsIWOTwdwC7Ow/GUvx8HgUJTO691pBuorIQD8JvwAs= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= From 221b19e536e936bcdff1bc7cdda082cdbdce7717 Mon Sep 17 00:00:00 2001 From: Philip Su Date: Mon, 25 Nov 2024 19:45:58 -0800 Subject: [PATCH 2/6] Add upgrade --- app/upgrades.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/upgrades.go b/app/upgrades.go index 1c1715f8c1..155ad55434 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -112,6 +112,7 @@ var upgradesList = []string{ "v5.8.0", "v5.9.0", "v6.0.0", + "v6.0.1", } // if there is an override list, use that instead, for integration tests From 129a0ee0554c193946a0448de1f58478898c9071 Mon Sep 17 00:00:00 2001 From: Jeremy Wei Date: Tue, 26 Nov 2024 14:03:44 -0500 Subject: [PATCH 3/6] Fix max base fee upgrade (#1965) * add more tests, bump consensus version * add upgrade to upgrades.go for testing * Revert "add upgrade to upgrades.go for testing" This reverts commit 3b35a908f75c83d05319bcda1fa49a1a7c5106d2. --- .../migrate_eip_1559_max_base_fee_test.go | 26 +++++++++++++++++++ x/evm/module.go | 2 +- x/evm/module_test.go | 2 +- x/evm/types/params_test.go | 9 +++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 x/evm/migrations/migrate_eip_1559_max_base_fee_test.go diff --git a/x/evm/migrations/migrate_eip_1559_max_base_fee_test.go b/x/evm/migrations/migrate_eip_1559_max_base_fee_test.go new file mode 100644 index 0000000000..9ca4376a47 --- /dev/null +++ b/x/evm/migrations/migrate_eip_1559_max_base_fee_test.go @@ -0,0 +1,26 @@ +package migrations_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper" + "github.com/sei-protocol/sei-chain/x/evm/migrations" + "github.com/stretchr/testify/require" + tmtypes "github.com/tendermint/tendermint/proto/tendermint/types" +) + +func TestMigrateEip1559MaxBaseFee(t *testing.T) { + k := testkeeper.EVMTestApp.EvmKeeper + ctx := testkeeper.EVMTestApp.NewContext(false, tmtypes.Header{}) + + keeperParams := k.GetParams(ctx) + keeperParams.MaximumFeePerGas = sdk.NewDec(123) + + // Perform the migration + err := migrations.MigrateEip1559MaxFeePerGas(ctx, &k) + require.NoError(t, err) + + // Ensure that the new EIP-1559 parameters were migrated and the old ones were not changed + require.Equal(t, keeperParams.MaximumFeePerGas, sdk.NewDec(123)) +} diff --git a/x/evm/module.go b/x/evm/module.go index 29b504d85e..436130340b 100644 --- a/x/evm/module.go +++ b/x/evm/module.go @@ -262,7 +262,7 @@ func (am AppModule) ExportGenesisStream(ctx sdk.Context, cdc codec.JSONCodec) <- } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 14 } +func (AppModule) ConsensusVersion() uint64 { return 15 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/evm/module_test.go b/x/evm/module_test.go index bfa9afae60..7342282e0d 100644 --- a/x/evm/module_test.go +++ b/x/evm/module_test.go @@ -60,7 +60,7 @@ func TestModuleExportGenesis(t *testing.T) { func TestConsensusVersion(t *testing.T) { k, _ := testkeeper.MockEVMKeeper() module := evm.NewAppModule(nil, k) - assert.Equal(t, uint64(14), module.ConsensusVersion()) + assert.Equal(t, uint64(15), module.ConsensusVersion()) } func TestABCI(t *testing.T) { diff --git a/x/evm/types/params_test.go b/x/evm/types/params_test.go index 7b09701271..8474b13bbb 100644 --- a/x/evm/types/params_test.go +++ b/x/evm/types/params_test.go @@ -88,6 +88,15 @@ func TestValidateParamsInvalidDeliverTxHookWasmGasLimit(t *testing.T) { require.Contains(t, err.Error(), "invalid deliver_tx_hook_wasm_gas_limit: must be greater than 0") } +func TestValidateParamsInvalidMaxFeePerGas(t *testing.T) { + params := types.DefaultParams() + params.MaximumFeePerGas = sdk.NewDec(-1) // Set to invalid negative value + + err := params.Validate() + require.Error(t, err) + require.Contains(t, err.Error(), "negative max fee per gas") +} + func TestValidateParamsValidDeliverTxHookWasmGasLimit(t *testing.T) { params := types.DefaultParams() From 04f19a21ca913c0d8ccccc27137a24456ef2850f Mon Sep 17 00:00:00 2001 From: yirenz Date: Wed, 27 Nov 2024 10:44:14 -0500 Subject: [PATCH 4/6] revert: 150% gasUsed refund limit policy (#1967) * revert: 150% gasUsed refund limit policy * fix unit test --- go.mod | 2 +- go.sum | 4 ++-- precompiles/bank/bank_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 2637699b90..f7f0cd920c 100644 --- a/go.mod +++ b/go.mod @@ -349,7 +349,7 @@ replace ( github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.47 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.20241120141252-bf6b5923d7d7 + github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241126162048-86648c51118c 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.45 // Latest goleveldb is broken, we have to stick to this version diff --git a/go.sum b/go.sum index 9038a56c8d..63a81e6849 100644 --- a/go.sum +++ b/go.sum @@ -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.20241120141252-bf6b5923d7d7 h1:5G1wqz9+1lDKQIpnoaP/oXneLfuhJozPd1/BDNCtaxw= -github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241120141252-bf6b5923d7d7/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ= +github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241126162048-86648c51118c h1:SmV5dTPMgLOBG1p9bNpuBxJKFftehzdhSPdcrCowo4A= +github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241126162048-86648c51118c/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.47 h1:EOwbEEGiozCqfU5NnA9thdL6LGJjKWkoKs+b+EkMe0Y= diff --git a/precompiles/bank/bank_test.go b/precompiles/bank/bank_test.go index 4a88ac6cef..d488749f9c 100644 --- a/precompiles/bank/bank_test.go +++ b/precompiles/bank/bank_test.go @@ -193,7 +193,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(101398)))), + banktypes.NewCoinReceivedEvent(senderAddr, sdk.NewCoins(sdk.NewCoin("usei", sdk.NewInt(132401)))), // tip is paid to the validator banktypes.NewCoinReceivedEvent(sdk.MustAccAddressFromBech32("sei1v4mx6hmrda5kucnpwdjsqqqqqqqqqqqqlve8dv"), sdk.NewCoins(sdk.NewCoin("usei", sdk.NewInt(67599)))), } @@ -244,7 +244,7 @@ func TestRun(t *testing.T) { Denom: "ufoo", }, bank.CoinBalance(parsedBalances[0])) require.Equal(t, bank.CoinBalance{ - Amount: big.NewInt(9901387), + Amount: big.NewInt(9932390), Denom: "usei", }, bank.CoinBalance(parsedBalances[1])) From a5aba95c4555709e05db23e99d4b955eb1218aad Mon Sep 17 00:00:00 2001 From: Kartik Bhat Date: Wed, 27 Nov 2024 11:51:26 -0500 Subject: [PATCH 5/6] Ignore Version during Set Earliest Version (#1968) * Ignore Version during Set Earliest Version * Bump sei cosmos seidb --- app/test_state_store.go | 2 +- app/test_state_store_test.go | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- tools/migration/ss/migrator.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/test_state_store.go b/app/test_state_store.go index a5b0711450..194390f863 100644 --- a/app/test_state_store.go +++ b/app/test_state_store.go @@ -143,7 +143,7 @@ func (s *InMemoryStateStore) GetEarliestVersion() (int64, error) { return s.earliestVersion, nil } -func (s *InMemoryStateStore) SetEarliestVersion(version int64) error { +func (s *InMemoryStateStore) SetEarliestVersion(version int64, ignoreVersion bool) error { s.mu.Lock() defer s.mu.Unlock() diff --git a/app/test_state_store_test.go b/app/test_state_store_test.go index 141294b58c..f82bf057ec 100644 --- a/app/test_state_store_test.go +++ b/app/test_state_store_test.go @@ -126,7 +126,7 @@ func TestGetLatestVersionAndSetLatestVersion(t *testing.T) { func TestGetEarliestVersionAndSetEarliestVersion(t *testing.T) { store := NewInMemoryStateStore() - err := store.SetEarliestVersion(1) + err := store.SetEarliestVersion(1, false) assert.NoError(t, err) version, err := store.GetEarliestVersion() diff --git a/go.mod b/go.mod index f7f0cd920c..a292dce574 100644 --- a/go.mod +++ b/go.mod @@ -346,12 +346,12 @@ require ( replace ( github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.2.9 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 - github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.47 + github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.48 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.20241126162048-86648c51118c 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.45 + github.com/sei-protocol/sei-db => github.com/sei-protocol/sei-db v0.0.46 // Latest goleveldb is broken, we have to stick to this version github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.4.3 diff --git a/go.sum b/go.sum index 63a81e6849..e0a76f2ac1 100644 --- a/go.sum +++ b/go.sum @@ -1347,10 +1347,10 @@ github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241126162048-86648c51118c github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241126162048-86648c51118c/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.47 h1:EOwbEEGiozCqfU5NnA9thdL6LGJjKWkoKs+b+EkMe0Y= -github.com/sei-protocol/sei-cosmos v0.3.47/go.mod h1:ZwWxF/69WlcLEn4BzVjPPToTFkE2sjPanU8PNNyKoOk= -github.com/sei-protocol/sei-db v0.0.45 h1:95ygzGFMyvaGwEUmzlKi8MxwXfbluoNzbaIjy9zOG6o= -github.com/sei-protocol/sei-db v0.0.45/go.mod h1:m5g7p0QeAS3dNJHIl28zQpzOgxQmvYqPb7t4hwgIOCA= +github.com/sei-protocol/sei-cosmos v0.3.48 h1:kSDweeTaLZ4TByLqAD6/hmtgAhAJHwXU1beyqsVXJkQ= +github.com/sei-protocol/sei-cosmos v0.3.48/go.mod h1:XC417pB6NwxP/cQ2XTSZLzVnP8dMZ//4uCXS3SxFgoM= +github.com/sei-protocol/sei-db v0.0.46 h1:naXfSp1I3UgJJm/iSvXpdFzr9nofEOxp/EekcAVj7wY= +github.com/sei-protocol/sei-db v0.0.46/go.mod h1:m5g7p0QeAS3dNJHIl28zQpzOgxQmvYqPb7t4hwgIOCA= github.com/sei-protocol/sei-iavl v0.2.0 h1:OisPjXiDT+oe+aeckzDEFgkZCYuUjHgs/PP8DPicN+I= github.com/sei-protocol/sei-iavl v0.2.0/go.mod h1:qRf8QYUPfrAO7K6VDB2B2l/N7K5L76OorioGBcJBIbw= github.com/sei-protocol/sei-ibc-go/v3 v3.3.2 h1:BaMZ6gjwqe3R/5dLmcJ1TkSZ3omcWy2TjaAZAeOJH44= diff --git a/tools/migration/ss/migrator.go b/tools/migration/ss/migrator.go index 1da6d26672..e737a86133 100644 --- a/tools/migration/ss/migrator.go +++ b/tools/migration/ss/migrator.go @@ -65,7 +65,7 @@ func (m *Migrator) Migrate(version int64, homeDir string) error { } // Set earliest and latest version in the database - err = m.stateStore.SetEarliestVersion(1) + err = m.stateStore.SetEarliestVersion(1, true) if err != nil { return err } From f257cbfd114d9dd6a967182f9a2a29c2d4004ece Mon Sep 17 00:00:00 2001 From: Yiming Zang <50607998+yzang2019@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:55:34 -0800 Subject: [PATCH 6/6] [Bug Fix] getLogs endpoint should check whether or not to include cosmos Txs based on namespace (#1988) * Fix GetEthLogs: getEvmTxHashesFromBlock should exclude cosmos txs * Fix unit test * Fix test failure and add a check for synthetic logs * Fix test * Fix log * Increase fee * Add fee * Test --- contracts/test/lib.js | 13 +++++++-- evmrpc/block.go | 12 ++++++-- evmrpc/block_test.go | 32 +++++++++++----------- evmrpc/filter.go | 13 ++++----- evmrpc/filter_test.go | 23 ++++++---------- evmrpc/setup_test.go | 64 +++++++++++++++++++++---------------------- evmrpc/state_test.go | 2 +- evmrpc/tx_test.go | 4 +-- evmrpc/utils.go | 22 +++++++-------- go.mod | 2 +- go.sum | 4 +-- 11 files changed, 100 insertions(+), 91 deletions(-) diff --git a/contracts/test/lib.js b/contracts/test/lib.js index 94a1388740..04ca795aa6 100644 --- a/contracts/test/lib.js +++ b/contracts/test/lib.js @@ -286,14 +286,14 @@ async function instantiateWasm(codeId, adminAddr, label, args = {}, from=adminKe return getEventAttribute(response, "instantiate", "_contract_address"); } -async function proposeCW20toERC20Upgrade(erc20Address, cw20Address, title="erc20-pointer", version=99, description="erc20 pointer",fees="20000usei", from=adminKeyName) { +async function proposeCW20toERC20Upgrade(erc20Address, cw20Address, title="erc20-pointer", version=99, description="erc20 pointer",fees="200000usei", from=adminKeyName) { const command = `seid tx evm add-cw-erc20-pointer "${title}" "${description}" ${erc20Address} ${version} 200000000usei ${cw20Address} --from ${from} --fees ${fees} -y -o json --broadcast-mode=block` const output = await execute(command); const proposalId = getEventAttribute(JSON.parse(output), "submit_proposal", "proposal_id") return await passProposal(proposalId) } -async function passProposal(proposalId, desposit="200000000usei", fees="20000usei", from=adminKeyName) { +async function passProposal(proposalId, desposit="200000000usei", fees="200000usei", from=adminKeyName) { if(await isDocker()) { await executeOnAllNodes(`seid tx gov vote ${proposalId} yes --from node_admin -b block -y --fees ${fees}`) } else { @@ -330,6 +330,15 @@ async function registerPointerForERC721(erc721Address, fees="20000usei", from=ad return getEventAttribute(response, "pointer_registered", "pointer_address") } +async function registerPointerForERC1155(erc1155Address, fees="200000usei", from=adminKeyName) { + const command = `seid tx evm register-cw-pointer ERC1155 ${erc1155Address} --from ${from} --fees ${fees} --broadcast-mode block -y -o json` + const output = await execute(command); + const response = JSON.parse(output) + if(response.code !== 0) { + throw new Error("contract deployment failed") + } + return getEventAttribute(response, "pointer_registered", "pointer_address") +} async function getSeiAddress(evmAddress) { const command = `seid q evm sei-addr ${evmAddress} -o json` diff --git a/evmrpc/block.go b/evmrpc/block.go index 6ce9290fdb..93043f209c 100644 --- a/evmrpc/block.go +++ b/evmrpc/block.go @@ -40,7 +40,15 @@ type BlockAPI struct { } func NewBlockAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txConfig client.TxConfig, connectionType ConnectionType, namespace string) *BlockAPI { - return &BlockAPI{tmClient: tmClient, keeper: k, ctxProvider: ctxProvider, txConfig: txConfig, connectionType: connectionType, includeShellReceipts: shouldIncludeSynthetic(namespace)} + return &BlockAPI{ + tmClient: tmClient, + keeper: k, + ctxProvider: ctxProvider, + txConfig: txConfig, + connectionType: connectionType, + namespace: namespace, + includeShellReceipts: shouldIncludeSynthetic(namespace), + } } func (a *BlockAPI) GetBlockTransactionCountByNumber(ctx context.Context, number rpc.BlockNumber) (result *hexutil.Uint, returnErr error) { @@ -150,7 +158,7 @@ func (a *BlockAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.Block // Get all tx hashes for the block height := block.Block.Header.Height - txHashes := getEvmTxHashesFromBlock(block, a.txConfig) + txHashes := getTxHashesFromBlock(block, a.txConfig, shouldIncludeSynthetic(a.namespace)) // Get tx receipts for all hashes in parallel wg := sync.WaitGroup{} mtx := sync.Mutex{} diff --git a/evmrpc/block_test.go b/evmrpc/block_test.go index 2082f8b47b..398679d589 100644 --- a/evmrpc/block_test.go +++ b/evmrpc/block_test.go @@ -80,16 +80,16 @@ func TestGetBlockReceipts(t *testing.T) { // Query by block height resObj := sendRequestGood(t, "getBlockReceipts", "0x2") result := resObj["result"].([]interface{}) - require.Equal(t, 5, len(result)) + require.Equal(t, 3, len(result)) receipt1 := result[0].(map[string]interface{}) require.Equal(t, "0x2", receipt1["blockNumber"]) - require.Equal(t, "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", receipt1["transactionHash"]) + require.Equal(t, multiTxBlockTx1.Hash().Hex(), receipt1["transactionHash"]) receipt2 := result[1].(map[string]interface{}) require.Equal(t, "0x2", receipt2["blockNumber"]) - require.Equal(t, multiTxBlockTx1.Hash().Hex(), receipt2["transactionHash"]) + require.Equal(t, multiTxBlockTx2.Hash().Hex(), receipt2["transactionHash"]) receipt3 := result[2].(map[string]interface{}) require.Equal(t, "0x2", receipt3["blockNumber"]) - require.Equal(t, "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", receipt3["transactionHash"]) + require.Equal(t, multiTxBlockTx3.Hash().Hex(), receipt3["transactionHash"]) resObjSei := sendSeiRequestGood(t, "getBlockReceipts", "0x2") result = resObjSei["result"].([]interface{}) @@ -98,21 +98,21 @@ func TestGetBlockReceipts(t *testing.T) { // Query by block hash resObj2 := sendRequestGood(t, "getBlockReceipts", "0x0000000000000000000000000000000000000000000000000000000000000002") result = resObj2["result"].([]interface{}) - require.Equal(t, 5, len(result)) + require.Equal(t, 3, len(result)) receipt1 = result[0].(map[string]interface{}) require.Equal(t, "0x2", receipt1["blockNumber"]) - require.Equal(t, "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", receipt1["transactionHash"]) + require.Equal(t, multiTxBlockTx1.Hash().Hex(), receipt1["transactionHash"]) receipt2 = result[1].(map[string]interface{}) require.Equal(t, "0x2", receipt2["blockNumber"]) - require.Equal(t, multiTxBlockTx1.Hash().Hex(), receipt2["transactionHash"]) + require.Equal(t, multiTxBlockTx2.Hash().Hex(), receipt2["transactionHash"]) receipt3 = result[2].(map[string]interface{}) require.Equal(t, "0x2", receipt3["blockNumber"]) - require.Equal(t, "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", receipt3["transactionHash"]) + require.Equal(t, multiTxBlockTx3.Hash().Hex(), receipt3["transactionHash"]) // Query by tag latest => retrieves block 8 resObj3 := sendRequestGood(t, "getBlockReceipts", "latest") result = resObj3["result"].([]interface{}) - require.Equal(t, 2, len(result)) + require.Equal(t, 1, len(result)) receipt1 = result[0].(map[string]interface{}) require.Equal(t, "0x8", receipt1["blockNumber"]) require.Equal(t, tx1.Hash().Hex(), receipt1["transactionHash"]) @@ -192,10 +192,10 @@ func TestEncodeTmBlock_EmptyTransactions(t *testing.T) { block := &coretypes.ResultBlock{ BlockID: MockBlockID, Block: &tmtypes.Block{ - Header: mockBlockHeader(MockHeight), + Header: mockBlockHeader(MockHeight8), Data: tmtypes.Data{}, LastCommit: &tmtypes.Commit{ - Height: MockHeight - 1, + Height: MockHeight8 - 1, }, }, } @@ -228,7 +228,7 @@ func TestEncodeBankMsg(t *testing.T) { resBlock := coretypes.ResultBlock{ BlockID: MockBlockID, Block: &tmtypes.Block{ - Header: mockBlockHeader(MockHeight), + Header: mockBlockHeader(MockHeight8), Data: tmtypes.Data{ Txs: []tmtypes.Tx{func() []byte { bz, _ := Encoder(tx) @@ -236,7 +236,7 @@ func TestEncodeBankMsg(t *testing.T) { }()}, }, LastCommit: &tmtypes.Commit{ - Height: MockHeight - 1, + Height: MockHeight8 - 1, }, }, } @@ -282,12 +282,12 @@ func TestEncodeWasmExecuteMsg(t *testing.T) { resBlock := coretypes.ResultBlock{ BlockID: MockBlockID, Block: &tmtypes.Block{ - Header: mockBlockHeader(MockHeight), + Header: mockBlockHeader(MockHeight8), Data: tmtypes.Data{ Txs: []tmtypes.Tx{bz}, }, LastCommit: &tmtypes.Commit{ - Height: MockHeight - 1, + Height: MockHeight8 - 1, }, }, } @@ -313,7 +313,7 @@ func TestEncodeWasmExecuteMsg(t *testing.T) { to := common.Address(toSeiAddr) require.Equal(t, ðapi.RPCTransaction{ BlockHash: &bh, - BlockNumber: (*hexutil.Big)(big.NewInt(MockHeight)), + BlockNumber: (*hexutil.Big)(big.NewInt(MockHeight8)), From: fromEvmAddr, To: &to, Input: []byte{1, 2, 3}, diff --git a/evmrpc/filter.go b/evmrpc/filter.go index 9bda11057e..9fa04266fa 100644 --- a/evmrpc/filter.go +++ b/evmrpc/filter.go @@ -360,16 +360,13 @@ func (f *LogFetcher) FindBlockesByBloom(begin, end int64, filters [][]bloomIndex func (f *LogFetcher) FindLogsByBloom(height int64, filters [][]bloomIndexes) (res []*ethtypes.Log) { ctx := f.ctxProvider(LatestCtxHeight) - block, err := blockByNumberWithRetry(context.Background(), f.tmClient, &height, 1) - if err != nil { - fmt.Printf("error getting block when querying logs: %s\n", err) - return - } - - for _, hash := range getEvmTxHashesFromBlock(block, f.txConfig) { + for _, hash := range getTxHashesFromBlock(block, f.txConfig, f.includeSyntheticReceipts) { receipt, err := f.k.GetReceipt(ctx, hash) if err != nil { - ctx.Logger().Error(fmt.Sprintf("FindLogsByBloom: unable to find receipt for hash %s", hash.Hex())) + // ignore the error if receipt is not found when includeSyntheticReceipts is true + if !f.includeSyntheticReceipts { + ctx.Logger().Error(fmt.Sprintf("FindLogsByBloom: unable to find receipt for hash %s", hash.Hex())) + } continue } if !f.includeSyntheticReceipts && (receipt.TxType == ShellEVMTxType || receipt.EffectiveGasPrice == 0) { diff --git a/evmrpc/filter_test.go b/evmrpc/filter_test.go index 49570d3ff5..1d301c40d8 100644 --- a/evmrpc/filter_test.go +++ b/evmrpc/filter_test.go @@ -1,7 +1,6 @@ package evmrpc_test import ( - "fmt" "testing" "time" @@ -202,8 +201,8 @@ func TestFilterSeiGetLogs(t *testing.T) { testFilterGetLogs(t, "sei", []GetFilterLogTests{ { name: "filter by single synthetic address", - fromBlock: "0x8", - toBlock: "0x8", + fromBlock: "0x64", + toBlock: "0x64", addrs: []common.Address{common.HexToAddress("0x1111111111111111111111111111111111111116")}, wantErr: false, check: func(t *testing.T, log map[string]interface{}) { @@ -212,21 +211,18 @@ func TestFilterSeiGetLogs(t *testing.T) { wantLen: 1, }, { - name: "filter by single topic with default range, include synethetic logs", - topics: [][]common.Hash{{common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000234")}}, - wantErr: false, + name: "filter by single topic, include synethetic logs", + topics: [][]common.Hash{{common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000234")}}, + wantErr: false, + fromBlock: "0x64", + toBlock: "0x64", check: func(t *testing.T, log map[string]interface{}) { require.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000234", log["topics"].([]interface{})[0].(string)) }, wantLen: 1, }, - }) -} - -func TestFilterEthEndpointCanReturnSyntheticLogs(t *testing.T) { - testFilterGetLogs(t, "eth", []GetFilterLogTests{ { - name: "filter by single topic with default range, still include synthetic logs", + name: "filter by single topic with default range, include synethetic logs", topics: [][]common.Hash{{common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000234")}}, wantErr: false, check: func(t *testing.T, log map[string]interface{}) { @@ -257,7 +253,6 @@ func TestFilterEthEndpointReturnsNormalEvmLogEvenIfSyntheticLogIsInSameBlock(t * func testFilterGetLogs(t *testing.T, namespace string, tests []GetFilterLogTests) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - fmt.Println(tt.name) filterCriteria := map[string]interface{}{ "address": tt.addrs, "topics": tt.topics, @@ -302,7 +297,7 @@ func TestFilterGetFilterLogs(t *testing.T) { resObj = sendRequest(t, TestPort, "getFilterLogs", filterId) logs := resObj["result"].([]interface{}) - require.Equal(t, 6, len(logs)) + require.Equal(t, 4, len(logs)) for _, log := range logs { logObj := log.(map[string]interface{}) require.Equal(t, "0x2", logObj["blockNumber"].(string)) diff --git a/evmrpc/setup_test.go b/evmrpc/setup_test.go index 0c8d74e2af..1097d8c985 100644 --- a/evmrpc/setup_test.go +++ b/evmrpc/setup_test.go @@ -47,10 +47,10 @@ const TestPort = 7777 const TestWSPort = 7778 const TestBadPort = 7779 -const MockHeight = 8 -const MultiTxBlockHeight = 2 -const DebugTraceMockHeight = 101 -const SyntheticBlockHeight = 100 +const MockHeight8 = 8 +const MockHeight2 = 2 +const MockHeight101 = 101 +const MockHeight100 = 100 var DebugTraceHashHex = "0x1234567890123456789023456789012345678901234567890123456789000004" var DebugTraceBlockHash = "BE17E0261E539CB7E9A91E123A6D794E0163D656FCF9B8EAC07823F7ED28512B" @@ -129,7 +129,7 @@ func mockBlockHeader(height int64) tmtypes.Header { } func (c *MockClient) mockBlock(height int64) *coretypes.ResultBlock { - if height == MultiTxBlockHeight { + if height == MockHeight2 { return &coretypes.ResultBlock{ BlockID: MockBlockIDMultiTx, Block: &tmtypes.Block{ @@ -168,7 +168,7 @@ func (c *MockClient) mockBlock(height int64) *coretypes.ResultBlock { }, } } - if height == SyntheticBlockHeight { + if height == MockHeight100 { return &coretypes.ResultBlock{ BlockID: MockBlockID, Block: &tmtypes.Block{ @@ -205,11 +205,11 @@ func (c *MockClient) mockBlock(height int64) *coretypes.ResultBlock { }, }, LastCommit: &tmtypes.Commit{ - Height: MockHeight - 1, + Height: MockHeight8 - 1, }, }, } - if height == DebugTraceMockHeight { + if height == MockHeight101 { res.Block.Data.Txs = []tmtypes.Tx{ func() []byte { bz, _ := Encoder(DebugTraceTx) @@ -278,7 +278,7 @@ func (c *MockClient) Genesis(context.Context) (*coretypes.ResultGenesis, error) } func (c *MockClient) Block(_ context.Context, h *int64) (*coretypes.ResultBlock, error) { - height := int64(MockHeight) + height := int64(MockHeight8) if h != nil { height = *h } @@ -287,12 +287,12 @@ func (c *MockClient) Block(_ context.Context, h *int64) (*coretypes.ResultBlock, func (c *MockClient) BlockByHash(_ context.Context, hash bytes.HexBytes) (*coretypes.ResultBlock, error) { if hash.String() == DebugTraceBlockHash { - return c.mockBlock(DebugTraceMockHeight), nil + return c.mockBlock(MockHeight101), nil } if hash.String() == MultiTxBlockHash { - return c.mockBlock(MultiTxBlockHeight), nil + return c.mockBlock(MockHeight2), nil } - return c.mockBlock(MockHeight), nil + return c.mockBlock(MockHeight8), nil } func (c *MockClient) BlockResults(_ context.Context, height *int64) (*coretypes.ResultBlockResults, error) { @@ -351,7 +351,7 @@ func (c *MockClient) Events(_ context.Context, req *coretypes.RequestEvents) (*c panic("invalid cursor") } } else { - cursor = MockHeight + cursor = MockHeight8 } resultBlock := c.mockBlock(int64(cursor)) data := tmtypes.EventDataNewBlock{ @@ -397,7 +397,7 @@ func (c *MockClient) BroadcastTx(context.Context, tmtypes.Tx) (*coretypes.Result } func (c *MockClient) Tx(context.Context, bytes.HexBytes, bool) (*coretypes.ResultTx, error) { - return &coretypes.ResultTx{Hash: bytes.HexBytes(TestCosmosTxHash), Height: MockHeight, TxResult: abci.ExecTxResult{EvmTxInfo: &abci.EvmTxInfo{TxHash: TestEvmTxHash}}}, nil + return &coretypes.ResultTx{Hash: bytes.HexBytes(TestCosmosTxHash), Height: MockHeight8, TxResult: abci.ExecTxResult{EvmTxInfo: &abci.EvmTxInfo{TxHash: TestEvmTxHash}}}, nil } func (c *MockClient) UnconfirmedTxs(ctx context.Context, page, perPage *int) (*coretypes.ResultUnconfirmedTxs, error) { @@ -459,7 +459,7 @@ func init() { } testApp.Commit(context.Background()) ctxProvider := func(height int64) sdk.Context { - if height == MultiTxBlockHeight { + if height == MockHeight2 { return MultiTxCtx } return Ctx @@ -597,12 +597,12 @@ func generateTxData() { From: "0x1234567890123456789012345678901234567890", To: "0x1234567890123456789012345678901234567890", TransactionIndex: 0, - BlockNumber: MockHeight, + BlockNumber: MockHeight8, TxType: 1, ContractAddress: "0x1234567890123456789012345678901234567890", - CumulativeGasUsed: 123, + CumulativeGasUsed: 124, TxHashHex: tx1.Hash().Hex(), - GasUsed: 55, + GasUsed: 56, Status: 0, EffectiveGasPrice: 100000000000, Logs: []*types.Log{{ @@ -700,9 +700,9 @@ func setupLogs() { common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000123"), }, }}}}) - CtxMultiTx := Ctx.WithBlockHeight(MultiTxBlockHeight) + CtxMultiTx := Ctx.WithBlockHeight(MockHeight2) EVMKeeper.MockReceipt(CtxMultiTx, multiTxBlockTx1.Hash(), &types.Receipt{ - BlockNumber: MultiTxBlockHeight, + BlockNumber: MockHeight2, TransactionIndex: 1, // start at 1 bc 0 is the non-evm tx TxHashHex: multiTxBlockTx1.Hash().Hex(), LogsBloom: bloom1[:], @@ -723,7 +723,7 @@ func setupLogs() { }, }}}}) EVMKeeper.MockReceipt(CtxMultiTx, multiTxBlockTx2.Hash(), &types.Receipt{ - BlockNumber: MultiTxBlockHeight, + BlockNumber: MockHeight2, TransactionIndex: 3, TxHashHex: multiTxBlockTx2.Hash().Hex(), LogsBloom: bloom2[:], @@ -741,7 +741,7 @@ func setupLogs() { }, }}}}) EVMKeeper.MockReceipt(CtxMultiTx, multiTxBlockTx3.Hash(), &types.Receipt{ - BlockNumber: MultiTxBlockHeight, + BlockNumber: MockHeight2, TransactionIndex: 4, TxHashHex: multiTxBlockTx3.Hash().Hex(), LogsBloom: bloom3[:], @@ -758,9 +758,9 @@ func setupLogs() { common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000456"), }, }}}}) - CtxMock := Ctx.WithBlockHeight(MockHeight) + CtxMock := Ctx.WithBlockHeight(MockHeight8) EVMKeeper.MockReceipt(CtxMock, multiTxBlockTx4.Hash(), &types.Receipt{ - BlockNumber: MockHeight, + BlockNumber: MockHeight8, TransactionIndex: 1, TxHashHex: multiTxBlockTx4.Hash().Hex(), LogsBloom: bloom4[:], @@ -780,7 +780,7 @@ func setupLogs() { }}}}) EVMKeeper.MockReceipt(CtxMock, multiTxBlockSynthTx.Hash(), &types.Receipt{ TxType: evmrpc.ShellEVMTxType, - BlockNumber: MockHeight, + BlockNumber: MockHeight100, TransactionIndex: 0, TxHashHex: multiTxBlockSynthTx.Hash().Hex(), LogsBloom: bloomSynth[:], @@ -791,16 +791,16 @@ func setupLogs() { }}, EffectiveGasPrice: 0, }) - CtxDebugTrace := Ctx.WithBlockHeight(DebugTraceMockHeight) + CtxDebugTrace := Ctx.WithBlockHeight(MockHeight101) EVMKeeper.MockReceipt(CtxDebugTrace, common.HexToHash(DebugTraceHashHex), &types.Receipt{ - BlockNumber: DebugTraceMockHeight, + BlockNumber: MockHeight101, TransactionIndex: 0, TxHashHex: DebugTraceHashHex, }) txNonEvmBz, _ := Encoder(TxNonEvmWithSyntheticLog) txNonEvmHash := sha256.Sum256(txNonEvmBz) EVMKeeper.MockReceipt(CtxMultiTx, txNonEvmHash, &types.Receipt{ - BlockNumber: MultiTxBlockHeight, + BlockNumber: MockHeight2, TransactionIndex: 1, TxHashHex: common.Hash(txNonEvmHash).Hex(), LogsBloom: bloomSynth[:], @@ -812,16 +812,16 @@ func setupLogs() { EffectiveGasPrice: 100, }) - // block 8 - EVMKeeper.SetTxHashesOnHeight(Ctx, MultiTxBlockHeight, []common.Hash{ + // block 2 + EVMKeeper.SetTxHashesOnHeight(Ctx, MockHeight2, []common.Hash{ multiTxBlockTx1.Hash(), multiTxBlockTx2.Hash(), multiTxBlockTx3.Hash(), }) EVMKeeper.SetBlockBloom(MultiTxCtx, []ethtypes.Bloom{bloom1, bloom2, bloom3}) - // block 2 - EVMKeeper.SetTxHashesOnHeight(Ctx, MockHeight, []common.Hash{ + // block 8 + EVMKeeper.SetTxHashesOnHeight(Ctx, MockHeight8, []common.Hash{ multiTxBlockSynthTx.Hash(), multiTxBlockTx4.Hash(), }) diff --git a/evmrpc/state_test.go b/evmrpc/state_test.go index abcd6c9d87..f68a728bcf 100644 --- a/evmrpc/state_test.go +++ b/evmrpc/state_test.go @@ -210,7 +210,7 @@ func TestGetProof(t *testing.T) { _, evmAddr := testkeeper.MockAddressPair() key, val := []byte("test"), []byte("abc") testApp.EvmKeeper.SetState(testApp.GetContextForDeliverTx([]byte{}), evmAddr, common.BytesToHash(key), common.BytesToHash(val)) - for i := 0; i < MockHeight; i++ { + for i := 0; i < MockHeight8; i++ { testApp.FinalizeBlock(context.Background(), &abci.RequestFinalizeBlock{Height: int64(i + 1)}) testApp.SetDeliverStateToCommit() _, err := testApp.Commit(context.Background()) diff --git a/evmrpc/tx_test.go b/evmrpc/tx_test.go index e2d1896bf3..c5352d0fb4 100644 --- a/evmrpc/tx_test.go +++ b/evmrpc/tx_test.go @@ -43,10 +43,10 @@ func testGetTxReceipt(t *testing.T, namespace string) { resObj = resObj["result"].(map[string]interface{}) require.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000001", resObj["blockHash"].(string)) require.Equal(t, "0x8", resObj["blockNumber"].(string)) - require.Equal(t, "0x7b", resObj["cumulativeGasUsed"].(string)) + require.Equal(t, "0x7c", resObj["cumulativeGasUsed"].(string)) require.Equal(t, "0x174876e800", resObj["effectiveGasPrice"].(string)) require.Equal(t, "0x1234567890123456789012345678901234567890", resObj["from"].(string)) - require.Equal(t, "0x37", resObj["gasUsed"].(string)) + require.Equal(t, "0x38", resObj["gasUsed"].(string)) logs := resObj["logs"].([]interface{}) require.Equal(t, 1, len(logs)) log := logs[0].(map[string]interface{}) diff --git a/evmrpc/utils.go b/evmrpc/utils.go index 0d494c9495..953166e11c 100644 --- a/evmrpc/utils.go +++ b/evmrpc/utils.go @@ -207,7 +207,7 @@ func shouldIncludeSynthetic(namespace string) bool { return namespace == "sei" } -func getEvmTxHashesFromBlock(block *coretypes.ResultBlock, txConfig client.TxConfig) []common.Hash { +func getTxHashesFromBlock(block *coretypes.ResultBlock, txConfig client.TxConfig, shouldIncludeSynthetic bool) []common.Hash { txHashes := []common.Hash{} for i, tx := range block.Block.Data.Txs { sdkTx, err := txConfig.TxDecoder()(tx) @@ -215,18 +215,18 @@ func getEvmTxHashesFromBlock(block *coretypes.ResultBlock, txConfig client.TxCon fmt.Printf("error decoding tx %d in block %d, skipping\n", i, block.Block.Height) continue } - if len(sdkTx.GetMsgs()) == 0 { - txHashes = append(txHashes, sha256.Sum256(tx)) - continue - } - if evmTx, ok := sdkTx.GetMsgs()[0].(*types.MsgEVMTransaction); ok { - if evmTx.IsAssociateTx() { - continue + if len(sdkTx.GetMsgs()) > 0 { + if evmTx, ok := sdkTx.GetMsgs()[0].(*types.MsgEVMTransaction); ok { + if evmTx.IsAssociateTx() { + continue + } + ethtx, _ := evmTx.AsTransaction() + txHashes = append(txHashes, ethtx.Hash()) } - ethtx, _ := evmTx.AsTransaction() - txHashes = append(txHashes, ethtx.Hash()) } - txHashes = append(txHashes, sha256.Sum256(tx)) + if shouldIncludeSynthetic { + txHashes = append(txHashes, sha256.Sum256(tx)) + } } return txHashes } diff --git a/go.mod b/go.mod index a292dce574..9fcd571eec 100644 --- a/go.mod +++ b/go.mod @@ -349,7 +349,7 @@ replace ( github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.48 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.20241126162048-86648c51118c + github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-24 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.46 // Latest goleveldb is broken, we have to stick to this version diff --git a/go.sum b/go.sum index e0a76f2ac1..16c5623845 100644 --- a/go.sum +++ b/go.sum @@ -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.20241126162048-86648c51118c h1:SmV5dTPMgLOBG1p9bNpuBxJKFftehzdhSPdcrCowo4A= -github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20241126162048-86648c51118c/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ= +github.com/sei-protocol/go-ethereum v1.13.5-sei-24 h1:XgpUFzEZbg8XWMmjl/MtTW8q5Gr43dGyzDlDZ24BT+g= +github.com/sei-protocol/go-ethereum v1.13.5-sei-24/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.48 h1:kSDweeTaLZ4TByLqAD6/hmtgAhAJHwXU1beyqsVXJkQ=