diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index d150d09d8..7ea6486f5 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -619,7 +619,7 @@ type storedReceiptRLP struct { CumulativeGasUsed uint64 Logs []*types.LogForStorage L1Fee *big.Int - FeeTokenID *uint16 + FeeTokenID *uint64 FeeRate *big.Int TokenScale *big.Int FeeLimit *big.Int diff --git a/core/state_processor.go b/core/state_processor.go index 8daab4d6f..198a2dc70 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -193,7 +193,7 @@ func ApplyTransactionWithEVM(msg Message, config *params.ChainConfig, gp *GasPoo receipt.TransactionIndex = uint(statedb.TxIndex()) receipt.L1Fee = result.L1DataFee if tx.IsAltFeeTx() { - tokenID := tx.FeeTokenID() + tokenID := uint64(tx.FeeTokenID()) receipt.FeeTokenID = &tokenID receipt.FeeLimit = tx.FeeLimit() receipt.FeeRate = result.FeeRate diff --git a/core/types/gen_receipt_json.go b/core/types/gen_receipt_json.go index d7a968920..c52ef74c5 100644 --- a/core/types/gen_receipt_json.go +++ b/core/types/gen_receipt_json.go @@ -16,27 +16,27 @@ var _ = (*receiptMarshaling)(nil) // MarshalJSON marshals as JSON. func (r Receipt) MarshalJSON() ([]byte, error) { type Receipt struct { - Type hexutil.Uint64 `json:"type,omitempty"` - PostState hexutil.Bytes `json:"root"` - Status hexutil.Uint64 `json:"status"` - CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"` - Bloom Bloom `json:"logsBloom" gencodec:"required"` - Logs []*Log `json:"logs" gencodec:"required"` - TxHash common.Hash `json:"transactionHash" gencodec:"required"` - ContractAddress common.Address `json:"contractAddress"` - GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"` - EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"` - BlobGasUsed hexutil.Uint64 `json:"blobGasUsed,omitempty"` - BlobGasPrice *hexutil.Big `json:"blobGasPrice,omitempty"` - BlockHash common.Hash `json:"blockHash,omitempty"` - BlockNumber *hexutil.Big `json:"blockNumber,omitempty"` - TransactionIndex hexutil.Uint `json:"transactionIndex"` - ReturnValue []byte `json:"returnValue,omitempty"` - L1Fee *hexutil.Big `json:"l1Fee,omitempty"` - FeeTokenID *uint16 `json:"feeTokenID,omitempty"` - FeeRate *hexutil.Big `json:"feeRate,omitempty"` - TokenScale *hexutil.Big `json:"tokenScale,omitempty"` - FeeLimit *hexutil.Big `json:"feeLimit,omitempty"` + Type hexutil.Uint64 `json:"type,omitempty"` + PostState hexutil.Bytes `json:"root"` + Status hexutil.Uint64 `json:"status"` + CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"` + Bloom Bloom `json:"logsBloom" gencodec:"required"` + Logs []*Log `json:"logs" gencodec:"required"` + TxHash common.Hash `json:"transactionHash" gencodec:"required"` + ContractAddress common.Address `json:"contractAddress"` + GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"` + EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"` + BlobGasUsed hexutil.Uint64 `json:"blobGasUsed,omitempty"` + BlobGasPrice *hexutil.Big `json:"blobGasPrice,omitempty"` + BlockHash common.Hash `json:"blockHash,omitempty"` + BlockNumber *hexutil.Big `json:"blockNumber,omitempty"` + TransactionIndex hexutil.Uint `json:"transactionIndex"` + ReturnValue []byte `json:"returnValue,omitempty"` + L1Fee *hexutil.Big `json:"l1Fee,omitempty"` + FeeTokenID *hexutil.Uint64 `json:"feeTokenID,omitempty"` + FeeRate *hexutil.Big `json:"feeRate,omitempty"` + TokenScale *hexutil.Big `json:"tokenScale,omitempty"` + FeeLimit *hexutil.Big `json:"feeLimit,omitempty"` } var enc Receipt enc.Type = hexutil.Uint64(r.Type) @@ -56,7 +56,7 @@ func (r Receipt) MarshalJSON() ([]byte, error) { enc.TransactionIndex = hexutil.Uint(r.TransactionIndex) enc.ReturnValue = r.ReturnValue enc.L1Fee = (*hexutil.Big)(r.L1Fee) - enc.FeeTokenID = r.FeeTokenID + enc.FeeTokenID = (*hexutil.Uint64)(r.FeeTokenID) enc.FeeRate = (*hexutil.Big)(r.FeeRate) enc.TokenScale = (*hexutil.Big)(r.TokenScale) enc.FeeLimit = (*hexutil.Big)(r.FeeLimit) @@ -83,7 +83,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error { TransactionIndex *hexutil.Uint `json:"transactionIndex"` ReturnValue []byte `json:"returnValue,omitempty"` L1Fee *hexutil.Big `json:"l1Fee,omitempty"` - FeeTokenID *uint16 `json:"feeTokenID,omitempty"` + FeeTokenID *hexutil.Uint64 `json:"feeTokenID,omitempty"` FeeRate *hexutil.Big `json:"feeRate,omitempty"` TokenScale *hexutil.Big `json:"tokenScale,omitempty"` FeeLimit *hexutil.Big `json:"feeLimit,omitempty"` @@ -149,7 +149,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error { r.L1Fee = (*big.Int)(dec.L1Fee) } if dec.FeeTokenID != nil { - r.FeeTokenID = dec.FeeTokenID + r.FeeTokenID = (*uint64)(dec.FeeTokenID) } if dec.FeeRate != nil { r.FeeRate = (*big.Int)(dec.FeeRate) @@ -160,6 +160,5 @@ func (r *Receipt) UnmarshalJSON(input []byte) error { if dec.FeeLimit != nil { r.FeeLimit = (*big.Int)(dec.FeeLimit) } - return nil } diff --git a/core/types/l2trace.go b/core/types/l2trace.go index cf8fbf703..9f5f37097 100644 --- a/core/types/l2trace.go +++ b/core/types/l2trace.go @@ -57,9 +57,9 @@ type StorageTrace struct { // execution status, the amount of gas used and the return value type ExecutionResult struct { L1DataFee *hexutil.Big `json:"l1DataFee,omitempty"` - FeeTokenID *uint16 `json:"fee_token_id,omitempty"` + FeeTokenID *uint64 `json:"feeTokenID,omitempty"` FeeRate *hexutil.Big `json:"feeRate,omitempty"` - TokenScale *hexutil.Big `json:"token_scale,omitempty"` + TokenScale *hexutil.Big `json:"tokenScale,omitempty"` FeeLimit *hexutil.Big `json:"feeLimit,omitempty"` Gas uint64 `json:"gas"` Failed bool `json:"failed"` @@ -138,7 +138,7 @@ type TransactionData struct { GasPrice *hexutil.Big `json:"gasPrice"` GasTipCap *hexutil.Big `json:"gasTipCap"` GasFeeCap *hexutil.Big `json:"gasFeeCap"` - FeeTokenID *uint16 `json:"feeTokenID,omitempty"` + FeeTokenID *uint64 `json:"feeTokenID,omitempty"` FeeLimit *hexutil.Big `json:"feeLimit,omitempty"` From common.Address `json:"from"` To *common.Address `json:"to"` @@ -197,7 +197,7 @@ func NewTransactionData(tx *Transaction, blockNumber uint64, blockTime uint64, c // Set FeeTokenID and FeeLimit for AltFeeTx if tx.Type() == AltFeeTxType { - feeTokenID := tx.FeeTokenID() + feeTokenID := uint64(tx.FeeTokenID()) if feeTokenID != 0 { result.FeeTokenID = &feeTokenID } diff --git a/core/types/receipt.go b/core/types/receipt.go index 964c2f3b8..3fbc55511 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -79,9 +79,9 @@ type Receipt struct { // Morph rollup L1Fee *big.Int `json:"l1Fee,omitempty"` // Alt Fee - FeeTokenID *uint16 `json:"fee_token_id,omitempty"` - FeeRate *big.Int `json:"fee_rate,omitempty"` - TokenScale *big.Int `json:"token_scale,omitempty"` + FeeTokenID *uint64 `json:"feeTokenID,omitempty"` + FeeRate *big.Int `json:"feeRate,omitempty"` + TokenScale *big.Int `json:"tokenScale,omitempty"` FeeLimit *big.Int `json:"feeLimit,omitempty"` } @@ -97,6 +97,10 @@ type receiptMarshaling struct { BlockNumber *hexutil.Big TransactionIndex hexutil.Uint L1Fee *hexutil.Big + FeeTokenID *hexutil.Uint64 + FeeRate *hexutil.Big + TokenScale *hexutil.Big + FeeLimit *hexutil.Big } // receiptRLP is the consensus encoding of a receipt. @@ -113,7 +117,7 @@ type storedReceiptRLP struct { CumulativeGasUsed uint64 Logs []*LogForStorage L1Fee *big.Int - FeeTokenID *uint16 + FeeTokenID *uint64 FeeRate *big.Int TokenScale *big.Int FeeLimit *big.Int @@ -127,7 +131,7 @@ type v7StoredReceiptRLP struct { CumulativeGasUsed uint64 Logs []*LogForStorage L1Fee *big.Int - FeeTokenID *uint16 + FeeTokenID *uint64 FeeRate *big.Int TokenScale *big.Int FeeLimit *big.Int diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index bfc205934..5b5bff87c 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -51,8 +51,8 @@ type TransactionArgs struct { Input *hexutil.Bytes `json:"input"` // AltFeeTxType - FeeTokenID *hexutil.Uint64 `json:"fee_token_id,omitempty"` - FeeLimit *hexutil.Big `json:"fee_limit,omitempty"` + FeeTokenID *hexutil.Uint64 `json:"feeTokenID,omitempty"` + FeeLimit *hexutil.Big `json:"feeLimit,omitempty"` // Introduced by AccessListTxType transaction. AccessList *types.AccessList `json:"accessList,omitempty"`