diff --git a/packages/synthetic-chain/src/cli/dockerfileGen.ts b/packages/synthetic-chain/src/cli/dockerfileGen.ts index 1df03ee2..935ae9a6 100755 --- a/packages/synthetic-chain/src/cli/dockerfileGen.ts +++ b/packages/synthetic-chain/src/cli/dockerfileGen.ts @@ -2,10 +2,11 @@ // @ts-check import fs from 'node:fs'; -import type { - CoreEvalProposal, - ProposalInfo, - SoftwareUpgradeProposal, +import { + lastPassedProposal, + type CoreEvalProposal, + type ProposalInfo, + type SoftwareUpgradeProposal, } from './proposals.js'; /** @@ -242,6 +243,12 @@ export function writeDockerfile( blocks.push(stage.TEST(proposal)); previousProposal = proposal; } + // If one of the proposals is a passed proposal, make the latest one the default entrypoint + const lastPassed = lastPassedProposal(allProposals); + if (lastPassed) { + blocks.push(stage.DEFAULT(lastPassed)); + } + const contents = blocks.join('\n'); fs.writeFileSync('Dockerfile', contents); } diff --git a/packages/synthetic-chain/src/cli/proposals.ts b/packages/synthetic-chain/src/cli/proposals.ts index 70612b1b..1d7cd3e0 100644 --- a/packages/synthetic-chain/src/cli/proposals.ts +++ b/packages/synthetic-chain/src/cli/proposals.ts @@ -62,10 +62,10 @@ export const matchOneProposal = ( return proposals[0]; }; -export function lastPassedProposal(proposals: ProposalInfo[]): ProposalInfo { - const last = proposals.findLast(p => p.proposalIdentifier.match(/^\d/)); - assert(last, 'no passed proposals'); - return last; +export function lastPassedProposal( + proposals: ProposalInfo[], +): ProposalInfo | undefined { + return proposals.findLast(p => p.proposalIdentifier.match(/^\d/)); } export function imageNameForProposal(