Skip to content

Commit 1f86bf4

Browse files
committed
feat(devnet): Bump contracts and remove cannon usage.
chore(devnet): bump rollups-contracts to v3.0.0-alpha.5 chore(devnet): Bump github release prt version to v3.0.0-alpha.2 feat(devnet): Remove cannon and use only GitHub artefacts. * New pre-calculated address per chain artefact is available on release.
1 parent f13e165 commit 1f86bf4

6 files changed

Lines changed: 60 additions & 419 deletions

File tree

.changeset/clever-toes-find.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cartesi/devnet": patch
3+
---
4+
5+
Bump rollups-contracts to version v3.0.0-alpha.5

.changeset/lovely-stars-cross.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cartesi/devnet": patch
3+
---
4+
5+
Bump github release prt version to v3.0.0-alpha.2

.changeset/public-guests-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cartesi/devnet": patch
3+
---
4+
5+
Replace the use of Cannon with GitHub pre-computed addresses artefact.

bun.lock

Lines changed: 2 additions & 385 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/devnet/build.ts

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { $, semver } from "bun";
1+
import { semver } from "bun";
22
import { existsSync, readdirSync } from "fs-extra";
33
import { Listr, type ListrTask } from "listr2";
44
import * as path from "node:path";
@@ -16,9 +16,8 @@ import * as anvil from "./anvil";
1616
import { downloadAndExtract } from "./download";
1717

1818
const ANVIL_VERSION = "1.4.3";
19-
const ROLLUPS_VERSION = "2.2.0";
20-
const PRT_VERSION = "2.1.1";
21-
const CANNON_VERSION = "2.1.1";
19+
const ROLLUPS_VERSION = "3.0.0-alpha.5";
20+
const PRT_VERSION = "3.0.0-alpha.2";
2221

2322
const supportedChains = {
2423
arbitrum,
@@ -39,6 +38,10 @@ const dependencies: ListrTask[] = [
3938
url: `https://github.com/cartesi/dave/releases/download/v${PRT_VERSION}/cartesi-rollups-prt-${PRT_VERSION}-anvil-v${ANVIL_VERSION}.tar.gz`,
4039
destination: "build",
4140
},
41+
{
42+
url: `https://github.com/cartesi/dave/releases/download/v${PRT_VERSION}/cartesi-rollups-prt-${PRT_VERSION}-deployment-addresses.tar.gz`,
43+
destination: "build",
44+
},
4245
{
4346
url: `https://github.com/cartesi/dave/releases/download/v${PRT_VERSION}/cartesi-rollups-prt-${PRT_VERSION}-contract-artifacts.tar.gz`,
4447
destination: "out",
@@ -91,38 +94,41 @@ const collectContracts = async (dir: string): Promise<ContractDeployments> => {
9194
}),
9295
);
9396

94-
return deployments.reduce((contracts, deployment) => {
95-
const { abi, address, contractName } = deployment;
96-
contracts[contractName] = { abi, address };
97-
return contracts;
98-
}, {});
97+
return deployments.reduce(
98+
(contracts, deployment) => {
99+
const { abi, address, contractName } = deployment;
100+
contracts[contractName] = { abi, address };
101+
return contracts;
102+
},
103+
{} as Record<string, { abi: any; address: string }>,
104+
);
99105
};
100106

101107
/**
102-
* Inspect cannon package and export to a directory
108+
* Prepare deployment information per chain
109+
* by collection contract information based on GitHub release from cartesi-rollups-prt
103110
* @param options.chainId - chainId to export
104111
*/
105-
const cannonTasks: ListrTask[] = Object.entries(supportedChains).map(
106-
([name, chain]) => ({
107-
title: `Export chain ${chain.id} of cannon package cartesi-dave-app-factory:${CANNON_VERSION}`,
108-
task: async () => {
109-
const chainId = chain.id.toString();
110-
const exportDir = path.join("build", "deployments", chainId);
111-
await $`cannon inspect cartesi-dave-app-factory:${CANNON_VERSION} --chain-id ${chainId} --write-deployments ${exportDir} --quiet`;
112-
const contracts = await collectContracts(exportDir);
112+
const perChainDeploymentTasks: ListrTask[] = Object.entries(
113+
supportedChains,
114+
).map(([name, chain]) => ({
115+
title: `Prepare deployment for chain ${chain.id} for cartesi-rollups-prt ${PRT_VERSION}`,
116+
task: async () => {
117+
const chainId = chain.id.toString();
118+
const exportDir = path.join("build", "deployments", chainId);
119+
const contracts = await collectContracts(exportDir);
113120

114-
const filename = path.join("deployments", `${name}.json`);
115-
await Bun.write(
116-
filename,
117-
JSON.stringify({
118-
name,
119-
chainId,
120-
contracts,
121-
}),
122-
);
123-
},
124-
}),
125-
);
121+
const filename = path.join("deployments", `${name}.json`);
122+
await Bun.write(
123+
filename,
124+
JSON.stringify({
125+
name,
126+
chainId,
127+
contracts,
128+
}),
129+
);
130+
},
131+
}));
126132

127133
/**
128134
* Deploy contracts using forge script
@@ -198,7 +204,9 @@ const build = async () => {
198204

199205
// setup graceful anvil shutdown, just in case process is terminated prematurely
200206
const shutdown = async () => {
201-
await anvil.stop(ctx.anvilProc);
207+
if (ctx.anvilProc) {
208+
await anvil.stop(ctx.anvilProc);
209+
}
202210
};
203211
process.on("SIGINT", shutdown);
204212
process.on("SIGTERM", shutdown);
@@ -236,9 +244,11 @@ const build = async () => {
236244
},
237245
},
238246
{
239-
title: "Export cannon packages",
247+
title: "Generate deployment per supported chain",
240248
task: async (_, task) =>
241-
task.newListr(cannonTasks, { concurrent: true }),
249+
task.newListr(perChainDeploymentTasks, {
250+
concurrent: true,
251+
}),
242252
},
243253
{
244254
title: "Stopping anvil...",

packages/devnet/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"devDependencies": {
1818
"@types/bun": "^1.3.9",
1919
"@types/fs-extra": "^11.0.4",
20-
"@usecannon/cli": "^2.25.1",
2120
"fs-extra": "^11.3.2",
2221
"listr2": "^10.1.0",
2322
"modern-tar": "^0.7.3",

0 commit comments

Comments
 (0)