anoma / namada

Rust implementation of Namada, a Proof-of-Stake L1 for interchain asset-agnostic privacy
https://namada.net
GNU General Public License v3.0
2.39k stars 948 forks source link

governance voting is broken in v0.44.0 #3859

Open McDaan opened 6 days ago

McDaan commented 6 days ago

While trying to collect data for Undexer improvements, we have voted nay on proposal ID 1 (voting period from epoch 60 to 63) on Housefire running on v0.44.0:

https://shielded.live/txs/52AF06EC53AA9EE88289F318706396536D7CC31DC60754BCAF207422271D8988

Block height in which the transaction has been processed: https://shielded.live/blocks/26579 (epoch 61)

But:

namadac query-proposal-votes --proposal-id 1
Votes for proposal id 1

No votes shown.

namadac query-proposal-result --proposal-id 1
Proposal Id: 1
    The voting period has ended.
    Rejected with 0.000000 yay votes, 0.000000 nay votes and 0.000000 abstain votes, total voting power: 2001302524.222226, threshold (fraction) of total voting power needed to tally: 800521009.688891 (0.4)

No voting power shown on nay side.

Fraccaman commented 6 days ago

I just tested this on one of our internal networks and I can see the votes:

namadac query-proposal-votes --proposal-id 1
Votes for proposal id 1

Voter: tnam1qz4u7j7dkxj5wv9xuwy2qemaeeqd450ysgl7pq0r
Vote: nay
Proposal Id: 1
    The voting period is underway and will continue until epoch 230 begins.
    NOTE: Validators can vote only until the end of epoch 228.
    Currently with 0.000000 yay votes, 1000.000000 nay votes and 0.000000 abstain votes, total voting power: 31000.000000, threshold (fraction) of total voting power needed to tally: 12400.000000 (0.4)
grarco commented 6 days ago

From the block results of that block it seems like the tx didn't change any keys in storage:

{
   "jsonrpc":"2.0",
   "id":-1,
   "result":{
      "height":"26579",
      "txs_results":[
         {
            "code":0,
            "data":null,
            "log":"",
            "info":"",
            "gas_wanted":"0",
            "gas_used":"0",
            "events":[

            ],
            "codespace":""
         }
      ],
      "begin_block_events":null,
      "end_block_events":[
         {
            "type":"tx/applied",
            "attributes":[
               {
                  "key":"batch",
                  "value":"{\"F0E28A053E91E283FB1A15ADF1044EEEFAFECA1C6C8D2F7B84D3BE07384C37FE\":{\"Ok\":{\"changed_keys\":[],\"vps_result\":{\"accepted_vps\":[\"tnam1qxshaapfleewqjgdrqsfkz8zmjkzum088qpl76cn\"],\"rejected_vps\":[],\"errors\":[],\"status_flags\":\"\"},\"initialized_accounts\":[],\"events\":[]}}}",
                  "index":true
               },
               {
                  "key":"code",
                  "value":"0",
                  "index":true
               },
               {
                  "key":"gas_used",
                  "value":"56669",
                  "index":true
               },
               {
                  "key":"hash",
                  "value":"52AF06EC53AA9EE88289F318706396536D7CC31DC60754BCAF207422271D8988",
                  "index":true
               },
               {
                  "key":"height",
                  "value":"26579",
                  "index":true
               },
               {
                  "key":"info",
                  "value":"Check batch for result.",
                  "index":true
               },
               {
                  "key":"log",
                  "value":"",
                  "index":true
               },
               {
                  "key":"event-level",
                  "value":"tx",
                  "index":true
               }
            ]
         }
      ],
      "validator_updates":null,
      "consensus_param_updates":null
   }
}
McDaan commented 5 days ago

I just tested this on one of our internal networks and I can see the votes:

namadac query-proposal-votes --proposal-id 1
Votes for proposal id 1

Voter: tnam1qz4u7j7dkxj5wv9xuwy2qemaeeqd450ysgl7pq0r
Vote: nay
Proposal Id: 1
    The voting period is underway and will continue until epoch 230 begins.
    NOTE: Validators can vote only until the end of epoch 228.
    Currently with 0.000000 yay votes, 1000.000000 nay votes and 0.000000 abstain votes, total voting power: 31000.000000, threshold (fraction) of total voting power needed to tally: 12400.000000 (0.4)

I just tried again with a PGF Steward proposal that I have created, and I've been able to reproduce the same issue voting via a validator address, so not sure if this is related to an inconsistency in the configuration and/or the way Housefire v0.44.0 has been set up - due to the fact you are getting a different result on an internal devnet. Although if this is a way similar to the one in which we'll launch the mainnet, then it's definitely concerning.

https://shielded.live/txs/9FB77E56DDD347936DE8BC3AD1CA756478B8BF78999D45F621CEDF2F7E017036

Block height in which the transaction has been processed: https://shielded.live/blocks/39984 (epoch 92)

namadac query-proposal-votes --proposal-id 2
Votes for proposal id 2
namadac query-proposal-result --proposal-id 2
Proposal Id: 2
    The voting period is underway and will continue until epoch 95 begins.
    NOTE: Validators can vote only until the end of epoch 93.
    Currently with 0.000000 yay votes, 0.000000 nay votes and 0.000000 abstain votes, total voting power: 2001390443.222226, threshold (fraction) of total voting power needed to tally: 667130147.740075 (0.333333333333)
McDaan commented 5 days ago

I just voted abstain in the same proposal as above via a delegator address tnam1qrmanuyyunsljx3jek6wzq3th2v4p6k2nvqsq9yu and looks like the vote has been registered now:

https://shielded.live/txs/AE96E2C605D50065C7CA00E1E24EADDDC0EE6EC3E5B2B394A2C070A1070304DE

Block height in which the transaction has been processed: https://shielded.live/blocks/40409 (epoch 93)

namadac query-proposal-votes --proposal-id 2
Votes for proposal id 2

Voter: tnam1qzm0yt3e7gdmcf65jmxkstwm6ngv7cpprv8tqd6j
Vote: yay

Voter: tnam1qzm0yt3e7gdmcf65jmxkstwm6ngv7cpprv8tqd6j
Vote: yay

Voter: tnam1qrmanuyyunsljx3jek6wzq3th2v4p6k2nvqsq9yu
Vote: abstain

Voter: tnam1qzm0yt3e7gdmcf65jmxkstwm6ngv7cpprv8tqd6j
Vote: yay

Voter: tnam1qzm0yt3e7gdmcf65jmxkstwm6ngv7cpprv8tqd6j
Vote: yay

Voter: tnam1qzm0yt3e7gdmcf65jmxkstwm6ngv7cpprv8tqd6j
Vote: yay

The odd thing, as we can see above, is that other delegator address has voted yes and his vote has been registered "multiple times" (?):

https://shielded.live/txs/5407151E5D617CB7692DA5D804E87AC92F0205836F99F4E3728275B2D57DE3D6

Block height in which the transaction has been processed: https://shielded.live/blocks/40256 (epoch 92)

Fraccaman commented 5 days ago

multiple votes from the same delegator is fine (the vote is stored in storage for each delegation, so probably tnam1qzm0yt3e7gdmcf65jmxkstwm6ngv7cpprv8tqd6j has 5 delegations towards 5 different validators). Im still trying to reproduce the error internally.

McDaan commented 5 days ago

multiple votes from the same delegator is fine (the vote is stored in storage for each delegation, so probably tnam1qzm0yt3e7gdmcf65jmxkstwm6ngv7cpprv8tqd6j has 5 delegations towards 5 different validators). Im still trying to reproduce the error internally.

Ah, got it. Well, then this would leave the major issue of validator votes not being included in the storage. I have just tried again in the proposal ID 3 at Housefire v0.44.0 and same, the validator vote it's not being counted/included in the storage:

https://shielded.live/txs/1ADD8331438A73BAD731A3888B365DE5F13C1EA53A0A4E77479847DB2283F879

Block height in which the transaction has been processed: https://shielded.live/blocks/48308 (epoch 111)

Fraccaman commented 5 days ago

I might have a lead, ill keep you posted here.

Fraccaman commented 4 days ago

this might be due to your validator not having a self-bond. Can you try adding a self-bond and voting?

McDaan commented 4 days ago

this might be due to your validator not having a self-bond. Can you try adding a self-bond and voting?

@Fraccaman Okay. I'm going to reproduce this.

I just self-bonded 100 NAM to my validator: https://shielded.live/txs/0C3BACD5A08C62AC1A559F1DF5B3781568FB4452EF2AFE8C26832D5DDCA2FBEE Block height in which the transaction has been processed: https://shielded.live/blocks/52658 (epoch 121)

I just created a new proposal with a voting period from epoch 122 to 125 (activation epoch is 128): https://shielded.live/txs/C5AA88EA42D64678149421F3B6F9BBA8189C9B643A93C2128CE88EF6F834A4A2 Block height in which the transaction has been processed: https://shielded.live/blocks/52674 (epoch 121)

I will vote on epoch 123 to ensure (121 + pipeline_length, i.e. 2 on Housefire v0.44.0) the 100 NAM tokens are effectively counted as part of the validator self-bonded amount: https://shielded.live/txs/C731B685550B47068DD5919840C2E2B24974BF960BE9077CBFDB35294B4D6EBD Block height in which the transaction has been processed: https://shielded.live/blocks/53670 (epoch 123)

Last committed epoch: 123
Self-bonds from tnam1qxshaapfleewqjgdrqsfkz8zmjkzum088qpl76cn:
  Remaining active bond from epoch 123: Δ 100.000000 (slashed 0.000000)
Active (slashable) bonds total: 100.000000
Bonds total: 100.000000

Withdrawable total: 0.000000

All bonds total active: 100.000000
All bonds total: 100.000000
[...]
namadac query-proposal-votes --proposal-id 5
Votes for proposal id 5

Voter: tnam1qxshaapfleewqjgdrqsfkz8zmjkzum088qpl76cn
Vote: yay
namadac query-proposal-result --proposal-id 5
Proposal Id: 5
    The voting period is underway and will continue until epoch 125 begins.
    NOTE: Validators can vote only until the end of epoch 123.
    Currently with 1056278.000000 yay votes, 0.000000 nay votes and 0.000000 abstain votes, total voting power: 2001396373.222226, threshold (fraction) of total voting power needed to tally: 667132124.406742 (0.333333333333)

We can now see that validator vote is counted/stored in the storage.