truechain / truechain-engineering-code

Go implementation of TrueChain
GNU Lesser General Public License v3.0
100 stars 81 forks source link

Bad Fast Block - Snail block not on the chain #36

Open hyangl opened 5 years ago

hyangl commented 5 years ago

When committee propose a fast block having snail block reward, the node will check failed when the node's snail chain has forked more than 12 blocks than the committee node.

INFO [12-14|16:57:49.943] Peer connected success                   id=ab6fd208251c1033 conn=dyndial name=Getrue/v0.9.1-unstable-527329fb/linux-amd64/go1.10.4 RemoteAddr=192.144.143.96:30313
INFO [12-14|16:57:58.516] Finalize:                                header.SnailHash=2a6249…7cda38 header.SnailNumber=9160
ERROR[12-14|16:57:58.516] 
########## BAD FAST BLOCK #########
Chain config: {ChainID: 1 Engine: {MinimumDifficulty: 10000 MinimumFruitDifficulty: 100 DurationLimit: 60}}

Number: 580856
Hash: 0x07709b602e7b64af695e02d9e5c4db1c28d92aafb42ce1e9d435257e95fa8cad

Error: Snail block not on the chain
##############################

WARN [12-14|16:57:58.516] Synchronisation failed, dropping peer    peer=ab6fd208251c1033 err="fast retrieved hash chain is invalid"
INFO [12-14|16:57:58.516] drop peer fast Synchronise               id=ab6fd208251c1033
INFO [12-14|16:57:58.516] fastDownloader Synchronise exit          origin=580855 height=44
ERROR[12-14|16:57:58.516] fast sync:                               err>>>>>>>>>="fast retrieved hash chain is invalid"
hyangl commented 5 years ago

Can't sync new snail block to switch the right canonical block. Rewarding to snail block 9160, the snail block 9172 includes fruits 580779-580838, and new block 9173 includes fruit 580856, which verifies failed.

jiyilanzhou commented 5 years ago
INFO [12-28|17:32:10.226] Peer connected success                   id=f684c0103dee129e conn=dyndial name=Getrue/v0.9.5-unstable-823c5548/linux-amd64/go1.10.4 RemoteAddr=192.144.141.61:30313
INFO [12-28|17:32:10.631] pm_synchronise                           pTd=189049816 td=183692516 NumberU64=11234
INFO [12-28|17:32:13.966] pm_synchronise                           pTd=189049816 td=183692516 NumberU64=11234
INFO [12-28|17:32:13.966] pm_synchronise                           pTd=189049816 td=183692516 NumberU64=11234
INFO [12-28|17:32:13.967] Finalize:                                header.SnailHash=076687…b02b77 header.SnailNumber=11222
ERROR[12-28|17:32:13.967] 
########## BAD FAST BLOCK #########
Chain config: {ChainID: 1 Engine: {MinimumDifficulty: 10000 MinimumFruitDifficulty: 100 DurationLimit: 60}}

Number: 710211
Hash: 0xf82b4f200ac5c43530cb90123d4096f32d0c70d7e3d5bae56303f7d625fed94d

Error: Snail block not on the chain
##############################

INFO [12-28|17:32:13.967] Fast Downloaded item processing failed   number=710211 hash=f82b4f…fed94d err="Snail block not on the chain"
WARN [12-28|17:32:13.967] Synchronisation failed, dropping peer    peer=f684c0103dee129e err="fast retrieved hash chain is invalid"
INFO [12-28|17:32:13.967] drop peer fast Synchronise               id=f684c0103dee129e
INFO [12-28|17:32:13.967] Removing Truechain peer                  peer=f684c0103dee129e RemoteAddr=192.144.141.61:30313
INFO [12-28|17:32:13.991] fastDownloader Synchronise exit          origin=710210 height=55
ERROR[12-28|17:32:13.991] fast sync:                               err>>>>>>>>>="fast retrieved hash chain is invalid"
WARN [12-28|17:32:13.991] Synchronisation failed, retrying         err="no peers to keep download active"
INFO [12-28|17:32:13.991] Truechain message handling failed        id=f684c0103dee129e conn=dyndial RemoteAddr=192.144.141.61:30313  err=EOF
local    Fast   710210  Snail      11234
{
  beginFruitNumber: 709426,
  difficulty: 10000,
  endFruitNumber: 709485,
  extraData: "0xd78209058667657472756586676f312e3130856c696e7578",
  fastNumber: 0,
  fruitDifficulty: 100,
  fruitHash: "0xf3c335b3b515a6047562dd4aa87003107228af4956e09a504dee1b367b74da29",
  fruits: 60,
  hash: "0xa86f27840b5a034308a999de1b0d0673cbf93db7fbce57557472868b43084783",
  miner: "0x1074f7deccf8c66efcd0106e034d3356b7db3f2c",
  mixHash: "0x0005a7e65c464848bc99a14157ab7e5b13a8b06be9c2b478ec7d689b0b8aca61",
  nonce: "0x16b40ace45784bfa",
  number: 11222,
  parentHash: "0xe3b8d833c3fe4fcf9c9a9c6d77b892640b5786d67a5c191e24619b17143c13f1",
  pointerNumber: 11214,
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 58585,
  timestamp: 1545936838,
  uncles: []
}

remote Fast 731206 Snail 11581
etrue.getBlock(710211) { SnailHash: "0x07668702e7e58e37130ececc6f3c1b673c553f08d39156b4e954f830f3b02b77", SnailNumber: "11222", difficulty: 0, extraData: "0x", gasLimit: 4712388, gasUsed: 0, hash: "0xf82b4f200ac5c43530cb90123d4096f32d0c70d7e3d5bae56303f7d625fed94d", logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", number: 710211, parentHash: "0x1197afc40392f0d13688fa102ea8569fd1a24aef08c8a962daf876676028ab00", receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", signs: [{ fastHash: "0xf82b4f200ac5c43530cb90123d4096f32d0c70d7e3d5bae56303f7d625fed94d", fastHeight: "710211", result: 1, sign: "0xcc708e7818ca5dfca96a3317b97e48186880e735d9f236e5632ad1070af6973661c15e2e2cd11cbe2ac2dd8c2db6dfe21e14900b5619232746c26eb6e4cc925e00" }, { fastHash: "0xf82b4f200ac5c43530cb90123d4096f32d0c70d7e3d5bae56303f7d625fed94d", fastHeight: "710211", result: 1, sign: "0xd88a64e249f4f63439bcd3e388e490800310990f20cc094e26b85debfab1684134108864327217381f3a14896d981ef694db4638036195c74a114af32ca5750100" }, { fastHash: "0xf82b4f200ac5c43530cb90123d4096f32d0c70d7e3d5bae56303f7d625fed94d", fastHeight: "710211", result: 1, sign: "0x5c0ab1d2b7084766e21bea734fe75c6e3ea2b9cdbd28d2178a54a49a11ee48e925558f454827703d7716f992fa9a25427e3ac925358eaa1661938ca01b84454401" }], size: 794, stateRoot: "0xffaa02092cfcab2f8483dffad01afc6f61806ae22b8437f389b16497ad3f2efd", timestamp: 1545941421, transactions: [], transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" }

etrue.getSnail("0x07668702e7e58e37130ececc6f3c1b673c553f08d39156b4e954f830f3b02b77") { beginFruitNumber: 709426, difficulty: 10000, endFruitNumber: 709485, extraData: "0xd98209058667657472756588676f312e31302e34856c696e7578", fastNumber: 0, fruitDifficulty: 100, fruitHash: "0x253df46641c06afa1721590ab621c21d19ee26b2fcfb3e42a10f9470445f373f", fruits: 60, hash: "0x07668702e7e58e37130ececc6f3c1b673c553f08d39156b4e954f830f3b02b77", miner: "0x1074f7deccf8c66efcd0106e034d3356b7db3f2c", mixHash: "0x0005b43793de373428f0c4ef632e1f142c2631469efe56c24cd4a06c2ab8f96c", nonce: "0x43ddbf60fd49ff03", number: 11222, parentHash: "0xe3b8d833c3fe4fcf9c9a9c6d77b892640b5786d67a5c191e24619b17143c13f1", pointerNumber: 11214, sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", size: 58591, timestamp: 1545936836, uncles: [] } etrue.getFruit(710211) { difficulty: "0x2710", extraData: "0xd78209058667657472756586676f312e3130856c696e7578", fastHash: "0xf82b4f200ac5c43530cb90123d4096f32d0c70d7e3d5bae56303f7d625fed94d", fastNumber: 710211, fruitDifficulty: "0x64", hash: "0x7e362b607402228cfc4e94331c31513cbe8d188bac724d9081ff3e1dacafb3e3", miner: "0x7c357530174275dd30e46319b89f71186256e4f7", mixHash: "0x64b6e9b2dc74b24958695729bf0357200088c6665d676632c79ee511cae054b7", nonce: "0x2d1dacf779b5ee10", number: "11235", sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", signs: 3, size: "0x3c5", timestamp: "0x5c2531c4" } etrue.getSnail(11235) { beginFruitNumber: 710206, difficulty: 10000, endFruitNumber: 710265, extraData: "0xd98209058667657472756588676f312e31302e34856c696e7578", fastNumber: 0, fruitDifficulty: 100, fruitHash: "0xec44192d40e715252ef330a2301ccafce5e1e7e00f25cdded9e56cc68c0531c8", fruits: 60, hash: "0x435d47212e86fce6c3ecfa8428ba14194d3ea529db7e3347b06813813894a44c", miner: "0x1074f7deccf8c66efcd0106e034d3356b7db3f2c", mixHash: "0x00000bda76a96a828ceff37d001e16ca270ed0a6dd671a92df0cdc2578c0077c", nonce: "0x7edc43c939ee4604", number: 11235, parentHash: "0x488fb315d75a4d14551febe147f4855c00204302a70e02ed6942f55276e00473", pointerNumber: 11227, sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", size: 58581, timestamp: 1545941763, uncles: [] }