Skip to content

Commit

Permalink
add the greek letters in State and remove json tags
Browse files Browse the repository at this point in the history
  • Loading branch information
pantrif committed Jul 30, 2024
1 parent 417ee97 commit de709c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
18 changes: 9 additions & 9 deletions internal/safrole/safrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ type TicketsMark [time.TimeslotsPerEpoch]block.Ticket
type CustomErrorCode int

type Safrole struct {
Input Input `json:"input"`
PreState State `json:"pre_state"`
Output OutputOrError `json:"output"`
PostState State `json:"post_state"`
Input Input
PreState State
Output OutputOrError
PostState State
}

type Input struct {
Slot uint32 `json:"slot"` // Current slot.
Entropy crypto.Hash `json:"entropy"` // Per block entropy (originated from block entropy source VRF).
Extrinsic []block.TicketProof `json:"extrinsic"` // Safrole extrinsic.
Slot uint32 // Current slot.
Entropy crypto.Hash // Per block entropy (originated from block entropy source VRF).
Extrinsic []block.TicketProof // Safrole extrinsic.
}

// TicketsOrKeys is enum
Expand Down Expand Up @@ -87,8 +87,8 @@ type OutputOrErrorValues interface {
}

type OutputMarks struct {
EpochMark *block.EpochMarker `json:"epoch_mark"`
TicketsMark *TicketsMark `json:"tickets_mark"`
EpochMark *block.EpochMarker
TicketsMark *TicketsMark
}

func setOutputOrError[Value OutputOrErrorValues](oe *OutputOrError, value Value) {
Expand Down
26 changes: 13 additions & 13 deletions internal/safrole/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (

// State relevant to Safrole protocol
type State struct {
MostRecentTimeslot uint32 `json:"tau"` // Most recent block's timeslot.
EntropyAccumulator [4]crypto.Hash `json:"eta"` // Entropy accumulator and epochal randomness.
PreviousValidators ValidatorsData `json:"lambda"` // Validator keys and metadata which were active in the prior epoch.
CurrentValidators ValidatorsData `json:"kappa"` // Validator keys and metadata currently active.
NextValidators ValidatorsData `json:"gamma_k"` // Validator keys for the following epoch.
FutureValidators ValidatorsData `json:"iota"` // Validator keys and metadata to be drawn from next.
TicketAccumulator []block.Ticket `json:"gamma_a"` // Sealing-key contest ticket accumulator.
SealingKeySeries TicketsOrKeys `json:"gamma_s"` // Sealing-key series of the current epoch.
RingCommitment crypto.RingCommitment `json:"gamma_z"` // Bandersnatch ring commitment.
MostRecentTimeslot uint32 // (τ) Most recent block's timeslot.
EntropyAccumulator [4]crypto.Hash // (η) Entropy accumulator and epochal randomness.
PreviousValidators ValidatorsData // (λ) Validator keys and metadata which were active in the prior epoch.
CurrentValidators ValidatorsData // (κ) Validator keys and metadata currently active.
NextValidators ValidatorsData // (γk) Validator keys for the following epoch.
FutureValidators ValidatorsData // (ι) Validator keys and metadata to be drawn from next.
TicketAccumulator []block.Ticket // (γa) Sealing-key contest ticket accumulator.
SealingKeySeries TicketsOrKeys // (γs) Sealing-key series of the current epoch.
RingCommitment crypto.RingCommitment // (γz) Bandersnatch ring commitment.
}

type ValidatorData struct {
Bandersnatch crypto.BandersnatchKey `json:"bandersnatch"`
Ed25519 crypto.Ed25519PublicKey `json:"ed25519"`
Bls crypto.BlsKey `json:"bls"`
Metadata crypto.MetadataKey `json:"metadata"`
Bandersnatch crypto.BandersnatchKey
Ed25519 crypto.Ed25519PublicKey
Bls crypto.BlsKey
Metadata crypto.MetadataKey
}
type ValidatorsData [block.NumberOfValidators]ValidatorData

0 comments on commit de709c7

Please sign in to comment.