Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
3659a097
Unverified
Commit
3659a097
authored
Dec 02, 2022
by
mergify[bot]
Committed by
GitHub
Dec 02, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4135 from ethereum-optimism/sc/ctb-mp-versioned-nonce
feat(ctb): add message versioning to MessagePasser
parents
df47e202
b6af4279
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
103 additions
and
50 deletions
+103
-50
l2tol1messagepasser.go
op-bindings/bindings/l2tol1messagepasser.go
+45
-14
l2tol1messagepasser_more.go
op-bindings/bindings/l2tol1messagepasser_more.go
+2
-2
config.go
op-chain-ops/genesis/config.go
+1
-5
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+9
-9
.storage-layout
packages/contracts-bedrock/.storage-layout
+1
-1
L2ToL1MessagePasser.sol
...es/contracts-bedrock/contracts/L2/L2ToL1MessagePasser.sol
+37
-11
L2CrossDomainMessenger.t.sol
...racts-bedrock/contracts/test/L2CrossDomainMessenger.t.sol
+2
-2
L2ToL1MessagePasser.t.sol
...ontracts-bedrock/contracts/test/L2ToL1MessagePasser.t.sol
+5
-5
OptimismPortal.t.sol
...ges/contracts-bedrock/contracts/test/OptimismPortal.t.sol
+1
-1
No files found.
op-bindings/bindings/l2tol1messagepasser.go
View file @
3659a097
...
...
@@ -30,8 +30,8 @@ var (
// L2ToL1MessagePasserMetaData contains all meta data concerning the L2ToL1MessagePasser contract.
var
L2ToL1MessagePasserMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
nonce
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
sender
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
target
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
value
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
gasLimit
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
data
\"
,
\"
type
\"
:
\"
bytes
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
withdrawalHash
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
MessagePassed
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
amount
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
WithdrawerBalanceBurnt
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
burn
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_target
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_gasLimit
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
_data
\"
,
\"
type
\"
:
\"
bytes
\"
}],
\"
name
\"
:
\"
initiateWithdrawal
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
n
once
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
sentMessages
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
receive
\"
}]"
,
Bin
:
"0x60e060405234801561001057600080fd5b506000608081905260a052600160c05260805160a05160c051610
8f261004f60003960006102d5015260006102ac0152600061028301526108f26000f3fe60806040526004361061005e5760003560e01c806382e3702d1161004357806382e3702d146100c7578063affed0e014610107578063c2b3e5ac1461012b57600080fd5b806344df8e701461008757806354fd4d501461009c57600080fd5b366100825761008033620186a060405180602001604052806000815250610139565b005b600080fd5b34801561009357600080fd5b50610080610244565b3480156100a857600080fd5b506100b161027c565b6040516100be919061055e565b60405180910390f35b3480156100d357600080fd5b506100f76100e2366004610578565b60006020819052908152604090205460ff1681565b60405190151581526020016100be565b34801561011357600080fd5b5061011d60015481565b6040519081526020016100be565b6100806101393660046105c0565b600061019e6040518060c0016040528060015481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018581526020018481525061031f565b6000818152602081905260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915554905191925073ffffffffffffffffffffffffffffffffffffffff8616913391907f02a52367d10742d8032712c1bb8e0144ff1ec5ffda1ed7d70bb05a27449550549061022e9034908990899089906106c4565b60405180910390a4505060018054810190555050565b4761024e8161036c565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606102a77f000000000000000000000000000000000000000000000000000000000000000061039b565b6102d07f000000000000000000000000000000000000000000000000000000000000000061039b565b6102f97f000000000000000000000000000000000000000000000000000000000000000061039b565b60405160200161030b939291906106f4565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761034f97909695910161076a565b604051602081830303815290604052805190602001209050919050565b80604051610379906104d8565b6040518091039082f0905080158015610396573d6000803e3d6000fd5b505050565b6060816000036103de57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561040857806103f2816107f0565b91506104019050600a83610857565b91506103e2565b60008167ffffffffffffffff81111561042357610423610591565b6040519080825280601f01601f19166020018201604052801561044d576020820181803683370190505b5090505b84156104d05761046260018361086b565b915061046f600a86610882565b61047a906030610896565b60f81b81838151811061048f5761048f6108ae565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506104c9600a86610857565b9450610451565b949350505050565b6008806108de83390190565b60005b838110156104ff5781810151838201526020016104e7565b8381111561050e576000848401525b50505050565b6000815180845261052c8160208601602086016104e4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006105716020830184610514565b9392505050565b60006020828403121561058a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156105d557600080fd5b833573ffffffffffffffffffffffffffffffffffffffff811681146105f957600080fd5b925060208401359150604084013567ffffffffffffffff8082111561061d57600080fd5b818601915086601f83011261063157600080fd5b81358181111561064357610643610591565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068957610689610591565b816040528281528960208487010111156106a257600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b8481528360208201526080604082015260006106e36080830185610514565b905082606083015295945050505050565b600084516107068184602089016104e4565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610742816001850160208a016104e4565b6001920191820152835161075d8160028401602088016104e4565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526107b560c0830184610514565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610821576108216107c1565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261086657610866610828565b500490565b60008282101561087d5761087d6107c1565b500390565b60008261089157610891610828565b500690565b600082198211156108a9576108a96107c1
565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a"
,
ABI
:
"[{
\"
inputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
constructor
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
nonce
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
sender
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
target
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
value
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
gasLimit
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
data
\"
,
\"
type
\"
:
\"
bytes
\"
},{
\"
indexed
\"
:false,
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"
withdrawalHash
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
MessagePassed
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
amount
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
WithdrawerBalanceBurnt
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
MESSAGE_VERSION
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint16
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint16
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
burn
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
_target
\"
,
\"
type
\"
:
\"
address
\"
},{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_gasLimit
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
internalType
\"
:
\"
bytes
\"
,
\"
name
\"
:
\"
_data
\"
,
\"
type
\"
:
\"
bytes
\"
}],
\"
name
\"
:
\"
initiateWithdrawal
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
messageN
once
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
bytes32
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
name
\"
:
\"
sentMessages
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
bool
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
bool
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
stateMutability
\"
:
\"
payable
\"
,
\"
type
\"
:
\"
receive
\"
}]"
,
Bin
:
"0x60e060405234801561001057600080fd5b506000608081905260a052600160c05260805160a05160c051610
a2061004f6000396000610403015260006103da015260006103b10152610a206000f3fe6080604052600436106100695760003560e01c806382e3702d1161004357806382e3702d146100f6578063c2b3e5ac14610136578063ecc704281461014957600080fd5b80633f827a5a1461009257806344df8e70146100bf57806354fd4d50146100d457600080fd5b3661008d5761008b33620186a0604051806020016040528060008152506101ae565b005b600080fd5b34801561009e57600080fd5b506100a7600181565b60405161ffff90911681526020015b60405180910390f35b3480156100cb57600080fd5b5061008b610372565b3480156100e057600080fd5b506100e96103aa565b6040516100b6919061068c565b34801561010257600080fd5b506101266101113660046106a6565b60006020819052908152604090205460ff1681565b60405190151581526020016100b6565b61008b6101443660046106ee565b6101ae565b34801561015557600080fd5b506101a06001547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e010000000000000000000000000000000000000000000000000000000000001790565b6040519081526020016100b6565b60006102446040518060c001604052806102086001547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e010000000000000000000000000000000000000000000000000000000000001790565b815233602082015273ffffffffffffffffffffffffffffffffffffffff871660408201523460608201526080810186905260a00184905261044d565b600081815260208190526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055905073ffffffffffffffffffffffffffffffffffffffff8416336102df6001547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e010000000000000000000000000000000000000000000000000000000000001790565b7f02a52367d10742d8032712c1bb8e0144ff1ec5ffda1ed7d70bb05a27449550543487878760405161031494939291906107f2565b60405180910390a45050600180547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8082168301167fffff0000000000000000000000000000000000000000000000000000000000009091161790555050565b4761037c8161049a565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606103d57f00000000000000000000000000000000000000000000000000000000000000006104c9565b6103fe7f00000000000000000000000000000000000000000000000000000000000000006104c9565b6104277f00000000000000000000000000000000000000000000000000000000000000006104c9565b60405160200161043993929190610822565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761047d979096959101610898565b604051602081830303815290604052805190602001209050919050565b806040516104a790610606565b6040518091039082f09050801580156104c4573d6000803e3d6000fd5b505050565b60608160000361050c57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561053657806105208161091e565b915061052f9050600a83610985565b9150610510565b60008167ffffffffffffffff811115610551576105516106bf565b6040519080825280601f01601f19166020018201604052801561057b576020820181803683370190505b5090505b84156105fe57610590600183610999565b915061059d600a866109b0565b6105a89060306109c4565b60f81b8183815181106105bd576105bd6109dc565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506105f7600a86610985565b945061057f565b949350505050565b600880610a0c83390190565b60005b8381101561062d578181015183820152602001610615565b8381111561063c576000848401525b50505050565b6000815180845261065a816020860160208601610612565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061069f6020830184610642565b9392505050565b6000602082840312156106b857600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561070357600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461072757600080fd5b925060208401359150604084013567ffffffffffffffff8082111561074b57600080fd5b818601915086601f83011261075f57600080fd5b813581811115610771576107716106bf565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156107b7576107b76106bf565b816040528281528960208487010111156107d057600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b8481528360208201526080604082015260006108116080830185610642565b905082606083015295945050505050565b60008451610834818460208901610612565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610870816001850160208a01610612565b6001920191820152835161088b816002840160208801610612565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526108e360c0830184610642565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361094f5761094f6108ef565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261099457610994610956565b500490565b6000828210156109ab576109ab6108ef565b500390565b6000826109bf576109bf610956565b500690565b600082198211156109d7576109d76108ef
565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a"
,
}
// L2ToL1MessagePasserABI is the input ABI used to generate the binding from.
...
...
@@ -201,12 +201,43 @@ func (_L2ToL1MessagePasser *L2ToL1MessagePasserTransactorRaw) Transact(opts *bin
return
_L2ToL1MessagePasser
.
Contract
.
contract
.
Transact
(
opts
,
method
,
params
...
)
}
//
Nonce is a free data retrieval call binding the contract method 0xaffed0e0
.
//
MESSAGEVERSION is a free data retrieval call binding the contract method 0x3f827a5a
.
//
// Solidity: function
nonce() view returns(uint25
6)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserCaller
)
Nonce
(
opts
*
bind
.
CallOpts
)
(
*
big
.
Int
,
error
)
{
// Solidity: function
MESSAGE_VERSION() view returns(uint1
6)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserCaller
)
MESSAGEVERSION
(
opts
*
bind
.
CallOpts
)
(
uint16
,
error
)
{
var
out
[]
interface
{}
err
:=
_L2ToL1MessagePasser
.
contract
.
Call
(
opts
,
&
out
,
"nonce"
)
err
:=
_L2ToL1MessagePasser
.
contract
.
Call
(
opts
,
&
out
,
"MESSAGE_VERSION"
)
if
err
!=
nil
{
return
*
new
(
uint16
),
err
}
out0
:=
*
abi
.
ConvertType
(
out
[
0
],
new
(
uint16
))
.
(
*
uint16
)
return
out0
,
err
}
// MESSAGEVERSION is a free data retrieval call binding the contract method 0x3f827a5a.
//
// Solidity: function MESSAGE_VERSION() view returns(uint16)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserSession
)
MESSAGEVERSION
()
(
uint16
,
error
)
{
return
_L2ToL1MessagePasser
.
Contract
.
MESSAGEVERSION
(
&
_L2ToL1MessagePasser
.
CallOpts
)
}
// MESSAGEVERSION is a free data retrieval call binding the contract method 0x3f827a5a.
//
// Solidity: function MESSAGE_VERSION() view returns(uint16)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserCallerSession
)
MESSAGEVERSION
()
(
uint16
,
error
)
{
return
_L2ToL1MessagePasser
.
Contract
.
MESSAGEVERSION
(
&
_L2ToL1MessagePasser
.
CallOpts
)
}
// MessageNonce is a free data retrieval call binding the contract method 0xecc70428.
//
// Solidity: function messageNonce() view returns(uint256)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserCaller
)
MessageNonce
(
opts
*
bind
.
CallOpts
)
(
*
big
.
Int
,
error
)
{
var
out
[]
interface
{}
err
:=
_L2ToL1MessagePasser
.
contract
.
Call
(
opts
,
&
out
,
"messageNonce"
)
if
err
!=
nil
{
return
*
new
(
*
big
.
Int
),
err
...
...
@@ -218,18 +249,18 @@ func (_L2ToL1MessagePasser *L2ToL1MessagePasserCaller) Nonce(opts *bind.CallOpts
}
//
Nonce is a free data retrieval call binding the contract method 0xaffed0e0
.
//
MessageNonce is a free data retrieval call binding the contract method 0xecc70428
.
//
// Solidity: function
n
once() view returns(uint256)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserSession
)
Nonce
()
(
*
big
.
Int
,
error
)
{
return
_L2ToL1MessagePasser
.
Contract
.
Nonce
(
&
_L2ToL1MessagePasser
.
CallOpts
)
// Solidity: function
messageN
once() view returns(uint256)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserSession
)
Message
Nonce
()
(
*
big
.
Int
,
error
)
{
return
_L2ToL1MessagePasser
.
Contract
.
Message
Nonce
(
&
_L2ToL1MessagePasser
.
CallOpts
)
}
//
Nonce is a free data retrieval call binding the contract method 0xaffed0e0
.
//
MessageNonce is a free data retrieval call binding the contract method 0xecc70428
.
//
// Solidity: function
n
once() view returns(uint256)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserCallerSession
)
Nonce
()
(
*
big
.
Int
,
error
)
{
return
_L2ToL1MessagePasser
.
Contract
.
Nonce
(
&
_L2ToL1MessagePasser
.
CallOpts
)
// Solidity: function
messageN
once() view returns(uint256)
func
(
_L2ToL1MessagePasser
*
L2ToL1MessagePasserCallerSession
)
Message
Nonce
()
(
*
big
.
Int
,
error
)
{
return
_L2ToL1MessagePasser
.
Contract
.
Message
Nonce
(
&
_L2ToL1MessagePasser
.
CallOpts
)
}
// SentMessages is a free data retrieval call binding the contract method 0x82e3702d.
...
...
op-bindings/bindings/l2tol1messagepasser_more.go
View file @
3659a097
...
...
@@ -9,11 +9,11 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc"
)
const
L2ToL1MessagePasserStorageLayoutJSON
=
"{
\"
storage
\"
:[{
\"
astId
\"
:1000,
\"
contract
\"
:
\"
contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser
\"
,
\"
label
\"
:
\"
sentMessages
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
0
\"
,
\"
type
\"
:
\"
t_mapping(t_bytes32,t_bool)
\"
},{
\"
astId
\"
:1001,
\"
contract
\"
:
\"
contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser
\"
,
\"
label
\"
:
\"
nonce
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
1
\"
,
\"
type
\"
:
\"
t_uint256
\"
}],
\"
types
\"
:{
\"
t_bool
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
bool
\"
,
\"
numberOfBytes
\"
:
\"
1
\"
},
\"
t_bytes32
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
bytes32
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
},
\"
t_mapping(t_bytes32,t_bool)
\"
:{
\"
encoding
\"
:
\"
mapping
\"
,
\"
label
\"
:
\"
mapping(bytes32 =
\u003e
bool)
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
,
\"
key
\"
:
\"
t_bytes32
\"
,
\"
value
\"
:
\"
t_bool
\"
},
\"
t_uint256
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
uint256
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
}}}"
const
L2ToL1MessagePasserStorageLayoutJSON
=
"{
\"
storage
\"
:[{
\"
astId
\"
:1000,
\"
contract
\"
:
\"
contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser
\"
,
\"
label
\"
:
\"
sentMessages
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
0
\"
,
\"
type
\"
:
\"
t_mapping(t_bytes32,t_bool)
\"
},{
\"
astId
\"
:1001,
\"
contract
\"
:
\"
contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser
\"
,
\"
label
\"
:
\"
msgNonce
\"
,
\"
offset
\"
:0,
\"
slot
\"
:
\"
1
\"
,
\"
type
\"
:
\"
t_uint240
\"
}],
\"
types
\"
:{
\"
t_bool
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
bool
\"
,
\"
numberOfBytes
\"
:
\"
1
\"
},
\"
t_bytes32
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
bytes32
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
},
\"
t_mapping(t_bytes32,t_bool)
\"
:{
\"
encoding
\"
:
\"
mapping
\"
,
\"
label
\"
:
\"
mapping(bytes32 =
\u003e
bool)
\"
,
\"
numberOfBytes
\"
:
\"
32
\"
,
\"
key
\"
:
\"
t_bytes32
\"
,
\"
value
\"
:
\"
t_bool
\"
},
\"
t_uint240
\"
:{
\"
encoding
\"
:
\"
inplace
\"
,
\"
label
\"
:
\"
uint240
\"
,
\"
numberOfBytes
\"
:
\"
30
\"
}}}"
var
L2ToL1MessagePasserStorageLayout
=
new
(
solc
.
StorageLayout
)
var
L2ToL1MessagePasserDeployedBin
=
"0x6080604052600436106100
5e5760003560e01c806382e3702d1161004357806382e3702d146100c7578063affed0e014610107578063c2b3e5ac1461012b57600080fd5b806344df8e701461008757806354fd4d501461009c57600080fd5b366100825761008033620186a060405180602001604052806000815250610139565b005b600080fd5b34801561009357600080fd5b50610080610244565b3480156100a857600080fd5b506100b161027c565b6040516100be919061055e565b60405180910390f35b3480156100d357600080fd5b506100f76100e2366004610578565b60006020819052908152604090205460ff1681565b60405190151581526020016100be565b34801561011357600080fd5b5061011d60015481565b6040519081526020016100be565b6100806101393660046105c0565b600061019e6040518060c0016040528060015481526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018581526020018481525061031f565b6000818152602081905260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915554905191925073ffffffffffffffffffffffffffffffffffffffff8616913391907f02a52367d10742d8032712c1bb8e0144ff1ec5ffda1ed7d70bb05a27449550549061022e9034908990899089906106c4565b60405180910390a4505060018054810190555050565b4761024e8161036c565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606102a77f000000000000000000000000000000000000000000000000000000000000000061039b565b6102d07f000000000000000000000000000000000000000000000000000000000000000061039b565b6102f97f000000000000000000000000000000000000000000000000000000000000000061039b565b60405160200161030b939291906106f4565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761034f97909695910161076a565b604051602081830303815290604052805190602001209050919050565b80604051610379906104d8565b6040518091039082f0905080158015610396573d6000803e3d6000fd5b505050565b6060816000036103de57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561040857806103f2816107f0565b91506104019050600a83610857565b91506103e2565b60008167ffffffffffffffff81111561042357610423610591565b6040519080825280601f01601f19166020018201604052801561044d576020820181803683370190505b5090505b84156104d05761046260018361086b565b915061046f600a86610882565b61047a906030610896565b60f81b81838151811061048f5761048f6108ae565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506104c9600a86610857565b9450610451565b949350505050565b6008806108de83390190565b60005b838110156104ff5781810151838201526020016104e7565b8381111561050e576000848401525b50505050565b6000815180845261052c8160208601602086016104e4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006105716020830184610514565b9392505050565b60006020828403121561058a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156105d557600080fd5b833573ffffffffffffffffffffffffffffffffffffffff811681146105f957600080fd5b925060208401359150604084013567ffffffffffffffff8082111561061d57600080fd5b818601915086601f83011261063157600080fd5b81358181111561064357610643610591565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561068957610689610591565b816040528281528960208487010111156106a257600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b8481528360208201526080604082015260006106e36080830185610514565b905082606083015295945050505050565b600084516107068184602089016104e4565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610742816001850160208a016104e4565b6001920191820152835161075d8160028401602088016104e4565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526107b560c0830184610514565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610821576108216107c1565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261086657610866610828565b500490565b60008282101561087d5761087d6107c1565b500390565b60008261089157610891610828565b500690565b600082198211156108a9576108a96107c1
565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a"
var
L2ToL1MessagePasserDeployedBin
=
"0x6080604052600436106100
695760003560e01c806382e3702d1161004357806382e3702d146100f6578063c2b3e5ac14610136578063ecc704281461014957600080fd5b80633f827a5a1461009257806344df8e70146100bf57806354fd4d50146100d457600080fd5b3661008d5761008b33620186a0604051806020016040528060008152506101ae565b005b600080fd5b34801561009e57600080fd5b506100a7600181565b60405161ffff90911681526020015b60405180910390f35b3480156100cb57600080fd5b5061008b610372565b3480156100e057600080fd5b506100e96103aa565b6040516100b6919061068c565b34801561010257600080fd5b506101266101113660046106a6565b60006020819052908152604090205460ff1681565b60405190151581526020016100b6565b61008b6101443660046106ee565b6101ae565b34801561015557600080fd5b506101a06001547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e010000000000000000000000000000000000000000000000000000000000001790565b6040519081526020016100b6565b60006102446040518060c001604052806102086001547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e010000000000000000000000000000000000000000000000000000000000001790565b815233602082015273ffffffffffffffffffffffffffffffffffffffff871660408201523460608201526080810186905260a00184905261044d565b600081815260208190526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055905073ffffffffffffffffffffffffffffffffffffffff8416336102df6001547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e010000000000000000000000000000000000000000000000000000000000001790565b7f02a52367d10742d8032712c1bb8e0144ff1ec5ffda1ed7d70bb05a27449550543487878760405161031494939291906107f2565b60405180910390a45050600180547dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8082168301167fffff0000000000000000000000000000000000000000000000000000000000009091161790555050565b4761037c8161049a565b60405181907f7967de617a5ac1cc7eba2d6f37570a0135afa950d8bb77cdd35f0d0b4e85a16f90600090a250565b60606103d57f00000000000000000000000000000000000000000000000000000000000000006104c9565b6103fe7f00000000000000000000000000000000000000000000000000000000000000006104c9565b6104277f00000000000000000000000000000000000000000000000000000000000000006104c9565b60405160200161043993929190610822565b604051602081830303815290604052905090565b80516020808301516040808501516060860151608087015160a0880151935160009761047d979096959101610898565b604051602081830303815290604052805190602001209050919050565b806040516104a790610606565b6040518091039082f09050801580156104c4573d6000803e3d6000fd5b505050565b60608160000361050c57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561053657806105208161091e565b915061052f9050600a83610985565b9150610510565b60008167ffffffffffffffff811115610551576105516106bf565b6040519080825280601f01601f19166020018201604052801561057b576020820181803683370190505b5090505b84156105fe57610590600183610999565b915061059d600a866109b0565b6105a89060306109c4565b60f81b8183815181106105bd576105bd6109dc565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506105f7600a86610985565b945061057f565b949350505050565b600880610a0c83390190565b60005b8381101561062d578181015183820152602001610615565b8381111561063c576000848401525b50505050565b6000815180845261065a816020860160208601610612565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061069f6020830184610642565b9392505050565b6000602082840312156106b857600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561070357600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461072757600080fd5b925060208401359150604084013567ffffffffffffffff8082111561074b57600080fd5b818601915086601f83011261075f57600080fd5b813581811115610771576107716106bf565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156107b7576107b76106bf565b816040528281528960208487010111156107d057600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b8481528360208201526080604082015260006108116080830185610642565b905082606083015295945050505050565b60008451610834818460208901610612565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610870816001850160208a01610612565b6001920191820152835161088b816002840160208801610612565b0160020195945050505050565b868152600073ffffffffffffffffffffffffffffffffffffffff808816602084015280871660408401525084606083015283608083015260c060a08301526108e360c0830184610642565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361094f5761094f6108ef565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261099457610994610956565b500490565b6000828210156109ab576109ab6108ef565b500390565b6000826109bf576109bf610956565b500690565b600082198211156109d7576109d76108ef
565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfe608060405230fffea164736f6c634300080f000a"
func
init
()
{
if
err
:=
json
.
Unmarshal
([]
byte
(
L2ToL1MessagePasserStorageLayoutJSON
),
L2ToL1MessagePasserStorageLayout
);
err
!=
nil
{
...
...
op-chain-ops/genesis/config.go
View file @
3659a097
...
...
@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"math/big"
"os"
"path/filepath"
...
...
@@ -339,11 +338,8 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage
return
storage
,
errors
.
New
(
"block base fee not set"
)
}
// Set the initial L2ToL1MessagePasser nonce to
// `type(uint32).max` to prevent nonce collisions
// with historical withdrawals.
storage
[
"L2ToL1MessagePasser"
]
=
state
.
StorageValues
{
"
nonce"
:
math
.
MaxUint32
,
"
msgNonce"
:
0
,
}
storage
[
"L2CrossDomainMessenger"
]
=
state
.
StorageValues
{
"_initialized"
:
1
,
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
3659a097
...
...
@@ -81,8 +81,8 @@ L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageSucceeds() (gas: 53204)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageToSystemContract() (gas: 36172)
L2CrossDomainMessenger_Test:test_L2MessengerRelayMessageV0Fails() (gas: 18870)
L2CrossDomainMessenger_Test:test_L2MessengerRelayShouldRevertIfPaused() (gas: 41596)
L2CrossDomainMessenger_Test:test_L2MessengerSendMessage() (gas: 122
42
3)
L2CrossDomainMessenger_Test:test_L2MessengerTwiceSendMessage() (gas: 134
632
)
L2CrossDomainMessenger_Test:test_L2MessengerSendMessage() (gas: 122
53
3)
L2CrossDomainMessenger_Test:test_L2MessengerTwiceSendMessage() (gas: 134
716
)
L2CrossDomainMessenger_Test:test_L2MessengerXDomainSenderReverts() (gas: 10568)
L2CrossDomainMessenger_Test:test_L2MessengerxDomainMessageSenderResets() (gas: 52615)
L2OutputOracleTest:testCannot_ProposeWithUnmatchedBlockhash() (gas: 29434)
...
...
@@ -118,13 +118,13 @@ L2StandardBridge_Test:test_finalizeBridgeETH_sendToMessengerReverts() (gas: 2396
L2StandardBridge_Test:test_finalizeBridgeETH_sendToSelfReverts() (gas: 23793)
L2StandardBridge_Test:test_finalizeDeposit() (gas: 89363)
L2StandardBridge_Test:test_initialize() (gas: 10536)
L2StandardBridge_Test:test_receive() (gas: 1318
20
)
L2StandardBridge_Test:test_withdraw() (gas: 3439
51
)
L2StandardBridge_Test:test_withdrawTo() (gas: 344
680
)
L2StandardBridge_Test:test_receive() (gas: 1318
62
)
L2StandardBridge_Test:test_withdraw() (gas: 3439
84
)
L2StandardBridge_Test:test_withdrawTo() (gas: 344
713
)
L2StandardBridge_Test:test_withdraw_onlyEOA() (gas: 251816)
L2ToL1MessagePasserTest:test_burn() (gas: 1125
30
)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromContract() (gas: 70
24
6)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromEOA() (gas: 75
76
4)
L2ToL1MessagePasserTest:test_burn() (gas: 1125
94
)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromContract() (gas: 70
35
6)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromEOA() (gas: 75
87
4)
LegacyERC20ETH_Test:test_approve() (gas: 10723)
LegacyERC20ETH_Test:test_burn() (gas: 10615)
LegacyERC20ETH_Test:test_crossDomain() (gas: 6339)
...
...
@@ -293,4 +293,4 @@ SequencerFeeVault_Test:test_constructor() (gas: 5459)
SequencerFeeVault_Test:test_minWithdrawalAmount() (gas: 5418)
SequencerFeeVault_Test:test_receive() (gas: 17316)
SequencerFeeVault_Test:test_revertWithdraw() (gas: 9343)
SequencerFeeVault_Test:test_withdraw() (gas: 1358
37
)
SequencerFeeVault_Test:test_withdraw() (gas: 1358
79
)
packages/contracts-bedrock/.storage-layout
View file @
3659a097
...
...
@@ -256,7 +256,7 @@
+============================================================================================================================+
| sentMessages | mapping(bytes32 => bool) | 0 | 0 | 32 | contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser |
|--------------+--------------------------+------+--------+-------+----------------------------------------------------------|
|
nonce | uint256 | 1 | 0 | 32
| contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser |
|
msgNonce | uint240 | 1 | 0 | 30
| contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser |
+--------------+--------------------------+------+--------+-------+----------------------------------------------------------+
=======================
...
...
packages/contracts-bedrock/contracts/L2/L2ToL1MessagePasser.sol
View file @
3659a097
...
...
@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
import { Types } from "../libraries/Types.sol";
import { Hashing } from "../libraries/Hashing.sol";
import { Encoding } from "../libraries/Encoding.sol";
import { Burn } from "../libraries/Burn.sol";
import { Semver } from "../universal/Semver.sol";
...
...
@@ -20,6 +21,11 @@ contract L2ToL1MessagePasser is Semver {
*/
uint256 internal constant RECEIVE_DEFAULT_GAS_LIMIT = 100_000;
/**
* @notice Current message version identifier.
*/
uint16 public constant MESSAGE_VERSION = 1;
/**
* @notice Includes the message hashes for all withdrawals
*/
...
...
@@ -28,18 +34,18 @@ contract L2ToL1MessagePasser is Semver {
/**
* @notice A unique value hashed with each withdrawal.
*/
uint2
56 public n
once;
uint2
40 internal msgN
once;
/**
* @notice Emitted any time a withdrawal is initiated.
*
* @param nonce Unique value corresponding to each withdrawal.
* @param sender The L2 account address which initiated the withdrawal.
* @param target The L1 account address the call will be send to.
* @param value The ETH value submitted for withdrawal, to be forwarded to the target.
* @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 withdrawalHash
The hash of the withdrawal.
* @param nonce
Unique value corresponding to each withdrawal.
* @param sender
The L2 account address which initiated the withdrawal.
* @param target
The L1 account address the call will be send to.
* @param value
The ETH value submitted for withdrawal, to be forwarded to the target.
* @param gasLimit
The minimum amount of gas that must be provided when withdrawing
.
* @param data
The data to be forwarded to the target on L1.
* @param withdrawalHash The hash of the withdrawal.
*/
event MessagePassed(
uint256 indexed nonce,
...
...
@@ -96,7 +102,7 @@ contract L2ToL1MessagePasser is Semver {
) public payable {
bytes32 withdrawalHash = Hashing.hashWithdrawal(
Types.WithdrawalTransaction({
nonce:
nonce
,
nonce:
messageNonce()
,
sender: msg.sender,
target: _target,
value: msg.value,
...
...
@@ -107,9 +113,29 @@ contract L2ToL1MessagePasser is Semver {
sentMessages[withdrawalHash] = true;
emit MessagePassed(nonce, msg.sender, _target, msg.value, _gasLimit, _data, withdrawalHash);
emit MessagePassed(
messageNonce(),
msg.sender,
_target,
msg.value,
_gasLimit,
_data,
withdrawalHash
);
unchecked {
++
n
once;
++
msgN
once;
}
}
/**
* @notice Retrieves the next message nonce. Message version will be added to the upper two
* bytes of the message nonce. Message version allows us to treat messages as having
* different structures.
*
* @return Nonce of the next message to be sent, with added message version.
*/
function messageNonce() public view returns (uint256) {
return Encoding.encodeVersionedNonce(msgNonce, MESSAGE_VERSION);
}
}
packages/contracts-bedrock/contracts/test/L2CrossDomainMessenger.t.sol
View file @
3659a097
...
...
@@ -58,7 +58,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
// MessagePassed event
vm.expectEmit(true, true, true, true);
emit MessagePassed(
messagePasser.
n
once(),
messagePasser.
messageN
once(),
address(L2Messenger),
address(L1Messenger),
0,
...
...
@@ -66,7 +66,7 @@ contract L2CrossDomainMessenger_Test is Messenger_Initializer {
xDomainCallData,
Hashing.hashWithdrawal(
Types.WithdrawalTransaction({
nonce: messagePasser.
n
once(),
nonce: messagePasser.
messageN
once(),
sender: address(L2Messenger),
target: address(L1Messenger),
value: 0,
...
...
packages/contracts-bedrock/contracts/test/L2ToL1MessagePasser.t.sol
View file @
3659a097
...
...
@@ -32,7 +32,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
uint256 _gasLimit,
bytes memory _data
) external {
uint256 nonce = messagePasser.
n
once();
uint256 nonce = messagePasser.
messageN
once();
bytes32 withdrawalHash = Hashing.hashWithdrawal(
Types.WithdrawalTransaction({
...
...
@@ -63,7 +63,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
function test_initiateWithdrawal_fromContract() external {
bytes32 withdrawalHash = Hashing.hashWithdrawal(
Types.WithdrawalTransaction(
messagePasser.
n
once(),
messagePasser.
messageN
once(),
address(this),
address(4),
100,
...
...
@@ -74,7 +74,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
vm.expectEmit(true, true, true, true);
emit MessagePassed(
messagePasser.
n
once(),
messagePasser.
messageN
once(),
address(this),
address(4),
100,
...
...
@@ -93,7 +93,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
address target = address(4);
uint256 value = 100;
bytes memory data = hex"ff";
uint256 nonce = messagePasser.
n
once();
uint256 nonce = messagePasser.
messageN
once();
// EOA emulation
vm.prank(alice, alice);
...
...
@@ -110,7 +110,7 @@ contract L2ToL1MessagePasserTest is CommonTest {
// the sent messages mapping is filled
assertEq(messagePasser.sentMessages(withdrawalHash), true);
// the nonce increments
assertEq(nonce + 1, messagePasser.
n
once());
assertEq(nonce + 1, messagePasser.
messageN
once());
}
// Test: burn should destroy the ETH held in the contract
...
...
packages/contracts-bedrock/contracts/test/OptimismPortal.t.sol
View file @
3659a097
...
...
@@ -814,7 +814,7 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
// Total ETH supply is currently about 120M ETH.
uint256 value = bound(_value, 0, 200_000_000 ether);
uint256 gasLimit = bound(_gasLimit, 0, 50_000_000);
uint256 nonce = messagePasser.
n
once();
uint256 nonce = messagePasser.
messageN
once();
Types.WithdrawalTransaction memory _tx = Types.WithdrawalTransaction({
nonce: nonce,
sender: _sender,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment