@agoric/cosmos 0.35.0-u14.0 → 0.35.0-u14.1
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 +14 -0
- package/ante/ante.go +1 -4
- package/app/app.go +37 -23
- package/git-revision.txt +1 -1
- package/go.mod +1 -1
- package/go.sum +2 -2
- package/package.json +2 -2
- package/ante/fee.go +0 -96
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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-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)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **cosmos:** add agorictest-upgrade-14-rc1 upgrade name ([f6e8731](https://github.com/gibson042/agoric-sdk/commit/f6e873145f0c064b7714db30765ad7ce3b755075))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* eliminate fee double-charge by using configurable decorator ([65d5eef](https://github.com/gibson042/agoric-sdk/commit/65d5eeffe8fdb70fb939eb0c4cbcbb68abdc9326))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
## [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
21
|
|
|
8
22
|
|
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
|
-
|
|
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
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
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
|
+
upgrade14Handler(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
|
|
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,41 @@ func NewAgoricApp(
|
|
|
837
830
|
return app
|
|
838
831
|
}
|
|
839
832
|
|
|
833
|
+
var upgradeNamesOfThisVersion = map[string]bool{
|
|
834
|
+
"agoric-upgrade-14": true,
|
|
835
|
+
"agorictest-upgrade-14": true,
|
|
836
|
+
"agorictest-upgrade-14-2": true,
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool {
|
|
840
|
+
for name := range upgradeNamesOfThisVersion {
|
|
841
|
+
if app.UpgradeKeeper.GetDoneHeight(ctx, name) != 0 {
|
|
842
|
+
return false
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return true
|
|
846
|
+
}
|
|
847
|
+
|
|
840
848
|
// upgrade14Handler performs standard upgrade actions plus custom actions for upgrade-14.
|
|
841
849
|
func upgrade14Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
|
|
842
850
|
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
|
|
843
851
|
app.CheckControllerInited(false)
|
|
844
852
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
CoreProposalSteps
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
//
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
853
|
+
CoreProposalSteps := []vm.CoreProposalStep{}
|
|
854
|
+
|
|
855
|
+
// These CoreProposalSteps are not idempotent and should only be executed
|
|
856
|
+
// as part of the first upgrade-14 on any given chain.
|
|
857
|
+
if isFirstTimeUpgradeOfThisVersion(app, ctx) {
|
|
858
|
+
// Each CoreProposalStep runs sequentially, and can be constructed from
|
|
859
|
+
// one or more modules executing in parallel within the step.
|
|
860
|
+
CoreProposalSteps = []vm.CoreProposalStep{
|
|
861
|
+
// First, upgrade wallet factory
|
|
862
|
+
vm.CoreProposalStepForModules("@agoric/vats/scripts/build-wallet-factory2-upgrade.js"),
|
|
863
|
+
// Then, upgrade Zoe and ZCF
|
|
864
|
+
vm.CoreProposalStepForModules("@agoric/vats/scripts/replace-zoe.js"),
|
|
865
|
+
// Next revive KREAd characters
|
|
866
|
+
vm.CoreProposalStepForModules("@agoric/vats/scripts/revive-kread.js"),
|
|
867
|
+
}
|
|
854
868
|
}
|
|
855
869
|
|
|
856
870
|
app.upgradeDetails = &upgradeDetails{
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d69c01100
|
package/go.mod
CHANGED
|
@@ -169,7 +169,7 @@ replace (
|
|
|
169
169
|
github.com/confio/ics23/go => github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1
|
|
170
170
|
|
|
171
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
|
|
172
|
+
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.1
|
|
173
173
|
|
|
174
174
|
// https://pkg.go.dev/vuln/GO-2023-2409
|
|
175
175
|
github.com/dvsekhvalnov/jose2go => github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88
|
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:
|
|
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.1 h1:VZFX9Mogwt4cVTnkdt9zA6UJue4XYXdBURNhlTWw71Q=
|
|
236
|
+
github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.1/go.mod h1:zUe5lsg/X7SeSO1nGkzOh9EGKO295szfrxIxYmeLYic=
|
|
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=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.35.0-u14.
|
|
3
|
+
"version": "0.35.0-u14.1",
|
|
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": "
|
|
38
|
+
"gitHead": "d69c011001d300735546dcb74a9ae21e306e4789"
|
|
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
|
-
}
|