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
731bad4e
Commit
731bad4e
authored
Jan 18, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into refcell/bindings
parents
6755bfc2
e768427b
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
275 additions
and
382 deletions
+275
-382
message.go
op-chain-ops/crossdomain/message.go
+6
-6
migrate.go
op-chain-ops/crossdomain/migrate.go
+1
-1
withdrawal.go
op-chain-ops/crossdomain/withdrawal.go
+8
-6
derivation.md
specs/derivation.md
+260
-369
No files found.
op-chain-ops/crossdomain/message.go
View file @
731bad4e
...
@@ -14,12 +14,12 @@ import (
...
@@ -14,12 +14,12 @@ import (
// version 1 messages have a value and the most significant
// version 1 messages have a value and the most significant
// byte of the nonce is a 1
// byte of the nonce is a 1
type
CrossDomainMessage
struct
{
type
CrossDomainMessage
struct
{
Nonce
*
big
.
Int
Nonce
*
big
.
Int
`json:"nonce"`
Sender
*
common
.
Address
Sender
*
common
.
Address
`json:"sender"`
Target
*
common
.
Address
Target
*
common
.
Address
`json:"target"`
Value
*
big
.
Int
Value
*
big
.
Int
`json:"value"`
GasLimit
*
big
.
Int
GasLimit
*
big
.
Int
`json:"gasLimit"`
Data
[]
byte
Data
[]
byte
`json:"data"`
}
}
// NewCrossDomainMessage creates a CrossDomainMessage.
// NewCrossDomainMessage creates a CrossDomainMessage.
...
...
op-chain-ops/crossdomain/migrate.go
View file @
731bad4e
...
@@ -76,7 +76,7 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
...
@@ -76,7 +76,7 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
withdrawal
.
Target
,
withdrawal
.
Target
,
value
,
value
,
new
(
big
.
Int
),
new
(
big
.
Int
),
withdrawal
.
Data
,
[]
byte
(
withdrawal
.
Data
)
,
)
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot abi encode relayMessage: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot abi encode relayMessage: %w"
,
err
)
...
...
op-chain-ops/crossdomain/withdrawal.go
View file @
731bad4e
...
@@ -2,11 +2,13 @@ package crossdomain
...
@@ -2,11 +2,13 @@ package crossdomain
import
(
import
(
"errors"
"errors"
"fmt"
"math/big"
"math/big"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
)
)
...
@@ -28,7 +30,7 @@ type Withdrawal struct {
...
@@ -28,7 +30,7 @@ type Withdrawal struct {
Target
*
common
.
Address
`json:"target"`
Target
*
common
.
Address
`json:"target"`
Value
*
big
.
Int
`json:"value"`
Value
*
big
.
Int
`json:"value"`
GasLimit
*
big
.
Int
`json:"gasLimit"`
GasLimit
*
big
.
Int
`json:"gasLimit"`
Data
[]
byte
`json:"data"`
Data
hexutil
.
Bytes
`json:"data"`
}
}
// NewWithdrawal will create a Withdrawal
// NewWithdrawal will create a Withdrawal
...
@@ -44,7 +46,7 @@ func NewWithdrawal(
...
@@ -44,7 +46,7 @@ func NewWithdrawal(
Target
:
target
,
Target
:
target
,
Value
:
value
,
Value
:
value
,
GasLimit
:
gasLimit
,
GasLimit
:
gasLimit
,
Data
:
data
,
Data
:
hexutil
.
Bytes
(
data
)
,
}
}
}
}
...
@@ -58,9 +60,9 @@ func (w *Withdrawal) Encode() ([]byte, error) {
...
@@ -58,9 +60,9 @@ func (w *Withdrawal) Encode() ([]byte, error) {
{
Name
:
"gasLimit"
,
Type
:
Uint256Type
},
{
Name
:
"gasLimit"
,
Type
:
Uint256Type
},
{
Name
:
"data"
,
Type
:
BytesType
},
{
Name
:
"data"
,
Type
:
BytesType
},
}
}
enc
,
err
:=
args
.
Pack
(
w
.
Nonce
,
w
.
Sender
,
w
.
Target
,
w
.
Value
,
w
.
GasLimit
,
w
.
Data
)
enc
,
err
:=
args
.
Pack
(
w
.
Nonce
,
w
.
Sender
,
w
.
Target
,
w
.
Value
,
w
.
GasLimit
,
[]
byte
(
w
.
Data
)
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot encode withdrawal: %w"
,
err
)
}
}
return
enc
,
nil
return
enc
,
nil
}
}
...
@@ -110,7 +112,7 @@ func (w *Withdrawal) Decode(data []byte) error {
...
@@ -110,7 +112,7 @@ func (w *Withdrawal) Decode(data []byte) error {
w
.
Target
=
&
target
w
.
Target
=
&
target
w
.
Value
=
value
w
.
Value
=
value
w
.
GasLimit
=
gasLimit
w
.
GasLimit
=
gasLimit
w
.
Data
=
msgData
w
.
Data
=
hexutil
.
Bytes
(
msgData
)
return
nil
return
nil
}
}
...
@@ -150,6 +152,6 @@ func (w *Withdrawal) WithdrawalTransaction() bindings.TypesWithdrawalTransaction
...
@@ -150,6 +152,6 @@ func (w *Withdrawal) WithdrawalTransaction() bindings.TypesWithdrawalTransaction
Target
:
*
w
.
Target
,
Target
:
*
w
.
Target
,
Value
:
w
.
Value
,
Value
:
w
.
Value
,
GasLimit
:
w
.
GasLimit
,
GasLimit
:
w
.
GasLimit
,
Data
:
w
.
Data
,
Data
:
[]
byte
(
w
.
Data
)
,
}
}
}
}
specs/derivation.md
View file @
731bad4e
This diff is collapsed.
Click to expand it.
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