near / stakewars-iii

Stake Wars: Episode 3 challenges and place to report issues
87 stars 177 forks source link

SHARDNET Validators API call with block_height: 2018939 is pointing to a epoch_start_height: 2008940, but this block doesn't exist #104

Open sotcsa opened 2 years ago

sotcsa commented 2 years ago

While I was writing a Python script for big-data challenge, detected a weird response from RPC server:

Step 1

Get validators method with block_height: 2018939 And save result.epoch_start_height (2008940)

BLOCK_HEIGHT_epoch_start_height=$(curl -s -X POST 'https://rpc.shardnet.near.org' \
-H 'Content-Type: application/json' \
-d '{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "validators",
  "params": [2018939]
}' -s | jq .result.epoch_start_height)

Setp 2

Call block method with the epoch_start_height

curl -s -X POST 'https://rpc.shardnet.near.org' \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "id": "dontcare",
    "method": "block",
    "params": {
        "block_id": '$BLOCK_HEIGHT_epoch_start_height'
    }
}' -s | jq

Expected result

Validators method should answer 2008939 as epoch_start_height, instead of non-exiting block (2008940) The 2008941 block says: "prev_height": 2008939

Actual result

2008940 response is:


  "jsonrpc": "2.0",
  "error": {
    "name": "HANDLER_ERROR",
    "cause": {
      "info": {},
      "name": "UNKNOWN_BLOCK"
    },
    "code": -32000,
    "message": "Server error",
    "data": "DB Not Found Error: BLOCK HEIGHT: 2008940 \n Cause: Unknown"
  },
  "id": "dontcare"
}```