Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: contract size cuts #444

Open
wants to merge 15 commits into
base: atlas-v1.1
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

tests:
needs: ["lint", "build"]
needs: ["build"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
block_gas_limit = 300000000
gas_limit = 3000000000
gas_price = 1500000000
solc_version = "0.8.25"
solc_version = "0.8.28"
evm_version = "cancun"
isolate = false
gas_reports = ["Atlas", "AtlasVerification", "Simulator", "Sorter", "ExecutionEnvironment"]
Expand Down
2 changes: 1 addition & 1 deletion script/base/deploy-base.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/create-oev-demo-positions.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
22 changes: 17 additions & 5 deletions script/deploy-atlas.s.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";

import { DeployBaseScript } from "./base/deploy-base.s.sol";

import { FactoryLib } from "../src/contracts/atlas/FactoryLib.sol";
import { Atlas } from "../src/contracts/atlas/Atlas.sol";
import { AtlasVerification } from "../src/contracts/atlas/AtlasVerification.sol";
import { TxBuilder } from "../src/contracts/helpers/TxBuilder.sol";
Expand All @@ -27,9 +28,9 @@ contract DeployAtlasScript is DeployBaseScript {
address deployer = vm.addr(deployerPrivateKey);

// Computes the addresses at which AtlasVerification will be deployed
address expectedAtlasAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 1);
address expectedAtlasVerificationAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 2);
address expectedSimulatorAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 3);
address expectedAtlasAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 2);
address expectedAtlasVerificationAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 3);
address expectedSimulatorAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 4);

address prevSimAddr = _getAddressFromDeploymentsJson("SIMULATOR");
uint256 prevSimBalance = (prevSimAddr == address(0)) ? 0 : prevSimAddr.balance;
Expand All @@ -40,13 +41,14 @@ contract DeployAtlasScript is DeployBaseScript {
vm.startBroadcast(deployerPrivateKey);

ExecutionEnvironment execEnvTemplate = new ExecutionEnvironment(expectedAtlasAddr);
FactoryLib factoryLib = new FactoryLib(address(execEnvTemplate));
atlas = new Atlas({
escrowDuration: ESCROW_DURATION,
atlasSurchargeRate: ATLAS_SURCHARGE_RATE,
bundlerSurchargeRate: BUNDLER_SURCHARGE_RATE,
verification: expectedAtlasVerificationAddr,
simulator: expectedSimulatorAddr,
executionTemplate: address(execEnvTemplate),
factoryLib: address(factoryLib),
initialSurchargeRecipient: deployer,
l2GasCalculator: address(0)
});
Expand Down Expand Up @@ -110,6 +112,16 @@ contract DeployAtlasScript is DeployBaseScript {
console.log("ERROR: Sorter deployment address is 0x0");
error = true;
}
// Check FactoryLib address set correctly in Atlas
if (address(factoryLib) != atlas.FACTORY_LIB()) {
console.log("ERROR: FactoryLib address not set correctly in Atlas");
error = true;
}
// Check ExecutionEnvironment address set correctly in FactoryLib
if (address(execEnvTemplate) != factoryLib.EXECUTION_ENV_TEMPLATE()) {
console.log("ERROR: ExecutionEnvironment address not set correctly in FactoryLib");
error = true;
}
// Check ESCROW_DURATION was not set to 0
if (atlas.ESCROW_DURATION() == 0) {
console.log("ERROR: ESCROW_DURATION was set to 0");
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-demo-tokens.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-exec-env.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-fl-online-control.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-gas-calculator.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion script/deploy-oev-demo.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-solver.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-sorter.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-swap-intent-control.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-tx-builder.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/deploy-v2-reward-control.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/log-balances.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/mint-demo-tokens.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/set-oev-demo-signers.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/solver-deposit.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import "forge-std/Script.sol";
import "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/atlas/AtlETH.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol";
import { SafeCast } from "openzeppelin-contracts/contracts/utils/math/SafeCast.sol";
Expand Down
7 changes: 3 additions & 4 deletions src/contracts/atlas/Atlas.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol";
import { LibSort } from "solady/utils/LibSort.sol";
Expand Down Expand Up @@ -34,7 +34,7 @@ contract Atlas is Escrow, Factory {
address simulator,
address initialSurchargeRecipient,
address l2GasCalculator,
address executionTemplate
address factoryLib
)
Escrow(
escrowDuration,
Expand All @@ -45,7 +45,7 @@ contract Atlas is Escrow, Factory {
initialSurchargeRecipient,
l2GasCalculator
)
Factory(executionTemplate)
Factory(factoryLib)
{ }

/// @notice metacall is the entrypoint function for the Atlas transactions.
Expand Down Expand Up @@ -371,7 +371,6 @@ contract Atlas is Escrow, Factory {
uint32 callConfig
)
internal
view
override
returns (bool)
{
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/atlas/AtlasVerification.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import { EIP712 } from "openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol";
import { ECDSA } from "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/atlas/DAppIntegration.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import { IDAppControl } from "../interfaces/IDAppControl.sol";
import { IAtlas } from "../interfaces/IAtlas.sol";
Expand Down
6 changes: 3 additions & 3 deletions src/contracts/atlas/Escrow.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;
pragma solidity 0.8.28;

import { AtlETH } from "./AtlETH.sol";
import { IExecutionEnvironment } from "../interfaces/IExecutionEnvironment.sol";
Expand Down Expand Up @@ -573,8 +573,8 @@ abstract contract Escrow is AtlETH {
bool _success;

// Set the solver lock and solver address at the beginning to ensure reliability
_setSolverLock(uint256(uint160(solverOp.from)));
_setSolverTo(solverOp.solver);
t_solverLock = uint256(uint160(solverOp.from));
t_solverTo = solverOp.solver;

// ------------------------------------- //
// Pre-Solver Call //
Expand Down
Loading
Loading