Skip to content

Commit 620c03b

Browse files
authored
overwrite block hash in tracer response with tendermint block hash (#2117)
1 parent 4d74c37 commit 620c03b

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

evmrpc/simulate.go

+1
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ func (b Backend) BlockByNumber(ctx context.Context, bn rpc.BlockNumber) (*ethtyp
282282
Header_: header,
283283
Txs: txs,
284284
}
285+
block.OverwriteHash(common.BytesToHash(tmBlock.BlockID.Hash))
285286
return block, nil
286287
}
287288

evmrpc/tests/tracers_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package tests
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
)
8+
9+
func TestTraceBlockByNumber(t *testing.T) {
10+
txBz := signAndEncodeTx(send(0), mnemonic1)
11+
SetupTestServer([][][]byte{{txBz}}, mnemonicInitializer(mnemonic1)).Run(
12+
func(port int) {
13+
res := sendRequestWithNamespace("debug", port, "traceBlockByNumber", "0x2", map[string]interface{}{
14+
"timeout": "60s", "tracer": "flatCallTracer",
15+
})
16+
blockHash := res["result"].([]interface{})[0].(map[string]interface{})["result"].([]interface{})[0].(map[string]interface{})["blockHash"]
17+
// assert that the block hash has been overwritten instead of the RLP hash.
18+
require.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000002", blockHash.(string))
19+
},
20+
)
21+
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ replace (
354354
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.56-0.20250313190228-9fb9a4fd8636
355355
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.2.0
356356
github.com/cosmos/ibc-go/v3 => github.com/sei-protocol/sei-ibc-go/v3 v3.3.5
357-
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-27
357+
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-28
358358
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
359359
github.com/sei-protocol/sei-db => github.com/sei-protocol/sei-db v0.0.48
360360
// Latest goleveldb is broken, we have to stick to this version

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1344,8 +1344,8 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod
13441344
github.com/securego/gosec/v2 v2.11.0 h1:+PDkpzR41OI2jrw1q6AdXZCbsNGNGT7pQjal0H0cArI=
13451345
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
13461346
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
1347-
github.com/sei-protocol/go-ethereum v1.13.5-sei-27 h1:TYZLAoKSfE2N/63sFTTWh3djH59L9BxtQRSm2Q/8bLY=
1348-
github.com/sei-protocol/go-ethereum v1.13.5-sei-27/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
1347+
github.com/sei-protocol/go-ethereum v1.13.5-sei-28 h1:V+NAzqD74lL+j57u57oGv9g7gmr4VzbZStYnh5THXvI=
1348+
github.com/sei-protocol/go-ethereum v1.13.5-sei-28/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
13491349
github.com/sei-protocol/goutils v0.0.2 h1:Bfa7Sv+4CVLNM20QcpvGb81B8C5HkQC/kW1CQpIbXDA=
13501350
github.com/sei-protocol/goutils v0.0.2/go.mod h1:iYE2DuJfEnM+APPehr2gOUXfuLuPsVxorcDO+Tzq9q8=
13511351
github.com/sei-protocol/sei-cosmos v0.3.56-0.20250313190228-9fb9a4fd8636 h1:9RMstipSzuAgpwz8IcM+LvZB2frXSBolu8CRj660fI4=

0 commit comments

Comments
 (0)