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

chore: repair upgrade 18 proposal #10363

Merged
merged 15 commits into from
Oct 30, 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
8 changes: 0 additions & 8 deletions a3p-integration/proposals/n:upgrade-next/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions a3p-integration/proposals/n:upgrade-next/eval.sh

This file was deleted.

17 changes: 0 additions & 17 deletions a3p-integration/proposals/n:upgrade-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 main",
"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",
Expand Down
102 changes: 0 additions & 102 deletions a3p-integration/proposals/n:upgrade-next/provisionPool.test.js

This file was deleted.

41 changes: 0 additions & 41 deletions a3p-integration/proposals/n:upgrade-next/resetChargingPeriod.js

This file was deleted.

2 changes: 0 additions & 2 deletions a3p-integration/proposals/n:upgrade-next/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions a3p-integration/proposals/n:upgrade-next/use.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions a3p-integration/proposals/z:acceptance/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
!*submission/
restart-valueVow
start-valueVow
localchaintest-submission
1 change: 1 addition & 0 deletions a3p-integration/proposals/z:acceptance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
Expand Down
77 changes: 45 additions & 32 deletions golang/cosmos/app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand All @@ -106,23 +106,27 @@ 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)

if variant == "" {
return nil, nil
}

return buildProposalStepWithArgs(
"@agoric/builders/scripts/inter-protocol/replace-electorate-core.js",
Expand All @@ -134,7 +138,11 @@ func replaceElectorateCoreProposalStep(upgradeName string) (vm.CoreProposalStep,
}

func replacePriceFeedsCoreProposal(upgradeName string) (vm.CoreProposalStep, error) {
variant := getVariantFromUpgradeName(upgradeName)
variant := getVariantFromUpgradeName(upgradeName)

if variant == "" {
return nil, nil
}

return buildProposalStepWithArgs(
"@agoric/builders/scripts/inter-protocol/updatePriceFeeds.js",
Expand Down Expand Up @@ -165,37 +173,42 @@ 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,
// 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 = []vm.CoreProposalStep{
replaceElectorateStep,
priceFeedUpdate,
vm.CoreProposalStepForModules(
"@agoric/builders/scripts/vats/add-auction.js",
),
vm.CoreProposalStepForModules(
"@agoric/builders/scripts/vats/upgradeVaults.js",
),
CoreProposalSteps = append(CoreProposalSteps,
vm.CoreProposalStepForModules(
// 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",
),
}
)
}

app.upgradeDetails = &upgradeDetails{
Expand Down
6 changes: 3 additions & 3 deletions golang/cosmos/cmd/agd/agvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/cmd/agd/find_binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,7 +32,7 @@ func FindBinaryNextToMe(walkUp int, path... string) (string, error) {
if _, err = os.Stat(bin); err != nil {
return "", err
}

return bin, nil
}

Expand Down
Loading
Loading