Skip to content

Commit

Permalink
Merge pull request #9073 from Agoric/prepare-release-20240312T004505
Browse files Browse the repository at this point in the history
chore(release): publish upgrade-14 RC1
  • Loading branch information
michaelfig authored Mar 12, 2024
2 parents 28b493b + d69c011 commit c876ab1
Show file tree
Hide file tree
Showing 35 changed files with 278 additions and 171 deletions.
74 changes: 74 additions & 0 deletions a3p-integration/proposals/a:upgrade-14/ante-fees.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import test from 'ava';

import { CHAINID, GOV1ADDR, GOV2ADDR, agd } from '@agoric/synthetic-chain';

test(`ante handler sends fee only to vbank/reserve`, async t => {
const [feeCollector, vbankReserve] = await Promise.all(
// Look up addresses for fee collector and reserve accounts.
['fee_collector', 'vbank/reserve'].map(async name => {
const {
account: {
'@type': moduleAcct,
base_account: { address },
},
} = await agd.query('auth', 'module-account', name);

t.is(
moduleAcct,
'/cosmos.auth.v1beta1.ModuleAccount',
`${name} is a module account`,
);
return address;
}),
);

const getBalances = addresses =>
Promise.all(
addresses.map(async address => {
const { balances } = await agd.query('bank', 'balances', address);
return balances;
}),
);

const [feeCollectorStartBalances, vbankReserveStartBalances] =
await getBalances([feeCollector, vbankReserve]);

// Send a transaction with a known fee.
const feeAmount = 999n;
const feeDenom = 'uist';
const result = await agd.tx(
`bank send ${GOV1ADDR} ${GOV2ADDR} 1234ubld --fees=${feeAmount}${feeDenom} \
--from=${GOV1ADDR} --chain-id=${CHAINID} --keyring-backend=test --yes`,
);
t.like(result, { code: 0 });

const [feeCollectorEndBalances, vbankReserveEndBalances] = await getBalances([
feeCollector,
vbankReserve,
]);
t.deepEqual(feeCollectorEndBalances, feeCollectorStartBalances);

// The reserve balances should have increased by exactly the fee (possibly
// from zero, in which case start balances wouldn't include its denomination).
const feeDenomIndex = vbankReserveStartBalances.findIndex(
({ denom }) => denom === feeDenom,
);
const preFeeAmount =
feeDenomIndex < 0
? 0n
: BigInt(vbankReserveStartBalances[feeDenomIndex].amount);
const beforeCount =
feeDenomIndex < 0 ? vbankReserveStartBalances.length : feeDenomIndex;

const vbankReserveExpectedBalances = [
...vbankReserveStartBalances.slice(0, beforeCount),
{ amount: String(preFeeAmount + feeAmount), denom: feeDenom },
...vbankReserveStartBalances.slice(beforeCount + 1),
];

t.deepEqual(
vbankReserveEndBalances,
vbankReserveExpectedBalances,
'vbank/reserve should receive the fee',
);
});
14 changes: 14 additions & 0 deletions golang/cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.35.0-u14.1](https://github.com/gibson042/agoric-sdk/compare/@agoric/cosmos@0.35.0-u14.0...@agoric/cosmos@0.35.0-u14.1) (2024-03-12)


### Features

* **cosmos:** add agorictest-upgrade-14-rc1 upgrade name ([f6e8731](https://github.com/gibson042/agoric-sdk/commit/f6e873145f0c064b7714db30765ad7ce3b755075))


### Bug Fixes

* eliminate fee double-charge by using configurable decorator ([65d5eef](https://github.com/gibson042/agoric-sdk/commit/65d5eeffe8fdb70fb939eb0c4cbcbb68abdc9326))



## [0.35.0-u14.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmos@0.35.0-u13.0...@agoric/cosmos@0.35.0-u14.0) (2024-02-27)


Expand Down
5 changes: 1 addition & 4 deletions golang/cosmos/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,12 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(),
ante.NewExtensionOptionsDecorator(nil), // reject all extensions
// former ante.NewMempoolFeeDecorator()
// replaced as in https://github.com/provenance-io/provenance/pull/1016
ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, nil),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(opts.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
NewInboundDecorator(opts.SwingsetKeeper),
NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, opts.FeeCollectorName),
ante.NewDeductFeeDecoratorWithName(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, nil, opts.FeeCollectorName),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(opts.AccountKeeper),
ante.NewValidateSigCountDecorator(opts.AccountKeeper),
Expand Down
96 changes: 0 additions & 96 deletions golang/cosmos/ante/fee.go

This file was deleted.

60 changes: 37 additions & 23 deletions golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,25 +788,18 @@ func NewAgoricApp(
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)

const (
upgradeName = "agoric-upgrade-14"
upgradeNameTest = "agorictest-upgrade-14"
)

app.UpgradeKeeper.SetUpgradeHandler(
upgradeName,
upgrade14Handler(app, upgradeName),
)
app.UpgradeKeeper.SetUpgradeHandler(
upgradeNameTest,
upgrade14Handler(app, upgradeNameTest),
)
for name := range upgradeNamesOfThisVersion {
app.UpgradeKeeper.SetUpgradeHandler(
name,
upgrade14Handler(app, name),
)
}

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if (upgradeInfo.Name == upgradeName || upgradeInfo.Name == upgradeNameTest) && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
if upgradeNamesOfThisVersion[upgradeInfo.Name] && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Deleted: []string{
crisistypes.ModuleName, // The SDK discontinued the crisis module in v0.51.0
Expand Down Expand Up @@ -837,20 +830,41 @@ func NewAgoricApp(
return app
}

var upgradeNamesOfThisVersion = map[string]bool{
"agoric-upgrade-14": true,
"agorictest-upgrade-14": true,
"agorictest-upgrade-14-2": true,
}

func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool {
for name := range upgradeNamesOfThisVersion {
if app.UpgradeKeeper.GetDoneHeight(ctx, name) != 0 {
return false
}
}
return true
}

// upgrade14Handler performs standard upgrade actions plus custom actions for upgrade-14.
func upgrade14Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
app.CheckControllerInited(false)

// Each CoreProposalStep runs sequentially, and can be constructed from
// one or more modules executing in parallel within the step.
CoreProposalSteps := []vm.CoreProposalStep{
// First, upgrade wallet factory
vm.CoreProposalStepForModules("@agoric/vats/scripts/build-wallet-factory2-upgrade.js"),
// Then, upgrade Zoe and ZCF
vm.CoreProposalStepForModules("@agoric/vats/scripts/replace-zoe.js"),
// Next revive KREAd characters
vm.CoreProposalStepForModules("@agoric/vats/scripts/revive-kread.js"),
CoreProposalSteps := []vm.CoreProposalStep{}

// These CoreProposalSteps are not idempotent and should only be executed
// as part of the first upgrade-14 on any given chain.
if isFirstTimeUpgradeOfThisVersion(app, ctx) {
// Each CoreProposalStep runs sequentially, and can be constructed from
// one or more modules executing in parallel within the step.
CoreProposalSteps = []vm.CoreProposalStep{
// First, upgrade wallet factory
vm.CoreProposalStepForModules("@agoric/vats/scripts/build-wallet-factory2-upgrade.js"),
// Then, upgrade Zoe and ZCF
vm.CoreProposalStepForModules("@agoric/vats/scripts/replace-zoe.js"),
// Next revive KREAd characters
vm.CoreProposalStepForModules("@agoric/vats/scripts/revive-kread.js"),
}
}

app.upgradeDetails = &upgradeDetails{
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ replace (
github.com/confio/ics23/go => github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1

// We need a fork of cosmos-sdk until all of the differences are merged.
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.1

// https://pkg.go.dev/vuln/GO-2023-2409
github.com/dvsekhvalnov/jose2go => github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/agoric-labs/cometbft v0.34.30-alpha.agoric.1 h1:tqCNL72pQXdUmBzgv1md5SN2U3K/PaYQ4qZ5pFv8v6w=
github.com/agoric-labs/cometbft v0.34.30-alpha.agoric.1/go.mod h1:myvkihZD8eg9jKE3WFaugkNoL5nvEqlP7Jbjg98pCek=
github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2 h1:iHHqpYC0JzMbH4UYnQrcwVjLyHJuQphB0ogHbuLz44c=
github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2/go.mod h1:zUe5lsg/X7SeSO1nGkzOh9EGKO295szfrxIxYmeLYic=
github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.1 h1:VZFX9Mogwt4cVTnkdt9zA6UJue4XYXdBURNhlTWw71Q=
github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.1/go.mod h1:zUe5lsg/X7SeSO1nGkzOh9EGKO295szfrxIxYmeLYic=
github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1 h1:2jvHI/2d+psWAZy6FQ0vXJCHUtfU3ZbbW+pQFL04arQ=
github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agoric/cosmos",
"version": "0.35.0-u14.0",
"version": "0.35.0-u14.1",
"description": "Connect JS to the Cosmos blockchain SDK",
"parsers": {
"js": "mjs"
Expand Down
8 changes: 8 additions & 0 deletions packages/agoric-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.22.0-u14.1](https://github.com/Agoric/agoric-sdk/compare/agoric@0.22.0-u14.0...agoric@0.22.0-u14.1) (2024-03-12)

**Note:** Version bump only for package agoric





## [0.22.0-u14.0](https://github.com/Agoric/agoric-sdk/compare/agoric@0.22.0-u13.0...agoric@0.22.0-u14.0) (2024-02-27)


Expand Down
10 changes: 5 additions & 5 deletions packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agoric",
"version": "0.22.0-u14.0",
"version": "0.22.0-u14.1",
"description": "Manage the Agoric Javascript smart contract platform",
"type": "module",
"main": "src/main.js",
Expand Down Expand Up @@ -29,7 +29,7 @@
"lint:eslint": "eslint ."
},
"devDependencies": {
"@agoric/deploy-script-support": "^0.10.4-u14.0",
"@agoric/deploy-script-support": "^0.10.4-u14.1",
"ava": "^5.2.0",
"c8": "^7.13.0",
"dd-trace": "^3.3.0"
Expand All @@ -41,12 +41,12 @@
"@agoric/casting": "^0.4.3-u14.0",
"@agoric/cosmic-proto": "^0.3.1-u14.0",
"@agoric/ertp": "^0.16.3-u14.0",
"@agoric/inter-protocol": "^0.16.2-u14.0",
"@agoric/inter-protocol": "^0.16.2-u14.1",
"@agoric/internal": "^0.4.0-u14.0",
"@agoric/smart-wallet": "^0.5.4-u14.0",
"@agoric/smart-wallet": "^0.5.4-u14.1",
"@agoric/store": "^0.9.3-u14.0",
"@agoric/swingset-vat": "^0.32.3-u14.0",
"@agoric/vats": "^0.15.2-u14.0",
"@agoric/vats": "^0.15.2-u14.1",
"@agoric/zoe": "^0.26.3-u14.0",
"@agoric/zone": "^0.2.3-u14.0",
"@confio/relayer": "^0.9.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/cosmic-swingset/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.42.0-u14.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmic-swingset@0.42.0-u14.0...@agoric/cosmic-swingset@0.42.0-u14.1) (2024-03-12)

**Note:** Version bump only for package @agoric/cosmic-swingset





## [0.42.0-u14.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmic-swingset@0.42.0-u13.0...@agoric/cosmic-swingset@0.42.0-u14.0) (2024-02-27)


Expand Down
Loading

0 comments on commit c876ab1

Please sign in to comment.