From 730db6878b94b1f901dfeeeb37f686bf5e5cff31 Mon Sep 17 00:00:00 2001 From: 0xJabberwock <0xjabberwock@defi.sucks> Date: Tue, 19 Nov 2024 02:59:10 -0300 Subject: [PATCH] test: property-id 1 --- .../handlers/HandlerEBORequestCreator.t.sol | 7 +++++++ ...ertyEbo.t.sol => PropertyEBORequestCreator.t.sol} | 12 +++++++----- test/invariants/properties/PropertyParent.t.sol | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) rename test/invariants/properties/{PropertyEbo.t.sol => PropertyEBORequestCreator.t.sol} (55%) diff --git a/test/invariants/handlers/HandlerEBORequestCreator.t.sol b/test/invariants/handlers/HandlerEBORequestCreator.t.sol index 2104da1..74780b5 100644 --- a/test/invariants/handlers/HandlerEBORequestCreator.t.sol +++ b/test/invariants/handlers/HandlerEBORequestCreator.t.sol @@ -25,6 +25,13 @@ contract HandlerEBORequestCreator is BaseHandler { // Get current request data IOracle.Request memory requestData = eboRequestCreator.getRequestData(); + // Build request module parameters + IEBORequestModule.RequestParameters memory requestParams = + abi.decode(requestData.requestModuleData, (IEBORequestModule.RequestParameters)); + requestParams.epoch = _epoch; + requestParams.chainId = chainId; + requestData.requestModuleData = abi.encode(requestParams); + // Calculate request ID using same logic as Oracle bytes32 requestId = keccak256(abi.encode(requestData)); diff --git a/test/invariants/properties/PropertyEbo.t.sol b/test/invariants/properties/PropertyEBORequestCreator.t.sol similarity index 55% rename from test/invariants/properties/PropertyEbo.t.sol rename to test/invariants/properties/PropertyEBORequestCreator.t.sol index 4c2df8b..d212864 100644 --- a/test/invariants/properties/PropertyEbo.t.sol +++ b/test/invariants/properties/PropertyEBORequestCreator.t.sol @@ -3,14 +3,16 @@ pragma solidity 0.8.26; import {HandlerParent} from '../handlers/HandlerParent.t.sol'; -contract PropertyEbo is HandlerParent { +contract PropertyEBORequestCreator is HandlerParent { //solhint-disable no-empty-blocks constructor() {} /// @custom:property-id 1 /// @custom:property Requester can always create a request as long as the same chainId/epoch isn't requested yet - // function property_canAlwaysCreateRequest(uint256 _epoch, uint256 _chainId) external { - // _epoch = _boundEpoch(_epoch); - // string memory _chainId = _generateChainId(_chainId); - // } + function property_canAlwaysCreateRequest(uint256 _epoch, uint256 _chainIdSeed) external { + try HandlerParent(this).handleCreateRequest(_epoch, _chainIdSeed) {} + catch { + assert(false); + } + } } diff --git a/test/invariants/properties/PropertyParent.t.sol b/test/invariants/properties/PropertyParent.t.sol index 5e6eeda..6d3c698 100644 --- a/test/invariants/properties/PropertyParent.t.sol +++ b/test/invariants/properties/PropertyParent.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.26; -import {PropertyEbo} from './PropertyEbo.t.sol'; +import {PropertyEBORequestCreator} from './PropertyEBORequestCreator.t.sol'; import {PropertySanityCheck} from './PropertySanityCheck.t.sol'; -contract PropertyParent is PropertyEbo, PropertySanityCheck { +contract PropertyParent is PropertyEBORequestCreator, PropertySanityCheck { //solhint-disable no-empty-blocks constructor() {} }