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
8ee24756
Unverified
Commit
8ee24756
authored
Jan 18, 2023
by
mergify[bot]
Committed by
GitHub
Jan 18, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4730 from ethereum-optimism/feat/better-encode-wd
op-chain-ops: `Withdrawal` type use `hexutil.Bytes`
parents
b002d657
614b1723
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
migrate.go
op-chain-ops/crossdomain/migrate.go
+1
-1
withdrawal.go
op-chain-ops/crossdomain/withdrawal.go
+8
-6
No files found.
op-chain-ops/crossdomain/migrate.go
View file @
8ee24756
...
...
@@ -76,7 +76,7 @@ func MigrateWithdrawal(withdrawal *LegacyWithdrawal, l1CrossDomainMessenger *com
withdrawal
.
Target
,
value
,
new
(
big
.
Int
),
withdrawal
.
Data
,
[]
byte
(
withdrawal
.
Data
)
,
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot abi encode relayMessage: %w"
,
err
)
...
...
op-chain-ops/crossdomain/withdrawal.go
View file @
8ee24756
...
...
@@ -2,11 +2,13 @@ package crossdomain
import
(
"errors"
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"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"
)
...
...
@@ -28,7 +30,7 @@ type Withdrawal struct {
Target
*
common
.
Address
`json:"target"`
Value
*
big
.
Int
`json:"value"`
GasLimit
*
big
.
Int
`json:"gasLimit"`
Data
[]
byte
`json:"data"`
Data
hexutil
.
Bytes
`json:"data"`
}
// NewWithdrawal will create a Withdrawal
...
...
@@ -44,7 +46,7 @@ func NewWithdrawal(
Target
:
target
,
Value
:
value
,
GasLimit
:
gasLimit
,
Data
:
data
,
Data
:
hexutil
.
Bytes
(
data
)
,
}
}
...
...
@@ -58,9 +60,9 @@ func (w *Withdrawal) Encode() ([]byte, error) {
{
Name
:
"gasLimit"
,
Type
:
Uint256Type
},
{
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
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot encode withdrawal: %w"
,
err
)
}
return
enc
,
nil
}
...
...
@@ -110,7 +112,7 @@ func (w *Withdrawal) Decode(data []byte) error {
w
.
Target
=
&
target
w
.
Value
=
value
w
.
GasLimit
=
gasLimit
w
.
Data
=
msgData
w
.
Data
=
hexutil
.
Bytes
(
msgData
)
return
nil
}
...
...
@@ -150,6 +152,6 @@ func (w *Withdrawal) WithdrawalTransaction() bindings.TypesWithdrawalTransaction
Target
:
*
w
.
Target
,
Value
:
w
.
Value
,
GasLimit
:
w
.
GasLimit
,
Data
:
w
.
Data
,
Data
:
[]
byte
(
w
.
Data
)
,
}
}
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