Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
| `InvalidIndex()` | `0x63df8171` |
| `InvalidChainSlug()` | `0xbff6b106` |
| `InvalidPayloadSize()` | `0xfbdf7954` |
| `InvalidOnChainAddress()` | `0xb758c606` |
| `InvalidScheduleDelay()` | `0x9a993219` |
| `AuctionClosed()` | `0x36b6b46d` |
| `AuctionNotOpen()` | `0xf0460077` |
Expand Down
1 change: 1 addition & 0 deletions FunctionSignatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@
| `requestOwnershipHandover` | `0x25692962` |
| `rescueFunds` | `0x6ccae054` |
| `setPrecompile` | `0x122e0042` |
| `setRequestPayloadCountLimit` | `0x8526582b` |
| `submitRequest` | `0xbb299a2c` |
| `transferOwnership` | `0xf2fde38b` |
| `updateRequestAndProcessBatch` | `0x46464471` |
Expand Down
6 changes: 2 additions & 4 deletions contracts/evmx/base/AppGatewayBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway {
return address(0);
}

onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_])
.getOnChainAddress();
onChainAddress = IForwarder(forwarderAddresses[contractId_][chainSlug_]).getOnChainAddress();
}

////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -234,13 +233,12 @@ abstract contract AppGatewayBase is AddressResolverUtil, IAppGateway {
uint32 chainSlug_,
address token_,
uint256 amount_,
uint256 maxFees_,
address receiver_
) internal {
AppGatewayApprovals[] memory approvals = new AppGatewayApprovals[](1);
approvals[0] = AppGatewayApprovals({appGateway: address(feesManager__()), approval: true});
feesManager__().approveAppGateways(approvals);
feesManager__().withdrawCredits(chainSlug_, token_, amount_, maxFees_, receiver_);
feesManager__().withdrawCredits(chainSlug_, token_, amount_, maxFees, receiver_);
}

////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 0 additions & 1 deletion contracts/evmx/helpers/AsyncDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ abstract contract AsyncDeployerStorage is IAsyncDeployer {

/// @title AsyncDeployer Contract
/// @notice This contract is responsible for deploying Forwarder and AsyncPromise contracts.
/// @dev Inherits the AccessControl contract and implements the IAddressResolver interface.
contract AsyncDeployer is AsyncDeployerStorage, Initializable, AddressResolverUtil, Ownable {
constructor() {
_disableInitializers(); // disable for implementation
Expand Down
3 changes: 2 additions & 1 deletion contracts/evmx/helpers/Forwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "../interfaces/IAddressResolver.sol";
import "../interfaces/IAppGateway.sol";
import "../interfaces/IForwarder.sol";
import {QueueParams, OverrideParams, Transaction} from "../../utils/common/Structs.sol";
import {AsyncModifierNotSet, WatcherNotSet} from "../../utils/common/Errors.sol";
import {AsyncModifierNotSet, WatcherNotSet, InvalidOnChainAddress} from "../../utils/common/Errors.sol";
import "../../utils/RescueFundsLib.sol";

/// @title Forwarder Storage
Expand Down Expand Up @@ -44,6 +44,7 @@ contract Forwarder is ForwarderStorage, Initializable, AddressResolverUtil {
address onChainAddress_,
address addressResolver_
) public reinitializer(1) {
if (onChainAddress_ == address(0)) revert InvalidOnChainAddress();
chainSlug = chainSlug_;
onChainAddress = onChainAddress_;
_setAddressResolver(addressResolver_);
Expand Down
12 changes: 10 additions & 2 deletions contracts/evmx/watcher/RequestHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract contract RequestHandlerStorage is IRequestHandler {
// slots [0-49] reserved for gap
uint256[50] _gap_before;

// slot 50 (40 + 40 + 40)
// slot 50 (40 + 40 + 40 + 128)
/// @notice Counter for tracking request counts
uint40 public nextRequestCount = 1;

Expand All @@ -26,6 +26,9 @@ abstract contract RequestHandlerStorage is IRequestHandler {
/// @notice Counter for tracking batch counts
uint40 public nextBatchCount;

/// @notice max number of payloads in single request
uint128 requestPayloadCountLimit;

// slot 51
/// @notice Mapping to store the precompiles for each call type
mapping(bytes4 => IPrecompile) public precompiles;
Expand Down Expand Up @@ -88,6 +91,7 @@ contract RequestHandler is RequestHandlerStorage, Initializable, Ownable, Addres
}

function initialize(address owner_, address addressResolver_) external reinitializer(1) {
requestPayloadCountLimit = 100;
_initializeOwner(owner_);
_setAddressResolver(addressResolver_);
}
Expand All @@ -96,6 +100,10 @@ contract RequestHandler is RequestHandlerStorage, Initializable, Ownable, Addres
precompiles[callType_] = precompile_;
}

function setRequestPayloadCountLimit(uint128 requestPayloadCountLimit_) external onlyOwner {
requestPayloadCountLimit = requestPayloadCountLimit_;
}

function getPrecompileFees(
bytes4 callType_,
bytes memory precompileData_
Expand Down Expand Up @@ -128,7 +136,7 @@ contract RequestHandler is RequestHandlerStorage, Initializable, Ownable, Addres
bytes memory onCompleteData_
) external onlyWatcher returns (uint40 requestCount, address[] memory promiseList) {
if (queueParams_.length == 0) return (0, new address[](0));
if (queueParams_.length > REQUEST_PAYLOAD_COUNT_LIMIT)
if (queueParams_.length > requestPayloadCountLimit)
revert RequestPayloadCountLimitExceeded();

if (!feesManager__().isCreditSpendable(consumeFrom_, appGateway_, maxFees_))
Expand Down
1 change: 1 addition & 0 deletions contracts/evmx/watcher/Watcher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ contract Watcher is Trigger {
address consumeFrom,
bytes memory onCompleteData
) internal returns (uint40 requestCount, address[] memory promiseList) {
if (payloadQueue.length == 0) return (0, new address[](0));
address appGateway = msg.sender;

// this check is to verify that msg.sender (app gateway base) belongs to correct app gateway
Expand Down
1 change: 0 additions & 1 deletion contracts/utils/common/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ bytes4 constant SCHEDULE = bytes4(keccak256("SCHEDULE"));
bytes32 constant CALLBACK = keccak256("CALLBACK");
bytes32 constant FAST = keccak256("FAST");

uint256 constant REQUEST_PAYLOAD_COUNT_LIMIT = 10;
uint256 constant PAYLOAD_SIZE_LIMIT = 24_500;
uint16 constant MAX_COPY_BYTES = 2048; // 2KB
1 change: 1 addition & 0 deletions contracts/utils/common/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ error InvalidTarget();
error InvalidIndex();
error InvalidChainSlug();
error InvalidPayloadSize();
error InvalidOnChainAddress();
error InvalidScheduleDelay();
/// @notice Error thrown when trying to start or bid a closed auction
error AuctionClosed();
Expand Down
72 changes: 35 additions & 37 deletions deployments/dev_addresses.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
{
"421614": {
"ContractFactoryPlug": "0xaCd26f991E548F353f285942509d90200064Cf14",
"FastSwitchboard": "0xbcc1CE144cA85C0d121f08634547a61E93627ce4",
"FeesPlug": "0xb0cbd56A86568BB4cBBE59B0EcA029A4F2D7f235",
"Socket": "0xEb907f52eAF6e81439F8807AE2F143Bd3482e6b6",
"SocketBatcher": "0xc498A63eE84143A15A7D3080E1E51af700f35e41",
"startBlock": 159285686,
"TestUSDC": "0x2321BF7AdFaf49b1338F1Cd474859dBc0D8dfA96"
"ContractFactoryPlug": "0x7b9928b01272b915050aDfcba7e0a11b22271BAd",
"FastSwitchboard": "0x2974E94c0d1323D3A24f7B4F924fbdB325Be1aa3",
"FeesPlug": "0x6FdF04Cbcbd40414BF12e0b4Ce0e331e4657EB03",
"Socket": "0xb7378ae43b135988C8a83dfD1AcD71Ff39381396",
"SocketBatcher": "0x60541d31Fda60163480CAb486be3762b5793B650",
"startBlock": 159641867
},
"7625382": {
"AddressResolver": "0xF7efc3886b225A571d35C2DF736eD515F132911F",
"AddressResolverImpl": "0x865A24Cf706027639124489e0dA2A28766efB96A",
"AsyncDeployer": "0xC1A87C08d86bE83323F071362Cf4f48C946b9d00",
"AsyncDeployerImpl": "0xF4f5606189Bc091528680b2ca1c82167641d3cAf",
"AuctionManager": "0xEdf413851964c6Ac5154FA768F3e54e9BeB777dB",
"AuctionManagerImpl": "0x1C40B5d5f6E9be1Ca4557d92cb7dba35e721a322",
"Configurations": "0x5A6c10F1c7bEf419022be7c2F716CC4628cBa3Cf",
"ConfigurationsImpl": "0x8d41aBDbE6Bbd208D68Dd4E671c4B72474525C7B",
"DeployForwarder": "0xD0d5BAF888afE7F857B5AeF74A63bE7416B742eE",
"DeployForwarderImpl": "0xD9CF47342c8a256fcD8B51aaABA810cd5D05F726",
"ERC1967Factory": "0x1b0F1aA38F8BBbe779A6C1fCe7e3Ff00380fa9CE",
"FeesManager": "0x07653B23F84aB397649378BB512bd82D19D9D6F1",
"FeesManagerImpl": "0x255fBaD02F8f2Aae0Faf7074249a8701371890D2",
"AddressResolver": "0x8161cDBa2d2fCE66307254AAC1d42966D4F5353E",
"AddressResolverImpl": "0x91e548d87768313C03da8405D01171b83912c430",
"AsyncDeployer": "0x025b308371dC1C5e337527f96BE46Ba6A12c774A",
"AsyncDeployerImpl": "0x80CFbD3B6134Fb2D2B7d21FC132a9F7c115e7B72",
"AuctionManager": "0xA40aFA1632328D84226084a4539B3869D2B68e28",
"AuctionManagerImpl": "0x42109F6212765ABeb589f9b2c14Bee4b8DB3e638",
"Configurations": "0x60185198097df249B504D5A164323eBF42B3764d",
"ConfigurationsImpl": "0x0d2646fC08af29A7799Af435c5ABBA1b020C4dC7",
"DeployForwarder": "0xdC51D652B8c3cCB3cAAB9C1E2704fD4D62E76433",
"DeployForwarderImpl": "0xCe95fca954a0BF43c299c79d5152f2c164C02b7A",
"ERC1967Factory": "0xb0364Fd8f158071831ac87E7EE2C792Ab509a524",
"FeesManager": "0x09F824Eae77f71279d73Ae24FEb2163FCe88B25D",
"FeesManagerImpl": "0x6975302A1B7aF61d89F85a13855B66D15221Cf8D",
"FeesPool": "0xc20Be67ef742202dc93A78aa741E7C3715eA1DFd",
"PromiseResolver": "0xF24B41A8C9F814d70FAD9E617CE32C74EcCB1A25",
"ReadPrecompile": "0xddeEDDD5F156123fDbf77B86A66A043568AEfcda",
"RequestHandler": "0x52968Eb279aad2287aF4C9a4638C146F91787958",
"RequestHandlerImpl": "0x1fa5D12C7dC1F3615c28B842A6053f5f151230F8",
"SchedulePrecompile": "0xDa60303321dc6aA8AeF32557bDe914008a3196eC",
"startBlock": 8263673,
"Watcher": "0x60005b459Dc46D9a63bcb61D01Ad002130644a4F",
"WatcherImpl": "0x812EcdF5366036B045e41Fe2dD95B72ecc26d8f3",
"WritePrecompile": "0xF221bAA9AEA24c366258309ab09C2C7ce80610Fc",
"WritePrecompileImpl": "0x09A1A0A7BB8266171855871c4c0Af200a30922BE"
"PromiseResolver": "0xcfFda1dF8668266E6A77809EcA9CCA8A632ecaF3",
"ReadPrecompile": "0x254Dc9e0623426A79F02D2001E367cd32B50aaaA",
"RequestHandler": "0x1FE7527a8620374B3Fdb101bA1D56eC46EC9a24A",
"RequestHandlerImpl": "0x3d9578B252ed1F5A66348Cc40E482dacc32Ae790",
"SchedulePrecompile": "0x7D6F2A4aDf7e5Cfcf9627CC7FCA1d39fD19C07fc",
"startBlock": 8355289,
"Watcher": "0xD5b30DC89D96ee7303Dc2726491996B46089F693",
"WatcherImpl": "0xFa9B9271A4153eEABa76ae10bfc4F128651c25D7",
"WritePrecompile": "0x10eaDbd1a2787ebbF4Abe9b6D79e669C0c8E8B26",
"WritePrecompileImpl": "0xD3aEb53da0a72788C16eAf5a23a5aBae6708C073"
},
"11155420": {
"ContractFactoryPlug": "0xf134E3a725DdbBebf9e0f66D6767B44468cdBB48",
"FastSwitchboard": "0xa2E9eC2B0e035650744B6F489e8dDd471B502b2b",
"FeesPlug": "0x64b7157Fe0878880b180d9BD2a0bd0D1794Cf44A",
"Socket": "0xd8C787c27Cc6F4BF143855Bb50c880FB2DE38267",
"SocketBatcher": "0xc6Fe653dAfeDd76d50e3F971dDA650917824f948",
"startBlock": 28522517,
"TestUSDC": "0x15dbE4B96306Cc9Eba15D834d6c1a895cF4e1697"
"ContractFactoryPlug": "0x0279A18d5FC235A92fB4ABd5F7e9258e78E27948",
"FastSwitchboard": "0x6b4EF1452265193798bfa3ef6D29421da9e7E222",
"FeesPlug": "0x99f7441292EB7f0b127Db204ba269Abd9F912d4C",
"Socket": "0xB260A4DD0952e9A5b5F6652019469F05Fb137dC5",
"SocketBatcher": "0xc320FC7b06D4491A9E7e6fa55a3305b12548519e",
"startBlock": 28568337
}
}
Loading