Commit 6de6b5fc authored by Joshua Gutow's avatar Joshua Gutow Committed by GitHub

Switch common.Hex2Bytes to common.FromHex (#9283)

parent 5eacf435
...@@ -17,31 +17,31 @@ func TestCreate2Address(t *testing.T) { ...@@ -17,31 +17,31 @@ func TestCreate2Address(t *testing.T) {
{ {
name: "SafeL2", name: "SafeL2",
creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(), creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(),
salt: common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000000"), salt: common.FromHex("0000000000000000000000000000000000000000000000000000000000000000"),
expectedAddress: common.HexToAddress("0x3E5c63644E683549055b9Be8653de26E0B4CD36E"), expectedAddress: common.HexToAddress("0x3E5c63644E683549055b9Be8653de26E0B4CD36E"),
}, },
{ {
name: "MultiSendCallOnly", name: "MultiSendCallOnly",
creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(), creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(),
salt: common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000000"), salt: common.FromHex("0000000000000000000000000000000000000000000000000000000000000000"),
expectedAddress: common.HexToAddress("0x40A2aCCbd92BCA938b02010E17A5b8929b49130D"), expectedAddress: common.HexToAddress("0x40A2aCCbd92BCA938b02010E17A5b8929b49130D"),
}, },
{ {
name: "MultiSend", name: "MultiSend",
creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(), creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(),
salt: common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000000"), salt: common.FromHex("0000000000000000000000000000000000000000000000000000000000000000"),
expectedAddress: common.HexToAddress("0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"), expectedAddress: common.HexToAddress("0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"),
}, },
{ {
name: "Permit2", name: "Permit2",
creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(), creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(),
salt: common.Hex2Bytes("0000000000000000000000000000000000000000d3af2663da51c10215000000"), salt: common.FromHex("0000000000000000000000000000000000000000d3af2663da51c10215000000"),
expectedAddress: common.HexToAddress("0x000000000022D473030F116dDEE9F6B43aC78BA3"), expectedAddress: common.HexToAddress("0x000000000022D473030F116dDEE9F6B43aC78BA3"),
}, },
{ {
name: "EntryPoint", name: "EntryPoint",
creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(), creatorAddress: common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C").Bytes(),
salt: common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000000"), salt: common.FromHex("0000000000000000000000000000000000000000000000000000000000000000"),
expectedAddress: common.HexToAddress("0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"), expectedAddress: common.HexToAddress("0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"),
}, },
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -38,7 +38,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) { ...@@ -38,7 +38,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) {
{ {
name: "EmptyOracleData", name: "EmptyOracleData",
data: &types.PreimageOracleData{}, data: &types.PreimageOracleData{},
expectedUUID: new(big.Int).SetBytes(common.Hex2Bytes("827b659bbda2a0bdecce2c91b8b68462545758f3eba2dbefef18e0daf84f5ccd")), expectedUUID: new(big.Int).SetBytes(common.FromHex("827b659bbda2a0bdecce2c91b8b68462545758f3eba2dbefef18e0daf84f5ccd")),
}, },
{ {
name: "OracleDataAndOffset_Control", name: "OracleDataAndOffset_Control",
...@@ -46,7 +46,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) { ...@@ -46,7 +46,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) {
OracleData: []byte{1, 2, 3}, OracleData: []byte{1, 2, 3},
OracleOffset: 0x010203, OracleOffset: 0x010203,
}, },
expectedUUID: new(big.Int).SetBytes(common.Hex2Bytes("641e230bcf3ade8c71b7e591d210184cdb190e853f61ba59a1411c3b7aca9890")), expectedUUID: new(big.Int).SetBytes(common.FromHex("641e230bcf3ade8c71b7e591d210184cdb190e853f61ba59a1411c3b7aca9890")),
}, },
{ {
name: "OracleDataAndOffset_DifferentOffset", name: "OracleDataAndOffset_DifferentOffset",
...@@ -54,7 +54,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) { ...@@ -54,7 +54,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) {
OracleData: []byte{1, 2, 3}, OracleData: []byte{1, 2, 3},
OracleOffset: 0x010204, OracleOffset: 0x010204,
}, },
expectedUUID: new(big.Int).SetBytes(common.Hex2Bytes("aec56de44401325420e5793f72b777e3e547778de7d8344004b31be086a3136d")), expectedUUID: new(big.Int).SetBytes(common.FromHex("aec56de44401325420e5793f72b777e3e547778de7d8344004b31be086a3136d")),
}, },
{ {
name: "OracleDataAndOffset_DifferentData", name: "OracleDataAndOffset_DifferentData",
...@@ -62,7 +62,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) { ...@@ -62,7 +62,7 @@ func TestLargePreimageUploader_NewUUID(t *testing.T) {
OracleData: []byte{1, 2, 3, 4}, OracleData: []byte{1, 2, 3, 4},
OracleOffset: 0x010203, OracleOffset: 0x010203,
}, },
expectedUUID: new(big.Int).SetBytes(common.Hex2Bytes("ca38aa17d56805cf26376a050c2c7b15b6be4e709bc422a1c679fe21aa6aa8c7")), expectedUUID: new(big.Int).SetBytes(common.FromHex("ca38aa17d56805cf26376a050c2c7b15b6be4e709bc422a1c679fe21aa6aa8c7")),
}, },
} }
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
) )
var absolutePrestate = common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000060") var absolutePrestate = common.FromHex("0000000000000000000000000000000000000000000000000000000000000060")
var absolutePrestateInt = new(big.Int).SetBytes(absolutePrestate) var absolutePrestateInt = new(big.Int).SetBytes(absolutePrestate)
var _ types.PrestateProvider = (*AlphabetPrestateProvider)(nil) var _ types.PrestateProvider = (*AlphabetPrestateProvider)(nil)
......
...@@ -84,9 +84,9 @@ func TestGetStepData(t *testing.T) { ...@@ -84,9 +84,9 @@ func TestGetStepData(t *testing.T) {
provider, generator := setupWithTestData(t, dataDir, prestate) provider, generator := setupWithTestData(t, dataDir, prestate)
value, proof, data, err := provider.GetStepData(context.Background(), PositionFromTraceIndex(provider, new(big.Int))) value, proof, data, err := provider.GetStepData(context.Background(), PositionFromTraceIndex(provider, new(big.Int)))
require.NoError(t, err) require.NoError(t, err)
expected := common.Hex2Bytes("b8f068de604c85ea0e2acd437cdb47add074a2d70b81d018390c504b71fe26f400000000000000000000000000000000000000000000000000000000000000000000000000") expected := common.FromHex("b8f068de604c85ea0e2acd437cdb47add074a2d70b81d018390c504b71fe26f400000000000000000000000000000000000000000000000000000000000000000000000000")
require.Equal(t, expected, value) require.Equal(t, expected, value)
expectedProof := common.Hex2Bytes("08028e3c0000000000000000000000003c01000a24210b7c00200008000000008fa40004") expectedProof := common.FromHex("08028e3c0000000000000000000000003c01000a24210b7c00200008000000008fa40004")
require.Equal(t, expectedProof, proof) require.Equal(t, expectedProof, proof)
// TODO: Need to add some oracle data // TODO: Need to add some oracle data
require.Nil(t, data) require.Nil(t, data)
...@@ -207,9 +207,9 @@ func TestGetStepData(t *testing.T) { ...@@ -207,9 +207,9 @@ func TestGetStepData(t *testing.T) {
provider, generator := setupWithTestData(t, dataDir, prestate) provider, generator := setupWithTestData(t, dataDir, prestate)
value, proof, data, err := provider.GetStepData(context.Background(), PositionFromTraceIndex(provider, big.NewInt(2))) value, proof, data, err := provider.GetStepData(context.Background(), PositionFromTraceIndex(provider, big.NewInt(2)))
require.NoError(t, err) require.NoError(t, err)
expected := common.Hex2Bytes("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc") expected := common.FromHex("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc")
require.Equal(t, expected, value) require.Equal(t, expected, value)
expectedProof := common.Hex2Bytes("dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd") expectedProof := common.FromHex("dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd")
require.Equal(t, expectedProof, proof) require.Equal(t, expectedProof, proof)
require.Empty(t, generator.generated) require.Empty(t, generator.generated)
require.Nil(t, data) require.Nil(t, data)
......
...@@ -167,15 +167,15 @@ func TestCreateLocalContext(t *testing.T) { ...@@ -167,15 +167,15 @@ func TestCreateLocalContext(t *testing.T) {
prePosition: types.NewPositionFromGIndex(big.NewInt(2)), prePosition: types.NewPositionFromGIndex(big.NewInt(2)),
postValue: common.HexToHash("cc00000000000000000000000000000000000000000000000000000000000000"), postValue: common.HexToHash("cc00000000000000000000000000000000000000000000000000000000000000"),
postPosition: types.NewPositionFromGIndex(big.NewInt(3)), postPosition: types.NewPositionFromGIndex(big.NewInt(3)),
expected: common.Hex2Bytes("abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567890000000000000000000000000000000000000000000000000000000000000002cc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003"), expected: common.FromHex("abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567890000000000000000000000000000000000000000000000000000000000000002cc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003"),
}, },
{ {
name: "LargePositions", name: "LargePositions",
preValue: common.HexToHash("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"), preValue: common.HexToHash("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"),
prePosition: types.NewPositionFromGIndex(new(big.Int).SetBytes(common.Hex2Bytes("cbcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678c"))), prePosition: types.NewPositionFromGIndex(new(big.Int).SetBytes(common.FromHex("cbcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678c"))),
postValue: common.HexToHash("dd00000000000000000000000000000000000000000000000000000000000000"), postValue: common.HexToHash("dd00000000000000000000000000000000000000000000000000000000000000"),
postPosition: types.NewPositionFromGIndex(new(big.Int).SetUint64(math.MaxUint64)), postPosition: types.NewPositionFromGIndex(new(big.Int).SetUint64(math.MaxUint64)),
expected: common.Hex2Bytes("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789cbcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678cdd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff"), expected: common.FromHex("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789cbcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678cdd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff"),
}, },
{ {
name: "AbsolutePreState", name: "AbsolutePreState",
...@@ -183,7 +183,7 @@ func TestCreateLocalContext(t *testing.T) { ...@@ -183,7 +183,7 @@ func TestCreateLocalContext(t *testing.T) {
prePosition: types.Position{}, prePosition: types.Position{},
postValue: common.HexToHash("cc00000000000000000000000000000000000000000000000000000000000000"), postValue: common.HexToHash("cc00000000000000000000000000000000000000000000000000000000000000"),
postPosition: types.NewPositionFromGIndex(big.NewInt(3)), postPosition: types.NewPositionFromGIndex(big.NewInt(3)),
expected: common.Hex2Bytes("cc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003"), expected: common.FromHex("cc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003"),
}, },
} }
......
...@@ -43,7 +43,7 @@ func TestStateCommitment(t *testing.T) { ...@@ -43,7 +43,7 @@ func TestStateCommitment(t *testing.T) {
t.Run("", func(t *testing.T) { t.Run("", func(t *testing.T) {
state := NewStateMatrix() state := NewStateMatrix()
copy(state.s.a[:], test.matrix) copy(state.s.a[:], test.matrix)
expected := crypto.Keccak256Hash(common.Hex2Bytes(test.expectedPacked)) expected := crypto.Keccak256Hash(common.FromHex(test.expectedPacked))
actual := state.StateCommitment() actual := state.StateCommitment()
require.Equal(t, test.expectedPacked, common.Bytes2Hex(state.StateSnapshot().Pack())) require.Equal(t, test.expectedPacked, common.Bytes2Hex(state.StateSnapshot().Pack()))
require.Equal(t, expected, actual) require.Equal(t, expected, actual)
......
...@@ -334,11 +334,11 @@ func createPayloadWithWithdrawals(w *types.Withdrawals) *ExecutionPayload { ...@@ -334,11 +334,11 @@ func createPayloadWithWithdrawals(w *types.Withdrawals) *ExecutionPayload {
GasLimit: Uint64Quantity(333), GasLimit: Uint64Quantity(333),
GasUsed: Uint64Quantity(444), GasUsed: Uint64Quantity(444),
Timestamp: Uint64Quantity(555), Timestamp: Uint64Quantity(555),
ExtraData: common.Hex2Bytes("6666"), ExtraData: common.FromHex("6666"),
BaseFeePerGas: *uint256.NewInt(777), BaseFeePerGas: *uint256.NewInt(777),
BlockHash: common.HexToHash("0x888"), BlockHash: common.HexToHash("0x888"),
Withdrawals: w, Withdrawals: w,
Transactions: []Data{common.Hex2Bytes("9999")}, Transactions: []Data{common.FromHex("9999")},
} }
} }
......
...@@ -356,7 +356,7 @@ func TestVerifyReceipts(t *testing.T) { ...@@ -356,7 +356,7 @@ func TestVerifyReceipts(t *testing.T) {
Type: 2, Type: 2,
Status: 0, Status: 0,
CumulativeGasUsed: 0x3035b, CumulativeGasUsed: 0x3035b,
Bloom: types.BytesToBloom(common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), Bloom: types.BytesToBloom(common.FromHex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")),
Logs: nil, Logs: nil,
TxHash: txHashes[0], TxHash: txHashes[0],
GasUsed: 0x3035b, GasUsed: 0x3035b,
...@@ -369,7 +369,7 @@ func TestVerifyReceipts(t *testing.T) { ...@@ -369,7 +369,7 @@ func TestVerifyReceipts(t *testing.T) {
Type: 2, Type: 2,
Status: 1, Status: 1,
CumulativeGasUsed: 0xa9ae4, CumulativeGasUsed: 0xa9ae4,
Bloom: types.BytesToBloom(common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), Bloom: types.BytesToBloom(common.FromHex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")),
Logs: nil, Logs: nil,
TxHash: txHashes[1], TxHash: txHashes[1],
GasUsed: 0x79789, GasUsed: 0x79789,
...@@ -382,7 +382,7 @@ func TestVerifyReceipts(t *testing.T) { ...@@ -382,7 +382,7 @@ func TestVerifyReceipts(t *testing.T) {
Type: 0, Type: 0,
Status: 1, Status: 1,
CumulativeGasUsed: 0x101f09, CumulativeGasUsed: 0x101f09,
Bloom: types.BytesToBloom(common.Hex2Bytes("00000000000000000000000000000200000400000000000000000000000000800000000000040000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002002000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000800000000000000000000000000000000000000000000000000000400000000000000020000000000000000000000000002000000000000000000000000000000000000000000")), Bloom: types.BytesToBloom(common.FromHex("00000000000000000000000000000200000400000000000000000000000000800000000000040000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002002000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000800000000000000000000000000000000000000000000000000000400000000000000020000000000000000000000000002000000000000000000000000000000000000000000")),
Logs: []*types.Log{ Logs: []*types.Log{
{ {
Address: common.HexToAddress("0x759c5e44a9e4be8b7e9bd25a790ceb662c924c45"), Address: common.HexToAddress("0x759c5e44a9e4be8b7e9bd25a790ceb662c924c45"),
...@@ -391,7 +391,7 @@ func TestVerifyReceipts(t *testing.T) { ...@@ -391,7 +391,7 @@ func TestVerifyReceipts(t *testing.T) {
common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000426a80"), common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000426a80"),
common.HexToHash("0x000000000000000000000000a6275ee214f80a532c3abee0a4cbbc2d1dc22a72"), common.HexToHash("0x000000000000000000000000a6275ee214f80a532c3abee0a4cbbc2d1dc22a72"),
}, },
Data: common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000005dc"), Data: common.FromHex("00000000000000000000000000000000000000000000000000000000000005dc"),
BlockNumber: block.Number, BlockNumber: block.Number,
TxHash: txHashes[2], TxHash: txHashes[2],
TxIndex: 2, TxIndex: 2,
...@@ -411,7 +411,7 @@ func TestVerifyReceipts(t *testing.T) { ...@@ -411,7 +411,7 @@ func TestVerifyReceipts(t *testing.T) {
Type: 0, Type: 0,
Status: 1, Status: 1,
CumulativeGasUsed: 0x1227ab, CumulativeGasUsed: 0x1227ab,
Bloom: types.BytesToBloom(common.Hex2Bytes("00000000000000000000000000000200000400000000000000000000000000800000000000040000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002002000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000800000000000000000000000000000000000000000000000000000400000000000000020000000000000000000000000002000000000000000000000000000000000000000000")), Bloom: types.BytesToBloom(common.FromHex("00000000000000000000000000000200000400000000000000000000000000800000000000040000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002002000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000800000000000000000000000000000000000000000000000000000400000000000000020000000000000000000000000002000000000000000000000000000000000000000000")),
Logs: []*types.Log{ Logs: []*types.Log{
{ {
Address: common.HexToAddress("0x759c5e44a9e4be8b7e9bd25a790ceb662c924c45"), Address: common.HexToAddress("0x759c5e44a9e4be8b7e9bd25a790ceb662c924c45"),
...@@ -420,7 +420,7 @@ func TestVerifyReceipts(t *testing.T) { ...@@ -420,7 +420,7 @@ func TestVerifyReceipts(t *testing.T) {
common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000426a80"), common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000426a80"),
common.HexToHash("0x000000000000000000000000a6275ee214f80a532c3abee0a4cbbc2d1dc22a72"), common.HexToHash("0x000000000000000000000000a6275ee214f80a532c3abee0a4cbbc2d1dc22a72"),
}, },
Data: common.Hex2Bytes("00000000000000000000000000000000000000000000000000000000000005dc"), Data: common.FromHex("00000000000000000000000000000000000000000000000000000000000005dc"),
BlockNumber: block.Number, BlockNumber: block.Number,
TxHash: txHashes[3], TxHash: txHashes[3],
TxIndex: 3, TxIndex: 3,
......
...@@ -30,11 +30,11 @@ func TestRethDBReceiptsLoad(t *testing.T) { ...@@ -30,11 +30,11 @@ func TestRethDBReceiptsLoad(t *testing.T) {
require.Equal(t, receipt.Type, uint8(2)) require.Equal(t, receipt.Type, uint8(2))
require.Equal(t, receipt.Status, uint64(1)) require.Equal(t, receipt.Status, uint64(1))
require.Equal(t, receipt.CumulativeGasUsed, uint64(115_316)) require.Equal(t, receipt.CumulativeGasUsed, uint64(115_316))
require.Equal(t, receipt.Bloom, types.BytesToBloom(common.Hex2Bytes("00200000000000000000000080001000000000000000000000000000000000000000000000000000000000000000100002000100080000000000000000000000000000000000000000000008000000200000000400000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000400000000000001000000000000000100000000080000004000000000000000000000000000000000000002000000000000000000000000000000000000000006000000000000000000000000000000000000001000000000000000000000200000000000000100000000020000000000000000000000000000000010"))) require.Equal(t, receipt.Bloom, types.BytesToBloom(common.FromHex("00200000000000000000000080001000000000000000000000000000000000000000000000000000000000000000100002000100080000000000000000000000000000000000000000000008000000200000000400000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000400000000000001000000000000000100000000080000004000000000000000000000000000000000000002000000000000000000000000000000000000000006000000000000000000000000000000000000001000000000000000000000200000000000000100000000020000000000000000000000000000000010")))
require.Equal(t, receipt.Logs[0].Address, common.HexToAddress("c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2")) require.Equal(t, receipt.Logs[0].Address, common.HexToAddress("c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"))
require.Equal(t, receipt.Logs[0].Topics[0], common.HexToHash("ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")) require.Equal(t, receipt.Logs[0].Topics[0], common.HexToHash("ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"))
require.Equal(t, receipt.Logs[0].Topics[1], common.HexToHash("00000000000000000000000000000000003b3cc22af3ae1eac0440bcee416b40")) require.Equal(t, receipt.Logs[0].Topics[1], common.HexToHash("00000000000000000000000000000000003b3cc22af3ae1eac0440bcee416b40"))
require.Equal(t, receipt.Logs[0].Data, common.Hex2Bytes("00000000000000000000000000000000000000000000000008a30cd230000000")) require.Equal(t, receipt.Logs[0].Data, common.FromHex("00000000000000000000000000000000000000000000000008a30cd230000000"))
require.Equal(t, receipt.TxHash, common.HexToHash("0x88b2d153a4e893ba91ac235325c44b1aa0c802fcb42657701e1a73e1c675f7ca")) require.Equal(t, receipt.TxHash, common.HexToHash("0x88b2d153a4e893ba91ac235325c44b1aa0c802fcb42657701e1a73e1c675f7ca"))
require.Equal(t, receipt.BlockHash, blockHash) require.Equal(t, receipt.BlockHash, blockHash)
......
...@@ -106,7 +106,7 @@ func NextRandomL2Ref(rng *rand.Rand, l2BlockTime uint64, parent eth.L2BlockRef, ...@@ -106,7 +106,7 @@ func NextRandomL2Ref(rng *rand.Rand, l2BlockTime uint64, parent eth.L2BlockRef,
// Output is deterministic when the supplied rng generates the same random sequence. // Output is deterministic when the supplied rng generates the same random sequence.
func InsecureRandomKey(rng *rand.Rand) *ecdsa.PrivateKey { func InsecureRandomKey(rng *rand.Rand) *ecdsa.PrivateKey {
idx := rng.Intn(len(randomEcdsaKeys)) idx := rng.Intn(len(randomEcdsaKeys))
key, err := crypto.ToECDSA(common.Hex2Bytes(randomEcdsaKeys[idx])) key, err := crypto.ToECDSA(common.FromHex(randomEcdsaKeys[idx]))
if err != nil { if err != nil {
// Should never happen because the list of keys is hard coded and known to be valid. // Should never happen because the list of keys is hard coded and known to be valid.
panic(fmt.Errorf("invalid pre-generated ecdsa key at index %v: %w", idx, err)) panic(fmt.Errorf("invalid pre-generated ecdsa key at index %v: %w", idx, err))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment