MystenLabs / sui

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language
https://sui.io
Apache License 2.0
6.01k stars 11.11k forks source link

suix_getStakes fails with "Cannot find rates for staking pool {pool_id}" #18304

Closed idan-david closed 3 months ago

idan-david commented 3 months ago

Steps to Reproduce Issue

curl https://rpc.mainnet.sui.io \
--header 'content-type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "suix_getStakes",
    "params": {
        "owner": "0x0d0d252e6226d929475cbd9d896ff3cf564b89ffee8c134173dae752e0c43c24"
    }
}'

Expected Result

Should return the stakes for the address

Actual Result

{"jsonrpc":"2.0","error":{"code":-32602,"message":"Cannot find rates for staking pool {pool_id}"},"id":1}

Other Info

From the code here I am guessing that there is a stake with an inactive validator. Is there a way for me to still get the list of delegations?

EDIT I used suix_getOwnedObjects, and I believe the following stake is the problem. At the time of writing, the epoch is 432, and the activation epoch of that stake is 433. The validator with that reward pool is new 0xd4658e488c374d597f9b87dcb45d18f591d7e49eb121e510922d441773782f19. (I retrieved the address from the StakingRequest event

{
    "data": {
        "objectId": "0xc620ff40430e604bc7471ec6915fd949b57aef24f6fac0342937ca86c7ec293e",
        "version": "266411565",
        "digest": "6GfnGvHUhYLDU3d7tcthHcepuPJxaPRbPavXmPJEJqJ",
        "type": "0x3::staking_pool::StakedSui",
        "owner": {
            "AddressOwner": "0x0d0d252e6226d929475cbd9d896ff3cf564b89ffee8c134173dae752e0c43c24"
        },
        "previousTransaction": "4FoMt1v5ntAnVsWyfTuCRxhxR8FM4KrygAokLiSk7TwP",
        "storageRebate": "1292000",
        "content": {
            "dataType": "moveObject",
            "type": "0x3::staking_pool::StakedSui",
            "hasPublicTransfer": true,
            "fields": {
                "id": {
                    "id": "0xc620ff40430e604bc7471ec6915fd949b57aef24f6fac0342937ca86c7ec293e"
                },
                "pool_id": "0xcec083441e89e77b1868691bca6b55ee9c4679bd59e74a86e2545fe03d6a052d",
                "principal": "6864472950000000",
                "stake_activation_epoch": "433"
            }
        }
    }
}
idan-david commented 3 months ago

Update: this is now working, as the validator has successfully registered.