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

Sync to integration #17

Merged
merged 8 commits into from
Jan 13, 2025
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
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:

test-contract-size:
name: Test Contract Size
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -43,6 +44,7 @@ jobs:
test-gas-check:
name: Test Gas Check
runs-on: ubuntu-latest
if: false
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -57,6 +59,7 @@ jobs:

test-sigs:
name: Test Signatures
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -72,6 +75,7 @@ jobs:

test-storage:
name: Test Storage
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -81,6 +85,6 @@ jobs:
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- run: yarn minimal-install
- run: yarn test:storage
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/nitro-contracts"]
path = lib/nitro-contracts
url = https://github.com/EspressoSystems/nitro-contracts
branch = develop
[submodule "lib/arbitrum-sdk"]
path = lib/arbitrum-sdk
url = https://github.com/OffchainLabs/arbitrum-sdk
[submodule "lib/nitro-contracts"]
path = lib/nitro-contracts
url = https://github.com/EspressoSystems/nitro-contracts

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions contracts/child-chain/espresso-migration/SetChainConfig.s.sol

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "forge-std/Script.sol";
Expand All @@ -19,15 +19,15 @@ contract DeployAndInitEspressoSequencerInbox is Script {
uint256 maxDataSize = vm.envUint("MAX_DATA_SIZE");
// Grab booleans we need from env
bool isUsingFeeToken = vm.envBool("IS_USING_FEE_TOKEN");
// Trick the Vm into seeing that this opcode exsists and
// Trick the Vm into seeing that this opcode exsists and
bytes memory code = vm.getDeployedCode("ArbSysMock.sol:ArbSysMock");
vm.etch(0x0000000000000000000000000000000000000064, code);
// initialize interfaces needed
IReader4844 reader = IReader4844(reader4844Addr);
// Start broadcast to deploy the SequencerInbox
vm.startBroadcast(deployerPrivateKey);
SequencerInbox sequencerInbox = new SequencerInbox(maxDataSize, reader, isUsingFeeToken);

// Setting batch posters and batch poster manager
vm.stopBroadcast();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ contract DeployEspressoSequencerMigrationAction is Script {
address oldBatchPosterAddr = vm.envAddress("OLD_BATCH_POSTER_ADDRESS");
address newBatchPosterAddr = vm.envAddress("NEW_BATCH_POSTER_ADDRESS");
address batchPosterManagerAddr = vm.envAddress("BATCH_POSTER_MANAGER_ADDRESS");

bool isRevert = vm.envBool("IS_REVERT");
vm.startBroadcast(deployerPrivateKey);
EspressoSequencerInboxMigrationAction migrationAction =
new EspressoSequencerInboxMigrationAction(newSequencerInboxImplAddr, rollupAddr, proxyAdminAddr, espressoTeeVerifierAddr, oldBatchPosterAddr, newBatchPosterAddr, batchPosterManagerAddr);
EspressoSequencerInboxMigrationAction migrationAction = new EspressoSequencerInboxMigrationAction(
newSequencerInboxImplAddr,
rollupAddr,
proxyAdminAddr,
espressoTeeVerifierAddr,
oldBatchPosterAddr,
newBatchPosterAddr,
batchPosterManagerAddr,
isRevert
);
vm.stopBroadcast();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,30 @@ contract EspressoSequencerInboxMigrationAction {
address public immutable oldBatchPosterAddr;
address public immutable newBatchPosterAddr;
address public immutable batchPosterManager;
bool public immutable isRevert;

error AddressIsNotContract(address incorrectAddr);

error OldBatchPosterMustNotBeZeroAddr();

error NewBatchPosterMustNotBeZeroAddr();

error MaxTimeVariationNotSet();

error SequencerInboxNotUpgraded(address oldSequencerInboxAddr);

error espressoTEEVerifierNotSet();

constructor(address _newSequencerInboxImpl, address _rollup, address _proxyAdminAddr, address _espressoTEEVerifier, address _oldBatchPosterAddr, address _newBatchPosterAddr, address _batchPosterManager) {
constructor(
address _newSequencerInboxImpl,
address _rollup,
address _proxyAdminAddr,
address _espressoTEEVerifier,
address _oldBatchPosterAddr,
address _newBatchPosterAddr,
address _batchPosterManager,
bool _isRevert
) {
// If the new impl addresses are contracts, we need to revert
if (!Address.isContract(_newSequencerInboxImpl)) {
revert AddressIsNotContract(_newSequencerInboxImpl);
Expand All @@ -54,15 +64,15 @@ contract EspressoSequencerInboxMigrationAction {
revert AddressIsNotContract(_proxyAdminAddr);
}

if (!Address.isContract(_espressoTEEVerifier)){
if (!Address.isContract(_espressoTEEVerifier)) {
revert AddressIsNotContract(_espressoTEEVerifier);
}

if (_oldBatchPosterAddr == address(0x0)){
if (_oldBatchPosterAddr == address(0x0)) {
revert OldBatchPosterMustNotBeZeroAddr();
}
if (_newBatchPosterAddr == address(0x0)){

if (_newBatchPosterAddr == address(0x0)) {
revert NewBatchPosterMustNotBeZeroAddr();
}

Expand All @@ -79,7 +89,8 @@ contract EspressoSequencerInboxMigrationAction {
newBatchPosterAddr = _newBatchPosterAddr;

batchPosterManager = _batchPosterManager;


isRevert = _isRevert;
}

function perform() public {
Expand All @@ -89,7 +100,7 @@ contract EspressoSequencerInboxMigrationAction {

TransparentUpgradeableProxy sequencerInbox =
TransparentUpgradeableProxy(payable(address(rollupCore.sequencerInbox())));

// migrate the rollup to the new sequencer inbox
proxyAdmin.upgrade(sequencerInbox, newSequencerInboxImpl);

Expand All @@ -98,22 +109,24 @@ contract EspressoSequencerInboxMigrationAction {
if (proxyImpl != newSequencerInboxImpl) {
revert SequencerInboxNotUpgraded(proxyImpl);
}

SequencerInbox proxyInbox = SequencerInbox(address(rollupCore.sequencerInbox()));
// Set the TEE verifier address
proxyInbox.setEspressoTEEVerifier(espressoTEEVerifier);
if (!isRevert) {
proxyInbox.setEspressoTEEVerifier(espressoTEEVerifier);
}
// Remove the permissions for the old batch poster addresses
proxyInbox.setIsBatchPoster(oldBatchPosterAddr, false);
// Whitelist the new batch posters address to enable it to post batches
// Whitelist the new batch posters address to enable it to post batches
proxyInbox.setIsBatchPoster(newBatchPosterAddr, true);
// Set the batch poster manager.
if (batchPosterManager != address(0x0)){
proxyInbox.setBatchPosterManager(batchPosterManager);
if (batchPosterManager != address(0x0)) {
proxyInbox.setBatchPosterManager(batchPosterManager);
}

address proxyTEEVerifierAddr = address(proxyInbox.espressoTEEVerifier());
if (proxyTEEVerifierAddr != espressoTEEVerifier) {
revert espressoTEEVerifierNotSet();
if (!isRevert && (proxyTEEVerifierAddr != espressoTEEVerifier)) {
revert espressoTEEVerifierNotSet();
}
}
}
26 changes: 17 additions & 9 deletions contracts/tests/EspressoMigrationAction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,30 @@ contract MigrationTest is Test {
function test_migrateToEspresso() public {
//begin by seting pre-requisites in the vm so the test can get the data it needs.
IRollupCore rollup = IRollupCore(rollupAddress);

address upgradeExecutorExpectedAddress = computeCreateAddress(address(rollupCreator), 4);
//ensure we have the correct address for the proxy admin
ProxyAdmin admin = ProxyAdmin(_getProxyAdmin(address(rollup.sequencerInbox())));
address adminAddr = _getProxyAdmin(address(rollup.sequencerInbox()));

assertEq(admin.owner(), upgradeExecutorExpectedAddress, "Invalid proxyAdmin's owner");

IUpgradeExecutor _upgradeExecutor = IUpgradeExecutor(upgradeExecutorExpectedAddress);

bytes memory data =
abi.encodeWithSelector(EspressoSequencerInboxMigrationAction.perform.selector);

address migration = address(new EspressoSequencerInboxMigrationAction(newSequencerImplAddress, rollupAddress, adminAddr, mockTEEVerifier, oldBatchPosterAddr, newBatchPosterAddr, batchPosterManagerAddr));
bytes memory data = abi.encodeWithSelector(EspressoSequencerInboxMigrationAction.perform.selector);

address migration = address(
new EspressoSequencerInboxMigrationAction(
newSequencerImplAddress,
rollupAddress,
adminAddr,
mockTEEVerifier,
oldBatchPosterAddr,
newBatchPosterAddr,
batchPosterManagerAddr,
false
)
);

vm.prank(rollupOwner);
_upgradeExecutor.execute(migration, data);
Expand All @@ -196,8 +206,6 @@ contract MigrationTest is Test {
"Sequencer Inbox has not been updated"
);
SequencerInbox proxyInbox = SequencerInbox(address(rollup.sequencerInbox()));
assertEq(
mockTEEVerifier, address(proxyInbox.espressoTEEVerifier())
);
assertEq(mockTEEVerifier, address(proxyInbox.espressoTEEVerifier()));
}
}
3 changes: 2 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const config: HardhatUserConfig = {
solidity: getSolidityConfigFromFoundryToml(
process.env.FOUNDRY_PROFILE || 'default'
),

networks: {
fork: {
url: process.env.FORK_URL || 'http://localhost:8545',
Expand Down Expand Up @@ -46,11 +47,11 @@ function getSolidityConfigFromFoundryToml(profile: string): SolidityUserConfig {
const solidity = {
version: profileConfig?.solc_version || defaultConfig.solc_version,
settings: {
viaIR: true,
optimizer: {
enabled: true,
runs: profileConfig?.optimizer_runs || defaultConfig.optimizer_runs,
},
viaIR: true,
},
}

Expand Down
2 changes: 1 addition & 1 deletion lib/arbitrum-sdk
Submodule arbitrum-sdk updated 75 files
+2 −2 .env-sample
+22 −41 .github/workflows/build-test.yml
+4 −0 .gitignore
+100 −73 README.md
+15 −58 audit-ci.jsonc
+0 −198 docs/1-introduction.mdx
+0 −198 docs/2-migrate.mdx
+7 −11 package.json
+1 −1 scripts/cancelRetryable.ts
+3 −3 scripts/deployStandard.ts
+1 −15 scripts/genAbi.js
+13 −30 scripts/genNetwork.ts
+32 −12 scripts/instantiate_bridge.ts
+17 −18 scripts/lib.ts
+5 −5 scripts/redeemRetryable.ts
+4 −4 scripts/sendL2SignedMsg.ts
+84 −54 scripts/testSetup.ts
+4 −4 scripts/upgrade_weth.ts
+28 −67 src/index.ts
+0 −2,077 src/lib/abi-bold/BoldRollupUserLogic.ts
+0 −2,175 src/lib/abi-bold/factories/BoldRollupUserLogic__factory.ts
+28 −27 src/lib/assetBridger/assetBridger.ts
+308 −531 src/lib/assetBridger/erc20Bridger.ts
+86 −107 src/lib/assetBridger/ethBridger.ts
+0 −1,642 src/lib/assetBridger/l1l3Bridger.ts
+0 −24 src/lib/dataEntities/constants.ts
+1 −1 src/lib/dataEntities/message.ts
+515 −381 src/lib/dataEntities/networks.ts
+23 −27 src/lib/dataEntities/transactionRequest.ts
+77 −123 src/lib/inbox/inbox.ts
+0 −333 src/lib/message/ChildToParentMessage.ts
+0 −768 src/lib/message/ChildToParentMessageNitro.ts
+178 −203 src/lib/message/L1ToL2Message.ts
+57 −73 src/lib/message/L1ToL2MessageCreator.ts
+58 −77 src/lib/message/L1ToL2MessageGasEstimator.ts
+87 −101 src/lib/message/L1Transaction.ts
+317 −0 src/lib/message/L2ToL1Message.ts
+88 −100 src/lib/message/L2ToL1MessageClassic.ts
+573 −0 src/lib/message/L2ToL1MessageNitro.ts
+44 −44 src/lib/message/L2Transaction.ts
+1 −2 src/lib/utils/byte_serialize_params.ts
+0 −32 src/lib/utils/calldata.ts
+32 −105 src/lib/utils/lib.ts
+32 −2 src/lib/utils/multicall.ts
+0 −6 src/lib/utils/types.ts
+3 −6 tests/fork/inbox.test.ts
+12 −12 tests/integration/L1ToL2MessageGasEstimator.test.ts
+64 −89 tests/integration/custom-fee-token/customFeeTokenEthBridger.test.ts
+24 −42 tests/integration/custom-fee-token/customFeeTokenTestHelpers.ts
+2 −2 tests/integration/custom-fee-token/mochaExtensions.ts
+121 −158 tests/integration/customerc20.test.ts
+93 −240 tests/integration/eth.test.ts
+47 −0 tests/integration/ethBridgeAddresses.test.ts
+0 −85 tests/integration/getArbitrumNetworkInformationFromRollup.test.ts
+161 −0 tests/integration/l1ToL2MessageCreator.test.ts
+0 −1,056 tests/integration/l1l3Bridger.test.ts
+21 −50 tests/integration/l2TransactionReceipt.test.ts
+0 −169 tests/integration/parentToChildMessageCreator.test.ts
+35 −49 tests/integration/retryableData.test.ts
+52 −56 tests/integration/sanity.test.ts
+0 −149 tests/integration/sendChildmsg.test.ts
+143 −0 tests/integration/sendL2msg.test.ts
+81 −78 tests/integration/standarderc20.test.ts
+140 −185 tests/integration/testHelpers.ts
+41 −45 tests/integration/weth.test.ts
+0 −64 tests/unit/calldata.test.ts
+0 −144 tests/unit/childBlocksForL1Block.test.ts
+17 −23 tests/unit/l1toL2MessageEvents.test.ts
+136 −0 tests/unit/l2BlocksForL1Block.test.ts
+24 −27 tests/unit/l2toL1MessageEvents.test.ts
+9 −12 tests/unit/multicall.test.ts
+0 −117 tests/unit/nativeToken.test.ts
+223 −157 tests/unit/network.test.ts
+4 −0 theme/style.css
+143 −536 yarn.lock
2 changes: 1 addition & 1 deletion lib/forge-std
Loading
Loading