Skip to content

Refactor various witness types #218

@roynalnaruto

Description

@roynalnaruto

There are now several witness types for backwards compatibility. For eg this, this, this, this, this.

This calls for a refactoring to make those types easier to reason about.

We could define a single enum type (one each for chunk, batch and so on) such that:

#[non_exhaustive]
pub enum BackwardsCompatibleChunkWitness {
    /// Currently the `LegacyChunkWitness`.
    V5(ChunkWitnessV5),
    /// To be chunk witness from v6.
    V6(ChunkWitnessV6),
}

impl BackwardsCompatibleChunkWitness {
    /// serialize
    pub fn serialize(&self) -> Vec<u8> { /* */ }
}

And then implement:

impl ChunkWitness {
    /// Into an older version witness.
    pub fn to_legacy(&self, version: Version) -> BackwardsCompatibleChunkWitness { /* * / }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions