DMDcoin / alpha4

Alpha 4 Testnetwork
0 stars 0 forks source link

Invalid pub key #4

Closed SurfingNerd closed 1 day ago

SurfingNerd commented 3 days ago

On a reset of Alpha4, we went into a scenario where the public treshold key could not get produced.

An Idea how this could happen is that specific key gen transactions were included from a specific fork.

latest block: 451180
timestamp: Tue, 29 Oct 2024 09:13:35 GMT
gas limit: 300000000
maxValidators: 25
keyGenHistoryContract: 0x7000000000000000000000000000000000000001
stakingContract: 0x1100000000000000000000000000000000000001
randomContract: 0x3000000000000000000000000000000000000001
blockRewardContract: 0x2000000000000000000000000000000000000001
validatorInactivityThreshold 31536000
KeyGenHistory address:  0x7000000000000000000000000000000000000001
keyGenRound: 1
minGasPrice:  800000000
blockGasLimit:  100000000
epoch start time UTC: Tue, 29 Oct 2024 09:13:35 GMT
next Phase Transition UTC: Tue, 29 Oct 2024 10:03:35 GMT
Epoch End Time: UTC: Tue, 29 Oct 2024 10:13:34 GMT
pending validators: []
current validators: [
  '0xbc911502C259c5644C9F7220A57A9435548Ba0F9',
  '0x42aa1E9e0C4521e1a48fb70b6DD16B89B6030CE7',
  '0xd75819Fa48f16cde2E8726Afd116264c50B8C3fA',
  '0x13c8CAFb584F9041A777799a5f8770D8e6cEfbAC',
  '0xD1D2F2B720e9aAC66437c88650E0219D1c573525',
  '0x462D5107FE7aBd7ac88DA088eC0168a4b0601002',
  '0xb58b7537f454e6F92bD756e87E94867380029683'
]
Key state:
0xbc911502C259c5644C9F7220A57A9435548Ba0F9(hbbft4) partByteLength: 1887 acks: 7
0x42aa1E9e0C4521e1a48fb70b6DD16B89B6030CE7(hbbft9) partByteLength: 1887 acks: 7
0xd75819Fa48f16cde2E8726Afd116264c50B8C3fA(hbbft8) partByteLength: 1887 acks: 7
0x13c8CAFb584F9041A777799a5f8770D8e6cEfbAC(hbbft6) partByteLength: 1887 acks: 7
0xD1D2F2B720e9aAC66437c88650E0219D1c573525(hbbft7) partByteLength: 1887 acks: 7
0x462D5107FE7aBd7ac88DA088eC0168a4b0601002(hbbft11) partByteLength: 1887 acks: 7
0xb58b7537f454e6F92bD756e87E94867380029683(hbbft3) partByteLength: 1887 acks: 7
likehilihood: Result {
  '0': [
    '10000000000000000000000',
    '10000050544566394484430',
    '10201191948535359627145',
    '10000347366984135190021',
    '10100350407500577356008',
    '10000338483854099842248',
    '11007342342242426329408',
    '10000350145949112381156'
  ],
  '1': '81309971239632105210416',
  likelihoods: [
    '10000000000000000000000',
    '10000050544566394484430',
    '10201191948535359627145',
    '10000347366984135190021',
    '10100350407500577356008',
    '10000338483854099842248',
    '11007342342242426329408',
    '10000350145949112381156'
  ],
  sum: '81309971239632105210416'
}
validator candidate 0xCd8EF415AfE6f05afaC642DaEf39A7fed2468ce5 (node address:0x28176D6DF28B558AD18b487d8742464522FC0685(hbbft12)) IP: 144.126.144.43:54012 available since: 1730193019 Tue, 29 Oct 2024 09:10:19 GMT
validator candidate 0xa7e06C3add8cDFC452AA98f686329FC0DD7B89D7 (node address:0x462D5107FE7aBd7ac88DA088eC0168a4b0601002(hbbft11)) IP: 194.163.160.191:54011 available since: 1730193010 Tue, 29 Oct 2024 09:10:10 GMT
validator candidate 0x6af9B952740923581c8C5A5D128EB12197f425eD (node address:0xb58b7537f454e6F92bD756e87E94867380029683(hbbft3)) IP: 167.86.88.83:54003 available since: 1729691327 Wed, 23 Oct 2024 13:48:47 GMT
validator candidate 0xbC81e4c79447F73022B02203b14a526f64B821E0 (node address:0xbc911502C259c5644C9F7220A57A9435548Ba0F9(hbbft4)) IP: 167.86.89.30:54004 available since: 1730192954 Tue, 29 Oct 2024 09:09:14 GMT
validator candidate 0x0Ac8fD9844E9C8043D5e3535ac9C8461B80a01cE (node address:0xD1D2F2B720e9aAC66437c88650E0219D1c573525(hbbft7)) IP: 38.242.206.150:54007 available since: 1730192960 Tue, 29 Oct 2024 09:09:20 GMT
validator candidate 0x1bc4e0508473A9840A40Ad424B792097f70967Ee (node address:0x13c8CAFb584F9041A777799a5f8770D8e6cEfbAC(hbbft6)) IP: 38.242.206.146:54006 available since: 1730192960 Tue, 29 Oct 2024 09:09:20 GMT
validator candidate 0xc0F323f6E9a3438F4752e640E6fb3e994807df38 (node address:0x42aa1E9e0C4521e1a48fb70b6DD16B89B6030CE7(hbbft9)) IP: 194.163.160.187:54009 available since: 1730192963 Tue, 29 Oct 2024 09:09:23 GMT
validator candidate 0x118Fe581C8c3628C4077f6459919E92D95756E8d (node address:0xd75819Fa48f16cde2E8726Afd116264c50B8C3fA(hbbft8)) IP: 194.163.160.185:54008 available since: 1730192963 Tue, 29 Oct 2024 09:09:23 GMT
timeframeLength:  600
connectivityTrackerAddress: 0x1200000000000000000000000000000000000001
early epoch treshold:  0
connectivity tracker: isEarlyEpochEnd false
is Early Epoch end:  true
flagged validators: 0
validator: 0xbc911502C259c5644C9F7220A57A9435548Ba0F9 score: 0
validator: 0x42aa1E9e0C4521e1a48fb70b6DD16B89B6030CE7 score: 0
validator: 0xd75819Fa48f16cde2E8726Afd116264c50B8C3fA score: 0
validator: 0x13c8CAFb584F9041A777799a5f8770D8e6cEfbAC score: 0
validator: 0xD1D2F2B720e9aAC66437c88650E0219D1c573525 score: 0
validator: 0x462D5107FE7aBd7ac88DA088eC0168a4b0601002 score: 0
validator: 0xb58b7537f454e6F92bD756e87E94867380029683 score: 0
faultyValidatorsCount: 0
minReportAgeBlocks: 10

example log output:

2024-10-29 10:13:01  Verifier #0 TRACE engine  is_pending_validator: true
2024-10-29 10:13:01  Verifier #0 ERROR engine  connect_to_validator_core: no port specified for Node ( Public (NodeId): 04..10 , staking address: 0xaf67…1237, socket_addr: 0.0.0.0:0
2024-10-29 10:13:01  Verifier #0 WARN Engine  could not add pending validator to reserved peers: 0x7591…41f0
2024-10-29 10:13:01  Verifier #0 DEBUG engine  added to additional 1 reserved peers, because they are pending validators.
2024-10-29 10:13:01  Verifier #0 TRACE engine   get_validator_pubkeys...
2024-10-29 10:13:01  Verifier #0 WARN engine  engine_signer_to_synckeygen error Encrypt("invalid public key")
2024-10-29 10:13:01  Verifier #0 ERROR engine  Error sending keygen transactions ReturnValueInvalid
2024-10-29 10:13:01  Verifier #0 TRACE consensus  calling reward function for block 451169 isEpochEnd? false on address: 0x2000…0001 (latest block: 451168
2024-10-29 10:13:01  Verifier #0 INFO import  Imported #451169 0x5e1e…d2ad (0 txs, 0.00 Mgas, 18 ms, 0.59 KiB)
2024-10-29 10:13:03  Worker Client3 INFO import   27/27 peers   2 MiB chain 0 bytes queue  RPC:  0 conn,    0 req/s,    0 µs
2024-10-29 10:13:04  Verifier #3 TRACE engine  is_pending_validator: true
2024-10-29 10:13:04  Verifier #3 ERROR engine  connect_to_validator_core: no port specified for Node ( Public (NodeId): 04..10 , staking address: 0xaf67…1237, socket_addr: 0.0.0.0:0
2024-10-29 10:13:04  Verifier #3 WARN Engine  could not add pending validator to reserved peers: 0x7591…41f0
2024-10-29 10:13:04  Verifier #3 DEBUG engine  added to additional 1 reserved peers, because they are pending validators.
2024-10-29 10:13:04  Verifier #3 TRACE engine   get_validator_pubkeys...
2024-10-29 10:13:04  Verifier #3 WARN engine  engine_signer_to_synckeygen error Encrypt("invalid public key")
2024-10-29 10:13:04  Verifier #3 ERROR engine  Error sending keygen transactions ReturnValueInvalid
2024-10-29 10:13:04  Verifier #3 TRACE consensus  calling reward function for block 451170 isEpochEnd? false on address: 0x2000…0001 (latest block: 451169
2024-10-29 10:13:04  Verifier #3 INFO import  Imported #451170 0x161b…74c8 (0 txs, 0.00 Mgas, 20 ms, 0.59 KiB)
2024-10-29 10:13:07  Verifier #1 TRACE engine  is_pending_validator: true
2024-10-29 10:13:07  Verifier #1 ERROR engine  connect_to_validator_core: no port specified for Node ( Public (NodeId): 04..10 , staking address: 0xaf67…1237, socket_addr: 0.0.0.0:0
2024-10-29 10:13:07  Verifier #1 WARN Engine  could not add pending validator to reserved peers: 0x7591…41f0
2024-10-29 10:13:07  Verifier #1 DEBUG engine  added to additional 1 reserved peers, because they are pending validators.
2024-10-29 10:13:07  Verifier #1 TRACE engine   get_validator_pubkeys...
2024-10-29 10:13:07  Verifier #1 WARN engine  engine_signer_to_synckeygen error Encrypt("invalid public key")
2024-10-29 10:13:07  Verifier #1 ERROR engine  Error sending keygen transactions ReturnValueInvalid
2024-10-29 10:13:07  Verifier #1 TRACE consensus  calling reward function for block 451171 isEpochEnd? false on address: 0x2000…0001 (latest block: 451170
2024-10-29 10:13:07  Verifier #1 INFO import  Imported #451171 0xd9f8…7889 (0 txs, 0.00 Mgas, 24 ms, 0.59 KiB)
SurfingNerd commented 3 days ago

even if validators write malicious public keys, as time passes by, the network goes into a new key generation round - so it automaticaly recovers.

SurfingNerd commented 2 days ago

it was not triggered by keys from a fork., see https://github.com/DMDcoin/alpha4/issues/5 for details

SurfingNerd commented 1 day ago

with fix https://github.com/DMDcoin/diamond-node/pull/133 validators are now detecting their public keys, and will send (invalid) parts - so they can progress further into the next key gen round, while kicking out the faulty validator.