From 7bbab6674de454e180139b6d8d250ba30fa0c434 Mon Sep 17 00:00:00 2001 From: eloylp Date: Thu, 27 Jul 2023 18:45:44 +0200 Subject: [PATCH] Ensure checked add --- contracts/voting/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contracts/voting/src/lib.rs b/contracts/voting/src/lib.rs index 6ba4851a..42a33cf6 100644 --- a/contracts/voting/src/lib.rs +++ b/contracts/voting/src/lib.rs @@ -156,7 +156,11 @@ impl ProposalVotingContract { id, Proposal { id, - voting_end_time: env.ledger().timestamp() + voting_period_secs, + voting_end_time: env + .ledger() + .timestamp() + .checked_add(voting_period_secs) + .unwrap(), target_approval_rate_bps, votes: 0, voters: Map::::new(&env),