Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Oct 9, 2024
1 parent 9ff31f8 commit 34fc9fb
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/createRollupPrepareDeploymentParamsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,26 @@ export function createRollupPrepareDeploymentParamsConfig<TChain extends Chain |
);
}

const paramsByParentBlockTime: {
let paramsByParentBlockTime: {
confirmPeriodBlocks: bigint;
sequencerInboxMaxTimeVariation: SequencerInboxMaxTimeVariation;
} = parentChainIsCustom
? {
// ok to use non-null assertion here because we already checked above
confirmPeriodBlocks: confirmPeriodBlocks!,
// ok to use non-null assertion here because we already checked above
sequencerInboxMaxTimeVariation: sequencerInboxMaxTimeVariation!,
}
: {
confirmPeriodBlocks: confirmPeriodBlocks ?? getDefaultConfirmPeriodBlocks(parentChainId),
sequencerInboxMaxTimeVariation:
sequencerInboxMaxTimeVariation ?? getDefaultSequencerInboxMaxTimeVariation(parentChainId),
};
};

if (parentChainIsCustom) {
// ok to use non-null assertions here because we already checked above
paramsByParentBlockTime = {
confirmPeriodBlocks: confirmPeriodBlocks!,
sequencerInboxMaxTimeVariation: sequencerInboxMaxTimeVariation!,
};
} else {
const defaultConfirmPeriodBlocks = getDefaultConfirmPeriodBlocks(parentChainId);
const defaultSequencerInboxMTV = getDefaultSequencerInboxMaxTimeVariation(parentChainId);

paramsByParentBlockTime = {
confirmPeriodBlocks: confirmPeriodBlocks ?? defaultConfirmPeriodBlocks,
sequencerInboxMaxTimeVariation: sequencerInboxMaxTimeVariation ?? defaultSequencerInboxMTV,
};
}

return {
...defaults,
Expand Down

0 comments on commit 34fc9fb

Please sign in to comment.