From 2aa2c7d133b4dd034cc90f729ee8d5640cc8bc35 Mon Sep 17 00:00:00 2001 From: Reinis Martinsons <77973553+Reinis-FRP@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:56:31 +0300 Subject: [PATCH] M-03 [Oval] Newest Prices May Be Reported Ignoring the lockWindow() Constraint (#17) Signed-off-by: Reinis Martinsons --- src/controllers/ImmutableController.sol | 3 +++ src/controllers/MutableUnlockersController.sol | 3 +++ src/factories/BaseFactory.sol | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/controllers/ImmutableController.sol b/src/controllers/ImmutableController.sol index 0b48665..a42bbd7 100644 --- a/src/controllers/ImmutableController.sol +++ b/src/controllers/ImmutableController.sol @@ -18,6 +18,9 @@ abstract contract ImmutableController is Oval { mapping(address => bool) public unlockers; constructor(uint256 _lockWindow, uint256 _maxTraversal, address[] memory _unlockers, uint256 _maxAge) { + require(_maxAge > _lockWindow, "Max age not above lock window"); + require(_maxTraversal > 0, "Max traversal must be > 0"); + LOCK_WINDOW = _lockWindow; MAX_TRAVERSAL = _maxTraversal; MAX_AGE = _maxAge; diff --git a/src/controllers/MutableUnlockersController.sol b/src/controllers/MutableUnlockersController.sol index a7acf13..c9ea029 100644 --- a/src/controllers/MutableUnlockersController.sol +++ b/src/controllers/MutableUnlockersController.sol @@ -16,6 +16,9 @@ abstract contract MutableUnlockersController is Ownable, Oval { mapping(address => bool) public unlockers; constructor(uint256 _lockWindow, uint256 _maxTraversal, address[] memory _unlockers, uint256 _maxAge) { + require(_maxAge > _lockWindow, "Max age not above lock window"); + require(_maxTraversal > 0, "Max traversal must be > 0"); + LOCK_WINDOW = _lockWindow; MAX_TRAVERSAL = _maxTraversal; MAX_AGE = _maxAge; diff --git a/src/factories/BaseFactory.sol b/src/factories/BaseFactory.sol index f4fcd8c..a97b33b 100644 --- a/src/factories/BaseFactory.sol +++ b/src/factories/BaseFactory.sol @@ -24,6 +24,8 @@ contract BaseFactory is Ownable { ); constructor(uint256 _maxTraversal, address[] memory _defaultUnlockers) { + require(_maxTraversal > 0, "Max traversal must be > 0"); + MAX_TRAVERSAL = _maxTraversal; setDefaultUnlockers(_defaultUnlockers); }