Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9900 elide comments in bundles #9997

Merged
merged 7 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions multichain-testing/scripts/update-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ sed -i -e 's/index_all_keys = false/index_all_keys = true/g' $CHAIN_DIR/config/c
sed -i -e 's/seeds = ".*"/seeds = ""/g' $CHAIN_DIR/config/config.toml
sed -i -e 's#cors_allowed_origins = \[\]#cors_allowed_origins = \["*"\]#g' $CHAIN_DIR/config/config.toml

echo "Increase $(*_bytes) parameters for MsgInstallBundle"
# See https://github.com/Agoric/agoric-sdk/blob/7b684a6268c999b082a326fdb22f63e4575bac4f/packages/agoric-cli/src/chain-config.js#L66
RPC_MAX_BODY_BYTES=15000000
MAX_HEADER_BYTES=$((RPC_MAX_BODY_BYTES / 10))
MAX_TXS_BYTES=$((RPC_MAX_BODY_BYTES * 50))
sed -i -e "s/max_body_bytes = .*/max_body_bytes = $RPC_MAX_BODY_BYTES/g" $CHAIN_DIR/config/config.toml
sed -i -e "s/max_header_bytes = .*/max_header_bytes = $MAX_HEADER_BYTES/g" $CHAIN_DIR/config/config.toml
sed -i -e "s/max_txs_bytes = .*/max_txs_bytes = $MAX_TXS_BYTES/g" $CHAIN_DIR/config/config.toml
sed -i -e "s/max_tx_bytes = .*/max_tx_bytes = $RPC_MAX_BODY_BYTES/g" $CHAIN_DIR/config/config.toml
sed -i -e "s/^rpc-max-body-bytes =.*/rpc-max-body-bytes = $RPC_MAX_BODY_BYTES/" $CHAIN_DIR/config/app.toml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This edit was the only motivation for checking in update-config.sh in the first place. We should be able to delete this file and the remove the reference from config.yaml:
ebeb975

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting to make that clearer next time, maybe with a comment like "This file only exists to support this change. If we find this is not needed, please remove this entire file"

echo "Update client.toml file"
sed -i -e 's#keyring-backend = "os"#keyring-backend = "test"#g' $CHAIN_DIR/config/client.toml
sed -i -e 's#output = "text"#output = "json"#g' $CHAIN_DIR/config/client.toml
Expand Down
2 changes: 1 addition & 1 deletion packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"devDependencies": {
"@agoric/swingset-vat": "^0.32.2",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@fast-check/ava": "^1.1.5",
"ava": "^5.3.0",
"tsd": "^0.31.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@agoric/xsnap": "^0.14.2",
"@agoric/xsnap-lockdown": "^0.14.0",
"@endo/base64": "^1.0.6",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/captp": "^4.2.2",
"@endo/check-bundle": "^1.0.8",
"@endo/compartment-mapper": "^1.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ bundleID before submitting to the kernel), or (temporarily) a full bundle.
* @typedef { string } VatID
* @typedef { string } UpgradeID
* @typedef {{
* changeOptions: (vatID: string, options: {}) => void;
* createMeter: (remaining: bigint, threshold: bigint) => MeterID
* createUnlimitedMeter: () => MeterID
* addMeterRemaining: (meterID: MeterID, delta: bigint) => void
* setMeterThreshold: (meterID: MeterID, threshold: bigint) => void
* getMeter: (meterID: MeterID) => { remaining: bigint, threshold: bigint }
* createByBundle: (bundle: Bundle, options: {}) => VatID
* createByBundleID: (bundleID: BundleID, options: {}) => VatID
* upgradeVat: (bundleID: BundleID, vatParameters: {}) => UpgradeID
* getBundleIDByName: (name: string) => string;
* upgradeVat: (vatID: string, bundleID: BundleID, _vatParameters: unknown, upgradeMessage: string) => UpgradeID;
* terminateWithFailure: (vatID: VatID, reason: {}) => void
* getBundleCap: (bundleID: BundleID) => BundleCap
* getNamedBundleCap: (name: string) => BundleCap
Expand Down
24 changes: 21 additions & 3 deletions packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,38 @@ import {
prepareSingleton,
} from '@agoric/vat-data';

/**
* @import {VatAdminRootDeviceNode} from '../../devices/vat-admin/device-vat-admin.js';
* @import {DProxy} from'../plugin-manager.js';
* @import {Baggage} from '@agoric/vat-data';
*/

const managerTypes = ['local', 'node-subprocess', 'xsnap', 'xs-worker']; // xs-worker is alias

function producePRR() {
const { promise, resolve, reject } = makePromiseKit();
return /** @type {const} */ ([promise, { resolve, reject }]);
}

/**
* Build root object of the bootstrap vat.
*
* @param {VatPowers & {
* D: DProxy;
* }} vatPowers
* @param {never} _vatParameters
* @param {Baggage} baggage
*/
export function buildRootObject(vatPowers, _vatParameters, baggage) {
const criticalVatKey = prepareSingleton(baggage, 'criticalVatKey', {});

const { D } = vatPowers;
const pendingVatCreations = new Map(); // vatID -> { resolve, reject } for promise
const pendingBundles = new Map(); // bundleID -> Promise<BundleCap>
/** @type {Map<BundleID, PromiseKit<BundleCap>>} */
const pendingBundles = new Map();
const pendingUpgrades = new Map(); // upgradeID -> Promise<UpgradeResults>

/** @type {import('../plugin-manager.js').Device<VatAdminRootDeviceNode>} */
let vatAdminDev;

const runningVats = new Map(); // vatID -> [doneP, { resolve, reject }]
Expand Down Expand Up @@ -200,7 +217,7 @@ export function buildRootObject(vatPowers, _vatParameters, baggage) {
console.log(`bundle ${bundleID} missing, hoping for reinstall`);
return;
}
pendingBundles.get(bundleID).resolve(bundlecap);
pendingBundles.get(bundleID)?.resolve(bundlecap);
pendingBundles.delete(bundleID);
checkForQuiescence();
}
Expand Down Expand Up @@ -418,8 +435,9 @@ export function buildRootObject(vatPowers, _vatParameters, baggage) {
if (!pendingBundles.has(bundleID)) {
pendingBundles.set(bundleID, makePromiseKit());
}
return pendingBundles.get(bundleID).promise;
return pendingBundles.get(bundleID)?.promise;
Comment on lines 435 to +438
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s a little weird to add a runtime check to appease the type system, when the runtime code above guarantees that the promise is defined.

const bundlePromise = pendingBundles.get(bundleId);
if (bundlePromise !== undefined) {
  return bundlePromise;
}
const bundleKit = makePromiseKit()
pendingBundles.set(bundleId, bundleKit);
return bundleKit.promise;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that's better code but are you also asserting it's a better change to make? I opted for the minimum characters changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️

},
/** @type {(bundleID: BundleID) => BundleCap} */
getBundleCap(bundleID) {
const bundlecap = D(vatAdminDev).getBundleCap(bundleID);
if (bundlecap) {
Expand Down
2 changes: 1 addition & 1 deletion packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@cosmjs/math": "^0.32.3",
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/captp": "^4.2.2",
"@endo/compartment-mapper": "^1.2.1",
"@endo/env-options": "^1.1.5",
Expand Down
13 changes: 11 additions & 2 deletions packages/agoric-cli/src/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,17 @@ export { bootPlugin } from ${JSON.stringify(absPath)};

const allEndowments = harden({
home: bootP,
bundleSource: (file, options = undefined) =>
bundleSource(pathResolve(file), options),
/**
* @template {import('@endo/bundle-source').ModuleFormat} ModuleFormat
* @param {string} file
* @param {import('@endo/bundle-source').BundleOptions<ModuleFormat>} options
* @returns {Promise<import('@endo/bundle-source').BundleSourceResult<ModuleFormat>>}
*/
bundleSource: (file, options = {}) =>
bundleSource(pathResolve(file), {
elideComments: true,
...options,
}),
...endowments,
pathResolve,
installUnsafePlugin,
Expand Down
2 changes: 1 addition & 1 deletion packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@agoric/vow": "^0.1.0",
"@agoric/zoe": "^0.26.2",
"@agoric/zone": "^0.2.2",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/captp": "^4.2.2",
"@endo/eventual-send": "^1.2.4",
"@endo/far": "^1.1.4",
Expand Down
169 changes: 0 additions & 169 deletions packages/boot/test/bootstrapTests/addAssets.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@agoric/vat-data": "^0.5.2",
"@agoric/vats": "^0.15.1",
"@agoric/zoe": "^0.26.2",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/captp": "^4.2.2",
"@endo/eventual-send": "^1.2.4",
"@endo/far": "^1.1.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"@agoric/cosmos": "^0.34.1",
"@ava/typescript": "^4.1.0",
"@cosmology/telescope": "^1.7.1",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/import-bundle": "^1.2.1",
"ava": "^5.3.1",
"rimraf": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@agoric/swingset-vat": "^0.32.2",
"@agoric/telemetry": "^0.6.2",
"@agoric/vm-config": "^0.1.0",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/env-options": "^1.1.5",
"@endo/far": "^1.1.4",
"@endo/import-bundle": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"c8": "^9.1.0"
},
"dependencies": {
"agoric": "^0.22.0-u16.2"
"agoric": "^0.21.1"
},
"keywords": [],
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/deploy-script-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@agoric/time": "^0.3.2",
"@agoric/zoe": "^0.26.2",
"@endo/base64": "^1.0.6",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/far": "^1.1.4",
"@endo/marshal": "^1.5.2",
"@endo/nat": "^5.0.9",
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@agoric/time": "^0.3.2",
"@agoric/vat-data": "^0.5.2",
"@agoric/zoe": "^0.26.2",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/captp": "^4.2.2",
"@endo/eventual-send": "^1.2.4",
"@endo/far": "^1.1.4",
Expand All @@ -50,7 +50,7 @@
},
"devDependencies": {
"@agoric/swingset-vat": "^0.32.2",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/init": "^1.1.3",
"ava": "^5.3.0",
"c8": "^9.1.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@agoric/swingset-liveslots": "^0.10.2",
"@agoric/swingset-vat": "^0.32.2",
"@agoric/zone": "^0.2.2",
"@endo/bundle-source": "^3.3.0",
"@endo/bundle-source": "^3.4.0",
"@endo/init": "^1.1.3",
"@endo/promise-kit": "^1.1.4",
"@fast-check/ava": "^1.1.5",
Expand Down
Loading
Loading