diff options
Diffstat (limited to 'crypto/compactcert/structs.go')
-rw-r--r-- | crypto/compactcert/structs.go | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/crypto/compactcert/structs.go b/crypto/compactcert/structs.go index c0e333868..1e02e4eaf 100644 --- a/crypto/compactcert/structs.go +++ b/crypto/compactcert/structs.go @@ -30,34 +30,6 @@ type Params struct { SecKQ uint64 // Security parameter (k+q) from analysis document } -// A Participant corresponds to an account whose AccountData.Status -// is Online, and for which the expected sigRound satisfies -// AccountData.VoteFirstValid <= sigRound <= AccountData.VoteLastValid. -// -// In the Algorand ledger, it is possible for multiple accounts to have -// the same PK. Thus, the PK is not necessarily unique among Participants. -// However, each account will produce a unique Participant struct, to avoid -// potential DoS attacks where one account claims to have the same VoteID PK -// as another account. -type Participant struct { - _struct struct{} `codec:",omitempty,omitemptyarray"` - - // PK is AccountData.VoteID. - PK crypto.OneTimeSignatureVerifier `codec:"p"` - - // Weight is AccountData.MicroAlgos. - Weight uint64 `codec:"w"` - - // KeyDilution is AccountData.KeyDilution() with the protocol for sigRound - // as expected by the Builder. - KeyDilution uint64 `codec:"d"` -} - -// ToBeHashed implements the crypto.Hashable interface. -func (p Participant) ToBeHashed() (protocol.HashID, []byte) { - return protocol.CompactCertPart, protocol.Encode(&p) -} - // CompactOneTimeSignature is crypto.OneTimeSignature with omitempty type CompactOneTimeSignature struct { _struct struct{} `codec:",omitempty,omitemptyarray"` @@ -87,15 +59,13 @@ func (ssc sigslotCommit) ToBeHashed() (protocol.HashID, []byte) { type Reveal struct { _struct struct{} `codec:",omitempty,omitemptyarray"` - SigSlot sigslotCommit `codec:"s"` - Part Participant `codec:"p"` + SigSlot sigslotCommit `codec:"s"` + Part basics.Participant `codec:"p"` } -// MaxReveals is a bound on allocation and on numReveals to limit log computation -const MaxReveals = 1024 - -// MaxProofDigests is a bound on allocation on number of proofs -const MaxProofDigests = 20 * MaxReveals +// maxReveals is a bound on allocation and on numReveals to limit log computation +const maxReveals = 1024 +const maxProofDigests = 20 * maxReveals // Cert represents a compact certificate. type Cert struct { @@ -103,13 +73,13 @@ type Cert struct { SigCommit crypto.Digest `codec:"c"` SignedWeight uint64 `codec:"w"` - SigProofs []crypto.Digest `codec:"S,allocbound=MaxProofDigests"` - PartProofs []crypto.Digest `codec:"P,allocbound=MaxProofDigests"` + SigProofs []crypto.Digest `codec:"S,allocbound=maxProofDigests"` + PartProofs []crypto.Digest `codec:"P,allocbound=maxProofDigests"` // Reveals is a sparse map from the position being revealed // to the corresponding elements from the sigs and participants // arrays. - Reveals map[uint64]Reveal `codec:"r,allocbound=MaxReveals"` + Reveals map[uint64]Reveal `codec:"r,allocbound=maxReveals"` } // SortUint64 implements sorting by uint64 keys for |