From cccac07a998336eaece60d6da55057154e0e4376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=20=C4=90ANG?= Date: Wed, 26 Jul 2023 18:06:28 +0700 Subject: [PATCH] remove EffectiveGasPrice --- core/types/gen_receipt_json.go | 5 --- core/types/receipt.go | 9 ++---- core/types/receipt_test.go | 57 ++++++++++++++++------------------ internal/ethapi/api.go | 1 - 4 files changed, 29 insertions(+), 43 deletions(-) diff --git a/core/types/gen_receipt_json.go b/core/types/gen_receipt_json.go index 8d85dd5b9c1a..e1bd0af75d36 100644 --- a/core/types/gen_receipt_json.go +++ b/core/types/gen_receipt_json.go @@ -25,7 +25,6 @@ func (r Receipt) MarshalJSON() ([]byte, error) { TxHash common.Hash `json:"transactionHash" gencodec:"required"` ContractAddress common.Address `json:"contractAddress"` GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"` - EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice,omitempty"` BlockHash common.Hash `json:"blockHash,omitempty"` BlockNumber *hexutil.Big `json:"blockNumber,omitempty"` TransactionIndex hexutil.Uint `json:"transactionIndex"` @@ -40,7 +39,6 @@ func (r Receipt) MarshalJSON() ([]byte, error) { enc.TxHash = r.TxHash enc.ContractAddress = r.ContractAddress enc.GasUsed = hexutil.Uint64(r.GasUsed) - enc.EffectiveGasPrice = (*hexutil.Big)(r.EffectiveGasPrice) enc.BlockHash = r.BlockHash enc.BlockNumber = (*hexutil.Big)(r.BlockNumber) enc.TransactionIndex = hexutil.Uint(r.TransactionIndex) @@ -100,9 +98,6 @@ func (r *Receipt) UnmarshalJSON(input []byte) error { return errors.New("missing required field 'gasUsed' for Receipt") } r.GasUsed = uint64(*dec.GasUsed) - if dec.EffectiveGasPrice != nil { - r.EffectiveGasPrice = (*big.Int)(dec.EffectiveGasPrice) - } if dec.BlockHash != nil { r.BlockHash = *dec.BlockHash } diff --git a/core/types/receipt.go b/core/types/receipt.go index c6d8ccdd73f0..44fa59d78d70 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -59,10 +59,9 @@ type Receipt struct { Logs []*Log `json:"logs" gencodec:"required"` // Implementation fields: These fields are added by geth when processing a transaction. - TxHash common.Hash `json:"transactionHash" gencodec:"required"` - ContractAddress common.Address `json:"contractAddress"` - GasUsed uint64 `json:"gasUsed" gencodec:"required"` - EffectiveGasPrice *big.Int `json:"effectiveGasPrice"` + TxHash common.Hash `json:"transactionHash" gencodec:"required"` + ContractAddress common.Address `json:"contractAddress"` + GasUsed uint64 `json:"gasUsed" gencodec:"required"` // Inclusion information: These fields provide information about the inclusion of the // transaction corresponding to this receipt. @@ -325,8 +324,6 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu rs[i].Type = txs[i].Type() rs[i].TxHash = txs[i].Hash() - rs[i].EffectiveGasPrice = txs[i].inner.effectiveGasPrice(new(big.Int), baseFee) - // block location fields rs[i].BlockHash = hash rs[i].BlockNumber = new(big.Int).SetUint64(number) diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index 376177f976ef..3d1bd1bb914f 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -168,13 +168,12 @@ func TestDeriveFields(t *testing.T) { }, }, // derived fields: - TxHash: txs[0].Hash(), - ContractAddress: common.HexToAddress("0x5a443704dd4b594b382c22a083e2bd3090a6fef3"), - GasUsed: 1, - EffectiveGasPrice: big.NewInt(11), - BlockHash: blockHash, - BlockNumber: blockNumber, - TransactionIndex: 0, + TxHash: txs[0].Hash(), + ContractAddress: common.HexToAddress("0x5a443704dd4b594b382c22a083e2bd3090a6fef3"), + GasUsed: 1, + BlockHash: blockHash, + BlockNumber: blockNumber, + TransactionIndex: 0, }, &Receipt{ PostState: common.Hash{2}.Bytes(), @@ -200,12 +199,11 @@ func TestDeriveFields(t *testing.T) { }, }, // derived fields: - TxHash: txs[1].Hash(), - GasUsed: 2, - EffectiveGasPrice: big.NewInt(22), - BlockHash: blockHash, - BlockNumber: blockNumber, - TransactionIndex: 1, + TxHash: txs[1].Hash(), + GasUsed: 2, + BlockHash: blockHash, + BlockNumber: blockNumber, + TransactionIndex: 1, }, &Receipt{ Type: AccessListTxType, @@ -213,12 +211,11 @@ func TestDeriveFields(t *testing.T) { CumulativeGasUsed: 6, Logs: []*Log{}, // derived fields: - TxHash: txs[2].Hash(), - GasUsed: 3, - EffectiveGasPrice: big.NewInt(33), - BlockHash: blockHash, - BlockNumber: blockNumber, - TransactionIndex: 2, + TxHash: txs[2].Hash(), + GasUsed: 3, + BlockHash: blockHash, + BlockNumber: blockNumber, + TransactionIndex: 2, }, &Receipt{ Type: DynamicFeeTxType, @@ -226,12 +223,11 @@ func TestDeriveFields(t *testing.T) { CumulativeGasUsed: 10, Logs: []*Log{}, // derived fields: - TxHash: txs[3].Hash(), - GasUsed: 4, - EffectiveGasPrice: big.NewInt(1044), - BlockHash: blockHash, - BlockNumber: blockNumber, - TransactionIndex: 3, + TxHash: txs[3].Hash(), + GasUsed: 4, + BlockHash: blockHash, + BlockNumber: blockNumber, + TransactionIndex: 3, }, &Receipt{ Type: DynamicFeeTxType, @@ -239,12 +235,11 @@ func TestDeriveFields(t *testing.T) { CumulativeGasUsed: 15, Logs: []*Log{}, // derived fields: - TxHash: txs[4].Hash(), - GasUsed: 5, - EffectiveGasPrice: big.NewInt(1055), - BlockHash: blockHash, - BlockNumber: blockNumber, - TransactionIndex: 4, + TxHash: txs[4].Hash(), + GasUsed: 5, + BlockHash: blockHash, + BlockNumber: blockNumber, + TransactionIndex: 4, }, } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 57662405fbd3..af0d71bbf3a2 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1648,7 +1648,6 @@ func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common. "logs": receipt.Logs, "logsBloom": receipt.Bloom, "type": hexutil.Uint(tx.Type()), - "effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice), } // Assign receipt status or post state.