* uses enum for shred type Current code is using u8 which does not have any type-safety and can contain invalid values: https://github.com/solana-labs/solana/blob/66fa062f1/ledger/src/shred.rs#L167 Checks for invalid shred-types are scattered through the code: https://github.com/solana-labs/solana/blob/66fa062f1/ledger/src/blockstore.rs#L849-L851 https://github.com/solana-labs/solana/blob/66fa062f1/ledger/src/shred.rs#L346-L348 The commit uses enum for shred type with #[repr(u8)]. Backward compatibility is maintained by implementing Serialize and Deserialize compatible with u8, and adding a test to assert that. (cherry picked from commit57057f8d39
) # Conflicts: # core/src/retransmit_stage.rs # gossip/src/cluster_info.rs # ledger/Cargo.toml # ledger/src/blockstore.rs # ledger/src/shred.rs * changes Blockstore::is_shred_duplicate arg type to ShredType (cherry picked from commit48dfdfb4d5
) # Conflicts: # ledger/src/blockstore.rs * removes backport merge conflicts Co-authored-by: behzad nouri <behzadnouri@gmail.com>