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

Address trivial bugs in validating Forest #18

Open
aatifsyed opened this issue Jul 22, 2024 · 0 comments
Open

Address trivial bugs in validating Forest #18

aatifsyed opened this issue Jul 22, 2024 · 0 comments
Assignees

Comments

@aatifsyed
Copy link
Contributor

aatifsyed commented Jul 22, 2024

Repro with this setup:

┌──────────────────────────────────┐                                         ┌───────────────────────┐
│                         "forest" ├──────────────────────────────────:2345─►│                       │
│ forest-tool api compare          │        ┌───────────────────────┐        │ forest-tool api serve │
│                         "lotus"  ├─:1234─►│ tool json-rpc capture ├─:2345─►│                       │
└──────────────────────────────────┘        └───────────────────────┘        └───────────────────────┘

Start an RPC server (forest).

$ git show --no-patch --no-notes --pretty=%h-%cs HEAD
40ff0ad6a6f-2024-08-20
$ cargo run --release --bin forest-tool -- api serve --chain calibnet ~/chainsafe/snapshots/forest_snapshot_calibnet_2024-06-27_height_1738657.forest.car.zst

Start RPC capture (filecoin-common-node-api).

This should capture ~700MiB.

$ git show --no-patch --no-notes --pretty=%h-%cs HEAD
b453a9d-2024-08-16
$ cargo run --release --manifest-path rust/Cargo.toml --package tool -- json-rpc capture --local 127.0.0.1:1234 --remote 'http://127.0.0.1:2345' > capture

Make RPC calls (forest).

Note that the tests fail (even when I provide the default --filter-file).
This should take ~1min.

$ cargo run --release --bin forest-tool -- api compare ~/chainsafe/snapshots/forest_snapshot_calibnet_2024-06-27_height_1738657.forest.car.zst

Validate the captured RPC calls (filecoin-common-node-api).

$ cargo run --quiet --release --manifest-path rust/Cargo.toml --package tool -- openrpc validate spec.json < capture 2>&1 | grep -v 'not found in spec'
script[1917]: failed to validate method Filecoin.StateGetNetworkParams: [invalid-result]
script[2419]: failed to validate method Filecoin.StateMinerInfo: [invalid-result]
...
script[2453]: failed to validate method Filecoin.StateMinerInfo: [invalid-result]
script[2540]: failed to validate method Filecoin.StateMinerProvingDeadline: [invalid-result]
script[2542]: failed to validate method Filecoin.StateMinerProvingDeadline: [invalid-result]
...
script[2575]: failed to validate method Filecoin.StateMinerProvingDeadline: [invalid-result]
...

Drilling into the failing items.

Note that these are only the ones covered by Forest's integration tests.

$ sed '1918q;d' capture | cargo run --quiet --release --manifest-path rust/Cargo.toml --package tool -- openrpc validate spec.json
script[0]: failed to validate method Filecoin.StateGetNetworkParams (1 errors)
invalid result:
        /properties/SupportedProofTypes/type    /SupportedProofTypes    [3,4] is not of type "integer"
...
$ sed '2420q;d' capture | cargo run --quiet --release --manifest-path rust/Cargo.toml --package tool -- openrpc validate
spec.json
script[0]: failed to validate method Filecoin.StateMinerInfo (1 errors)
invalid result:
        /properties/WindowPoStProofType/type    /WindowPoStProofType    13 is not of type "string"
...
$ sed '2541q;d' capture | cargo run --quiet --release --manifest-path rust/Cargo.toml --package tool -- openrpc validate
spec.json
script[0]: failed to validate method Filecoin.StateMinerProvingDeadline (1 errors)
invalid result:
        /type           {"Challenge":1738587,"Close":1738667,"CurrentEpoch":1738628,"FaultCutoff":1738537,"FaultDeclarationCutoff":70,"Index":22,"Open":1738607,"PeriodStart":1737287,"WPoStChallengeLookback":20,"WPoStChallengeWindow":60,"WPoStPeriodDeadlines":48,"WPoStProvingPeriod":2880} is not of type "string"
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

No branches or pull requests

2 participants