diff --git a/.gitignore b/.gitignore index ea5f25493..fc3f898e7 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/changelogs/JSONRPC.md b/changelogs/JSONRPC.md index f54b79ee8..0da342b15 100644 --- a/changelogs/JSONRPC.md +++ b/changelogs/JSONRPC.md @@ -1,6 +1,7 @@ # JSON-RPC CHANGELOG ## vNext +1. Support gasFee in transaction receipt for espace RPC ## v2.4.1 diff --git a/crates/rpc/rpc-eth-types/src/receipt.rs b/crates/rpc/rpc-eth-types/src/receipt.rs index dce010093..cb4691e51 100644 --- a/crates/rpc/rpc-eth-types/src/receipt.rs +++ b/crates/rpc/rpc-eth-types/src/receipt.rs @@ -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, /// Logs diff --git a/crates/rpc/rpc/src/eth.rs b/crates/rpc/rpc/src/eth.rs index b08bc2a83..a054e164a 100644 --- a/crates/rpc/rpc/src/eth.rs +++ b/crates/rpc/rpc/src/eth.rs @@ -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, diff --git a/run/clear_state.sh b/run/clear_state.sh index da44590ce..180385966 100755 --- a/run/clear_state.sh +++ b/run/clear_state.sh @@ -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 \ No newline at end of file + +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 diff --git a/tests/evm_space/tx_and_receipt_test.py b/tests/evm_space/tx_and_receipt_test.py index 3110615ad..935c1864b 100755 --- a/tests/evm_space/tx_and_receipt_test.py +++ b/tests/evm_space/tx_and_receipt_test.py @@ -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) diff --git a/tests/rpc/test_tx_receipt_by_hash.py b/tests/rpc/test_tx_receipt_by_hash.py index ceec69839..08e6c58e8 100644 --- a/tests/rpc/test_tx_receipt_by_hash.py +++ b/tests/rpc/test_tx_receipt_by_hash.py @@ -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)