From 0bc8707b6722b5fc08cb50d6d3fb5cbb4c98c497 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Mon, 5 May 2025 19:31:00 +0530 Subject: [PATCH 1/7] feat: separate socket folder --- contracts/{protocol => evmx}/AddressResolver.sol | 0 contracts/{protocol => evmx}/AsyncPromise.sol | 0 contracts/{protocol => evmx}/Forwarder.sol | 0 contracts/{protocol => evmx}/payload-delivery/AuctionManager.sol | 0 .../{protocol => evmx}/payload-delivery/ContractFactoryPlug.sol | 0 contracts/{protocol => evmx}/payload-delivery/FeesManager.sol | 0 contracts/{protocol => evmx}/payload-delivery/FeesPlug.sol | 0 .../payload-delivery/app-gateway/DeliveryHelper.sol | 0 .../payload-delivery/app-gateway/DeliveryHelperStorage.sol | 0 .../payload-delivery/app-gateway/DeliveryUtils.sol | 0 .../payload-delivery/app-gateway/FeesHelpers.sol | 0 .../payload-delivery/app-gateway/RequestQueue.sol | 0 contracts/{protocol => evmx}/utils/AccessControl.sol | 0 contracts/{protocol => evmx}/utils/AddressResolverUtil.sol | 0 contracts/{protocol => evmx}/utils/Gauge.sol | 0 contracts/{protocol => evmx}/utils/RescueFundsLib.sol | 0 contracts/{protocol => evmx}/utils/common/AccessRoles.sol | 0 contracts/{protocol => evmx}/utils/common/Constants.sol | 0 contracts/{protocol => evmx}/utils/common/Errors.sol | 0 contracts/{protocol => evmx}/utils/common/Structs.sol | 0 .../{protocol => evmx}/watcherPrecompile/PayloadHeaderDecoder.sol | 0 .../watcherPrecompile/WatcherPrecompileConfig.sol | 0 .../watcherPrecompile/WatcherPrecompileLimits.sol | 0 .../{protocol => evmx}/watcherPrecompile/core/RequestHandler.sol | 0 .../{protocol => evmx}/watcherPrecompile/core/WatcherIdUtils.sol | 0 .../watcherPrecompile/core/WatcherPrecompile.sol | 0 .../watcherPrecompile/core/WatcherPrecompileCore.sol | 0 .../watcherPrecompile/core/WatcherPrecompileStorage.sol | 0 contracts/{protocol => }/socket/Socket.sol | 0 contracts/{protocol => }/socket/SocketBatcher.sol | 0 contracts/{protocol => }/socket/SocketConfig.sol | 0 contracts/{protocol => }/socket/SocketFeeManager.sol | 0 contracts/{protocol => }/socket/SocketUtils.sol | 0 contracts/{protocol => }/socket/switchboard/FastSwitchboard.sol | 0 contracts/{protocol => }/socket/switchboard/SwitchboardBase.sol | 0 35 files changed, 0 insertions(+), 0 deletions(-) rename contracts/{protocol => evmx}/AddressResolver.sol (100%) rename contracts/{protocol => evmx}/AsyncPromise.sol (100%) rename contracts/{protocol => evmx}/Forwarder.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/AuctionManager.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/ContractFactoryPlug.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/FeesManager.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/FeesPlug.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/app-gateway/DeliveryHelper.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/app-gateway/DeliveryHelperStorage.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/app-gateway/DeliveryUtils.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/app-gateway/FeesHelpers.sol (100%) rename contracts/{protocol => evmx}/payload-delivery/app-gateway/RequestQueue.sol (100%) rename contracts/{protocol => evmx}/utils/AccessControl.sol (100%) rename contracts/{protocol => evmx}/utils/AddressResolverUtil.sol (100%) rename contracts/{protocol => evmx}/utils/Gauge.sol (100%) rename contracts/{protocol => evmx}/utils/RescueFundsLib.sol (100%) rename contracts/{protocol => evmx}/utils/common/AccessRoles.sol (100%) rename contracts/{protocol => evmx}/utils/common/Constants.sol (100%) rename contracts/{protocol => evmx}/utils/common/Errors.sol (100%) rename contracts/{protocol => evmx}/utils/common/Structs.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/PayloadHeaderDecoder.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/WatcherPrecompileConfig.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/WatcherPrecompileLimits.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/core/RequestHandler.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/core/WatcherIdUtils.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/core/WatcherPrecompile.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/core/WatcherPrecompileCore.sol (100%) rename contracts/{protocol => evmx}/watcherPrecompile/core/WatcherPrecompileStorage.sol (100%) rename contracts/{protocol => }/socket/Socket.sol (100%) rename contracts/{protocol => }/socket/SocketBatcher.sol (100%) rename contracts/{protocol => }/socket/SocketConfig.sol (100%) rename contracts/{protocol => }/socket/SocketFeeManager.sol (100%) rename contracts/{protocol => }/socket/SocketUtils.sol (100%) rename contracts/{protocol => }/socket/switchboard/FastSwitchboard.sol (100%) rename contracts/{protocol => }/socket/switchboard/SwitchboardBase.sol (100%) diff --git a/contracts/protocol/AddressResolver.sol b/contracts/evmx/AddressResolver.sol similarity index 100% rename from contracts/protocol/AddressResolver.sol rename to contracts/evmx/AddressResolver.sol diff --git a/contracts/protocol/AsyncPromise.sol b/contracts/evmx/AsyncPromise.sol similarity index 100% rename from contracts/protocol/AsyncPromise.sol rename to contracts/evmx/AsyncPromise.sol diff --git a/contracts/protocol/Forwarder.sol b/contracts/evmx/Forwarder.sol similarity index 100% rename from contracts/protocol/Forwarder.sol rename to contracts/evmx/Forwarder.sol diff --git a/contracts/protocol/payload-delivery/AuctionManager.sol b/contracts/evmx/payload-delivery/AuctionManager.sol similarity index 100% rename from contracts/protocol/payload-delivery/AuctionManager.sol rename to contracts/evmx/payload-delivery/AuctionManager.sol diff --git a/contracts/protocol/payload-delivery/ContractFactoryPlug.sol b/contracts/evmx/payload-delivery/ContractFactoryPlug.sol similarity index 100% rename from contracts/protocol/payload-delivery/ContractFactoryPlug.sol rename to contracts/evmx/payload-delivery/ContractFactoryPlug.sol diff --git a/contracts/protocol/payload-delivery/FeesManager.sol b/contracts/evmx/payload-delivery/FeesManager.sol similarity index 100% rename from contracts/protocol/payload-delivery/FeesManager.sol rename to contracts/evmx/payload-delivery/FeesManager.sol diff --git a/contracts/protocol/payload-delivery/FeesPlug.sol b/contracts/evmx/payload-delivery/FeesPlug.sol similarity index 100% rename from contracts/protocol/payload-delivery/FeesPlug.sol rename to contracts/evmx/payload-delivery/FeesPlug.sol diff --git a/contracts/protocol/payload-delivery/app-gateway/DeliveryHelper.sol b/contracts/evmx/payload-delivery/app-gateway/DeliveryHelper.sol similarity index 100% rename from contracts/protocol/payload-delivery/app-gateway/DeliveryHelper.sol rename to contracts/evmx/payload-delivery/app-gateway/DeliveryHelper.sol diff --git a/contracts/protocol/payload-delivery/app-gateway/DeliveryHelperStorage.sol b/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol similarity index 100% rename from contracts/protocol/payload-delivery/app-gateway/DeliveryHelperStorage.sol rename to contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol diff --git a/contracts/protocol/payload-delivery/app-gateway/DeliveryUtils.sol b/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol similarity index 100% rename from contracts/protocol/payload-delivery/app-gateway/DeliveryUtils.sol rename to contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol diff --git a/contracts/protocol/payload-delivery/app-gateway/FeesHelpers.sol b/contracts/evmx/payload-delivery/app-gateway/FeesHelpers.sol similarity index 100% rename from contracts/protocol/payload-delivery/app-gateway/FeesHelpers.sol rename to contracts/evmx/payload-delivery/app-gateway/FeesHelpers.sol diff --git a/contracts/protocol/payload-delivery/app-gateway/RequestQueue.sol b/contracts/evmx/payload-delivery/app-gateway/RequestQueue.sol similarity index 100% rename from contracts/protocol/payload-delivery/app-gateway/RequestQueue.sol rename to contracts/evmx/payload-delivery/app-gateway/RequestQueue.sol diff --git a/contracts/protocol/utils/AccessControl.sol b/contracts/evmx/utils/AccessControl.sol similarity index 100% rename from contracts/protocol/utils/AccessControl.sol rename to contracts/evmx/utils/AccessControl.sol diff --git a/contracts/protocol/utils/AddressResolverUtil.sol b/contracts/evmx/utils/AddressResolverUtil.sol similarity index 100% rename from contracts/protocol/utils/AddressResolverUtil.sol rename to contracts/evmx/utils/AddressResolverUtil.sol diff --git a/contracts/protocol/utils/Gauge.sol b/contracts/evmx/utils/Gauge.sol similarity index 100% rename from contracts/protocol/utils/Gauge.sol rename to contracts/evmx/utils/Gauge.sol diff --git a/contracts/protocol/utils/RescueFundsLib.sol b/contracts/evmx/utils/RescueFundsLib.sol similarity index 100% rename from contracts/protocol/utils/RescueFundsLib.sol rename to contracts/evmx/utils/RescueFundsLib.sol diff --git a/contracts/protocol/utils/common/AccessRoles.sol b/contracts/evmx/utils/common/AccessRoles.sol similarity index 100% rename from contracts/protocol/utils/common/AccessRoles.sol rename to contracts/evmx/utils/common/AccessRoles.sol diff --git a/contracts/protocol/utils/common/Constants.sol b/contracts/evmx/utils/common/Constants.sol similarity index 100% rename from contracts/protocol/utils/common/Constants.sol rename to contracts/evmx/utils/common/Constants.sol diff --git a/contracts/protocol/utils/common/Errors.sol b/contracts/evmx/utils/common/Errors.sol similarity index 100% rename from contracts/protocol/utils/common/Errors.sol rename to contracts/evmx/utils/common/Errors.sol diff --git a/contracts/protocol/utils/common/Structs.sol b/contracts/evmx/utils/common/Structs.sol similarity index 100% rename from contracts/protocol/utils/common/Structs.sol rename to contracts/evmx/utils/common/Structs.sol diff --git a/contracts/protocol/watcherPrecompile/PayloadHeaderDecoder.sol b/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/PayloadHeaderDecoder.sol rename to contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol diff --git a/contracts/protocol/watcherPrecompile/WatcherPrecompileConfig.sol b/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/WatcherPrecompileConfig.sol rename to contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol diff --git a/contracts/protocol/watcherPrecompile/WatcherPrecompileLimits.sol b/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/WatcherPrecompileLimits.sol rename to contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol diff --git a/contracts/protocol/watcherPrecompile/core/RequestHandler.sol b/contracts/evmx/watcherPrecompile/core/RequestHandler.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/core/RequestHandler.sol rename to contracts/evmx/watcherPrecompile/core/RequestHandler.sol diff --git a/contracts/protocol/watcherPrecompile/core/WatcherIdUtils.sol b/contracts/evmx/watcherPrecompile/core/WatcherIdUtils.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/core/WatcherIdUtils.sol rename to contracts/evmx/watcherPrecompile/core/WatcherIdUtils.sol diff --git a/contracts/protocol/watcherPrecompile/core/WatcherPrecompile.sol b/contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/core/WatcherPrecompile.sol rename to contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol diff --git a/contracts/protocol/watcherPrecompile/core/WatcherPrecompileCore.sol b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/core/WatcherPrecompileCore.sol rename to contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol diff --git a/contracts/protocol/watcherPrecompile/core/WatcherPrecompileStorage.sol b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol similarity index 100% rename from contracts/protocol/watcherPrecompile/core/WatcherPrecompileStorage.sol rename to contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol diff --git a/contracts/protocol/socket/Socket.sol b/contracts/socket/Socket.sol similarity index 100% rename from contracts/protocol/socket/Socket.sol rename to contracts/socket/Socket.sol diff --git a/contracts/protocol/socket/SocketBatcher.sol b/contracts/socket/SocketBatcher.sol similarity index 100% rename from contracts/protocol/socket/SocketBatcher.sol rename to contracts/socket/SocketBatcher.sol diff --git a/contracts/protocol/socket/SocketConfig.sol b/contracts/socket/SocketConfig.sol similarity index 100% rename from contracts/protocol/socket/SocketConfig.sol rename to contracts/socket/SocketConfig.sol diff --git a/contracts/protocol/socket/SocketFeeManager.sol b/contracts/socket/SocketFeeManager.sol similarity index 100% rename from contracts/protocol/socket/SocketFeeManager.sol rename to contracts/socket/SocketFeeManager.sol diff --git a/contracts/protocol/socket/SocketUtils.sol b/contracts/socket/SocketUtils.sol similarity index 100% rename from contracts/protocol/socket/SocketUtils.sol rename to contracts/socket/SocketUtils.sol diff --git a/contracts/protocol/socket/switchboard/FastSwitchboard.sol b/contracts/socket/switchboard/FastSwitchboard.sol similarity index 100% rename from contracts/protocol/socket/switchboard/FastSwitchboard.sol rename to contracts/socket/switchboard/FastSwitchboard.sol diff --git a/contracts/protocol/socket/switchboard/SwitchboardBase.sol b/contracts/socket/switchboard/SwitchboardBase.sol similarity index 100% rename from contracts/protocol/socket/switchboard/SwitchboardBase.sol rename to contracts/socket/switchboard/SwitchboardBase.sol From 04139f019087c8fbfbf2224996abe572392d20b5 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Mon, 5 May 2025 19:33:04 +0530 Subject: [PATCH 2/7] feat: moved utils --- contracts/socket/SocketBatcher.sol | 2 +- contracts/socket/SocketConfig.sol | 8 ++++---- contracts/socket/SocketFeeManager.sol | 4 ++-- contracts/{evmx => }/utils/AccessControl.sol | 0 contracts/{evmx => }/utils/AddressResolverUtil.sol | 0 contracts/{evmx => }/utils/Gauge.sol | 0 contracts/{evmx => }/utils/RescueFundsLib.sol | 0 contracts/{evmx => }/utils/common/AccessRoles.sol | 0 contracts/{evmx => }/utils/common/Constants.sol | 0 contracts/{evmx => }/utils/common/Errors.sol | 0 contracts/{evmx => }/utils/common/Structs.sol | 0 11 files changed, 7 insertions(+), 7 deletions(-) rename contracts/{evmx => }/utils/AccessControl.sol (100%) rename contracts/{evmx => }/utils/AddressResolverUtil.sol (100%) rename contracts/{evmx => }/utils/Gauge.sol (100%) rename contracts/{evmx => }/utils/RescueFundsLib.sol (100%) rename contracts/{evmx => }/utils/common/AccessRoles.sol (100%) rename contracts/{evmx => }/utils/common/Constants.sol (100%) rename contracts/{evmx => }/utils/common/Errors.sol (100%) rename contracts/{evmx => }/utils/common/Structs.sol (100%) diff --git a/contracts/socket/SocketBatcher.sol b/contracts/socket/SocketBatcher.sol index d996a722..3f1e1589 100644 --- a/contracts/socket/SocketBatcher.sol +++ b/contracts/socket/SocketBatcher.sol @@ -5,7 +5,7 @@ import "solady/auth/Ownable.sol"; import "../../interfaces/ISocket.sol"; import "../../interfaces/ISwitchboard.sol"; import "../utils/RescueFundsLib.sol"; -import {ExecuteParams, TransmissionParams} from "../../protocol/utils/common/Structs.sol"; +import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; import "../../interfaces/ISocketBatcher.sol"; /** diff --git a/contracts/socket/SocketConfig.sol b/contracts/socket/SocketConfig.sol index 96aebd12..68287aea 100644 --- a/contracts/socket/SocketConfig.sol +++ b/contracts/socket/SocketConfig.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../../interfaces/ISocket.sol"; -import "../../interfaces/ISwitchboard.sol"; -import {IPlug} from "../../interfaces/IPlug.sol"; +import "../interfaces/ISocket.sol"; +import "../interfaces/ISwitchboard.sol"; +import {IPlug} from "../interfaces/IPlug.sol"; import "../utils/AccessControl.sol"; import {GOVERNANCE_ROLE, RESCUE_ROLE, SWITCHBOARD_DISABLER_ROLE} from "../utils/common/AccessRoles.sol"; import {CallType, PlugConfig, SwitchboardStatus, ExecutionStatus} from "../utils/common/Structs.sol"; import {PlugNotFound, InvalidAppGateway, InvalidTransmitter} from "../utils/common/Errors.sol"; -import "../../interfaces/ISocketFeeManager.sol"; +import "../interfaces/ISocketFeeManager.sol"; import {MAX_COPY_BYTES} from "../utils/common/Constants.sol"; /** diff --git a/contracts/socket/SocketFeeManager.sol b/contracts/socket/SocketFeeManager.sol index 1bfb66f4..1625a532 100644 --- a/contracts/socket/SocketFeeManager.sol +++ b/contracts/socket/SocketFeeManager.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.21; import "../utils/AccessControl.sol"; import {GOVERNANCE_ROLE, RESCUE_ROLE} from "../utils/common/AccessRoles.sol"; -import {ExecuteParams, TransmissionParams} from "../../protocol/utils/common/Structs.sol"; -import "../../interfaces/ISocketFeeManager.sol"; +import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; +import "../interfaces/ISocketFeeManager.sol"; import "../utils/RescueFundsLib.sol"; /** diff --git a/contracts/evmx/utils/AccessControl.sol b/contracts/utils/AccessControl.sol similarity index 100% rename from contracts/evmx/utils/AccessControl.sol rename to contracts/utils/AccessControl.sol diff --git a/contracts/evmx/utils/AddressResolverUtil.sol b/contracts/utils/AddressResolverUtil.sol similarity index 100% rename from contracts/evmx/utils/AddressResolverUtil.sol rename to contracts/utils/AddressResolverUtil.sol diff --git a/contracts/evmx/utils/Gauge.sol b/contracts/utils/Gauge.sol similarity index 100% rename from contracts/evmx/utils/Gauge.sol rename to contracts/utils/Gauge.sol diff --git a/contracts/evmx/utils/RescueFundsLib.sol b/contracts/utils/RescueFundsLib.sol similarity index 100% rename from contracts/evmx/utils/RescueFundsLib.sol rename to contracts/utils/RescueFundsLib.sol diff --git a/contracts/evmx/utils/common/AccessRoles.sol b/contracts/utils/common/AccessRoles.sol similarity index 100% rename from contracts/evmx/utils/common/AccessRoles.sol rename to contracts/utils/common/AccessRoles.sol diff --git a/contracts/evmx/utils/common/Constants.sol b/contracts/utils/common/Constants.sol similarity index 100% rename from contracts/evmx/utils/common/Constants.sol rename to contracts/utils/common/Constants.sol diff --git a/contracts/evmx/utils/common/Errors.sol b/contracts/utils/common/Errors.sol similarity index 100% rename from contracts/evmx/utils/common/Errors.sol rename to contracts/utils/common/Errors.sol diff --git a/contracts/evmx/utils/common/Structs.sol b/contracts/utils/common/Structs.sol similarity index 100% rename from contracts/evmx/utils/common/Structs.sol rename to contracts/utils/common/Structs.sol From fb422044d315b1c2cccff4f6e969e7c51154ee04 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Mon, 5 May 2025 19:48:47 +0530 Subject: [PATCH 3/7] fix: move helper --- contracts/{utils => evmx}/AddressResolverUtil.sol | 0 contracts/{base => helpers}/ProxyFactory.sol | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename contracts/{utils => evmx}/AddressResolverUtil.sol (100%) rename contracts/{base => helpers}/ProxyFactory.sol (100%) diff --git a/contracts/utils/AddressResolverUtil.sol b/contracts/evmx/AddressResolverUtil.sol similarity index 100% rename from contracts/utils/AddressResolverUtil.sol rename to contracts/evmx/AddressResolverUtil.sol diff --git a/contracts/base/ProxyFactory.sol b/contracts/helpers/ProxyFactory.sol similarity index 100% rename from contracts/base/ProxyFactory.sol rename to contracts/helpers/ProxyFactory.sol From 13efb18ec73f6ad0bfd42a5b17b22de51f0a4fd4 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Mon, 5 May 2025 19:48:55 +0530 Subject: [PATCH 4/7] rm: gauge --- contracts/utils/Gauge.sol | 47 --------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 contracts/utils/Gauge.sol diff --git a/contracts/utils/Gauge.sol b/contracts/utils/Gauge.sol deleted file mode 100644 index fa2aba78..00000000 --- a/contracts/utils/Gauge.sol +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.21; -import {LimitParams} from "../utils/common/Structs.sol"; -import {LimitReached} from "../utils/common/Errors.sol"; - -abstract contract Gauge { - // slot 0-49: gap for future storage variables - uint256[50] _gap_gauge; - - function _getCurrentLimit(LimitParams storage params_) internal view returns (uint256 _limit) { - uint256 timeElapsed = block.timestamp - params_.lastUpdateTimestamp; - uint256 limitIncrease = timeElapsed * params_.ratePerSecond; - - if (limitIncrease + params_.lastUpdateLimit > params_.maxLimit) { - _limit = params_.maxLimit; - } else { - _limit = limitIncrease + params_.lastUpdateLimit; - } - } - - function _consumePartLimit( - uint256 amount_, - LimitParams storage params_ - ) internal returns (uint256 consumedAmount, uint256 pendingAmount) { - uint256 currentLimit = _getCurrentLimit(params_); - params_.lastUpdateTimestamp = block.timestamp; - if (currentLimit >= amount_) { - params_.lastUpdateLimit = currentLimit - amount_; - consumedAmount = amount_; - pendingAmount = 0; - } else { - params_.lastUpdateLimit = 0; - consumedAmount = currentLimit; - pendingAmount = amount_ - currentLimit; - } - } - - function _consumeFullLimit(uint256 amount_, LimitParams storage params_) internal { - uint256 currentLimit = _getCurrentLimit(params_); - if (currentLimit >= amount_) { - params_.lastUpdateTimestamp = block.timestamp; - params_.lastUpdateLimit = currentLimit - amount_; - } else { - revert LimitReached(); - } - } -} From fb1bacd50924c17e2d35273936d1f09d9e383367 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Mon, 5 May 2025 21:16:21 +0530 Subject: [PATCH 5/7] fix: move interfaces and helpers --- contracts/{ => evmx}/base/AppGatewayBase.sol | 0 contracts/{ => evmx}/helpers/ProxyFactory.sol | 0 contracts/{ => evmx}/helpers/TestUSDC.sol | 0 .../interfaces/IAddressResolver.sol | 0 .../{ => evmx}/interfaces/IAppGateway.sol | 2 +- .../{ => evmx}/interfaces/IAuctionManager.sol | 2 +- .../interfaces/IContractFactoryPlug.sol | 2 +- .../{ => evmx}/interfaces/IFeesManager.sol | 2 +- contracts/{ => evmx}/interfaces/IFeesPlug.sol | 0 .../{ => evmx}/interfaces/IForwarder.sol | 0 .../{ => evmx}/interfaces/IMiddleware.sol | 2 +- contracts/{ => evmx}/interfaces/IPromise.sol | 0 .../interfaces/IWatcherPrecompile.sol | 2 +- .../interfaces/IWatcherPrecompileConfig.sol | 15 +++++++- .../interfaces/IWatcherPrecompileLimits.sol | 2 +- .../evmx/payload-delivery/AuctionManager.sol | 8 ++--- contracts/evmx/payload-delivery/FeesPlug.sol | 10 +++--- .../app-gateway/DeliveryHelperStorage.sol | 4 +-- .../app-gateway/DeliveryUtils.sol | 2 +- .../PayloadHeaderDecoder.sol | 2 +- .../WatcherPrecompileConfig.sol | 4 +-- .../WatcherPrecompileLimits.sol | 6 ++-- .../core/WatcherPrecompileCore.sol | 2 +- .../core/WatcherPrecompileStorage.sol | 6 ++-- contracts/socket/SocketBatcher.sol | 6 ++-- contracts/{ => socket}/base/PlugBase.sol | 0 contracts/{ => socket}/interfaces/IPlug.sol | 0 contracts/{ => socket}/interfaces/ISocket.sol | 2 +- .../interfaces/ISocketBatcher.sol | 2 +- .../interfaces/ISocketFeeManager.sol | 2 +- .../{ => socket}/interfaces/ISwitchboard.sol | 0 .../socket/switchboard/SwitchboardBase.sol | 4 +-- script/admin/RescueFunds.s.sol | 2 +- script/admin/UpdateAppEVMxLimits.s.sol | 6 ++-- script/counter/DeployEVMxCounterApp.s.sol | 2 +- script/counter/DeployOnchainCounters.s.sol | 2 +- script/counter/SetFees.s.sol | 2 +- .../WithdrawFeesArbitrumFeesPlug.s.sol | 4 +-- script/helpers/AppGatewayFeeBalance.s.sol | 4 +-- script/helpers/CheckAppEVMxLimits.s.sol | 6 ++-- script/helpers/PayFeesInArbitrumETH.s.sol | 4 +-- .../helpers/PayFeesInArbitrumTestUSDC.s.sol | 4 +-- test/DeliveryHelper.t.sol | 8 ++--- test/Migration.t.sol | 12 +++---- test/SetupTest.t.sol | 34 +++++++++---------- test/SocketFeeManager.t.sol | 6 ++-- test/apps/SuperToken.t.sol | 2 +- test/mock/MockSocket.sol | 2 +- test/mock/MockWatcherPrecompile.sol | 6 ++-- test/mock/MockWatcherPrecompileImpl.sol | 2 +- 50 files changed, 105 insertions(+), 92 deletions(-) rename contracts/{ => evmx}/base/AppGatewayBase.sol (100%) rename contracts/{ => evmx}/helpers/ProxyFactory.sol (100%) rename contracts/{ => evmx}/helpers/TestUSDC.sol (100%) rename contracts/{ => evmx}/interfaces/IAddressResolver.sol (100%) rename contracts/{ => evmx}/interfaces/IAppGateway.sol (96%) rename contracts/{ => evmx}/interfaces/IAuctionManager.sol (92%) rename contracts/{ => evmx}/interfaces/IContractFactoryPlug.sol (94%) rename contracts/{ => evmx}/interfaces/IFeesManager.sol (96%) rename contracts/{ => evmx}/interfaces/IFeesPlug.sol (100%) rename contracts/{ => evmx}/interfaces/IForwarder.sol (100%) rename contracts/{ => evmx}/interfaces/IMiddleware.sol (98%) rename contracts/{ => evmx}/interfaces/IPromise.sol (100%) rename contracts/{ => evmx}/interfaces/IWatcherPrecompile.sol (99%) rename contracts/{ => evmx}/interfaces/IWatcherPrecompileConfig.sol (78%) rename contracts/{ => evmx}/interfaces/IWatcherPrecompileLimits.sol (97%) rename contracts/{ => socket}/base/PlugBase.sol (100%) rename contracts/{ => socket}/interfaces/IPlug.sol (100%) rename contracts/{ => socket}/interfaces/ISocket.sol (96%) rename contracts/{ => socket}/interfaces/ISocketBatcher.sol (92%) rename contracts/{ => socket}/interfaces/ISocketFeeManager.sol (91%) rename contracts/{ => socket}/interfaces/ISwitchboard.sol (100%) diff --git a/contracts/base/AppGatewayBase.sol b/contracts/evmx/base/AppGatewayBase.sol similarity index 100% rename from contracts/base/AppGatewayBase.sol rename to contracts/evmx/base/AppGatewayBase.sol diff --git a/contracts/helpers/ProxyFactory.sol b/contracts/evmx/helpers/ProxyFactory.sol similarity index 100% rename from contracts/helpers/ProxyFactory.sol rename to contracts/evmx/helpers/ProxyFactory.sol diff --git a/contracts/helpers/TestUSDC.sol b/contracts/evmx/helpers/TestUSDC.sol similarity index 100% rename from contracts/helpers/TestUSDC.sol rename to contracts/evmx/helpers/TestUSDC.sol diff --git a/contracts/interfaces/IAddressResolver.sol b/contracts/evmx/interfaces/IAddressResolver.sol similarity index 100% rename from contracts/interfaces/IAddressResolver.sol rename to contracts/evmx/interfaces/IAddressResolver.sol diff --git a/contracts/interfaces/IAppGateway.sol b/contracts/evmx/interfaces/IAppGateway.sol similarity index 96% rename from contracts/interfaces/IAppGateway.sol rename to contracts/evmx/interfaces/IAppGateway.sol index 886ebec7..cde9d440 100644 --- a/contracts/interfaces/IAppGateway.sol +++ b/contracts/evmx/interfaces/IAppGateway.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {Read, Parallel, QueuePayloadParams, OverrideParams, CallType, WriteFinality, PayloadParams} from "../protocol/utils/common/Structs.sol"; +import {Read, Parallel, QueuePayloadParams, OverrideParams, CallType, WriteFinality, PayloadParams} from "../utils/common/Structs.sol"; /// @title IAppGateway /// @notice Interface for the app gateway diff --git a/contracts/interfaces/IAuctionManager.sol b/contracts/evmx/interfaces/IAuctionManager.sol similarity index 92% rename from contracts/interfaces/IAuctionManager.sol rename to contracts/evmx/interfaces/IAuctionManager.sol index a67f0200..38122547 100644 --- a/contracts/interfaces/IAuctionManager.sol +++ b/contracts/evmx/interfaces/IAuctionManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {Bid, RequestMetadata, RequestParams} from "../protocol/utils/common/Structs.sol"; +import {Bid, RequestMetadata, RequestParams} from "../utils/common/Structs.sol"; interface IAuctionManager { /// @notice Bids for an auction diff --git a/contracts/interfaces/IContractFactoryPlug.sol b/contracts/evmx/interfaces/IContractFactoryPlug.sol similarity index 94% rename from contracts/interfaces/IContractFactoryPlug.sol rename to contracts/evmx/interfaces/IContractFactoryPlug.sol index 7a020a6a..2eb3db90 100644 --- a/contracts/interfaces/IContractFactoryPlug.sol +++ b/contracts/evmx/interfaces/IContractFactoryPlug.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {IsPlug} from "../protocol/utils/common/Structs.sol"; +import {IsPlug} from "../utils/common/Structs.sol"; /// @title IContractFactory /// @notice Interface for contract factory functionality diff --git a/contracts/interfaces/IFeesManager.sol b/contracts/evmx/interfaces/IFeesManager.sol similarity index 96% rename from contracts/interfaces/IFeesManager.sol rename to contracts/evmx/interfaces/IFeesManager.sol index 02701602..48c0b9ca 100644 --- a/contracts/interfaces/IFeesManager.sol +++ b/contracts/evmx/interfaces/IFeesManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {Bid, QueuePayloadParams, PayloadSubmitParams, AppGatewayWhitelistParams} from "../protocol/utils/common/Structs.sol"; +import {Bid, QueuePayloadParams, PayloadSubmitParams, AppGatewayWhitelistParams} from "../utils/common/Structs.sol"; interface IFeesManager { function blockCredits( diff --git a/contracts/interfaces/IFeesPlug.sol b/contracts/evmx/interfaces/IFeesPlug.sol similarity index 100% rename from contracts/interfaces/IFeesPlug.sol rename to contracts/evmx/interfaces/IFeesPlug.sol diff --git a/contracts/interfaces/IForwarder.sol b/contracts/evmx/interfaces/IForwarder.sol similarity index 100% rename from contracts/interfaces/IForwarder.sol rename to contracts/evmx/interfaces/IForwarder.sol diff --git a/contracts/interfaces/IMiddleware.sol b/contracts/evmx/interfaces/IMiddleware.sol similarity index 98% rename from contracts/interfaces/IMiddleware.sol rename to contracts/evmx/interfaces/IMiddleware.sol index 6bbd5a3d..d6c879c9 100644 --- a/contracts/interfaces/IMiddleware.sol +++ b/contracts/evmx/interfaces/IMiddleware.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {PayloadSubmitParams, QueuePayloadParams, Bid, WriteFinality, BatchParams, CallType, Parallel, IsPlug, RequestMetadata} from "../protocol/utils/common/Structs.sol"; +import {PayloadSubmitParams, QueuePayloadParams, Bid, WriteFinality, BatchParams, CallType, Parallel, IsPlug, RequestMetadata} from "../utils/common/Structs.sol"; /// @title IMiddleware /// @notice Interface for the Middleware contract diff --git a/contracts/interfaces/IPromise.sol b/contracts/evmx/interfaces/IPromise.sol similarity index 100% rename from contracts/interfaces/IPromise.sol rename to contracts/evmx/interfaces/IPromise.sol diff --git a/contracts/interfaces/IWatcherPrecompile.sol b/contracts/evmx/interfaces/IWatcherPrecompile.sol similarity index 99% rename from contracts/interfaces/IWatcherPrecompile.sol rename to contracts/evmx/interfaces/IWatcherPrecompile.sol index 0262a220..788f4842 100644 --- a/contracts/interfaces/IWatcherPrecompile.sol +++ b/contracts/evmx/interfaces/IWatcherPrecompile.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {DigestParams, ResolvedPromises, PayloadParams, TriggerParams, PayloadSubmitParams, Bid, RequestParams, RequestMetadata} from "../protocol/utils/common/Structs.sol"; +import {DigestParams, ResolvedPromises, PayloadParams, TriggerParams, PayloadSubmitParams, Bid, RequestParams, RequestMetadata} from "../utils/common/Structs.sol"; import {IWatcherPrecompileLimits} from "./IWatcherPrecompileLimits.sol"; import {IWatcherPrecompileConfig} from "./IWatcherPrecompileConfig.sol"; diff --git a/contracts/interfaces/IWatcherPrecompileConfig.sol b/contracts/evmx/interfaces/IWatcherPrecompileConfig.sol similarity index 78% rename from contracts/interfaces/IWatcherPrecompileConfig.sol rename to contracts/evmx/interfaces/IWatcherPrecompileConfig.sol index 3cf44e00..ff9c7fd0 100644 --- a/contracts/interfaces/IWatcherPrecompileConfig.sol +++ b/contracts/evmx/interfaces/IWatcherPrecompileConfig.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {AppGatewayConfig, PlugConfig} from "../protocol/utils/common/Structs.sol"; +import {AppGatewayConfig, PlugConfig} from "../utils/common/Structs.sol"; /// @title IWatcherPrecompileConfig /// @notice Interface for the Watcher Precompile system that handles payload verification and execution @@ -59,4 +59,17 @@ interface IWatcherPrecompileConfig { uint256 signatureNonce_, bytes calldata signature_ ) external; + + /// @notice Maps contract to their associated gateway + function contractsToGateways(address contract_) external view returns (address); + + /// @notice Sets the gateway for a contract + /// @param contract_ The address of the contract + /// @param gateway_ The address of the gateway + function setGateway(address contract_, address gateway_) external; + + /// @notice Gets the gateway for a contract + /// @param contract_ The address of the contract + /// @return The address of the gateway + function getGateway(address contract_) external view returns (address); } diff --git a/contracts/interfaces/IWatcherPrecompileLimits.sol b/contracts/evmx/interfaces/IWatcherPrecompileLimits.sol similarity index 97% rename from contracts/interfaces/IWatcherPrecompileLimits.sol rename to contracts/evmx/interfaces/IWatcherPrecompileLimits.sol index 02899a72..8ce07954 100644 --- a/contracts/interfaces/IWatcherPrecompileLimits.sol +++ b/contracts/evmx/interfaces/IWatcherPrecompileLimits.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {LimitParams, UpdateLimitParams} from "../protocol/utils/common/Structs.sol"; +import {LimitParams, UpdateLimitParams} from "../utils/common/Structs.sol"; /// @title IWatcherPrecompileLimits /// @notice Interface for the Watcher Precompile system that handles payload verification and execution diff --git a/contracts/evmx/payload-delivery/AuctionManager.sol b/contracts/evmx/payload-delivery/AuctionManager.sol index 40f1d38d..f2bbbb2a 100644 --- a/contracts/evmx/payload-delivery/AuctionManager.sol +++ b/contracts/evmx/payload-delivery/AuctionManager.sol @@ -3,13 +3,13 @@ pragma solidity ^0.8.21; import {ECDSA} from "solady/utils/ECDSA.sol"; import "solady/utils/Initializable.sol"; -import "../utils/AccessControl.sol"; +import "../../../utils/AccessControl.sol"; import "../../interfaces/IAuctionManager.sol"; import {IMiddleware} from "../../interfaces/IMiddleware.sol"; import {IFeesManager} from "../../interfaces/IFeesManager.sol"; -import {AddressResolverUtil} from "../utils/AddressResolverUtil.sol"; -import {AuctionClosed, AuctionAlreadyStarted, BidExceedsMaxFees, LowerBidAlreadyExists, InvalidTransmitter} from "../utils/common/Errors.sol"; -import {TRANSMITTER_ROLE} from "../utils/common/AccessRoles.sol"; +import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; +import {AuctionClosed, AuctionAlreadyStarted, BidExceedsMaxFees, LowerBidAlreadyExists, InvalidTransmitter} from "../../utils/common/Errors.sol"; +import {TRANSMITTER_ROLE} from "../../utils/common/AccessRoles.sol"; /// @title AuctionManagerStorage /// @notice Storage for the AuctionManager contract diff --git a/contracts/evmx/payload-delivery/FeesPlug.sol b/contracts/evmx/payload-delivery/FeesPlug.sol index 4935afa9..586d816f 100644 --- a/contracts/evmx/payload-delivery/FeesPlug.sol +++ b/contracts/evmx/payload-delivery/FeesPlug.sol @@ -4,12 +4,12 @@ pragma solidity ^0.8.21; import "solady/utils/SafeTransferLib.sol"; import "solady/tokens/ERC20.sol"; import "../../base/PlugBase.sol"; -import "../utils/AccessControl.sol"; -import {RESCUE_ROLE} from "../utils/common/AccessRoles.sol"; +import "../../../utils/AccessControl.sol"; +import {RESCUE_ROLE} from "../../../utils/common/AccessRoles.sol"; import {IFeesPlug} from "../../interfaces/IFeesPlug.sol"; -import "../utils/RescueFundsLib.sol"; -import {ETH_ADDRESS} from "../utils/common/Constants.sol"; -import {InvalidTokenAddress, FeesAlreadyPaid} from "../utils/common/Errors.sol"; +import "../../../utils/RescueFundsLib.sol"; +import {ETH_ADDRESS} from "../../../utils/common/Constants.sol"; +import {InvalidTokenAddress, FeesAlreadyPaid} from "../../../utils/common/Errors.sol"; /// @title FeesManager /// @notice Contract for managing fees on a network diff --git a/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol b/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol index 73c89be1..557a5e46 100644 --- a/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol +++ b/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol @@ -8,8 +8,8 @@ import {IAppGateway} from "../../../interfaces/IAppGateway.sol"; import {IAuctionManager} from "../../../interfaces/IAuctionManager.sol"; import {IFeesManager} from "../../../interfaces/IFeesManager.sol"; -import {NotAuctionManager, InvalidTransmitter, InvalidIndex} from "../../utils/common/Errors.sol"; -import {DEPLOY, PAYLOAD_SIZE_LIMIT, REQUEST_PAYLOAD_COUNT_LIMIT} from "../../utils/common/Constants.sol"; +import {NotAuctionManager, InvalidTransmitter, InvalidIndex} from "../../../utils/common/Errors.sol"; +import {DEPLOY, PAYLOAD_SIZE_LIMIT, REQUEST_PAYLOAD_COUNT_LIMIT} from "../../../utils/common/Constants.sol"; /// @title DeliveryHelperStorage /// @notice Storage contract for DeliveryHelper diff --git a/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol b/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol index 38fcecc9..f5ac360f 100644 --- a/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol +++ b/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import "solady/utils/Initializable.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import {AddressResolverUtil} from "../../utils/AddressResolverUtil.sol"; +import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; import "./DeliveryHelperStorage.sol"; /// @notice Abstract contract for managing asynchronous payloads diff --git a/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol b/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol index a7f17356..496b3363 100644 --- a/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol +++ b/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {CallType, Parallel, WriteFinality} from "../utils/common/Structs.sol"; +import {CallType, Parallel, WriteFinality} from "../../../utils/common/Structs.sol"; library PayloadHeaderDecoder { // Corrected mapping (most significant bits on the left): diff --git a/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol b/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol index 81083086..c4ca1cdc 100644 --- a/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol +++ b/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol @@ -5,8 +5,8 @@ import "solady/utils/Initializable.sol"; import {ECDSA} from "solady/utils/ECDSA.sol"; import {Ownable} from "solady/auth/Ownable.sol"; import "../../interfaces/IWatcherPrecompileConfig.sol"; -import {AddressResolverUtil} from "../utils/AddressResolverUtil.sol"; -import {InvalidWatcherSignature, NonceUsed} from "../utils/common/Errors.sol"; +import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; +import {InvalidWatcherSignature, NonceUsed} from "../../../utils/common/Errors.sol"; import "./core/WatcherIdUtils.sol"; /// @title WatcherPrecompileConfig diff --git a/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol b/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol index 2c01968e..33a6c7bd 100644 --- a/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol +++ b/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol @@ -3,10 +3,10 @@ pragma solidity ^0.8.21; import "solady/utils/Initializable.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import {Gauge} from "../utils/Gauge.sol"; -import {AddressResolverUtil} from "../utils/AddressResolverUtil.sol"; +import {Gauge} from "../../../utils/Gauge.sol"; +import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; import "../../interfaces/IWatcherPrecompileLimits.sol"; -import {SCHEDULE, QUERY, FINALIZE, CALLBACK} from "../utils/common/Constants.sol"; +import {SCHEDULE, QUERY, FINALIZE, CALLBACK} from "../../../utils/common/Constants.sol"; /// @title WatcherPrecompileLimits /// @notice Contract for managing watcher precompile limits diff --git a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol index 85fc60f7..1c6a7d10 100644 --- a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol +++ b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol @@ -6,7 +6,7 @@ import {ECDSA} from "solady/utils/ECDSA.sol"; import {Ownable} from "solady/auth/Ownable.sol"; import "solady/utils/Initializable.sol"; -import {AddressResolverUtil} from "../../utils/AddressResolverUtil.sol"; +import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; import {IFeesManager} from "../../../interfaces/IFeesManager.sol"; import "./WatcherIdUtils.sol"; diff --git a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol index d90706f9..d604bfb7 100644 --- a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol +++ b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol @@ -7,9 +7,9 @@ import {IPromise} from "../../../interfaces/IPromise.sol"; import "../PayloadHeaderDecoder.sol"; import {IMiddleware} from "../../../interfaces/IMiddleware.sol"; -import {QUERY, FINALIZE, SCHEDULE, MAX_COPY_BYTES} from "../../utils/common/Constants.sol"; -import {InvalidCallerTriggered, TimeoutDelayTooLarge, TimeoutAlreadyResolved, InvalidInboxCaller, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled, InvalidWatcherSignature, NonceUsed, RequestAlreadyExecuted} from "../../utils/common/Errors.sol"; -import {ResolvedPromises, AppGatewayConfig, LimitParams, WriteFinality, UpdateLimitParams, PlugConfig, DigestParams, TimeoutRequest, QueuePayloadParams, PayloadParams, RequestParams} from "../../utils/common/Structs.sol"; +import {QUERY, FINALIZE, SCHEDULE, MAX_COPY_BYTES} from "../../../utils/common/Constants.sol"; +import {InvalidCallerTriggered, TimeoutDelayTooLarge, TimeoutAlreadyResolved, InvalidInboxCaller, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled, InvalidWatcherSignature, NonceUsed, RequestAlreadyExecuted} from "../../../utils/common/Errors.sol"; +import {ResolvedPromises, AppGatewayConfig, LimitParams, WriteFinality, UpdateLimitParams, PlugConfig, DigestParams, TimeoutRequest, QueuePayloadParams, PayloadParams, RequestParams, RequestMetadata} from "../../../utils/common/Structs.sol"; /// @title WatcherPrecompileStorage /// @notice Storage contract for the WatcherPrecompile system diff --git a/contracts/socket/SocketBatcher.sol b/contracts/socket/SocketBatcher.sol index 3f1e1589..23112546 100644 --- a/contracts/socket/SocketBatcher.sol +++ b/contracts/socket/SocketBatcher.sol @@ -2,11 +2,11 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import "../../interfaces/ISocket.sol"; -import "../../interfaces/ISwitchboard.sol"; +import "../interfaces/ISocket.sol"; +import "../interfaces/ISwitchboard.sol"; import "../utils/RescueFundsLib.sol"; import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; -import "../../interfaces/ISocketBatcher.sol"; +import "../interfaces/ISocketBatcher.sol"; /** * @title SocketBatcher diff --git a/contracts/base/PlugBase.sol b/contracts/socket/base/PlugBase.sol similarity index 100% rename from contracts/base/PlugBase.sol rename to contracts/socket/base/PlugBase.sol diff --git a/contracts/interfaces/IPlug.sol b/contracts/socket/interfaces/IPlug.sol similarity index 100% rename from contracts/interfaces/IPlug.sol rename to contracts/socket/interfaces/IPlug.sol diff --git a/contracts/interfaces/ISocket.sol b/contracts/socket/interfaces/ISocket.sol similarity index 96% rename from contracts/interfaces/ISocket.sol rename to contracts/socket/interfaces/ISocket.sol index dc5b999e..9d20d918 100644 --- a/contracts/interfaces/ISocket.sol +++ b/contracts/socket/interfaces/ISocket.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {ExecuteParams, TransmissionParams} from "../protocol/utils/common/Structs.sol"; +import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; /** * @title ISocket diff --git a/contracts/interfaces/ISocketBatcher.sol b/contracts/socket/interfaces/ISocketBatcher.sol similarity index 92% rename from contracts/interfaces/ISocketBatcher.sol rename to contracts/socket/interfaces/ISocketBatcher.sol index b8cb2270..75655179 100644 --- a/contracts/interfaces/ISocketBatcher.sol +++ b/contracts/socket/interfaces/ISocketBatcher.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {ExecuteParams} from "../protocol/utils/common/Structs.sol"; +import {ExecuteParams} from "../utils/common/Structs.sol"; /** * @title ISocketBatcher diff --git a/contracts/interfaces/ISocketFeeManager.sol b/contracts/socket/interfaces/ISocketFeeManager.sol similarity index 91% rename from contracts/interfaces/ISocketFeeManager.sol rename to contracts/socket/interfaces/ISocketFeeManager.sol index 1d7958c0..d92f1090 100644 --- a/contracts/interfaces/ISocketFeeManager.sol +++ b/contracts/socket/interfaces/ISocketFeeManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {ExecuteParams, TransmissionParams} from "../protocol/utils/common/Structs.sol"; +import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; interface ISocketFeeManager { /** diff --git a/contracts/interfaces/ISwitchboard.sol b/contracts/socket/interfaces/ISwitchboard.sol similarity index 100% rename from contracts/interfaces/ISwitchboard.sol rename to contracts/socket/interfaces/ISwitchboard.sol diff --git a/contracts/socket/switchboard/SwitchboardBase.sol b/contracts/socket/switchboard/SwitchboardBase.sol index 0c99eaac..c4d1ea89 100644 --- a/contracts/socket/switchboard/SwitchboardBase.sol +++ b/contracts/socket/switchboard/SwitchboardBase.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.21; import {ECDSA} from "solady/utils/ECDSA.sol"; -import "../../../interfaces/ISwitchboard.sol"; -import "../../../interfaces/ISocket.sol"; +import "../../interfaces/ISwitchboard.sol"; +import "../../interfaces/ISocket.sol"; import "../../utils/AccessControl.sol"; import "../../utils/RescueFundsLib.sol"; import {RESCUE_ROLE} from "../../utils/common/AccessRoles.sol"; diff --git a/script/admin/RescueFunds.s.sol b/script/admin/RescueFunds.s.sol index dbd5a3dd..d1268058 100644 --- a/script/admin/RescueFunds.s.sol +++ b/script/admin/RescueFunds.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.19; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {FeesPlug} from "../../contracts/protocol/payload-delivery/FeesPlug.sol"; +import {FeesPlug} from "../../contracts/evmx/payload-delivery/FeesPlug.sol"; contract RescueFundsScript is Script { address constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; diff --git a/script/admin/UpdateAppEVMxLimits.s.sol b/script/admin/UpdateAppEVMxLimits.s.sol index 4d23d16c..5783d764 100644 --- a/script/admin/UpdateAppEVMxLimits.s.sol +++ b/script/admin/UpdateAppEVMxLimits.s.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.21; import "forge-std/Script.sol"; -import {WatcherPrecompile} from "../../contracts/protocol/watcherPrecompile/core/WatcherPrecompile.sol"; -import {UpdateLimitParams} from "../../contracts/protocol/utils/common/Structs.sol"; -import {SCHEDULE, QUERY, FINALIZE} from "../../contracts/protocol/utils/common/Constants.sol"; +import {WatcherPrecompile} from "../../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; +import {UpdateLimitParams} from "../../contracts/utils/common/Structs.sol"; +import {SCHEDULE, QUERY, FINALIZE} from "../../contracts/utils/common/Constants.sol"; contract UpdateLimitsScript is Script { function run() external { diff --git a/script/counter/DeployEVMxCounterApp.s.sol b/script/counter/DeployEVMxCounterApp.s.sol index 42c09af7..79c916c8 100644 --- a/script/counter/DeployEVMxCounterApp.s.sol +++ b/script/counter/DeployEVMxCounterApp.s.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; // source .env && forge script script/counter/deployEVMxCounterApp.s.sol --broadcast --skip-simulation --legacy --gas-price 0 contract CounterDeploy is Script { diff --git a/script/counter/DeployOnchainCounters.s.sol b/script/counter/DeployOnchainCounters.s.sol index 531e2b95..3edb7b78 100644 --- a/script/counter/DeployOnchainCounters.s.sol +++ b/script/counter/DeployOnchainCounters.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; // source .env && forge script script/counter/DeployCounterOnchain.s.sol --broadcast --skip-simulation --legacy --gas-price 0 diff --git a/script/counter/SetFees.s.sol b/script/counter/SetFees.s.sol index 3f87f4ac..b365f64b 100644 --- a/script/counter/SetFees.s.sol +++ b/script/counter/SetFees.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; // source .env && forge script script/counter/DeployCounterOnchain.s.sol --broadcast --skip-simulation --legacy --gas-price 0 diff --git a/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol b/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol index ecd8b2b6..57ad117e 100644 --- a/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol +++ b/script/counter/WithdrawFeesArbitrumFeesPlug.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {FeesManager} from "../../contracts/protocol/payload-delivery/FeesManager.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {FeesManager} from "../../contracts/evmx/payload-delivery/FeesManager.sol"; +import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; import {CounterAppGateway} from "../../test/apps/app-gateways/counter/CounterAppGateway.sol"; // @notice This script is used to withdraw fees from EVMX to Arbitrum Sepolia diff --git a/script/helpers/AppGatewayFeeBalance.s.sol b/script/helpers/AppGatewayFeeBalance.s.sol index 8e80861f..2911c527 100644 --- a/script/helpers/AppGatewayFeeBalance.s.sol +++ b/script/helpers/AppGatewayFeeBalance.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {FeesManager} from "../../contracts/protocol/payload-delivery/FeesManager.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {FeesManager} from "../../contracts/evmx/payload-delivery/FeesManager.sol"; +import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; contract CheckDepositedFees is Script { function run() external { diff --git a/script/helpers/CheckAppEVMxLimits.s.sol b/script/helpers/CheckAppEVMxLimits.s.sol index d31c2cdc..1fc1d901 100644 --- a/script/helpers/CheckAppEVMxLimits.s.sol +++ b/script/helpers/CheckAppEVMxLimits.s.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.21; import "forge-std/Script.sol"; -import {WatcherPrecompile} from "../../contracts/protocol/watcherPrecompile/core/WatcherPrecompile.sol"; -import {LimitParams} from "../../contracts/protocol/utils/common/Structs.sol"; -import {SCHEDULE, QUERY, FINALIZE} from "../../contracts/protocol/utils/common/Constants.sol"; +import {WatcherPrecompile} from "../../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; +import {LimitParams} from "../../contracts/utils/common/Structs.sol"; +import {SCHEDULE, QUERY, FINALIZE} from "../../contracts/utils/common/Constants.sol"; contract CheckLimitsScript is Script { function run() external { diff --git a/script/helpers/PayFeesInArbitrumETH.s.sol b/script/helpers/PayFeesInArbitrumETH.s.sol index 0940009a..b7d5b887 100644 --- a/script/helpers/PayFeesInArbitrumETH.s.sol +++ b/script/helpers/PayFeesInArbitrumETH.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {FeesPlug} from "../../contracts/protocol/payload-delivery/FeesPlug.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {FeesPlug} from "../../contracts/evmx/payload-delivery/FeesPlug.sol"; +import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; // source .env && forge script script/helpers/PayFeesInArbitrumETH.s.sol --broadcast --skip-simulation contract DepositFees is Script { diff --git a/script/helpers/PayFeesInArbitrumTestUSDC.s.sol b/script/helpers/PayFeesInArbitrumTestUSDC.s.sol index c7fe8111..3012dbd6 100644 --- a/script/helpers/PayFeesInArbitrumTestUSDC.s.sol +++ b/script/helpers/PayFeesInArbitrumTestUSDC.s.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.21; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {FeesPlug} from "../../contracts/protocol/payload-delivery/FeesPlug.sol"; -import {ETH_ADDRESS} from "../../contracts/protocol/utils/common/Constants.sol"; +import {FeesPlug} from "../../contracts/evmx/payload-delivery/FeesPlug.sol"; +import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; import {TestUSDC} from "../../contracts/helpers/TestUSDC.sol"; // source .env && forge script script/helpers/PayFeesInArbitrumETH.s.sol --broadcast --skip-simulation contract DepositFees is Script { diff --git a/test/DeliveryHelper.t.sol b/test/DeliveryHelper.t.sol index 85d4b42b..1463cc62 100644 --- a/test/DeliveryHelper.t.sol +++ b/test/DeliveryHelper.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../contracts/protocol/payload-delivery/app-gateway/DeliveryHelper.sol"; -import "../contracts/protocol/payload-delivery/FeesManager.sol"; -import "../contracts/protocol/payload-delivery/AuctionManager.sol"; +import "../contracts/evmx/payload-delivery/app-gateway/DeliveryHelper.sol"; +import "../contracts/evmx/payload-delivery/FeesManager.sol"; +import "../contracts/evmx/payload-delivery/AuctionManager.sol"; -import "../contracts/protocol/Forwarder.sol"; +import "../contracts/evmx/Forwarder.sol"; import "../contracts/interfaces/IAppGateway.sol"; import "./SetupTest.t.sol"; diff --git a/test/Migration.t.sol b/test/Migration.t.sol index 0dd023c5..ecb6fc15 100644 --- a/test/Migration.t.sol +++ b/test/Migration.t.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.21; import "./SetupTest.t.sol"; -import "../contracts/protocol/AddressResolver.sol"; -import "../contracts/protocol/watcherPrecompile/core/WatcherPrecompile.sol"; -import "../contracts/protocol/watcherPrecompile/WatcherPrecompileLimits.sol"; -import "../contracts/protocol/watcherPrecompile/WatcherPrecompileConfig.sol"; -import "../contracts/protocol/Forwarder.sol"; -import "../contracts/protocol/AsyncPromise.sol"; +import "../contracts/evmx/AddressResolver.sol"; +import "../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; +import "../contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol"; +import "../contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol"; +import "../contracts/evmx/Forwarder.sol"; +import "../contracts/evmx/AsyncPromise.sol"; import "./mock/MockWatcherPrecompileImpl.sol"; contract MigrationTest is SetupTest { diff --git a/test/SetupTest.t.sol b/test/SetupTest.t.sol index 4735ab79..c7cca36c 100644 --- a/test/SetupTest.t.sol +++ b/test/SetupTest.t.sol @@ -2,24 +2,24 @@ pragma solidity ^0.8.21; import "forge-std/Test.sol"; -import "../contracts/protocol/utils/common/Structs.sol"; -import "../contracts/protocol/utils/common/Errors.sol"; -import "../contracts/protocol/utils/common/Constants.sol"; -import "../contracts/protocol/watcherPrecompile/core/WatcherPrecompile.sol"; -import "../contracts/protocol/watcherPrecompile/WatcherPrecompileConfig.sol"; -import "../contracts/protocol/watcherPrecompile/WatcherPrecompileLimits.sol"; -import "../contracts/protocol/watcherPrecompile/PayloadHeaderDecoder.sol"; +import "../contracts/utils/common/Structs.sol"; +import "../contracts/utils/common/Errors.sol"; +import "../contracts/utils/common/Constants.sol"; +import "../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; +import "../contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol"; +import "../contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol"; +import "../contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol"; import "../contracts/interfaces/IForwarder.sol"; -import "../contracts/protocol/utils/common/AccessRoles.sol"; -import {Socket} from "../contracts/protocol/socket/Socket.sol"; -import "../contracts/protocol/socket/switchboard/FastSwitchboard.sol"; -import "../contracts/protocol/socket/SocketBatcher.sol"; -import "../contracts/protocol/AddressResolver.sol"; -import {ContractFactoryPlug} from "../contracts/protocol/payload-delivery/ContractFactoryPlug.sol"; -import {FeesPlug} from "../contracts/protocol/payload-delivery/FeesPlug.sol"; -import {SocketFeeManager} from "../contracts/protocol/socket/SocketFeeManager.sol"; -import {ETH_ADDRESS} from "../contracts/protocol/utils/common/Constants.sol"; -import {ResolvedPromises, OnChainFees} from "../contracts/protocol/utils/common/Structs.sol"; +import "../contracts/utils/common/AccessRoles.sol"; +import {Socket} from "../contracts/socket/Socket.sol"; +import "../contracts/socket/switchboard/FastSwitchboard.sol"; +import "../contracts/socket/SocketBatcher.sol"; +import "../contracts/evmx/AddressResolver.sol"; +import {ContractFactoryPlug} from "../contracts/evmx/payload-delivery/ContractFactoryPlug.sol"; +import {FeesPlug} from "../contracts/evmx/payload-delivery/FeesPlug.sol"; +import {SocketFeeManager} from "../contracts/socket/SocketFeeManager.sol"; +import {ETH_ADDRESS} from "../contracts/utils/common/Constants.sol"; +import {ResolvedPromises, OnChainFees} from "../contracts/utils/common/Structs.sol"; import "solady/utils/ERC1967Factory.sol"; import "./apps/app-gateways/USDC.sol"; diff --git a/test/SocketFeeManager.t.sol b/test/SocketFeeManager.t.sol index e57dc809..35b222a5 100644 --- a/test/SocketFeeManager.t.sol +++ b/test/SocketFeeManager.t.sol @@ -4,10 +4,10 @@ pragma solidity ^0.8.0; import {CounterAppGateway} from "./apps/app-gateways/counter/CounterAppGateway.sol"; import {Counter} from "./apps/app-gateways/counter/Counter.sol"; import "./SetupTest.t.sol"; -import {SocketFeeManager} from "../contracts/protocol/socket/SocketFeeManager.sol"; +import {SocketFeeManager} from "../contracts/socket/SocketFeeManager.sol"; import {MockFastSwitchboard} from "./mock/MockFastSwitchboard.sol"; -import {ExecuteParams, TransmissionParams, CallType, WriteFinality} from "../contracts/protocol/utils/common/Structs.sol"; -import {GOVERNANCE_ROLE, RESCUE_ROLE} from "../contracts/protocol/utils/common/AccessRoles.sol"; +import {ExecuteParams, TransmissionParams, CallType, WriteFinality} from "../contracts/utils/common/Structs.sol"; +import {GOVERNANCE_ROLE, RESCUE_ROLE} from "../contracts/utils/common/AccessRoles.sol"; import {Test} from "forge-std/Test.sol"; contract SocketFeeManagerTest is SetupTest { diff --git a/test/apps/SuperToken.t.sol b/test/apps/SuperToken.t.sol index bd5c88ab..9a5a4897 100644 --- a/test/apps/SuperToken.t.sol +++ b/test/apps/SuperToken.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.21; import {SuperTokenAppGateway} from "./app-gateways/super-token/SuperTokenAppGateway.sol"; import {SuperToken} from "./app-gateways/super-token/SuperToken.sol"; import "../DeliveryHelper.t.sol"; -import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/protocol/utils/common/Constants.sol"; +import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/utils/common/Constants.sol"; /** * @title SuperToken Test diff --git a/test/mock/MockSocket.sol b/test/mock/MockSocket.sol index 7f460c2c..55a1bb83 100644 --- a/test/mock/MockSocket.sol +++ b/test/mock/MockSocket.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {InvalidAppGateway} from "../../contracts/protocol/utils/common/Errors.sol"; +import {InvalidAppGateway} from "../../contracts/utils/common/Errors.sol"; import "../../contracts/interfaces/ISwitchboard.sol"; import "../../contracts/interfaces/ISocket.sol"; diff --git a/test/mock/MockWatcherPrecompile.sol b/test/mock/MockWatcherPrecompile.sol index 3cd1681c..957a7641 100644 --- a/test/mock/MockWatcherPrecompile.sol +++ b/test/mock/MockWatcherPrecompile.sol @@ -5,9 +5,9 @@ import "../../contracts/interfaces/IAppGateway.sol"; import "../../contracts/interfaces/IWatcherPrecompile.sol"; import "../../contracts/interfaces/IPromise.sol"; -import {TimeoutRequest, TriggerParams, PlugConfig, ResolvedPromises, AppGatewayConfig} from "../../contracts/protocol/utils/common/Structs.sol"; -import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/protocol/utils/common/Constants.sol"; -import {TimeoutDelayTooLarge, TimeoutAlreadyResolved, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled} from "../../contracts/protocol/utils/common/Errors.sol"; +import {TimeoutRequest, TriggerParams, PlugConfig, ResolvedPromises, AppGatewayConfig} from "../../contracts/utils/common/Structs.sol"; +import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/utils/common/Constants.sol"; +import {TimeoutDelayTooLarge, TimeoutAlreadyResolved, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled} from "../../contracts/utils/common/Errors.sol"; import "solady/utils/ERC1967Factory.sol"; /// @title WatcherPrecompile diff --git a/test/mock/MockWatcherPrecompileImpl.sol b/test/mock/MockWatcherPrecompileImpl.sol index 86f49e22..59cbfb87 100644 --- a/test/mock/MockWatcherPrecompileImpl.sol +++ b/test/mock/MockWatcherPrecompileImpl.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../../contracts/protocol/watcherPrecompile/core/WatcherPrecompile.sol"; +import "../../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; contract MockWatcherPrecompileImpl is WatcherPrecompile { // Mock function to test reinitialization with version 2 From dfcd233f7383134018a2a16d1dd1879737b55af5 Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Mon, 5 May 2025 21:35:44 +0530 Subject: [PATCH 6/7] fix: build --- contracts/evmx/AddressResolver.sol | 2 +- contracts/evmx/AddressResolverUtil.sol | 12 +- contracts/evmx/AsyncPromise.sol | 10 +- contracts/evmx/Forwarder.sol | 14 +- contracts/evmx/base/AppGatewayBase.sol | 6 +- contracts/evmx/interfaces/IAppGateway.sol | 2 +- contracts/evmx/interfaces/IAuctionManager.sol | 2 +- .../evmx/interfaces/IContractFactoryPlug.sol | 2 +- contracts/evmx/interfaces/IFeesManager.sol | 2 +- contracts/evmx/interfaces/IMiddleware.sol | 2 +- .../evmx/interfaces/IWatcherPrecompile.sol | 2 +- .../interfaces/IWatcherPrecompileConfig.sol | 14 +- .../interfaces/IWatcherPrecompileLimits.sol | 52 +------ .../evmx/payload-delivery/AuctionManager.sol | 10 +- .../payload-delivery/ContractFactoryPlug.sol | 14 +- .../evmx/payload-delivery/FeesManager.sol | 10 +- contracts/evmx/payload-delivery/FeesPlug.sol | 14 +- .../app-gateway/DeliveryHelperStorage.sol | 12 +- .../app-gateway/DeliveryUtils.sol | 2 +- .../PayloadHeaderDecoder.sol | 2 +- .../WatcherPrecompileConfig.sol | 6 +- .../WatcherPrecompileLimits.sol | 137 +----------------- .../core/WatcherPrecompileCore.sol | 6 +- .../core/WatcherPrecompileStorage.sol | 9 +- contracts/socket/SocketBatcher.sol | 6 +- contracts/socket/SocketConfig.sol | 9 +- contracts/socket/SocketFeeManager.sol | 2 +- contracts/socket/base/PlugBase.sol | 2 +- contracts/socket/interfaces/ISocket.sol | 2 +- .../socket/interfaces/ISocketBatcher.sol | 2 +- .../socket/interfaces/ISocketFeeManager.sol | 2 +- .../socket/switchboard/SwitchboardBase.sol | 4 +- script/admin/UpdateAppEVMxLimits.s.sol | 53 ------- script/helpers/CheckAppEVMxLimits.s.sol | 66 --------- .../helpers/PayFeesInArbitrumTestUSDC.s.sol | 2 +- test/DeliveryHelper.t.sol | 2 +- test/Migration.t.sol | 5 - test/SetupTest.t.sol | 2 +- test/SocketFeeManager.t.sol | 2 +- test/apps/app-gateways/counter/Counter.sol | 2 +- .../counter/CounterAppGateway.sol | 6 +- .../app-gateways/super-token/SuperToken.sol | 2 +- .../super-token/SuperTokenAppGateway.sol | 2 +- test/mock/MockFastSwitchboard.sol | 4 +- test/mock/MockSocket.sol | 4 +- test/mock/MockWatcherPrecompile.sol | 6 +- 46 files changed, 110 insertions(+), 421 deletions(-) delete mode 100644 script/admin/UpdateAppEVMxLimits.s.sol delete mode 100644 script/helpers/CheckAppEVMxLimits.s.sol diff --git a/contracts/evmx/AddressResolver.sol b/contracts/evmx/AddressResolver.sol index e6d0a401..35e9dca9 100644 --- a/contracts/evmx/AddressResolver.sol +++ b/contracts/evmx/AddressResolver.sol @@ -5,7 +5,7 @@ import {Ownable} from "solady/auth/Ownable.sol"; import {LibClone} from "solady/utils/LibClone.sol"; import {UpgradeableBeacon} from "solady/utils/UpgradeableBeacon.sol"; import {Initializable} from "solady/utils/Initializable.sol"; -import "../interfaces/IAddressResolver.sol"; +import "./interfaces/IAddressResolver.sol"; import {Forwarder} from "./Forwarder.sol"; import {AsyncPromise} from "./AsyncPromise.sol"; diff --git a/contracts/evmx/AddressResolverUtil.sol b/contracts/evmx/AddressResolverUtil.sol index 21f24611..7e08fcc0 100644 --- a/contracts/evmx/AddressResolverUtil.sol +++ b/contracts/evmx/AddressResolverUtil.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../../interfaces/IAddressResolver.sol"; -import "../../interfaces/IMiddleware.sol"; -import "../../interfaces/IWatcherPrecompile.sol"; -import "../../interfaces/IWatcherPrecompileConfig.sol"; -import "../../interfaces/IWatcherPrecompileLimits.sol"; -import "../../interfaces/IFeesManager.sol"; +import "./interfaces/IAddressResolver.sol"; +import "./interfaces/IMiddleware.sol"; +import "./interfaces/IWatcherPrecompile.sol"; +import "./interfaces/IWatcherPrecompileConfig.sol"; +import "./interfaces/IWatcherPrecompileLimits.sol"; +import "./interfaces/IFeesManager.sol"; /// @title AddressResolverUtil /// @notice Utility contract for resolving system contract addresses diff --git a/contracts/evmx/AsyncPromise.sol b/contracts/evmx/AsyncPromise.sol index 261c9d56..0f8f48ae 100644 --- a/contracts/evmx/AsyncPromise.sol +++ b/contracts/evmx/AsyncPromise.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {AddressResolverUtil} from "./utils/AddressResolverUtil.sol"; -import {IPromise} from "../interfaces/IPromise.sol"; -import {IAppGateway} from "../interfaces/IAppGateway.sol"; import {Initializable} from "solady/utils/Initializable.sol"; -import {AsyncPromiseState} from "./utils/common/Structs.sol"; -import {MAX_COPY_BYTES} from "./utils/common/Constants.sol"; import {LibCall} from "solady/utils/LibCall.sol"; +import {IPromise} from "./interfaces/IPromise.sol"; +import {IAppGateway} from "./interfaces/IAppGateway.sol"; +import {AddressResolverUtil} from "./AddressResolverUtil.sol"; +import {AsyncPromiseState} from "../utils/common/Structs.sol"; +import {MAX_COPY_BYTES} from "../utils/common/Constants.sol"; abstract contract AsyncPromiseStorage is IPromise { // slots [0-49] reserved for gap diff --git a/contracts/evmx/Forwarder.sol b/contracts/evmx/Forwarder.sol index 17bb2b6d..f6d214c2 100644 --- a/contracts/evmx/Forwarder.sol +++ b/contracts/evmx/Forwarder.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../interfaces/IAddressResolver.sol"; -import "../interfaces/IMiddleware.sol"; -import "../interfaces/IAppGateway.sol"; -import "../interfaces/IPromise.sol"; -import "../interfaces/IForwarder.sol"; -import {AddressResolverUtil} from "./utils/AddressResolverUtil.sol"; -import {AsyncModifierNotUsed, NoAsyncPromiseFound, PromiseCallerMismatch, RequestCountMismatch, DeliveryHelperNotSet} from "./utils/common/Errors.sol"; +import "./interfaces/IAddressResolver.sol"; +import "./interfaces/IMiddleware.sol"; +import "./interfaces/IAppGateway.sol"; +import "./interfaces/IPromise.sol"; +import "./interfaces/IForwarder.sol"; +import {AddressResolverUtil} from "./AddressResolverUtil.sol"; +import {AsyncModifierNotUsed, NoAsyncPromiseFound, PromiseCallerMismatch, RequestCountMismatch, DeliveryHelperNotSet} from "../utils/common/Errors.sol"; import "solady/utils/Initializable.sol"; /// @title Forwarder Storage diff --git a/contracts/evmx/base/AppGatewayBase.sol b/contracts/evmx/base/AppGatewayBase.sol index f1a936f4..1c8af3a6 100644 --- a/contracts/evmx/base/AppGatewayBase.sol +++ b/contracts/evmx/base/AppGatewayBase.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../protocol/utils/AddressResolverUtil.sol"; +import "../AddressResolverUtil.sol"; import "../interfaces/IAppGateway.sol"; import "../interfaces/IForwarder.sol"; import "../interfaces/IMiddleware.sol"; import "../interfaces/IPromise.sol"; -import {InvalidPromise, FeesNotSet, AsyncModifierNotUsed} from "../protocol/utils/common/Errors.sol"; -import {FAST} from "../protocol/utils/common/Constants.sol"; +import {InvalidPromise, FeesNotSet, AsyncModifierNotUsed} from "../../utils/common/Errors.sol"; +import {FAST} from "../../utils/common/Constants.sol"; /// @title AppGatewayBase /// @notice Abstract contract for the app gateway diff --git a/contracts/evmx/interfaces/IAppGateway.sol b/contracts/evmx/interfaces/IAppGateway.sol index cde9d440..7036cd43 100644 --- a/contracts/evmx/interfaces/IAppGateway.sol +++ b/contracts/evmx/interfaces/IAppGateway.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {Read, Parallel, QueuePayloadParams, OverrideParams, CallType, WriteFinality, PayloadParams} from "../utils/common/Structs.sol"; +import {Read, Parallel, QueuePayloadParams, OverrideParams, WriteFinality, PayloadParams} from "../../utils/common/Structs.sol"; /// @title IAppGateway /// @notice Interface for the app gateway diff --git a/contracts/evmx/interfaces/IAuctionManager.sol b/contracts/evmx/interfaces/IAuctionManager.sol index 38122547..c741c8e9 100644 --- a/contracts/evmx/interfaces/IAuctionManager.sol +++ b/contracts/evmx/interfaces/IAuctionManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {Bid, RequestMetadata, RequestParams} from "../utils/common/Structs.sol"; +import {Bid, RequestMetadata, RequestParams} from "../../utils/common/Structs.sol"; interface IAuctionManager { /// @notice Bids for an auction diff --git a/contracts/evmx/interfaces/IContractFactoryPlug.sol b/contracts/evmx/interfaces/IContractFactoryPlug.sol index 2eb3db90..4fa5f0fe 100644 --- a/contracts/evmx/interfaces/IContractFactoryPlug.sol +++ b/contracts/evmx/interfaces/IContractFactoryPlug.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {IsPlug} from "../utils/common/Structs.sol"; +import {IsPlug} from "../../utils/common/Structs.sol"; /// @title IContractFactory /// @notice Interface for contract factory functionality diff --git a/contracts/evmx/interfaces/IFeesManager.sol b/contracts/evmx/interfaces/IFeesManager.sol index 48c0b9ca..d7afdbaf 100644 --- a/contracts/evmx/interfaces/IFeesManager.sol +++ b/contracts/evmx/interfaces/IFeesManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {Bid, QueuePayloadParams, PayloadSubmitParams, AppGatewayWhitelistParams} from "../utils/common/Structs.sol"; +import {Bid, QueuePayloadParams, PayloadSubmitParams, AppGatewayWhitelistParams} from "../../utils/common/Structs.sol"; interface IFeesManager { function blockCredits( diff --git a/contracts/evmx/interfaces/IMiddleware.sol b/contracts/evmx/interfaces/IMiddleware.sol index d6c879c9..3fc7d2e2 100644 --- a/contracts/evmx/interfaces/IMiddleware.sol +++ b/contracts/evmx/interfaces/IMiddleware.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {PayloadSubmitParams, QueuePayloadParams, Bid, WriteFinality, BatchParams, CallType, Parallel, IsPlug, RequestMetadata} from "../utils/common/Structs.sol"; +import {PayloadSubmitParams, QueuePayloadParams, Bid, WriteFinality, BatchParams, CallType, Parallel, IsPlug, RequestMetadata} from "../../utils/common/Structs.sol"; /// @title IMiddleware /// @notice Interface for the Middleware contract diff --git a/contracts/evmx/interfaces/IWatcherPrecompile.sol b/contracts/evmx/interfaces/IWatcherPrecompile.sol index 788f4842..1dd0dabb 100644 --- a/contracts/evmx/interfaces/IWatcherPrecompile.sol +++ b/contracts/evmx/interfaces/IWatcherPrecompile.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {DigestParams, ResolvedPromises, PayloadParams, TriggerParams, PayloadSubmitParams, Bid, RequestParams, RequestMetadata} from "../utils/common/Structs.sol"; +import {DigestParams, ResolvedPromises, PayloadParams, TriggerParams, PayloadSubmitParams, RequestParams} from "../../utils/common/Structs.sol"; import {IWatcherPrecompileLimits} from "./IWatcherPrecompileLimits.sol"; import {IWatcherPrecompileConfig} from "./IWatcherPrecompileConfig.sol"; diff --git a/contracts/evmx/interfaces/IWatcherPrecompileConfig.sol b/contracts/evmx/interfaces/IWatcherPrecompileConfig.sol index ff9c7fd0..fcfc4026 100644 --- a/contracts/evmx/interfaces/IWatcherPrecompileConfig.sol +++ b/contracts/evmx/interfaces/IWatcherPrecompileConfig.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {AppGatewayConfig, PlugConfig} from "../utils/common/Structs.sol"; +import {AppGatewayConfig, PlugConfig} from "../../utils/common/Structs.sol"; /// @title IWatcherPrecompileConfig /// @notice Interface for the Watcher Precompile system that handles payload verification and execution @@ -60,16 +60,4 @@ interface IWatcherPrecompileConfig { bytes calldata signature_ ) external; - /// @notice Maps contract to their associated gateway - function contractsToGateways(address contract_) external view returns (address); - - /// @notice Sets the gateway for a contract - /// @param contract_ The address of the contract - /// @param gateway_ The address of the gateway - function setGateway(address contract_, address gateway_) external; - - /// @notice Gets the gateway for a contract - /// @param contract_ The address of the contract - /// @return The address of the gateway - function getGateway(address contract_) external view returns (address); } diff --git a/contracts/evmx/interfaces/IWatcherPrecompileLimits.sol b/contracts/evmx/interfaces/IWatcherPrecompileLimits.sol index 8ce07954..d71447b0 100644 --- a/contracts/evmx/interfaces/IWatcherPrecompileLimits.sol +++ b/contracts/evmx/interfaces/IWatcherPrecompileLimits.sol @@ -1,53 +1,12 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {LimitParams, UpdateLimitParams} from "../utils/common/Structs.sol"; +import {LimitParams, UpdateLimitParams} from "../../utils/common/Structs.sol"; /// @title IWatcherPrecompileLimits /// @notice Interface for the Watcher Precompile system that handles payload verification and execution /// @dev Defines core functionality for payload processing and promise resolution interface IWatcherPrecompileLimits { - /// @notice Get the current limit for a specific app gateway and limit type - /// @param limitType_ The type of limit to query - /// @param appGateway_ The app gateway address - /// @return The current limit value - function getCurrentLimit( - bytes32 limitType_, - address appGateway_ - ) external view returns (uint256); - - /// @notice Get the limit parameters for a specific app gateway and limit type - /// @param limitType_ The type of limit to query - /// @param appGateway_ The app gateway address - /// @return The limit parameters - function getLimitParams( - bytes32 limitType_, - address appGateway_ - ) external view returns (LimitParams memory); - - /// @notice Update limit parameters for multiple app gateways - /// @param updates_ Array of limit parameter updates - function updateLimitParams(UpdateLimitParams[] calldata updates_) external; - - /// @notice Set the default limit value - /// @param defaultLimit_ The new default limit value - function setDefaultLimitAndRatePerSecond(uint256 defaultLimit_) external; - - /// @notice Number of decimals used in limit calculations - function limitDecimals() external view returns (uint256); - - /// @notice Default limit value for any app gateway - function defaultLimit() external view returns (uint256); - - /// @notice Rate at which limit replenishes per second - function defaultRatePerSecond() external view returns (uint256); - - /// @notice Consumes a limit for an app gateway - /// @param appGateway_ The app gateway address - /// @param limitType_ The type of limit to consume - /// @param consumeLimit_ The amount of limit to consume - function consumeLimit(address appGateway_, bytes32 limitType_, uint256 consumeLimit_) external; - function getTotalFeesRequired( uint256 queryCount_, uint256 finalizeCount_, @@ -56,13 +15,10 @@ interface IWatcherPrecompileLimits { ) external view returns (uint256); function queryFees() external view returns (uint256); + function finalizeFees() external view returns (uint256); - function timeoutFees() external view returns (uint256); - function callBackFees() external view returns (uint256); - /// @notice Emitted when limit parameters are updated - event LimitParamsUpdated(UpdateLimitParams[] updates); + function timeoutFees() external view returns (uint256); - /// @notice Emitted when an app gateway is activated with default limits - event AppGatewayActivated(address indexed appGateway, uint256 maxLimit, uint256 ratePerSecond); + function callBackFees() external view returns (uint256); } diff --git a/contracts/evmx/payload-delivery/AuctionManager.sol b/contracts/evmx/payload-delivery/AuctionManager.sol index f2bbbb2a..bf625c8b 100644 --- a/contracts/evmx/payload-delivery/AuctionManager.sol +++ b/contracts/evmx/payload-delivery/AuctionManager.sol @@ -3,11 +3,11 @@ pragma solidity ^0.8.21; import {ECDSA} from "solady/utils/ECDSA.sol"; import "solady/utils/Initializable.sol"; -import "../../../utils/AccessControl.sol"; -import "../../interfaces/IAuctionManager.sol"; -import {IMiddleware} from "../../interfaces/IMiddleware.sol"; -import {IFeesManager} from "../../interfaces/IFeesManager.sol"; -import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; +import "../interfaces/IAuctionManager.sol"; +import {IMiddleware} from "../interfaces/IMiddleware.sol"; +import {IFeesManager} from "../interfaces/IFeesManager.sol"; +import "../../utils/AccessControl.sol"; +import {AddressResolverUtil} from "../AddressResolverUtil.sol"; import {AuctionClosed, AuctionAlreadyStarted, BidExceedsMaxFees, LowerBidAlreadyExists, InvalidTransmitter} from "../../utils/common/Errors.sol"; import {TRANSMITTER_ROLE} from "../../utils/common/AccessRoles.sol"; diff --git a/contracts/evmx/payload-delivery/ContractFactoryPlug.sol b/contracts/evmx/payload-delivery/ContractFactoryPlug.sol index 24518bd6..c6e39681 100644 --- a/contracts/evmx/payload-delivery/ContractFactoryPlug.sol +++ b/contracts/evmx/payload-delivery/ContractFactoryPlug.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../utils/AccessControl.sol"; -import {RESCUE_ROLE} from "../utils/common/AccessRoles.sol"; -import "../utils/RescueFundsLib.sol"; -import {NotSocket} from "../utils/common/Errors.sol"; -import "../../base/PlugBase.sol"; -import "../../interfaces/IContractFactoryPlug.sol"; import {LibCall} from "solady/utils/LibCall.sol"; -import {MAX_COPY_BYTES} from "../utils/common/Constants.sol"; +import "../../utils/AccessControl.sol"; +import {RESCUE_ROLE} from "../../utils/common/AccessRoles.sol"; +import "../../utils/RescueFundsLib.sol"; +import {NotSocket} from "../../utils/common/Errors.sol"; +import {MAX_COPY_BYTES} from "../../utils/common/Constants.sol"; +import "../interfaces/IContractFactoryPlug.sol"; +import "../../socket/base/PlugBase.sol"; /// @title ContractFactory /// @notice Abstract contract for deploying contracts diff --git a/contracts/evmx/payload-delivery/FeesManager.sol b/contracts/evmx/payload-delivery/FeesManager.sol index 22a6f70b..7f5e5e61 100644 --- a/contracts/evmx/payload-delivery/FeesManager.sol +++ b/contracts/evmx/payload-delivery/FeesManager.sol @@ -4,11 +4,11 @@ pragma solidity ^0.8.21; import {Ownable} from "solady/auth/Ownable.sol"; import "solady/utils/Initializable.sol"; import "solady/utils/ECDSA.sol"; -import {IFeesPlug} from "../../interfaces/IFeesPlug.sol"; -import "../../interfaces/IFeesManager.sol"; -import {AddressResolverUtil} from "../utils/AddressResolverUtil.sol"; -import {NotAuctionManager, InvalidWatcherSignature, NonceUsed} from "../utils/common/Errors.sol"; -import {Bid, CallType, Parallel, WriteFinality, QueuePayloadParams, IsPlug, PayloadSubmitParams, RequestMetadata, UserCredits} from "../utils/common/Structs.sol"; +import {IFeesPlug} from "../interfaces/IFeesPlug.sol"; +import "../interfaces/IFeesManager.sol"; +import {AddressResolverUtil} from "../AddressResolverUtil.sol"; +import {NotAuctionManager, InvalidWatcherSignature, NonceUsed} from "../../utils/common/Errors.sol"; +import {Bid, CallType, Parallel, WriteFinality, QueuePayloadParams, IsPlug, PayloadSubmitParams, RequestMetadata, UserCredits} from "../../utils/common/Structs.sol"; abstract contract FeesManagerStorage is IFeesManager { // slots [0-49] reserved for gap diff --git a/contracts/evmx/payload-delivery/FeesPlug.sol b/contracts/evmx/payload-delivery/FeesPlug.sol index 586d816f..9eb674f3 100644 --- a/contracts/evmx/payload-delivery/FeesPlug.sol +++ b/contracts/evmx/payload-delivery/FeesPlug.sol @@ -3,13 +3,13 @@ pragma solidity ^0.8.21; import "solady/utils/SafeTransferLib.sol"; import "solady/tokens/ERC20.sol"; -import "../../base/PlugBase.sol"; -import "../../../utils/AccessControl.sol"; -import {RESCUE_ROLE} from "../../../utils/common/AccessRoles.sol"; -import {IFeesPlug} from "../../interfaces/IFeesPlug.sol"; -import "../../../utils/RescueFundsLib.sol"; -import {ETH_ADDRESS} from "../../../utils/common/Constants.sol"; -import {InvalidTokenAddress, FeesAlreadyPaid} from "../../../utils/common/Errors.sol"; +import "../../socket/base/PlugBase.sol"; +import "../../utils/AccessControl.sol"; +import {RESCUE_ROLE} from "../../utils/common/AccessRoles.sol"; +import {IFeesPlug} from "../interfaces/IFeesPlug.sol"; +import "../../utils/RescueFundsLib.sol"; +import {ETH_ADDRESS} from "../../utils/common/Constants.sol"; +import {InvalidTokenAddress, FeesAlreadyPaid} from "../../utils/common/Errors.sol"; /// @title FeesManager /// @notice Contract for managing fees on a network diff --git a/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol b/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol index 557a5e46..f6fbcc15 100644 --- a/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol +++ b/contracts/evmx/payload-delivery/app-gateway/DeliveryHelperStorage.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../../../interfaces/IMiddleware.sol"; -import {IAddressResolver} from "../../../interfaces/IAddressResolver.sol"; -import {IContractFactoryPlug} from "../../../interfaces/IContractFactoryPlug.sol"; -import {IAppGateway} from "../../../interfaces/IAppGateway.sol"; -import {IAuctionManager} from "../../../interfaces/IAuctionManager.sol"; -import {IFeesManager} from "../../../interfaces/IFeesManager.sol"; +import "../../interfaces/IMiddleware.sol"; +import {IAddressResolver} from "../../interfaces/IAddressResolver.sol"; +import {IContractFactoryPlug} from "../../interfaces/IContractFactoryPlug.sol"; +import {IAppGateway} from "../../interfaces/IAppGateway.sol"; +import {IAuctionManager} from "../../interfaces/IAuctionManager.sol"; +import {IFeesManager} from "../../interfaces/IFeesManager.sol"; import {NotAuctionManager, InvalidTransmitter, InvalidIndex} from "../../../utils/common/Errors.sol"; import {DEPLOY, PAYLOAD_SIZE_LIMIT, REQUEST_PAYLOAD_COUNT_LIMIT} from "../../../utils/common/Constants.sol"; diff --git a/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol b/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol index f5ac360f..14dc88bb 100644 --- a/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol +++ b/contracts/evmx/payload-delivery/app-gateway/DeliveryUtils.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import "solady/utils/Initializable.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; +import {AddressResolverUtil} from "../../AddressResolverUtil.sol"; import "./DeliveryHelperStorage.sol"; /// @notice Abstract contract for managing asynchronous payloads diff --git a/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol b/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol index 496b3363..22879a1c 100644 --- a/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol +++ b/contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {CallType, Parallel, WriteFinality} from "../../../utils/common/Structs.sol"; +import {CallType, Parallel, WriteFinality} from "../../utils/common/Structs.sol"; library PayloadHeaderDecoder { // Corrected mapping (most significant bits on the left): diff --git a/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol b/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol index c4ca1cdc..b0a3984f 100644 --- a/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol +++ b/contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.21; import "solady/utils/Initializable.sol"; import {ECDSA} from "solady/utils/ECDSA.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import "../../interfaces/IWatcherPrecompileConfig.sol"; -import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; -import {InvalidWatcherSignature, NonceUsed} from "../../../utils/common/Errors.sol"; +import "../interfaces/IWatcherPrecompileConfig.sol"; +import {AddressResolverUtil} from "../AddressResolverUtil.sol"; +import {InvalidWatcherSignature, NonceUsed} from "../../utils/common/Errors.sol"; import "./core/WatcherIdUtils.sol"; /// @title WatcherPrecompileConfig diff --git a/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol b/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol index 33a6c7bd..850feb16 100644 --- a/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol +++ b/contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol @@ -3,10 +3,9 @@ pragma solidity ^0.8.21; import "solady/utils/Initializable.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import {Gauge} from "../../../utils/Gauge.sol"; -import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; -import "../../interfaces/IWatcherPrecompileLimits.sol"; -import {SCHEDULE, QUERY, FINALIZE, CALLBACK} from "../../../utils/common/Constants.sol"; +import {AddressResolverUtil} from "../AddressResolverUtil.sol"; +import "../interfaces/IWatcherPrecompileLimits.sol"; +import {SCHEDULE, QUERY, FINALIZE, CALLBACK} from "../../utils/common/Constants.sol"; /// @title WatcherPrecompileLimits /// @notice Contract for managing watcher precompile limits @@ -14,7 +13,6 @@ contract WatcherPrecompileLimits is IWatcherPrecompileLimits, Initializable, Ownable, - Gauge, AddressResolverUtil { // slots 0-49 (50) reserved for gauge @@ -23,34 +21,12 @@ contract WatcherPrecompileLimits is // slots [101-150]: gap for future storage variables uint256[50] _gap_before; - // slot 151: limitDecimals - /// @notice Number of decimals used in limit calculations - uint256 public limitDecimals; - - // slot 152: defaultLimit - /// @notice Default limit value for any app gateway - uint256 public defaultLimit; - - // slot 153: defaultRatePerSecond - /// @notice Rate at which limit replenishes per second - uint256 public defaultRatePerSecond; - - // slot 154: _limitParams - // appGateway => limitType => receivingLimitParams - mapping(address => mapping(bytes32 => LimitParams)) internal _limitParams; - - // slot 155: _activeAppGateways - // Mapping to track active app gateways - mapping(address => bool) internal _activeAppGateways; - // slot 157: fees uint256 public queryFees; uint256 public finalizeFees; uint256 public timeoutFees; uint256 public callBackFees; - /// @notice Emitted when the default limit and rate per second are set - event DefaultLimitAndRatePerSecondSet(uint256 defaultLimit, uint256 defaultRatePerSecond); /// @notice Emitted when the query fees are set event QueryFeesSet(uint256 queryFees); /// @notice Emitted when the finalize fees are set @@ -63,114 +39,9 @@ contract WatcherPrecompileLimits is error WatcherFeesNotSet(bytes32 limitType); /// @notice Initial initialization (version 1) - function initialize( - address owner_, - address addressResolver_, - uint256 defaultLimit_ - ) public reinitializer(1) { + function initialize(address owner_, address addressResolver_, uint256) public reinitializer(1) { _setAddressResolver(addressResolver_); _initializeOwner(owner_); - limitDecimals = 18; - - // limit per day - defaultLimit = defaultLimit_ * 10 ** limitDecimals; - // limit per second - defaultRatePerSecond = defaultLimit / (24 * 60 * 60); - } - - /** - * @notice Get the current limit for a specific app gateway and limit type - * @param limitType_ The type of limit to query - * @param appGateway_ The app gateway address - * @return The current limit value - */ - function getCurrentLimit( - bytes32 limitType_, - address appGateway_ - ) external view returns (uint256) { - return _getCurrentLimit(_limitParams[appGateway_][limitType_]); - } - - /** - * @notice Get the limit parameters for a specific app gateway and limit type - * @param limitType_ The type of limit to query - * @param appGateway_ The app gateway address - * @return The limit parameters - */ - function getLimitParams( - bytes32 limitType_, - address appGateway_ - ) external view returns (LimitParams memory) { - return _limitParams[appGateway_][limitType_]; - } - - /** - * @notice Update limit parameters for multiple app gateways - * @param updates_ Array of limit parameter updates - */ - function updateLimitParams(UpdateLimitParams[] calldata updates_) external onlyOwner { - _updateLimitParams(updates_); - } - - /** - * @notice Internal function to update limit parameters - * @param updates_ Array of limit parameter updates - */ - function _updateLimitParams(UpdateLimitParams[] calldata updates_) internal { - for (uint256 i = 0; i < updates_.length; i++) { - _consumePartLimit(0, _limitParams[updates_[i].appGateway][updates_[i].limitType]); - _limitParams[updates_[i].appGateway][updates_[i].limitType].maxLimit = updates_[i] - .maxLimit; - _limitParams[updates_[i].appGateway][updates_[i].limitType].ratePerSecond = updates_[i] - .ratePerSecond; - } - - emit LimitParamsUpdated(updates_); - } - - /** - * @notice Internal function to consume limit based on caller - * @param appGateway_ The app gateway address - * @param limitType_ The type of limit to consume - * @param consumeLimit_ The amount of limit to consume - */ - function consumeLimit( - address appGateway_, - bytes32 limitType_, - uint256 consumeLimit_ - ) external override onlyWatcherPrecompile { - LimitParams storage limitParams = _limitParams[appGateway_][limitType_]; - - // Initialize limit if not active, give default limit and rate per second - if (!_activeAppGateways[appGateway_]) { - LimitParams memory limitParam = LimitParams({ - maxLimit: defaultLimit, - ratePerSecond: defaultRatePerSecond, - lastUpdateTimestamp: block.timestamp, - lastUpdateLimit: defaultLimit - }); - - _limitParams[appGateway_][QUERY] = limitParam; - _limitParams[appGateway_][FINALIZE] = limitParam; - _limitParams[appGateway_][SCHEDULE] = limitParam; - - _activeAppGateways[appGateway_] = true; - emit AppGatewayActivated(appGateway_, defaultLimit, defaultRatePerSecond); - } - - // Update the limit - _consumeFullLimit(consumeLimit_ * 10 ** limitDecimals, limitParams); - } - - /** - * @notice Set the default limit value - * @param defaultLimit_ The new default limit value - */ - function setDefaultLimitAndRatePerSecond(uint256 defaultLimit_) external onlyOwner { - defaultLimit = defaultLimit_; - defaultRatePerSecond = defaultLimit / (24 * 60 * 60); - - emit DefaultLimitAndRatePerSecondSet(defaultLimit, defaultRatePerSecond); } function setQueryFees(uint256 queryFees_) external onlyOwner { diff --git a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol index 1c6a7d10..9da6d736 100644 --- a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol +++ b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileCore.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "./WatcherPrecompileStorage.sol"; import {ECDSA} from "solady/utils/ECDSA.sol"; import {Ownable} from "solady/auth/Ownable.sol"; import "solady/utils/Initializable.sol"; -import {AddressResolverUtil} from "../../../utils/AddressResolverUtil.sol"; -import {IFeesManager} from "../../../interfaces/IFeesManager.sol"; +import {AddressResolverUtil} from "../../AddressResolverUtil.sol"; +import {IFeesManager} from "../../interfaces/IFeesManager.sol"; import "./WatcherIdUtils.sol"; +import "./WatcherPrecompileStorage.sol"; /// @title WatcherPrecompileCore /// @notice Core functionality for the WatcherPrecompile system diff --git a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol index d604bfb7..2ef880e3 100644 --- a/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol +++ b/contracts/evmx/watcherPrecompile/core/WatcherPrecompileStorage.sol @@ -1,12 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../../../interfaces/IWatcherPrecompile.sol"; -import {IAppGateway} from "../../../interfaces/IAppGateway.sol"; -import {IPromise} from "../../../interfaces/IPromise.sol"; import "../PayloadHeaderDecoder.sol"; - -import {IMiddleware} from "../../../interfaces/IMiddleware.sol"; +import "../../interfaces/IWatcherPrecompile.sol"; +import {IAppGateway} from "../../interfaces/IAppGateway.sol"; +import {IPromise} from "../../interfaces/IPromise.sol"; +import {IMiddleware} from "../../interfaces/IMiddleware.sol"; import {QUERY, FINALIZE, SCHEDULE, MAX_COPY_BYTES} from "../../../utils/common/Constants.sol"; import {InvalidCallerTriggered, TimeoutDelayTooLarge, TimeoutAlreadyResolved, InvalidInboxCaller, ResolvingTimeoutTooEarly, CallFailed, AppGatewayAlreadyCalled, InvalidWatcherSignature, NonceUsed, RequestAlreadyExecuted} from "../../../utils/common/Errors.sol"; import {ResolvedPromises, AppGatewayConfig, LimitParams, WriteFinality, UpdateLimitParams, PlugConfig, DigestParams, TimeoutRequest, QueuePayloadParams, PayloadParams, RequestParams, RequestMetadata} from "../../../utils/common/Structs.sol"; diff --git a/contracts/socket/SocketBatcher.sol b/contracts/socket/SocketBatcher.sol index 23112546..e8313f08 100644 --- a/contracts/socket/SocketBatcher.sol +++ b/contracts/socket/SocketBatcher.sol @@ -2,11 +2,11 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import "../interfaces/ISocket.sol"; -import "../interfaces/ISwitchboard.sol"; +import "./interfaces/ISocket.sol"; +import "./interfaces/ISocketBatcher.sol"; +import "./interfaces/ISwitchboard.sol"; import "../utils/RescueFundsLib.sol"; import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; -import "../interfaces/ISocketBatcher.sol"; /** * @title SocketBatcher diff --git a/contracts/socket/SocketConfig.sol b/contracts/socket/SocketConfig.sol index 68287aea..e3fb0194 100644 --- a/contracts/socket/SocketConfig.sol +++ b/contracts/socket/SocketConfig.sol @@ -1,15 +1,14 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../interfaces/ISocket.sol"; -import "../interfaces/ISwitchboard.sol"; -import {IPlug} from "../interfaces/IPlug.sol"; - +import "./interfaces/ISocket.sol"; +import "./interfaces/ISwitchboard.sol"; +import {IPlug} from "./interfaces/IPlug.sol"; +import "./interfaces/ISocketFeeManager.sol"; import "../utils/AccessControl.sol"; import {GOVERNANCE_ROLE, RESCUE_ROLE, SWITCHBOARD_DISABLER_ROLE} from "../utils/common/AccessRoles.sol"; import {CallType, PlugConfig, SwitchboardStatus, ExecutionStatus} from "../utils/common/Structs.sol"; import {PlugNotFound, InvalidAppGateway, InvalidTransmitter} from "../utils/common/Errors.sol"; -import "../interfaces/ISocketFeeManager.sol"; import {MAX_COPY_BYTES} from "../utils/common/Constants.sol"; /** diff --git a/contracts/socket/SocketFeeManager.sol b/contracts/socket/SocketFeeManager.sol index 1625a532..3e3bfa8e 100644 --- a/contracts/socket/SocketFeeManager.sol +++ b/contracts/socket/SocketFeeManager.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.21; import "../utils/AccessControl.sol"; import {GOVERNANCE_ROLE, RESCUE_ROLE} from "../utils/common/AccessRoles.sol"; import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; -import "../interfaces/ISocketFeeManager.sol"; +import "./interfaces/ISocketFeeManager.sol"; import "../utils/RescueFundsLib.sol"; /** diff --git a/contracts/socket/base/PlugBase.sol b/contracts/socket/base/PlugBase.sol index 1ef146bc..21d22417 100644 --- a/contracts/socket/base/PlugBase.sol +++ b/contracts/socket/base/PlugBase.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import {ISocket} from "../interfaces/ISocket.sol"; import {IPlug} from "../interfaces/IPlug.sol"; -import {NotSocket} from "../protocol/utils/common/Errors.sol"; +import {NotSocket} from "../../utils/common/Errors.sol"; /// @title PlugBase /// @notice Abstract contract for plugs diff --git a/contracts/socket/interfaces/ISocket.sol b/contracts/socket/interfaces/ISocket.sol index 9d20d918..80a8a25a 100644 --- a/contracts/socket/interfaces/ISocket.sol +++ b/contracts/socket/interfaces/ISocket.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; +import {ExecuteParams, TransmissionParams} from "../../utils/common/Structs.sol"; /** * @title ISocket diff --git a/contracts/socket/interfaces/ISocketBatcher.sol b/contracts/socket/interfaces/ISocketBatcher.sol index 75655179..dfd146ac 100644 --- a/contracts/socket/interfaces/ISocketBatcher.sol +++ b/contracts/socket/interfaces/ISocketBatcher.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {ExecuteParams} from "../utils/common/Structs.sol"; +import {ExecuteParams} from "../../utils/common/Structs.sol"; /** * @title ISocketBatcher diff --git a/contracts/socket/interfaces/ISocketFeeManager.sol b/contracts/socket/interfaces/ISocketFeeManager.sol index d92f1090..b1029300 100644 --- a/contracts/socket/interfaces/ISocketFeeManager.sol +++ b/contracts/socket/interfaces/ISocketFeeManager.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import {ExecuteParams, TransmissionParams} from "../utils/common/Structs.sol"; +import {ExecuteParams, TransmissionParams} from "../../utils/common/Structs.sol"; interface ISocketFeeManager { /** diff --git a/contracts/socket/switchboard/SwitchboardBase.sol b/contracts/socket/switchboard/SwitchboardBase.sol index c4d1ea89..99e3a607 100644 --- a/contracts/socket/switchboard/SwitchboardBase.sol +++ b/contracts/socket/switchboard/SwitchboardBase.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.21; import {ECDSA} from "solady/utils/ECDSA.sol"; -import "../../interfaces/ISwitchboard.sol"; -import "../../interfaces/ISocket.sol"; +import "../interfaces/ISwitchboard.sol"; +import "../interfaces/ISocket.sol"; import "../../utils/AccessControl.sol"; import "../../utils/RescueFundsLib.sol"; import {RESCUE_ROLE} from "../../utils/common/AccessRoles.sol"; diff --git a/script/admin/UpdateAppEVMxLimits.s.sol b/script/admin/UpdateAppEVMxLimits.s.sol deleted file mode 100644 index 5783d764..00000000 --- a/script/admin/UpdateAppEVMxLimits.s.sol +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.21; - -import "forge-std/Script.sol"; -import {WatcherPrecompile} from "../../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; -import {UpdateLimitParams} from "../../contracts/utils/common/Structs.sol"; -import {SCHEDULE, QUERY, FINALIZE} from "../../contracts/utils/common/Constants.sol"; - -contract UpdateLimitsScript is Script { - function run() external { - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - - // Load private key from env - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); - - // Start broadcast with private key - vm.startBroadcast(deployerPrivateKey); - address watcherPrecompile = vm.envAddress("WATCHER_PRECOMPILE"); - address appGateway = vm.envAddress("APP_GATEWAY"); - - console.log("WatcherPrecompile address:", watcherPrecompile); - console.log("AppGateway address:", appGateway); - WatcherPrecompile watcherContract = WatcherPrecompile(watcherPrecompile); - - // Create update params array - UpdateLimitParams[] memory updates = new UpdateLimitParams[](3); - - // Example update - modify these values as needed - updates[0] = UpdateLimitParams({ - limitType: SCHEDULE, // Example limit type - appGateway: appGateway, // Replace with actual app gateway address - maxLimit: 10000000000, // Maximum limit - ratePerSecond: 10000000000 // Rate per second - }); - updates[1] = UpdateLimitParams({ - limitType: QUERY, // Example limit type - appGateway: appGateway, // Replace with actual app gateway address - maxLimit: 10000000000, // Maximum limit - ratePerSecond: 10000000000 // Rate per second - }); - updates[2] = UpdateLimitParams({ - limitType: FINALIZE, // Example limit type - appGateway: appGateway, // Replace with actual app gateway address - maxLimit: 10000000000, // Maximum limit - ratePerSecond: 10000000000 // Rate per second - }); - // // Update the limits - watcherContract.watcherPrecompileLimits__().updateLimitParams(updates); - - vm.stopBroadcast(); - } -} diff --git a/script/helpers/CheckAppEVMxLimits.s.sol b/script/helpers/CheckAppEVMxLimits.s.sol deleted file mode 100644 index 1fc1d901..00000000 --- a/script/helpers/CheckAppEVMxLimits.s.sol +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.21; - -import "forge-std/Script.sol"; -import {WatcherPrecompile} from "../../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; -import {LimitParams} from "../../contracts/utils/common/Structs.sol"; -import {SCHEDULE, QUERY, FINALIZE} from "../../contracts/utils/common/Constants.sol"; - -contract CheckLimitsScript is Script { - function run() external { - string memory rpc = vm.envString("EVMX_RPC"); - vm.createSelectFork(rpc); - - address watcherPrecompile = vm.envAddress("WATCHER_PRECOMPILE"); - address appGateway = vm.envAddress("APP_GATEWAY"); - - console.log("WatcherPrecompile address:", watcherPrecompile); - console.log("AppGateway address:", appGateway); - WatcherPrecompile watcherContract = WatcherPrecompile(watcherPrecompile); - - LimitParams memory scheduleLimit = watcherContract - .watcherPrecompileLimits__() - .getLimitParams(SCHEDULE, appGateway); - LimitParams memory queryLimit = watcherContract.watcherPrecompileLimits__().getLimitParams( - QUERY, - appGateway - ); - LimitParams memory finalizeLimit = watcherContract - .watcherPrecompileLimits__() - .getLimitParams(FINALIZE, appGateway); - - uint256 scheduleCurrentLimit = watcherContract.watcherPrecompileLimits__().getCurrentLimit( - SCHEDULE, - appGateway - ); - uint256 queryCurrentLimit = watcherContract.watcherPrecompileLimits__().getCurrentLimit( - QUERY, - appGateway - ); - uint256 finalizeCurrentLimit = watcherContract.watcherPrecompileLimits__().getCurrentLimit( - FINALIZE, - appGateway - ); - - console.log("Schedule max limit:"); - console.log(scheduleLimit.maxLimit); - console.log("Schedule rate per second:"); - console.log(scheduleLimit.ratePerSecond); - console.log("Schedule current limit:"); - console.log(scheduleCurrentLimit); - - console.log("Query max limit:"); - console.log(queryLimit.maxLimit); - console.log("Query rate per second:"); - console.log(queryLimit.ratePerSecond); - console.log("Query current limit:"); - console.log(queryCurrentLimit); - - console.log("Finalize max limit:"); - console.log(finalizeLimit.maxLimit); - console.log("Finalize rate per second:"); - console.log(finalizeLimit.ratePerSecond); - console.log("Finalize current limit:"); - console.log(finalizeCurrentLimit); - } -} diff --git a/script/helpers/PayFeesInArbitrumTestUSDC.s.sol b/script/helpers/PayFeesInArbitrumTestUSDC.s.sol index 3012dbd6..daf9b08e 100644 --- a/script/helpers/PayFeesInArbitrumTestUSDC.s.sol +++ b/script/helpers/PayFeesInArbitrumTestUSDC.s.sol @@ -5,7 +5,7 @@ import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {FeesPlug} from "../../contracts/evmx/payload-delivery/FeesPlug.sol"; import {ETH_ADDRESS} from "../../contracts/utils/common/Constants.sol"; -import {TestUSDC} from "../../contracts/helpers/TestUSDC.sol"; +import {TestUSDC} from "../../contracts/evmx/helpers/TestUSDC.sol"; // source .env && forge script script/helpers/PayFeesInArbitrumETH.s.sol --broadcast --skip-simulation contract DepositFees is Script { function run() external { diff --git a/test/DeliveryHelper.t.sol b/test/DeliveryHelper.t.sol index 1463cc62..a14321b7 100644 --- a/test/DeliveryHelper.t.sol +++ b/test/DeliveryHelper.t.sol @@ -6,7 +6,7 @@ import "../contracts/evmx/payload-delivery/FeesManager.sol"; import "../contracts/evmx/payload-delivery/AuctionManager.sol"; import "../contracts/evmx/Forwarder.sol"; -import "../contracts/interfaces/IAppGateway.sol"; +import "../contracts/evmx/interfaces/IAppGateway.sol"; import "./SetupTest.t.sol"; diff --git a/test/Migration.t.sol b/test/Migration.t.sol index ecb6fc15..fa7b05cb 100644 --- a/test/Migration.t.sol +++ b/test/Migration.t.sol @@ -131,11 +131,6 @@ contract MigrationTest is SetupTest { address(addressResolver), "AddressResolver should be preserved" ); - assertEq( - watcherPrecompileLimits.defaultLimit(), - defaultLimit * 10 ** 18, - "DefaultLimit should be preserved" - ); } function testWatcherPrecompileConfigUpgrade() public { diff --git a/test/SetupTest.t.sol b/test/SetupTest.t.sol index c7cca36c..8f7b8f5e 100644 --- a/test/SetupTest.t.sol +++ b/test/SetupTest.t.sol @@ -9,7 +9,7 @@ import "../contracts/evmx/watcherPrecompile/core/WatcherPrecompile.sol"; import "../contracts/evmx/watcherPrecompile/WatcherPrecompileConfig.sol"; import "../contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol"; import "../contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol"; -import "../contracts/interfaces/IForwarder.sol"; +import "../contracts/evmx/interfaces/IForwarder.sol"; import "../contracts/utils/common/AccessRoles.sol"; import {Socket} from "../contracts/socket/Socket.sol"; import "../contracts/socket/switchboard/FastSwitchboard.sol"; diff --git a/test/SocketFeeManager.t.sol b/test/SocketFeeManager.t.sol index 35b222a5..2639166b 100644 --- a/test/SocketFeeManager.t.sol +++ b/test/SocketFeeManager.t.sol @@ -6,7 +6,7 @@ import {Counter} from "./apps/app-gateways/counter/Counter.sol"; import "./SetupTest.t.sol"; import {SocketFeeManager} from "../contracts/socket/SocketFeeManager.sol"; import {MockFastSwitchboard} from "./mock/MockFastSwitchboard.sol"; -import {ExecuteParams, TransmissionParams, CallType, WriteFinality} from "../contracts/utils/common/Structs.sol"; +import {ExecuteParams, TransmissionParams, CallType} from "../contracts/utils/common/Structs.sol"; import {GOVERNANCE_ROLE, RESCUE_ROLE} from "../contracts/utils/common/AccessRoles.sol"; import {Test} from "forge-std/Test.sol"; diff --git a/test/apps/app-gateways/counter/Counter.sol b/test/apps/app-gateways/counter/Counter.sol index 214bab43..0a64f2f0 100644 --- a/test/apps/app-gateways/counter/Counter.sol +++ b/test/apps/app-gateways/counter/Counter.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import "../../../../contracts/base/PlugBase.sol"; +import "../../../../contracts/socket/base/PlugBase.sol"; interface ICounterAppGateway { function increase(uint256 value_) external returns (bytes32); diff --git a/test/apps/app-gateways/counter/CounterAppGateway.sol b/test/apps/app-gateways/counter/CounterAppGateway.sol index f5bca934..eecc2c79 100644 --- a/test/apps/app-gateways/counter/CounterAppGateway.sol +++ b/test/apps/app-gateways/counter/CounterAppGateway.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../../../../contracts/base/AppGatewayBase.sol"; -import "../../../../contracts/interfaces/IForwarder.sol"; -import "../../../../contracts/interfaces/IPromise.sol"; +import "../../../../contracts/evmx/base/AppGatewayBase.sol"; +import "../../../../contracts/evmx/interfaces/IForwarder.sol"; +import "../../../../contracts/evmx/interfaces/IPromise.sol"; import "./Counter.sol"; import "./ICounter.sol"; diff --git a/test/apps/app-gateways/super-token/SuperToken.sol b/test/apps/app-gateways/super-token/SuperToken.sol index f1bf0247..2849a211 100644 --- a/test/apps/app-gateways/super-token/SuperToken.sol +++ b/test/apps/app-gateways/super-token/SuperToken.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import "solady/tokens/ERC20.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import "../../../../contracts/base/PlugBase.sol"; +import "../../../../contracts/socket/base/PlugBase.sol"; /** * @title SuperToken diff --git a/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol b/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol index fbaf6f15..aa88756f 100644 --- a/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol +++ b/test/apps/app-gateways/super-token/SuperTokenAppGateway.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import "../../../../contracts/base/AppGatewayBase.sol"; +import "../../../../contracts/evmx/base/AppGatewayBase.sol"; import "./ISuperToken.sol"; import "./SuperToken.sol"; diff --git a/test/mock/MockFastSwitchboard.sol b/test/mock/MockFastSwitchboard.sol index 3341fab8..a26cd58e 100644 --- a/test/mock/MockFastSwitchboard.sol +++ b/test/mock/MockFastSwitchboard.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "../../contracts/interfaces/ISwitchboard.sol"; -import "../../contracts/interfaces/ISocket.sol"; +import "../../contracts/socket/interfaces/ISwitchboard.sol"; +import "../../contracts/socket/interfaces/ISocket.sol"; contract MockFastSwitchboard is ISwitchboard { address public owner; ISocket public immutable socket__; diff --git a/test/mock/MockSocket.sol b/test/mock/MockSocket.sol index 55a1bb83..d2fad1ff 100644 --- a/test/mock/MockSocket.sol +++ b/test/mock/MockSocket.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.21; import {InvalidAppGateway} from "../../contracts/utils/common/Errors.sol"; -import "../../contracts/interfaces/ISwitchboard.sol"; -import "../../contracts/interfaces/ISocket.sol"; +import "../../contracts/socket/interfaces/ISwitchboard.sol"; +import "../../contracts/socket/interfaces/ISocket.sol"; /** * @title SocketDst diff --git a/test/mock/MockWatcherPrecompile.sol b/test/mock/MockWatcherPrecompile.sol index 957a7641..ee89876b 100644 --- a/test/mock/MockWatcherPrecompile.sol +++ b/test/mock/MockWatcherPrecompile.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.21; -import "../../contracts/interfaces/IAppGateway.sol"; -import "../../contracts/interfaces/IWatcherPrecompile.sol"; -import "../../contracts/interfaces/IPromise.sol"; +import "../../contracts/evmx/interfaces/IAppGateway.sol"; +import "../../contracts/evmx/interfaces/IWatcherPrecompile.sol"; +import "../../contracts/evmx/interfaces/IPromise.sol"; import {TimeoutRequest, TriggerParams, PlugConfig, ResolvedPromises, AppGatewayConfig} from "../../contracts/utils/common/Structs.sol"; import {QUERY, FINALIZE, SCHEDULE} from "../../contracts/utils/common/Constants.sol"; From a6a95377a8553f9287c6932adeedc0a8e3155f4d Mon Sep 17 00:00:00 2001 From: Ameesha Agrawal Date: Mon, 5 May 2025 21:42:56 +0530 Subject: [PATCH 7/7] fix: rename socket folder --- contracts/evmx/payload-delivery/ContractFactoryPlug.sol | 2 +- contracts/evmx/payload-delivery/FeesPlug.sol | 3 ++- contracts/{socket => protocol}/Socket.sol | 0 contracts/{socket => protocol}/SocketBatcher.sol | 0 contracts/{socket => protocol}/SocketConfig.sol | 0 contracts/{socket => protocol}/SocketFeeManager.sol | 0 contracts/{socket => protocol}/SocketUtils.sol | 0 contracts/{socket => protocol}/base/PlugBase.sol | 0 contracts/{socket => protocol}/interfaces/IPlug.sol | 0 contracts/{socket => protocol}/interfaces/ISocket.sol | 0 .../{socket => protocol}/interfaces/ISocketBatcher.sol | 0 .../{socket => protocol}/interfaces/ISocketFeeManager.sol | 0 .../{socket => protocol}/interfaces/ISwitchboard.sol | 0 .../{socket => protocol}/switchboard/FastSwitchboard.sol | 0 .../{socket => protocol}/switchboard/SwitchboardBase.sol | 0 test/SetupTest.t.sol | 8 ++++---- test/SocketFeeManager.t.sol | 2 +- test/apps/app-gateways/counter/Counter.sol | 2 +- test/apps/app-gateways/super-token/SuperToken.sol | 2 +- test/mock/MockFastSwitchboard.sol | 5 +++-- test/mock/MockSocket.sol | 4 ++-- 21 files changed, 15 insertions(+), 13 deletions(-) rename contracts/{socket => protocol}/Socket.sol (100%) rename contracts/{socket => protocol}/SocketBatcher.sol (100%) rename contracts/{socket => protocol}/SocketConfig.sol (100%) rename contracts/{socket => protocol}/SocketFeeManager.sol (100%) rename contracts/{socket => protocol}/SocketUtils.sol (100%) rename contracts/{socket => protocol}/base/PlugBase.sol (100%) rename contracts/{socket => protocol}/interfaces/IPlug.sol (100%) rename contracts/{socket => protocol}/interfaces/ISocket.sol (100%) rename contracts/{socket => protocol}/interfaces/ISocketBatcher.sol (100%) rename contracts/{socket => protocol}/interfaces/ISocketFeeManager.sol (100%) rename contracts/{socket => protocol}/interfaces/ISwitchboard.sol (100%) rename contracts/{socket => protocol}/switchboard/FastSwitchboard.sol (100%) rename contracts/{socket => protocol}/switchboard/SwitchboardBase.sol (100%) diff --git a/contracts/evmx/payload-delivery/ContractFactoryPlug.sol b/contracts/evmx/payload-delivery/ContractFactoryPlug.sol index c6e39681..c3691374 100644 --- a/contracts/evmx/payload-delivery/ContractFactoryPlug.sol +++ b/contracts/evmx/payload-delivery/ContractFactoryPlug.sol @@ -8,7 +8,7 @@ import "../../utils/RescueFundsLib.sol"; import {NotSocket} from "../../utils/common/Errors.sol"; import {MAX_COPY_BYTES} from "../../utils/common/Constants.sol"; import "../interfaces/IContractFactoryPlug.sol"; -import "../../socket/base/PlugBase.sol"; +import "../../protocol/base/PlugBase.sol"; /// @title ContractFactory /// @notice Abstract contract for deploying contracts diff --git a/contracts/evmx/payload-delivery/FeesPlug.sol b/contracts/evmx/payload-delivery/FeesPlug.sol index 9eb674f3..8d7fa8a8 100644 --- a/contracts/evmx/payload-delivery/FeesPlug.sol +++ b/contracts/evmx/payload-delivery/FeesPlug.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import "solady/utils/SafeTransferLib.sol"; import "solady/tokens/ERC20.sol"; -import "../../socket/base/PlugBase.sol"; +import "../../protocol/base/PlugBase.sol"; import "../../utils/AccessControl.sol"; import {RESCUE_ROLE} from "../../utils/common/AccessRoles.sol"; import {IFeesPlug} from "../interfaces/IFeesPlug.sol"; @@ -125,6 +125,7 @@ contract FeesPlug is IFeesPlug, PlugBase, AccessControl { ) external onlyOwner { _connectSocket(appGatewayId_, socket_, switchboard_); } + /** * @notice Rescues funds from the contract if they are locked by mistake. This contract does not * theoretically need this function but it is added for safety. diff --git a/contracts/socket/Socket.sol b/contracts/protocol/Socket.sol similarity index 100% rename from contracts/socket/Socket.sol rename to contracts/protocol/Socket.sol diff --git a/contracts/socket/SocketBatcher.sol b/contracts/protocol/SocketBatcher.sol similarity index 100% rename from contracts/socket/SocketBatcher.sol rename to contracts/protocol/SocketBatcher.sol diff --git a/contracts/socket/SocketConfig.sol b/contracts/protocol/SocketConfig.sol similarity index 100% rename from contracts/socket/SocketConfig.sol rename to contracts/protocol/SocketConfig.sol diff --git a/contracts/socket/SocketFeeManager.sol b/contracts/protocol/SocketFeeManager.sol similarity index 100% rename from contracts/socket/SocketFeeManager.sol rename to contracts/protocol/SocketFeeManager.sol diff --git a/contracts/socket/SocketUtils.sol b/contracts/protocol/SocketUtils.sol similarity index 100% rename from contracts/socket/SocketUtils.sol rename to contracts/protocol/SocketUtils.sol diff --git a/contracts/socket/base/PlugBase.sol b/contracts/protocol/base/PlugBase.sol similarity index 100% rename from contracts/socket/base/PlugBase.sol rename to contracts/protocol/base/PlugBase.sol diff --git a/contracts/socket/interfaces/IPlug.sol b/contracts/protocol/interfaces/IPlug.sol similarity index 100% rename from contracts/socket/interfaces/IPlug.sol rename to contracts/protocol/interfaces/IPlug.sol diff --git a/contracts/socket/interfaces/ISocket.sol b/contracts/protocol/interfaces/ISocket.sol similarity index 100% rename from contracts/socket/interfaces/ISocket.sol rename to contracts/protocol/interfaces/ISocket.sol diff --git a/contracts/socket/interfaces/ISocketBatcher.sol b/contracts/protocol/interfaces/ISocketBatcher.sol similarity index 100% rename from contracts/socket/interfaces/ISocketBatcher.sol rename to contracts/protocol/interfaces/ISocketBatcher.sol diff --git a/contracts/socket/interfaces/ISocketFeeManager.sol b/contracts/protocol/interfaces/ISocketFeeManager.sol similarity index 100% rename from contracts/socket/interfaces/ISocketFeeManager.sol rename to contracts/protocol/interfaces/ISocketFeeManager.sol diff --git a/contracts/socket/interfaces/ISwitchboard.sol b/contracts/protocol/interfaces/ISwitchboard.sol similarity index 100% rename from contracts/socket/interfaces/ISwitchboard.sol rename to contracts/protocol/interfaces/ISwitchboard.sol diff --git a/contracts/socket/switchboard/FastSwitchboard.sol b/contracts/protocol/switchboard/FastSwitchboard.sol similarity index 100% rename from contracts/socket/switchboard/FastSwitchboard.sol rename to contracts/protocol/switchboard/FastSwitchboard.sol diff --git a/contracts/socket/switchboard/SwitchboardBase.sol b/contracts/protocol/switchboard/SwitchboardBase.sol similarity index 100% rename from contracts/socket/switchboard/SwitchboardBase.sol rename to contracts/protocol/switchboard/SwitchboardBase.sol diff --git a/test/SetupTest.t.sol b/test/SetupTest.t.sol index 8f7b8f5e..8153cd27 100644 --- a/test/SetupTest.t.sol +++ b/test/SetupTest.t.sol @@ -11,13 +11,13 @@ import "../contracts/evmx/watcherPrecompile/WatcherPrecompileLimits.sol"; import "../contracts/evmx/watcherPrecompile/PayloadHeaderDecoder.sol"; import "../contracts/evmx/interfaces/IForwarder.sol"; import "../contracts/utils/common/AccessRoles.sol"; -import {Socket} from "../contracts/socket/Socket.sol"; -import "../contracts/socket/switchboard/FastSwitchboard.sol"; -import "../contracts/socket/SocketBatcher.sol"; +import {Socket} from "../contracts/protocol/Socket.sol"; +import "../contracts/protocol/switchboard/FastSwitchboard.sol"; +import "../contracts/protocol/SocketBatcher.sol"; import "../contracts/evmx/AddressResolver.sol"; import {ContractFactoryPlug} from "../contracts/evmx/payload-delivery/ContractFactoryPlug.sol"; import {FeesPlug} from "../contracts/evmx/payload-delivery/FeesPlug.sol"; -import {SocketFeeManager} from "../contracts/socket/SocketFeeManager.sol"; +import {SocketFeeManager} from "../contracts/protocol/SocketFeeManager.sol"; import {ETH_ADDRESS} from "../contracts/utils/common/Constants.sol"; import {ResolvedPromises, OnChainFees} from "../contracts/utils/common/Structs.sol"; diff --git a/test/SocketFeeManager.t.sol b/test/SocketFeeManager.t.sol index 2639166b..e81132ca 100644 --- a/test/SocketFeeManager.t.sol +++ b/test/SocketFeeManager.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import {CounterAppGateway} from "./apps/app-gateways/counter/CounterAppGateway.sol"; import {Counter} from "./apps/app-gateways/counter/Counter.sol"; import "./SetupTest.t.sol"; -import {SocketFeeManager} from "../contracts/socket/SocketFeeManager.sol"; +import {SocketFeeManager} from "../contracts/protocol/SocketFeeManager.sol"; import {MockFastSwitchboard} from "./mock/MockFastSwitchboard.sol"; import {ExecuteParams, TransmissionParams, CallType} from "../contracts/utils/common/Structs.sol"; import {GOVERNANCE_ROLE, RESCUE_ROLE} from "../contracts/utils/common/AccessRoles.sol"; diff --git a/test/apps/app-gateways/counter/Counter.sol b/test/apps/app-gateways/counter/Counter.sol index 0a64f2f0..4a089f1e 100644 --- a/test/apps/app-gateways/counter/Counter.sol +++ b/test/apps/app-gateways/counter/Counter.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.21; import "solady/auth/Ownable.sol"; -import "../../../../contracts/socket/base/PlugBase.sol"; +import "../../../../contracts/protocol/base/PlugBase.sol"; interface ICounterAppGateway { function increase(uint256 value_) external returns (bytes32); diff --git a/test/apps/app-gateways/super-token/SuperToken.sol b/test/apps/app-gateways/super-token/SuperToken.sol index 2849a211..e62fdd92 100644 --- a/test/apps/app-gateways/super-token/SuperToken.sol +++ b/test/apps/app-gateways/super-token/SuperToken.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.21; import "solady/tokens/ERC20.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -import "../../../../contracts/socket/base/PlugBase.sol"; +import "../../../../contracts/protocol/base/PlugBase.sol"; /** * @title SuperToken diff --git a/test/mock/MockFastSwitchboard.sol b/test/mock/MockFastSwitchboard.sol index a26cd58e..e516fe3d 100644 --- a/test/mock/MockFastSwitchboard.sol +++ b/test/mock/MockFastSwitchboard.sol @@ -1,8 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "../../contracts/socket/interfaces/ISwitchboard.sol"; -import "../../contracts/socket/interfaces/ISocket.sol"; +import "../../contracts/protocol/interfaces/ISwitchboard.sol"; +import "../../contracts/protocol/interfaces/ISocket.sol"; + contract MockFastSwitchboard is ISwitchboard { address public owner; ISocket public immutable socket__; diff --git a/test/mock/MockSocket.sol b/test/mock/MockSocket.sol index d2fad1ff..027d3c27 100644 --- a/test/mock/MockSocket.sol +++ b/test/mock/MockSocket.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.21; import {InvalidAppGateway} from "../../contracts/utils/common/Errors.sol"; -import "../../contracts/socket/interfaces/ISwitchboard.sol"; -import "../../contracts/socket/interfaces/ISocket.sol"; +import "../../contracts/protocol/interfaces/ISwitchboard.sol"; +import "../../contracts/protocol/interfaces/ISocket.sol"; /** * @title SocketDst