diff --git a/core/state_transition.go b/core/state_transition.go index efd8e9995bc6..47903e657b65 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -294,11 +294,6 @@ func (st *StateTransition) transitionDbImpl() (*ExecutionResult, error) { // 5. there is no overflow when calculating intrinsic gas // 6. caller has enough balance to cover asset transfer for **topmost** call - // There are no tips in L2 - if st.evm.ChainConfig().IsArbitrum() && st.gasPrice.Cmp(st.evm.Context.BaseFee) > 0 { - st.gasPrice = st.evm.Context.BaseFee - } - // Check clauses 1-3, buy gas if everything is correct if err := st.preCheck(); err != nil { return nil, err @@ -320,7 +315,7 @@ func (st *StateTransition) transitionDbImpl() (*ExecutionResult, error) { } st.gas -= gas - err = st.evm.ProcessingHook.GasChargingHook(&st.gas) + tipRecipient, err := st.evm.ProcessingHook.GasChargingHook(&st.gas) if err != nil { return nil, err } @@ -357,7 +352,10 @@ func (st *StateTransition) transitionDbImpl() (*ExecutionResult, error) { if london { effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee)) } - st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip)) + if tipRecipient == nil { + tipRecipient = &st.evm.Context.Coinbase + } + st.state.AddBalance(*tipRecipient, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip)) return &ExecutionResult{ UsedGas: st.gasUsed(), diff --git a/core/types/arb_types.go b/core/types/arb_types.go index 6100fcb8eb9c..48d91b263a40 100644 --- a/core/types/arb_types.go +++ b/core/types/arb_types.go @@ -349,16 +349,3 @@ func (d *ArbitrumInternalTx) rawSignatureValues() (v, r, s *big.Int) { func (d *ArbitrumInternalTx) setSignatureValues(chainID, v, r, s *big.Int) { } - -type ArbitrumWrappedTx struct { - l1Calldata uint64 - TxData -} - -func (tx *ArbitrumWrappedTx) copy() TxData { - cpy := &ArbitrumWrappedTx{ - l1Calldata: tx.l1Calldata, - TxData: tx.TxData.copy(), - } - return cpy -} diff --git a/core/types/transaction.go b/core/types/transaction.go index d812296bb612..711cd55d8397 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -48,7 +48,6 @@ const ( ArbitrumDepositTxType = 100 ArbitrumUnsignedTxType = 101 ArbitrumContractTxType = 102 - ArbitrumWrappedTxType = 103 ArbitrumRetryTxType = 104 ArbitrumSubmitRetryableTxType = 105 ArbitrumInternalTxType = 106 @@ -99,7 +98,7 @@ type TxData interface { // EncodeRLP implements rlp.Encoder func (tx *Transaction) EncodeRLP(w io.Writer) error { - if tx.realType() == LegacyTxType { + if tx.Type() == LegacyTxType { return rlp.Encode(w, tx.inner) } // It's an EIP-2718 typed TX envelope. @@ -114,7 +113,7 @@ func (tx *Transaction) EncodeRLP(w io.Writer) error { // encodeTyped writes the canonical encoding of a typed transaction to w. func (tx *Transaction) encodeTyped(w *bytes.Buffer) error { - w.WriteByte(tx.realType()) + w.WriteByte(tx.Type()) return rlp.Encode(w, tx.inner) } @@ -205,10 +204,6 @@ func (tx *Transaction) decodeTyped(b []byte, arbParsing bool) (TxData, error) { var inner ArbitrumContractTx err := rlp.DecodeBytes(b[1:], &inner) return &inner, err - case ArbitrumWrappedTxType: - var inner ArbitrumWrappedTx - err := rlp.DecodeBytes(b[1:], &inner) - return &inner, err case ArbitrumRetryTxType: var inner ArbitrumRetryTx err := rlp.DecodeBytes(b[1:], &inner) @@ -296,15 +291,6 @@ func (tx *Transaction) Type() uint8 { return tx.inner.txType() } -func (tx *Transaction) realType() uint8 { - _, isArbWrapped := tx.inner.(*ArbitrumWrappedTx) - if isArbWrapped { - return ArbitrumWrappedTxType - } else { - return tx.Type() - } -} - func (tx *Transaction) GetInner() TxData { return tx.inner.copy() } diff --git a/core/vm/evm_arbitrum.go b/core/vm/evm_arbitrum.go index 11a7a6890cc3..d5943bd20667 100644 --- a/core/vm/evm_arbitrum.go +++ b/core/vm/evm_arbitrum.go @@ -28,7 +28,7 @@ func (evm *EVM) Depth() int { type TxProcessingHook interface { StartTxHook() (bool, uint64, error, []byte) // return 4-tuple rather than *struct to avoid an import cycle - GasChargingHook(gasRemaining *uint64) error + GasChargingHook(gasRemaining *uint64) (*common.Address, error) PushCaller(addr common.Address) PopCaller() ForceRefundGas() uint64 @@ -45,8 +45,8 @@ func (p DefaultTxProcessor) StartTxHook() (bool, uint64, error, []byte) { return false, 0, nil, nil } -func (p DefaultTxProcessor) GasChargingHook(gasRemaining *uint64) error { - return nil +func (p DefaultTxProcessor) GasChargingHook(gasRemaining *uint64) (*common.Address, error) { + return nil, nil } func (p DefaultTxProcessor) PushCaller(addr common.Address) {