Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.
This repository was archived by the owner on May 14, 2025. It is now read-only.

Address trivial bugs in validating Forest #18

Description

@aatifsyed

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"
...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions