Commit a5e715c3 authored by Maurelian's avatar Maurelian Committed by GitHub

ctb: Rename event in the L2ToL1MessagePasser (#3652)

* ctb: Rename event in the L2ToL1MessagePasser

The new name MessagePassed, is less confusing since the
name 'WithdrawalInitiated' is used in the L2 Bridge.

* Chore: bindings

* op-node: fix tests for MessagePassed topic 0

* chore: Changeset
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent e81c5c93
---
'@eth-optimism/contracts-bedrock': patch
'@eth-optimism/sdk': patch
---
Rename the event emitted in the L2ToL1MessagePasser
This diff is collapsed.
...@@ -13,7 +13,7 @@ const L2ToL1MessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":2546,\"co ...@@ -13,7 +13,7 @@ const L2ToL1MessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":2546,\"co
var L2ToL1MessagePasserStorageLayout = new(solc.StorageLayout) var L2ToL1MessagePasserStorageLayout = new(solc.StorageLayout)
var L2ToL1MessagePasserDeployedBin = "0x60806040526004361061005e5760003560e01c806382e3702d1161004357806382e3702d146100c7578063affed0e014610107578063c2b3e5ac1461012b57600080fd5b806344df8e701461008757806354fd4d501461009c57600080fd5b366100825761008033620186a060405180602001604052806000815250610139565b005b600080fd5b34801561009357600080fd5b5061008061026d565b3480156100a857600080fd5b506100b16102a5565b6040516100be9190610587565b60405180910390f35b3480156100d357600080fd5b506100f76100e23660046105a1565b60006020819052908152604090205460ff1681565b60405190151581526020016100be565b34801561011357600080fd5b5061011d60015481565b6040519081526020016100be565b6100806101393660046105e9565b600061019e6040518060c0016040528060015481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200134815260200185815260200184815250610348565b6000818152602081905260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915554905191925073ffffffffffffffffffffffffffffffffffffffff8616913391907f87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a61369061022c903490899089906106ed565b60405180910390a460405181907f2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb90600090a2505060018054810190555050565b4761027781610395565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606102d07f00000000000000000000000000000000000000000000000000000000000000006103c4565b6102f97f00000000000000000000000000000000000000000000000000000000000000006103c4565b6103227f00000000000000000000000000000000000000000000000000000000000000006103c4565b60405160200161033493929190610715565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761037897909695910161078b565b604051602081830303815290604052805190602001209050919050565b806040516103a290610501565b6040518091039082f09050801580156103bf573d6000803e3d6000fd5b505050565b60608160000361040757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610431578061041b81610811565b915061042a9050600a83610878565b915061040b565b60008167ffffffffffffffff81111561044c5761044c6105ba565b6040519080825280601f01601f191660200182016040528015610476576020820181803683370190505b5090505b84156104f95761048b60018361088c565b9150610498600a866108a3565b6104a39060306108b7565b60f81b8183815181106104b8576104b86108cf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506104f2600a86610878565b945061047a565b949350505050565b6008806108ff83390190565b60005b83811015610528578181015183820152602001610510565b83811115610537576000848401525b50505050565b6000815180845261055581602086016020860161050d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061059a602083018461053d565b9392505050565b6000602082840312156105b357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156105fe57600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461062257600080fd5b925060208401359150604084013567ffffffffffffffff8082111561064657600080fd5b818601915086601f83011261065a57600080fd5b81358181111561066c5761066c6105ba565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156106b2576106b26105ba565b816040528281528960208487010111156106cb57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b83815282602082015260606040820152600061070c606083018461053d565b95945050505050565b6000845161072781846020890161050d565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610763816001850160208a0161050d565b6001920191820152835161077e81600284016020880161050d565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526107d660c083018461053d565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610842576108426107e2565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261088757610887610849565b500490565b60008282101561089e5761089e6107e2565b500390565b6000826108b2576108b2610849565b500690565b600082198211156108ca576108ca6107e2565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a" var L2ToL1MessagePasserDeployedBin = "0x60806040526004361061005e5760003560e01c806382e3702d1161004357806382e3702d146100c7578063affed0e014610107578063c2b3e5ac1461012b57600080fd5b806344df8e701461008757806354fd4d501461009c57600080fd5b366100825761008033620186a060405180602001604052806000815250610139565b005b600080fd5b34801561009357600080fd5b5061008061026d565b3480156100a857600080fd5b506100b16102a5565b6040516100be9190610587565b60405180910390f35b3480156100d357600080fd5b506100f76100e23660046105a1565b60006020819052908152604090205460ff1681565b60405190151581526020016100be565b34801561011357600080fd5b5061011d60015481565b6040519081526020016100be565b6100806101393660046105e9565b600061019e6040518060c0016040528060015481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200134815260200185815260200184815250610348565b6000818152602081905260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915554905191925073ffffffffffffffffffffffffffffffffffffffff8616913391907f7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d729061022c903490899089906106ed565b60405180910390a460405181907fedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c90600090a2505060018054810190555050565b4761027781610395565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606102d07f00000000000000000000000000000000000000000000000000000000000000006103c4565b6102f97f00000000000000000000000000000000000000000000000000000000000000006103c4565b6103227f00000000000000000000000000000000000000000000000000000000000000006103c4565b60405160200161033493929190610715565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761037897909695910161078b565b604051602081830303815290604052805190602001209050919050565b806040516103a290610501565b6040518091039082f09050801580156103bf573d6000803e3d6000fd5b505050565b60608160000361040757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610431578061041b81610811565b915061042a9050600a83610878565b915061040b565b60008167ffffffffffffffff81111561044c5761044c6105ba565b6040519080825280601f01601f191660200182016040528015610476576020820181803683370190505b5090505b84156104f95761048b60018361088c565b9150610498600a866108a3565b6104a39060306108b7565b60f81b8183815181106104b8576104b86108cf565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506104f2600a86610878565b945061047a565b949350505050565b6008806108ff83390190565b60005b83811015610528578181015183820152602001610510565b83811115610537576000848401525b50505050565b6000815180845261055581602086016020860161050d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061059a602083018461053d565b9392505050565b6000602082840312156105b357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156105fe57600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461062257600080fd5b925060208401359150604084013567ffffffffffffffff8082111561064657600080fd5b818601915086601f83011261065a57600080fd5b81358181111561066c5761066c6105ba565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156106b2576106b26105ba565b816040528281528960208487010111156106cb57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b83815282602082015260606040820152600061070c606083018461053d565b95945050505050565b6000845161072781846020890161050d565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610763816001850160208a0161050d565b6001920191820152835161077e81600284016020880161050d565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526107d660c083018461053d565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610842576108426107e2565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261088757610887610849565b500490565b60008282101561089e5761089e6107e2565b500390565b6000826108b2576108b2610849565b500690565b600082198211156108ca576108ca6107e2565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a"
func init() { func init() {
if err := json.Unmarshal([]byte(L2ToL1MessagePasserStorageLayoutJSON), L2ToL1MessagePasserStorageLayout); err != nil { if err := json.Unmarshal([]byte(L2ToL1MessagePasserStorageLayoutJSON), L2ToL1MessagePasserStorageLayout); err != nil {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
{ {
"address": "0x4200000000000000000000000000000000000016", "address": "0x4200000000000000000000000000000000000016",
"topics": [ "topics": [
"0x87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a6136", "0x7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d72",
"0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000004200000000000000000000000000000000000007", "0x0000000000000000000000004200000000000000000000000000000000000007",
"0x0000000000000000000000006900000000000000000000000000000000000002" "0x0000000000000000000000006900000000000000000000000000000000000002"
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
{ {
"address": "0x4200000000000000000000000000000000000016", "address": "0x4200000000000000000000000000000000000016",
"topics": [ "topics": [
"0x2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb", "0xedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c",
"0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285" "0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"
], ],
"data": "0x", "data": "0x",
...@@ -131,4 +131,4 @@ ...@@ -131,4 +131,4 @@
"blockHash": "0xfdd4ad8a984b45687aca0463db491cbd0e85273d970019a3f8bf618b614938df", "blockHash": "0xfdd4ad8a984b45687aca0463db491cbd0e85273d970019a3f8bf618b614938df",
"blockNumber": "0x36", "blockNumber": "0x36",
"transactionIndex": "0x1" "transactionIndex": "0x1"
} }
\ No newline at end of file
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
) )
var WithdrawalInitiatedTopic = crypto.Keccak256Hash([]byte("WithdrawalInitiated(uint256,address,address,uint256,uint256,bytes)")) var MessagePassedTopic = crypto.Keccak256Hash([]byte("MessagePassed(uint256,address,address,uint256,uint256,bytes)"))
var WithdrawalInitiatedExtension1Topic = crypto.Keccak256Hash([]byte("WithdrawalInitiatedExtension1(bytes32)")) var MessagePassedExtension1Topic = crypto.Keccak256Hash([]byte("MessagePassedExtension1(bytes32)"))
// WaitForFinalizationPeriod waits until there is OutputProof for an L2 block number larger than the supplied l2BlockNumber // WaitForFinalizationPeriod waits until there is OutputProof for an L2 block number larger than the supplied l2BlockNumber
// and that the output is finalized. // and that the output is finalized.
...@@ -172,11 +172,11 @@ func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txH ...@@ -172,11 +172,11 @@ func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txH
return FinalizedWithdrawalParameters{}, err return FinalizedWithdrawalParameters{}, err
} }
// Parse the receipt // Parse the receipt
ev, err := ParseWithdrawalInitiated(receipt) ev, err := ParseMessagePassed(receipt)
if err != nil { if err != nil {
return FinalizedWithdrawalParameters{}, err return FinalizedWithdrawalParameters{}, err
} }
ev1, err := ParseWithdrawalInitiatedExtension1(receipt) ev1, err := ParseMessagePassedExtension1(receipt)
if err != nil { if err != nil {
return FinalizedWithdrawalParameters{}, err return FinalizedWithdrawalParameters{}, err
} }
...@@ -244,7 +244,7 @@ var ( ...@@ -244,7 +244,7 @@ var (
// - I don't like having to use the ABI Generated struct // - I don't like having to use the ABI Generated struct
// - There should be a better way to run the ABI encoding // - There should be a better way to run the ABI encoding
// - These needs to be fuzzed against the solidity // - These needs to be fuzzed against the solidity
func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common.Hash, error) { func WithdrawalHash(ev *bindings.L2ToL1MessagePasserMessagePassed) (common.Hash, error) {
// abi.encode(nonce, msg.sender, _target, msg.value, _gasLimit, _data) // abi.encode(nonce, msg.sender, _target, msg.value, _gasLimit, _data)
args := abi.Arguments{ args := abi.Arguments{
{Name: "nonce", Type: Uint256Type}, {Name: "nonce", Type: Uint256Type},
...@@ -261,50 +261,50 @@ func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common ...@@ -261,50 +261,50 @@ func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common
return crypto.Keccak256Hash(enc), nil return crypto.Keccak256Hash(enc), nil
} }
// ParseWithdrawalInitiated parses WithdrawalInitiated events from // ParseMessagePassed parses MessagePassed events from
// a transaction receipt. It does not support multiple withdrawals // a transaction receipt. It does not support multiple withdrawals
// per receipt. // per receipt.
func ParseWithdrawalInitiated(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserWithdrawalInitiated, error) { func ParseMessagePassed(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserMessagePassed, error) {
contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil) contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, log := range receipt.Logs { for _, log := range receipt.Logs {
if len(log.Topics) == 0 || log.Topics[0] != WithdrawalInitiatedTopic { if len(log.Topics) == 0 || log.Topics[0] != MessagePassedTopic {
continue continue
} }
ev, err := contract.ParseWithdrawalInitiated(*log) ev, err := contract.ParseMessagePassed(*log)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse log: %w", err) return nil, fmt.Errorf("failed to parse log: %w", err)
} }
return ev, nil return ev, nil
} }
return nil, errors.New("Unable to find WithdrawalInitiated event") return nil, errors.New("Unable to find MessagePassed event")
} }
// ParseWithdrawalInitiatedExtension1 parses WithdrawalInitiatedExtension1 events // ParseMessagePassedExtension1 parses MessagePassedExtension1 events
// from a transaction receipt. It does not support multiple withdrawals per // from a transaction receipt. It does not support multiple withdrawals per
// receipt. // receipt.
func ParseWithdrawalInitiatedExtension1(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1, error) { func ParseMessagePassedExtension1(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserMessagePassedExtension1, error) {
contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil) contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, log := range receipt.Logs { for _, log := range receipt.Logs {
if len(log.Topics) == 0 || log.Topics[0] != WithdrawalInitiatedExtension1Topic { if len(log.Topics) == 0 || log.Topics[0] != MessagePassedExtension1Topic {
continue continue
} }
ev, err := contract.ParseWithdrawalInitiatedExtension1(*log) ev, err := contract.ParseMessagePassedExtension1(*log)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to parse log: %w", err) return nil, fmt.Errorf("failed to parse log: %w", err)
} }
return ev, nil return ev, nil
} }
return nil, errors.New("Unable to find WithdrawalInitiatedExtension1 event") return nil, errors.New("Unable to find MessagePassedExtension1 event")
} }
// StorageSlotOfWithdrawalHash determines the storage slot of the Withdrawer contract to look at // StorageSlotOfWithdrawalHash determines the storage slot of the Withdrawer contract to look at
......
...@@ -15,16 +15,16 @@ import ( ...@@ -15,16 +15,16 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestParseWithdrawalInitiated(t *testing.T) { func TestParseMessagePassed(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
file string file string
expected *bindings.L2ToL1MessagePasserWithdrawalInitiated expected *bindings.L2ToL1MessagePasserMessagePassed
}{ }{
{ {
"withdrawal through bridge", "withdrawal through bridge",
"bridge-withdrawal.json", "bridge-withdrawal.json",
&bindings.L2ToL1MessagePasserWithdrawalInitiated{ &bindings.L2ToL1MessagePasserMessagePassed{
Nonce: new(big.Int), Nonce: new(big.Int),
Sender: common.HexToAddress("0x4200000000000000000000000000000000000007"), Sender: common.HexToAddress("0x4200000000000000000000000000000000000007"),
Target: common.HexToAddress("0x6900000000000000000000000000000000000002"), Target: common.HexToAddress("0x6900000000000000000000000000000000000002"),
...@@ -51,7 +51,7 @@ func TestParseWithdrawalInitiated(t *testing.T) { ...@@ -51,7 +51,7 @@ func TestParseWithdrawalInitiated(t *testing.T) {
Raw: types.Log{ Raw: types.Log{
Address: common.HexToAddress("0x4200000000000000000000000000000000000016"), Address: common.HexToAddress("0x4200000000000000000000000000000000000016"),
Topics: []common.Hash{ Topics: []common.Hash{
common.HexToHash("0x87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a6136"), common.HexToHash("0x7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d72"),
common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
common.HexToHash("0x0000000000000000000000004200000000000000000000000000000000000007"), common.HexToHash("0x0000000000000000000000004200000000000000000000000000000000000007"),
common.HexToHash("0x0000000000000000000000006900000000000000000000000000000000000002"), common.HexToHash("0x0000000000000000000000006900000000000000000000000000000000000002"),
...@@ -95,7 +95,7 @@ func TestParseWithdrawalInitiated(t *testing.T) { ...@@ -95,7 +95,7 @@ func TestParseWithdrawalInitiated(t *testing.T) {
dec := json.NewDecoder(f) dec := json.NewDecoder(f)
receipt := new(types.Receipt) receipt := new(types.Receipt)
require.NoError(t, dec.Decode(receipt)) require.NoError(t, dec.Decode(receipt))
parsed, err := ParseWithdrawalInitiated(receipt) parsed, err := ParseMessagePassed(receipt)
require.NoError(t, err) require.NoError(t, err)
// Have to do this weird thing to compare zero bigints. // Have to do this weird thing to compare zero bigints.
...@@ -117,21 +117,21 @@ func TestParseWithdrawalInitiated(t *testing.T) { ...@@ -117,21 +117,21 @@ func TestParseWithdrawalInitiated(t *testing.T) {
} }
} }
func TestParseWithdrawalInitiatedExtension1(t *testing.T) { func TestParseMessagePassedExtension1(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
file string file string
expected *bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1 expected *bindings.L2ToL1MessagePasserMessagePassedExtension1
}{ }{
{ {
"withdrawal through bridge", "withdrawal through bridge",
"bridge-withdrawal.json", "bridge-withdrawal.json",
&bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1{ &bindings.L2ToL1MessagePasserMessagePassedExtension1{
Hash: common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"), Hash: common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"),
Raw: types.Log{ Raw: types.Log{
Address: common.HexToAddress("0x4200000000000000000000000000000000000016"), Address: common.HexToAddress("0x4200000000000000000000000000000000000016"),
Topics: []common.Hash{ Topics: []common.Hash{
common.HexToHash("0x2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb"), common.HexToHash("0xedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c"),
common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"), common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"),
}, },
Data: []byte{}, Data: []byte{},
...@@ -152,7 +152,7 @@ func TestParseWithdrawalInitiatedExtension1(t *testing.T) { ...@@ -152,7 +152,7 @@ func TestParseWithdrawalInitiatedExtension1(t *testing.T) {
dec := json.NewDecoder(f) dec := json.NewDecoder(f)
receipt := new(types.Receipt) receipt := new(types.Receipt)
require.NoError(t, dec.Decode(receipt)) require.NoError(t, dec.Decode(receipt))
parsed, err := ParseWithdrawalInitiatedExtension1(receipt) parsed, err := ParseMessagePassedExtension1(receipt)
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, test.expected, parsed) require.EqualValues(t, test.expected, parsed)
}) })
......
...@@ -40,7 +40,7 @@ contract L2ToL1MessagePasser is Semver { ...@@ -40,7 +40,7 @@ contract L2ToL1MessagePasser is Semver {
* @param gasLimit The minimum amount of gas that must be provided when withdrawing on L1. * @param gasLimit The minimum amount of gas that must be provided when withdrawing on L1.
* @param data The data to be forwarded to the target on L1. * @param data The data to be forwarded to the target on L1.
*/ */
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, uint256 indexed nonce,
address indexed sender, address indexed sender,
address indexed target, address indexed target,
...@@ -51,11 +51,11 @@ contract L2ToL1MessagePasser is Semver { ...@@ -51,11 +51,11 @@ contract L2ToL1MessagePasser is Semver {
/** /**
* @notice Emitted any time a withdrawal is initiated. An extension to * @notice Emitted any time a withdrawal is initiated. An extension to
* WithdrawalInitiated so that the interface is maintained. * MessagePassed to allow for a 4th indexed argument.
* *
* @param hash The hash of the withdrawal * @param hash The hash of the withdrawal
*/ */
event WithdrawalInitiatedExtension1(bytes32 indexed hash); event MessagePassedExtension1(bytes32 indexed hash);
/** /**
* @notice Emitted when the balance of this contract is burned. * @notice Emitted when the balance of this contract is burned.
...@@ -113,8 +113,8 @@ contract L2ToL1MessagePasser is Semver { ...@@ -113,8 +113,8 @@ contract L2ToL1MessagePasser is Semver {
sentMessages[withdrawalHash] = true; sentMessages[withdrawalHash] = true;
emit WithdrawalInitiated(nonce, msg.sender, _target, msg.value, _gasLimit, _data); emit MessagePassed(nonce, msg.sender, _target, msg.value, _gasLimit, _data);
emit WithdrawalInitiatedExtension1(withdrawalHash); emit MessagePassedExtension1(withdrawalHash);
unchecked { unchecked {
++nonce; ++nonce;
......
...@@ -190,7 +190,7 @@ contract Messenger_Initializer is L2OutputOracle_Initializer { ...@@ -190,7 +190,7 @@ contract Messenger_Initializer is L2OutputOracle_Initializer {
uint256 value uint256 value
); );
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, uint256 indexed nonce,
address indexed sender, address indexed sender,
address indexed target, address indexed target,
......
...@@ -56,9 +56,9 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer { ...@@ -56,9 +56,9 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
) )
); );
// WithdrawalInitiated event // MessagePassed event
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
messagePasser.nonce(), messagePasser.nonce(),
address(L2Messenger), address(L2Messenger),
address(L1Messenger), address(L1Messenger),
......
...@@ -9,7 +9,7 @@ import { Hashing } from "../libraries/Hashing.sol"; ...@@ -9,7 +9,7 @@ import { Hashing } from "../libraries/Hashing.sol";
contract L2ToL1MessagePasserTest is CommonTest { contract L2ToL1MessagePasserTest is CommonTest {
L2ToL1MessagePasser messagePasser; L2ToL1MessagePasser messagePasser;
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, uint256 indexed nonce,
address indexed sender, address indexed sender,
address indexed target, address indexed target,
...@@ -18,7 +18,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -18,7 +18,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
bytes data bytes data
); );
event WithdrawalInitiatedExtension1(bytes32 indexed hash); event MessagePassedExtension1(bytes32 indexed hash);
event WithdrawerBalanceBurnt(uint256 indexed amount); event WithdrawerBalanceBurnt(uint256 indexed amount);
...@@ -36,7 +36,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -36,7 +36,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
uint256 nonce = messagePasser.nonce(); uint256 nonce = messagePasser.nonce();
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
nonce, nonce,
_sender, _sender,
_target, _target,
...@@ -57,7 +57,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -57,7 +57,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
); );
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiatedExtension1(withdrawalHash); emit MessagePassedExtension1(withdrawalHash);
vm.deal(_sender, _value); vm.deal(_sender, _value);
vm.prank(_sender); vm.prank(_sender);
...@@ -86,7 +86,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -86,7 +86,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
// Test: initiateWithdrawal should emit the correct log when called by a contract // Test: initiateWithdrawal should emit the correct log when called by a contract
function test_initiateWithdrawal_fromContract() external { function test_initiateWithdrawal_fromContract() external {
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
messagePasser.nonce(), messagePasser.nonce(),
address(this), address(this),
address(4), address(4),
...@@ -107,7 +107,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -107,7 +107,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
); );
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiatedExtension1(withdrawalHash); emit MessagePassedExtension1(withdrawalHash);
vm.deal(address(this), 2**64); vm.deal(address(this), 2**64);
messagePasser.initiateWithdrawal{ value: 100 }( messagePasser.initiateWithdrawal{ value: 100 }(
...@@ -129,7 +129,7 @@ contract L2ToL1MessagePasserTest is CommonTest { ...@@ -129,7 +129,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
vm.prank(alice, alice); vm.prank(alice, alice);
vm.deal(alice, 2**64); vm.deal(alice, 2**64);
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
emit WithdrawalInitiated( emit MessagePassed(
nonce, nonce,
alice, alice,
target, target,
......
...@@ -1212,30 +1212,30 @@ export class CrossChainMessenger { ...@@ -1212,30 +1212,30 @@ export class CrossChainMessenger {
) )
interface WithdrawalEntry { interface WithdrawalEntry {
withdrawalInitiated: any MessagePassed: any
withdrawalInitiatedExtension1: any MessagePassedExtension1: any
} }
// Handle multiple withdrawals in the same tx and be backwards // Handle multiple withdrawals in the same tx and be backwards
// compatible without WithdrawalInitiatedExtension1 // compatible without MessagePassedExtension1
const logs: Partial<{ number: WithdrawalEntry }> = {} const logs: Partial<{ number: WithdrawalEntry }> = {}
for (const [i, log] of Object.entries(receipt.logs)) { for (const [i, log] of Object.entries(receipt.logs)) {
if (log.address === this.contracts.l2.BedrockMessagePasser.address) { if (log.address === this.contracts.l2.BedrockMessagePasser.address) {
const decoded = const decoded =
this.contracts.l2.L2ToL1MessagePasser.interface.parseLog(log) this.contracts.l2.L2ToL1MessagePasser.interface.parseLog(log)
// Find the withdrawal initiated events // Find the withdrawal initiated events
if (decoded.name === 'WithdrawalInitiated') { if (decoded.name === 'MessagePassed') {
logs[log.logIndex] = { logs[log.logIndex] = {
withdrawalInitiated: decoded.args, MessagePassed: decoded.args,
withdrawalInitiatedExtension1: null, MessagePassedExtension1: null,
} }
if (receipt.logs[i + 1]) { if (receipt.logs[i + 1]) {
const next = const next =
this.contracts.l2.L2ToL1MessagePasser.interface.parseLog( this.contracts.l2.L2ToL1MessagePasser.interface.parseLog(
receipt.logs[i + 1] receipt.logs[i + 1]
) )
if (next.name === 'WithdrawalInitiatedExtension1') { if (next.name === 'MessagePassedExtension1') {
logs[log.logIndex].withdrawalInitiatedExtension1 = next.args logs[log.logIndex].MessagePassedExtension1 = next.args
} }
} }
} }
...@@ -1252,17 +1252,17 @@ export class CrossChainMessenger { ...@@ -1252,17 +1252,17 @@ export class CrossChainMessenger {
} }
const withdrawalHash = hashWithdrawal( const withdrawalHash = hashWithdrawal(
withdrawal.withdrawalInitiated.nonce, withdrawal.MessagePassed.nonce,
withdrawal.withdrawalInitiated.sender, withdrawal.MessagePassed.sender,
withdrawal.withdrawalInitiated.target, withdrawal.MessagePassed.target,
withdrawal.withdrawalInitiated.value, withdrawal.MessagePassed.value,
withdrawal.withdrawalInitiated.gasLimit, withdrawal.MessagePassed.gasLimit,
withdrawal.withdrawalInitiated.data withdrawal.MessagePassed.data
) )
// Sanity check // Sanity check
if (withdrawal.withdrawalInitiatedExtension1) { if (withdrawal.MessagePassedExtension1) {
if (withdrawal.withdrawalInitiatedExtension1.hash !== withdrawalHash) { if (withdrawal.MessagePassedExtension1.hash !== withdrawalHash) {
throw new Error(`Mismatched withdrawal hashes`) throw new Error(`Mismatched withdrawal hashes`)
} }
} }
...@@ -1314,12 +1314,12 @@ export class CrossChainMessenger { ...@@ -1314,12 +1314,12 @@ export class CrossChainMessenger {
output, output,
// TODO(tynes): use better type, typechain? // TODO(tynes): use better type, typechain?
{ {
messageNonce: withdrawal.withdrawalInitiated.nonce, messageNonce: withdrawal.MessagePassed.nonce,
sender: withdrawal.withdrawalInitiated.sender, sender: withdrawal.MessagePassed.sender,
target: withdrawal.withdrawalInitiated.target, target: withdrawal.MessagePassed.target,
value: withdrawal.withdrawalInitiated.value, value: withdrawal.MessagePassed.value,
minGasLimit: withdrawal.withdrawalInitiated.gasLimit, minGasLimit: withdrawal.MessagePassed.gasLimit,
message: withdrawal.withdrawalInitiated.data, message: withdrawal.MessagePassed.data,
}, },
] ]
} }
......
...@@ -78,7 +78,7 @@ which stores messages to be withdrawn. ...@@ -78,7 +78,7 @@ which stores messages to be withdrawn.
```js ```js
interface L2ToL1MessagePasser { interface L2ToL1MessagePasser {
event WithdrawalInitiated( event MessagePassed(
uint256 indexed nonce, // this is a global nonce value for all withdrawal messages uint256 indexed nonce, // this is a global nonce value for all withdrawal messages
address indexed sender, address indexed sender,
address indexed target, address indexed target,
...@@ -87,7 +87,7 @@ interface L2ToL1MessagePasser { ...@@ -87,7 +87,7 @@ interface L2ToL1MessagePasser {
bytes data bytes data
); );
event WithdrawalInitiatedExtension1(bytes32 indexed hash); event MessagePassedExtension1(bytes32 indexed hash);
event WithdrawerBalanceBurnt(uint256 indexed amount); event WithdrawerBalanceBurnt(uint256 indexed amount);
...@@ -102,8 +102,8 @@ interface L2ToL1MessagePasser { ...@@ -102,8 +102,8 @@ interface L2ToL1MessagePasser {
``` ```
The `WithdrawalInitiated` event includes all of the data that is hashed and The `MessagePassed` event includes all of the data that is hashed and
stored in the `sentMessages` mapping. The `WithdrawalInitiatedExtension1` emits stored in the `sentMessages` mapping. The `MessagePassedExtension1` emits
the hash that was computed and used as part of the storage proof used to the hash that was computed and used as part of the storage proof used to
finalize the withdrawal on L1. finalize the withdrawal on L1.
......
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