From 0ac8a40a8e06df723689351a714d0458c613c317 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Tue, 17 Sep 2024 14:29:51 +0200 Subject: [PATCH] fix: eliminate non-determinism of floating point --- x/gov/types/v1/params.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 115b29be..6692fed2 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -170,14 +170,14 @@ func (p Params) ValidateBasic() error { if p.QuorumTimeout.Seconds() < 0 { return fmt.Errorf("quorum timeout must be 0 or greater: %s", p.QuorumTimeout) } - if p.QuorumTimeout.Seconds() >= p.VotingPeriod.Seconds() { + if p.QuorumTimeout.Nanoseconds() >= p.VotingPeriod.Nanoseconds() { return fmt.Errorf("quorum timeout %s must be strictly less than the voting period %s", p.QuorumTimeout, p.VotingPeriod) } if p.MaxVotingPeriodExtension == nil { return fmt.Errorf("max voting period extension must not be nil: %d", p.MaxVotingPeriodExtension) } - if p.MaxVotingPeriodExtension.Seconds() < p.VotingPeriod.Seconds()-p.QuorumTimeout.Seconds() { + if p.MaxVotingPeriodExtension.Nanoseconds() < p.VotingPeriod.Nanoseconds()-p.QuorumTimeout.Nanoseconds() { return fmt.Errorf("max voting period extension %s must be greater than or equal to the difference between the voting period %s and the quorum timeout %s", p.MaxVotingPeriodExtension, p.VotingPeriod, p.QuorumTimeout) } }