Skip to content

RPC calls don't work if the requested version is the latest finalized block #457

@zizou0x

Description

@zizou0x

Description

When calling the /protocol_state or /contract_state endpoint for the latest finalized block, it returns 404 Error: Not Found. However, the endpoint works as expected for the blocks immediately before and after the latest finalized block.

Example

Given current finalized block: 21392273

With this request:

curl -X 'POST' \
  'http://0.0.0.0:4242/v1/contract_state' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "chain": "ethereum",
  "pagination": {
    "page": 0,
    "page_size": 2
  },
  "protocol_system": "vm:balancer_v2",
  "version": {
    "block": {
      "chain": "ethereum",
      "number": 21392273
    }
  }
}'
  • Behavior:
    • /contract_state for block 21392272 → ✅ Works
    • /contract_state for block 21392274 → ✅ Works
    • /contract_state for block 21392273 → ❌ 404 Error: Not Found

And same behavior for /protocol_state.

On the server side, this log appears:

ERROR get_contract_state: Error while getting contract states. error=Could not find Block with id `21392273`!

Expected Behavior

/protocol_state and /contract_state endpoints should return the state for the latest finalized block.


Actual Behavior

The endpoint return 404 Error: Not Found specifically for the latest finalized block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions