Skip to content

Sanitize duplicate proofsΒ #1231

@InKryption

Description

@InKryption

pub fn serializeDuplicateProof(
allocator: std.mem.Allocator,
shred_payload: []const u8,
other_payload: []const u8,
) ![]const u8 {
// TODO validate the shreds. Implement check_shreds in Agave
// https://github.com/Syndica/sig/issues/1225
const proof = sig.ledger.meta.DuplicateSlotProof{
.shred1 = shred_payload,
.shred2 = other_payload,
};
var proof_data: std.ArrayListUnmanaged(u8) = .empty;
errdefer proof_data.deinit(allocator);
try bincode.write(proof_data.writer(allocator), proof, bincode.Params.standard);
const bytes = try proof_data.toOwnedSlice(allocator);
return bytes;
}

This was added in #1172, which was a revival of an older PR. The intentions behind the TODO aren't totally clear, but this is being noted for verification at some point in case it's relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions