Skip to content

Commit

Permalink
Merge pull request #2977 from Conflux-Chain/rpc-tx-receipt-gasfee
Browse files Browse the repository at this point in the history
feat: support gasFee for espace transaction receipt related RPC, resolves #2926
  • Loading branch information
wangdayong228 authored Dec 9, 2024
2 parents 7b55f56 + bc20409 commit a942990
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ target
.phabricator*
build/
build_clippy/
**/blockchain_db/
**/blockchain_data/
**/pos_db/
**/sqlite_db/
**/net_config/
**/*.log
**/stderr.txt
**/testnet.toml
*~
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions changelogs/JSONRPC.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# JSON-RPC CHANGELOG

## vNext
1. Support gasFee in transaction receipt for espace RPC

## v2.4.1

Expand Down
2 changes: 2 additions & 0 deletions crates/rpc/rpc-eth-types/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub struct Receipt {
pub cumulative_gas_used: U256,
/// Gas used
pub gas_used: U256,
/// The gas fee charged in the execution of the transaction.
pub gas_fee: U256,
/// Contract address
pub contract_address: Option<H160>,
/// Logs
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/rpc/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ impl EthApi {
block_number: block_height,
cumulative_gas_used: receipt.accumulated_gas_used,
gas_used,
gas_fee: receipt.gas_fee,
contract_address,
logs,
logs_bloom: receipt.log_bloom,
Expand Down
4 changes: 3 additions & 1 deletion run/clear_state.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash
rm -rf blockchain_data
rm -rf log
rm stderr.txt

rm -rf pos_db
rm pos.log
rm -rf pos_config/private_keys
cd pos_config && ls | grep -v pos_config.yaml | grep -v pos_key | xargs rm

cd pos_config && ls | grep -v pos_config.yaml | grep -v pos_key | grep -v genesis_file | grep -v initial_nodes.json | xargs rm -rf
1 change: 1 addition & 0 deletions tests/evm_space/tx_and_receipt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def run_test(self):
receipt = self.w3.eth.wait_for_transaction_receipt(return_tx_hash)
assert_equal(receipt["status"], 1)
assert_equal(receipt["gasUsed"], 21000)
assert_equal(receipt["gasFee"], "0x2673c")
assert_equal(receipt["txExecErrorMsg"], None)

tx = self.w3.eth.get_transaction(return_tx_hash)
Expand Down
1 change: 1 addition & 0 deletions tests/rpc/test_tx_receipt_by_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test_simple_receipt(self):
assert_equal(receipt['storageCoveredBySponsor'], False)
assert_equal(len(receipt['storageReleased']), 0)
assert_equal(receipt['txExecErrorMsg'], None)
assert_equal(receipt['gasFee'], "0x5208")

def test_receipt_with_storage_changes(self):
bytecode_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), CONTRACT_PATH)
Expand Down

0 comments on commit a942990

Please sign in to comment.