Skip to content

Commit

Permalink
Make ouput JSONs schema identical to legacy one
Browse files Browse the repository at this point in the history
  • Loading branch information
gvladika committed Mar 27, 2024
1 parent 2aa74db commit 46d901c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 31 deletions.
3 changes: 2 additions & 1 deletion scripts/local-deployment/deployCreatorAndCreateRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ async function main() {
'utf8'
)

// get child deployment info
// child chain info
chainInfo['chain-name'] = childChainName
const childChainInfo =
process.env.CHILD_CHAIN_INFO !== undefined
? process.env.CHILD_CHAIN_INFO
Expand Down
71 changes: 41 additions & 30 deletions scripts/rollupCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { BigNumber, Signer } from 'ethers'
import { IERC20__factory } from '../build/types'
import { sleep } from './testSetup'
import { promises as fs } from 'fs'
import { Provider } from '@ethersproject/providers'
import { _isRunningOnArbitrum } from './deploymentUtils'

// 1 gwei
Expand All @@ -33,23 +32,29 @@ interface RollupCreatedEvent {
}

interface RollupCreationResult {
Bridge: string
Inbox: string
SequencerInbox: string
DeployedAt: number
Rollup: string
NativeToken: string
UpgradeExecutor: string
ValidatorUtils: string
ValidatorWalletCreator: string
bridge: string
inbox: string
'sequencer-inbox': string
'deployed-at': number
rollup: string
'native-token': string
'upgrade-executor': string
'validator-utils': string
'validator-wallet-creator': string
}

interface ChainInfo {
ChainName: string
ParentChainId: number
ParentChainIsArbitrum: boolean
ChainConfig: any
RollupAddresses: RollupCreationResult
'chain-name': string
'parent-chain-id': number
'parent-chain-is-arbitrum': boolean
'chain-config': any
rollup: RollupCreationResult
'sequencer-url': string
'secondary-forwarding-target': string
'feed-url': string
'secondary-feed-url': string
'das-index-url': string
'has-genesis-state': boolean
}

export async function createRollup(
Expand Down Expand Up @@ -183,24 +188,29 @@ export async function createRollup(
console.log('All deployed at block number:', blockNumber)

const rollupCreationResult: RollupCreationResult = {
Bridge: bridge,
Inbox: inboxAddress,
SequencerInbox: sequencerInbox,
DeployedAt: blockNumber,
Rollup: rollupAddress,
NativeToken: nativeToken,
UpgradeExecutor: upgradeExecutor,
ValidatorUtils: validatorUtils,
ValidatorWalletCreator: validatorWalletCreator,
bridge: bridge,
inbox: inboxAddress,
'sequencer-inbox': sequencerInbox,
'deployed-at': blockNumber,
rollup: rollupAddress,
'native-token': nativeToken,
'upgrade-executor': upgradeExecutor,
'validator-utils': validatorUtils,
'validator-wallet-creator': validatorWalletCreator,
}


const chainInfo: ChainInfo = {
ChainName: 'dev-chain',
ParentChainId: deployParams.config.chainId.toNumber(),
ParentChainIsArbitrum: await _isRunningOnArbitrum(signer),
ChainConfig: deployParams.config,
RollupAddresses: rollupCreationResult,
'chain-name': 'dev-chain',
'parent-chain-id': deployParams.config.chainId.toNumber(),
'parent-chain-is-arbitrum': await _isRunningOnArbitrum(signer),
'sequencer-url': '',
'secondary-forwarding-target': '',
'feed-url': '',
'secondary-feed-url': '',
'das-index-url': '',
'has-genesis-state': false,
'chain-config': JSON.parse(deployParams.config.chainConfig),
rollup: rollupCreationResult,
}

return { rollupCreationResult, chainInfo }
Expand Down Expand Up @@ -241,6 +251,7 @@ async function _getDevRollupConfig(feeToken: string) {
process.env.CHILD_CHAIN_CONFIG_PATH !== undefined
? process.env.CHILD_CHAIN_CONFIG_PATH
: 'l2_chain_config.json'

const chainConfig = await fs.readFile(childChainConfigPath, {
encoding: 'utf8',
})
Expand Down

0 comments on commit 46d901c

Please sign in to comment.