Commit 731bad4e authored by Andreas Bigger's avatar Andreas Bigger

Merge branch 'develop' into refcell/bindings

parents 6755bfc2 e768427b
...@@ -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.
......
...@@ -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)
......
...@@ -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),
} }
} }
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment