Skip to content

Anker: SellRewards might fail for small amounts #502

Description

@ruuda

I observed this on devnet:

$ target/debug/solido --config tests/.keys/fc6d3127ed/config.json anker show                        
Anker address:         BovX97d8MnVTbpwbBdyjSrEr7RvxN8AHEk3dYwTEx7RD
Anker program id:      8MT6MtwbSdNyYH655cDxf2MypYSVfmAdx8jXrBWPREzf
Solido address:        EMtjYGwPnXdtqK5SGL8CWGv4wgdBQN79UPoy53x9bBTJ
Solido program id:     874qdedig9MnSiinBkErWvafQacAfwzkHjHyE6XTa8kg
Rewards destination:   terra1uwlxcas745mwjte8wwu2l0fcs483twujnt8j5l
bSOL mint:             3FMBoeddUhtqxepzkrxPrMUV3CL4bZM5QmMoLJfEpirz
bSOL mint authority:   Bp9HtrSCLH3QnRMT1eXyk68xftm1HSdSfnmotjsiVyAH
bSOL supply:           0.250000000 bSOL
Reserve authority:     7vzwvurXS9ssMMeL2H7hjMnWJFmrxGnmQmqPaeWdAhvv
stSOL reserve address: BSGfVnE6q6KemspkugEERU8x7WbQwSKwvHT1cZZ4ACVN
stSOL reserve balance: 0.260000000 stSOL
stSOL reserve value:   0.260000000 SOL
UST reserve address:   275Mv1uYxAEyvNJGpQgCDLj3VTFt3ajASKfVBuh9iTHo
UST reserve balance:   0.000000 UST

So we have 0.01 stSOL excess that we can sell.

$ target/debug/solido --config tests/.keys/fc6d3127ed/config.json perform-maintenance
Sell stSOL rewards
  Amount:               0.260000000 stSOL

Okay, it sold some of the excess. The amount printed seems wrong though, we probably want to print the amount sold, not the balance before.

$ target/debug/solido --config tests/.keys/fc6d3127ed/config.json anker show         
Anker address:         BovX97d8MnVTbpwbBdyjSrEr7RvxN8AHEk3dYwTEx7RD
Anker program id:      8MT6MtwbSdNyYH655cDxf2MypYSVfmAdx8jXrBWPREzf
Solido address:        EMtjYGwPnXdtqK5SGL8CWGv4wgdBQN79UPoy53x9bBTJ
Solido program id:     874qdedig9MnSiinBkErWvafQacAfwzkHjHyE6XTa8kg
Rewards destination:   terra1uwlxcas745mwjte8wwu2l0fcs483twujnt8j5l
bSOL mint:             3FMBoeddUhtqxepzkrxPrMUV3CL4bZM5QmMoLJfEpirz
bSOL mint authority:   Bp9HtrSCLH3QnRMT1eXyk68xftm1HSdSfnmotjsiVyAH
bSOL supply:           0.250000000 bSOL
Reserve authority:     7vzwvurXS9ssMMeL2H7hjMnWJFmrxGnmQmqPaeWdAhvv
stSOL reserve address: BSGfVnE6q6KemspkugEERU8x7WbQwSKwvHT1cZZ4ACVN
stSOL reserve balance: 0.250001099 stSOL
stSOL reserve value:   0.250001099 SOL
UST reserve address:   275Mv1uYxAEyvNJGpQgCDLj3VTFt3ajASKfVBuh9iTHo
UST reserve balance:   0.009090 UST

Hmm, but it did not sell the full excess? There is still a tiny bit of stSOL left? Might have something to do with numeric precision, UST only has 6 decimals, and I set up the pool with really small initial balances (0.1 stSOL + 0.1 UST). Anyway, let’s try once more then:

$ target/debug/solido --config tests/.keys/fc6d3127ed/config.json perform-maintenance
Failed to perform maintenance.
Solana RPC client returned an error:

  Request:    Some(SendTransaction)
  Kind:       RPC response error
  Error code: -32002
  Message:    Transaction simulation failed: Error processing Instruction 0: custom program error: 0x14
  Reason:     Transaction preflight failure
  Error:     

    Raw:      InstructionError(0, Custom(20))
    Display:  Error processing Instruction 0: custom program error: 0x14

  Error code interpretations:

    Solido error 20 is ValidatorCreditNotFound
    Error 20 is not a known Multisig error.
    Error 20 is not a known Anker error.

  Logs:      

    Program 8MT6MtwbSdNyYH655cDxf2MypYSVfmAdx8jXrBWPREzf invoke [1]
    Program 3xQ8SWv2GaFXXpHZNqkXsdxq5DZciHBz6ZFoPPfbFd7U invoke [2]
    Program log: Instruction: Swap
    Program log: Error: Given pool token amount results in zero trading tokens
    Program 3xQ8SWv2GaFXXpHZNqkXsdxq5DZciHBz6ZFoPPfbFd7U consumed 10770 of 173731 compute units
    Program 3xQ8SWv2GaFXXpHZNqkXsdxq5DZciHBz6ZFoPPfbFd7U failed: custom program error: 0x14
    Program 8MT6MtwbSdNyYH655cDxf2MypYSVfmAdx8jXrBWPREzf consumed 37039 of 200000 compute units
    Program 8MT6MtwbSdNyYH655cDxf2MypYSVfmAdx8jXrBWPREzf failed: custom program error: 0x14

Nope, the pool doesn’t allow us.

This is including #495 already. We should probably raise the minimum then.

Metadata

Metadata

Assignees

No one assigned

    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