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
b2242f40
Commit
b2242f40
authored
Dec 20, 2022
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: more fixes
parent
de9a9a16
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
566 additions
and
319 deletions
+566
-319
main.go
op-chain-ops/cmd/withdrawals/main.go
+556
-316
legacy_withdrawal.go
op-chain-ops/crossdomain/legacy_withdrawal.go
+4
-3
message.go
op-chain-ops/crossdomain/message.go
+6
-0
No files found.
op-chain-ops/cmd/withdrawals/main.go
View file @
b2242f40
This diff is collapsed.
Click to expand it.
op-chain-ops/crossdomain/legacy_withdrawal.go
View file @
b2242f40
...
...
@@ -10,6 +10,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
...
...
@@ -17,7 +18,7 @@ import (
type
LegacyWithdrawal
struct
{
Target
*
common
.
Address
`json:"target"`
Sender
*
common
.
Address
`json:"sender"`
Data
[]
byte
`json:"data"`
Data
hexutil
.
Bytes
`json:"data"`
Nonce
*
big
.
Int
`json:"nonce"`
}
...
...
@@ -38,7 +39,7 @@ func NewLegacyWithdrawal(target, sender *common.Address, data []byte, nonce *big
// through the standard optimism cross domain messaging system by hashing in
// the L2CrossDomainMessenger address.
func
(
w
*
LegacyWithdrawal
)
Encode
()
([]
byte
,
error
)
{
enc
,
err
:=
EncodeCrossDomainMessageV0
(
w
.
Target
,
w
.
Sender
,
w
.
Data
,
w
.
Nonce
)
enc
,
err
:=
EncodeCrossDomainMessageV0
(
w
.
Target
,
w
.
Sender
,
[]
byte
(
w
.
Data
)
,
w
.
Nonce
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot encode LegacyWithdrawal: %w"
,
err
)
}
...
...
@@ -98,7 +99,7 @@ func (w *LegacyWithdrawal) Decode(data []byte) error {
w
.
Target
=
&
target
w
.
Sender
=
&
sender
w
.
Data
=
msgData
w
.
Data
=
hexutil
.
Bytes
(
msgData
)
w
.
Nonce
=
nonce
return
nil
}
...
...
op-chain-ops/crossdomain/message.go
View file @
b2242f40
...
...
@@ -72,6 +72,12 @@ func (c *CrossDomainMessage) Hash() (common.Hash, error) {
}
}
// HashV1 forces using the V1 hash even if its a legacy hash. This is used
// for the migration process.
func
(
c
*
CrossDomainMessage
)
HashV1
()
(
common
.
Hash
,
error
)
{
return
HashCrossDomainMessageV1
(
c
.
Nonce
,
c
.
Sender
,
c
.
Target
,
c
.
Value
,
c
.
GasLimit
,
c
.
Data
)
}
// ToWithdrawal will turn a CrossDomainMessage into a Withdrawal.
// This only works for version 0 CrossDomainMessages as not all of
// the data is present for version 1 CrossDomainMessages to be turned
...
...
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