Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/five-grapes-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@eth-optimism/contracts-bedrock': patch
'@eth-optimism/sdk': patch
---

Rename the event emitted in the L2ToL1MessagePasser
108 changes: 54 additions & 54 deletions op-bindings/bindings/l2tol1messagepasser.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion op-bindings/bindings/l2tol1messagepasser_more.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions op-node/withdrawals/testdata/bridge-withdrawal.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{
"address": "0x4200000000000000000000000000000000000016",
"topics": [
"0x87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a6136",
"0x7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d72",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000004200000000000000000000000000000000000007",
"0x0000000000000000000000006900000000000000000000000000000000000002"
Expand All @@ -53,7 +53,7 @@
{
"address": "0x4200000000000000000000000000000000000016",
"topics": [
"0x2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb",
"0xedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c",
"0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"
],
"data": "0x",
Expand Down Expand Up @@ -131,4 +131,4 @@
"blockHash": "0xfdd4ad8a984b45687aca0463db491cbd0e85273d970019a3f8bf618b614938df",
"blockNumber": "0x36",
"transactionIndex": "0x1"
}
}
30 changes: 15 additions & 15 deletions op-node/withdrawals/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)

var WithdrawalInitiatedTopic = crypto.Keccak256Hash([]byte("WithdrawalInitiated(uint256,address,address,uint256,uint256,bytes)"))
var WithdrawalInitiatedExtension1Topic = crypto.Keccak256Hash([]byte("WithdrawalInitiatedExtension1(bytes32)"))
var MessagePassedTopic = crypto.Keccak256Hash([]byte("MessagePassed(uint256,address,address,uint256,uint256,bytes)"))
var MessagePassedExtension1Topic = crypto.Keccak256Hash([]byte("MessagePassedExtension1(bytes32)"))

// WaitForFinalizationPeriod waits until there is OutputProof for an L2 block number larger than the supplied l2BlockNumber
// and that the output is finalized.
Expand Down Expand Up @@ -172,11 +172,11 @@ func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txH
return FinalizedWithdrawalParameters{}, err
}
// Parse the receipt
ev, err := ParseWithdrawalInitiated(receipt)
ev, err := ParseMessagePassed(receipt)
if err != nil {
return FinalizedWithdrawalParameters{}, err
}
ev1, err := ParseWithdrawalInitiatedExtension1(receipt)
ev1, err := ParseMessagePassedExtension1(receipt)
if err != nil {
return FinalizedWithdrawalParameters{}, err
}
Expand Down Expand Up @@ -244,7 +244,7 @@ var (
// - I don't like having to use the ABI Generated struct
// - There should be a better way to run the ABI encoding
// - 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)
args := abi.Arguments{
{Name: "nonce", Type: Uint256Type},
Expand All @@ -261,50 +261,50 @@ func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common
return crypto.Keccak256Hash(enc), nil
}

// ParseWithdrawalInitiated parses WithdrawalInitiated events from
// ParseMessagePassed parses MessagePassed events from
// a transaction receipt. It does not support multiple withdrawals
// 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)
if err != nil {
return nil, err
}

for _, log := range receipt.Logs {
if len(log.Topics) == 0 || log.Topics[0] != WithdrawalInitiatedTopic {
if len(log.Topics) == 0 || log.Topics[0] != MessagePassedTopic {
continue
}

ev, err := contract.ParseWithdrawalInitiated(*log)
ev, err := contract.ParseMessagePassed(*log)
if err != nil {
return nil, fmt.Errorf("failed to parse log: %w", err)
}
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
// receipt.
func ParseWithdrawalInitiatedExtension1(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1, error) {
func ParseMessagePassedExtension1(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserMessagePassedExtension1, error) {
contract, err := bindings.NewL2ToL1MessagePasser(common.Address{}, nil)
if err != nil {
return nil, err
}

for _, log := range receipt.Logs {
if len(log.Topics) == 0 || log.Topics[0] != WithdrawalInitiatedExtension1Topic {
if len(log.Topics) == 0 || log.Topics[0] != MessagePassedExtension1Topic {
continue
}

ev, err := contract.ParseWithdrawalInitiatedExtension1(*log)
ev, err := contract.ParseMessagePassedExtension1(*log)
if err != nil {
return nil, fmt.Errorf("failed to parse log: %w", err)
}
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
Expand Down
20 changes: 10 additions & 10 deletions op-node/withdrawals/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ import (
"github.com/stretchr/testify/require"
)

func TestParseWithdrawalInitiated(t *testing.T) {
func TestParseMessagePassed(t *testing.T) {
tests := []struct {
name string
file string
expected *bindings.L2ToL1MessagePasserWithdrawalInitiated
expected *bindings.L2ToL1MessagePasserMessagePassed
}{
{
"withdrawal through bridge",
"bridge-withdrawal.json",
&bindings.L2ToL1MessagePasserWithdrawalInitiated{
&bindings.L2ToL1MessagePasserMessagePassed{
Nonce: new(big.Int),
Sender: common.HexToAddress("0x4200000000000000000000000000000000000007"),
Target: common.HexToAddress("0x6900000000000000000000000000000000000002"),
Expand All @@ -51,7 +51,7 @@ func TestParseWithdrawalInitiated(t *testing.T) {
Raw: types.Log{
Address: common.HexToAddress("0x4200000000000000000000000000000000000016"),
Topics: []common.Hash{
common.HexToHash("0x87bf7b546c8de873abb0db5b579ec131f8d0cf5b14f39933551cf9ced23a6136"),
common.HexToHash("0x7744840cae4793a72467311120512aa98e4398bcd2b9d379b2b9c3b60fa03d72"),
common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
common.HexToHash("0x0000000000000000000000004200000000000000000000000000000000000007"),
common.HexToHash("0x0000000000000000000000006900000000000000000000000000000000000002"),
Expand Down Expand Up @@ -95,7 +95,7 @@ func TestParseWithdrawalInitiated(t *testing.T) {
dec := json.NewDecoder(f)
receipt := new(types.Receipt)
require.NoError(t, dec.Decode(receipt))
parsed, err := ParseWithdrawalInitiated(receipt)
parsed, err := ParseMessagePassed(receipt)
require.NoError(t, err)

// Have to do this weird thing to compare zero bigints.
Expand All @@ -117,21 +117,21 @@ func TestParseWithdrawalInitiated(t *testing.T) {
}
}

func TestParseWithdrawalInitiatedExtension1(t *testing.T) {
func TestParseMessagePassedExtension1(t *testing.T) {
tests := []struct {
name string
file string
expected *bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1
expected *bindings.L2ToL1MessagePasserMessagePassedExtension1
}{
{
"withdrawal through bridge",
"bridge-withdrawal.json",
&bindings.L2ToL1MessagePasserWithdrawalInitiatedExtension1{
&bindings.L2ToL1MessagePasserMessagePassedExtension1{
Hash: common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"),
Raw: types.Log{
Address: common.HexToAddress("0x4200000000000000000000000000000000000016"),
Topics: []common.Hash{
common.HexToHash("0x2ef6ceb1668fdd882b1f89ddd53a666b0c1113d14cf90c0fbf97c7b1ad880fbb"),
common.HexToHash("0xedd348f9c36ef1a5b0747bb5039752707059f0b934c8e508b3271e08fbd0122c"),
common.HexToHash("0x0d827f8148288e3a2466018f71b968ece4ea9f9e2a81c30da9bd46cce2868285"),
},
Data: []byte{},
Expand All @@ -152,7 +152,7 @@ func TestParseWithdrawalInitiatedExtension1(t *testing.T) {
dec := json.NewDecoder(f)
receipt := new(types.Receipt)
require.NoError(t, dec.Decode(receipt))
parsed, err := ParseWithdrawalInitiatedExtension1(receipt)
parsed, err := ParseMessagePassedExtension1(receipt)
require.NoError(t, err)
require.EqualValues(t, test.expected, parsed)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract L2ToL1MessagePasser is Semver {
* @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.
*/
event WithdrawalInitiated(
event MessagePassed(
uint256 indexed nonce,
address indexed sender,
address indexed target,
Expand All @@ -51,11 +51,11 @@ contract L2ToL1MessagePasser is Semver {

/**
* @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
*/
event WithdrawalInitiatedExtension1(bytes32 indexed hash);
event MessagePassedExtension1(bytes32 indexed hash);

/**
* @notice Emitted when the balance of this contract is burned.
Expand Down Expand Up @@ -113,8 +113,8 @@ contract L2ToL1MessagePasser is Semver {

sentMessages[withdrawalHash] = true;

emit WithdrawalInitiated(nonce, msg.sender, _target, msg.value, _gasLimit, _data);
emit WithdrawalInitiatedExtension1(withdrawalHash);
emit MessagePassed(nonce, msg.sender, _target, msg.value, _gasLimit, _data);
emit MessagePassedExtension1(withdrawalHash);

unchecked {
++nonce;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ contract Messenger_Initializer is L2OutputOracle_Initializer {
uint256 value
);

event WithdrawalInitiated(
event MessagePassed(
uint256 indexed nonce,
address indexed sender,
address indexed target,
Expand Down
Loading