Skip to content

Add ArbitrumRetryTx type #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions core/types/arb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,39 @@ type ArbitrumRetryTx struct {
RefundTo common.Address
}

func (tx *ArbitrumRetryTx) txType() byte { return ArbitrumRetryTxType }

func (tx *ArbitrumRetryTx) copy() TxData {
contractTx := ArbitrumContractTx{
ChainId: new(big.Int),
RequestId: tx.RequestId,
GasPrice: new(big.Int),
Gas: tx.Gas,
From: tx.From,
To: nil,
Value: new(big.Int),
Data: common.CopyBytes(tx.Data),
}
if tx.ChainId != nil {
contractTx.ChainId.Set(tx.ChainId)
}
if tx.GasPrice != nil {
contractTx.GasPrice.Set(tx.GasPrice)
}
if tx.To != nil {
tmp := *tx.To
contractTx.To = &tmp
}
if tx.Value != nil {
contractTx.Value.Set(tx.Value)
}
return &ArbitrumRetryTx{
contractTx,
tx.TicketId,
tx.RefundTo,
}
}

func (tx *ArbitrumRetryTx) chainID() *big.Int { return tx.ArbitrumContractTx.chainID() }
func (tx *ArbitrumRetryTx) accessList() AccessList { return tx.ArbitrumContractTx.accessList() }
func (tx *ArbitrumRetryTx) data() []byte { return tx.ArbitrumContractTx.data() }
Expand Down
4 changes: 4 additions & 0 deletions core/types/arbitrum_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func (s arbitrumSigner) Sender(tx *Transaction) (common.Address, error) {
return inner.From, nil
case *ArbitrumDepositTx:
return arbAddress, nil
case *ArbitrumRetryTx:
return inner.From, nil
default:
return s.Signer.Sender(tx)
}
Expand All @@ -40,6 +42,8 @@ func (s arbitrumSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *b
return bigZero, bigZero, bigZero, nil
case *ArbitrumDepositTx:
return bigZero, bigZero, bigZero, nil
case *ArbitrumRetryTx:
return bigZero, bigZero, bigZero, nil
default:
return s.Signer.SignatureValues(tx, sig)
}
Expand Down
5 changes: 5 additions & 0 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (
ArbitrumUnsignedTxType = 201
ArbitrumContractTxType = 202
ArbitrumWrappedTxType = 203
ArbitrumRetryTxType = 204
)

// Transaction is an Ethereum transaction.
Expand Down Expand Up @@ -201,6 +202,10 @@ func (tx *Transaction) decodeTyped(b []byte, arbParsing bool) (TxData, error) {
var inner ArbitrumWrappedTx
err := rlp.DecodeBytes(b[1:], &inner)
return &inner, err
case ArbitrumRetryTxType:
var inner ArbitrumRetryTx
err := rlp.DecodeBytes(b[1:], &inner)
return &inner, err
}
}
switch b[0] {
Expand Down