FindoraNetwork / platform

Official Implementation of Findora Network.
https://findora.org
Other
73 stars 29 forks source link

Fix the situation that the field `pubkey_sign_map` in the transaction structure will be out of order #877

Closed malefooo closed 1 year ago

malefooo commented 1 year ago

New transaction structure body v1 version, the data structure of the field pubkey_sign_map is changed from HashMap to BtreeMap

pub struct TransactionV1 {
    pub body: TransactionBody,
    pub signatures: Vec<SignatureOf<TransactionBody>>,
    pub pubkey_sign_map: BTreeMap<XfrPublicKey, SignatureOf<TransactionBody>>,
}

The logic of the fix is as follows

  1. create a new checkpoint fix_tx_sign_map_disorder
  2. update txn_merkle when update_state, and use TransactionV1 to replace the previous data structure to generate the hash when the checkpoint is reached
  3. when updating txns_in_block_hash, when the checkpoint is reached, use the list constructed by TransactionV1 to generate the hash instead of the previous data structure list
jimmysun0815 commented 1 year ago

Can one of the admins verify this patch?

malefooo commented 1 year ago

Can one of the admins verify this patch?

@jimmysun0815 Still need to test many times, so the pr is still draft pr, the current local debug test is not reproduced, the follow-up I should do a long test of the main network synchronization