Skip to content

Commit

Permalink
chore: repair upgrade 18 proposal (#10363)
Browse files Browse the repository at this point in the history
## Description

Fix a variety of things in a3p-integration for Upgrade 18

 * The keys in updatePriceFeeds.js for specifying the platform don't match what's needed.
 * move test-localchain.js to z:acceptance
 * drop extraneous sdk-generate entries in package.json
 * drop eval.sh (and code it intended to run)
 * make upgrade.go and the parameterized proposals more robust to variations in the parameters
 * clean up go formatting

### Security Considerations

N/A

### Scaling Considerations

No impact

### Documentation Considerations
None

### Testing Considerations

We'll verify in DevNet

The logic for configurable core proposals was tested locally with the following `upgrade-next` config (in `package.json`):

```
  "agoricProposal": {
    "releaseNotes": false,
    "sdkImageTag": "unreleased",
    "planName": "UNRELEASED_BASIC",
    "upgradeInfo": {
      "coreProposals": {
        "steps": [
          [
            {
              "module": "@agoric/builders/scripts/inter-protocol/replace-electorate-core.js",
              "entrypoint": "defaultProposalBuilder",
              "args": [
                {
                  "config": {
                    "committeeName": "Economic Committee",
                    "voterAddresses": {
                      "gov1": "agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q",
                      "gov2": "agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277",
                      "gov4": "agoric1c9gyu460lu70rtcdp95vummd6032psmpdx7wdy"
                    },
                    "highPrioritySendersConfig": {
                      "addressesToAdd": [
                        "agoric1c9gyu460lu70rtcdp95vummd6032psmpdx7wdy"
                      ],
                      "addressesToRemove": [
                        "agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq"
                      ]
                    }
                  }
                }
              ]
            }
          ],
          [
            {
              "module": "@agoric/builders/scripts/inter-protocol/updatePriceFeeds.js",
              "entrypoint": "defaultProposalBuilder",
              "args": [
                {
                  "config": {
                    "oracleAddresses": [
                      "agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q",
                      "agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277",
                      "agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq"
                    ],
                    "inBrandNames": [
                      "ATOM",
                      "stATOM"
                    ]
                  }
                }
              ]
            }
          ],
          [
            "@agoric/builders/scripts/vats/add-auction.js"
          ],
          [
            "@agoric/builders/scripts/vats/upgradeVaults.js"
          ]
        ]
      }
    },
    "type": "Software Upgrade Proposal"
  },
```

### Upgrade Considerations

It's all upgrade.
  • Loading branch information
mergify[bot] authored Oct 30, 2024
2 parents ced5d49 + 3cb85b8 commit ef001c0
Show file tree
Hide file tree
Showing 19 changed files with 160 additions and 261 deletions.
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

0 comments on commit ef001c0

Please sign in to comment.