diff --git a/Makefile b/Makefile index 1b53ff5..25efb4f 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ provider-start: build-apps $(providerd) config set client chain-id provider-localnet $(providerd) config set client keyring-backend test $(providerd) keys add val - $(providerd) genesis add-genesis-account val 1000000000000uatone + $(providerd) genesis add-genesis-account val 1000000000000uatone,1000000000000uphoton $(providerd) keys add user $(providerd) genesis add-genesis-account user 1000000000uatone $(providerd) genesis gentx val 1000000000uatone @@ -167,7 +167,18 @@ consumer-start: consumer-init consumer-create $(MAKE) consumer-genesis CONSUMER_ID=0 $(MAKE) consumer-run -.PHONY: consumer-init consumer-create consumer-genesis consumer-run consumer-start +# Fund a consumer's fee pool so the provider can collect its per-block fees and +# the consumer stays out of debt. The fee denom is uphoton (fixed at module +# wiring); FEE_POOL_AMOUNT must clear the min-deposit floor +# (fees_per_block_amount x min_deposit_blocks). Run after the consumer exists, +# e.g. make provider-fund-consumer-fee-pool CONSUMER_ID=0 +FEE_POOL_AMOUNT ?= 100000000uphoton +provider-fund-consumer-fee-pool: + $(providerd) tx provider fund-consumer-fee-pool $(CONSUMER_ID) $(FEE_POOL_AMOUNT) \ + --from val --keyring-backend test --chain-id provider-localnet \ + --gas auto --gas-adjustment 1.5 --fees 10000uatone -y + +.PHONY: consumer-init consumer-create consumer-genesis consumer-run consumer-start provider-fund-consumer-fee-pool ############################################################################### ### TS Relayer ### diff --git a/app/provider/app.go b/app/provider/app.go index 71ce916..c6a4ea1 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -399,6 +399,8 @@ func New( authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), authtypes.FeeCollectorName, + // Per-block consumer fee denom, fixed for the lifetime of the binary. + providertypes.DefaultFeesPerBlockDenom, ) app.BankKeeper.AppendSendRestriction(app.ProviderKeeper.FeePoolSendRestriction()) diff --git a/proto/vaas/provider/v1/provider.proto b/proto/vaas/provider/v1/provider.proto index 50512ab..0abd866 100644 --- a/proto/vaas/provider/v1/provider.proto +++ b/proto/vaas/provider/v1/provider.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package vaas.provider.v1; import "amino/amino.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "cosmos/evidence/v1beta1/evidence.proto"; @@ -38,12 +37,14 @@ message Params { // to the consensus engine on the provider. int64 max_provider_consensus_validators = 4; - // The fee charged per block for consumer chain operation. - cosmos.base.v1beta1.Coin fees_per_block = 5 [ - (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin", - (amino.encoding) = "legacy_coin", - (amino.dont_omitempty) = true, - (gogoproto.nullable) = false + // The per-block fee amount charged for consumer chain operation. The denom + // is not a parameter: it is fixed at module wiring (see Keeper.feeDenom) and + // cannot be changed without a binary upgrade. + string fees_per_block_amount = 5 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // Minimum deposit on MsgFundConsumerFeePool, expressed as a multiplier of diff --git a/proto/vaas/provider/v1/query.proto b/proto/vaas/provider/v1/query.proto index aef6c12..63331ba 100644 --- a/proto/vaas/provider/v1/query.proto +++ b/proto/vaas/provider/v1/query.proto @@ -110,7 +110,8 @@ service Query { } // QueryConsumerFeesPerBlock returns the effective per-block fee for a - // consumer chain: the override if one is set, else Params.FeesPerBlock. + // consumer chain: the override amount if one is set, else + // Params.FeesPerBlockAmount, carried at the module's wired fee denom. rpc QueryConsumerFeesPerBlock(QueryConsumerFeesPerBlockRequest) returns (QueryConsumerFeesPerBlockResponse) { option (google.api.http).get = @@ -304,8 +305,9 @@ message QueryConsumerFeesPerBlockRequest { uint64 consumer_id = 1; } -// Effective fee for the consumer: the override if one is set, else -// Params.FeesPerBlock. is_override distinguishes the two cases. +// Effective fee for the consumer (a resolved coin at the module's wired fee +// denom): the override amount if one is set, else Params.FeesPerBlockAmount. +// is_override distinguishes the two cases. message QueryConsumerFeesPerBlockResponse { cosmos.base.v1beta1.Coin fees_per_block = 1 [ (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.Coin", diff --git a/proto/vaas/provider/v1/tx.proto b/proto/vaas/provider/v1/tx.proto index caacbba..2a8f3c3 100644 --- a/proto/vaas/provider/v1/tx.proto +++ b/proto/vaas/provider/v1/tx.proto @@ -174,12 +174,12 @@ message MsgSetConsumerFeesPerBlock { // consumer_id is the internal numeric id of the target consumer. uint64 consumer_id = 2; // amount is the per-block fee charged to the consumer, expressed in the - // module's fee denom (Params.FeesPerBlock.Denom). + // module's fee denom (fixed at module wiring). // // Empty string clears any existing override; the consumer reverts to - // Params.FeesPerBlock.Amount. A non-empty value must parse as a + // Params.FeesPerBlockAmount. A non-empty value must parse as a // cosmossdk.io/math.Int and must be strictly greater than the module-wide - // Params.FeesPerBlock.Amount, which acts as a floor: an override may only + // Params.FeesPerBlockAmount, which acts as a floor: an override may only // raise a consumer's per-block fee above the global default, never lower it. string amount = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; } diff --git a/tests/e2e/chain_test.go b/tests/e2e/chain_test.go index 608f9d1..4e548da 100644 --- a/tests/e2e/chain_test.go +++ b/tests/e2e/chain_test.go @@ -6,6 +6,7 @@ const ( providerHomePath = "/home/nonroot/.provider" consumerHomePath = "/home/nonroot/.consumer" bondDenom = "uatone" + feeDenom = "uphoton" providerChainID = "provider-e2e" consumerChainID = "consumer-e2e" ) diff --git a/tests/e2e/e2e_debt_test.go b/tests/e2e/e2e_debt_test.go index 300ed0a..e1396b7 100644 --- a/tests/e2e/e2e_debt_test.go +++ b/tests/e2e/e2e_debt_test.go @@ -169,7 +169,7 @@ func (s *IntegrationTestSuite) testConsumerDebtFlow() { s.T().Log("funding consumer fee pool on provider...") // Must clear the min-deposit floor: fees_per_block (1000) * // MinDepositBlocks (14400) = 14_400_000. Fund above it with margin. - s.providerFundConsumerFeePool("0", "20000000"+bondDenom) + s.providerFundConsumerFeePool("0", "20000000"+feeDenom) s.T().Log("waiting for consumer to exit debt (bank send should succeed)...") s.Require().Eventuallyf(func() bool { diff --git a/tests/e2e/e2e_fee_pool_test.go b/tests/e2e/e2e_fee_pool_test.go index b2c84c4..02dc1c1 100644 --- a/tests/e2e/e2e_fee_pool_test.go +++ b/tests/e2e/e2e_fee_pool_test.go @@ -128,7 +128,7 @@ func (s *IntegrationTestSuite) providerFundCommunityPool(amount string) { func (s *IntegrationTestSuite) testFeePoolFundAndLockEnforcement() { s.Run("fee pool fund and lock enforcement", func() { const consumerID = "0" - denom := bondDenom + denom := feeDenom valAddr := s.providerKeyAddress("val") userAddr := s.providerKeyAddress("user") @@ -222,7 +222,7 @@ func (s *IntegrationTestSuite) testFeePoolSendRestriction() { func (s *IntegrationTestSuite) testFeePoolGovSubsidyClawback() { s.Run("fee pool gov subsidy + clawback", func() { const consumerID = "0" - denom := bondDenom + denom := feeDenom govAddr := s.queryGovAuthority() distrAddr := s.queryModuleAccountAddress("distribution") @@ -242,7 +242,7 @@ func (s *IntegrationTestSuite) testFeePoolGovSubsidyClawback() { "deposit": "10000000%s", "title": "Subsidize consumer %s", "summary": "e2e gov subsidy test" -}`, govAddr, consumerID, denom, denom, consumerID) +}`, govAddr, consumerID, denom, bondDenom, consumerID) s.submitAndPassProposal(fundJSON) @@ -263,7 +263,7 @@ func (s *IntegrationTestSuite) testFeePoolGovSubsidyClawback() { "deposit": "10000000%s", "title": "Clawback consumer %s subsidy", "summary": "e2e gov clawback test" -}`, govAddr, consumerID, denom, denom, consumerID) +}`, govAddr, consumerID, denom, bondDenom, consumerID) s.submitAndPassProposal(clawbackJSON) diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index d1ea1fe..c4c288b 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -249,16 +249,13 @@ func (s *IntegrationTestSuite) initAndStartProvider() { } } - // Set fast epoch for VSC, and override fees_per_block to use the - // bond denom so the e2e debt-flow test can fund the consumer fee - // pool from existing genesis accounts. + // Set fast epoch for VSC and a small per-block fee amount. The fee + // denom is fixed to feeDenom at module wiring, only the amount is + // configurable here. val is funded with feeDenom in provider-init.sh if provider, ok := appState["provider"].(map[string]any); ok { if params, ok := provider["params"].(map[string]any); ok { params["blocks_per_epoch"] = "5" - params["fees_per_block"] = map[string]any{ - "denom": bondDenom, - "amount": "1000", - } + params["fees_per_block_amount"] = "1000" } } }) diff --git a/tests/e2e/scripts/provider-init.sh b/tests/e2e/scripts/provider-init.sh index 137a6e9..e7a451a 100755 --- a/tests/e2e/scripts/provider-init.sh +++ b/tests/e2e/scripts/provider-init.sh @@ -9,6 +9,7 @@ BINARY="${BINARY:-provider}" HOME_DIR="${HOME_DIR:-/home/nonroot/.provider}" CHAIN_ID="${CHAIN_ID:-provider-e2e}" DENOM="${DENOM:-uatone}" +FEE_DENOM="${FEE_DENOM:-uphoton}" MNEMONIC="${MNEMONIC:-abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art}" # Initialize chain @@ -24,7 +25,7 @@ $BINARY keys add user --home "$HOME_DIR" --keyring-backend test echo "$MNEMONIC" | $BINARY keys add relayer --recover --home "$HOME_DIR" --keyring-backend test # Add genesis accounts -$BINARY genesis add-genesis-account val "1000000000000${DENOM}" --home "$HOME_DIR" --keyring-backend test +$BINARY genesis add-genesis-account val "1000000000000${DENOM},1000000000000${FEE_DENOM}" --home "$HOME_DIR" --keyring-backend test $BINARY genesis add-genesis-account user "1000000000${DENOM}" --home "$HOME_DIR" --keyring-backend test $BINARY genesis add-genesis-account relayer "100000000${DENOM}" --home "$HOME_DIR" --keyring-backend test diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index 8660d41..62fd00a 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -116,6 +116,7 @@ func NewInMemProviderKeeper(params InMemKeeperParams, mocks MockedKeepers) provi address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmosvalcons"), authtypes.FeeCollectorName, + providertypes.DefaultFeesPerBlockDenom, ) } diff --git a/x/vaas/provider/keeper/fee_denom_test.go b/x/vaas/provider/keeper/fee_denom_test.go new file mode 100644 index 0000000..185fd11 --- /dev/null +++ b/x/vaas/provider/keeper/fee_denom_test.go @@ -0,0 +1,48 @@ +package keeper_test + +import ( + "fmt" + "testing" + + providerkeeper "github.com/allinbits/vaas/x/vaas/provider/keeper" + "github.com/stretchr/testify/require" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" +) + +// NewKeeper fixes the per-block fee denom at construction. The guard exists so +// that GetFeesPerBlock's sdk.NewCoin(feeDenom, amount) can never panic at +// runtime: a bad denom is a wiring mistake that must fail loudly at startup +// rather than surface later as a malformed fee coin. For each rejected denom we +// assert both halves of that contract: the denom genuinely breaks coin +// construction, and NewKeeper refuses it up front. The guard is the first +// statement in NewKeeper, so nil dependencies are fine here; the valid-denom +// path is exercised by every other keeper test through the in-mem helper. +func TestNewKeeperRejectsInvalidFeeDenom(t *testing.T) { + assertRejected := func(denom string) { + require.Panicsf(t, func() { + sdk.NewCoin(denom, math.OneInt()) + }, "sanity: %q must be an invalid coin denom for the guard to be meaningful", denom) + + defer func() { + r := recover() + require.NotNilf(t, r, "expected NewKeeper to panic for fee denom %q", denom) + require.Containsf(t, fmt.Sprint(r), "fee denom", "denom %q should trip the fee-denom guard", denom) + }() + providerkeeper.NewKeeper( + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + govkeeper.Keeper{}, + "authority", + nil, nil, + "fee_collector", + denom, + ) + } + + for _, denom := range []string{"", "1leadingdigit", "white space"} { + assertRejected(denom) + } +} diff --git a/x/vaas/provider/keeper/fees.go b/x/vaas/provider/keeper/fees.go index 9954edf..5a094c8 100644 --- a/x/vaas/provider/keeper/fees.go +++ b/x/vaas/provider/keeper/fees.go @@ -87,7 +87,7 @@ func (k Keeper) CollectFeesFromConsumers(ctx sdk.Context) sdk.Coin { // does via BeginBlock VoteInfos. Signers that have since unbonded or been // removed from the set forfeit their share — we only pay current participants. func (k Keeper) DistributeFeesToValidators(ctx sdk.Context) error { - totalFees := k.bankKeeper.GetBalance(ctx, authtypes.NewModuleAddress(types.ModuleName), k.GetFeesPerBlock(ctx).Denom) + totalFees := k.bankKeeper.GetBalance(ctx, authtypes.NewModuleAddress(types.ModuleName), k.GetFeeDenom()) if totalFees.IsZero() { return nil } diff --git a/x/vaas/provider/keeper/fees_test.go b/x/vaas/provider/keeper/fees_test.go index 1e0957e..40d2479 100644 --- a/x/vaas/provider/keeper/fees_test.go +++ b/x/vaas/provider/keeper/fees_test.go @@ -34,7 +34,7 @@ func TestCollectFeesFromConsumers(t *testing.T) { feesPerBlock := sdk.NewInt64Coin("uphoton", 10) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = feesPerBlock + providerParams.FeesPerBlockAmount = feesPerBlock.Amount k.SetParams(ctx, providerParams) consumer0FeePoolAddr := k.GetConsumerFeePoolAddress(consumer0) consumer1FeePoolAddr := k.GetConsumerFeePoolAddress(consumer1) @@ -56,7 +56,8 @@ func TestCollectFeesFromConsumers(t *testing.T) { // TestCollectFeesFromConsumers_PerConsumerOverride verifies that each consumer // is charged its effective per-block fee: consumer1 has an override and pays -// the override amount; consumer0 has no override and pays Params.FeesPerBlock. +// the override amount; consumer0 has no override and pays +// Params.FeesPerBlockAmount. func TestCollectFeesFromConsumers_PerConsumerOverride(t *testing.T) { params := testkeeper.NewInMemKeeperParams(t) k, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, params) @@ -72,7 +73,7 @@ func TestCollectFeesFromConsumers_PerConsumerOverride(t *testing.T) { overrideFees := sdk.NewCoin("uphoton", overrideAmount) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = defaultFees + providerParams.FeesPerBlockAmount = defaultFees.Amount k.SetParams(ctx, providerParams) // consumer1 gets an override; consumer0 keeps the default. @@ -108,7 +109,7 @@ func TestCollectFeesFromConsumersSkipsWhenInsufficient(t *testing.T) { feesPerBlock := sdk.NewInt64Coin("uphoton", 10) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = feesPerBlock + providerParams.FeesPerBlockAmount = feesPerBlock.Amount k.SetParams(ctx, providerParams) consumer0FeePoolAddr := k.GetConsumerFeePoolAddress(consumer0) consumer1FeePoolAddr := k.GetConsumerFeePoolAddress(consumer1) @@ -139,7 +140,7 @@ func TestCollectFeesFromConsumersClearsDebtWhenRecovered(t *testing.T) { feesPerBlock := sdk.NewInt64Coin("uphoton", 10) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = feesPerBlock + providerParams.FeesPerBlockAmount = feesPerBlock.Amount k.SetParams(ctx, providerParams) consumer0FeePoolAddr := k.GetConsumerFeePoolAddress(consumer0) @@ -168,7 +169,7 @@ func TestCollectFeesFromConsumersContinuesOnGenericError(t *testing.T) { feesPerBlock := sdk.NewInt64Coin("uphoton", 10) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = feesPerBlock + providerParams.FeesPerBlockAmount = feesPerBlock.Amount k.SetParams(ctx, providerParams) consumer0FeePoolAddr := k.GetConsumerFeePoolAddress(consumer0) consumer1FeePoolAddr := k.GetConsumerFeePoolAddress(consumer1) @@ -238,12 +239,12 @@ func TestDistributeFeesToValidators(t *testing.T) { val2.Tokens = sdk.DefaultPowerReduction.MulRaw(20) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 10) + providerParams.FeesPerBlockAmount = math.NewInt(10) k.SetParams(ctx, providerParams) ctx = ctx.WithVoteInfos([]abci.VoteInfo{signerVote(cons1), signerVote(cons2)}) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewInt64Coin("uphoton", 300)) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). @@ -265,11 +266,11 @@ func TestDistributeFeesToValidatorsZeroFees(t *testing.T) { defer ctrl.Finish() providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 10) + providerParams.FeesPerBlockAmount = math.NewInt(10) k.SetParams(ctx, providerParams) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewCoin("uphoton", math.ZeroInt())) require.NoError(t, k.DistributeFeesToValidators(ctx)) @@ -289,12 +290,12 @@ func TestDistributeFeesToValidatorsSkipsWhenFeesTooSmall(t *testing.T) { val2, _, cons2 := newBondedValidator(t, valAddrCodec, 2) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 1) + providerParams.FeesPerBlockAmount = math.NewInt(1) k.SetParams(ctx, providerParams) ctx = ctx.WithVoteInfos([]abci.VoteInfo{signerVote(cons1), signerVote(cons2)}) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewInt64Coin("uphoton", 1)) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). @@ -318,12 +319,12 @@ func TestDistributeFeesToValidatorsRemainderStaysPooled(t *testing.T) { val3, op3, cons3 := newBondedValidator(t, valAddrCodec, 3) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 10) + providerParams.FeesPerBlockAmount = math.NewInt(10) k.SetParams(ctx, providerParams) ctx = ctx.WithVoteInfos([]abci.VoteInfo{signerVote(cons1), signerVote(cons2), signerVote(cons3)}) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewInt64Coin("uphoton", 10)) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). @@ -345,11 +346,11 @@ func TestDistributeFeesToValidatorsNoSigners(t *testing.T) { defer ctrl.Finish() providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 50) + providerParams.FeesPerBlockAmount = math.NewInt(50) k.SetParams(ctx, providerParams) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewInt64Coin("uphoton", 50)) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). @@ -372,7 +373,7 @@ func TestDistributeFeesToValidatorsSkipsAbsentSigners(t *testing.T) { val2, _, cons2 := newBondedValidator(t, valAddrCodec, 2) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 10) + providerParams.FeesPerBlockAmount = math.NewInt(10) k.SetParams(ctx, providerParams) ctx = ctx.WithVoteInfos([]abci.VoteInfo{ signerVote(cons1), // will be paid @@ -380,7 +381,7 @@ func TestDistributeFeesToValidatorsSkipsAbsentSigners(t *testing.T) { }) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewInt64Coin("uphoton", 100)) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). @@ -409,12 +410,12 @@ func TestDistributeFeesToValidatorsSkipsNonBondedSigner(t *testing.T) { _, _, consGone := newBondedValidator(t, valAddrCodec, 2) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 10) + providerParams.FeesPerBlockAmount = math.NewInt(10) k.SetParams(ctx, providerParams) ctx = ctx.WithVoteInfos([]abci.VoteInfo{signerVote(cons1), signerVote(consGone)}) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewInt64Coin("uphoton", 100)) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). @@ -435,11 +436,11 @@ func TestDistributeFeesToValidatorsPropagatesBondedFetchError(t *testing.T) { defer ctrl.Finish() providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 10) + providerParams.FeesPerBlockAmount = math.NewInt(10) k.SetParams(ctx, providerParams) mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). Return(sdk.NewInt64Coin("uphoton", 100)) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). diff --git a/x/vaas/provider/keeper/grpc_query.go b/x/vaas/provider/keeper/grpc_query.go index c1deb69..7eb9445 100644 --- a/x/vaas/provider/keeper/grpc_query.go +++ b/x/vaas/provider/keeper/grpc_query.go @@ -572,7 +572,7 @@ func (k Keeper) QueryConsumerGenesisTime(goCtx context.Context, req *types.Query } // QueryConsumerFeesPerBlock returns the effective per-block fee for the -// given consumer (override if set, else Params.FeesPerBlock). +// given consumer (override if set, else the default Params.FeesPerBlockAmount). func (k Keeper) QueryConsumerFeesPerBlock( goCtx context.Context, req *types.QueryConsumerFeesPerBlockRequest, diff --git a/x/vaas/provider/keeper/grpc_query_test.go b/x/vaas/provider/keeper/grpc_query_test.go index 3cc8a1e..f3a7bf1 100644 --- a/x/vaas/provider/keeper/grpc_query_test.go +++ b/x/vaas/provider/keeper/grpc_query_test.go @@ -72,7 +72,7 @@ func TestQueryConsumerFeesPerBlock(t *testing.T) { defer ctrl.Finish() providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = defaultFees + providerParams.FeesPerBlockAmount = defaultFees.Amount k.SetParams(ctx, providerParams) consumerId := k.FetchAndIncrementConsumerId(ctx) diff --git a/x/vaas/provider/keeper/keeper.go b/x/vaas/provider/keeper/keeper.go index 774602b..da5d3a2 100644 --- a/x/vaas/provider/keeper/keeper.go +++ b/x/vaas/provider/keeper/keeper.go @@ -43,6 +43,10 @@ type Keeper struct { distributionKeeper vaastypes.DistributionKeeper govKeeper govkeeper.Keeper feeCollectorName string + // feeDenom is the denom charged to consumers per block. It is fixed at + // construction and cannot be changed without a binary upgrade. The amount + // is instead governed via Params.FeesPerBlockAmount. + feeDenom string validatorAddressCodec addresscodec.Codec consensusAddressCodec addresscodec.Codec @@ -107,7 +111,15 @@ func NewKeeper( authority string, validatorAddressCodec, consensusAddressCodec addresscodec.Codec, feeCollectorName string, + feeDenom string, ) Keeper { + // The per-block fee denom is fixed for the lifetime of the binary. A bad + // value is a wiring mistake that must fail loudly at startup rather than + // surface later as malformed fee coins. + if err := sdk.ValidateDenom(feeDenom); err != nil { + panic(fmt.Errorf("invalid provider fee denom %q: %w", feeDenom, err)) + } + sb := collections.NewSchemaBuilder(storeService) k := Keeper{ @@ -122,6 +134,7 @@ func NewKeeper( bankKeeper: bankKeeper, distributionKeeper: distributionKeeper, feeCollectorName: feeCollectorName, + feeDenom: feeDenom, validatorAddressCodec: validatorAddressCodec, consensusAddressCodec: consensusAddressCodec, channelKeeperV2: channelKeeperV2, @@ -219,6 +232,12 @@ func (k Keeper) IsAuthority(addr string) bool { return strings.EqualFold(addr, k.authority) } +// GetFeeDenom returns the denom charged to consumer chains per block. It is +// fixed at module wiring and immutable without a binary upgrade. +func (k Keeper) GetFeeDenom() string { + return k.feeDenom +} + // ValidatorAddressCodec returns the app validator address codec. func (k Keeper) ValidatorAddressCodec() addresscodec.Codec { return k.validatorAddressCodec diff --git a/x/vaas/provider/keeper/msg_server.go b/x/vaas/provider/keeper/msg_server.go index 5c74edf..69fadb7 100644 --- a/x/vaas/provider/keeper/msg_server.go +++ b/x/vaas/provider/keeper/msg_server.go @@ -57,8 +57,8 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParam // Per-consumer fees_per_block overrides must stay strictly above the global // default. Only a higher floor can leave an existing override underwater; an // unchanged or lower floor keeps every override valid, so skip the walk. - if msg.Params.FeesPerBlock.Amount.GT(oldFloor) { - if err := k.reconcileFeesPerBlockOverrides(ctx, msg.Params.FeesPerBlock.Amount); err != nil { + if msg.Params.FeesPerBlockAmount.GT(oldFloor) { + if err := k.reconcileFeesPerBlockOverrides(ctx, msg.Params.FeesPerBlockAmount); err != nil { return nil, err } } @@ -597,9 +597,10 @@ func (k msgServer) FundConsumerFeePool( } params := k.GetParams(ctx) - if msg.Amount.Denom != params.FeesPerBlock.Denom { + feeDenom := k.GetFeeDenom() + if msg.Amount.Denom != feeDenom { return nil, errorsmod.Wrapf(types.ErrInvalidFundDenom, - "expected denom %s, got %s", params.FeesPerBlock.Denom, msg.Amount.Denom) + "expected denom %s, got %s", feeDenom, msg.Amount.Denom) } if params.MinDepositBlocks > 0 { diff --git a/x/vaas/provider/keeper/msg_server_test.go b/x/vaas/provider/keeper/msg_server_test.go index e584c9b..b956966 100644 --- a/x/vaas/provider/keeper/msg_server_test.go +++ b/x/vaas/provider/keeper/msg_server_test.go @@ -598,7 +598,7 @@ func TestUpdateParams_ReconcilesFeesPerBlockOverrides(t *testing.T) { // Raise the global default to 2000. newParams := providertypes.DefaultParams() - newParams.FeesPerBlock = sdk.NewInt64Coin(providertypes.DefaultFeesPerBlockDenom, 2000) + newParams.FeesPerBlockAmount = math.NewInt(2000) msgSrv := providerkeeper.NewMsgServerImpl(&k) _, err := msgSrv.UpdateParams(ctx, &providertypes.MsgUpdateParams{ @@ -621,7 +621,7 @@ func TestUpdateParams_ReconcilesFeesPerBlockOverrides(t *testing.T) { // Lowering the floor never invalidates overrides: the survivor stays. lowerParams := providertypes.DefaultParams() - lowerParams.FeesPerBlock = sdk.NewInt64Coin(providertypes.DefaultFeesPerBlockDenom, 500) + lowerParams.FeesPerBlockAmount = math.NewInt(500) _, err = msgSrv.UpdateParams(ctx, &providertypes.MsgUpdateParams{ Authority: k.GetAuthority(), Params: lowerParams, @@ -850,7 +850,7 @@ func TestFundConsumerFeePool(t *testing.T) { if feesAmount == 0 { feesAmount = 10 } - params.FeesPerBlock = sdk.NewInt64Coin("uphoton", feesAmount) + params.FeesPerBlockAmount = math.NewInt(feesAmount) params.MinDepositBlocks = tc.minDepositBlocks k.SetParams(ctx, params) diff --git a/x/vaas/provider/keeper/params.go b/x/vaas/provider/keeper/params.go index f20d0d8..92d8528 100644 --- a/x/vaas/provider/keeper/params.go +++ b/x/vaas/provider/keeper/params.go @@ -60,17 +60,18 @@ func (k Keeper) GetMaxProviderConsensusValidators(ctx context.Context) int64 { return params.MaxProviderConsensusValidators } -// GetFeesPerBlock returns the fees that each consumer chain must pay per block +// GetFeesPerBlock returns the fees that each consumer chain must pay per block. +// The amount is governed via Params.FeesPerBlockAmount while the denom is a +// keeper-wired constant and cannot be changed without a binary upgrade. func (k Keeper) GetFeesPerBlock(ctx context.Context) sdk.Coin { - params := k.GetParams(ctx) - return params.FeesPerBlock + return sdk.NewCoin(k.feeDenom, k.GetParams(ctx).FeesPerBlockAmount) } // GetEffectiveFeesPerBlock returns the per-block fee charged to a specific -// consumer: the override amount if one is set, else Params.FeesPerBlock. -// The returned Coin always carries Params.FeesPerBlock.Denom. The bool -// reports whether an override was applied (true) or the default was used -// (false). +// consumer: the override amount if one is set, else the default +// Params.FeesPerBlockAmount. The returned Coin always carries the module fee +// denom (Keeper.feeDenom). The bool reports whether an override was applied +// (true) or the default was used (false). func (k Keeper) GetEffectiveFeesPerBlock(ctx context.Context, consumerId uint64) (sdk.Coin, bool) { return k.effectiveFeesPerBlock(ctx, consumerId, k.GetFeesPerBlock(ctx)) } @@ -91,8 +92,8 @@ func (k Keeper) effectiveFeesPerBlock(ctx context.Context, consumerId uint64, de } // reconcileFeesPerBlockOverrides drops every per-consumer override that is no -// longer strictly greater than floor (the module-wide Params.FeesPerBlock -// amount). It is called when the global fees_per_block rises so the "override +// longer strictly greater than floor (the module-wide Params.FeesPerBlockAmount). +// It is called when the global fees_per_block rises so the "override // must exceed the default" floor holds as a true invariant, not just at set // time: a higher default can leave overrides underwater, and those consumers // should revert to paying the new (higher) default. diff --git a/x/vaas/provider/keeper/params_test.go b/x/vaas/provider/keeper/params_test.go index 201b3ac..c1c3f4d 100644 --- a/x/vaas/provider/keeper/params_test.go +++ b/x/vaas/provider/keeper/params_test.go @@ -30,7 +30,7 @@ func TestParams(t *testing.T) { 7*24*time.Hour, 600, 10, - sdk.NewInt64Coin("uphoton", 50), + math.NewInt(50), providertypes.DefaultMinDepositBlocks, ) providerKeeper.SetParams(ctx, newParams) @@ -82,7 +82,7 @@ func TestGetEffectiveFeesPerBlock(t *testing.T) { defer ctrl.Finish() providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = defaultFees + providerParams.FeesPerBlockAmount = defaultFees.Amount k.SetParams(ctx, providerParams) if !tc.overrideAmount.IsNil() { diff --git a/x/vaas/provider/module_test.go b/x/vaas/provider/module_test.go index 7d99b97..a849997 100644 --- a/x/vaas/provider/module_test.go +++ b/x/vaas/provider/module_test.go @@ -37,8 +37,9 @@ func TestBeginBlockCommitsDebtStateWhenDistributionFails(t *testing.T) { k.SetConsumerPhase(ctx, consumerInDebt, providertypes.CONSUMER_PHASE_LAUNCHED) k.SetConsumerPhase(ctx, consumerPaying, providertypes.CONSUMER_PHASE_LAUNCHED) + feesPerBlock := sdk.NewInt64Coin("uphoton", 10) providerParams := providertypes.DefaultParams() - providerParams.FeesPerBlock = sdk.NewInt64Coin("uphoton", 10) + providerParams.FeesPerBlockAmount = feesPerBlock.Amount k.SetParams(ctx, providerParams) consumerInDebtFeePoolAddr := k.GetConsumerFeePoolAddress(consumerInDebt) @@ -67,20 +68,20 @@ func TestBeginBlockCommitsDebtStateWhenDistributionFails(t *testing.T) { // Collection phase: one consumer underfunded (ErrInsufficientFunds), one pays. mocks.MockBankKeeper.EXPECT(). - SendCoinsFromAccountToModule(gomock.Any(), consumerInDebtFeePoolAddr, providertypes.ModuleName, sdk.NewCoins(providerParams.FeesPerBlock)). + SendCoinsFromAccountToModule(gomock.Any(), consumerInDebtFeePoolAddr, providertypes.ModuleName, sdk.NewCoins(feesPerBlock)). Return(sdkerrors.ErrInsufficientFunds.Wrapf("spendable 5 < 10")) mocks.MockBankKeeper.EXPECT(). - SendCoinsFromAccountToModule(gomock.Any(), consumerPayingFeePoolAddr, providertypes.ModuleName, sdk.NewCoins(providerParams.FeesPerBlock)). + SendCoinsFromAccountToModule(gomock.Any(), consumerPayingFeePoolAddr, providertypes.ModuleName, sdk.NewCoins(feesPerBlock)). Return(nil) // Distribution phase: bank send errors out, rolls back distribution only. mocks.MockBankKeeper.EXPECT(). - GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providerParams.FeesPerBlock.Denom). - Return(providerParams.FeesPerBlock) + GetBalance(gomock.Any(), authtypes.NewModuleAddress(providertypes.ModuleName), providertypes.DefaultFeesPerBlockDenom). + Return(feesPerBlock) mocks.MockStakingKeeper.EXPECT(). GetBondedValidatorsByPower(gomock.Any()). Return([]stakingtypes.Validator{val}, nil) mocks.MockBankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(gomock.Any(), providertypes.ModuleName, sdk.AccAddress(opBytes), sdk.NewCoins(providerParams.FeesPerBlock)). + SendCoinsFromModuleToAccount(gomock.Any(), providertypes.ModuleName, sdk.AccAddress(opBytes), sdk.NewCoins(feesPerBlock)). Return(errors.New("distribution boom")) require.NoError(t, appModule.BeginBlock(sdk.WrapSDKContext(ctx))) diff --git a/x/vaas/provider/types/genesis.go b/x/vaas/provider/types/genesis.go index aa2cb3d..69dff1b 100644 --- a/x/vaas/provider/types/genesis.go +++ b/x/vaas/provider/types/genesis.go @@ -88,7 +88,7 @@ func (gs GenesisState) Validate() error { // Overrides must reference a known consumer and stay strictly above the // module-wide fees_per_block floor (the same invariant the msg handler and // UpdateParams reconciliation enforce at runtime). - floor := gs.Params.FeesPerBlock.Amount + floor := gs.Params.FeesPerBlockAmount for _, ov := range gs.ConsumerFeesPerBlockOverrides { amt, ok := math.NewIntFromString(ov.Amount) if !ok { diff --git a/x/vaas/provider/types/genesis_test.go b/x/vaas/provider/types/genesis_test.go index 6df37ba..d48629d 100644 --- a/x/vaas/provider/types/genesis_test.go +++ b/x/vaas/provider/types/genesis_test.go @@ -4,17 +4,18 @@ import ( "testing" "time" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" - "github.com/allinbits/vaas/testutil/crypto" - "github.com/allinbits/vaas/x/vaas/provider/types" - vaastypes "github.com/allinbits/vaas/x/vaas/types" tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint" "github.com/stretchr/testify/require" + + "github.com/allinbits/vaas/testutil/crypto" + "github.com/allinbits/vaas/x/vaas/provider/types" + vaastypes "github.com/allinbits/vaas/x/vaas/types" ) func TestValidateGenesisState(t *testing.T) { @@ -87,7 +88,7 @@ func TestValidateGenesisState(t *testing.T) { nil, []types.ConsumerState{launchedCS(0, "chainid-1", "client-id", false)}, types.NewParams( - types.DefaultTrustingPeriodFraction, time.Hour, 600, 180, sdk.NewInt64Coin("uphoton", 42), types.DefaultMinDepositBlocks), + types.DefaultTrustingPeriodFraction, time.Hour, 600, 180, math.NewInt(42), types.DefaultMinDepositBlocks), nil, nil, nil, @@ -134,7 +135,7 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{launchedCS(0, "chainid-1", "client-id", false)}, types.NewParams( "0.0", // 0 trusting period fraction here - vaastypes.DefaultVAASTimeoutPeriod, 600, 180, sdk.NewInt64Coin("uphoton", 42), types.DefaultMinDepositBlocks), + vaastypes.DefaultVAASTimeoutPeriod, 600, 180, math.NewInt(42), types.DefaultMinDepositBlocks), nil, nil, nil, @@ -152,7 +153,7 @@ func TestValidateGenesisState(t *testing.T) { types.NewParams( types.DefaultTrustingPeriodFraction, 0, // 0 ccv timeout here - 600, 180, sdk.NewInt64Coin("uphoton", 42), types.DefaultMinDepositBlocks), + 600, 180, math.NewInt(42), types.DefaultMinDepositBlocks), nil, nil, nil, @@ -249,7 +250,7 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { t.Run("valid share record", func(t *testing.T) { err := build(types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: alice, Denom: "uphoton", - Shares: sdkmath.NewInt(100), + Shares: math.NewInt(100), }).Validate() require.NoError(t, err) }) @@ -257,7 +258,7 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { t.Run("invalid depositor bech32", func(t *testing.T) { err := build(types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: "not-a-bech32", Denom: "uphoton", - Shares: sdkmath.NewInt(100), + Shares: math.NewInt(100), }).Validate() require.Error(t, err) }) @@ -265,7 +266,7 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { t.Run("invalid denom", func(t *testing.T) { err := build(types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: alice, Denom: "", - Shares: sdkmath.NewInt(100), + Shares: math.NewInt(100), }).Validate() require.Error(t, err) }) @@ -273,7 +274,7 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { t.Run("zero shares", func(t *testing.T) { err := build(types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: alice, Denom: "uphoton", - Shares: sdkmath.ZeroInt(), + Shares: math.ZeroInt(), }).Validate() require.Error(t, err) }) @@ -281,7 +282,7 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { t.Run("negative shares", func(t *testing.T) { err := build(types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: alice, Denom: "uphoton", - Shares: sdkmath.NewInt(-1), + Shares: math.NewInt(-1), }).Validate() require.Error(t, err) }) @@ -289,7 +290,7 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { t.Run("orphan consumer id", func(t *testing.T) { err := build(types.ConsumerFeePoolShare{ ConsumerId: 99, Depositor: alice, Denom: "uphoton", - Shares: sdkmath.NewInt(100), + Shares: math.NewInt(100), }).Validate() require.Error(t, err) }) @@ -298,11 +299,11 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { err := build( types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: alice, Denom: "uphoton", - Shares: sdkmath.NewInt(50), + Shares: math.NewInt(50), }, types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: alice, Denom: "uphoton", - Shares: sdkmath.NewInt(50), + Shares: math.NewInt(50), }, ).Validate() require.Error(t, err) @@ -312,11 +313,11 @@ func TestValidateGenesisState_FeePoolShares(t *testing.T) { err := build( types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: alice, Denom: "uphoton", - Shares: sdkmath.NewInt(60), + Shares: math.NewInt(60), }, types.ConsumerFeePoolShare{ ConsumerId: 0, Depositor: bob, Denom: "uphoton", - Shares: sdkmath.NewInt(40), + Shares: math.NewInt(40), }, ).Validate() require.NoError(t, err) diff --git a/x/vaas/provider/types/params.go b/x/vaas/provider/types/params.go index ba00b46..7dffec9 100644 --- a/x/vaas/provider/types/params.go +++ b/x/vaas/provider/types/params.go @@ -9,8 +9,6 @@ import ( clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" ) const ( @@ -31,7 +29,10 @@ const ( // be passed on from the staking module to the consensus engine on the provider. DefaultMaxProviderConsensusValidators = 180 - // DefaultFeesPerBlockDenom is the base denom charged to each consumer chain per block. + // DefaultFeesPerBlockDenom is the denom charged to each consumer chain per + // block. It is not a module parameter: it is wired into the keeper at app + // construction (Keeper.feeDenom) and cannot be changed without a binary + // upgrade. The atomone hub wires photontypes.Denom here. DefaultFeesPerBlockDenom = "uphoton" // DefaultFeesPerBlockAmount is the default amount (in DefaultFeesPerBlockDenom) charged per block. @@ -55,7 +56,7 @@ func NewParams( vaasTimeoutPeriod time.Duration, blocksPerEpoch int64, maxProviderConsensusValidators int64, - feesPerBlock sdk.Coin, + feesPerBlockAmount math.Int, minDepositBlocks uint64, ) Params { return Params{ @@ -63,7 +64,7 @@ func NewParams( VaasTimeoutPeriod: vaasTimeoutPeriod, BlocksPerEpoch: blocksPerEpoch, MaxProviderConsensusValidators: maxProviderConsensusValidators, - FeesPerBlock: feesPerBlock, + FeesPerBlockAmount: feesPerBlockAmount, MinDepositBlocks: minDepositBlocks, } } @@ -74,7 +75,7 @@ func DefaultParams() Params { vaastypes.DefaultVAASTimeoutPeriod, DefaultBlocksPerEpoch, DefaultMaxProviderConsensusValidators, - sdk.NewInt64Coin(DefaultFeesPerBlockDenom, DefaultFeesPerBlockAmount), + math.NewInt(DefaultFeesPerBlockAmount), DefaultMinDepositBlocks, ) } @@ -154,19 +155,19 @@ func (p Params) Validate() error { if err := vaastypes.ValidatePositiveInt64(p.MaxProviderConsensusValidators); err != nil { return fmt.Errorf("max provider consensus validators is invalid: %s", err) } - if err := validateFeesPerBlock(p.FeesPerBlock); err != nil { + if err := validateFeesPerBlockAmount(p.FeesPerBlockAmount); err != nil { return err } return nil } -func validateFeesPerBlock(coin sdk.Coin) error { - if !coin.IsValid() { - return fmt.Errorf("fees per block coin is invalid: %s", coin) +func validateFeesPerBlockAmount(amount math.Int) error { + if amount.IsNil() { + return fmt.Errorf("fees per block amount must be set") } - if coin.IsZero() { - return fmt.Errorf("fees per block must be positive") + if !amount.IsPositive() { + return fmt.Errorf("fees per block amount must be positive") } return nil } diff --git a/x/vaas/provider/types/params_test.go b/x/vaas/provider/types/params_test.go index 9386291..6d7d1bb 100644 --- a/x/vaas/provider/types/params_test.go +++ b/x/vaas/provider/types/params_test.go @@ -7,7 +7,7 @@ import ( "github.com/allinbits/vaas/x/vaas/provider/types" "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/math" ) func TestValidateParams(t *testing.T) { @@ -17,12 +17,12 @@ func TestValidateParams(t *testing.T) { expPass bool }{ {"default params", types.DefaultParams(), true}, - {"custom valid params", types.NewParams("0.33", time.Hour, 1000, 180, sdk.NewInt64Coin("uphoton", 42), types.DefaultMinDepositBlocks), true}, - {"zero fees per block", types.NewParams("0.33", time.Hour, 1000, 180, sdk.NewInt64Coin("uphoton", 0), types.DefaultMinDepositBlocks), false}, + {"custom valid params", types.NewParams("0.33", time.Hour, 1000, 180, math.NewInt(42), types.DefaultMinDepositBlocks), true}, + {"zero fees per block", types.NewParams("0.33", time.Hour, 1000, 180, math.NewInt(0), types.DefaultMinDepositBlocks), false}, {"0 trusting period fraction", types.NewParams( - "0.00", time.Hour, 1000, 180, sdk.NewInt64Coin("uphoton", 1), types.DefaultMinDepositBlocks), false}, + "0.00", time.Hour, 1000, 180, math.NewInt(1), types.DefaultMinDepositBlocks), false}, {"0 ccv timeout period", types.NewParams( - "0.33", 0, 1000, 180, sdk.NewInt64Coin("uphoton", 1), types.DefaultMinDepositBlocks), false}, + "0.33", 0, 1000, 180, math.NewInt(1), types.DefaultMinDepositBlocks), false}, } for _, tc := range testCases { diff --git a/x/vaas/provider/types/provider.pb.go b/x/vaas/provider/types/provider.pb.go index 7ec9656..1aec7e0 100644 --- a/x/vaas/provider/types/provider.pb.go +++ b/x/vaas/provider/types/provider.pb.go @@ -7,16 +7,14 @@ import ( cosmossdk_io_math "cosmossdk.io/math" _ "cosmossdk.io/x/evidence/types" fmt "fmt" - types1 "github.com/allinbits/vaas/x/vaas/types" + types "github.com/allinbits/vaas/x/vaas/types" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" - types2 "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + types1 "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" _ "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" @@ -99,8 +97,10 @@ type Params struct { // The maximal number of validators that will be passed // to the consensus engine on the provider. MaxProviderConsensusValidators int64 `protobuf:"varint,4,opt,name=max_provider_consensus_validators,json=maxProviderConsensusValidators,proto3" json:"max_provider_consensus_validators,omitempty"` - // The fee charged per block for consumer chain operation. - FeesPerBlock github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,5,opt,name=fees_per_block,json=feesPerBlock,proto3,casttype=github.com/cosmos/cosmos-sdk/types.Coin" json:"fees_per_block"` + // The per-block fee amount charged for consumer chain operation. The denom + // is not a parameter: it is fixed at module wiring (see Keeper.feeDenom) and + // cannot be changed without a binary upgrade. + FeesPerBlockAmount cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=fees_per_block_amount,json=feesPerBlockAmount,proto3,customtype=cosmossdk.io/math.Int" json:"fees_per_block_amount"` // Minimum deposit on MsgFundConsumerFeePool, expressed as a multiplier of // fees_per_block.Amount (the floor is fees_per_block.Amount * // min_deposit_blocks). Zero disables the check. The floor applies to every @@ -169,13 +169,6 @@ func (m *Params) GetMaxProviderConsensusValidators() int64 { return 0 } -func (m *Params) GetFeesPerBlock() github_com_cosmos_cosmos_sdk_types.Coin { - if m != nil { - return m.FeesPerBlock - } - return github_com_cosmos_cosmos_sdk_types.Coin{} -} - func (m *Params) GetMinDepositBlocks() uint64 { if m != nil { return m.MinDepositBlocks @@ -230,7 +223,7 @@ func (m *AddressList) GetAddresses() [][]byte { // ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. type ValidatorSetChangePackets struct { - List []types1.ValidatorSetChangePacketData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` + List []types.ValidatorSetChangePacketData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` } func (m *ValidatorSetChangePackets) Reset() { *m = ValidatorSetChangePackets{} } @@ -266,7 +259,7 @@ func (m *ValidatorSetChangePackets) XXX_DiscardUnknown() { var xxx_messageInfo_ValidatorSetChangePackets proto.InternalMessageInfo -func (m *ValidatorSetChangePackets) GetList() []types1.ValidatorSetChangePacketData { +func (m *ValidatorSetChangePackets) GetList() []types.ValidatorSetChangePacketData { if m != nil { return m.List } @@ -673,7 +666,7 @@ type ConsumerInitializationParameters struct { // the proposed initial height of new consumer chain. // For a completely new chain, this will be {0,1}. However, it may be // different if this is a chain that is converting to a consumer chain. - InitialHeight types2.Height `protobuf:"bytes,1,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height"` + InitialHeight types1.Height `protobuf:"bytes,1,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height"` // The hash of the consumer chain genesis state without the consumer VAAS // module genesis params. It is used for off-chain confirmation of // genesis.json validity by validators and other parties. @@ -730,11 +723,11 @@ func (m *ConsumerInitializationParameters) XXX_DiscardUnknown() { var xxx_messageInfo_ConsumerInitializationParameters proto.InternalMessageInfo -func (m *ConsumerInitializationParameters) GetInitialHeight() types2.Height { +func (m *ConsumerInitializationParameters) GetInitialHeight() types1.Height { if m != nil { return m.InitialHeight } - return types2.Height{} + return types1.Height{} } func (m *ConsumerInitializationParameters) GetGenesisHash() []byte { @@ -952,96 +945,94 @@ func init() { func init() { proto.RegisterFile("vaas/provider/v1/provider.proto", fileDescriptor_6404dd5d21545279) } var fileDescriptor_6404dd5d21545279 = []byte{ - // 1424 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xcf, 0xc6, 0x6e, 0x9a, 0x8c, 0x9d, 0x7c, 0xdd, 0x69, 0xd4, 0x3a, 0x69, 0x6b, 0xa7, 0xfe, - 0xaa, 0x10, 0x15, 0xba, 0xab, 0x14, 0x09, 0x21, 0x38, 0x54, 0x89, 0xbd, 0x6d, 0x4c, 0xd2, 0xd4, - 0x5a, 0xbb, 0x1c, 0x2a, 0xd0, 0x6a, 0x76, 0x77, 0x6a, 0x4f, 0xb3, 0xbb, 0xb3, 0xda, 0x19, 0x3b, - 0x35, 0x67, 0x90, 0x38, 0x96, 0x1b, 0xe2, 0x04, 0xe2, 0xc2, 0xb1, 0x07, 0xc4, 0x91, 0x03, 0xa7, - 0x72, 0xab, 0x38, 0x21, 0x84, 0x0a, 0x6a, 0x0f, 0xfd, 0x1f, 0x38, 0xa1, 0xf9, 0xb1, 0x1b, 0xe7, - 0x47, 0x45, 0x2a, 0x2e, 0xf6, 0xce, 0x7b, 0xef, 0x33, 0xef, 0xc7, 0x7c, 0xe6, 0xbd, 0x01, 0xf5, - 0x11, 0x42, 0xcc, 0x4a, 0x52, 0x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 0x63, 0xc1, 0xae, 0xc5, 0xc7, 0x09, 0x66, 0x12, 0xf0, 0xf5, 0xcb, 0xc7, 0x57, 0x4b, 0x21, 0xee, - 0x23, 0x7f, 0xec, 0x0a, 0x9e, 0x7e, 0xff, 0xf2, 0xf1, 0x55, 0xc3, 0x29, 0x0b, 0xb7, 0x1d, 0x9c, - 0x6e, 0x08, 0xa7, 0xf0, 0x6d, 0x00, 0x23, 0x12, 0xbb, 0x01, 0x4e, 0x28, 0x23, 0x5c, 0x45, 0xc2, - 0xaa, 0x33, 0x2b, 0xc6, 0x6a, 0xd1, 0xa9, 0x44, 0x24, 0x6e, 0x29, 0x85, 0x34, 0x66, 0x8d, 0xb7, - 0x40, 0x69, 0x3d, 0x08, 0x52, 0xcc, 0xd8, 0x36, 0x61, 0x1c, 0x5e, 0x04, 0x73, 0x48, 0x2d, 0x31, - 0xab, 0x1a, 0x2b, 0x85, 0xd5, 0xb2, 0xb3, 0x2f, 0x68, 0x7c, 0x0c, 0x96, 0xf2, 0x84, 0xbb, 0x98, - 0x37, 0x07, 0x28, 0xee, 0xe3, 0x0e, 0xf2, 0x77, 0x31, 0x67, 0xf0, 0x06, 0x28, 0x86, 0x84, 0x71, - 0x89, 0x2a, 0x5d, 0xbf, 0x62, 0xca, 0x0b, 0x38, 0x5a, 0x33, 0x5f, 0x85, 0x68, 0x21, 0x8e, 0x36, - 0x8a, 0xa2, 0x00, 0x8e, 0x04, 0x36, 0xbe, 0x34, 0x40, 0x75, 0x0b, 0x8f, 0xd7, 0x19, 0x23, 0xfd, - 0x38, 0xc2, 0x31, 0x77, 0x70, 0x12, 0x22, 0x1f, 0x8b, 0x4f, 0xf8, 0x7f, 0x30, 0x9f, 0x1f, 0x92, - 0x08, 0x48, 0xd2, 0xaa, 0xec, 0x94, 0x33, 0xa1, 0x48, 0x02, 0xbe, 0x0f, 0x40, 0x92, 0xe2, 0x91, - 0xeb, 0xbb, 0xbb, 0x78, 0xac, 0x39, 0x74, 0xd1, 0x9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0xf4, 0x03, 0x59, 0xaa, 0x9c, 0x45, 0xd3, 0x13, 0x2c, 0x82, 0x1f, 0x00, 0x90, 0xc8, 0xc3, 0x3b, - 0xf1, 0x09, 0xcf, 0x25, 0xd9, 0xa7, 0xa8, 0xdf, 0x03, 0x4a, 0x62, 0x77, 0x80, 0x45, 0x37, 0xd7, - 0xcd, 0x08, 0x08, 0xd1, 0xa6, 0x94, 0x34, 0x02, 0x50, 0xc9, 0x0a, 0x7f, 0x1b, 0x73, 0x14, 0x20, - 0x8e, 0x20, 0x04, 0xc5, 0x18, 0x45, 0x58, 0x37, 0x5f, 0xf9, 0x0d, 0x57, 0x40, 0x29, 0xc0, 0xcc, - 0x4f, 0x49, 0x22, 0xfb, 0xf2, 0xb4, 0x54, 0x4d, 0x8a, 0xe0, 0x32, 0x98, 0x8d, 0xf4, 0x0e, 0x32, - 0xca, 0x39, 0x27, 0x5f, 0x37, 0x9e, 0x14, 0xc0, 0x4a, 0xe6, 0xa6, 0x1d, 0x13, 0x4e, 0x50, 0x48, - 0x3e, 0x95, 0xbd, 0x58, 0xce, 0x00, 0xcc, 0x71, 0xca, 0xe0, 0x2d, 0xb0, 0x40, 0x94, 0x2e, 0x0b, - 0xd7, 0xd0, 0x07, 0x4a, 0x3c, 0xdf, 0x14, 0xf3, 0xca, 0xd4, 0x53, 0x6a, 0xb4, 0x66, 0xaa, 0xf0, - 0x75, 0x0b, 0x98, 0xd7, 0x38, 0x25, 0x84, 0x97, 0x41, 0xb9, 0x8f, 0x63, 0xcc, 0x08, 0x73, 0x07, - 0x88, 0x0d, 0x34, 0x2d, 0x4b, 0x5a, 0xb6, 0x89, 0xd8, 0x40, 0xd4, 0xc5, 0x23, 0x31, 0x4a, 0xc7, - 0xca, 0x42, 0x71, 0x12, 0x28, 0x91, 0x34, 0x68, 0x02, 0xc0, 0x12, 0xb4, 0x17, 0xcb, 0xd9, 0x22, - 0xeb, 0x76, 0x52, 0x66, 0xcd, 0x49, 0x9c, 0xd0, 0x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, 0x92, 0x2f, 0xd1, 0x87, 0xd6, 0xc1, 0x27, 0xbe, 0x7c, 0x04, 0x79, 0x33, 0xb2, - 0xbe, 0xef, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xfb, 0xf7, 0x74, 0x00, 0x0c, 0x00, 0x00, + // 1388 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6f, 0x1c, 0xc5, + 0x12, 0xf7, 0x78, 0x37, 0x8e, 0xdd, 0x6b, 0xfb, 0x6d, 0x3a, 0x4e, 0xb2, 0x76, 0x92, 0xb5, 0xb3, + 0x4f, 0x79, 0xb2, 0xf2, 0xc8, 0x0c, 0x0e, 0x12, 0x42, 0x70, 0x88, 0x6c, 0xef, 0x24, 0x5e, 0xec, + 0x38, 0xab, 0xd9, 0x0d, 0x87, 0x08, 0x34, 0xea, 0x9d, 0xe9, 0xec, 0x76, 0x3c, 0xd3, 0x3d, 0x9a, + 0xee, 0x5d, 0x67, 0x39, 0x73, 0xe0, 0x18, 0x6e, 0xdc, 0x00, 0x71, 0xe1, 0xc8, 0x01, 0x71, 0xe4, + 0x1c, 0x6e, 0x11, 0x27, 0x84, 0x50, 0x40, 0xc9, 0x81, 0x7f, 0x03, 0xf5, 0xc7, 0x8c, 0xc7, 0x1f, + 0x11, 0x8e, 0xb8, 0x8c, 0xba, 0x7f, 0x55, 0xbf, 0xea, 0xaa, 0xea, 0xea, 0xaa, 0x01, 0xcb, 0x23, + 0x84, 0xb8, 0x93, 0xa4, 0x6c, 0x44, 0x42, 0x9c, 0x3a, 0xa3, 0xb5, 0x7c, 0x6d, 0x27, 0x29, 0x13, + 0x0c, 0x56, 0xa5, 0x82, 0x9d, 0x83, 0xa3, 0xb5, 0xa5, 0x73, 0x28, 0x26, 0x94, 0x39, 0xea, 0xab, + 0x95, 0x96, 0x16, 0x03, 0xc6, 0x63, 0xc6,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x78, 0x44, 0xee, 0xb9, 0x77, + 0x5b, 0x9d, 0xae, 0xeb, 0xb9, 0xcd, 0xaa, 0x75, 0x02, 0xbd, 0xb5, 0xdb, 0xea, 0xb6, 0xd6, 0x77, + 0x5a, 0x0f, 0xdd, 0x66, 0x75, 0x12, 0x5e, 0x06, 0x97, 0x8e, 0xc8, 0x77, 0xd6, 0x1f, 0xec, 0x6e, + 0x6e, 0xb9, 0xcd, 0x6a, 0x09, 0x2e, 0x81, 0x8b, 0x47, 0x84, 0x9d, 0xee, 0xfd, 0x76, 0xdb, 0x6d, + 0x56, 0xcb, 0x27, 0xc8, 0x9a, 0xee, 0x8e, 0xdb, 0x75, 0x9b, 0xd5, 0x33, 0x4b, 0xe5, 0xcf, 0xbf, + 0xad, 0x4f, 0x6c, 0xb4, 0x9e, 0xbd, 0xac, 0x5b, 0xcf, 0x5f, 0xd6, 0xad, 0x3f, 0x5f, 0xd6, 0xad, + 0xa7, 0xaf, 0xea, 0x13, 0xcf, 0x5f, 0xd5, 0x27, 0x7e, 0x7d, 0x55, 0x9f, 0x78, 0xe8, 0xf4, 0x89, + 0x18, 0x0c, 0x7b, 0x76, 0xc0, 0x62, 0x07, 0x45, 0x11, 0xa1, 0x3d, 0x22, 0xb8, 0xa3, 0x7e, 0x33, + 0x9f, 0x38, 0x87, 0xff, 0xcf, 0xc5, 0x38, 0xc1, 0xbc, 0x37, 0xa5, 0xf2, 0xfb, 0xce, 0xdf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x63, 0x94, 0x07, 0xf6, 0xbd, 0x0b, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1070,11 +1061,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x30 } { - size, err := m.FeesPerBlock.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.FeesPerBlockAmount.Size() + i -= size + if _, err := m.FeesPerBlockAmount.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintProvider(dAtA, i, uint64(size)) } i-- @@ -1089,12 +1080,12 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.VaasTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VaasTimeoutPeriod):]) - if err2 != nil { - return 0, err2 + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.VaasTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VaasTimeoutPeriod):]) + if err1 != nil { + return 0, err1 } - i -= n2 - i = encodeVarintProvider(dAtA, i, uint64(n2)) + i -= n1 + i = encodeVarintProvider(dAtA, i, uint64(n1)) i-- dAtA[i] = 0x12 if len(m.TrustingPeriodFraction) > 0 { @@ -1344,12 +1335,12 @@ func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) - if err6 != nil { - return 0, err6 + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) + if err5 != nil { + return 0, err5 } - i -= n6 - i = encodeVarintProvider(dAtA, i, uint64(n6)) + i -= n5 + i = encodeVarintProvider(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x12 if m.ConsumerId != 0 { @@ -1481,29 +1472,29 @@ func (m *ConsumerInitializationParameters) MarshalToSizedBuffer(dAtA []byte) (in i-- dAtA[i] = 0x38 } - n8, err8 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.VaasTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VaasTimeoutPeriod):]) + n7, err7 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.VaasTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VaasTimeoutPeriod):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintProvider(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x32 + n8, err8 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod):]) if err8 != nil { return 0, err8 } i -= n8 i = encodeVarintProvider(dAtA, i, uint64(n8)) i-- - dAtA[i] = 0x32 - n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.UnbondingPeriod):]) + dAtA[i] = 0x2a + n9, err9 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.SpawnTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SpawnTime):]) if err9 != nil { return 0, err9 } i -= n9 i = encodeVarintProvider(dAtA, i, uint64(n9)) i-- - dAtA[i] = 0x2a - n10, err10 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.SpawnTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.SpawnTime):]) - if err10 != nil { - return 0, err10 - } - i -= n10 - i = encodeVarintProvider(dAtA, i, uint64(n10)) - i-- dAtA[i] = 0x22 if len(m.BinaryHash) > 0 { i -= len(m.BinaryHash) @@ -1553,20 +1544,20 @@ func (m *ConsumerIds) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.Ids) > 0 { - dAtA13 := make([]byte, len(m.Ids)*10) - var j12 int + dAtA12 := make([]byte, len(m.Ids)*10) + var j11 int for _, num := range m.Ids { for num >= 1<<7 { - dAtA13[j12] = uint8(uint64(num)&0x7f | 0x80) + dAtA12[j11] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j12++ + j11++ } - dAtA13[j12] = uint8(num) - j12++ + dAtA12[j11] = uint8(num) + j11++ } - i -= j12 - copy(dAtA[i:], dAtA13[:j12]) - i = encodeVarintProvider(dAtA, i, uint64(j12)) + i -= j11 + copy(dAtA[i:], dAtA12[:j11]) + i = encodeVarintProvider(dAtA, i, uint64(j11)) i-- dAtA[i] = 0xa } @@ -1650,12 +1641,12 @@ func (m *SlashJailParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - n16, err16 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.JailDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.JailDuration):]) - if err16 != nil { - return 0, err16 + n15, err15 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.JailDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.JailDuration):]) + if err15 != nil { + return 0, err15 } - i -= n16 - i = encodeVarintProvider(dAtA, i, uint64(n16)) + i -= n15 + i = encodeVarintProvider(dAtA, i, uint64(n15)) i-- dAtA[i] = 0x12 { @@ -1700,7 +1691,7 @@ func (m *Params) Size() (n int) { if m.MaxProviderConsensusValidators != 0 { n += 1 + sovProvider(uint64(m.MaxProviderConsensusValidators)) } - l = m.FeesPerBlock.Size() + l = m.FeesPerBlockAmount.Size() n += 1 + l + sovProvider(uint64(l)) if m.MinDepositBlocks != 0 { n += 1 + sovProvider(uint64(m.MinDepositBlocks)) @@ -2077,9 +2068,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { } case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeesPerBlock", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeesPerBlockAmount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -2089,22 +2080,23 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.FeesPerBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FeesPerBlockAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2288,7 +2280,7 @@ func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, types1.ValidatorSetChangePacketData{}) + m.List = append(m.List, types.ValidatorSetChangePacketData{}) if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/vaas/provider/types/query.pb.go b/x/vaas/provider/types/query.pb.go index 95468ab..406ee51 100644 --- a/x/vaas/provider/types/query.pb.go +++ b/x/vaas/provider/types/query.pb.go @@ -1390,8 +1390,9 @@ func (m *QueryConsumerFeesPerBlockRequest) GetConsumerId() uint64 { return 0 } -// Effective fee for the consumer: the override if one is set, else -// Params.FeesPerBlock. is_override distinguishes the two cases. +// Effective fee for the consumer (a resolved coin at the module's wired fee +// denom): the override amount if one is set, else Params.FeesPerBlockAmount. +// is_override distinguishes the two cases. type QueryConsumerFeesPerBlockResponse struct { FeesPerBlock github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,1,opt,name=fees_per_block,json=feesPerBlock,proto3,casttype=github.com/cosmos/cosmos-sdk/types.Coin" json:"fees_per_block"` IsOverride bool `protobuf:"varint,2,opt,name=is_override,json=isOverride,proto3" json:"is_override,omitempty"` @@ -2029,7 +2030,8 @@ type QueryClient interface { // of the consumer chain associated with the provided consumer id QueryConsumerGenesisTime(ctx context.Context, in *QueryConsumerGenesisTimeRequest, opts ...grpc.CallOption) (*QueryConsumerGenesisTimeResponse, error) // QueryConsumerFeesPerBlock returns the effective per-block fee for a - // consumer chain: the override if one is set, else Params.FeesPerBlock. + // consumer chain: the override amount if one is set, else + // Params.FeesPerBlockAmount, carried at the module's wired fee denom. QueryConsumerFeesPerBlock(ctx context.Context, in *QueryConsumerFeesPerBlockRequest, opts ...grpc.CallOption) (*QueryConsumerFeesPerBlockResponse, error) // QueryAllConsumerFeesPerBlockOverrides returns the list of per-consumer // fees_per_block amount overrides. @@ -2217,7 +2219,8 @@ type QueryServer interface { // of the consumer chain associated with the provided consumer id QueryConsumerGenesisTime(context.Context, *QueryConsumerGenesisTimeRequest) (*QueryConsumerGenesisTimeResponse, error) // QueryConsumerFeesPerBlock returns the effective per-block fee for a - // consumer chain: the override if one is set, else Params.FeesPerBlock. + // consumer chain: the override amount if one is set, else + // Params.FeesPerBlockAmount, carried at the module's wired fee denom. QueryConsumerFeesPerBlock(context.Context, *QueryConsumerFeesPerBlockRequest) (*QueryConsumerFeesPerBlockResponse, error) // QueryAllConsumerFeesPerBlockOverrides returns the list of per-consumer // fees_per_block amount overrides. diff --git a/x/vaas/provider/types/tx.pb.go b/x/vaas/provider/types/tx.pb.go index e922053..c3df744 100644 --- a/x/vaas/provider/types/tx.pb.go +++ b/x/vaas/provider/types/tx.pb.go @@ -722,12 +722,12 @@ type MsgSetConsumerFeesPerBlock struct { // consumer_id is the internal numeric id of the target consumer. ConsumerId uint64 `protobuf:"varint,2,opt,name=consumer_id,json=consumerId,proto3" json:"consumer_id,omitempty"` // amount is the per-block fee charged to the consumer, expressed in the - // module's fee denom (Params.FeesPerBlock.Denom). + // module's fee denom (fixed at module wiring). // // Empty string clears any existing override; the consumer reverts to - // Params.FeesPerBlock.Amount. A non-empty value must parse as a + // Params.FeesPerBlockAmount. A non-empty value must parse as a // cosmossdk.io/math.Int and must be strictly greater than the module-wide - // Params.FeesPerBlock.Amount, which acts as a floor: an override may only + // Params.FeesPerBlockAmount, which acts as a floor: an override may only // raise a consumer's per-block fee above the global default, never lower it. Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` }