@agoric/cosmos 0.35.0-u14.0 → 0.35.0-u15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,35 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.35.0-u15.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmos@0.35.0-u14.1...@agoric/cosmos@0.35.0-u15.0) (2024-04-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * upgrade zcf: install bundle and call updateZcfBundleId() ([74662d7](https://github.com/Agoric/agoric-sdk/commit/74662d73c0c213cbb537d7ff20e24fc31f35656d)), closes [#9250](https://github.com/Agoric/agoric-sdk/issues/9250)
12
+ * **cosmos:** Next upgrade is `agoric-upgrade-15` ([6a84bb1](https://github.com/Agoric/agoric-sdk/commit/6a84bb15b436a9f1f1556604028d029ef2190a8d))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * various fixes and features for u15 ([21e6f7c](https://github.com/Agoric/agoric-sdk/commit/21e6f7c7c36250d1cc270d97fada5590e8ae3a7f))
18
+
19
+
20
+
21
+ ## [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)
22
+
23
+
24
+ ### Features
25
+
26
+ * **cosmos:** add agorictest-upgrade-14-rc1 upgrade name ([f6e8731](https://github.com/gibson042/agoric-sdk/commit/f6e873145f0c064b7714db30765ad7ce3b755075))
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * eliminate fee double-charge by using configurable decorator ([65d5eef](https://github.com/gibson042/agoric-sdk/commit/65d5eeffe8fdb70fb939eb0c4cbcbb68abdc9326))
32
+
33
+
34
+
6
35
  ## [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)
7
36
 
8
37
 
package/ante/ante.go CHANGED
@@ -44,15 +44,12 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
44
44
  anteDecorators := []sdk.AnteDecorator{
45
45
  ante.NewSetUpContextDecorator(),
46
46
  ante.NewExtensionOptionsDecorator(nil), // reject all extensions
47
- // former ante.NewMempoolFeeDecorator()
48
- // replaced as in https://github.com/provenance-io/provenance/pull/1016
49
- ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, nil),
50
47
  ante.NewValidateBasicDecorator(),
51
48
  ante.NewTxTimeoutHeightDecorator(),
52
49
  ante.NewValidateMemoDecorator(opts.AccountKeeper),
53
50
  ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
54
51
  NewInboundDecorator(opts.SwingsetKeeper),
55
- NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, opts.FeeCollectorName),
52
+ ante.NewDeductFeeDecoratorWithName(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, nil, opts.FeeCollectorName),
56
53
  // SetPubKeyDecorator must be called before all signature verification decorators
57
54
  ante.NewSetPubKeyDecorator(opts.AccountKeeper),
58
55
  ante.NewValidateSigCountDecorator(opts.AccountKeeper),
package/app/app.go CHANGED
@@ -788,25 +788,18 @@ func NewAgoricApp(
788
788
  app.SetBeginBlocker(app.BeginBlocker)
789
789
  app.SetEndBlocker(app.EndBlocker)
790
790
 
791
- const (
792
- upgradeName = "agoric-upgrade-14"
793
- upgradeNameTest = "agorictest-upgrade-14"
794
- )
795
-
796
- app.UpgradeKeeper.SetUpgradeHandler(
797
- upgradeName,
798
- upgrade14Handler(app, upgradeName),
799
- )
800
- app.UpgradeKeeper.SetUpgradeHandler(
801
- upgradeNameTest,
802
- upgrade14Handler(app, upgradeNameTest),
803
- )
791
+ for name := range upgradeNamesOfThisVersion {
792
+ app.UpgradeKeeper.SetUpgradeHandler(
793
+ name,
794
+ upgrade15Handler(app, name),
795
+ )
796
+ }
804
797
 
805
798
  upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
806
799
  if err != nil {
807
800
  panic(err)
808
801
  }
809
- if (upgradeInfo.Name == upgradeName || upgradeInfo.Name == upgradeNameTest) && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
802
+ if upgradeNamesOfThisVersion[upgradeInfo.Name] && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
810
803
  storeUpgrades := storetypes.StoreUpgrades{
811
804
  Deleted: []string{
812
805
  crisistypes.ModuleName, // The SDK discontinued the crisis module in v0.51.0
@@ -837,20 +830,38 @@ func NewAgoricApp(
837
830
  return app
838
831
  }
839
832
 
840
- // upgrade14Handler performs standard upgrade actions plus custom actions for upgrade-14.
841
- func upgrade14Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
833
+ var upgradeNamesOfThisVersion = map[string]bool{
834
+ "agoric-upgrade-15": true,
835
+ "agorictest-upgrade-15": true,
836
+ }
837
+
838
+ func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool {
839
+ for name := range upgradeNamesOfThisVersion {
840
+ if app.UpgradeKeeper.GetDoneHeight(ctx, name) != 0 {
841
+ return false
842
+ }
843
+ }
844
+ return true
845
+ }
846
+
847
+ // upgrade15Handler performs standard upgrade actions plus custom actions for upgrade-15.
848
+ func upgrade15Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
842
849
  return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
843
850
  app.CheckControllerInited(false)
844
851
 
845
- // Each CoreProposalStep runs sequentially, and can be constructed from
846
- // one or more modules executing in parallel within the step.
847
- CoreProposalSteps := []vm.CoreProposalStep{
848
- // First, upgrade wallet factory
849
- vm.CoreProposalStepForModules("@agoric/vats/scripts/build-wallet-factory2-upgrade.js"),
850
- // Then, upgrade Zoe and ZCF
851
- vm.CoreProposalStepForModules("@agoric/vats/scripts/replace-zoe.js"),
852
- // Next revive KREAd characters
853
- vm.CoreProposalStepForModules("@agoric/vats/scripts/revive-kread.js"),
852
+ CoreProposalSteps := []vm.CoreProposalStep{}
853
+
854
+ // These CoreProposalSteps are not idempotent and should only be executed
855
+ // as part of the first upgrade using this handler on any given chain.
856
+ if isFirstTimeUpgradeOfThisVersion(app, ctx) {
857
+ // Each CoreProposalStep runs sequentially, and can be constructed from
858
+ // one or more modules executing in parallel within the step.
859
+ CoreProposalSteps = []vm.CoreProposalStep{
860
+ // Upgrade ZCF only
861
+ vm.CoreProposalStepForModules("@agoric/vats/scripts/upgrade-zcf.js"),
862
+ // Upgrade walletFactory
863
+ vm.CoreProposalStepForModules("@agoric/vats/scripts/build-wallet-factory2-upgrade.js"),
864
+ }
854
865
  }
855
866
 
856
867
  app.upgradeDetails = &upgradeDetails{
package/git-revision.txt CHANGED
@@ -1 +1 @@
1
- b3a6f3374
1
+ 734e86350
package/go.mod CHANGED
@@ -168,9 +168,6 @@ replace (
168
168
 
169
169
  github.com/confio/ics23/go => github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1
170
170
 
171
- // We need a fork of cosmos-sdk until all of the differences are merged.
172
- github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2
173
-
174
171
  // https://pkg.go.dev/vuln/GO-2023-2409
175
172
  github.com/dvsekhvalnov/jose2go => github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88
176
173
 
@@ -184,13 +181,22 @@ replace (
184
181
 
185
182
  // replace broken goleveldb.
186
183
  github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
184
+ )
185
+
186
+ // Agoric-specific replacements:
187
+ replace (
188
+ // We need a fork of cosmos-sdk until all of the differences are merged.
189
+ github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.4
190
+
191
+ // Pick up an IAVL race fix.
192
+ github.com/cosmos/iavl => github.com/cosmos/iavl v0.19.7
187
193
 
188
194
  // use cometbft
189
195
  // Use our fork at least until post-v0.34.14 is released with
190
196
  // https://github.com/tendermint/tendermint/issue/6899 resolved.
191
197
  github.com/tendermint/tendermint => github.com/agoric-labs/cometbft v0.34.30-alpha.agoric.1
192
198
 
193
- // For testing against a local cosmos-sdk or tendermint
199
+ // For testing against a local cosmos-sdk or cometbft
194
200
  // github.com/cosmos/cosmos-sdk => ../../../forks/cosmos-sdk
195
- // github.com/tendermint/tendermint => ../../../forks/tendermint
201
+ // github.com/tendermint/tendermint => ../../../forks/cometbft
196
202
  )
package/go.sum CHANGED
@@ -232,8 +232,8 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA
232
232
  github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
233
233
  github.com/agoric-labs/cometbft v0.34.30-alpha.agoric.1 h1:tqCNL72pQXdUmBzgv1md5SN2U3K/PaYQ4qZ5pFv8v6w=
234
234
  github.com/agoric-labs/cometbft v0.34.30-alpha.agoric.1/go.mod h1:myvkihZD8eg9jKE3WFaugkNoL5nvEqlP7Jbjg98pCek=
235
- github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2 h1:iHHqpYC0JzMbH4UYnQrcwVjLyHJuQphB0ogHbuLz44c=
236
- github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2/go.mod h1:zUe5lsg/X7SeSO1nGkzOh9EGKO295szfrxIxYmeLYic=
235
+ github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.4 h1:i5IgChQjTyWulV/y5NpVBB5qBJETQ59hYglod6vhok0=
236
+ github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.4/go.mod h1:d7e4h+w7FNBNmE6ysp6duBVuQg67pqMtvsLwpT9ca3E=
237
237
  github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1 h1:2jvHI/2d+psWAZy6FQ0vXJCHUtfU3ZbbW+pQFL04arQ=
238
238
  github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
239
239
  github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
@@ -376,8 +376,8 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY
376
376
  github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
377
377
  github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y=
378
378
  github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
379
- github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU=
380
- github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
379
+ github.com/cosmos/iavl v0.19.7 h1:ij32FaEnwxfEurtK0QKDNhTWFnz6NUmrI5gky/WnoY0=
380
+ github.com/cosmos/iavl v0.19.7/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
381
381
  github.com/cosmos/ibc-go/v6 v6.2.1 h1:NiaDXTRhKwf3n9kELD4VRIe5zby1yk1jBvaz9tXTQ6k=
382
382
  github.com/cosmos/ibc-go/v6 v6.2.1/go.mod h1:XLsARy4Y7+GtAqzMcxNdlQf6lx+ti1e8KcMGv5NIK7A=
383
383
  github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmos",
3
- "version": "0.35.0-u14.0",
3
+ "version": "0.35.0-u15.0",
4
4
  "description": "Connect JS to the Cosmos blockchain SDK",
5
5
  "parsers": {
6
6
  "js": "mjs"
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "b3a6f3374cb3bddab39fc6d6f426429cae6c29c6"
38
+ "gitHead": "734e8635002e01b3e27477e93998dda942c7fae8"
39
39
  }
package/ante/fee.go DELETED
@@ -1,96 +0,0 @@
1
- package ante
2
-
3
- import (
4
- "fmt"
5
-
6
- sdk "github.com/cosmos/cosmos-sdk/types"
7
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
8
- "github.com/cosmos/cosmos-sdk/x/auth/types"
9
- )
10
-
11
- // DeductFeeDecorator deducts fees from the first signer of the tx
12
- // If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error
13
- // Call next AnteHandler if fees successfully deducted
14
- // CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator
15
- type DeductFeeDecorator struct {
16
- ak AccountKeeper
17
- bankKeeper types.BankKeeper
18
- feegrantKeeper FeegrantKeeper
19
- feeCollectorName string
20
- }
21
-
22
- func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKeeper, feeCollectorName string) DeductFeeDecorator {
23
- return DeductFeeDecorator{
24
- ak: ak,
25
- bankKeeper: bk,
26
- feegrantKeeper: fk,
27
- feeCollectorName: feeCollectorName,
28
- }
29
- }
30
-
31
- func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
32
- feeTx, ok := tx.(sdk.FeeTx)
33
- if !ok {
34
- return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
35
- }
36
-
37
- if addr := dfd.ak.GetModuleAddress(dfd.feeCollectorName); addr == nil {
38
- return ctx, fmt.Errorf("Fee collector module account (%s) has not been set", dfd.feeCollectorName)
39
- }
40
-
41
- fee := feeTx.GetFee()
42
- feePayer := feeTx.FeePayer()
43
- feeGranter := feeTx.FeeGranter()
44
-
45
- deductFeesFrom := feePayer
46
-
47
- // if feegranter set deduct fee from feegranter account.
48
- // this works with only when feegrant enabled.
49
- if feeGranter != nil {
50
- if dfd.feegrantKeeper == nil {
51
- return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "fee grants are not enabled")
52
- } else if !feeGranter.Equals(feePayer) {
53
- err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, tx.GetMsgs())
54
-
55
- if err != nil {
56
- return ctx, sdkerrors.Wrapf(err, "%s not allowed to pay fees from %s", feeGranter, feePayer)
57
- }
58
- }
59
-
60
- deductFeesFrom = feeGranter
61
- }
62
-
63
- deductFeesFromAcc := dfd.ak.GetAccount(ctx, deductFeesFrom)
64
- if deductFeesFromAcc == nil {
65
- return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "fee payer address: %s does not exist", deductFeesFrom)
66
- }
67
-
68
- // deduct the fees
69
- if !feeTx.GetFee().IsZero() {
70
- err = DeductFees(dfd.bankKeeper, ctx, deductFeesFromAcc, feeTx.GetFee(), dfd.feeCollectorName)
71
- if err != nil {
72
- return ctx, err
73
- }
74
- }
75
-
76
- events := sdk.Events{sdk.NewEvent(sdk.EventTypeTx,
77
- sdk.NewAttribute(sdk.AttributeKeyFee, feeTx.GetFee().String()),
78
- )}
79
- ctx.EventManager().EmitEvents(events)
80
-
81
- return next(ctx, tx, simulate)
82
- }
83
-
84
- // DeductFees deducts fees from the given account.
85
- func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI, fees sdk.Coins, feeCollectorName string) error {
86
- if !fees.IsValid() {
87
- return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "invalid fee amount: %s", fees)
88
- }
89
-
90
- err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), feeCollectorName, fees)
91
- if err != nil {
92
- return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error())
93
- }
94
-
95
- return nil
96
- }