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

Use correct DSN protocols in gateway #3221

Merged
merged 4 commits into from
Nov 8, 2024
Merged

Use correct DSN protocols in gateway #3221

merged 4 commits into from
Nov 8, 2024

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Nov 8, 2024

In a recent refactor, I used the wrong gateway node config. The protocol version is missing a /subspace/2/ prefix, and the piece fetching protocols weren't enabled.

As part of this change, I also added a fallback from the farmer cache (L2) to archival storage (L1).

In the current implementation, all the DSN connections fail:

$ subspace-node run --chain mainnet --tmp
$ RUST_LOG=subspace=debug,subspace_networking=info,subspace_networking::utils::piece_provider=debug,info subspace-gateway run
$ websocat --jsonrpc ws://127.0.0.1:9955 | jq .
subspace_fetchObject {"mappings": {"v0": {"objects": [["0000000000000000000000000000000000000000000000000000000000000000", 0, 0]]}}}

2024-11-07T22:28:00.703640Z DEBUG subspace_networking::node_runner: Peer has different protocol version, banning temporarily local_peer_id=12D3KooWB9bHyw97AcEzCGDabL1dgaFU4K2q5a3DopQU9F4jaWs8 peer_id=12D3KooW9sMSK3i9pkPQaQJgWkVVeN7gzrgHD6kAGQKuycqUAWVY local_protocol_version=66455a580aabff303720aa83adbe6c44502922251c03ba73686d5245da9e21bd peer_protocol_version=/subspace/2/66455a580aabff303720aa83adbe6c44502922251c03ba73686d5245da9e21bd

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 9001,
    "message": "ObjectFetcherError(PieceNotFound { piece_index: PieceIndex(0) })"
  }
}

After these fixes, it works:

subspace_fetchObject {"mappings": {"v0": {"objects": [["0000000000000000000000000000000000000000000000000000000000000000", 0, 0]]}}}
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 9001,
    "message": "InvalidObjectHash { mapping_hash: 0000000000000000000000000000000000000000000000000000000000000000, data_hash: af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262 }"
  }
}
subspace_fetchObject {"mappings": {"v0": {"objects": [["af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262", 0, 0]]}}}
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": [
    ""
  ]
}

Code contributor checklist:

@teor2345 teor2345 self-assigned this Nov 8, 2024
@teor2345 teor2345 added bug Something isn't working improvement it is already working, but can be better labels Nov 8, 2024
@teor2345 teor2345 changed the title Use correct DSN protocol version in gateway Use correct DSN protocols in gateway Nov 8, 2024
@teor2345 teor2345 added this pull request to the merge queue Nov 8, 2024
Merged via the queue into main with commit 49a1013 Nov 8, 2024
8 checks passed
@teor2345 teor2345 deleted the fix-gateway-prot branch November 8, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement it is already working, but can be better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants