Skip to content

Commit

Permalink
Deploy blob reader and SequencerInbox
Browse files Browse the repository at this point in the history
  • Loading branch information
gvladika committed Feb 28, 2024
1 parent e5abbd5 commit 439ccee
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 33 deletions.
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ libs = ['node_modules', 'lib']
test = 'test'
cache_path = 'cache_forge'
solc_version = '0.8.16'
optimizer_runs = 2000
optimizer_runs = 2000
fs_permissions = [{ access = "read", path = "node_modules/@arbitrum/nitro-contracts/out/yul/Reader4844.yul/Reader4844.json"}]
32 changes: 0 additions & 32 deletions scripts/foundry/1.2.1/DeployOspAndChallengeManagerScript.s.sol

This file was deleted.

63 changes: 63 additions & 0 deletions scripts/foundry/upgrade/1.2.1/Deployer.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "forge-std/Script.sol";
import {OneStepProver0} from "@arbitrum/nitro-contracts/src/osp/OneStepProver0.sol";
import {OneStepProverMemory} from "@arbitrum/nitro-contracts/src/osp/OneStepProverMemory.sol";
import {OneStepProverMath} from "@arbitrum/nitro-contracts/src/osp/OneStepProverMath.sol";
import {OneStepProverHostIo} from "@arbitrum/nitro-contracts/src/osp/OneStepProverHostIo.sol";
import {OneStepProofEntry} from "@arbitrum/nitro-contracts/src/osp/OneStepProofEntry.sol";
import {ChallengeManager} from "@arbitrum/nitro-contracts/src/challenge/ChallengeManager.sol";
import {SequencerInbox} from "@arbitrum/nitro-contracts/src/bridge/SequencerInbox.sol";
import {IReader4844} from "@arbitrum/nitro-contracts/src/libraries/IReader4844.sol";

/**
* @title DeployScript
* @notice This script deploys OSPs and ChallengeManager templates,
*/
contract DeployScript is Script {
function run() public {
uint256 _chainId = block.chainid;
if (_chainId == 42161 || _chainId == 42170 || _chainId == 421614) {
revert("Chain ID not supported");
}

vm.startBroadcast();

// deploy OSP templates
OneStepProver0 osp0 = new OneStepProver0();
OneStepProverMemory ospMemory = new OneStepProverMemory();
OneStepProverMath ospMath = new OneStepProverMath();
OneStepProverHostIo ospHostIo = new OneStepProverHostIo();
new OneStepProofEntry(osp0, ospMemory, ospMath, ospHostIo);

// deploy new challenge manager templates
new ChallengeManager();

// deploy blob reader
bytes memory reader4844Bytecode = _getReader4844Bytecode();
address reader4844Address;
assembly {
reader4844Address := create(0, add(reader4844Bytecode, 0x20), mload(reader4844Bytecode))
}
require(reader4844Address != address(0), "Reader4844 could not be deployed");

// deploy sequencer inbox template
new SequencerInbox({_maxDataSize: 117964, reader4844_: IReader4844(reader4844Address), _isUsingFeeToken: false});

vm.stopBroadcast();
}

/**
* @notice Read Reader4844 bytecode from JSON file at ${root}/out/yul/Reader4844.yul/Reader4844.json
*/
function _getReader4844Bytecode() internal returns (bytes memory) {
string memory readerBytecodeFilePath = string(
abi.encodePacked(
vm.projectRoot(), "/node_modules/@arbitrum/nitro-contracts/out/yul/Reader4844.yul/Reader4844.json"
)
);
string memory json = vm.readFile(readerBytecodeFilePath);
return vm.parseJsonBytes(json, ".bytecode.object");
}
}

0 comments on commit 439ccee

Please sign in to comment.