From b5750141992f445b66b6e98a6ba37b91fc0c3817 Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Thu, 28 Oct 2021 08:06:29 -0400 Subject: [PATCH 01/10] Add ArbitrumRetryTx type --- core/types/arb_types.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/types/arb_types.go b/core/types/arb_types.go index 5d331cf1d2..b45b309e57 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -130,6 +130,28 @@ func (tx *ArbitrumContractTx) rawSignatureValues() (v, r, s *big.Int) { func (tx *ArbitrumContractTx) setSignatureValues(chainID, v, r, s *big.Int) {} func (tx *ArbitrumContractTx) isFake() bool { return true } +type ArbitrumRetryTx struct { + ArbitrumContractTx + TicketId common.Hash + RefundTo common.Address +} + +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() } +func (tx *ArbitrumRetryTx) gas() uint64 { return tx.ArbitrumContractTx.gas() } +func (tx *ArbitrumRetryTx) gasPrice() *big.Int { return tx.ArbitrumContractTx.gasPrice() } +func (tx *ArbitrumRetryTx) gasTipCap() *big.Int { return tx.ArbitrumContractTx.gasTipCap() } +func (tx *ArbitrumRetryTx) gasFeeCap() *big.Int { return tx.ArbitrumContractTx.gasFeeCap() } +func (tx *ArbitrumRetryTx) value() *big.Int { return tx.ArbitrumContractTx.value() } +func (tx *ArbitrumRetryTx) nonce() uint64 { return tx.ArbitrumContractTx.nonce() } +func (tx *ArbitrumRetryTx) to() *common.Address { return tx.ArbitrumContractTx.to() } +func (tx *ArbitrumRetryTx) rawSignatureValues() (v, r, s *big.Int) { + return tx.ArbitrumContractTx.rawSignatureValues() +} +func (tx *ArbitrumRetryTx) setSignatureValues(chainID, v, r, s *big.Int) { tx.ArbitrumContractTx.setSignatureValues(chainID, v, r, s)} +func (tx *ArbitrumRetryTx) isFake() bool { return tx.ArbitrumContractTx.isFake() } + type ArbitrumDepositTx struct { ChainId *big.Int L1RequestId common.Hash From be063734458dcd6eed37bfd733e4d08b8e43709f Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Thu, 28 Oct 2021 16:42:01 -0400 Subject: [PATCH 02/10] Fill out methods and ser/de for ArbRetryTx --- core/types/arb_types.go | 33 +++++++++++++++++++++++++++++++++ core/types/arbitrum_signer.go | 4 ++++ core/types/transaction.go | 5 +++++ 3 files changed, 42 insertions(+) diff --git a/core/types/arb_types.go b/core/types/arb_types.go index b45b309e57..db598a692c 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -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() } diff --git a/core/types/arbitrum_signer.go b/core/types/arbitrum_signer.go index d9cf4a0577..3f082b55c1 100644 --- a/core/types/arbitrum_signer.go +++ b/core/types/arbitrum_signer.go @@ -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) } @@ -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) } diff --git a/core/types/transaction.go b/core/types/transaction.go index 0271ee4946..3b332b68be 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -49,6 +49,7 @@ const ( ArbitrumUnsignedTxType = 201 ArbitrumContractTxType = 202 ArbitrumWrappedTxType = 203 + ArbitrumRetryTxType = 204 ) // Transaction is an Ethereum transaction. @@ -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] { From 203d5c4d08408dee8dd4434459c8d9d12649e029 Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Thu, 28 Oct 2021 17:04:27 -0400 Subject: [PATCH 03/10] Add ArbitrumSubmitRetryableTx type --- core/types/arb_types.go | 57 +++++++++++++++++++++++++++++++++++++++ core/types/transaction.go | 5 ++++ 2 files changed, 62 insertions(+) diff --git a/core/types/arb_types.go b/core/types/arb_types.go index db598a692c..9fd35e6a3e 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -185,6 +185,63 @@ func (tx *ArbitrumRetryTx) rawSignatureValues() (v, r, s *big.Int) { func (tx *ArbitrumRetryTx) setSignatureValues(chainID, v, r, s *big.Int) { tx.ArbitrumContractTx.setSignatureValues(chainID, v, r, s)} func (tx *ArbitrumRetryTx) isFake() bool { return tx.ArbitrumContractTx.isFake() } +type ArbitrumSubmitRetryableTx struct { + ChainId *big.Int + RequestId common.Hash + From common.Address + + GasPrice *big.Int // wei per gas + Gas uint64 // gas limit + To *common.Address `rlp:"nil"` // nil means contract creation + Value *big.Int // wei amount + Data []byte // contract invocation input data +} + +func (tx *ArbitrumSubmitRetryableTx) txType() byte { return ArbitrumSubmitRetryableTxType } + +func (tx *ArbitrumSubmitRetryableTx) copy() TxData { + cpy := &ArbitrumSubmitRetryableTx{ + 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 { + cpy.ChainId.Set(tx.ChainId) + } + if tx.GasPrice != nil { + cpy.GasPrice.Set(tx.GasPrice) + } + if tx.To != nil { + tmp := *tx.To + cpy.To = &tmp + } + if tx.Value != nil { + cpy.Value.Set(tx.Value) + } + return cpy +} + +func (tx *ArbitrumSubmitRetryableTx) chainID() *big.Int { return tx.ChainId } +func (tx *ArbitrumSubmitRetryableTx) accessList() AccessList { return nil } +func (tx *ArbitrumSubmitRetryableTx) data() []byte { return tx.Data } +func (tx *ArbitrumSubmitRetryableTx) gas() uint64 { return tx.Gas } +func (tx *ArbitrumSubmitRetryableTx) gasPrice() *big.Int { return tx.GasPrice } +func (tx *ArbitrumSubmitRetryableTx) gasTipCap() *big.Int { return tx.GasPrice } +func (tx *ArbitrumSubmitRetryableTx) gasFeeCap() *big.Int { return tx.GasPrice } +func (tx *ArbitrumSubmitRetryableTx) value() *big.Int { return tx.Value } +func (tx *ArbitrumSubmitRetryableTx) nonce() uint64 { return 0 } +func (tx *ArbitrumSubmitRetryableTx) to() *common.Address { return tx.To } +func (tx *ArbitrumSubmitRetryableTx) rawSignatureValues() (v, r, s *big.Int) { + return bigZero, bigZero, bigZero +} +func (tx *ArbitrumSubmitRetryableTx) setSignatureValues(chainID, v, r, s *big.Int) {} +func (tx *ArbitrumSubmitRetryableTx) isFake() bool { return true } + type ArbitrumDepositTx struct { ChainId *big.Int L1RequestId common.Hash diff --git a/core/types/transaction.go b/core/types/transaction.go index 3b332b68be..fdcf8a1f48 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -50,6 +50,7 @@ const ( ArbitrumContractTxType = 202 ArbitrumWrappedTxType = 203 ArbitrumRetryTxType = 204 + ArbitrumSubmitRetryableTxType = 205 ) // Transaction is an Ethereum transaction. @@ -206,6 +207,10 @@ func (tx *Transaction) decodeTyped(b []byte, arbParsing bool) (TxData, error) { var inner ArbitrumRetryTx err := rlp.DecodeBytes(b[1:], &inner) return &inner, err + case ArbitrumSubmitRetryableTxType: + var inner ArbitrumSubmitRetryableTx + err := rlp.DecodeBytes(b[1:], &inner) + return &inner, err } } switch b[0] { From a60ab22019a35a584182435d95119f80f5983879 Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Fri, 5 Nov 2021 10:13:02 -0400 Subject: [PATCH 04/10] Add ArbSubmitRetryableTx field and reformat --- core/types/arb_types.go | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/core/types/arb_types.go b/core/types/arb_types.go index 9fd35e6a3e..cee050c4ef 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -132,8 +132,8 @@ func (tx *ArbitrumContractTx) isFake() bool { re type ArbitrumRetryTx struct { ArbitrumContractTx - TicketId common.Hash - RefundTo common.Address + TicketId common.Hash + RefundTo common.Address } func (tx *ArbitrumRetryTx) txType() byte { return ArbitrumRetryTxType } @@ -182,33 +182,37 @@ func (tx *ArbitrumRetryTx) to() *common.Address { return tx.ArbitrumContractT func (tx *ArbitrumRetryTx) rawSignatureValues() (v, r, s *big.Int) { return tx.ArbitrumContractTx.rawSignatureValues() } -func (tx *ArbitrumRetryTx) setSignatureValues(chainID, v, r, s *big.Int) { tx.ArbitrumContractTx.setSignatureValues(chainID, v, r, s)} -func (tx *ArbitrumRetryTx) isFake() bool { return tx.ArbitrumContractTx.isFake() } +func (tx *ArbitrumRetryTx) setSignatureValues(chainID, v, r, s *big.Int) { + tx.ArbitrumContractTx.setSignatureValues(chainID, v, r, s) +} +func (tx *ArbitrumRetryTx) isFake() bool { return tx.ArbitrumContractTx.isFake() } type ArbitrumSubmitRetryableTx struct { ChainId *big.Int RequestId common.Hash From common.Address - GasPrice *big.Int // wei per gas - Gas uint64 // gas limit - To *common.Address `rlp:"nil"` // nil means contract creation - Value *big.Int // wei amount - Data []byte // contract invocation input data + GasPrice *big.Int // wei per gas + Gas uint64 // gas limit + To *common.Address `rlp:"nil"` // nil means contract creation + Value *big.Int // wei amount + Beneficiary common.Address + Data []byte // contract invocation input data } func (tx *ArbitrumSubmitRetryableTx) txType() byte { return ArbitrumSubmitRetryableTxType } func (tx *ArbitrumSubmitRetryableTx) copy() TxData { cpy := &ArbitrumSubmitRetryableTx{ - 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), + ChainId: new(big.Int), + RequestId: tx.RequestId, + GasPrice: new(big.Int), + Gas: tx.Gas, + From: tx.From, + To: nil, + Value: new(big.Int), + Beneficiary: tx.Beneficiary, + Data: common.CopyBytes(tx.Data), } if tx.ChainId != nil { cpy.ChainId.Set(tx.ChainId) From 14fb7671185bb682c782f078d9da058ffb1f8a63 Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Mon, 8 Nov 2021 14:13:19 -0500 Subject: [PATCH 05/10] Bug fixes --- core/types/arb_types.go | 2 +- core/types/transaction.go | 14 +++++++------- core/types/transaction_signing.go | 12 ++++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/core/types/arb_types.go b/core/types/arb_types.go index cee050c4ef..6ad744d420 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -275,7 +275,7 @@ func (d *ArbitrumDepositTx) copy() TxData { func (d *ArbitrumDepositTx) chainID() *big.Int { return d.ChainId } func (d *ArbitrumDepositTx) accessList() AccessList { return nil } func (d *ArbitrumDepositTx) data() []byte { return nil } -func (d ArbitrumDepositTx) gas() uint64 { return 0 } +func (d *ArbitrumDepositTx) gas() uint64 { return 0 } func (d *ArbitrumDepositTx) gasPrice() *big.Int { return bigZero } func (d *ArbitrumDepositTx) gasTipCap() *big.Int { return bigZero } func (d *ArbitrumDepositTx) gasFeeCap() *big.Int { return bigZero } diff --git a/core/types/transaction.go b/core/types/transaction.go index fdcf8a1f48..ca48e209bd 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -45,12 +45,12 @@ const ( LegacyTxType = iota AccessListTxType DynamicFeeTxType - ArbitrumDepositTxType = 200 - ArbitrumUnsignedTxType = 201 - ArbitrumContractTxType = 202 - ArbitrumWrappedTxType = 203 - ArbitrumRetryTxType = 204 - ArbitrumSubmitRetryableTxType = 205 + ArbitrumDepositTxType = 100 + ArbitrumUnsignedTxType = 101 + ArbitrumContractTxType = 102 + ArbitrumWrappedTxType = 103 + ArbitrumRetryTxType = 104 + ArbitrumSubmitRetryableTxType = 105 ) // Transaction is an Ethereum transaction. @@ -172,7 +172,7 @@ func (tx *Transaction) UnmarshalBinary(b []byte) error { return nil } // It's an EIP2718 typed transaction envelope. - inner, err := tx.decodeTyped(b, false) + inner, err := tx.decodeTyped(b, true) if err != nil { return err } diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 073a1e7907..0920f72336 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -277,6 +277,18 @@ func (s eip2930Signer) Sender(tx *Transaction) (common.Address, error) { // AL txs are defined to use 0 and 1 as their recovery // id, add 27 to become equivalent to unprotected Homestead signatures. V = new(big.Int).Add(V, big.NewInt(27)) + case ArbitrumDepositTxType: + return tx.inner.(*ArbitrumDepositTx).To, nil + case ArbitrumUnsignedTxType: + return tx.inner.(*ArbitrumUnsignedTx).From, nil + case ArbitrumContractTxType: + return tx.inner.(*ArbitrumContractTx).From, nil + case ArbitrumWrappedTxType: + return s.Sender(NewTx(tx.inner.(*ArbitrumWrappedTx).TxData)) + case ArbitrumRetryTxType: + return tx.inner.(*ArbitrumRetryTx).From, nil + case ArbitrumSubmitRetryableTxType: + return tx.inner.(*ArbitrumSubmitRetryableTx).From, nil default: return common.Address{}, ErrTxTypeNotSupported } From 12c0cdb4920cc670a0e1506adc81148a2c6a1060 Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Wed, 17 Nov 2021 12:25:19 -0500 Subject: [PATCH 06/10] Add SubmitRetryableTx to case statements --- core/types/arbitrum_signer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/types/arbitrum_signer.go b/core/types/arbitrum_signer.go index 3f082b55c1..0b5c4d94ff 100644 --- a/core/types/arbitrum_signer.go +++ b/core/types/arbitrum_signer.go @@ -24,6 +24,8 @@ func (s arbitrumSigner) Sender(tx *Transaction) (common.Address, error) { return arbAddress, nil case *ArbitrumRetryTx: return inner.From, nil + case *ArbitrumSubmitRetryableTx: + return inner.From, nil default: return s.Signer.Sender(tx) } @@ -44,6 +46,8 @@ func (s arbitrumSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *b return bigZero, bigZero, bigZero, nil case *ArbitrumRetryTx: return bigZero, bigZero, bigZero, nil + case *ArbitrumSubmitRetryableTx: + return bigZero, bigZero, bigZero, nil default: return s.Signer.SignatureValues(tx, sig) } From a2e19f82e4eed71bd34f55953a395dd4154f9c29 Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Fri, 19 Nov 2021 07:28:36 -0500 Subject: [PATCH 07/10] Retryables pass first test --- core/state_transition.go | 4 ++-- core/types/arb_types.go | 38 +++++++++++++++++++++++++------------- core/types/transaction.go | 2 ++ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index f8e5fe2d69..98bb7fd91b 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -33,7 +33,7 @@ import ( var emptyCodeHash = crypto.Keccak256Hash(nil) type TxProcessingHook interface { - InterceptMessage() (*ExecutionResult, error) + StartTxHook() (*ExecutionResult, error) ExtraGasChargingHook(gasRemaining *uint64, gasPool *GasPool) error EndTxHook(totalGasUsed uint64, gasPool *GasPool, success bool) error } @@ -366,7 +366,7 @@ func (st *StateTransition) transitionDbImpl() (*ExecutionResult, error) { func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { if st.processingHook != nil { - res, err := st.processingHook.InterceptMessage() + res, err := st.processingHook.StartTxHook() if res != nil || err != nil { return res, err } diff --git a/core/types/arb_types.go b/core/types/arb_types.go index 6ad744d420..512076dd69 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -188,16 +188,19 @@ func (tx *ArbitrumRetryTx) setSignatureValues(chainID, v, r, s *big.Int) { func (tx *ArbitrumRetryTx) isFake() bool { return tx.ArbitrumContractTx.isFake() } type ArbitrumSubmitRetryableTx struct { - ChainId *big.Int - RequestId common.Hash - From common.Address - - GasPrice *big.Int // wei per gas - Gas uint64 // gas limit - To *common.Address `rlp:"nil"` // nil means contract creation - Value *big.Int // wei amount - Beneficiary common.Address - Data []byte // contract invocation input data + ChainId *big.Int + RequestId common.Hash + From common.Address + + DepositValue *big.Int + GasPrice *big.Int // wei per gas + Gas uint64 // gas limit + To *common.Address `rlp:"nil"` // nil means contract creation + Value *big.Int // wei amount + Beneficiary common.Address + SubmissionFeePaid *big.Int + FeeRefundAddr common.Address + Data []byte // contract invocation input data } func (tx *ArbitrumSubmitRetryableTx) txType() byte { return ArbitrumSubmitRetryableTxType } @@ -206,17 +209,23 @@ func (tx *ArbitrumSubmitRetryableTx) copy() TxData { cpy := &ArbitrumSubmitRetryableTx{ ChainId: new(big.Int), RequestId: tx.RequestId, - GasPrice: new(big.Int), + DepositValue: tx.DepositValue, + GasPrice: tx.GasPrice, Gas: tx.Gas, From: tx.From, - To: nil, - Value: new(big.Int), + To: tx.To, + Value: tx.Value, Beneficiary: tx.Beneficiary, + SubmissionFeePaid: tx.SubmissionFeePaid, + FeeRefundAddr: tx.FeeRefundAddr, Data: common.CopyBytes(tx.Data), } if tx.ChainId != nil { cpy.ChainId.Set(tx.ChainId) } + if tx.DepositValue != nil { + cpy.DepositValue.Set(tx.DepositValue) + } if tx.GasPrice != nil { cpy.GasPrice.Set(tx.GasPrice) } @@ -227,6 +236,9 @@ func (tx *ArbitrumSubmitRetryableTx) copy() TxData { if tx.Value != nil { cpy.Value.Set(tx.Value) } + if tx.SubmissionFeePaid != nil { + cpy.SubmissionFeePaid.Set(tx.SubmissionFeePaid) + } return cpy } diff --git a/core/types/transaction.go b/core/types/transaction.go index ca48e209bd..2a49852ef1 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -422,6 +422,8 @@ func (tx *Transaction) Hash() common.Hash { var h common.Hash if tx.Type() == LegacyTxType { h = rlpHash(tx.inner) + } else if tx.Type() == ArbitrumSubmitRetryableTxType { + h = tx.inner.(*ArbitrumSubmitRetryableTx).RequestId } else { h = prefixedRlpHash(tx.Type(), tx.inner) } From 36bcc1d0b82eb08409b02a7367c4e5154d0a707d Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Tue, 23 Nov 2021 12:40:47 -0500 Subject: [PATCH 08/10] Small improvement --- core/types/arb_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/types/arb_types.go b/core/types/arb_types.go index 512076dd69..de0b725027 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -185,7 +185,7 @@ func (tx *ArbitrumRetryTx) rawSignatureValues() (v, r, s *big.Int) { func (tx *ArbitrumRetryTx) setSignatureValues(chainID, v, r, s *big.Int) { tx.ArbitrumContractTx.setSignatureValues(chainID, v, r, s) } -func (tx *ArbitrumRetryTx) isFake() bool { return tx.ArbitrumContractTx.isFake() } +func (tx *ArbitrumRetryTx) isFake() bool { return true } type ArbitrumSubmitRetryableTx struct { ChainId *big.Int From 18b0028b967a4db7d7f67af0ffa785408542849f Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Wed, 24 Nov 2021 08:39:13 -0500 Subject: [PATCH 09/10] Fix tx hashing for retry txs --- core/types/transaction.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/types/transaction.go b/core/types/transaction.go index 2a49852ef1..3bca8865c2 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -424,6 +424,8 @@ func (tx *Transaction) Hash() common.Hash { h = rlpHash(tx.inner) } else if tx.Type() == ArbitrumSubmitRetryableTxType { h = tx.inner.(*ArbitrumSubmitRetryableTx).RequestId + } else if tx.Type() == ArbitrumRetryTxType { + h = tx.inner.(*ArbitrumRetryTx).RequestId } else { h = prefixedRlpHash(tx.Type(), tx.inner) } From c4b86e3ff484c017c68d19e2bc3e258dca56c07e Mon Sep 17 00:00:00 2001 From: Ed Felten Date: Wed, 24 Nov 2021 08:45:57 -0500 Subject: [PATCH 10/10] Refactor --- core/types/arb_types.go | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/core/types/arb_types.go b/core/types/arb_types.go index de0b725027..5d700dfccb 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -139,31 +139,8 @@ type ArbitrumRetryTx struct { 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.ArbitrumContractTx.copy().(*ArbitrumContractTx), tx.TicketId, tx.RefundTo, }