From 16880e61b2445e25e3af23ed49e50ac87117c05c Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 09:30:37 -0700 Subject: [PATCH 01/15] chore: repair keys in priceFeed upgrade proposal --- packages/builders/scripts/inter-protocol/updatePriceFeeds.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builders/scripts/inter-protocol/updatePriceFeeds.js b/packages/builders/scripts/inter-protocol/updatePriceFeeds.js index c6a96157abf..dbc0ad193c0 100644 --- a/packages/builders/scripts/inter-protocol/updatePriceFeeds.js +++ b/packages/builders/scripts/inter-protocol/updatePriceFeeds.js @@ -13,7 +13,7 @@ const configurations = { ], inBrandNames: ['ATOM', 'stATOM'], }, - main: { + MAINNET: { oracleAddresses: [ 'agoric144rrhh4m09mh7aaffhm6xy223ym76gve2x7y78', // DSRV 'agoric19d6gnr9fyp6hev4tlrg87zjrzsd5gzr5qlfq2p', // Stakin @@ -24,7 +24,7 @@ const configurations = { inBrandNames: ['ATOM', 'stATOM', 'stOSMO', 'stTIA', 'stkATOM'], contractTerms: { minSubmissionCount: 3 }, }, - devnet: { + DEVNET: { oracleAddresses: [ 'agoric1lw4e4aas9q84tq0q92j85rwjjjapf8dmnllnft', // DSRV 'agoric1zj6vrrrjq4gsyr9lw7dplv4vyejg3p8j2urm82', // Stakin From 9a8922c6abf375bd010a0913d07799d0e9e6f129 Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 10:20:56 -0700 Subject: [PATCH 02/15] chore: also update package.json to use the new keys --- a3p-integration/proposals/n:upgrade-next/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a3p-integration/proposals/n:upgrade-next/package.json b/a3p-integration/proposals/n:upgrade-next/package.json index e2914aa6253..6dcb65601c0 100644 --- a/a3p-integration/proposals/n:upgrade-next/package.json +++ b/a3p-integration/proposals/n:upgrade-next/package.json @@ -16,10 +16,10 @@ "inter-protocol/updatePriceFeeds.js price-feeds A3P_INTEGRATION", "vats/add-auction.js price-feeds", "vats/upgradeVaults.js price-feeds", - "inter-protocol/updatePriceFeeds.js submission/main main", + "inter-protocol/updatePriceFeeds.js submission/main MAINNET", "vats/add-auction.js submission/main", "vats/upgradeVaults.js submission/main", - "inter-protocol/updatePriceFeeds.js submission/devnet devnet", + "inter-protocol/updatePriceFeeds.js submission/devnet DEVNET", "vats/add-auction.js submission/devnet", "vats/upgradeVaults.js submission/devnet" ], From a497ac37bdb058ac69fdd67ba903e797be70c7eb Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 11:32:05 -0700 Subject: [PATCH 03/15] chore: some bootstrap tests also use the priceFeedBuilder --- packages/boot/test/bootstrapTests/price-feed-replace.test.ts | 2 +- packages/boot/test/bootstrapTests/updateGovernedParams.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/boot/test/bootstrapTests/price-feed-replace.test.ts b/packages/boot/test/bootstrapTests/price-feed-replace.test.ts index 84a077f336e..a9c0ce6e177 100644 --- a/packages/boot/test/bootstrapTests/price-feed-replace.test.ts +++ b/packages/boot/test/bootstrapTests/price-feed-replace.test.ts @@ -101,7 +101,7 @@ test.serial('setupVaults; run updatePriceFeeds proposals', async t => { t.log('building all relevant CoreEvals'); const coreEvals = await Promise.all([ - buildProposal(priceFeedBuilder, ['main']), + buildProposal(priceFeedBuilder, ['MAINNET']), buildProposal('@agoric/builders/scripts/vats/upgradeVaults.js'), buildProposal('@agoric/builders/scripts/vats/add-auction.js'), ]); diff --git a/packages/boot/test/bootstrapTests/updateGovernedParams.test.ts b/packages/boot/test/bootstrapTests/updateGovernedParams.test.ts index f38d83bc5e7..5410fcc59d7 100644 --- a/packages/boot/test/bootstrapTests/updateGovernedParams.test.ts +++ b/packages/boot/test/bootstrapTests/updateGovernedParams.test.ts @@ -134,7 +134,7 @@ test('modify manager & director params; update vats, check', async t => { const priceFeedBuilder = '@agoric/builders/scripts/inter-protocol/updatePriceFeeds.js'; const coreEvals = await Promise.all([ - buildProposal(priceFeedBuilder, ['main']), + buildProposal(priceFeedBuilder, ['MAINNET']), buildProposal('@agoric/builders/scripts/vats/upgradeVaults.js'), buildProposal('@agoric/builders/scripts/vats/add-auction.js'), ]); From f94ca73b7b09b314ae9fe8b75527f5f96d8786c7 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 29 Oct 2024 18:46:16 +0000 Subject: [PATCH 04/15] chore(cosmos): fmt --- golang/cosmos/app/upgrade.go | 38 ++++++++++++++-------------- golang/cosmos/cmd/agd/agvm.go | 6 ++--- golang/cosmos/cmd/agd/find_binary.go | 4 +-- golang/cosmos/vm/client.go | 28 ++++++++++---------- golang/cosmos/x/vbank/types/key.go | 6 ++--- 5 files changed, 42 insertions(+), 40 deletions(-) diff --git a/golang/cosmos/app/upgrade.go b/golang/cosmos/app/upgrade.go index c8c9ed4d9af..b84231668e9 100644 --- a/golang/cosmos/app/upgrade.go +++ b/golang/cosmos/app/upgrade.go @@ -106,23 +106,23 @@ func buildProposalStepWithArgs(moduleName string, entrypoint string, opts map[st } func getVariantFromUpgradeName(upgradeName string) string { - switch upgradeName { - case "UNRELEASED_A3P_INTEGRATION": - return "A3P_INTEGRATION" - case "UNRELEASED_main": - return "MAINNET" - case "UNRELEASED_devnet": - return "DEVNET" - // Noupgrade for this version. - case "UNRELEASED_BASIC": - return "" - default: - return "" - } + switch upgradeName { + case "UNRELEASED_A3P_INTEGRATION": + return "A3P_INTEGRATION" + case "UNRELEASED_main": + return "MAINNET" + case "UNRELEASED_devnet": + return "DEVNET" + // Noupgrade for this version. + case "UNRELEASED_BASIC": + return "" + default: + return "" + } } func replaceElectorateCoreProposalStep(upgradeName string) (vm.CoreProposalStep, error) { - variant := getVariantFromUpgradeName(upgradeName) + variant := getVariantFromUpgradeName(upgradeName) return buildProposalStepWithArgs( "@agoric/builders/scripts/inter-protocol/replace-electorate-core.js", @@ -134,7 +134,7 @@ func replaceElectorateCoreProposalStep(upgradeName string) (vm.CoreProposalStep, } func replacePriceFeedsCoreProposal(upgradeName string) (vm.CoreProposalStep, error) { - variant := getVariantFromUpgradeName(upgradeName) + variant := getVariantFromUpgradeName(upgradeName) return buildProposalStepWithArgs( "@agoric/builders/scripts/inter-protocol/updatePriceFeeds.js", @@ -187,10 +187,10 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte // Upgrade Zoe (no new ZCF needed). "@agoric/builders/scripts/vats/upgrade-zoe.js", ), - // Revive KREAd characters - vm.CoreProposalStepForModules( - "@agoric/builders/scripts/vats/revive-kread.js", - ), + // Revive KREAd characters + vm.CoreProposalStepForModules( + "@agoric/builders/scripts/vats/revive-kread.js", + ), vm.CoreProposalStepForModules( // Upgrade to include a cleanup from https://github.com/Agoric/agoric-sdk/pull/10319 "@agoric/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js", diff --git a/golang/cosmos/cmd/agd/agvm.go b/golang/cosmos/cmd/agd/agvm.go index 262e2c51e68..2127e592840 100644 --- a/golang/cosmos/cmd/agd/agvm.go +++ b/golang/cosmos/cmd/agd/agvm.go @@ -27,9 +27,9 @@ func NewVMCommand(logger log.Logger, binary string, args []string, vmFromAgd, vm fdToAgd := fdFromAgd + 1 // ExtraFiles begins at fd numStdFiles, so we need to compute the array. - cmd.ExtraFiles = make([]*os.File, fdToAgd - numStdFiles + 1) - cmd.ExtraFiles[fdFromAgd - numStdFiles] = vmFromAgd - cmd.ExtraFiles[fdToAgd - numStdFiles] = vmToAgd + cmd.ExtraFiles = make([]*os.File, fdToAgd-numStdFiles+1) + cmd.ExtraFiles[fdFromAgd-numStdFiles] = vmFromAgd + cmd.ExtraFiles[fdToAgd-numStdFiles] = vmToAgd // Pass the file descriptor numbers in the environment. cmd.Env = append( diff --git a/golang/cosmos/cmd/agd/find_binary.go b/golang/cosmos/cmd/agd/find_binary.go index 336ee25a34c..3fee55be195 100644 --- a/golang/cosmos/cmd/agd/find_binary.go +++ b/golang/cosmos/cmd/agd/find_binary.go @@ -8,7 +8,7 @@ import ( // FindBinaryNextToMe looks for binName next to the current executable. // It returns an absolute filename for binName, or an error. -func FindBinaryNextToMe(walkUp int, path... string) (string, error) { +func FindBinaryNextToMe(walkUp int, path ...string) (string, error) { ex, err := os.Executable() if err != nil { return "", err @@ -32,7 +32,7 @@ func FindBinaryNextToMe(walkUp int, path... string) (string, error) { if _, err = os.Stat(bin); err != nil { return "", err } - + return bin, nil } diff --git a/golang/cosmos/vm/client.go b/golang/cosmos/vm/client.go index ac3fa067d3e..05be0a8becb 100644 --- a/golang/cosmos/vm/client.go +++ b/golang/cosmos/vm/client.go @@ -12,8 +12,8 @@ const ReceiveMessageMethod = "agvm.ReceiveMessage" // Message is what we send to the VM. type Message struct { - Port int - Data string + Port int + Data string NeedsReply bool } @@ -24,7 +24,9 @@ var _ rpc.ClientCodec = (*ClientCodec)(nil) // runtime and the VM in the single-process dual-runtime configuration. // // We expect to call it via the legacy API with signature: -// sendToController func(needsReply bool, msg string) (string, error) +// +// sendToController func(needsReply bool, msg string) (string, error) +// // where msg and the returned string are JSON-encoded values. // // Note that the net/rpc framework cannot express a call that does not expect a @@ -32,22 +34,22 @@ var _ rpc.ClientCodec = (*ClientCodec)(nil) // having the WriteRequest() method fabricate a Receive() call to clear the rpc // state. type ClientCodec struct { - ctx context.Context - send func(port, rPort int, msg string) - outbound map[int]rpc.Request - inbound chan *rpc.Response - replies map[uint64]string + ctx context.Context + send func(port, rPort int, msg string) + outbound map[int]rpc.Request + inbound chan *rpc.Response + replies map[uint64]string replyToRead uint64 } // NewClientCodec creates a new ClientCodec. func NewClientCodec(ctx context.Context, send func(int, int, string)) *ClientCodec { return &ClientCodec{ - ctx: ctx, - send: send, + ctx: ctx, + send: send, outbound: make(map[int]rpc.Request), - inbound: make(chan *rpc.Response), - replies: make(map[uint64]string), + inbound: make(chan *rpc.Response), + replies: make(map[uint64]string), } } @@ -97,7 +99,7 @@ func (cc *ClientCodec) Receive(rPort int, isError bool, data string) error { delete(cc.outbound, rPort) resp := &rpc.Response{ ServiceMethod: outb.ServiceMethod, - Seq: outb.Seq, + Seq: outb.Seq, } if isError { resp.Error = data diff --git a/golang/cosmos/x/vbank/types/key.go b/golang/cosmos/x/vbank/types/key.go index 5bd84ab7836..69ab859e466 100644 --- a/golang/cosmos/x/vbank/types/key.go +++ b/golang/cosmos/x/vbank/types/key.go @@ -7,7 +7,7 @@ const ( // StoreKey to be used when creating the KVStore StoreKey = ModuleName - ReservePoolName = "vbank/reserve" - GiveawayPoolName = "vbank/giveaway" - ProvisionPoolName = "vbank/provision" + ReservePoolName = "vbank/reserve" + GiveawayPoolName = "vbank/giveaway" + ProvisionPoolName = "vbank/provision" ) From 4ce13721201d9a62a40352d909f97a44d8e5b25d Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 29 Oct 2024 18:27:24 +0000 Subject: [PATCH 05/15] feat(cosmos): upgrade skips proposals with no variant --- golang/cosmos/app/upgrade.go | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/golang/cosmos/app/upgrade.go b/golang/cosmos/app/upgrade.go index b84231668e9..edfc1855f88 100644 --- a/golang/cosmos/app/upgrade.go +++ b/golang/cosmos/app/upgrade.go @@ -79,10 +79,10 @@ func buildProposalStepWithArgs(moduleName string, entrypoint string, opts map[st t := template.Must(template.New("").Parse(`{ "module": "{{.moduleName}}", "entrypoint": "{{.entrypoint}}", - "args": [ {{.args}} ] + "args": [ {{.optsArg}} ] }`)) - args, err := json.Marshal(opts) + optsArg, err := json.Marshal(opts) if err != nil { return nil, err } @@ -91,7 +91,7 @@ func buildProposalStepWithArgs(moduleName string, entrypoint string, opts map[st err = t.Execute(&result, map[string]any{ "moduleName": moduleName, "entrypoint": entrypoint, - "args": string(args), + "optsArg": string(optsArg), }) if err != nil { return nil, err @@ -124,6 +124,10 @@ func getVariantFromUpgradeName(upgradeName string) string { func replaceElectorateCoreProposalStep(upgradeName string) (vm.CoreProposalStep, error) { variant := getVariantFromUpgradeName(upgradeName) + if variant == "" { + return nil, nil + } + return buildProposalStepWithArgs( "@agoric/builders/scripts/inter-protocol/replace-electorate-core.js", "defaultProposalBuilder", @@ -136,6 +140,10 @@ func replaceElectorateCoreProposalStep(upgradeName string) (vm.CoreProposalStep, func replacePriceFeedsCoreProposal(upgradeName string) (vm.CoreProposalStep, error) { variant := getVariantFromUpgradeName(upgradeName) + if variant == "" { + return nil, nil + } + return buildProposalStepWithArgs( "@agoric/builders/scripts/inter-protocol/updatePriceFeeds.js", "defaultProposalBuilder", @@ -165,18 +173,20 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte replaceElectorateStep, err := replaceElectorateCoreProposalStep(targetUpgrade) if err != nil { return nil, err + } else if replaceElectorateStep != nil { + CoreProposalSteps = append(CoreProposalSteps, replaceElectorateStep) } priceFeedUpdate, err := replacePriceFeedsCoreProposal(targetUpgrade) if err != nil { return nil, err + } else if priceFeedUpdate != nil { + CoreProposalSteps = append(CoreProposalSteps, priceFeedUpdate) } // Each CoreProposalStep runs sequentially, and can be constructed from // one or more modules executing in parallel within the step. - CoreProposalSteps = []vm.CoreProposalStep{ - replaceElectorateStep, - priceFeedUpdate, + CoreProposalSteps = append(CoreProposalSteps, vm.CoreProposalStepForModules( "@agoric/builders/scripts/vats/add-auction.js", ), @@ -195,7 +205,7 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte // Upgrade to include a cleanup from https://github.com/Agoric/agoric-sdk/pull/10319 "@agoric/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js", ), - } + ) } app.upgradeDetails = &upgradeDetails{ From 8804ed28e259bf4ee9dd8872ccdd9ec42897e279 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 29 Oct 2024 19:36:23 +0000 Subject: [PATCH 06/15] feat: update price feed proposal support for custom config --- .../inter-protocol/updatePriceFeeds.js | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/packages/builders/scripts/inter-protocol/updatePriceFeeds.js b/packages/builders/scripts/inter-protocol/updatePriceFeeds.js index dbc0ad193c0..ffb8b2548cf 100644 --- a/packages/builders/scripts/inter-protocol/updatePriceFeeds.js +++ b/packages/builders/scripts/inter-protocol/updatePriceFeeds.js @@ -37,20 +37,29 @@ const configurations = { }; const { keys } = Object; -const Usage = `agoric run updatePriceFeed.js ${keys(configurations).join(' | ')}`; +const knownVariants = keys(configurations); + /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { - const config = configurations[opts.variant]; + const config = opts.config || configurations[opts.variant]; if (!config) { - console.error(Usage); - throw Error(Usage); + const error = `Unknown variant "${opts.variant}". Expected one of ${knownVariants.join(', ')}`; + console.error(error); + throw Error(error); } + const { oracleAddresses, inBrandNames, contractTerms } = config; + console.log( + 'Generating price feeds update proposal with config', + JSON.stringify({ oracleAddresses, inBrandNames, contractTerms }), + ); return harden({ sourceSpec: '@agoric/inter-protocol/src/proposals/deploy-price-feeds.js', getManifestCall: [ getManifestForPriceFeeds.name, { - ...config, + oracleAddresses, + inBrandNames, + contractTerms, priceAggregatorRef: publishRef( install( '@agoric/inter-protocol/src/price/fluxAggregatorContract.js', @@ -68,15 +77,35 @@ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { }); }; +const Usage = `agoric run updatePriceFeeds.js ${[...knownVariants, ''].join(' | ')}`; + /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */ export default async (homeP, endowments) => { const { scriptArgs } = endowments; - const variant = scriptArgs?.[0]; - console.log('updatePriceFeeds', scriptArgs, variant); + const variantOrConfig = scriptArgs?.[0]; + console.log('updatePriceFeeds.js', variantOrConfig); + + const opts = {}; + + if (typeof variantOrConfig === 'string') { + if (variantOrConfig[0] === '{') { + try { + opts.config = JSON.parse(variantOrConfig); + } catch (err) { + throw Error(`Failed to parse config argument ${variantOrConfig}`); + } + } else { + opts.variant = variantOrConfig; + } + } else { + console.error(Usage); + throw Error(Usage); + } const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreEval(`gov-price-feeds-${variant}`, (utils, opts) => - defaultProposalBuilder(utils, { ...opts, variant }), + await writeCoreEval( + `gov-price-feeds-${opts.variant || 'from-config'}`, + utils => defaultProposalBuilder(utils, opts), ); }; From d3014e3162eeb7e30c2976dd8fd3feb9b79efc54 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 29 Oct 2024 19:47:40 +0000 Subject: [PATCH 07/15] feat: replace committee proposal support for custom config --- .../inter-protocol/replace-electorate-core.js | 55 +++++++++++++++---- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/packages/builders/scripts/inter-protocol/replace-electorate-core.js b/packages/builders/scripts/inter-protocol/replace-electorate-core.js index 4545cbacfbc..e02e7a8df3d 100644 --- a/packages/builders/scripts/inter-protocol/replace-electorate-core.js +++ b/packages/builders/scripts/inter-protocol/replace-electorate-core.js @@ -12,10 +12,12 @@ * Example: * agoric run replace-electorate-core.js MAINNET */ -/* global process */ import { makeHelpers } from '@agoric/deploy-script-support'; import { getManifestForReplaceAllElectorates } from '@agoric/inter-protocol/src/proposals/replaceElectorate.js'; +/** @typedef {Parameters[1]['options']} ReplaceElectorateOptions */ + +/** @type {Record} */ const configurations = { MAINNET: { committeeName: 'Economic Committee', @@ -76,20 +78,33 @@ const configurations = { }; const { keys } = Object; -const Usage = `agoric run replace-electorate-core.js ${keys(configurations).join(' | ')}`; +const knownVariants = keys(configurations); + /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { - const config = configurations[opts.variant]; + const config = opts.config || configurations[opts.variant]; if (!config) { - console.error(Usage); - process.exit(1); + const error = `Unknown variant "${opts.variant}". Expected one of ${knownVariants.join(', ')}`; + console.error(error); + throw Error(error); } + const { committeeName, voterAddresses, highPrioritySendersConfig } = config; + console.log( + 'Generating replace committee proposal with config', + JSON.stringify({ + committeeName, + voterAddresses, + highPrioritySendersConfig, + }), + ); return harden({ sourceSpec: '@agoric/inter-protocol/src/proposals/replaceElectorate.js', getManifestCall: [ getManifestForReplaceAllElectorates.name, { - ...config, + committeeName, + voterAddresses, + highPrioritySendersConfig, economicCommitteeRef: publishRef( install( '@agoric/governance/src/committee.js', @@ -101,15 +116,35 @@ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => { }); }; +const Usage = `agoric run replace-electorate-core.js ${[...knownVariants, ''].join(' | ')}`; + /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */ export default async (homeP, endowments) => { const { scriptArgs } = endowments; - const variant = scriptArgs?.[0]; - console.log('replace-committee', scriptArgs, variant); + const variantOrConfig = scriptArgs?.[0]; + console.log('replace-electorate-core.js', variantOrConfig); + + const opts = {}; + + if (typeof variantOrConfig === 'string') { + if (variantOrConfig[0] === '{') { + try { + opts.config = JSON.parse(variantOrConfig); + } catch (err) { + throw Error(`Failed to parse config argument ${variantOrConfig}`); + } + } else { + opts.variant = variantOrConfig; + } + } else { + console.error(Usage); + throw Error(Usage); + } const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreEval(`replace-committee-${variant}`, (utils, opts) => - defaultProposalBuilder(utils, { ...opts, variant }), + await writeCoreEval( + `replace-committee-${opts.variant || 'from-config'}`, + utils => defaultProposalBuilder(utils, opts), ); }; From e0a71e2f2f37b19ccc856a06a3757135ac5a5baa Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 13:08:49 -0700 Subject: [PATCH 08/15] feat: drop sdk-generate from package.json --- .../proposals/n:upgrade-next/package.json | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/a3p-integration/proposals/n:upgrade-next/package.json b/a3p-integration/proposals/n:upgrade-next/package.json index 6dcb65601c0..af2361a9a58 100644 --- a/a3p-integration/proposals/n:upgrade-next/package.json +++ b/a3p-integration/proposals/n:upgrade-next/package.json @@ -6,23 +6,6 @@ "upgradeInfo": { "coreProposals": [] }, - "sdk-generate": [ - "vats/test-localchain.js localchaintest-submission", - "vats/upgrade-bank.js upgrade-bank", - "vats/upgrade-provisionPool.js upgrade-provisionPool", - "testing/add-LEMONS.js add-LEMONS", - "testing/add-OLIVES.js add-OLIVES", - "inter-protocol/replace-electorate-core.js replace-electorate A3P_INTEGRATION", - "inter-protocol/updatePriceFeeds.js price-feeds A3P_INTEGRATION", - "vats/add-auction.js price-feeds", - "vats/upgradeVaults.js price-feeds", - "inter-protocol/updatePriceFeeds.js submission/main MAINNET", - "vats/add-auction.js submission/main", - "vats/upgradeVaults.js submission/main", - "inter-protocol/updatePriceFeeds.js submission/devnet DEVNET", - "vats/add-auction.js submission/devnet", - "vats/upgradeVaults.js submission/devnet" - ], "type": "Software Upgrade Proposal" }, "type": "module", From a88d60b4511084b59b34ef0baa82e861fc4a17ae Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 13:16:32 -0700 Subject: [PATCH 09/15] chore: drop eval.sh which isn't used in software upgrades --- .../proposals/n:upgrade-next/eval.sh | 15 ------- .../n:upgrade-next/resetChargingPeriod.js | 41 ------------------- 2 files changed, 56 deletions(-) delete mode 100755 a3p-integration/proposals/n:upgrade-next/eval.sh delete mode 100755 a3p-integration/proposals/n:upgrade-next/resetChargingPeriod.js diff --git a/a3p-integration/proposals/n:upgrade-next/eval.sh b/a3p-integration/proposals/n:upgrade-next/eval.sh deleted file mode 100755 index c44d11c5a35..00000000000 --- a/a3p-integration/proposals/n:upgrade-next/eval.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Exit when any command fails -set -uxeo pipefail - -# The upgrade-vaults proposal needs to know the existing vaultDirector -# parameters in order to cleanly upgrade the contract. The governance notifier -# it relies on doesn't give the most recent value if there were no updates to -# the parameters, so we'll do a governance action to reset them to their current -# values so the notifier will work. - -./resetChargingPeriod.js - -cp /usr/src/upgrade-test-scripts/eval_submission.js . -./eval_submission.js diff --git a/a3p-integration/proposals/n:upgrade-next/resetChargingPeriod.js b/a3p-integration/proposals/n:upgrade-next/resetChargingPeriod.js deleted file mode 100755 index c77494dddc6..00000000000 --- a/a3p-integration/proposals/n:upgrade-next/resetChargingPeriod.js +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env node - -/* global setTimeout */ - -import { - getQuoteBody, - GOV1ADDR, - GOV2ADDR, - GOV3ADDR, -} from '@agoric/synthetic-chain'; -import { - proposeVaultDirectorParamChange, - voteForNewParams, -} from './agoric-tools.js'; - -const GOV_ADDRESSES = [GOV1ADDR, GOV2ADDR, GOV3ADDR]; - -const readChargingPeriod = async () => { - const governanceBody = await getQuoteBody( - 'published.vaultFactory.governance', - ); - const period = - governanceBody.current.ChargingPeriod.value.match(/\+?(\d+)/)[1]; - return `+${period}`; -}; - -const setChargingPeriod = async period => { - const params = { - ChargingPeriod: period, - }; - - const path = { paramPath: { key: 'governedParams' } }; - - await proposeVaultDirectorParamChange(GOV1ADDR, params, path); - await voteForNewParams(GOV_ADDRESSES, 0); - - await new Promise(r => setTimeout(r, 65000)); -}; - -const period = await readChargingPeriod(); -await setChargingPeriod(period); From 74a34a375bc1c7dd0d1067951d928a99b71bfbb6 Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 13:17:59 -0700 Subject: [PATCH 10/15] chore: drop .gitignore, which is no longer needed --- a3p-integration/proposals/n:upgrade-next/.gitignore | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 a3p-integration/proposals/n:upgrade-next/.gitignore diff --git a/a3p-integration/proposals/n:upgrade-next/.gitignore b/a3p-integration/proposals/n:upgrade-next/.gitignore deleted file mode 100644 index 2f3ed03b169..00000000000 --- a/a3p-integration/proposals/n:upgrade-next/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Generated Artifacts to Ignore in CI -add-LEMONS/ -add-OLIVES/ -upgrade-bank/ -upgrade-provisionPool/ -upgrade-orch-core/ -replace-electorate/ -price-feeds/ From f5b08d7c8292e3dd6a9eff1358daf22a65ff5102 Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 13:47:20 -0700 Subject: [PATCH 11/15] chore: drop provisionPool.test, which shouldn't be here --- .../n:upgrade-next/provisionPool.test.js | 102 ------------------ 1 file changed, 102 deletions(-) delete mode 100644 a3p-integration/proposals/n:upgrade-next/provisionPool.test.js diff --git a/a3p-integration/proposals/n:upgrade-next/provisionPool.test.js b/a3p-integration/proposals/n:upgrade-next/provisionPool.test.js deleted file mode 100644 index 6e0bbcca1f1..00000000000 --- a/a3p-integration/proposals/n:upgrade-next/provisionPool.test.js +++ /dev/null @@ -1,102 +0,0 @@ -// @ts-check - -import test from 'ava'; - -import { - evalBundles, - getIncarnation, - waitForBlock, -} from '@agoric/synthetic-chain'; - -import { bankSend, getProvisionPoolMetrics } from './agd-tools.js'; - -const NULL_UPGRADE_BANK_DIR = 'upgrade-bank'; -const UPGRADE_PP_DIR = 'upgrade-provisionPool'; -const ADD_LEMONS_DIR = 'add-LEMONS'; -const ADD_OLIVES_DIR = 'add-OLIVES'; - -const USDC_DENOM = - 'ibc/295548A78785A1007F232DE286149A6FF512F180AF5657780FC89C009E2C348F'; -const PROVISIONING_POOL_ADDR = 'agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346'; - -/** - * @file - * The problem to be addressed is that provisionPool won't correctly handle - * (#8722) deposit of assets after it (provisionPool) is upgraded or (#8724) - * new asset kinds after vat-bank is upgraded. - * - * To test this, we will - * - * 1. See that we can add USDC. - * - * 2. Null upgrade vat-bank, and see that we can add a new collateal. - * - * 2a. Not null upgrade provisionPool, since it would fail. If it had succeeded, - * we would have been able to observe the effect of #8724, which would have - * caused addition of new currencies to be ignored. - * - * 3. Do a full upgrade of provisionPool; then deposit USDC, and see IST - * incremented in totalMintedConverted. - * - * 4. Null upgrade vat-bank again, and then see (in logs) that adding a new - * asset type gives the ability to make deposits. We don't actually add it - * because it would be too much work to add a faucet or other ability to mint - * the new collateral. - */ - -const contributeToPool = async (t, asset, expectedToGrow) => { - const metricsBefore = await getProvisionPoolMetrics(); - console.log('PPT pre', metricsBefore); - - await bankSend(PROVISIONING_POOL_ADDR, asset); - - const metricsAfter = await getProvisionPoolMetrics(); - console.log('PPT post', metricsAfter); - t.is( - metricsAfter.totalMintedConverted.brand, - metricsBefore.totalMintedConverted.brand, - 'brands match', - ); - if (expectedToGrow) { - // I couldn't import AmountMath. dunno why. - t.true( - metricsAfter.totalMintedConverted.value > - metricsBefore.totalMintedConverted.value, - 'brands match', - ); - } else { - t.equal( - metricsAfter.totalMintedConverted.value, - metricsBefore.totalMintedConverted.value, - ); - } -}; - -test('upgrading provisionPool and vat-bank', async t => { - t.log('add assets before'); - await contributeToPool(t, `10000${USDC_DENOM}`, true); - - t.log(`upgrade Bank`); - await evalBundles(NULL_UPGRADE_BANK_DIR); - - const firstIncarnation = await getIncarnation('bank'); - t.is(firstIncarnation, 1); - - await evalBundles(ADD_LEMONS_DIR); - - t.log('full upgrade ProvisionPool'); - await evalBundles(UPGRADE_PP_DIR); - const ppIncarnation = await getIncarnation('db93f-provisionPool'); - t.is(ppIncarnation, 1); - - await contributeToPool(t, `30000${USDC_DENOM}`, true); - - t.log(`Add assets after bank upgrade`); - await evalBundles(NULL_UPGRADE_BANK_DIR); - await waitForBlock(2); - - const secondIncarnation = await getIncarnation('bank'); - t.is(secondIncarnation, 2); - - await evalBundles(ADD_OLIVES_DIR); -}); From 1ae68bdedf50f9c7d7da19067c697f9648bd4aeb Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 14:36:08 -0700 Subject: [PATCH 12/15] test: move localChain test to z:acceptance --- .../{n:upgrade-next => z:acceptance}/localchain.test.js | 0 a3p-integration/proposals/z:acceptance/package.json | 1 + 2 files changed, 1 insertion(+) rename a3p-integration/proposals/{n:upgrade-next => z:acceptance}/localchain.test.js (100%) diff --git a/a3p-integration/proposals/n:upgrade-next/localchain.test.js b/a3p-integration/proposals/z:acceptance/localchain.test.js similarity index 100% rename from a3p-integration/proposals/n:upgrade-next/localchain.test.js rename to a3p-integration/proposals/z:acceptance/localchain.test.js diff --git a/a3p-integration/proposals/z:acceptance/package.json b/a3p-integration/proposals/z:acceptance/package.json index a0fcaa82e22..9b7968892e3 100644 --- a/a3p-integration/proposals/z:acceptance/package.json +++ b/a3p-integration/proposals/z:acceptance/package.json @@ -3,6 +3,7 @@ "type": "/agoric.swingset.CoreEvalProposal", "sdk-generate": [ "testing/start-valueVow.js start-valueVow", + "vats/test-localchain.js localchaintest-submission", "testing/restart-valueVow.js restart-valueVow" ] }, From dcb24f19afd0b61359ba134f43fe65f25a9f411a Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 14:36:44 -0700 Subject: [PATCH 13/15] test: clean up use.sh and test.sh: comments and drop redudancies --- a3p-integration/proposals/n:upgrade-next/test.sh | 2 -- a3p-integration/proposals/n:upgrade-next/use.sh | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/a3p-integration/proposals/n:upgrade-next/test.sh b/a3p-integration/proposals/n:upgrade-next/test.sh index 07c0eb0d035..a3bc4a2d845 100755 --- a/a3p-integration/proposals/n:upgrade-next/test.sh +++ b/a3p-integration/proposals/n:upgrade-next/test.sh @@ -6,8 +6,6 @@ # suppress file names from glob that run earlier GLOBIGNORE=initial.test.js -yarn ava ./replaceElectorate.test.js - # test the state right after upgrade yarn ava initial.test.js diff --git a/a3p-integration/proposals/n:upgrade-next/use.sh b/a3p-integration/proposals/n:upgrade-next/use.sh index fa6c4e42f65..18740efb70e 100644 --- a/a3p-integration/proposals/n:upgrade-next/use.sh +++ b/a3p-integration/proposals/n:upgrade-next/use.sh @@ -4,7 +4,10 @@ set -uxeo pipefail node ./addGov4 + +# Econ Committee accept invitations for Committee and Charter ./acceptInvites.js +# "oracles" accept their invitations and provide prices to priceFeeds ./verifyPushedPrice.js 'ATOM' 12.01 ./verifyPushedPrice.js 'stATOM' 12.01 From fcbd971727863923f1571c40cf93c9a6ec36d2e0 Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Tue, 29 Oct 2024 15:02:23 -0700 Subject: [PATCH 14/15] test: gitignore localChaintest-submission/, now in z:acceptance --- a3p-integration/proposals/z:acceptance/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/a3p-integration/proposals/z:acceptance/.gitignore b/a3p-integration/proposals/z:acceptance/.gitignore index 146ed010dc0..3d143254692 100644 --- a/a3p-integration/proposals/z:acceptance/.gitignore +++ b/a3p-integration/proposals/z:acceptance/.gitignore @@ -1,3 +1,4 @@ !*submission/ restart-valueVow start-valueVow +localchaintest-submission From 3cb85b8a67fb69adf1bb0404cd101d205e05cd20 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 29 Oct 2024 23:56:38 +0000 Subject: [PATCH 15/15] fix(cosmos): express dependency between proposals --- golang/cosmos/app/upgrade.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/golang/cosmos/app/upgrade.go b/golang/cosmos/app/upgrade.go index edfc1855f88..25c9dcb6702 100644 --- a/golang/cosmos/app/upgrade.go +++ b/golang/cosmos/app/upgrade.go @@ -181,18 +181,21 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte if err != nil { return nil, err } else if priceFeedUpdate != nil { - CoreProposalSteps = append(CoreProposalSteps, priceFeedUpdate) + CoreProposalSteps = append(CoreProposalSteps, + priceFeedUpdate, + // The following have a dependency onto the price feed proposal + vm.CoreProposalStepForModules( + "@agoric/builders/scripts/vats/add-auction.js", + ), + vm.CoreProposalStepForModules( + "@agoric/builders/scripts/vats/upgradeVaults.js", + ), + ) } // Each CoreProposalStep runs sequentially, and can be constructed from // one or more modules executing in parallel within the step. CoreProposalSteps = append(CoreProposalSteps, - vm.CoreProposalStepForModules( - "@agoric/builders/scripts/vats/add-auction.js", - ), - vm.CoreProposalStepForModules( - "@agoric/builders/scripts/vats/upgradeVaults.js", - ), vm.CoreProposalStepForModules( // Upgrade Zoe (no new ZCF needed). "@agoric/builders/scripts/vats/upgrade-zoe.js",