EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.29k stars 3.6k forks source link

[Hard Fork occurs] in a 11-node local private chain with 3 malicious nodes #11063

Open renardbebe opened 2 years ago

renardbebe commented 2 years ago

Environment:

EOS: 2.1.0 Ubuntu: 20.04 Compiler: llvm-7 clang-7 clang++-7 llvm-cov-7


Local Private Chain Information:

I have built a local private EOS chain with 11 nodes, where 10 nodes (named bp.a ~ bp.j) are producers and 1 node (named eosio) is non-producer. Within 10 producers, bp.d, bp.g and bp.j are malicious nodes which will send packages containing random or illegal information, and others are normal nodes.

I have set the producer order with the following command:

set_bp_cmd_str='{
    "schedule":[
      { 
        "producer_name": "bp.a", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.b", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.c", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.d", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.e", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.f", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.g", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.h", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.i", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      },
      { 
        "producer_name": "bp.j", 
        "authority": [ 
          "block_signing_authority_v0", { 
            "threshold": 1, 
            "keys": [{ 
              "key": "EOS6drrb7foGaaqrHRSYYhGdEcFsk3CaCpnEJbYKj3RN7ePkscYvC", 
              "weight": 1
            }]
          }
        ]
      }
    ]
  }'
cleos push action eosio setprods "$set_bp_cmd_str" -p eosio

Phenomenon and Logs:

After running for 5 minutes, I checked the log information of each node. I found a hard fork happens: three honest nodes are separated from the mainnet. The last received block index of 7 nodes (bp.a, bp.b, bp.c, bp.d, bp.e, bp.g, bp.j) are 1289. However, the last received block index of bp.f, bp.h, bp.i and eosio are 799, 1277, 491, 183. Obviously, bp.f, bp.i and eosio failed to reach a consensus with the main network.

According to the principle of aBFT, in a network of 10 nodes, no more than 3 malicious nodes can be tolerated, and other honest nodes should be able to operate normally and reach consensus.

The complete log infomation can be found in the attachment: bp.a.log bp.f.log bp.h.log bp.i.log eosio.log

Hope to get a reply soon! Thanks a lot!