From 95e8262480e467a05cebef63e6de55cfdba39d96 Mon Sep 17 00:00:00 2001 From: Emanuel Pargov Date: Tue, 30 Jul 2024 19:06:49 +0300 Subject: [PATCH] Replace judgmentSignatureSize with Ed25519SignatureSize --- internal/block/dispute.go | 26 ++++++++++++-------------- internal/crypto/constants.go | 1 + 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/internal/block/dispute.go b/internal/block/dispute.go index 728e23bd..c47cedfe 100644 --- a/internal/block/dispute.go +++ b/internal/block/dispute.go @@ -1,9 +1,7 @@ package block -import "github.com/eigerco/strawberry/internal/crypto" - -const ( - judgmentSignatureSize = 64 // Size of Ed25519 signature +import ( + "github.com/eigerco/strawberry/internal/crypto" ) type DisputeExtrinsic struct { @@ -19,21 +17,21 @@ type Verdict struct { } type Culprit struct { - ReportHash crypto.Hash // H, hash of the work report - ValidatorEd25519PublicKey crypto.Ed25519PublicKey // He - Signature [judgmentSignatureSize]byte // E + ReportHash crypto.Hash // H, hash of the work report + ValidatorEd25519PublicKey crypto.Ed25519PublicKey // He + Signature [crypto.Ed25519SignatureSize]byte // E } type Fault struct { - ReportHash crypto.Hash // H, hash of the work report - IsValid bool // {⊺,⊥} - ValidatorEd25519PublicKey crypto.Ed25519PublicKey // He - Signature [judgmentSignatureSize]byte // E + ReportHash crypto.Hash // H, hash of the work report + IsValid bool // {⊺,⊥} + ValidatorEd25519PublicKey crypto.Ed25519PublicKey // He + Signature [crypto.Ed25519SignatureSize]byte // E } // Judgment represents a single judgment with a signature type Judgment struct { - IsValid bool // v: {⊺,⊥} - ValidatorIndex uint16 // i: NV - Signature [judgmentSignatureSize]byte // s: E + IsValid bool // v: {⊺,⊥} + ValidatorIndex uint16 // i: NV + Signature [crypto.Ed25519SignatureSize]byte // s: E } diff --git a/internal/crypto/constants.go b/internal/crypto/constants.go index c7469f09..520b0307 100644 --- a/internal/crypto/constants.go +++ b/internal/crypto/constants.go @@ -5,6 +5,7 @@ const ( BandersnatchSize = 32 Ed25519PublicSize = 32 Ed25519PrivateSize = 64 + Ed25519SignatureSize = 64 BLSSize = 144 BandersnatchRingSize = 144 MetadataSize = 128