SNOS version: V0_13_2
Current behavior:
Supposing I am making the following RPC call:
{
"id": "0",
"jsonrpc": "2.0",
"method": "pathfinder_getClassProof",
"params": {
"block_id": {
"block_number": 624
},
"class_hash": "0x1484c93b9d6cf61614d698ed069b3c6992c32549194fc3465258c2194734189"
}
}
Pathfinder may return the following response:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"class_proof": [
{
"edge": {
"child": "0x5b1cf4fae08fc3e2ab46133cae791bf38337964146736e6baf1b9dbc92bb872",
"path": {
"len": 251,
"value": "0x1484c93b9d6cf61614d698ed069b3c6992c32549194fc3465258c2194734189"
}
}
}
]
}
}
The json above fails to parse because we use the following struct for the response:
#[derive(Clone, Deserialize)]
pub struct PathfinderClassProof {
pub class_commitment: Felt,
pub class_proof: Vec<TrieNode>,
}
This panics, because the response does not include a class_commitment
thread 'main' panicked at snos/crates/bin/prove_block/src/lib.rs:285:78:
Failed to fetch class proofs: ReqwestError(reqwest::Error { kind: Decode, source: Error("missing field `class_commitment`", line: 1, column: 234) })
Expected behavior:
Since there are cases where the response is missing the class_commitment then we would need to read the response as:
#[derive(Clone, Deserialize)]
pub struct PathfinderClassProof {
pub class_commitment: Option<Felt>,
pub class_proof: Vec<TrieNode>,
}
Steps to reproduce:
- Setup and run Madara on port 9944
- Launch Pathfinder and connect it to Madara's feeder gateway:
cargo run --bin pathfinder -- \
--network custom \
--chain-id MADARA_DEVNET \
--ethereum.url wss://eth-sepolia.g.alchemy.com/.. \
--gateway-url http://localhost:8080/gateway \
--feeder-gateway-url http://localhost:8080/feeder_gateway \
--storage.state-tries archive \
--data-directory ~/pathfinder_db/ \
--http-rpc 127.0.0.1:9545
- Find the blocks immediately after the declare_v0 txn
Related code:
Here is a script to find blocks with this issue, you can adjust it as necessary
#!/bin/bash
# Output CSV file
output_file="failed_blocks.csv"
# Initialize the CSV file with headers
# echo "block_number" > $output_file
# Loop through blocks 1 to 100
for block_number in {1..100}
do
# Run the command for the current block
if ! cargo run -p prove_block -- --block-number $block_number; then
# If the command fails, log the block number to the CSV
echo "$block_number" >> $output_file
fi
done
echo "Script finished. Failed block numbers are saved in $output_file."
SNOS version: V0_13_2
Current behavior:
Supposing I am making the following RPC call:
{ "id": "0", "jsonrpc": "2.0", "method": "pathfinder_getClassProof", "params": { "block_id": { "block_number": 624 }, "class_hash": "0x1484c93b9d6cf61614d698ed069b3c6992c32549194fc3465258c2194734189" } }Pathfinder may return the following response:
{ "id": "0", "jsonrpc": "2.0", "result": { "class_proof": [ { "edge": { "child": "0x5b1cf4fae08fc3e2ab46133cae791bf38337964146736e6baf1b9dbc92bb872", "path": { "len": 251, "value": "0x1484c93b9d6cf61614d698ed069b3c6992c32549194fc3465258c2194734189" } } } ] } }The json above fails to parse because we use the following struct for the response:
This panics, because the response does not include a
class_commitmentExpected behavior:
Since there are cases where the response is missing the class_commitment then we would need to read the response as:
Steps to reproduce:
cargo run --bin pathfinder -- \ --network custom \ --chain-id MADARA_DEVNET \ --ethereum.url wss://eth-sepolia.g.alchemy.com/.. \ --gateway-url http://localhost:8080/gateway \ --feeder-gateway-url http://localhost:8080/feeder_gateway \ --storage.state-tries archive \ --data-directory ~/pathfinder_db/ \ --http-rpc 127.0.0.1:9545Related code:
Here is a script to find blocks with this issue, you can adjust it as necessary