Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support gasFee for espace transaction receipt related RPC, resolves #2926 #2977

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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