diff --git a/.prettierrc.js b/.prettierrc.js index 5392936b..917ddb37 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,3 +1,11 @@ +let solOptions = { + tabWidth: 4, + printWidth: 100, + singleQuote: false, + bracketSpacing: false, + compiler: '0.8.9', +} + module.exports = { semi: false, trailingComma: 'es5', @@ -7,15 +15,38 @@ module.exports = { arrowParens: 'avoid', bracketSpacing: true, overrides: [ + { files: '*.sol', options: solOptions }, + { + files: 'src/bridge/SequencerInbox.sol', + options: { ...solOptions, compiler: '0.8.24' }, + }, + { + files: 'src/rollup/BridgeCreator.sol', + options: { ...solOptions, compiler: '0.8.24' }, + }, + { + files: 'src/rollup/RollupCreator.sol', + options: { ...solOptions, compiler: '0.8.24' }, + }, + { + files: 'src/mocks/SequencerInboxStub.sol', + options: { ...solOptions, compiler: '0.8.24' }, + }, + { + files: 'src/libraries/GasRefundEnabled.sol', + options: { ...solOptions, compiler: '0.8.24' }, + }, + { + files: 'src/libraries/BlobDataHashReader.sol', + options: { ...solOptions, compiler: '0.8.24' }, + }, + { + files: 'src/rollup/ValidatorWallet.sol', + options: { ...solOptions, compiler: '0.8.24' }, + }, { - files: '*.sol', - options: { - tabWidth: 4, - printWidth: 100, - singleQuote: false, - bracketSpacing: false, - compiler: '0.8.9', - }, + files: 'src/rollup/ValidatorWalletCreator.sol', + options: { ...solOptions, compiler: '0.8.24' }, }, ], } diff --git a/deploy/SequencerInboxStubCreator.js b/deploy/SequencerInboxStubCreator.js index e61a227c..014d8efb 100644 --- a/deploy/SequencerInboxStubCreator.js +++ b/deploy/SequencerInboxStubCreator.js @@ -6,9 +6,6 @@ module.exports = async hre => { const { deployer } = await getNamedAccounts() const bridge = await ethers.getContract('BridgeStub') - const reader4844 = await Toolkit4844.deployReader4844( - await ethers.getSigner(deployer) - ) const maxTime = { delayBlocks: 10000, futureBlocks: 10000, @@ -17,14 +14,7 @@ module.exports = async hre => { } await deploy('SequencerInboxStub', { from: deployer, - args: [ - bridge.address, - deployer, - maxTime, - 117964, - reader4844.address, - false, - ], + args: [bridge.address, deployer, maxTime, 117964, false], }) } diff --git a/foundry.toml b/foundry.toml index 774b6a24..f20e5385 100644 --- a/foundry.toml +++ b/foundry.toml @@ -7,13 +7,8 @@ cache_path = 'forge-cache/sol' optimizer = true optimizer_runs = 20000 via_ir = false -solc_version = '0.8.9' - -[profile.yul] -src = 'yul' -out = 'out/yul' -libs = ['node_modules', 'lib'] -cache_path = 'forge-cache/yul' +solc_version = '0.8.24' +evm_version = 'cancun' [fmt] number_underscore = 'thousands' diff --git a/hardhat.config.ts b/hardhat.config.ts index 401a29b3..6d458782 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -11,6 +11,17 @@ import dotenv from 'dotenv' dotenv.config() +const cancunSolSettings = { + version: '0.8.24', + settings: { + evmVersion: 'cancun', + optimizer: { + enabled: true, + runs: 500, + }, + }, +} + const solidity = { compilers: [ { @@ -23,7 +34,16 @@ const solidity = { }, }, ], - overrides: {}, + overrides: { + 'src/bridge/SequencerInbox.sol': cancunSolSettings, + 'src/rollup/BridgeCreator.sol': cancunSolSettings, + 'src/rollup/RollupCreator.sol': cancunSolSettings, + 'src/mocks/SequencerInboxStub.sol': cancunSolSettings, + 'src/libraries/GasRefundEnabled.sol': cancunSolSettings, + 'src/libraries/BlobDataHashReader.sol': cancunSolSettings, + 'src/rollup/ValidatorWallet.sol': cancunSolSettings, + 'src/rollup/ValidatorWalletCreator.sol': cancunSolSettings, + }, } if (process.env['INTERFACE_TESTER_SOLC_VERSION']) { @@ -36,14 +56,12 @@ if (process.env['INTERFACE_TESTER_SOLC_VERSION']) { }, }, }) - solidity.overrides = { - 'src/test-helpers/InterfaceCompatibilityTester.sol': { - version: process.env['INTERFACE_TESTER_SOLC_VERSION'], - settings: { - optimizer: { - enabled: true, - runs: 100, - }, + solidity.overrides['src/test-helpers/InterfaceCompatibilityTester.sol'] = { + version: process.env['INTERFACE_TESTER_SOLC_VERSION'], + settings: { + optimizer: { + enabled: true, + runs: 100, }, }, } diff --git a/package.json b/package.json index 6f649956..bc59a3e7 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,7 @@ "prepublishOnly": "hardhat clean && hardhat compile", "build:all": "yarn build && yarn build:forge", "build": "hardhat compile", - "build:forge:sol": "forge build --skip *.yul", - "build:forge:yul": "FOUNDRY_PROFILE=yul forge build --skip *.sol", - "build:forge": "yarn build:forge:sol && yarn build:forge:yul", + "build:forge": "forge build", "lint:test": "eslint ./test", "solhint": "solhint -f table src/**/*.sol", "prettier:solidity": "prettier --write src/**/*.sol", diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index f69b8f0b..22f456d3 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -2,7 +2,7 @@ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 -pragma solidity ^0.8.0; +pragma solidity ^0.8.24; import { AlreadyInit, @@ -42,12 +42,12 @@ import "../rollup/IRollupLogic.sol"; import "./Messages.sol"; import "../precompiles/ArbGasInfo.sol"; import "../precompiles/ArbSys.sol"; -import "../libraries/IReader4844.sol"; import {L1MessageType_batchPostingReport} from "../libraries/MessageTypes.sol"; import "../libraries/DelegateCallAware.sol"; import {IGasRefunder} from "../libraries/IGasRefunder.sol"; import {GasRefundEnabled} from "../libraries/GasRefundEnabled.sol"; +import {BlobDataHashReader} from "../libraries/BlobDataHashReader.sol"; import "../libraries/ArbitrumChecker.sol"; import {IERC20Bridge} from "./IERC20Bridge.sol"; @@ -109,7 +109,6 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox } mapping(address => bool) public isSequencer; - IReader4844 public immutable reader4844; // see ISequencerInbox.MaxTimeVariation uint64 internal delayBlocks; @@ -128,18 +127,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox // True if the chain this SequencerInbox is deployed on uses custom fee token bool public immutable isUsingFeeToken; - constructor( - uint256 _maxDataSize, - IReader4844 reader4844_, - bool _isUsingFeeToken - ) { + constructor(uint256 _maxDataSize, bool _isUsingFeeToken) { maxDataSize = _maxDataSize; - if (hostChainIsArbitrum) { - if (reader4844_ != IReader4844(address(0))) revert DataBlobsNotSupported(); - } else { - if (reader4844_ == IReader4844(address(0))) revert InitParamZero("Reader4844"); - } - reader4844 = reader4844_; isUsingFeeToken = _isUsingFeeToken; } @@ -366,7 +355,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox IGasRefunder gasRefunder, uint256 prevMessageCount, uint256 newMessageCount - ) external refundsGas(gasRefunder, IReader4844(address(0))) { + ) external refundsGas(gasRefunder, false) { // solhint-disable-next-line avoid-tx-origin if (msg.sender != tx.origin) revert NotOrigin(); if (!isBatchPoster[msg.sender]) revert NotBatchPoster(); @@ -417,7 +406,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox IGasRefunder gasRefunder, uint256 prevMessageCount, uint256 newMessageCount - ) external refundsGas(gasRefunder, reader4844) { + ) external refundsGas(gasRefunder, true) { if (!isBatchPoster[msg.sender]) revert NotBatchPoster(); ( bytes32 dataHash, @@ -479,7 +468,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox IGasRefunder gasRefunder, uint256 prevMessageCount, uint256 newMessageCount - ) external override refundsGas(gasRefunder, IReader4844(address(0))) { + ) external override refundsGas(gasRefunder, false) { if (!isBatchPoster[msg.sender] && msg.sender != address(rollup)) revert NotBatchPoster(); (bytes32 dataHash, IBridge.TimeBounds memory timeBounds) = formCallDataHash( data, @@ -622,14 +611,14 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox uint256 ) { - bytes32[] memory dataHashes = reader4844.getDataHashes(); + bytes32[] memory dataHashes = BlobDataHashReader.getDataHashes(); if (dataHashes.length == 0) revert MissingDataHashes(); (bytes memory header, IBridge.TimeBounds memory timeBounds) = packHeader( afterDelayedMessagesRead ); - uint256 blobCost = reader4844.getBlobBaseFee() * GAS_PER_BLOB * dataHashes.length; + uint256 blobCost = block.blobbasefee * GAS_PER_BLOB * dataHashes.length; return ( keccak256(bytes.concat(header, DATA_BLOB_HEADER_FLAG, abi.encodePacked(dataHashes))), timeBounds, diff --git a/src/libraries/BlobDataHashReader.sol b/src/libraries/BlobDataHashReader.sol new file mode 100644 index 00000000..c908de35 --- /dev/null +++ b/src/libraries/BlobDataHashReader.sol @@ -0,0 +1,41 @@ +// Copyright 2021-2022, Offchain Labs, Inc. +// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity ^0.8.0; + +library BlobDataHashReader { + /// @notice Gets all the data blob hashes on this transaction + /// @dev Will revert if called on chains that do not support the 4844 blobhash opcode + function getDataHashes() internal view returns (bytes32[] memory) { + bytes32[] memory dataHashes; + // we use assembly so that we can push into a memory array without resizing + assembly { + // get the free mem pointer + let dataHashesPtr := mload(0x40) + // and keep track of the number of hashes + let i := 0 + // prettier-ignore + for { } 1 { } { + let h := blobhash(i) + // the blob hash opcode returns 0 where no blob hash exists for that index + if iszero(h) { + break + } + // we will fill the first slot with the array size + // so we store the hashes after that + mstore(add(dataHashesPtr, add(mul(i, 32), 32)), h) + i := add(i, 1) + } + // store the hash count + mstore(dataHashesPtr, i) + + // update the free mem pointer + let size := add(mul(i, 32), 32) + mstore(0x40, add(dataHashesPtr, size)) + + dataHashes := dataHashesPtr + } + return dataHashes; + } +} diff --git a/src/libraries/GasRefundEnabled.sol b/src/libraries/GasRefundEnabled.sol index 60287ee0..303e7d24 100644 --- a/src/libraries/GasRefundEnabled.sol +++ b/src/libraries/GasRefundEnabled.sol @@ -2,10 +2,9 @@ // For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE // SPDX-License-Identifier: BUSL-1.1 -// solhint-disable-next-line compiler-version pragma solidity ^0.8.0; -import "./IReader4844.sol"; +import "./BlobDataHashReader.sol"; import "./IGasRefunder.sol"; abstract contract GasRefundEnabled { @@ -14,7 +13,7 @@ abstract contract GasRefundEnabled { /// @dev this refunds the sender for execution costs of the tx /// calldata costs are only refunded if `msg.sender == tx.origin` to guarantee the value refunded relates to charging /// for the `tx.input`. this avoids a possible attack where you generate large calldata from a contract and get over-refunded - modifier refundsGas(IGasRefunder gasRefunder, IReader4844 reader4844) { + modifier refundsGas(IGasRefunder gasRefunder, bool includeBlobCosts) { uint256 startGasLeft = gasleft(); _; if (address(gasRefunder) != address(0)) { @@ -32,17 +31,20 @@ abstract contract GasRefundEnabled { } else { // for similar reasons to above we only refund blob gas when the tx.origin is the msg.sender // this avoids the caller being able to send blobs to other contracts and still get refunded here - if (address(reader4844) != address(0)) { + + // since 4844 may not be enabled on this chain we do not want to always call the + // blobhash or blobbasefee opcodes. We can only detect the presence of these opcodes without reverting + // by either doing a call and checking success or providing a bool for specific code paths. We go for + // the bool approach as it's cheaper + if (includeBlobCosts) { // add any cost for 4844 data, the data hash reader throws an error prior to 4844 being activated // we do this addition here rather in the GasRefunder so that we can check the msg.sender is the tx.origin - try reader4844.getDataHashes() returns (bytes32[] memory dataHashes) { - if (dataHashes.length != 0) { - uint256 blobBasefee = reader4844.getBlobBaseFee(); - startGasLeft += - (dataHashes.length * gasPerBlob * blobBasefee) / - block.basefee; - } - } catch {} + bytes32[] memory dataHashes = BlobDataHashReader.getDataHashes(); + if (dataHashes.length != 0 && block.basefee > 0) { + startGasLeft += + (dataHashes.length * gasPerBlob * block.blobbasefee) / + block.basefee; + } } } diff --git a/src/libraries/IReader4844.sol b/src/libraries/IReader4844.sol deleted file mode 100644 index a66ebae5..00000000 --- a/src/libraries/IReader4844.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma solidity >=0.6.9 <0.9.0; - -interface IReader4844 { - /// @notice Returns the current BLOBBASEFEE - function getBlobBaseFee() external view returns (uint256); - - /// @notice Returns all the data hashes of all the blobs on the current transaction - function getDataHashes() external view returns (bytes32[] memory); -} diff --git a/src/mocks/SequencerInboxStub.sol b/src/mocks/SequencerInboxStub.sol index e78d9479..88db5f00 100644 --- a/src/mocks/SequencerInboxStub.sol +++ b/src/mocks/SequencerInboxStub.sol @@ -14,9 +14,8 @@ contract SequencerInboxStub is SequencerInbox { address sequencer_, ISequencerInbox.MaxTimeVariation memory maxTimeVariation_, uint256 maxDataSize_, - IReader4844 reader4844_, bool isUsingFeeToken_ - ) SequencerInbox(maxDataSize_, reader4844_, isUsingFeeToken_) { + ) SequencerInbox(maxDataSize_, isUsingFeeToken_) { bridge = bridge_; rollup = IOwnable(msg.sender); delayBlocks = maxTimeVariation_.delayBlocks; diff --git a/src/rollup/ValidatorWallet.sol b/src/rollup/ValidatorWallet.sol index 0d7cbace..21d90c34 100644 --- a/src/rollup/ValidatorWallet.sol +++ b/src/rollup/ValidatorWallet.sol @@ -110,7 +110,7 @@ contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware, GasRefundEnab bytes[] calldata data, address[] calldata destination, uint256[] calldata amount - ) public payable onlyExecutorOrOwner refundsGas(gasRefunder, IReader4844(address(0))) { + ) public payable onlyExecutorOrOwner refundsGas(gasRefunder, false) { uint256 numTxes = data.length; if (numTxes != destination.length) revert BadArrayLength(numTxes, destination.length); if (numTxes != amount.length) revert BadArrayLength(numTxes, amount.length); @@ -145,7 +145,7 @@ contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware, GasRefundEnab bytes calldata data, address destination, uint256 amount - ) public payable onlyExecutorOrOwner refundsGas(gasRefunder, IReader4844(address(0))) { + ) public payable onlyExecutorOrOwner refundsGas(gasRefunder, false) { if (data.length > 0) require(destination.isContract(), "NO_CODE_AT_ADDR"); validateExecuteTransaction(destination); // We use a low level call here to allow for contract and non-contract calls @@ -169,7 +169,7 @@ contract ValidatorWallet is OwnableUpgradeable, DelegateCallAware, GasRefundEnab IGasRefunder gasRefunder, IChallengeManager manager, uint64[] calldata challenges - ) public onlyExecutorOrOwner refundsGas(gasRefunder, IReader4844(address(0))) { + ) public onlyExecutorOrOwner refundsGas(gasRefunder, false) { uint256 challengesCount = challenges.length; for (uint256 i = 0; i < challengesCount; i++) { try manager.timeout(challenges[i]) {} catch (bytes memory error) { diff --git a/test/contract/sequencerInbox.spec.4844.ts b/test/contract/sequencerInbox.spec.4844.ts index 643b43cc..88cac452 100644 --- a/test/contract/sequencerInbox.spec.4844.ts +++ b/test/contract/sequencerInbox.spec.4844.ts @@ -282,14 +282,8 @@ describe('SequencerInbox', async () => { await rollupOwner.getAddress() ) - const reader4844 = await Toolkit4844.deployReader4844(fundingWallet) - const sequencerInboxFac = new SequencerInbox__factory(deployer) - const seqInboxTemplate = await sequencerInboxFac.deploy( - 117964, - reader4844.address, - false - ) + const seqInboxTemplate = await sequencerInboxFac.deploy(117964, false) const inboxFac = new Inbox__factory(deployer) const inboxTemplate = await inboxFac.deploy(117964) diff --git a/test/contract/sequencerInboxForceInclude.spec.ts b/test/contract/sequencerInboxForceInclude.spec.ts index 92b1df6f..db729f61 100644 --- a/test/contract/sequencerInboxForceInclude.spec.ts +++ b/test/contract/sequencerInboxForceInclude.spec.ts @@ -232,15 +232,10 @@ describe('SequencerInboxForceInclude', async () => { )) as RollupMock__factory const rollup = await rollupMockFac.deploy(await rollupOwner.getAddress()) - const reader4844 = await Toolkit4844.deployReader4844(admin) const sequencerInboxFac = (await ethers.getContractFactory( 'SequencerInbox' )) as SequencerInbox__factory - const seqInboxTemplate = await sequencerInboxFac.deploy( - 117964, - reader4844.address, - false - ) + const seqInboxTemplate = await sequencerInboxFac.deploy(117964, false) const inboxFac = (await ethers.getContractFactory( 'Inbox' )) as Inbox__factory diff --git a/test/contract/toolkit4844.ts b/test/contract/toolkit4844.ts index b0271641..3f35b859 100644 --- a/test/contract/toolkit4844.ts +++ b/test/contract/toolkit4844.ts @@ -1,9 +1,7 @@ import { execSync } from 'child_process' -import { ContractFactory, Signer, Wallet, ethers } from 'ethers' +import { ContractFactory, Signer, ethers } from 'ethers' import * as http from 'http' -import { IReader4844, IReader4844__factory } from '../../build/types' import { JsonRpcProvider } from '@ethersproject/providers' -import { bytecode as Reader4844Bytecode } from '../../out/yul/Reader4844.yul/Reader4844.json' const wait = async (ms: number) => new Promise((res, rej) => { @@ -121,16 +119,4 @@ export class Toolkit4844 { throw new Error('Error sending blob tx:\n' + res) } } - - public static async deployReader4844(wallet: Signer): Promise { - const contractFactory = new ContractFactory( - IReader4844__factory.abi, - Reader4844Bytecode, - wallet - ) - const reader4844 = await contractFactory.deploy() - await reader4844.deployed() - - return IReader4844__factory.connect(reader4844.address, wallet) - } } diff --git a/test/foundry/BridgeCreator.t.sol b/test/foundry/BridgeCreator.t.sol index 58e4928d..7f55a261 100644 --- a/test/foundry/BridgeCreator.t.sol +++ b/test/foundry/BridgeCreator.t.sol @@ -13,14 +13,12 @@ contract BridgeCreatorTest is Test { BridgeCreator public creator; address public owner = address(100); uint256 public constant MAX_DATA_SIZE = 117_964; - IReader4844 dummyReader4844 = IReader4844(address(137)); BridgeCreator.BridgeContracts ethBasedTemplates = BridgeCreator.BridgeContracts({ bridge: new Bridge(), sequencerInbox: new SequencerInbox( MAX_DATA_SIZE, - dummyReader4844, false ), inbox: new Inbox(MAX_DATA_SIZE), @@ -32,7 +30,6 @@ contract BridgeCreatorTest is Test { bridge: new ERC20Bridge(), sequencerInbox: new SequencerInbox( MAX_DATA_SIZE, - dummyReader4844, true ), inbox: new ERC20Inbox(MAX_DATA_SIZE), diff --git a/test/foundry/RollupCreator.t.sol b/test/foundry/RollupCreator.t.sol index 591f04aa..959e9ebe 100644 --- a/test/foundry/RollupCreator.t.sol +++ b/test/foundry/RollupCreator.t.sol @@ -27,7 +27,6 @@ contract RollupCreatorTest is Test { IRollupAdmin public rollupAdmin; IRollupUser public rollupUser; DeployHelper public deployHelper; - IReader4844 dummyReader4844 = IReader4844(address(137)); // 1 gwei uint256 public constant MAX_FEE_PER_GAS = 1_000_000_000; @@ -37,7 +36,6 @@ contract RollupCreatorTest is Test { bridge: new Bridge(), sequencerInbox: new SequencerInbox( MAX_DATA_SIZE, - dummyReader4844, false ), inbox: new Inbox(MAX_DATA_SIZE), @@ -48,7 +46,6 @@ contract RollupCreatorTest is Test { bridge: new ERC20Bridge(), sequencerInbox: new SequencerInbox( MAX_DATA_SIZE, - dummyReader4844, true ), inbox: new ERC20Inbox(MAX_DATA_SIZE), diff --git a/test/foundry/SequencerInbox.t.sol b/test/foundry/SequencerInbox.t.sol index c6889820..ae46399e 100644 --- a/test/foundry/SequencerInbox.t.sol +++ b/test/foundry/SequencerInbox.t.sol @@ -51,7 +51,6 @@ contract SequencerInboxTest is Test { }); address dummyInbox = address(139); address proxyAdmin = address(140); - IReader4844 dummyReader4844 = IReader4844(address(137)); uint256 constant public MAX_DATA_SIZE = 117964; @@ -66,7 +65,6 @@ contract SequencerInboxTest is Test { SequencerInbox seqInboxImpl = new SequencerInbox( maxDataSize, - isArbHosted ? IReader4844(address(0)) : dummyReader4844, false ); SequencerInbox seqInbox = SequencerInbox(address(new TransparentUpgradeableProxy(address(seqInboxImpl), proxyAdmin, ""))); @@ -100,7 +98,7 @@ contract SequencerInboxTest is Test { abi.encodeWithSelector(ArbSys.arbOSVersion.selector), abi.encode(uint256(11)) ); - SequencerInbox seqInboxImpl = new SequencerInbox(maxDataSize, IReader4844(address(0)), true); + SequencerInbox seqInboxImpl = new SequencerInbox(maxDataSize, true); SequencerInbox seqInbox = SequencerInbox(address(new TransparentUpgradeableProxy(address(seqInboxImpl), proxyAdmin, ""))); seqInbox.initialize( bridge, @@ -237,7 +235,7 @@ contract SequencerInboxTest is Test { /* solhint-disable func-name-mixedcase */ function testConstructor() public { - SequencerInbox seqInboxLogic = new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false); + SequencerInbox seqInboxLogic = new SequencerInbox(MAX_DATA_SIZE, false); assertEq(seqInboxLogic.maxDataSize(), MAX_DATA_SIZE, "Invalid MAX_DATA_SIZE"); assertEq(seqInboxLogic.isUsingFeeToken(), false, "Invalid isUsingFeeToken"); @@ -245,7 +243,7 @@ contract SequencerInboxTest is Test { assertEq(seqInboxProxy.maxDataSize(), MAX_DATA_SIZE, "Invalid MAX_DATA_SIZE"); assertEq(seqInboxProxy.isUsingFeeToken(), false, "Invalid isUsingFeeToken"); - SequencerInbox seqInboxLogicFeeToken = new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true); + SequencerInbox seqInboxLogicFeeToken = new SequencerInbox(MAX_DATA_SIZE, true); assertEq(seqInboxLogicFeeToken.maxDataSize(), MAX_DATA_SIZE, "Invalid MAX_DATA_SIZE"); assertEq(seqInboxLogicFeeToken.isUsingFeeToken(), true, "Invalid isUsingFeeToken"); @@ -258,7 +256,7 @@ contract SequencerInboxTest is Test { Bridge _bridge = Bridge(address(new TransparentUpgradeableProxy(address(new Bridge()), proxyAdmin, ""))); _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner)))); - address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false)); + address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, false)); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); seqInboxProxy.initialize( IBridge(_bridge), @@ -275,7 +273,7 @@ contract SequencerInboxTest is Test { address nativeToken = address(new ERC20PresetMinterPauser("Appchain Token", "App")); _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner))), nativeToken); - address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true)); + address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, true)); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); seqInboxProxy.initialize( IBridge(_bridge), @@ -291,7 +289,7 @@ contract SequencerInboxTest is Test { Bridge _bridge = Bridge(address(new TransparentUpgradeableProxy(address(new Bridge()), proxyAdmin, ""))); _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner)))); - address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true)); + address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, true)); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); vm.expectRevert(abi.encodeWithSelector(NativeTokenMismatch.selector)); @@ -306,7 +304,7 @@ contract SequencerInboxTest is Test { address nativeToken = address(new ERC20PresetMinterPauser("Appchain Token", "App")); _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner))), nativeToken); - address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false)); + address seqInboxLogic = address(new SequencerInbox(MAX_DATA_SIZE, false)); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); vm.expectRevert(abi.encodeWithSelector(NativeTokenMismatch.selector)); @@ -476,7 +474,6 @@ contract SequencerInboxTest is Test { (SequencerInbox seqInbox, ) = deployRollup(false); SequencerInbox seqInboxImpl = new SequencerInbox( maxDataSize, - dummyReader4844, false ); diff --git a/yul/Reader4844.yul b/yul/Reader4844.yul deleted file mode 100644 index ef183d79..00000000 --- a/yul/Reader4844.yul +++ /dev/null @@ -1,39 +0,0 @@ -object "Reader4844" { - code { - datacopy(0, dataoffset("runtime"), datasize("runtime")) - return(0, datasize("runtime")) - } - object "runtime" { - code { - // This contract does not accept callvalue - if callvalue() { revert(0, 0) } - - // Match against the keccak of the ABI function signature needed. - switch shr(0xe0, calldataload(0)) - // bytes4(keccak("getDataHashes()")) - case 0xe83a2d82 { - let i := 0 - for { } true { } - { - // DATAHASH opcode has hex value 0x49 - let hash := verbatim_1i_1o(hex"49", i) - if iszero(hash) { break } - mstore(add(mul(i, 32), 64), hash) - i := add(i, 1) - } - mstore(0, 32) - mstore(32, i) - return(0, add(mul(i, 32), 64)) - } - // bytes4(keccak("getBlobBaseFee()")) - case 0x1f6d6ef7 { - // BLOBBASEFEE opcode has hex value 0x4a - let blobBasefee := verbatim_0i_1o(hex"4a") - mstore(0, blobBasefee) - return(0, 32) - } - // Unknown selector (revert) - default { revert(0, 0) } - } - } -}