From 1cef7013b54c84ee48c3b4321559ef8c4f1f238c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Volpe?= Date: Thu, 19 Sep 2024 18:27:02 +0200 Subject: [PATCH] fix migrations --- .../test-sol/precompiles/EpochSizePrecompile.sol | 12 ++++++++---- .../test-sol/unit/common/EpochManagerEnabler.t.sol | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/protocol/test-sol/precompiles/EpochSizePrecompile.sol b/packages/protocol/test-sol/precompiles/EpochSizePrecompile.sol index 22081fda236..cdab89b4674 100644 --- a/packages/protocol/test-sol/precompiles/EpochSizePrecompile.sol +++ b/packages/protocol/test-sol/precompiles/EpochSizePrecompile.sol @@ -1,21 +1,25 @@ -// TODO move this to test folder pragma solidity >=0.8.7 <0.8.20; address constant EPOCH_SIZEPRE_COMPILE_ADDRESS = address(0xff - 7); - contract EpochSizePrecompile { address constant ADDRESS = EPOCH_SIZEPRE_COMPILE_ADDRESS; - uint256 public EPOCH_SIZE = 100; + uint256 public constant EPOCH_SIZE = 100; + uint256 public epochSizeSet; receive() external payable {} fallback(bytes calldata) external payable returns (bytes memory) { + // this is required because when the migrations deploy the precompiles + // they don't get constructed + if (epochSizeSet != 0) { + return abi.encodePacked(epochSizeSet); + } return abi.encodePacked(EPOCH_SIZE); } function setEpochSize(uint256 epochSize) public { - EPOCH_SIZE = epochSize; + epochSizeSet = epochSize; } function getAddress() public pure returns (address) { diff --git a/packages/protocol/test-sol/unit/common/EpochManagerEnabler.t.sol b/packages/protocol/test-sol/unit/common/EpochManagerEnabler.t.sol index 0a4d2968fbd..b4273fb6c09 100644 --- a/packages/protocol/test-sol/unit/common/EpochManagerEnabler.t.sol +++ b/packages/protocol/test-sol/unit/common/EpochManagerEnabler.t.sol @@ -2,11 +2,8 @@ pragma solidity >=0.8.7 <0.8.20; import "celo-foundry-8/Test.sol"; - import "@celo-contracts-8/common/EpochManagerEnabler.sol"; - import "@celo-contracts/stability/test/MockSortedOracles.sol"; - import "@celo-contracts/common/interfaces/IRegistry.sol"; import { EPOCH_SIZEPRE_COMPILE_ADDRESS, EpochSizePrecompile } from "@test-sol/precompiles/EpochSizePrecompile.sol";