Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c91c5af
test: revenue sharing upgrade unit tests
Oct 1, 2025
dab3095
chore: remove temp file after creation in test
Oct 1, 2025
dddf761
chore: remove fork block number
Oct 2, 2025
3986eb1
chore: remove logs
Oct 2, 2025
432ae73
fix: compiler warnings
Oct 2, 2025
352e47a
refactor: cleanup
Oct 2, 2025
4619a0c
refactor: cleanup
Oct 2, 2025
663e174
test: improve opt out scenario tests
Oct 2, 2025
2b68c6f
test: add task for revshare opt out scenario
Oct 2, 2025
d0a501f
fix: regression test
Oct 2, 2025
d269699
chore: remove portal calls struct
Oct 2, 2025
69db45e
refactor: conventional test naming
Oct 2, 2025
b88760b
test: remove mock call from opt out scenario
Oct 2, 2025
254c9c6
refactor: reuse portal calls verifier function
Oct 2, 2025
7d20d2d
test: expected calls with config data
Oct 3, 2025
9ac3368
style: formatting
Oct 3, 2025
5f6c01a
fix: correct variables naming
Oct 3, 2025
b1bf26d
chore: remove redundant comments
Oct 3, 2025
1129106
Merge branch 'sc-feat/revshare-setup' into test/unit-revenue-share-up…
Oct 6, 2025
584d1e6
fix: same task id for examples
Oct 6, 2025
741e0e7
test: add integration tests (not working)
Oct 7, 2025
7aa9b76
fix: wrong folder naming breaking tests
Oct 7, 2025
4c7bcd4
style: formatting
Oct 7, 2025
4020201
test: expect portal events
Oct 7, 2025
bac5d2c
Merge branch 'test/unit-revenue-share-upgrade' into test/integration-…
Oct 7, 2025
dff53cf
test: integration tests
Oct 7, 2025
5681c2c
Merge branch 'sc-feat/revshare-setup' into test/unit-revenue-share-up…
Oct 7, 2025
3de7a1d
test: add simulation
Oct 8, 2025
d2ec8e6
fix: revert due to resource metering
Oct 8, 2025
f48949a
fix: wrong deployment approach
Oct 8, 2025
621e727
test: use simulate
Oct 8, 2025
1d674d7
Merge branch 'sc-feat/revshare-setup' into test/integration-supersim-…
Oct 8, 2025
8857d0b
Merge branch 'sc-feat/revshare-setup' into test/integration-supersim-…
Oct 9, 2025
e490955
test: add tenderly simulations logs
Oct 10, 2025
9ea7747
test: refactor and add opt out path
Oct 10, 2025
b99556f
Merge branch 'sc-feat/revshare-setup' into test/unit-revenue-share-up…
Oct 10, 2025
b575a04
Merge branch 'test/unit-revenue-share-upgrade' into test/integration-…
Oct 10, 2025
c2f80ca
chore: updates the bytecode for vaults, using initialize instead of c…
0xiamflux Oct 14, 2025
d6822b7
chore: remove unused vars
Oct 14, 2025
16d7b98
chore: remove unused deployment gas limit var in opt out revshare config
Oct 14, 2025
a28b513
style: add underscore prefix on function and stack vars
Oct 14, 2025
c1f6eaa
test: add gas limit
Oct 14, 2025
c7b2cee
refactor: improve approach for simulations
Oct 14, 2025
6a69642
docs: add tenderly simulations doc
Oct 15, 2025
8e6cc8d
test: revenue sharing upgrade unit tests (#22)
0xChin Oct 15, 2025
211c2f4
chore: update regression tests
0xiamflux Oct 15, 2025
1559a8c
chore: fmt check
0xiamflux Oct 15, 2025
7d3508c
Merge branch 'sc-feat/revshare-setup' into chore/initialize-vaults-ov…
0xiamflux Oct 15, 2025
2a5c0c4
test: add revenue share upgrade path assertions
Oct 15, 2025
807a28d
docs: add gas from tenderly new simulations
Oct 15, 2025
1c66183
Merge branch 'sc-feat/revshare-setup' into test/integration-supersim-…
Oct 15, 2025
4602d3f
style: formatting
Oct 15, 2025
68f0b51
fix: broken regression tests
Oct 16, 2025
3ecc691
Merge branch 'chore/initialize-vaults-over-constructor' into test/int…
Oct 16, 2025
338981a
chore: improve vars naming'
Oct 16, 2025
c5c2ef0
chore: remove unused imports
Oct 16, 2025
72c41b8
docs: add natspec
Oct 16, 2025
3f639a0
test: assert correct calculator address when opting in
Oct 16, 2025
3e3d48f
fix: broken late opt in task for low gas limits
Oct 16, 2025
9fabf01
test: add late opt in scenarios integration tests
Oct 16, 2025
f28a4a9
Merge branch 'sc-feat/revshare-setup' into test/integration-revshare-…
Oct 16, 2025
a930147
Merge branch 'sc-feat/revshare-setup' into test/integration-revshare-…
Oct 17, 2025
c2aff0b
refactor: add library with rev share calls gas limits
Oct 17, 2025
5e8b558
chore: remove late optin gas limit tests (it is hardcoded now)
Oct 17, 2025
e899c9c
fix: compiler errorr
Oct 17, 2025
ed23ae2
style: formatting
Oct 17, 2025
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
34 changes: 34 additions & 0 deletions src/libraries/RevShareGasLimits.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

/// @notice Library for storing the gas limits for the calls done in the Revenue Share templates
library RevShareGasLimits {
/// @notice Based on deployment tests, these are the average gas costs for each of the L2 operations:
/// - L1Withdrawer deployment: 497,812
/// - SC Rev Share Calculator deployment: 518,168
/// - Fee Vaults deployment: 757,214
/// - Fee Splitter deployment: 1,027,359
/// - upgradeAndCall: 73,015
/// - upgrade: 6,202
/// - setters: TODO: add this after simulating in tenderly
/// A buffer of ~20% is applied to each value to have enough margin. While leaving the upgrade call
/// to a fixed 150,000 gas limit.

/// @notice The gas limit for the SC Rev Share Calculator deployment.
uint64 internal constant SC_REV_SHARE_CALCULATOR_DEPLOYMENT_GAS_LIMIT = 625_000;

/// @notice The gas limit for the L1 Withdrawer deployment.
uint64 internal constant L1_WITHDRAWER_DEPLOYMENT_GAS_LIMIT = 625_000;

/// @notice The gas limit for the Fee Vaults deployment.
uint64 internal constant FEE_VAULTS_DEPLOYMENT_GAS_LIMIT = 910_000;

/// @notice The gas limit for the Fee Splitter deployment.
uint64 internal constant FEE_SPLITTER_DEPLOYMENT_GAS_LIMIT = 1_235_000;

/// @notice The gas limit for the upgrade calls on L2.
uint64 internal constant UPGRADE_GAS_LIMIT = 150_000;

/// @notice The gas limit for the Fee Vaults deployment.
uint64 internal constant SETTERS_GAS_LIMIT = 50_000;
}
60 changes: 42 additions & 18 deletions src/template/LateOptInRevenueShare.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Action} from "src/libraries/MultisigTypes.sol";
import {RevShareCodeRepo} from "src/libraries/RevShareCodeRepo.sol";
import {Utils} from "src/libraries/Utils.sol";
import {MultisigTaskPrinter} from "src/libraries/MultisigTaskPrinter.sol";
import {RevShareGasLimits} from "src/libraries/RevShareGasLimits.sol";

/// @notice Interface for the OptimismPortal2 in L1. This is the main interaction point for the template.
interface IOptimismPortal2 {
Expand Down Expand Up @@ -133,11 +134,6 @@ contract LateOptInRevenueShare is SimpleTaskBase {

useOwnCalculator = _toml.readBool(".useOwnCalculator");

uint256 _gasLimitRaw = _toml.readUint(".gasLimit");
require(_gasLimitRaw > 0, "gasLimit must be set");
require(_gasLimitRaw <= type(uint64).max, "gasLimit must be less than uint64.max");
gasLimit = uint64(_gasLimitRaw);

if (useOwnCalculator) {
calculator = _toml.readAddress(".calculator");
require(
Expand All @@ -150,7 +146,7 @@ contract LateOptInRevenueShare is SimpleTaskBase {
(
address(FEE_SPLITTER),
0,
gasLimit,
RevShareGasLimits.SETTERS_GAS_LIMIT,
false,
abi.encodeCall(IFeeSplitter.setSharesCalculator, (calculator))
)
Expand Down Expand Up @@ -183,7 +179,13 @@ contract LateOptInRevenueShare is SimpleTaskBase {
_incrementCallsToPortal(
abi.encodeCall(
IOptimismPortal2.depositTransaction,
(address(CREATE2_DEPLOYER), 0, gasLimit, false, _l1WithdrawerCalldata)
(
address(CREATE2_DEPLOYER),
0,
RevShareGasLimits.L1_WITHDRAWER_DEPLOYMENT_GAS_LIMIT,
false,
_l1WithdrawerCalldata
)
)
);

Expand All @@ -205,7 +207,13 @@ contract LateOptInRevenueShare is SimpleTaskBase {
_incrementCallsToPortal(
abi.encodeCall(
IOptimismPortal2.depositTransaction,
(address(CREATE2_DEPLOYER), 0, gasLimit, false, _scRevShareCalculatorCalldata)
(
address(CREATE2_DEPLOYER),
0,
RevShareGasLimits.SC_REV_SHARE_CALCULATOR_DEPLOYMENT_GAS_LIMIT,
false,
_scRevShareCalculatorCalldata
)
)
);
}
Expand All @@ -223,7 +231,7 @@ contract LateOptInRevenueShare is SimpleTaskBase {
(
address(FEE_SPLITTER),
0,
gasLimit,
RevShareGasLimits.SETTERS_GAS_LIMIT,
false,
abi.encodeCall(IFeeSplitter.setSharesCalculator, (calculator))
)
Expand All @@ -235,12 +243,20 @@ contract LateOptInRevenueShare is SimpleTaskBase {
if (!useOwnCalculator) {
// Deploy L1 Withdrawer
IOptimismPortal2(payable(portal)).depositTransaction(
address(CREATE2_DEPLOYER), 0, gasLimit, false, _l1WithdrawerCalldata
address(CREATE2_DEPLOYER),
0,
RevShareGasLimits.L1_WITHDRAWER_DEPLOYMENT_GAS_LIMIT,
false,
_l1WithdrawerCalldata
);

// Deploy SC Rev Share Calculator
IOptimismPortal2(payable(portal)).depositTransaction(
address(CREATE2_DEPLOYER), 0, gasLimit, false, _scRevShareCalculatorCalldata
address(CREATE2_DEPLOYER),
0,
RevShareGasLimits.SC_REV_SHARE_CALCULATOR_DEPLOYMENT_GAS_LIMIT,
false,
_scRevShareCalculatorCalldata
);
}

Expand All @@ -265,7 +281,7 @@ contract LateOptInRevenueShare is SimpleTaskBase {
bytes memory _feeSplitterSetCalculatorCalldata = abi.encodeCall(IFeeSplitter.setSharesCalculator, (calculator));

IOptimismPortal2(payable(portal)).depositTransaction(
address(FEE_SPLITTER), 0, gasLimit, false, _feeSplitterSetCalculatorCalldata
address(FEE_SPLITTER), 0, RevShareGasLimits.SETTERS_GAS_LIMIT, false, _feeSplitterSetCalculatorCalldata
);
}

Expand Down Expand Up @@ -306,19 +322,21 @@ contract LateOptInRevenueShare is SimpleTaskBase {
abi.encodeCall(IFeeVault.setMinWithdrawalAmount, (_minWithdrawalAmount));

IOptimismPortal2(payable(portal)).depositTransaction(
_vaultAddress, 0, gasLimit, false, _minWithdrawalAmountCalldata
_vaultAddress, 0, RevShareGasLimits.SETTERS_GAS_LIMIT, false, _minWithdrawalAmountCalldata
);

// Set the recipient calldata
bytes memory _recipientCalldata = abi.encodeCall(IFeeVault.setRecipient, (_recipient));

IOptimismPortal2(payable(portal)).depositTransaction(_vaultAddress, 0, gasLimit, false, _recipientCalldata);
IOptimismPortal2(payable(portal)).depositTransaction(
_vaultAddress, 0, RevShareGasLimits.SETTERS_GAS_LIMIT, false, _recipientCalldata
);

// Set the withdrawal network calldata
bytes memory _withdrawalNetworkCalldata = abi.encodeCall(IFeeVault.setWithdrawalNetwork, (_withdrawalNetwork));

IOptimismPortal2(payable(portal)).depositTransaction(
_vaultAddress, 0, gasLimit, false, _withdrawalNetworkCalldata
_vaultAddress, 0, RevShareGasLimits.SETTERS_GAS_LIMIT, false, _withdrawalNetworkCalldata
);
}

Expand All @@ -331,7 +349,7 @@ contract LateOptInRevenueShare is SimpleTaskBase {
(
_vaultAddress,
0,
gasLimit,
RevShareGasLimits.SETTERS_GAS_LIMIT,
false,
abi.encodeCall(IFeeVault.setMinWithdrawalAmount, (FEE_VAULT_MIN_WITHDRAWAL_AMOUNT))
)
Expand All @@ -340,7 +358,13 @@ contract LateOptInRevenueShare is SimpleTaskBase {
_incrementCallsToPortal(
abi.encodeCall(
IOptimismPortal2.depositTransaction,
(_vaultAddress, 0, gasLimit, false, abi.encodeCall(IFeeVault.setRecipient, (FEE_VAULT_RECIPIENT)))
(
_vaultAddress,
0,
RevShareGasLimits.SETTERS_GAS_LIMIT,
false,
abi.encodeCall(IFeeVault.setRecipient, (FEE_VAULT_RECIPIENT))
)
)
);
_incrementCallsToPortal(
Expand All @@ -349,7 +373,7 @@ contract LateOptInRevenueShare is SimpleTaskBase {
(
_vaultAddress,
0,
gasLimit,
RevShareGasLimits.SETTERS_GAS_LIMIT,
false,
abi.encodeCall(IFeeVault.setWithdrawalNetwork, (FEE_VAULT_WITHDRAWAL_NETWORK))
)
Expand Down
Loading