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 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: align filter rule for debug trace block (#1688)
* align filter rule for debug_traceBlockByNumber * test debug_traceBlockByNumber * update doc * update nix * fix lint * fix test * update nix * fix typo on comment * update gomod2nix --------- Co-authored-by: Freddy Caceres <[email protected]>
- Loading branch information
Showing
8 changed files
with
80 additions
and
17 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
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,51 @@ | ||
import requests | ||
from pystarport import ports | ||
|
||
from .utils import ( | ||
derive_new_account, | ||
send_transaction, | ||
sign_transaction, | ||
wait_for_new_blocks, | ||
) | ||
|
||
|
||
def test_trace_blk(ethermint): | ||
w3 = ethermint.w3 | ||
cli = ethermint.cosmos_cli() | ||
acc = derive_new_account(3) | ||
sender = acc.address | ||
# fund new sender | ||
fund = 3000000000000000000 | ||
tx = {"to": sender, "value": fund, "gasPrice": w3.eth.gas_price} | ||
send_transaction(w3, tx) | ||
assert w3.eth.get_balance(sender, "latest") == fund | ||
nonce = w3.eth.get_transaction_count(sender) | ||
blk = wait_for_new_blocks(cli, 1, sleep=0.1) | ||
txhashes = [] | ||
total = 3 | ||
for n in range(total): | ||
tx = { | ||
"to": "0x2956c404227Cc544Ea6c3f4a36702D0FD73d20A2", | ||
"value": fund // total, | ||
"gas": 21000, | ||
"maxFeePerGas": 6556868066901, | ||
"maxPriorityFeePerGas": 1500000000, | ||
"nonce": nonce + n, | ||
} | ||
signed = sign_transaction(w3, tx, acc.key) | ||
txhash = w3.eth.send_raw_transaction(signed.rawTransaction) | ||
txhashes.append(txhash) | ||
for txhash in txhashes[0 : total - 1]: | ||
res = w3.eth.wait_for_transaction_receipt(txhash) | ||
assert res.status == 1 | ||
|
||
url = f"http://127.0.0.1:{ports.evmrpc_port(ethermint.base_port(0))}" | ||
params = { | ||
"method": "debug_traceBlockByNumber", | ||
"params": [hex(blk + 1)], | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
} | ||
rsp = requests.post(url, json=params) | ||
assert rsp.status_code == 200 | ||
assert len(rsp.json()["result"]) == 2 |
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