Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 3 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ module.exports = {
: [],
},
custom: {
url: process.env['CUSTOM_RPC_URL'] || 'N/A'
url: process.env['CUSTOM_RPC_URL'] || 'N/A',
},
geth: {
url: 'http://localhost:8545',
Expand Down Expand Up @@ -245,8 +245,8 @@ module.exports = {
urls: {
apiURL: process.env['CUSTOM_ETHERSCAN_API_URL'],
browserURL: process.env['CUSTOM_ETHERSCAN_BROWSER_URL'],
}
}
},
},
],
},
mocha: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "3.0.1-beta.0",
"version": "3.0.1-beta.1",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
Expand Down
31 changes: 31 additions & 0 deletions patches/@arbitrum+sdk+3.7.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/node_modules/@arbitrum/sdk/dist/lib/message/L2ToL1MessageNitro.js b/node_modules/@arbitrum/sdk/dist/lib/message/L2ToL1MessageNitro.js
index 9f4d66a..a089766 100644
--- a/node_modules/@arbitrum/sdk/dist/lib/message/L2ToL1MessageNitro.js
+++ b/node_modules/@arbitrum/sdk/dist/lib/message/L2ToL1MessageNitro.js
@@ -160,6 +160,9 @@ class L2ToL1MessageReaderNitro extends L2ToL1MessageNitro {
const parsedLog = this.isAssertionCreatedLog(log)
? this.parseAssertionCreatedEvent(log)
: this.parseNodeCreatedAssertion(log);
+ if (parsedLog.afterState.blockHash === '0x0000000000000000000000000000000000000000000000000000000000000000') {
+ return arbitrumProvider.getBlock(0);
+ }
const l2Block = await arbitrumProvider.getBlock(parsedLog.afterState.blockHash);
if (!l2Block) {
throw new errors_1.ArbSdkError(`Block not found. ${parsedLog.afterState.blockHash}`);
@@ -263,9 +266,13 @@ class L2ToL1MessageReaderNitro extends L2ToL1MessageNitro {
toBlock: 'latest',
address: rollup.address,
});
- latestCreatedAssertionId =
- assertionCreatedEvents[assertionCreatedEvents.length - 1].event
- .assertionHash;
+ if (assertionCreatedEvents.length !== 0) {
+ latestCreatedAssertionId =
+ assertionCreatedEvents[assertionCreatedEvents.length - 1].event
+ .assertionHash;
+ } else {
+ latestCreatedAssertionId = latestConfirmedAssertionId;
+ }
}
else {
latestCreatedAssertionId = await rollup.callStatic.latestNodeCreated();
17 changes: 12 additions & 5 deletions scripts/boldUpgradeFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export const deployDependencies = async (
isUsingFeeToken ? 'ERC20Bridge' : 'Bridge',
bridge.address,
[],
isUsingFeeToken ? 'src/bridge/ERC20Bridge.sol:ERC20Bridge' : 'src/bridge/Bridge.sol:Bridge'
isUsingFeeToken
? 'src/bridge/ERC20Bridge.sol:ERC20Bridge'
: 'src/bridge/Bridge.sol:Bridge'
)
}

Expand All @@ -59,7 +61,7 @@ export const deployDependencies = async (
signer
)

let reader4844Addr = ethers.constants.AddressZero;
let reader4844Addr = ethers.constants.AddressZero
if (isUsing4844Reader) {
const reader4844 = await contractFactory.deploy()
await reader4844.deployed()
Expand Down Expand Up @@ -100,7 +102,7 @@ export const deployDependencies = async (
await verifyContract('RollupEventInbox', rei.address, [])
}

const outboxFac = isUsingFeeToken
const outboxFac = isUsingFeeToken
? new ERC20Outbox__factory(signer)
: new Outbox__factory(signer)
const outbox = await outboxFac.deploy()
Expand All @@ -110,7 +112,11 @@ export const deployDependencies = async (
}
if (verify) {
await outbox.deployTransaction.wait(5)
await verifyContract(isUsingFeeToken ? 'ERC20Outbox' : 'Outbox', outbox.address, [])
await verifyContract(
isUsingFeeToken ? 'ERC20Outbox' : 'Outbox',
outbox.address,
[]
)
}

const inboxFac = isUsingFeeToken
Expand Down Expand Up @@ -252,7 +258,8 @@ export const deployBoldUpgrade = async (
wallet
)
const isUsingFeeToken = await sequencerInbox.isUsingFeeToken()
const has4844Reader = await sequencerInbox.reader4844() != ethers.constants.AddressZero
const has4844Reader =
(await sequencerInbox.reader4844()) != ethers.constants.AddressZero
const deployed = await deployDependencies(
wallet,
config.settings.maxDataSize,
Expand Down
30 changes: 17 additions & 13 deletions scripts/executeBoldUpgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ async function getPreUpgradeState(l1Rpc: JsonRpcProvider, config: Config) {
l1Rpc
)

const bridge = IERC20Bridge__factory.connect(
config.contracts.bridge,
l1Rpc
)
const bridge = IERC20Bridge__factory.connect(config.contracts.bridge, l1Rpc)

const stakerCount = await oldRollupContract.stakerCount()

Expand All @@ -85,13 +82,15 @@ async function getPreUpgradeState(l1Rpc: JsonRpcProvider, config: Config) {

const wasmModuleRoot = await oldRollupContract.wasmModuleRoot()

const feeToken = await seqInbox.isUsingFeeToken() ? await bridge.nativeToken() : null
const feeToken = (await seqInbox.isUsingFeeToken())
? await bridge.nativeToken()
: null

return {
stakers,
wasmModuleRoot,
...boxes,
feeToken
feeToken,
}
}

Expand Down Expand Up @@ -138,7 +137,10 @@ async function perform(
boldActionPerformData,
])

const signerCanExecute = await upExec.hasRole('0xd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63', await timelockSigner.getAddress())
const signerCanExecute = await upExec.hasRole(
'0xd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63',
await timelockSigner.getAddress()
)

console.log('upgrade executor:', config.contracts.upgradeExecutor)
console.log('execute(...) call to upgrade executor:', performCallData)
Expand Down Expand Up @@ -280,7 +282,8 @@ async function checkSequencerInbox(

// make sure fee token-ness is correct
if (
await seqInboxContract.isUsingFeeToken() !== (preUpgradeState.feeToken !== null)
(await seqInboxContract.isUsingFeeToken()) !==
(preUpgradeState.feeToken !== null)
) {
throw new Error('SequencerInbox isUsingFeeToken does not match')
}
Expand Down Expand Up @@ -327,7 +330,10 @@ async function checkInbox(params: VerificationParams) {
config.contracts.inbox,
l1Rpc
)
const submissionFee = await inboxContract.calculateRetryableSubmissionFee(100, 100)
const submissionFee = await inboxContract.calculateRetryableSubmissionFee(
100,
100
)
if (preUpgradeState.feeToken && !submissionFee.eq(0)) {
throw new Error('Inbox is not an ERC20Inbox')
}
Expand Down Expand Up @@ -387,8 +393,7 @@ async function checkOutbox(
// will revert if not an ERC20Outbox
const withdrawalAmt = await erc20Outbox.l2ToL1WithdrawalAmount()
feeTokenValid = preUpgradeState.feeToken !== null
}
catch (e: any) {
} catch (e: any) {
if (e.code !== 'CALL_EXCEPTION') throw e
feeTokenValid = preUpgradeState.feeToken === null
}
Expand Down Expand Up @@ -429,8 +434,7 @@ async function checkBridge(
if (feeToken !== preUpgradeState.feeToken) {
feeTokenValid = false
}
}
catch (e: any) {
} catch (e: any) {
if (e.code !== 'CALL_EXCEPTION') throw e
feeTokenValid = preUpgradeState.feeToken === null
}
Expand Down
4 changes: 3 additions & 1 deletion scripts/local-deployment/deployCreatorAndCreateRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ async function main() {
let stakeToken = process.env.STAKE_TOKEN_ADDRESS as string
if (!stakeToken) {
console.log('Deploying WETH')
const wethFactory = (await ethers.getContractFactory('TestWETH9')).connect(deployerWallet)
const wethFactory = (await ethers.getContractFactory('TestWETH9')).connect(
deployerWallet
)
const weth = await wethFactory.deploy('Wrapped Ether', 'WETH')
await weth.deployTransaction.wait()
await weth.deployed()
Expand Down
18 changes: 9 additions & 9 deletions scripts/rollupCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { ERC20, ERC20__factory, IERC20__factory } from '../build/types'
import { sleep } from './testSetup'
import { promises as fs } from 'fs'
import { _isRunningOnArbitrum, verifyContract } from './deploymentUtils'
import { AssertionStateStruct, ConfigStruct, RollupCreator } from '../build/types/src/rollup/RollupCreator'
import {
AssertionStateStruct,
ConfigStruct,
RollupCreator,
} from '../build/types/src/rollup/RollupCreator'

// 1 gwei
const MAX_FER_PER_GAS = BigNumber.from('1000000000')
Expand Down Expand Up @@ -306,23 +310,19 @@ async function _getDevRollupConfig(
}

const config: ConfigStruct = {
confirmPeriodBlocks: ethers.BigNumber.from('20'),
confirmPeriodBlocks: ethers.BigNumber.from('1'), // was 20
stakeToken: stakeToken,
baseStake: 8,
wasmModuleRoot: wasmModuleRoot,
owner: ownerAddress,
loserStakeEscrow: ownerAddress,
chainId: JSON.parse(chainConfig)['chainId'],
chainConfig: chainConfig,
minimumAssertionPeriod: 5,
minimumAssertionPeriod: 1, // was 5
validatorAfkBlocks: 201600,
genesisAssertionState: genesisAssertionState,
genesisInboxCount: 0,
miniStakeValues: [
4,
2,
1,
],
miniStakeValues: [4, 2, 1],
layerZeroBlockEdgeHeight: 2 ** 26,
layerZeroBigStepEdgeHeight: 2 ** 19,
layerZeroSmallStepEdgeHeight: 2 ** 23,
Expand All @@ -335,7 +335,7 @@ async function _getDevRollupConfig(
delaySeconds: ethers.BigNumber.from('86400'),
futureSeconds: ethers.BigNumber.from('3600'),
},
anyTrustFastConfirmer: ethers.constants.AddressZero
anyTrustFastConfirmer: ethers.constants.AddressZero,
}

return {
Expand Down
18 changes: 11 additions & 7 deletions test/e2e/orbitChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
IInbox__factory,
Inbox__factory,
RollupCore__factory,
RollupCreator,
RollupCreator__factory,
} from '../../build/types'
import { AssertionStateStruct } from '../../build/types/src/challengeV2/IAssertionChain'
Expand All @@ -30,6 +31,7 @@ import {
l1Networks,
l2Networks,
} from '@arbitrum/sdk/dist/lib/dataEntities/networks'
import { ConfigStruct } from '../../build/types/src/rollup/RollupCreator'

const LOCALHOST_L2_RPC = 'http://127.0.0.1:8547'
const LOCALHOST_L3_RPC = 'http://127.0.0.1:3347'
Expand All @@ -56,6 +58,7 @@ describe('Orbit Chain', () => {
)
l2Network = {
...coreL2Network,
isBold: true,
tokenBridge: {
l1CustomGateway: '',
l1ERC20Gateway: '',
Expand Down Expand Up @@ -822,15 +825,15 @@ describe('Orbit Chain', () => {
}

/// deploy params
const config = {
const ownerAddr = '0x72f7EEedF02C522242a4D3Bdc8aE6A8583aD7c5e'
const config: ConfigStruct = {
confirmPeriodBlocks: ethers.BigNumber.from('150'),
extraChallengeTimeBlocks: ethers.BigNumber.from('200'),
stakeToken: ethers.constants.AddressZero,
stakeToken: '0x000000000000000000000000000000000000dead',
baseStake: ethers.utils.parseEther('1'),
wasmModuleRoot:
'0xda4e3ad5e7feacb817c21c8d0220da7650fe9051ece68a3f0b1c5d38bbb27b21',
owner: '0x72f7EEedF02C522242a4D3Bdc8aE6A8583aD7c5e',
loserStakeEscrow: ethers.constants.AddressZero,
owner: ownerAddr,
loserStakeEscrow: ownerAddr,
chainId: ethers.BigNumber.from('433333'),
chainConfig:
'{"chainId":433333,"homesteadBlock":0,"daoForkBlock":null,"daoForkSupport":true,"eip150Block":0,"eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":0,"berlinBlock":0,"londonBlock":0,"clique":{"period":0,"epoch":0},"arbitrum":{"EnableArbOS":true,"AllowDebugPrecompiles":false,"DataAvailabilityCommittee":false,"InitialArbOSVersion":10,"InitialChainOwner":"0x72f7EEedF02C522242a4D3Bdc8aE6A8583aD7c5e","GenesisBlockNum":0}}',
Expand Down Expand Up @@ -867,7 +870,7 @@ describe('Orbit Chain', () => {
const deployFactoriesToL2 = true
const maxFeePerGasForRetryables = BigNumber.from('100000000') // 0.1 gwei

const deployParams = {
const deployParams: RollupCreator.RollupDeploymentParamsStruct = {
config,
batchPosters,
batchPosterManager,
Expand All @@ -884,6 +887,7 @@ describe('Orbit Chain', () => {
value: nativeToken ? BigNumber.from(0) : fee,
})
).wait()

const l1TxReceipt = new L1TransactionReceipt(receipt)

// 1 init message + 8 msgs for deploying factories
Expand Down Expand Up @@ -1195,7 +1199,7 @@ async function _getRollupCreatorFromLogs(
const filter: Filter = {
topics: [
ethers.utils.id(
'RollupCreated(address,address,address,address,address,address,address,address,address,address,address,address)'
'RollupCreated(address,address,address,address,address,address,address,address,address,address,address)'
),
],
}
Expand Down
17 changes: 10 additions & 7 deletions test/e2e/stylusDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,16 @@ const deploy = async (args: {
let dataFee = BigNumber.from(0)
if (args.expectActivation) {
const programActivated = getProgramActivatedEvent(rec)
expect(
programActivated.dataFee.eq(activationFee),
// TODO: check if this is supposed to be exact or not
expect(programActivated.dataFee).to.closeTo(
activationFee,
activationFee.div(10),
'incorrect activation fee'
).to.be.true
)
dataFee = programActivated.dataFee
expect(programActivated.program, 'invalid contract address').to.eq(
contractDeployed.deployedContract
expect(programActivated.program).to.eq(
contractDeployed.deployedContract,
'invalid contract address'
)
}
expect(contractDeployed).to.not.be.undefined
Expand Down Expand Up @@ -331,7 +334,7 @@ describe('Stylus deployer', () => {
it('create1 deploy, activate, init', async function () {
const wall = await getConnectedL2Wallet()
const deployer = await new StylusDeployer__factory(wall).deploy()
const bytecode = getBytecode(5)
const bytecode = getBytecode(2)

await deploy({
wallet: wall,
Expand Down Expand Up @@ -451,7 +454,7 @@ describe('Stylus deployer', () => {
it('refund checks', async () => {
const wall = await getConnectedL2Wallet()
const deployer = await new StylusDeployer__factory(wall).deploy()
const bytecode = getBytecode(8)
const bytecode = getBytecode(4)
const forwarder1 = await new ReceivingForwarder__factory(wall).deploy()
const forwarder2 = await new ReceivingForwarder__factory(wall).deploy()

Expand Down
Loading