piplabs / story

Official repo for the Story L1 consensus client, contracts, and associated tooling.
GNU General Public License v3.0
39 stars 27 forks source link

devnet - validator isn't jailed after double sign #323

Closed jia57b closed 3 weeks ago

jia57b commented 1 month ago

Description and context

Tested on devnet (after singularity), validator isn't jailed after double sign

Steps to reproduce

  1. Create one validator using one running test node
  2. Run another test node by copying priv_validator_key.json from the above validator and different node_key.json
  3. Start the second test node

Experienced behavior

Both of the two nodes can produce blocks and the validator isn't jailed. image

Expected behavior

validator should be removed from active validator set and cannot unjail it.

jia57b commented 1 month ago

Tested again with story version v0.12.1-f20525a, after I wait some minutes (about 200 blocks) after the second node joined consensus, the validator node is in jail (so I couldn't see it being jailed last time, maybe because the waiting time was not enough), I tried to call unjail and it cannot unjail. But evidence in the api is empty, I'm not sure if it's expected. image (3)

jia57b commented 1 month ago

Tested in singularity, the validator isn't jailed and no find evidence of DuplicateVoteEvidence, after singularity (3000 height), the validator is jailed and cannot be unjailed.

Response of http://:26657/block?height=3005:

            "evidence": {
                "evidence": [
                    {
                        "type": "tendermint/DuplicateVoteEvidence",
                        "value": {
                            "vote_a": {
                                "type": 1,
                                "height": "3004",
                                "round": 0,
                                "block_id": {
                                    "hash": "32B37CB40D41FD65D7CF92353A81BCF512B712DA91411A2EA07CE1B19DEE0008",
                                    "parts": {
                                        "total": 1,
                                        "hash": "DBACBCE52CA66ED02137CD3D684A060EBB58DF67AC46F60B034302525451EF0D"
                                    }
                                },
                                "timestamp": "2024-11-01T12:54:18.327910945Z",
                                "validator_address": "7DF70B816E08B614AB7F6329AB76197ABF7F2548",
                                "validator_index": 0,
                                "signature": "lJZY9DPSaY7MCJVovIjMTqe//lwopzTVWUFGz6C8nE0O4ltGjpK2bvlr5orDXNvOtIqa5zWM1+vpLjTVUXQV9Q==",
                                "extension": null,
                                "extension_signature": null
                            },
                            "vote_b": {
                                "type": 1,
                                "height": "3004",
                                "round": 0,
                                "block_id": {
                                    "hash": "E8C831E627347F97534AC0B1B7536CCCAB1502CD61BABC40DEF0FF1141039DC5",
                                    "parts": {
                                        "total": 1,
                                        "hash": "C4E9AEFC24A05A810CBBFAD13C449A1DE522F480F42AD9AB8E8D6B35B9387FAB"
                                    }
                                },
                                "timestamp": "2024-11-01T12:54:18.386590247Z",
                                "validator_address": "7DF70B816E08B614AB7F6329AB76197ABF7F2548",
                                "validator_index": 0,
                                "signature": "X8oDglRfBeC1FI9bIlA2iS3kuDuHNHZ0QwRBMLDMOcBa05CeRu6Vl01he2lUiUrKoTnWV0i+sQlWc45upq5Gnw==",
                                "extension": null,
                                "extension_signature": null
                            },
                            "TotalVotingPower": "9000000",
                            "ValidatorPower": "5000000",
                            "Timestamp": "2024-11-01T12:54:16.548324932Z"
                        }
                    }
                ]
            },

http://:1317/staking/validators

{
        "operator_address": "storyvaloper10hmshqtwpzmpf2mlvv56kase02lh7f2g7p6j6y",
        "consensus_pubkey": {
          "type": "tendermint/PubKeySecp256k1",
          "value": "A4uHWIRA8zraUxBaFGyoDhJJCYi4OPz1w5j+lIc37gx1"
        },
        "jailed": true,
        "status": 1,
        "tokens": "4750000000000",
        "delegator_shares": "5000000000000.000000000000000000",
        "description": {
          "moniker": "non-validator-01-create"
        },
        "unbonding_height": "3005",
        "unbonding_time": "2024-11-01T12:54:28.556156678Z",
        "commission": {
          "commission_rates": {
            "rate": "0.100000000000000000",
            "max_rate": "0.500000000000000000",
            "max_change_rate": "0.010000000000000000"
          },
          "update_time": "2024-11-01T11:19:35.205488297Z"
        },
        "min_self_delegation": "1024",
        "unbonding_ids": [
          "1"
        ],
        "rewards_tokens": "2375000000000.000000000000000000",
        "delegator_rewards_shares": "2500000000000.000000000000000000"
      },
jia57b commented 3 weeks ago

Tested mininet with story version: v0.12.2-unstable-e6d2d51

Test 1:

  1. Reset mininet
  2. Start a test node A and createValidator
  3. Start a test node B with the same priv_validator_key.json from the above validator and different node_key.json
  4. Wait singularity (600)
  5. Before singularity height, no evidence of DuplicateVoteEvidence on the validator, after singularity height (at 605 height), the validator is jailed and also query evidence of DuplicateVoteEvidence on the validator, cannot unjail it

Test 2:

  1. Reset mininet
  2. Wait singularity (600)
  3. Start a test node A and createValidator
  4. Start a test node B with the same priv_validator_key.json from the above validator and different node_key.json
  5. At 748 height after node B started generating blocks, the validator is jailed and also query evidence of DuplicateVoteEvidence on the validator, cannot unjail it
0xHansLee commented 3 weeks ago

@jia57b Thanks for your testing! We also need to test double signing in the singularity with the same key of genesis validator.

jia57b commented 3 weeks ago

Tested double signing on the genesis validator in the singularity:

  1. Reset mininet
  2. Start a test node with the same priv_validator_key.json with genesis validator 4 and different node_key.json
  3. The validator4 gets evidence of DuplicateVoteEvidence at height 49 and 51, it's not jailed
  4. After singularity, the valdiator 4 isn't jailed
  5. Restart story and geth process on validator 4, it's still not jailed

validator4 logs:

Nov 05 03:09:54 ip-172-31-10-69.us-west-1.compute.internal cosmovisor[1522874]: 24-11-05 03:09:54.941 ERRO found conflicting vote from ourselves; did you unsafe_reset a validator? module=consensus height=50 round=0 type=SIGNED_MSG_TYPE_PREVOTE
Nov 05 03:09:54 ip-172-31-10-69.us-west-1.compute.internal cosmovisor[1522874]: 24-11-05 03:09:54.941 ERRO failed to process message                module=consensus height=50 round=0 peer=d86e7d2995f3cfde015c51eed474166fa76ab7b6 msg_type=*consensus.VoteMessage err="conflicting votes from validator EAEDE127412F3122AB3D905B5796591B196AB703"

validator4 API:

"evidence": [
                    {
                        "type": "tendermint/DuplicateVoteEvidence",
                        "value": {
                            "vote_a": {
                                "type": 1,
                                "height": "48",
                                "round": 0,
                                "block_id": {
                                    "hash": "1698C9A53F5B882FF8F2514DC8EE648404E87DCC562EA647946E9F67A0415818",
                                    "parts": {
                                        "total": 1,
                                        "hash": "167063A58EA9DB50EA69E92EE2FCE72EF6496B6017B1EAE5DF31479D9CBA2507"
                                    }
                                },
                                "timestamp": "2024-11-05T03:09:50.848782433Z",
                                "validator_address": "EAEDE127412F3122AB3D905B5796591B196AB703",
                                "validator_index": 3,
                                "signature": "Y1CzqPe2kPYDsl1tHmoUrPiMy85k/qDBEiul4vUFhSlh7DYZxssUYbfW2hQGLPZrbewh7Z0I75L4Fo9baMytBQ==",
                                "extension": null,
                                "extension_signature": null
                            },
                            "vote_b": {
                                "type": 1,
                                "height": "48",
                                "round": 0,
                                "block_id": {
                                    "hash": "3C12750B191299E93335BD927E92CDD020084D5B1063C55721112D00B82EB2F1",
                                    "parts": {
                                        "total": 1,
                                        "hash": "AD06B9D1F17EEB86095377CE64EA42E5EF56014B6D630F8FB3DD4E36422E81DD"
                                    }
                                },
                                "timestamp": "2024-11-05T03:09:50.871611979Z",
                                "validator_address": "EAEDE127412F3122AB3D905B5796591B196AB703",
                                "validator_index": 3,
                                "signature": "7qeBPqNixohq+0fiP1/Z3eYHP3XKVVk6K9oYS4fuB2cKEgMj8NEqcXbAtepnqH9iHGu3o9mFbWxvKrhXN0vRfA==",
                                "extension": null,
                                "extension_signature": null
                            },
                            "TotalVotingPower": "4000000",
                            "ValidatorPower": "1000000",
                            "Timestamp": "2024-11-05T03:09:49.121613003Z"
                        }
                    }
                ]

test node logs:

24-11-05 03:09:54.807 ERRO prevote step: consensus deems this block invalid; prevoting nil module=consensus height=50 round=0 err="wrong Block.Header.AppHash.  Expected E897607598962F9929E88CDCB5BD03AB505F36218B1FD99C839C9CEAFD8C5885, got 1C874E2361FBCAB5D65547BF4150A8ABDD4C34139B2186CCA418F0008E2C30D0"
24-11-05 03:09:54.922 ERRO found conflicting vote from ourselves; did you unsafe_reset a validator? module=consensus height=50 round=0 type=SIGNED_MSG_TYPE_PREVOTE
24-11-05 03:09:54.922 ERRO failed to process message                module=consensus height=50 round=0 peer=0d132ae896ae4d2823ed143bfcce9edc572a5fa3 msg_type=*consensus.VoteMessage err="conflicting votes from validator EAEDE127412F3122AB3D905B5796591B196AB703"
24-11-05 03:09:54.925 ERRO CONSENSUS FAILURE!!!                     module=consensus err="precommit step; +2/3 prevoted for an invalid block: wrong Block.Header.AppHash.  Expected E897607598962F9929E88CDCB5BD03AB505F36218B1FD99C839C9CEAFD8C5885, got 1C874E2361FBCAB5D65547BF4150A8ABDD4C34139B2186CCA418F0008E2C30D0"

test node API:

"evidence": [
                    {
                        "type": "tendermint/DuplicateVoteEvidence",
                        "value": {
                            "vote_a": {
                                "type": 1,
                                "height": "48",
                                "round": 0,
                                "block_id": {
                                    "hash": "1698C9A53F5B882FF8F2514DC8EE648404E87DCC562EA647946E9F67A0415818",
                                    "parts": {
                                        "total": 1,
                                        "hash": "167063A58EA9DB50EA69E92EE2FCE72EF6496B6017B1EAE5DF31479D9CBA2507"
                                    }
                                },
                                "timestamp": "2024-11-05T03:09:50.848782433Z",
                                "validator_address": "EAEDE127412F3122AB3D905B5796591B196AB703",
                                "validator_index": 3,
                                "signature": "Y1CzqPe2kPYDsl1tHmoUrPiMy85k/qDBEiul4vUFhSlh7DYZxssUYbfW2hQGLPZrbewh7Z0I75L4Fo9baMytBQ==",
                                "extension": null,
                                "extension_signature": null
                            },
                            "vote_b": {
                                "type": 1,
                                "height": "48",
                                "round": 0,
                                "block_id": {
                                    "hash": "3C12750B191299E93335BD927E92CDD020084D5B1063C55721112D00B82EB2F1",
                                    "parts": {
                                        "total": 1,
                                        "hash": "AD06B9D1F17EEB86095377CE64EA42E5EF56014B6D630F8FB3DD4E36422E81DD"
                                    }
                                },
                                "timestamp": "2024-11-05T03:09:50.871611979Z",
                                "validator_address": "EAEDE127412F3122AB3D905B5796591B196AB703",
                                "validator_index": 3,
                                "signature": "7qeBPqNixohq+0fiP1/Z3eYHP3XKVVk6K9oYS4fuB2cKEgMj8NEqcXbAtepnqH9iHGu3o9mFbWxvKrhXN0vRfA==",
                                "extension": null,
                                "extension_signature": null
                            },
                            "TotalVotingPower": "4000000",
                            "ValidatorPower": "1000000",
                            "Timestamp": "2024-11-05T03:09:49.121613003Z"
                        }
                    }
                ]

Attach logs after restart validator04. val04.log