This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: align empty account result for old blocks as ethereum (#1484)
* align result account as ethereum * add test_get_transaction_count * add change doc * sync gomod2nix * Apply suggestions from code review * crosscheck with ws & geth * sync gomod2nix * Update rpc/backend/utils.go * use session provider Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
|
||
from eth_account import Account | ||
|
||
from .utils import ADDRS, w3_wait_for_new_blocks | ||
|
||
|
||
def test_get_transaction_count(ethermint_rpc_ws, geth): | ||
for p in [ethermint_rpc_ws, geth]: | ||
w3 = p.w3 | ||
blk = hex(w3.eth.block_number) | ||
sender = ADDRS["validator"] | ||
|
||
# derive a new address | ||
account_path = "m/44'/60'/0'/0/1" | ||
mnemonic = os.getenv("COMMUNITY_MNEMONIC") | ||
receiver = (Account.from_mnemonic(mnemonic, account_path=account_path)).address | ||
n0 = w3.eth.get_transaction_count(receiver, blk) | ||
# ensure transaction send in new block | ||
w3_wait_for_new_blocks(w3, 1, sleep=0.1) | ||
txhash = w3.eth.send_transaction( | ||
{ | ||
"from": sender, | ||
"to": receiver, | ||
"value": 1000, | ||
} | ||
) | ||
receipt = w3.eth.wait_for_transaction_receipt(txhash) | ||
assert receipt.status == 1 | ||
[n1, n2] = [w3.eth.get_transaction_count(receiver, b) for b in [blk, "latest"]] | ||
assert n0 == n1 | ||
assert n0 == n2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters