@agoric/cosmos 0.34.2-dev-5d5ee65.0 → 0.34.2-dev-c731c8c.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/ante/ante.go +1 -4
- package/git-revision.txt +1 -1
- package/go.mod +1 -1
- package/go.sum +2 -2
- package/package.json +2 -2
- package/proto/agoric/swingset/swingset.proto +1 -1
- package/x/swingset/types/swingset.pb.go +1 -1
- package/ante/fee.go +0 -97
package/ante/ante.go
CHANGED
|
@@ -45,15 +45,12 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
|
|
|
45
45
|
anteDecorators := []sdk.AnteDecorator{
|
|
46
46
|
ante.NewSetUpContextDecorator(),
|
|
47
47
|
ante.NewExtensionOptionsDecorator(nil), // reject all extensions
|
|
48
|
-
// former ante.NewMempoolFeeDecorator()
|
|
49
|
-
// replaced as in https://github.com/provenance-io/provenance/pull/1016
|
|
50
|
-
ante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, nil),
|
|
51
48
|
ante.NewValidateBasicDecorator(),
|
|
52
49
|
ante.NewTxTimeoutHeightDecorator(),
|
|
53
50
|
ante.NewValidateMemoDecorator(opts.AccountKeeper),
|
|
54
51
|
ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
|
|
55
52
|
NewInboundDecorator(opts.SwingsetKeeper),
|
|
56
|
-
|
|
53
|
+
ante.NewDeductFeeDecoratorWithName(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper, nil, opts.FeeCollectorName),
|
|
57
54
|
// SetPubKeyDecorator must be called before all signature verification decorators
|
|
58
55
|
ante.NewSetPubKeyDecorator(opts.AccountKeeper),
|
|
59
56
|
ante.NewValidateSigCountDecorator(opts.AccountKeeper),
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
c731c8c
|
package/go.mod
CHANGED
|
@@ -187,7 +187,7 @@ replace (
|
|
|
187
187
|
// Agoric-specific replacements:
|
|
188
188
|
replace (
|
|
189
189
|
// We need a fork of cosmos-sdk until all of the differences are merged.
|
|
190
|
-
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2
|
|
190
|
+
github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.1
|
|
191
191
|
|
|
192
192
|
// Async version negotiation
|
|
193
193
|
github.com/cosmos/ibc-go/v6 => github.com/agoric-labs/ibc-go/v6 v6.2.1-alpha.agoric.3
|
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/agoric-labs/ibc-go/v6 v6.2.1-alpha.agoric.3 h1:YqvVwK+Lg/ZsuwyVm9UbPs8K55fg00R3Y9KnmaTBdgc=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.34.2-dev-
|
|
3
|
+
"version": "0.34.2-dev-c731c8c.0+c731c8c",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"typeCoverage": {
|
|
39
39
|
"atLeast": 0
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "c731c8cc815d9cbc814a79a7e53936d672d67a9b"
|
|
42
42
|
}
|
|
@@ -8,7 +8,7 @@ option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types
|
|
|
8
8
|
|
|
9
9
|
// CoreEvalProposal is a gov Content type for evaluating code in the SwingSet
|
|
10
10
|
// core.
|
|
11
|
-
// See `agoric-sdk
|
|
11
|
+
// See `bridgeCoreEval` in agoric-sdk packages/vats/src/core/chain-behaviors.js.
|
|
12
12
|
message CoreEvalProposal {
|
|
13
13
|
option (gogoproto.goproto_getters) = false;
|
|
14
14
|
|
|
@@ -27,7 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
27
27
|
|
|
28
28
|
// CoreEvalProposal is a gov Content type for evaluating code in the SwingSet
|
|
29
29
|
// core.
|
|
30
|
-
// See `agoric-sdk
|
|
30
|
+
// See `bridgeCoreEval` in agoric-sdk packages/vats/src/core/chain-behaviors.js.
|
|
31
31
|
type CoreEvalProposal struct {
|
|
32
32
|
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
|
|
33
33
|
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
package/ante/fee.go
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
package ante
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
|
|
6
|
-
sdkioerrors "cosmossdk.io/errors"
|
|
7
|
-
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
-
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
9
|
-
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
// DeductFeeDecorator deducts fees from the first signer of the tx
|
|
13
|
-
// If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error
|
|
14
|
-
// Call next AnteHandler if fees successfully deducted
|
|
15
|
-
// CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator
|
|
16
|
-
type DeductFeeDecorator struct {
|
|
17
|
-
ak AccountKeeper
|
|
18
|
-
bankKeeper types.BankKeeper
|
|
19
|
-
feegrantKeeper FeegrantKeeper
|
|
20
|
-
feeCollectorName string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKeeper, feeCollectorName string) DeductFeeDecorator {
|
|
24
|
-
return DeductFeeDecorator{
|
|
25
|
-
ak: ak,
|
|
26
|
-
bankKeeper: bk,
|
|
27
|
-
feegrantKeeper: fk,
|
|
28
|
-
feeCollectorName: feeCollectorName,
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
|
|
33
|
-
feeTx, ok := tx.(sdk.FeeTx)
|
|
34
|
-
if !ok {
|
|
35
|
-
return ctx, sdkioerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if addr := dfd.ak.GetModuleAddress(dfd.feeCollectorName); addr == nil {
|
|
39
|
-
return ctx, fmt.Errorf("fee collector module account (%s) has not been set", dfd.feeCollectorName)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
fee := feeTx.GetFee()
|
|
43
|
-
feePayer := feeTx.FeePayer()
|
|
44
|
-
feeGranter := feeTx.FeeGranter()
|
|
45
|
-
|
|
46
|
-
deductFeesFrom := feePayer
|
|
47
|
-
|
|
48
|
-
// if feegranter set deduct fee from feegranter account.
|
|
49
|
-
// this works with only when feegrant enabled.
|
|
50
|
-
if feeGranter != nil {
|
|
51
|
-
if dfd.feegrantKeeper == nil {
|
|
52
|
-
return ctx, sdkioerrors.Wrap(sdkerrors.ErrInvalidRequest, "fee grants are not enabled")
|
|
53
|
-
} else if !feeGranter.Equals(feePayer) {
|
|
54
|
-
err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, tx.GetMsgs())
|
|
55
|
-
|
|
56
|
-
if err != nil {
|
|
57
|
-
return ctx, sdkioerrors.Wrapf(err, "%s not allowed to pay fees from %s", feeGranter, feePayer)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
deductFeesFrom = feeGranter
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
deductFeesFromAcc := dfd.ak.GetAccount(ctx, deductFeesFrom)
|
|
65
|
-
if deductFeesFromAcc == nil {
|
|
66
|
-
return ctx, sdkioerrors.Wrapf(sdkerrors.ErrUnknownAddress, "fee payer address: %s does not exist", deductFeesFrom)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// deduct the fees
|
|
70
|
-
if !feeTx.GetFee().IsZero() {
|
|
71
|
-
err = DeductFees(dfd.bankKeeper, ctx, deductFeesFromAcc, feeTx.GetFee(), dfd.feeCollectorName)
|
|
72
|
-
if err != nil {
|
|
73
|
-
return ctx, err
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
events := sdk.Events{sdk.NewEvent(sdk.EventTypeTx,
|
|
78
|
-
sdk.NewAttribute(sdk.AttributeKeyFee, feeTx.GetFee().String()),
|
|
79
|
-
)}
|
|
80
|
-
ctx.EventManager().EmitEvents(events)
|
|
81
|
-
|
|
82
|
-
return next(ctx, tx, simulate)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// DeductFees deducts fees from the given account.
|
|
86
|
-
func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI, fees sdk.Coins, feeCollectorName string) error {
|
|
87
|
-
if !fees.IsValid() {
|
|
88
|
-
return sdkioerrors.Wrapf(sdkerrors.ErrInsufficientFee, "invalid fee amount: %s", fees)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), feeCollectorName, fees)
|
|
92
|
-
if err != nil {
|
|
93
|
-
return sdkioerrors.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error())
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return nil
|
|
97
|
-
}
|