Skip to content
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
18 changes: 9 additions & 9 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Test unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -55,7 +55,7 @@ jobs:
cache: false

- name: Setup nodejs
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
name: 4844 tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -140,7 +140,7 @@ jobs:
no-token-bridge: true

- name: Setup nodejs
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
Expand All @@ -159,7 +159,7 @@ jobs:
name: Test e2e
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
name: Test e2e custom fee token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -224,7 +224,7 @@ jobs:
name: Test e2e fee token with 6 decimals and pricer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
# name: BOLD upgrade test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# with:
# submodules: recursive

Expand Down
3 changes: 3 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,7 @@ module.exports = {
contractSizer: {
strict: true,
},
sourcify: {
enabled: true,
},
}
83 changes: 83 additions & 0 deletions scripts/config.example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { ethers } from 'ethers'
import {
AssertionStateStruct,
RollupCreator,
} from '../build/types/src/rollup/RollupCreator'

type PartialRollupParams = Pick<
RollupCreator.RollupDeploymentParamsStruct,
'config' | 'validators' | 'batchPosterManager' | 'batchPosters'
>

// 90% of Geth's 128KB tx size limit, leaving ~13KB for proving
// This need to be adjusted for Orbit chains
export const maxDataSize = 117964
export const isUsingFeeToken = false
const chainId = ethers.BigNumber.from('13331370')

const genesisAssertionState: AssertionStateStruct = {
globalState: {
bytes32Vals: [ethers.constants.HashZero, ethers.constants.HashZero],
u64Vals: [ethers.BigNumber.from('0'), ethers.BigNumber.from('0')],
},
machineStatus: 1, // FINISHED
endHistoryRoot: ethers.constants.HashZero,
}

export const config: PartialRollupParams = {
config: {
confirmPeriodBlocks: ethers.BigNumber.from('45818'),
stakeToken: process.env.STAKE_TOKEN_ADDRESS!,
baseStake: ethers.utils.parseEther('1'),
wasmModuleRoot:
'0x184884e1eb9fefdc158f6c8ac912bb183bf3cf83f0090317e0bc4ac5860baa39', // Arbitrum Nitro Consensus v32
owner: '0x1234123412341234123412341234123412341234',
loserStakeEscrow: '0x1234123412341234123412341234123412341234', // Cannot be address(0)
chainId: chainId,
chainConfig: `{"chainId":${chainId.toString()},"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":32,"InitialChainOwner":"0x1234123412341234123412341234123412341234","GenesisBlockNum":0}}`,
minimumAssertionPeriod: 75,
validatorAfkBlocks: 201600,
genesisAssertionState: genesisAssertionState,
genesisInboxCount: 0,
miniStakeValues: [
0,
ethers.utils.parseEther('0.5'),
ethers.utils.parseEther('0.25'),
],
layerZeroBlockEdgeHeight: 2 ** 26,
layerZeroBigStepEdgeHeight: 2 ** 19,
layerZeroSmallStepEdgeHeight: 2 ** 23,
numBigStepLevel: 1,
challengeGracePeriodBlocks: 10,
bufferConfig: {
threshold: ethers.BigNumber.from('600'), // Set this to 0 to disable delay buffer
max: ethers.BigNumber.from('14400'),
replenishRateInBasis: ethers.BigNumber.from('833'),
},
sequencerInboxMaxTimeVariation: {
delayBlocks: ethers.BigNumber.from('7200'),
futureBlocks: ethers.BigNumber.from('12'),
delaySeconds: ethers.BigNumber.from('86400'),
futureSeconds: ethers.BigNumber.from('3600'),
},
anyTrustFastConfirmer: ethers.constants.AddressZero,
},
validators: [
'0x1234123412341234123412341234123412341234',
'0x1234512345123451234512345123451234512345',
],
batchPosterManager: '0x1234123412341234123412341234123412341234',
batchPosters: ['0x1234123412341234123412341234123412341234'],
}

// These value should be defined in the env
// TODO: Consolidate configs to a single file, these env vars are used in nitro-testnode
console.log('ROLLUP_CREATOR_ADDRESS :', process.env.ROLLUP_CREATOR_ADDRESS)
console.log('STAKE_TOKEN_ADDRESS :', process.env.STAKE_TOKEN_ADDRESS)
if (config.config.stakeToken !== process.env.STAKE_TOKEN_ADDRESS) {
throw new Error('STAKE_TOKEN_ADDRESS mismatch')
}
console.log('FEE_TOKEN_ADDRESS :', process.env.FEE_TOKEN_ADDRESS)
console.log('FEE_TOKEN_PRICER_ADDRESS:', process.env.FEE_TOKEN_PRICER_ADDRESS)

console.log(config.config.chainConfig)
45 changes: 0 additions & 45 deletions scripts/config.ts.example

This file was deleted.

39 changes: 20 additions & 19 deletions scripts/rollupCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,25 @@ export async function createRollup(

// Call the createRollup function
console.log('Calling createRollup to generate a new rollup ...')
const deployParams = isDevDeployment
? await _getDevRollupConfig(
feeToken,
feeTokenPricer,
validatorWalletCreator,
stakeToken
)
: {
config: config.rollupConfig,
validators: config.validators,
maxDataSize: ethers.BigNumber.from(maxDataSize),
nativeToken: feeToken,
deployFactoriesToL2: true,
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
batchPosters: config.batchPosters,
batchPosterManager: config.batchPosterManager,
feeTokenPricer: feeTokenPricer,
}
const deployParams: RollupCreator.RollupDeploymentParamsStruct =
isDevDeployment
? await _getDevRollupConfig(
feeToken,
feeTokenPricer,
validatorWalletCreator,
stakeToken
)
: {
config: config.config,
validators: config.validators,
maxDataSize: ethers.BigNumber.from(maxDataSize),
nativeToken: feeToken,
deployFactoriesToL2: true,
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
batchPosters: config.batchPosters,
batchPosterManager: config.batchPosterManager,
feeTokenPricer: feeTokenPricer,
}

const createRollupTx = await rollupCreator.createRollup(deployParams, {
value: feeCost,
Expand Down Expand Up @@ -212,7 +213,7 @@ export async function createRollup(
'secondary-feed-url': '',
'das-index-url': '',
'has-genesis-state': false,
'chain-config': JSON.parse(deployParams.config.chainConfig),
'chain-config': JSON.parse(await deployParams.config.chainConfig),
rollup: rollupCreationResult,
}

Expand Down
2 changes: 1 addition & 1 deletion slither.db.json

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions test/e2e/customFeeRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,23 @@ describe('Custom fee token orbit rollup', () => {
const txData = (
await l2Provider.getTransaction(batchSpendingReportEvent.transactionHash)
).data
const batchtxData = seqInbox.interface.decodeFunctionData(
seqInbox.interface.functions[
'addSequencerL2BatchFromOriginDelayProof(uint256,bytes,uint256,address,uint256,uint256,(bytes32,(uint8,address,uint64,uint64,uint256,uint256,bytes32)))'
],
txData
)
let batchtxData
// TODO: disable delay buffer here or use 4 bytes to determine if delay proof is used
try {
batchtxData = seqInbox.interface.decodeFunctionData(
seqInbox.interface.functions[
'addSequencerL2BatchFromOriginDelayProof(uint256,bytes,uint256,address,uint256,uint256,(bytes32,(uint8,address,uint64,uint64,uint256,uint256,bytes32)))'
],
txData
)
} catch (e) {
batchtxData = seqInbox.interface.decodeFunctionData(
seqInbox.interface.functions[
'addSequencerL2BatchFromOrigin(uint256,bytes,uint256,address,uint256,uint256)'
],
txData
)
}
const computeBatchCost = (batchData: string) => {
const zeroBytes = batchData
.substring(2)
Expand Down