Skip to content

Commit

Permalink
interim checkpoint for using upgraded endo bundle-source package
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovonni committed Jul 17, 2024
1 parent 6261e41 commit afd7c22
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ start-contract-mint:
--eval src/platform-goals/board-aux.core.js \
--eval src/sell-concert-tickets.proposal.js


deploy-contract-mint:
yarn node scripts/deploy-contract.js \
--deploy ./src/sell-concert-tickets.contract.js
Expand Down Expand Up @@ -101,3 +102,6 @@ bundles/deploy-swaparoo.js: src/swaparoo.proposal.js

clean:
@rm -rf bundles/

patch-bn:
cp ./patch-bn.js ../node_modules/bn.js/lib/bn.js
2 changes: 1 addition & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@agoric/vat-data": "0.5.3-u14.0",
"@agoric/vats": "0.15.2-u14.0",
"@agoric/zoe": "^0.26.3-u14.0",
"@endo/bundle-source": "^2.8.0",
"@endo/bundle-source": "https://github.com/endojs/endo.git#7277ef6ed47cc9bff0c1df5808c22cc17b4444ad2e25552740f3b7fdce5c5a81",
"@endo/far": "^0.2.22",
"@endo/init": "^0.5.60",
"@endo/marshal": "^0.8.9",
Expand Down
9 changes: 7 additions & 2 deletions contract/scripts/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,19 @@ const mockExecutionContext = () => {
};

//
// const redactImportDecls = txt =>
// txt.replace(/^\s*import\b\s*(.*)/gm, '// XMPORT: $1');

const hideImportExpr = txt => txt.replace(/\bimport\(/g, 'XMPORT(');

const generateDeployArtifact = async (path, name, { readFile, writeFile }) => {
// readtemplate
const template = await readFile('src/auto-deploy.template.js', 'utf-8');
console.log(template);
console.log(process.cwd());
console.log(name);
// string replace for contract name
const finalFile = template.replace('_CONTRACT_NAME_', name);
const finalFile = hideImportExpr(template.replace('_CONTRACT_NAME_', name));

//write result to bundles/deploy-name.js

Check failure on line 75 in contract/scripts/deploy-contract.js

View workflow job for this annotation

GitHub Actions / unit

Expected space or tab after '//' in comment
return writeFile(`bundles/deploy-${name}.js`, finalFile);
Expand Down Expand Up @@ -121,7 +126,7 @@ const main = async (bundleDir = 'bundles') => {
const name = stem(contractEntry);
await tools.installBundles({ [name]: contractEntry }, progress);

const generatedCoreEval = `bundles/deploy-${name}.js`;
const generatedCoreEval = `bundles/deploy-${name}-entry.js`;
// TODO: fix
await generateDeployArtifact(generatedCoreEval, name, fsp);
console.log({ contractEntry });
Expand Down
13 changes: 10 additions & 3 deletions contract/tools/e2e-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,20 @@ export const makeE2ETools = (
throw Error('@@TODO: agoric run style');
}
const { name, title = name, description = title, entryFile, permit } = info;

const eval0 = {
code: `bundles/deploy-${name}.js`,
permit: `bundles/deploy-${name}-permit.json`,
};
const loadResult = await deployBundleCache.load(
entryFile,
name,
console.log,
);
console.log('loadResult', loadResult);
throw 1;

Check failure on line 564 in contract/tools/e2e-tools.js

View workflow job for this annotation

GitHub Actions / unit

Expected an error object to be thrown
await writeFile(eval0.code, loadResult);

Check failure on line 565 in contract/tools/e2e-tools.js

View workflow job for this annotation

GitHub Actions / unit

Unreachable code
await writeFile(eval0.permit, JSON.stringify(permit, null, 2));
await null;
try {
const todo = await runMake(`${eval0.code}.done`);
Expand All @@ -574,9 +584,6 @@ export const makeE2ETools = (
const detail = { evals: [eval0], title, description };

// await runPackageScript('build:deployer', entryFile);
await bundleCache.load(eval0.code, name, console.log);

await writeFile(eval0.permit, JSON.stringify(permit, null, 2));

const proposal = await runCoreEval(t, detail, { agd, blockTool });
await writeFile(
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8253,7 +8253,7 @@ __metadata:
"@agoric/xsnap": "npm:0.14.3-u14.0"
"@agoric/zoe": "npm:^0.26.3-u14.0"
"@agoric/zone": "npm:0.2.3-u14.0"
"@endo/bundle-source": "npm:^2.8.0"
"@endo/bundle-source": "https://github.com/endojs/endo.git#7277ef6ed47cc9bff0c1df5808c22cc17b4444ad2e25552740f3b7fdce5c5a81"
"@endo/eslint-plugin": "npm:^0.5.2"
"@endo/far": "npm:^0.2.22"
"@endo/init": "npm:^0.5.60"
Expand Down

0 comments on commit afd7c22

Please sign in to comment.