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

Handle getProof without storage root idx #6

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ftheirs
Copy link

@ftheirs ftheirs commented Nov 25, 2024

Pathfinder encounters an error when querying the storage_root_idx results in None. This PR addresses these cases by handling the error and populating contract_proof with an empty vector instead.


While working with a devnet on Madara, we discovered a condition that occurs only in the initial blocks of the chain. From block 1 to block 9, the storage_root_idx query returns None, causing Pathfinder to immediately throw an error.
This error is propagated instead of being handled appropriately at the application layer, specifically in SNOS. Returning an empty vector allows us to continue with our workflow and handle this situation more gracefully.

On the other hand, the error received is not descriptive, forcing SNOS to interrupt execution. For example:

{"error":{"code":-32603,"message":"Internal error"},"id":1,"jsonrpc":"2.0"}

Steps to reproduce:

  1. Clone repositories
git clone [email protected]:eqlabs/pathfinder.git
git clone [email protected]:madara-alliance/madara
  1. Run Madara
cd madara
cargo run --release -- \
    --name madara \
    --base-path $(pwd)/madara-db \
    --rpc-port 9944 \
    --rpc-cors "*" \
    --rpc-external \
    --sequencer \
    --chain-config-path configs/presets/devnet.yaml \
    --feeder-gateway-enable \
    --gateway-enable \
    --gateway-external \
    --gas-price 1234 \
    --blob-gas-price 10 \
    --rpc-methods unsafe \
    --no-l1-sync
  1. Start Pathfinder
cd ../pathfinder
cargo run --bin pathfinder -- \
    --network custom \
    --chain-id MADARA_DEVNET \
    --ethereum.url wss://eth-sepolia.g.alchemy.com/v2/WIUR5JUZXieEBkze6Xs3IOXWhsS840TX \
    --gateway-url http://localhost:8080/gateway \
    --feeder-gateway-url http://localhost:8080/feeder_gateway \
    --storage.state-tries archive \
    --data-directory ~/pathfinder/data \
    --http-rpc 127.0.0.1:9545
  1. Retrieve a storage proof using curl from any block between 1 and 9
curl --request POST \
    --url http://127.0.0.1:9545/rpc/pathfinder/v0.1 \
    --header 'accept: application/json' \
    --header 'content-type: application/json' \
    --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "pathfinder_getProof",
  "params": [
    { "block_number": 5 }, "0x1", ["0x0"]
  ]
}
'

@whichqua
Copy link

Could you consider giving the PR a little more info and motivation?

@ftheirs ftheirs changed the title handle getProof without storage root idx Handle getProof without storage root idx Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants