Skip to content

Missing properties on L2Network type & l2Network variable #102

@horizon-eth

Description

@horizon-eth

While setting up and deploying the token bridge contracts for our custom Orbit chain, I encountered a type mismatch issue in the scripts/deployments/deployTokenBridgeCreator.ts script.

Adding these two parameters were required to deploy all contracts for parent and child chain and finally to run this command:

   yarn run deploy:token-bridge-creator

Specifically, the L2Network object defined in the script is missing two properties that were required for successful execution in my setup:

  • blockTime
  • partnerChainIDs

To resolve this locally, I added the following fields to the L2Network object:

const l2Network: L2Network = {
  blockTime: 10, // missing parameter
  chainID: l2NetworkInfo.chainId,
  confirmPeriodBlocks: (await rollup.confirmPeriodBlocks()).toNumber(),
  ethBridge: {
    bridge: await rollup.bridge(),
    inbox: await rollup.inbox(),
    outbox: await rollup.outbox(),
    rollup: rollup.address,
    sequencerInbox: await rollup.sequencerInbox(),
  },
  explorerUrl: '',
  isArbitrum: true,
  isCustom: true,
  name: 'OrbitChain',
  partnerChainID: l1NetworkInfo.chainId,
  partnerChainIDs: [l1NetworkInfo.chainId],  // missing parameter
  retryableLifetimeSeconds: 7 * 24 * 60 * 60,
  nitroGenesisBlock: 0,
  nitroGenesisL1Block: 0,
  depositTimeout: 900000,
  tokenBridge: {
    l1CustomGateway: '',
    l1ERC20Gateway: '',
    l1GatewayRouter: '',
    l1MultiCall: '',
    l1ProxyAdmin: '',
    l1Weth: '',
    l1WethGateway: '',
    l2CustomGateway: '',
    l2ERC20Gateway: '',
    l2GatewayRouter: '',
    l2Multicall: '',
    l2ProxyAdmin: '',
    l2Weth: '',
    l2WethGateway: '',
  },
}

Without these 2 parameters, you'll get an error when you run deployment command

```bash
   yarn run deploy:token-bridge-creator

error log:

yarn run deploy:token-bridge-creator
yarn run v1.22.22
$ ts-node ./scripts/deployment/deployTokenBridgeCreator.ts
/home/horizon/token-bridge-contracts/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
scripts/deployment/deployTokenBridgeCreator.ts:110:9 - error TS2739: Type '{ chainID: number; confirmPeriodBlocks: number; ethBridge: { bridge: string; inbox: string; outbox: string; rollup: string; sequencerInbox: string; }; explorerUrl: string; isArbitrum: true; isCustom: true; ... 6 more ...; tokenBridge: { ...; }; }' is missing the following properties from type 'L2Network': blockTime, partnerChainIDs

110 const l2Network: L2Network = {
~~~~~~~~~

at createTSError (/home/horizon/token-bridge-contracts/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/home/horizon/token-bridge-contracts/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/home/horizon/token-bridge-contracts/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/home/horizon/token-bridge-contracts/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/home/horizon/token-bridge-contracts/node_modules/ts-node/src/index.ts:1617:30)
at loadTS (node:internal/modules/cjs/loader:1826:10)
at Object.require.extensions.<computed> [as .ts] (/home/horizon/token-bridge-contracts/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1469:32)
at Function._load (node:internal/modules/cjs/loader:1286:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14) {

diagnosticCodes: [ 2739 ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions