-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add comprehensive test data for Ethereum trie root validation #9452
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
Merged
athei
merged 470 commits into
master
from
lrubasze/eth-trie-root-and-rlp-codec-improvements
Dec 16, 2025
Merged
Changes from 53 commits
Commits
Show all changes
470 commits
Select commit
Hold shift + click to select a range
9bc898d
revive/tests: rename test
lrubasze c396af2
revive: Cargo.lock update
lrubasze 7a002c2
revive: Fix alloy consensus features to compile tests
lexnv 9b14b44
revive: Remove alloy-rlp crate import
lexnv c08e505
revive/cargo: Add alloy trie as dependency
lexnv 365b53f
revive: Use alloy-trie crate
lexnv b430c6b
Merge branch 'lexnv/minimal-poc-block-storage' into lrubasze/eth-trie…
lrubasze e1317d3
revive/tests: Simplify test assets
lexnv 607740c
runtime/tests: Bump the test limit of call size to 512 bytes
lexnv e5b05f7
Pallet revive benchmarks (#9496)
lrubasze f14faee
revive: Move eth block storage to dedicated module
lexnv 14342f7
Merge branch 'lexnv/minimal-poc-block-storage' into lrubasze/eth-trie…
lrubasze 5312398
revive/hash: Save the block hash in the returned block
lexnv 9adc0f0
revive: Simplify the build API
lexnv a881f4b
Merge remote-tracking branch 'origin/master' into lexnv/minimal-poc-b…
lexnv 3b5e642
revive/benchmarks: use block_storage module
lrubasze 6b070cd
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] 83058e2
Update from github-actions[bot] running command 'prdoc --audience nod…
github-actions[bot] cb9cbe9
Merge branch 'master' into lexnv/minimal-poc-block-storage
lexnv fd04988
revive: Remove signed type from rlp codec
lexnv 153bd7d
revive: better docs
lexnv 71daa4d
revive: Change to Identity for storage map
lexnv ea066ca
revive: Remove stale comment
lexnv 957418a
revive/api: Make block author nonoptional
lexnv 410913c
revive/tests: update tests after weights changes
lrubasze 5b2beaf
Merge branch 'master' into lexnv/minimal-poc-block-storage
lexnv f91fa8c
revive: Change transactionSigned back into bytes
lexnv 0e5f274
frame: Ensure EVMOrigin for eth_call and eth_instantiate
lexnv 3231893
revive: Add docs about transaction_encoded
lexnv 5e501d3
revive: Implement event limits on Stack object
lexnv 8e0a7bf
revive/benchmarks: separate on_finalize benchmarks
lrubasze 3959e16
revive: Move limit checking into deposit_event directly
lexnv 40cd147
Merge remote-tracking branch 'origin/lexnv/minimal-poc-block-storage'…
lexnv e81271b
revive: Apply cargo fmt
lexnv e52b146
Merge branch 'master' into lexnv/minimal-poc-block-storage
lexnv 2466181
revive: Use saturating add where possible
lexnv 1428e9b
Merge remote-tracking branch 'origin/lexnv/minimal-poc-block-storage'…
lexnv 7faa0d1
revive: Import TransactionSigned from evm
lexnv 56ba0d1
Add EnsureEVM origin to pallets
lexnv 2ea7b21
Add EnsureEVM origin to subtrate-node runtime
lrubasze 6efcbf9
update expected compile error after serde update
lrubasze bee04d0
revive: update README
lrubasze 6da298a
revive/benchmarking: revert weights to let benchmark bot commit prope…
lrubasze 72d75f5
Revert "Add EnsureEVM origin to pallets"
lexnv addc6a4
Revert "frame: Ensure EVMOrigin for eth_call and eth_instantiate"
lexnv 630f468
Merge remote-tracking branch 'origin/lexnv/minimal-poc-block-storage'…
lexnv 5596841
Revert "Add EnsureEVM origin to subtrate-node runtime"
lrubasze 9782821
Revert "Add EnsureEVM origin to subtrate-node runtime"
lexnv 41c7e69
Merge remote-tracking branch 'origin/lexnv/minimal-poc-block-storage'…
lexnv f49c713
Update cargo.lock with minimal changes
lexnv eeb34a0
Revert "update expected compile error after serde update"
lrubasze 102a578
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] c9d7ae4
revive: Efficiently store first tx/receipt into a dedicated object
lexnv 9358571
revive/tests: Adjust testing to the new API
lexnv 69b04b9
revive/rpc: regenerate revive_chain.metadata
lrubasze 95e1f15
revive/rpc: revert changes within lib.rs and receipt_extractor.rs
lrubasze a139a35
revive/rpc: update block_author
lrubasze 1faebb2
revive/tests: update tests after weights changes
lrubasze f5127eb
Merge branch 'master' into lexnv/minimal-poc-block-storage
lrubasze f894abc
Update from github-actions[bot] running command 'bench --runtime dev …
github-actions[bot] a44a155
revive: Ensure the IR forms fallback to index 1
lexnv dd91bef
revive/tests: Move away from hardcoded gas and use expected values
lexnv dcb138c
Merge remote-tracking branch 'origin/lexnv/minimal-poc-block-storage'…
lexnv 5bd73cd
revive: Add more documentation
lexnv 6cdf623
revive: Optimize one storage access for build phase
lexnv 56bda94
revive: Hide away the storage loads
lexnv 10db306
revive/tests: Adjust testing to new API
lexnv 5f905b3
revive: Move receipt and logs bloom to dedicated module
lexnv 4ef2982
revive: Move incremental builder to dedicated module
lexnv 1895820
revive: Move block builder to a dedicated module
lexnv 5921361
revive: Move functionality away from lib.rs into block_storage
lexnv 3fc1b6c
revive: Adjust docs
lexnv 35cb484
Merge remote-tracking branch 'origin/master' into lexnv/minimal-poc-b…
lexnv ec41a8e
revive: Adjust benchmarks to new import paths
lexnv 4c282b5
revive: Introduce a builder phase for explicit usage
lexnv f8afc46
revive: Make write/read API explicit
lexnv 6be3f21
revive/tests: Adjust testing to new API
lexnv 3096a15
revive: Add debug / error logs
lexnv d50b802
revive/tests: Add conformance tests for accrue log bloom
lexnv dcfd21c
revive/tests: Add conformance tests for accrue other blooms
lexnv dde6596
revive/tests: Add conformance tests for accumulate receipt
lexnv 92066f3
Merge remote-tracking branch 'origin/master' into lexnv/minimal-poc-b…
lexnv b9dfe44
revive: Adjust docs
lexnv 2209850
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze ef02568
revive: add optional stats to the IncrementalHashBuilder
lrubasze f30f5c2
revive: add IncrementalHashBuilder tests
lrubasze c0558ec
revive: add IncrementalHashBuilderIR size tests
lrubasze 3724648
revive: IncrementalHashBuilder tests - cleanup
lrubasze e83036d
revive: take 'EthereumBlockBuilderIR' into account in integrity_test
lrubasze 53d0543
Merge branch 'master' into lexnv/minimal-poc-block-storage
lrubasze 8768be0
Merge branch 'master' into lexnv/minimal-poc-block-storage
lrubasze d86e643
fmt Cargo.toml
lrubasze 62e6803
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze 1a5151e
cargo: Update cargo lock with minimal changes
lexnv 2716b30
revive: Downgrade log to debug
lexnv f65b19e
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze 3526540
revive/rpc: fix price setting
lrubasze 5f6497f
revive: adjust MAX_TRANSACTION_PAYLOAD_SIZE
lrubasze c1f9a10
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze b714852
revive/rpc: add ethereum-substrate block hash mapping infrastructure …
lrubasze bebd690
Merge branch 'master' into temp/lexnv/minimal-poc-block-storage
lrubasze 13172f1
revive: fixes after master merge
lrubasze be1d2e9
Merge branch 'master' into lexnv/minimal-poc-block-storage
lexnv 3d37952
revive: fix failing tests
lrubasze b53514b
revive: fix benchmarks
lrubasze 9edd35c
Revert "revive/rpc: EVM tx reconstruction tests"
lrubasze d623962
Revert "revive/rpc: tests improvements"
lrubasze 2bc5f66
Revert "revive/rpc: further cleanup"
lrubasze 84bd856
Revert "revive/rpc: fix some debugs"
lrubasze 4b0826c
Revert "revive/rpc: store receipt metadata for pruned state recovery"
lrubasze 5903f08
Revert "revive/rpc: EVM block reconstruction tests"
lrubasze 24fe576
Revert "revive/rpc: get gas_limit and block_author from the mapping d…
lrubasze bb01a0d
Revert "revive/rpc: add gas_limit and block_author to the ethereum-su…
lrubasze 282fffb
Revert "revive/rpc: add fetch_block_gas_limit and fetch_block_author …
lrubasze b0b4bb8
revive/rpc: improve block pruning
lrubasze 5f9f1a1
revive/rpc: get rid of evm_block_from_receipts
lrubasze f64cd59
revive/rpc: some tests
lrubasze c7f5a7b
revive/rpc: handle genesis block
lrubasze f3531db
revive/rpc: another test
lrubasze d8b4bcf
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze aa231c6
revive/rpc: handle genesis block when processing subscribed blocks
lrubasze 324617d
revive/rpc: insert_block_mapping api improvement
lrubasze ccac003
revive/rpc: fix tests
lrubasze e015a21
revive/cargo: Remove default-features = false
lexnv 3476049
revive/rpc: Add default-features = true to cargo toml
lexnv 8fdd41e
revive: Avoid reencoding the tx
lexnv d510e4f
revive: Pub export minimal types from block hash
lexnv a0e6f5a
revive: Remove unneeded trait bounds for hooks
lexnv c77ccf2
revive: Rename weight_utils to weightinfo_extension mod
lexnv 7d12deb
revive: Panic on API missuse from revive pallet
lexnv 608d431
revive: Simplify processing test statistics
lexnv 4782a26
revive: Take tx on finalized weight into account
lexnv 63906e9
revive: Revert merge conflict EthTransactInfo
lexnv 390dc51
revive: Modify create_call signature
lexnv 2d01742
revive/rpc: reduce potentially spamming logs to debug level
lrubasze c6ba22d
revive/runtime_api: Add eth_receipt_data to extract gas info from
lexnv 12e3cb5
revive: Revert hard cap limits for depositng events
lexnv 842b061
revive: Fix return of deposit_event fn
lexnv 2512cfb
revive: Export only ReceiptGasInfo as gas info
lexnv afc7445
revive/rpc: fix docstring
lrubasze ea9b197
revive/rpc: use rpc api to get the best block hash
lrubasze d519363
revive: Use default instead of new methods for incremental builder
lexnv 1a13a7d
Revert "revive: decouple EthereumBlockBuilder from pallet storage"
lrubasze 9449a6d
revive: add block 0 using BuildGenesisConfig
lrubasze 406749f
revive/rpc: do not reconstruct genesis block, take it from storage
lrubasze fcbf64b
revive/rpc: cleanup
lrubasze 74b14be
revive: Add comments about mem usage
lexnv cc45e76
revive: Ensure memory builder is taken into account
lexnv 7742c4e
revive: Take mem usage and storage usage into account for integrity
lexnv 9e57597
revive: Take event limits into account
lexnv 2e23551
revive/tests: Manual impl derive to avoid needless trait bounds
lexnv cd24087
revive: Add debug logs for eth block builder
lexnv fa6493d
Merge remote-tracking branch 'origin/master' into lexnv/minimal-poc-b…
lexnv 31311f4
revive: Charge extra weight for events to ensure enough memory and
lexnv cd1100b
revive: Use DefaultNoBound
lexnv 7b02443
revive: Remove unneeded trait bounds from benchmarking
lexnv 31a4bd7
revive: Use weight instead of u64
lexnv 9ef212c
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze 1e1ba1a
revive/rpc: use runtime api to get eth block data
lrubasze 04e94be
revive: Remove default-features = false
lrubasze 1e2dc2a
revive: reduce scope of EthereumBlock type
lrubasze aab84a8
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze 78c8417
revive: make block_hash module public
lrubasze f366d31
revive: set block timestamps in seconds as Eth uses
lrubasze ca2ca80
Revert "revive: make block_hash module public"
lrubasze d3b68f5
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze dfa0f27
revive/rpc: flatten ReceiptGasInfo import
lrubasze 36a9ca4
revive: Add more logs for integrity check
lexnv 917844d
revive/tests: Bump fee for tests
lexnv 0875791
revive: Adjust more tests
lexnv 14d6231
revive/rpc: let block_hash_for_tag use ethereum hash at input
lrubasze bfd62ab
revive/rpc: more tests
lrubasze 32f429e
revive: Adjust gas of fixtures
lexnv 954bee2
Merge remote-tracking branch 'origin/lexnv/minimal-poc-block-storage'…
lexnv 481ca1c
Merge remote-tracking branch 'origin/master' into lexnv/minimal-poc-b…
lexnv 6415d25
Merge branch 'master' into lexnv/minimal-poc-block-storage
lrubasze 64578e5
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze 41407e6
asset-hub/tests: Increase gas
lexnv 98d271e
Merge remote-tracking branch 'origin/master' into lexnv/minimal-poc-b…
lexnv 7648c8f
asset-hub: Adjust more tests
lexnv 89649b1
xcm: Adjust ERC20TransferGasLimit to allow higher fees
lexnv 3eac3cc
revive/rpc: extend block_number_to_hash to keep substrate, eth hashes…
lrubasze 0518e8e
revive/rpc: centralize block mapping insertion
lrubasze 39dba82
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze 4c60922
revive: Remove cloning of encoded bytes
lexnv 91f79d1
revive: Use constants for tx payload size
lexnv 1ccd2ba
revive: Remove stale comment
lexnv 1f79ac1
revive: Make block author infalliable
lexnv a71fe20
revive: weightinfo_extension as crate module
lexnv 7696c7a
revive/tests: Revert balance changes
lexnv d73e8e1
revive/rpc: Remove substitute for TransactionSigned
lexnv 655e068
Merge remote-tracking branch 'origin/master' into lexnv/minimal-poc-b…
lexnv c324219
Merge branch 'lexnv/minimal-poc-block-storage' into lexnv/revive-rpc-…
lrubasze 9274403
Revert "revive/rpc: centralize block mapping insertion"
lrubasze 98db7a8
Revert "revive/rpc: extend block_number_to_hash to keep substrate, et…
lrubasze 21b3eb9
revive/rpc: use ethereum block hash in logs table
lrubasze 9286e6f
revive/rpc: remove block_number from eth_to_substrate_blocks table
lrubasze 0c8add3
revive/rpc: cleanup
lrubasze 8dee9c7
revive/rpc: just INSERT to the tables
lrubasze 775f9d2
revive/rpc: use eth_to_substrate_blocks as a source of truth
lrubasze cc79c8f
revive/rpc: error if receipt gas info not found or length mismatch
lrubasze 6a22917
Merge branch 'master' into lexnv/revive-rpc-adjustment
lrubasze 26bd82e
revive/rpc: clippy
lrubasze 40688e3
revive/rpc: prdoc
lrubasze 15d8c6d
revive/rpc: update prdoc
lrubasze ad3e1b5
Merge branch 'lexnv/revive-rpc-adjustment' into lrubasze/eth-trie-roo…
lrubasze 0a4a84b
Merge branch 'master' into lexnv/revive-rpc-adjustment
pgherveou 2fca942
revive: more test data for root tests
lrubasze 9034f9b
Merge branch 'lexnv/revive-rpc-adjustment' into lrubasze/eth-trie-roo…
lrubasze 57c0ede
revive/rpc: clippy
lrubasze e6eb15e
revive: fix seal_block_hash benchmark
lrubasze cd6f967
revive/rpc: update prdoc
lrubasze ddfd266
Merge branch 'master' into lexnv/revive-rpc-adjustment
lrubasze df67a07
bring change from #10018
pgherveou 1c79554
rm unused dep
pgherveou d27866c
fix part one
pgherveou 030ab07
revive/rpc: fix get_block_transaction_count
lrubasze 8bfdfa7
revive/rpc: support for getting substrate block extrinsic index
lrubasze 5bacb9e
revive/rpc: further improvements to substrate block extrinsic index
lrubasze 84bbc1a
revive/rpc: add test for multiple transactions in a block
lrubasze abaa7cf
revive: fix tests
lrubasze ad672dd
revive/rpc: comments
lrubasze 55df115
Merge branch 'master' into lexnv/revive-rpc-adjustment
lrubasze 0524613
Merge branch 'lexnv/revive-rpc-adjustment' into lrubasze/eth-trie-roo…
lrubasze a7f14f7
revive: remove some deps
lrubasze 887fd74
revive: fmtCargo.toml
lrubasze 1f87661
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] 94255f4
Revert "revive/rpc: further improvements to substrate block extrinsic…
lrubasze 8c57460
Revert "revive/rpc: support for getting substrate block extrinsic index"
lrubasze ff15443
revive/rpc: use Substrate extrinsic indexes as EVM transaction indexes
lrubasze 9b34a57
revive/rpc: use find_transaction to trace transaction
lrubasze 53d9083
revive/rpc: some cleanup
lrubasze 2d577a0
revive: improve some tests
lrubasze 29a937b
revive: improve block_hash_works test
lrubasze 867d2b2
revive/rpc: switch to log::trace in tests
lrubasze 2789ee6
Merge branch 'lexnv/revive-rpc-adjustment' into lrubasze/eth-trie-roo…
lrubasze bb57331
Merge remote-tracking branch 'origin/master' into lrubasze/eth-trie-r…
lrubasze e661278
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] abdcfb4
revive: switch to log::trace in tests
lrubasze d39a9fa
revive: remove ethereum dependency in tests
lrubasze a54e8c1
revive/rpc: get rid of wait_for_receipt_advanced
lrubasze 2265233
revive/rpc: send_typed -> send_with_type
lrubasze 490044b
revive/rpc: max_priority_fee_per_gas = 0
lrubasze b4b9223
revive/rpc: fix setting max_priority_fee_per_gas
lrubasze be65f66
Merge branch 'master' into lrubasze/eth-trie-root-and-rlp-codec-impro…
lrubasze 51812b3
Merge branch 'master' into lrubasze/eth-trie-root-and-rlp-codec-impro…
lrubasze 94e9880
revive: fix test
lrubasze f2e1de2
Merge branch 'lrubasze/eth-trie-root-and-rlp-codec-improvements' into…
lrubasze ae5fef3
Merge branch 'master' into lrubasze/eth-trie-root-and-rlp-codec-impro…
lrubasze e3a7250
Merge branch 'master' into lrubasze/eth-trie-root-and-rlp-codec-impro…
lrubasze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
175 changes: 175 additions & 0 deletions
175
substrate/frame/revive/rpc/examples/collect-test-data.rs
This file contains hidden or 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,175 @@ | ||
| // This file is part of Substrate. | ||
|
|
||
| // Copyright (C) Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| use clap::Parser; | ||
| use jsonrpsee::http_client::HttpClientBuilder; | ||
| use pallet_revive::evm::{BlockNumberOrTag, ReceiptInfo, TransactionInfo, H256, U256}; | ||
| use pallet_revive_eth_rpc::EthRpcClient; | ||
| use serde::Serialize; | ||
| use std::sync::Arc; | ||
|
|
||
| #[derive(Parser)] | ||
| #[command(name = "collect-test-data")] | ||
| #[command(about = "Collect block data, transactions and receipts for test data generation")] | ||
| struct Args { | ||
| /// RPC URL (e.g., http://localhost:8545) | ||
| #[arg(short, long, default_value = "http://localhost:8545")] | ||
| rpc_url: String, | ||
|
|
||
| /// Block number (if not provided, uses latest block) | ||
| #[arg(short, long)] | ||
| block_number: Option<u64>, | ||
|
|
||
| /// Include transaction infos in the JSON output | ||
| #[arg(long)] | ||
| with_transactions: bool, | ||
|
|
||
| /// Include receipt infos in the JSON output | ||
| #[arg(long)] | ||
| with_receipts: bool, | ||
| } | ||
|
|
||
| #[derive(Serialize)] | ||
| struct TestDataInfo { | ||
| rpc_url: String, | ||
| block_number_requested: String, | ||
| } | ||
|
|
||
| #[derive(Serialize)] | ||
| struct TestData { | ||
| info: TestDataInfo, | ||
| block_number: U256, | ||
| block_hash: H256, | ||
| transactions: Option<Vec<TransactionInfo>>, | ||
| transactions_rlp: Vec<String>, | ||
| transactions_root: H256, | ||
| receipts: Option<Vec<ReceiptInfo>>, | ||
| receipts_rlp: Vec<String>, | ||
| receipts_root: H256, | ||
| } | ||
| // TODO | ||
lrubasze marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // below command fails | ||
| // target/debug/examples/collect-test-data -b 23094898 -r https://ethereum-rpc.publicnode.com | ||
| // with such message: | ||
| // Fetching block data for: U256(23094898) | ||
| // Error: Parse error: data did not match any variant of untagged enum HashesOrTransactionInfos at | ||
| // line 1 column 520458 | ||
| // Caused by: | ||
| // data did not match any variant of untagged enum HashesOrTransactionInfos at line 1 column | ||
| // 520458 | ||
|
|
||
| #[tokio::main] | ||
| async fn main() -> anyhow::Result<()> { | ||
| let args = Args::parse(); | ||
|
|
||
| let client = Arc::new(HttpClientBuilder::default().build(&args.rpc_url)?); | ||
|
|
||
| // Determine block number to use | ||
| let block_number = match args.block_number { | ||
| Some(num) => BlockNumberOrTag::U256(U256::from(num)), | ||
| None => BlockNumberOrTag::BlockTag(pallet_revive::evm::BlockTag::Latest), | ||
| }; | ||
|
|
||
| println!("Fetching block data for: {:?}", block_number); | ||
|
|
||
| // Get block information | ||
| let block = client | ||
| .get_block_by_number(block_number.clone(), true) | ||
| .await? | ||
| .ok_or_else(|| anyhow::anyhow!("Block not found"))?; | ||
|
|
||
| println!("Block hash: {:?}", block.hash); | ||
| println!("Block number: {:?}", block.number); | ||
| println!( | ||
| "Transactions count: {}", | ||
| match &block.transactions { | ||
| pallet_revive::evm::HashesOrTransactionInfos::TransactionInfos(txs) => txs.len(), | ||
| pallet_revive::evm::HashesOrTransactionInfos::Hashes(hashes) => hashes.len(), | ||
| } | ||
| ); | ||
|
|
||
| // Extract transaction infos | ||
| let transaction_infos = match block.transactions { | ||
| pallet_revive::evm::HashesOrTransactionInfos::TransactionInfos(txs) => txs, | ||
| pallet_revive::evm::HashesOrTransactionInfos::Hashes(hashes) => { | ||
| // If we only have hashes, fetch full transaction info | ||
| let mut txs = Vec::new(); | ||
| for hash in hashes { | ||
| if let Some(tx) = client.get_transaction_by_hash(hash).await? { | ||
| txs.push(tx); | ||
| } | ||
| } | ||
| txs | ||
| }, | ||
| }; | ||
|
|
||
| // Collect receipts | ||
| let mut receipts = Vec::new(); | ||
| for tx in &transaction_infos { | ||
| if let Some(receipt) = client.get_transaction_receipt(tx.hash).await? { | ||
| receipts.push(receipt); | ||
| } | ||
| } | ||
|
|
||
| println!("Collected {} receipts", receipts.len()); | ||
|
|
||
| // Generate RLP encoded transactions | ||
| let mut transactions_rlp = Vec::new(); | ||
| for tx in &transaction_infos { | ||
| let rlp_encoded = tx.transaction_signed.encode_2718(); | ||
| transactions_rlp.push(format!("0x{}", hex::encode(rlp_encoded))); | ||
| } | ||
|
|
||
| // Generate RLP encoded receipts | ||
| let mut receipts_rlp = Vec::new(); | ||
| for receipt in &receipts { | ||
| let rlp_encoded = receipt.encode_2718(); | ||
| receipts_rlp.push(format!("0x{}", hex::encode(rlp_encoded))); | ||
| } | ||
|
|
||
| // Create test data structure | ||
| let test_data = TestData { | ||
| info: TestDataInfo { | ||
| rpc_url: args.rpc_url.clone(), | ||
| block_number_requested: match args.block_number { | ||
| Some(num) => num.to_string(), | ||
| None => "latest".to_string(), | ||
| }, | ||
| }, | ||
| block_number: block.number, | ||
| block_hash: block.hash, | ||
| transactions: if args.with_transactions { Some(transaction_infos) } else { None }, | ||
| transactions_rlp, | ||
| transactions_root: block.transactions_root, | ||
| receipts: if args.with_receipts { Some(receipts) } else { None }, | ||
| receipts_rlp, | ||
| receipts_root: block.receipts_root, | ||
| }; | ||
|
|
||
| // Output as JSON | ||
| let json_output = serde_json::to_string_pretty(&test_data)?; | ||
| println!("\n=== TEST DATA ===\n"); | ||
| println!("{}", json_output); | ||
|
|
||
| // Also save to file | ||
| let filename = format!("test_data_block_{}.json", block.number); | ||
| std::fs::write(&filename, &json_output)?; | ||
| println!("\n=== SAVED TO FILE ==="); | ||
| println!("Test data saved to: {}", filename); | ||
|
|
||
| Ok(()) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.