Skip to content

Commit

Permalink
use latest nitro package
Browse files Browse the repository at this point in the history
  • Loading branch information
fredlacs committed Jul 6, 2022
1 parent c1bb0bc commit 3b3fc59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
34 changes: 14 additions & 20 deletions packages/arb-bridge-eth/contracts/bridge/NitroMigrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,15 @@ import "../libraries/NitroReadyQuery.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/proxy/ProxyAdmin.sol";
import "@arbitrum/nitro-contracts/src/bridge/IBridgeNoErrors.sol" as INitroBridge;
import "@arbitrum/nitro-contracts/src/bridge/IInboxNoErrors.sol" as INitroInbox;

pragma solidity ^0.6.11;

interface INitroBridge is IBridge {
function acceptFundsFromOldBridge() external payable;
}

interface INitroInbox is IInbox {
function postUpgradeInit(INitroBridge) external;
}

interface INitroRollup {
function bridge() external view returns (INitroBridge);
function bridge() external view returns (INitroBridge.IBridge);

function inbox() external view returns (INitroInbox);
function inbox() external view returns (INitroInbox.IInbox);

function setInbox(IInbox newInbox) external;
}
Expand All @@ -59,7 +53,7 @@ contract NitroMigrator is Ownable {
// assumed this contract is now the rollup admin
RollupAdminFacet public rollup;

INitroBridge public nitroBridge;
INitroBridge.IBridge public nitroBridge;

/// @dev The nitro migration includes various steps.
///
Expand Down Expand Up @@ -135,15 +129,16 @@ contract NitroMigrator is Ownable {

// Upgrade the classic inbox to the nitro inbox's impl,
// and configure nitro to use the classic inbox's address.
INitroInbox oldNitroInbox = nitroRollup.inbox();
INitroInbox.IInbox oldNitroInbox = nitroRollup.inbox();
address nitroInboxImpl = proxyAdmin.getProxyImplementation(
TransparentUpgradeableProxy(payable(address(oldNitroInbox)))
);
nitroBridge.setInbox(address(oldNitroInbox), false);
// TODO: shouldn't this already be set to false by default?
nitroBridge.setDelayedInbox(address(oldNitroInbox), false);
proxyAdmin.upgradeAndCall(
TransparentUpgradeableProxy(payable(address(inbox))),
nitroInboxImpl,
abi.encodeWithSelector(INitroInbox.postUpgradeInit.selector, nitroBridge)
abi.encodeWithSelector(INitroInbox.IInbox.postUpgradeInit.selector, nitroBridge)
);
nitroRollup.setInbox(inbox);

Expand All @@ -155,10 +150,7 @@ contract NitroMigrator is Ownable {
/// it is assumed that at this point the sequencer has stopped receiving txs and has posted its final batch on-chain
/// Before this step the ownership of the Rollup and Bridge must have been transferred to this contract
// CHRIS: TODO: remove bridge data
function nitroStep1(address[] calldata seqAddresses, bytes calldata bridgeData)
external
onlyOwner
{
function nitroStep1(address[] calldata seqAddresses) external onlyOwner {
require(latestCompleteStep == NitroMigrationSteps.Step0, "WRONG_STEP");

// check that ownership of the bridge and rollup has been transferred
Expand Down Expand Up @@ -186,7 +178,7 @@ contract NitroMigrator is Ownable {
(bool success, ) = bridge.executeCall(
address(nitroBridge),
bal,
abi.encodeWithSelector(INitroBridge.acceptFundsFromOldBridge.selector)
abi.encodeWithSelector(INitroBridge.IBridge.acceptFundsFromOldBridge.selector)
);
require(success, "ESCROW_TRANSFER_FAIL");
}
Expand Down Expand Up @@ -230,7 +222,9 @@ contract NitroMigrator is Ownable {
"ROLLUP_SHUTDOWN_NOT_COMPLETE"
);

nitroBridge.setInbox(address(inbox), true);
// TODO: enable sequencer inbox in nitro bridge
// TODO: will there be a rollup event bridge for nitro?
nitroBridge.setDelayedInbox(address(inbox), true);
nitroBridge.setOutbox(address(outboxV1), true);
nitroBridge.setOutbox(address(outboxV2), true);

Expand Down
2 changes: 1 addition & 1 deletion packages/arb-bridge-eth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"hardhat": "hardhat --config hardhat.config.ts"
},
"dependencies": {
"@arbitrum/nitro-contracts": "1.0.0-beta.5",
"@arbitrum/nitro-contracts": "https://gitpkg.now.sh/OffchainLabs/nitro/contracts?678866136ca917ed20dd3f0ee23176bb7bb7bd49",
"@openzeppelin/contracts": "3.4.2",
"@openzeppelin/contracts-0.8": "npm:@openzeppelin/contracts@^4.3.2",
"@openzeppelin/contracts-upgradeable": "3.4.2",
Expand Down
14 changes: 3 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
# yarn lockfile v1


"@arbitrum/[email protected]":
version "1.0.0-beta.5"
resolved "https://registry.yarnpkg.com/@arbitrum/nitro-contracts/-/nitro-contracts-1.0.0-beta.5.tgz#b4ca2a8d99b8a108e7dc412f6c2cb74818d5099a"
integrity sha512-hEpRXIL8S6AfTt6dqJsKCa84JufhuXuRgm2BnximdRrhJ8ukqR6Pt/mndYMa4nWRRTBMYkIxy6EA5iYxDwxWAQ==
"@arbitrum/nitro-contracts@https://gitpkg.now.sh/OffchainLabs/nitro/contracts?678866136ca917ed20dd3f0ee23176bb7bb7bd49":
version "1.0.0-beta.8"
resolved "https://gitpkg.now.sh/OffchainLabs/nitro/contracts?678866136ca917ed20dd3f0ee23176bb7bb7bd49#ccacdf6e00feb1a8af23c0938b2f00ead2ee69fd"
dependencies:
"@openzeppelin/contracts" "4.5.0"
"@openzeppelin/contracts-upgradeable" "4.5.2"
Expand Down Expand Up @@ -1624,13 +1623,6 @@ aproba@^1.0.3:
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==

arbos-precompiles@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/arbos-precompiles/-/arbos-precompiles-1.0.2.tgz#7bebd5963aef972cd259eb41f3116ea065013ea6"
integrity sha512-1dOFYFJUN0kKoofh6buZJ8qCqTs+oLGSsGzHI0trA/Pka/TCERflCRsNVxez2lihOvK7MT/a2RA8AepKtBXdPQ==
dependencies:
hardhat "^2.6.4"

are-we-there-yet@~1.1.2:
version "1.1.7"
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz#b15474a932adab4ff8a50d9adfa7e4e926f21146"
Expand Down

0 comments on commit 3b3fc59

Please sign in to comment.