Documentation
¶
Index ¶
- type FileState
- func (fs *FileState) CheckHRS(height int64, round int, step Step) (bool, error)
- func (fs *FileState) CheckProposalsOnlyDifferByTimestamp(signBytes []byte) (time.Time, bool)
- func (fs *FileState) CheckVotesOnlyDifferByTimestamp(signBytes []byte) (time.Time, bool)
- func (fs *FileState) String() string
- func (fs *FileState) Update(height int64, round int, step Step, signBytes, signature []byte) error
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileState ¶
type FileState struct { Height int64 `json:"height" comment:"the height of the last sign"` Round int `json:"round" comment:"the round of the last sign"` Step Step `json:"step" comment:"the step of the last sign"` SignBytes []byte `json:"signbytes,omitempty" comment:"the raw signature bytes of the last sign"` Signature []byte `json:"signature,omitempty" comment:"the signature of the last sign"` // contains filtered or unexported fields }
FileState stores the state of the last signing operation in a file. NOTE: keep in sync with gno.land/cmd/gnoland/secrets.go NOTE: this was migrated from tm2/pkg/bft/privval/file.go
func GeneratePersistedFileState ¶
GeneratePersistedFileState generates a new FileState persisted to disk.
func LoadFileState ¶
LoadFileState reads a FileState from the given file path.
func LoadOrMakeFileState ¶
LoadOrMakeFileState returns a new FileState instance from the given file path. If the file does not exist, a new FileState is generated and persisted to disk.
func (*FileState) CheckHRS ¶
checkHRS checks the given height, round, step (HRS) against the last state. It returns an error if the arguments constitute a regression, or if HRS match but the SignBytes are not set. The returned boolean indicates whether the last Signature should be reused or not. It will be true if the HRS match and the SignBytes and Signature are already set in the last state (indicating we have already signed for this HRS).
func (*FileState) CheckProposalsOnlyDifferByTimestamp ¶
checkProposalsOnlyDifferByTimestamp returns the timestamp from the last state SignBytes and a boolean indicating if the only difference in the proposals is their timestamp.
func (*FileState) CheckVotesOnlyDifferByTimestamp ¶
checkVotesOnlyDifferByTimestamp returns the timestamp from the last state SignBytes and a boolean indicating if the only difference in the votes is their timestamp.
type Step ¶
type Step uint8
Step is the step in the consensus process.
func VoteTypeToStep ¶
func VoteTypeToStep(voteType types.SignedMsgType) Step
A vote type is either stepPrevote or stepPrecommit.