From 31797eef8b9f664fdfa89b0ce09d27a31e0f8bb2 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Wed, 9 Oct 2024 00:57:43 +0200 Subject: [PATCH 01/13] [Tokenomics] Prevent GMR to produce zero values (#866) ## Summary This PR handles the case where non zero claimed rewards produce zero GMR rewards when the claimed rewards are too low. ## Issue When claimed rewards are too low, they might produce a global mint reward that is non-zero but less that 1. Since the TLM does not exepect a zero value, this might lead to a chain halt like below. ``` ERR error processing token logic modules for claim "af85b9dd2d49f1d5b133347eac2b65e7cd7a1a555fea742adba778f711207c6b": TLM "TLMGlobalMint": mint amount cannot be zero: failed to process TLM [/go/pkg/mod/cosmossdk.io/errors@v1.0.1/errors.go:155] module=server num_claim_compute_units=2 num_relays_in_session_tree=2 proof_requirement=NOT_REQUIRED session_id=af85b9dd2d49f1d5b133347eac2b65e7cd7a1a555fea742adba778f711207c6b supplier_operator_address=pokt1ytsx06dfxrp7cgt7t95jkxuyu2m97563zqz5pn ERR could not settle pending claims due to error TLM "TLMGlobalMint": mint amount cannot be zero: failed to process TLM [/go/pkg/mod/cosmossdk.io/errors@v1.0.1/errors.go:155] method=EndBlocker module=x/tokenomics ``` https://gist.github.com/okdas/013df312354ca0e7877a41290d94fad2 ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [x] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [x] **Unit Tests**: `make go_develop_and_test` - [x] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --- x/tokenomics/keeper/token_logic_modules.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 288c82f73..4ff96e027 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -635,6 +635,11 @@ func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk // TODO_MAINNET: Consider using fixed point arithmetic for deterministic results. settlementAmtFloat := new(big.Float).SetUint64(settlementCoin.Amount.Uint64()) newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintPerClaimedTokenGlobalInflation)) + // DEV_NOTE: If new mint is less than 1 and more than 0, ceil it to 1 so that + // we never expect to process a claim with 0 minted tokens. + if newMintAmtFloat.Cmp(big.NewFloat(1)) < 0 && newMintAmtFloat.Cmp(big.NewFloat(0)) > 0 { + newMintAmtFloat = big.NewFloat(1) + } newMintAmtInt, _ := newMintAmtFloat.Int64() mintAmtCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt)) return mintAmtCoin, *newMintAmtFloat From fd719737f3a6187036d70d6642d2a503517ef684 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 9 Oct 2024 19:49:15 +0200 Subject: [PATCH 02/13] [Application] Enforce minimum stake when staking (#847) ## Summary - Adds minimum stake validation to the application stake message handler (i.e. total stake must be >= minimum stake). - Updates error returns in the same handler to ensure all error paths return appropriate gRPC status errors. - Replaces some warn and error level logs with info level, which I believe is more appropriate (until we have a practical debug level, at which point they should become debug logs). ## Dependencies - #809 - #843 - #844 - #845 ## Dependents - #848 - #849 - #850 - #857 - #852 - #861 - #851 - #863 ## Issue - #612 ## Type of change Select one or more from the following: - [x] New feature, functionality or library - [x] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [ ] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [x] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- .../msg_server_delegate_to_gateway_test.go | 39 +++++----- .../keeper/msg_server_stake_application.go | 38 +++++++--- .../msg_server_stake_application_test.go | 76 ++++++++++++++----- .../msg_server_transfer_application_test.go | 3 +- ...msg_server_undelegate_from_gateway_test.go | 9 +-- .../msg_server_unstake_application_test.go | 31 ++++---- 6 files changed, 124 insertions(+), 72 deletions(-) diff --git a/x/application/keeper/msg_server_delegate_to_gateway_test.go b/x/application/keeper/msg_server_delegate_to_gateway_test.go index 722fc8e39..a0f8ec98b 100644 --- a/x/application/keeper/msg_server_delegate_to_gateway_test.go +++ b/x/application/keeper/msg_server_delegate_to_gateway_test.go @@ -4,14 +4,13 @@ import ( "fmt" "testing" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -28,9 +27,9 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -45,7 +44,7 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { require.True(t, isAppFound) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr1, } @@ -72,7 +71,7 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ + delegateMsg2 := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr2, } @@ -108,9 +107,9 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -125,7 +124,7 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { require.True(t, isAppFound) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } @@ -152,14 +151,14 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ + delegateMsg2 := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } // Attempt to delegate the application to the gateway again _, err = srv.DelegateToGateway(ctx, delegateMsg2) - require.ErrorIs(t, err, types.ErrAppAlreadyDelegated) + require.ErrorIs(t, err, apptypes.ErrAppAlreadyDelegated) events = sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) foundApp, isAppFound = k.GetApplication(ctx, appAddr) @@ -177,9 +176,9 @@ func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { gatewayAddr := sample.AccAddress() // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -194,14 +193,14 @@ func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { require.True(t, isAppFound) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } // Attempt to delegate the application to the unstaked gateway _, err = srv.DelegateToGateway(ctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppGatewayNotFound) + require.ErrorIs(t, err, apptypes.ErrAppGatewayNotFound) foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) @@ -215,9 +214,9 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { appAddr := sample.AccAddress() // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -240,7 +239,7 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { gatewayAddresses[i] = gatewayAddr // Mock the gateway being staked via the staked gateway map keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } @@ -270,14 +269,14 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } // Attempt to delegate the application when the max is already reached _, err = srv.DelegateToGateway(ctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppMaxDelegatedGateways) + require.ErrorIs(t, err, apptypes.ErrAppMaxDelegatedGateways) events = sdkCtx.EventManager().Events() require.Equal(t, int(maxDelegatedParam), len(events)) foundApp, isStakedAppFound := k.GetApplication(ctx, appAddr) diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index 769f0aa42..92153258c 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -5,6 +5,8 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/telemetry" "github.com/pokt-network/poktroll/x/application/types" @@ -23,7 +25,7 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl if err := msg.ValidateBasic(); err != nil { logger.Error(fmt.Sprintf("invalid MsgStakeApplication: %v", err)) - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Check if the application already exists or not @@ -38,13 +40,13 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl logger.Info(fmt.Sprintf("Application found. About to try and update application for address %q", msg.Address)) currAppStake := *foundApp.Stake if err = k.updateApplication(ctx, &foundApp, msg); err != nil { - logger.Error(fmt.Sprintf("could not update application for address %q due to error %v", msg.Address, err)) - return nil, err + logger.Info(fmt.Sprintf("could not update application for address %q due to error %v", msg.Address, err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } coinsToEscrow, err = (*msg.Stake).SafeSub(currAppStake) if err != nil { - logger.Error(fmt.Sprintf("could not calculate coins to escrow due to error %v", err)) - return nil, err + logger.Info(fmt.Sprintf("could not calculate coins to escrow due to error %v", err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } logger.Info(fmt.Sprintf("Application is going to escrow an additional %+v coins", coinsToEscrow)) @@ -52,24 +54,40 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl foundApp.UnstakeSessionEndHeight = types.ApplicationNotUnstaking } - // Must always stake or upstake (> 0 delta) + // MUST ALWAYS stake or upstake (> 0 delta) if coinsToEscrow.IsZero() { logger.Warn(fmt.Sprintf("Application %q must escrow more than 0 additional coins", msg.Address)) - return nil, types.ErrAppInvalidStake.Wrapf("application %q must escrow more than 0 additional coins", msg.Address) + return nil, status.Error( + codes.InvalidArgument, + types.ErrAppInvalidStake.Wrapf( + "application %q must escrow more than 0 additional coins", + msg.Address, + ).Error()) + } + + // MUST ALWAYS have at least minimum stake. + minStake := k.GetParams(ctx).MinStake + if msg.Stake.Amount.LT(minStake.Amount) { + errFmt := "application %q must stake at least %s" + logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) + return nil, status.Error( + codes.InvalidArgument, + types.ErrAppInvalidStake.Wrapf(errFmt, msg.Address, minStake).Error(), + ) } // Retrieve the address of the application appAddress, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - logger.Error(fmt.Sprintf("could not parse address %q", msg.Address)) - return nil, err + logger.Info(fmt.Sprintf("could not parse address %q", msg.Address)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Send the coins from the application to the staked application pool err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, appAddress, types.ModuleName, []sdk.Coin{coinsToEscrow}) if err != nil { logger.Error(fmt.Sprintf("could not send %v coins from %q to %q module account due to %v", coinsToEscrow, appAddress, types.ModuleName, err)) - return nil, err + return nil, status.Error(codes.Internal, err.Error()) } logger.Info(fmt.Sprintf("Successfully escrowed %v coins from %q to %q module account", coinsToEscrow, appAddress, types.ModuleName)) diff --git a/x/application/keeper/msg_server_stake_application_test.go b/x/application/keeper/msg_server_stake_application_test.go index 81049bc59..a90ab1006 100644 --- a/x/application/keeper/msg_server_stake_application_test.go +++ b/x/application/keeper/msg_server_stake_application_test.go @@ -4,13 +4,14 @@ import ( "testing" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -26,9 +27,10 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isAppFound) // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + initialStake := &apptypes.DefaultMinStake + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -42,14 +44,15 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, int64(100), foundApp.Stake.Amount.Int64()) + require.Equal(t, initialStake, foundApp.Stake) require.Len(t, foundApp.ServiceConfigs, 1) require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) // Prepare an updated application with a higher stake and another service - updateStakeMsg := &types.MsgStakeApplication{ + upStake := initialStake.AddAmount(math.NewInt(100)) + updateStakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(200)}, + Stake: &upStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, {ServiceId: "svc2"}, @@ -61,7 +64,7 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { require.NoError(t, err) foundApp, isAppFound = k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, int64(200), foundApp.Stake.Amount.Int64()) + require.Equal(t, &upStake, foundApp.Stake) require.Len(t, foundApp.ServiceConfigs, 2) require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) require.Equal(t, "svc2", foundApp.ServiceConfigs[1].ServiceId) @@ -74,9 +77,10 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing appAddr := sample.AccAddress() // Prepare the application stake message - stakeMsg := &types.MsgStakeApplication{ + initialStake := &apptypes.DefaultMinStake + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -87,9 +91,10 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing require.NoError(t, err) // Prepare the application stake message without any services - updateStakeMsg := &types.MsgStakeApplication{ + upStake := initialStake.AddAmount(math.NewInt(100)) + updateStakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &upStake, Services: []*sharedtypes.ApplicationServiceConfig{}, } @@ -105,9 +110,9 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) // Prepare the application stake message with an invalid service ID - updateStakeMsg = &types.MsgStakeApplication{ + updateStakeMsg = &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &upStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1 INVALID ! & *"}, }, @@ -130,10 +135,11 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Prepare the application + initialStake := &apptypes.DefaultMinStake appAddr := sample.AccAddress() - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -146,9 +152,10 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { require.True(t, isAppFound) // Prepare an updated application with a lower stake - updateMsg := &types.MsgStakeApplication{ + downStake := initialStake.SubAmount(math.NewInt(1000)) + updateMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(50)}, + Stake: &downStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -161,5 +168,36 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { // Verify that the application stake is unchanged foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, int64(100), foundApp.Stake.Amount.Int64()) + require.Equal(t, initialStake, foundApp.Stake) +} + +func TestMsgServer_StakeApplication_FailBelowMinStake(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + addr := sample.AccAddress() + appStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) + minStake := appStake.AddAmount(math.NewInt(1)) + expectedErr := apptypes.ErrAppInvalidStake.Wrapf("application %q must stake at least %s", addr, minStake) + + // Set the minimum stake to be greater than the application stake. + params := k.GetParams(ctx) + params.MinStake = &minStake + err := k.SetParams(ctx, params) + require.NoError(t, err) + + // Prepare the application. + stakeMsg := &apptypes.MsgStakeApplication{ + Address: addr, + Stake: &appStake, + Services: []*sharedtypes.ApplicationServiceConfig{ + {ServiceId: "svc1"}, + }, + } + + // Attempt to stake the application & verify that the application does NOT exist. + _, err = srv.StakeApplication(ctx, stakeMsg) + require.ErrorContains(t, err, expectedErr.Error()) + _, isGatewayFound := k.GetApplication(ctx, addr) + require.False(t, isGatewayFound) } diff --git a/x/application/keeper/msg_server_transfer_application_test.go b/x/application/keeper/msg_server_transfer_application_test.go index ab323de62..f301a0339 100644 --- a/x/application/keeper/msg_server_transfer_application_test.go +++ b/x/application/keeper/msg_server_transfer_application_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec/types" cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -30,7 +29,7 @@ func TestMsgServer_TransferApplication_Success(t *testing.T) { _, isSrcFound := k.GetApplication(ctx, srcBech32) require.False(t, isSrcFound) - expectedAppStake := &cosmostypes.Coin{Denom: "upokt", Amount: math.NewInt(100)} + expectedAppStake := &apptypes.DefaultMinStake // Prepare the application. stakeMsg := &apptypes.MsgStakeApplication{ diff --git a/x/application/keeper/msg_server_undelegate_from_gateway_test.go b/x/application/keeper/msg_server_undelegate_from_gateway_test.go index 7f4785ace..a3f1abf8b 100644 --- a/x/application/keeper/msg_server_undelegate_from_gateway_test.go +++ b/x/application/keeper/msg_server_undelegate_from_gateway_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -39,7 +38,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -131,7 +130,7 @@ func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -206,7 +205,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGatew // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -514,7 +513,7 @@ func createAppStakeDelegateAndUndelegate( appAddr := sample.AccAddress() stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go index 442b65a98..a5ed5801f 100644 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ b/x/application/keeper/msg_server_unstake_application_test.go @@ -3,14 +3,13 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -27,7 +26,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { require.False(t, isAppFound) // Prepare the application - initialStake := int64(100) + initialStake := apptypes.DefaultMinStake.Amount.Int64() stakeMsg := createAppStakeMsg(unstakingAppAddr, initialStake) // Stake the application @@ -54,7 +53,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { require.True(t, isAppFound) // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: unstakingAppAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: unstakingAppAddr} _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) @@ -64,7 +63,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { require.True(t, foundApp.IsUnbonding()) // Move block height to the end of the unbonding period - unbondingHeight := types.GetApplicationUnbondingHeight(&sharedParams, &foundApp) + unbondingHeight := apptypes.GetApplicationUnbondingHeight(&sharedParams, &foundApp) ctx = keepertest.SetBlockHeight(ctx, unbondingHeight) // Run the endblocker to unbond applications @@ -91,7 +90,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { appAddr := sample.AccAddress() // Stake the application - initialStake := int64(100) + initialStake := apptypes.DefaultMinStake.Amount.Int64() stakeMsg := createAppStakeMsg(appAddr, initialStake) _, err := srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) @@ -102,7 +101,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { require.False(t, foundApp.IsUnbonding()) // Initiate the application unstaking - unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: appAddr} _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) @@ -111,7 +110,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { require.True(t, isAppFound) require.True(t, foundApp.IsUnbonding()) - unbondingHeight := types.GetApplicationUnbondingHeight(&sharedParams, &foundApp) + unbondingHeight := apptypes.GetApplicationUnbondingHeight(&sharedParams, &foundApp) // Stake the application again stakeMsg = createAppStakeMsg(appAddr, initialStake+1) @@ -147,10 +146,10 @@ func TestMsgServer_UnstakeApplication_FailIfNotStaked(t *testing.T) { require.False(t, isAppFound) // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: appAddr} _, err := srv.UnstakeApplication(ctx, unstakeMsg) require.Error(t, err) - require.ErrorIs(t, err, types.ErrAppNotFound) + require.ErrorIs(t, err, apptypes.ErrAppNotFound) _, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) require.False(t, isAppFound) @@ -164,13 +163,13 @@ func TestMsgServer_UnstakeApplication_FailIfCurrentlyUnstaking(t *testing.T) { appAddr := sample.AccAddress() // Stake the application - initialStake := int64(100) + initialStake := apptypes.DefaultMinStake.Amount.Int64() stakeMsg := createAppStakeMsg(appAddr, initialStake) _, err := srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) // Initiate the application unstaking - unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: appAddr} _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) @@ -179,13 +178,13 @@ func TestMsgServer_UnstakeApplication_FailIfCurrentlyUnstaking(t *testing.T) { // Verify that the application cannot unstake if it is already unstaking. _, err = srv.UnstakeApplication(ctx, unstakeMsg) - require.ErrorIs(t, err, types.ErrAppIsUnstaking) + require.ErrorIs(t, err, apptypes.ErrAppIsUnstaking) } -func createAppStakeMsg(appAddr string, stakeAmount int64) *types.MsgStakeApplication { - initialStake := sdk.NewCoin("upokt", math.NewInt(stakeAmount)) +func createAppStakeMsg(appAddr string, stakeAmount int64) *apptypes.MsgStakeApplication { + initialStake := sdk.NewInt64Coin("upokt", stakeAmount) - return &types.MsgStakeApplication{ + return &apptypes.MsgStakeApplication{ Address: appAddr, Stake: &initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ From 879401e18eb73b944f26d047a9559b3a83ac9259 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Thu, 10 Oct 2024 05:08:19 +0200 Subject: [PATCH 03/13] [DifficultyHash] Prepare for difficulty multiplier usage (#836) ## Summary This PR prepares for claimed amount calculation to use the `RelayDifficultyMultiplier`. * It removes the `RelayDifficultyTargetHash` `proof` param. * Replace `prooftypes.DefaultRelayDifficultyTargetHash` occurrences with `protocol.BaseRelayDifficultyHashBz`. * Moves the `RleayMiningDifficulty` logic to the `service` module due to cyclic dependencies. * Rename `num_compute_units` to `num_claimed_compute_units` and add `num_estimated_compute_units` and `claimed_amount_upokt` * Remove the no longer used tokenomics querier to retrieve a service difficulty target hash. The PR is only renaming and moving of files most (~13200LOC) changes are auto-generated code. ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [x] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [x] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [x] **Unit Tests**: `make go_develop_and_test` - [x] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --- api/poktroll/proof/event.pulsar.go | 1048 ++++++-- api/poktroll/proof/params.pulsar.go | 174 +- api/poktroll/service/event.pulsar.go | 842 ++++++ api/poktroll/service/genesis.pulsar.go | 212 +- api/poktroll/service/query.pulsar.go | 2269 ++++++++++++++++- api/poktroll/service/query_grpc.pb.go | 84 +- .../service/relay_mining_difficulty.pulsar.go | 775 ++++++ api/poktroll/tokenomics/event.pulsar.go | 1505 ++++------- api/poktroll/tokenomics/genesis.pulsar.go | 215 +- api/poktroll/tokenomics/query.pulsar.go | 2235 +--------------- api/poktroll/tokenomics/query_grpc.pb.go | 80 +- docusaurus/docs/protocol/governance/params.md | 6 +- e2e/tests/0_settlement.feature | 2 - e2e/tests/parse_params_test.go | 3 - e2e/tests/session.feature | 1 - e2e/tests/session_steps_test.go | 3 +- e2e/tests/update_params_test.go | 6 - pkg/client/interface.go | 16 +- pkg/client/query/servicequerier.go | 17 + pkg/client/query/tokenomicsquerier.go | 55 - pkg/deps/config/suppliers.go | 18 - pkg/relayer/cmd/cmd.go | 3 +- pkg/relayer/miner/miner.go | 13 +- pkg/relayer/miner/miner_test.go | 4 +- pkg/relayer/session/proof.go | 2 +- pkg/relayer/session/session.go | 4 - pkg/relayer/session/session_test.go | 2 - proto/poktroll/proof/event.proto | 17 +- proto/poktroll/proof/params.proto | 4 - proto/poktroll/service/event.proto | 17 + proto/poktroll/service/genesis.proto | 2 + proto/poktroll/service/query.proto | 26 + .../relay_mining_difficulty.proto | 4 +- proto/poktroll/tokenomics/event.proto | 30 +- proto/poktroll/tokenomics/genesis.proto | 6 +- proto/poktroll/tokenomics/query.proto | 31 - .../relay_mining_difficulty_test.go | 11 +- .../relay_mining_integration_test.go | 4 +- testutil/integration/suites/param_configs.go | 1 - testutil/keeper/tokenomics.go | 10 +- .../testqueryclients/servicequerier.go | 43 + .../testqueryclients/tokenomicsquerier.go | 66 - x/proof/keeper/msg_server_create_claim.go | 16 +- .../keeper/msg_server_create_claim_test.go | 34 +- x/proof/keeper/msg_server_submit_proof.go | 32 +- .../keeper/msg_server_submit_proof_test.go | 11 +- x/proof/keeper/msg_server_update_param.go | 7 - .../keeper/msg_server_update_param_test.go | 28 - x/proof/keeper/msg_update_params_test.go | 5 +- x/proof/keeper/params_test.go | 29 - x/proof/keeper/proof_validation.go | 15 +- x/proof/keeper/proof_validation_test.go | 28 +- x/proof/types/claim.go | 4 +- x/proof/types/event.pb.go | 542 +++- x/proof/types/expected_keepers.go | 3 + x/proof/types/message_update_param.go | 14 - x/proof/types/message_update_param_test.go | 8 +- x/proof/types/params.go | 41 - x/proof/types/params.pb.go | 114 +- .../keeper/query_relay_mining_difficulty.go | 2 +- .../query_relay_mining_difficulty_test.go | 6 +- .../keeper/relay_mining_difficulty.go | 2 +- .../keeper/relay_mining_difficulty_test.go | 10 +- .../keeper/scale_difficulty_test.go | 0 .../keeper/update_relay_mining_difficulty.go | 165 ++ .../update_relay_mining_difficulty_test.go | 40 +- x/service/module/genesis.go | 5 + x/service/module/genesis_test.go | 10 + x/service/types/errors.go | 31 +- x/service/types/event.pb.go | 495 ++++ x/service/types/genesis.go | 38 +- x/service/types/genesis.pb.go | 96 +- x/service/types/genesis_test.go | 23 + .../types/key_relay_mining_difficulty.go | 0 x/service/types/query.pb.go | 1089 +++++++- x/service/types/query.pb.gw.go | 184 ++ .../types/relay_mining_difficulty.pb.go | 49 +- .../keeper_settle_pending_claims_test.go | 26 +- x/tokenomics/keeper/settle_pending_claims.go | 29 +- x/tokenomics/keeper/token_logic_modules.go | 37 +- .../keeper/update_relay_mining_difficulty.go | 158 +- x/tokenomics/module/genesis.go | 5 - x/tokenomics/module/genesis_test.go | 10 - x/tokenomics/types/errors.go | 25 +- x/tokenomics/types/event.pb.go | 578 ++--- x/tokenomics/types/expected_keepers.go | 3 + x/tokenomics/types/genesis.go | 11 - x/tokenomics/types/genesis.pb.go | 89 +- x/tokenomics/types/genesis_test.go | 22 - x/tokenomics/types/query.pb.go | 884 +------ x/tokenomics/types/query.pb.gw.go | 184 -- x/tokenomics/types/tx.pb.go | 1 - 92 files changed, 8676 insertions(+), 6428 deletions(-) create mode 100644 api/poktroll/service/event.pulsar.go create mode 100644 api/poktroll/service/relay_mining_difficulty.pulsar.go delete mode 100644 pkg/client/query/tokenomicsquerier.go create mode 100644 proto/poktroll/service/event.proto rename proto/poktroll/{tokenomics => service}/relay_mining_difficulty.proto (92%) rename tests/integration/{tokenomics => service}/relay_mining_difficulty_test.go (94%) delete mode 100644 testutil/testclient/testqueryclients/tokenomicsquerier.go rename x/{tokenomics => service}/keeper/query_relay_mining_difficulty.go (97%) rename x/{tokenomics => service}/keeper/query_relay_mining_difficulty_test.go (95%) rename x/{tokenomics => service}/keeper/relay_mining_difficulty.go (97%) rename x/{tokenomics => service}/keeper/relay_mining_difficulty_test.go (85%) rename x/{tokenomics => service}/keeper/scale_difficulty_test.go (100%) create mode 100644 x/service/keeper/update_relay_mining_difficulty.go rename x/{tokenomics => service}/keeper/update_relay_mining_difficulty_test.go (87%) create mode 100644 x/service/types/event.pb.go rename x/{tokenomics => service}/types/key_relay_mining_difficulty.go (100%) rename x/{tokenomics => service}/types/relay_mining_difficulty.pb.go (83%) diff --git a/api/poktroll/proof/event.pulsar.go b/api/poktroll/proof/event.pulsar.go index 50fdd4646..be2eeaf14 100644 --- a/api/poktroll/proof/event.pulsar.go +++ b/api/poktroll/proof/event.pulsar.go @@ -2,6 +2,7 @@ package proof import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -14,10 +15,12 @@ import ( ) var ( - md_EventClaimCreated protoreflect.MessageDescriptor - fd_EventClaimCreated_claim protoreflect.FieldDescriptor - fd_EventClaimCreated_num_relays protoreflect.FieldDescriptor - fd_EventClaimCreated_num_compute_units protoreflect.FieldDescriptor + md_EventClaimCreated protoreflect.MessageDescriptor + fd_EventClaimCreated_claim protoreflect.FieldDescriptor + fd_EventClaimCreated_num_relays protoreflect.FieldDescriptor + fd_EventClaimCreated_num_claimed_compute_units protoreflect.FieldDescriptor + fd_EventClaimCreated_num_estimated_compute_units protoreflect.FieldDescriptor + fd_EventClaimCreated_claimed_amount_upokt protoreflect.FieldDescriptor ) func init() { @@ -25,7 +28,9 @@ func init() { md_EventClaimCreated = File_poktroll_proof_event_proto.Messages().ByName("EventClaimCreated") fd_EventClaimCreated_claim = md_EventClaimCreated.Fields().ByName("claim") fd_EventClaimCreated_num_relays = md_EventClaimCreated.Fields().ByName("num_relays") - fd_EventClaimCreated_num_compute_units = md_EventClaimCreated.Fields().ByName("num_compute_units") + fd_EventClaimCreated_num_claimed_compute_units = md_EventClaimCreated.Fields().ByName("num_claimed_compute_units") + fd_EventClaimCreated_num_estimated_compute_units = md_EventClaimCreated.Fields().ByName("num_estimated_compute_units") + fd_EventClaimCreated_claimed_amount_upokt = md_EventClaimCreated.Fields().ByName("claimed_amount_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimCreated)(nil) @@ -105,9 +110,21 @@ func (x *fastReflection_EventClaimCreated) Range(f func(protoreflect.FieldDescri return } } - if x.NumComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.NumComputeUnits) - if !f(fd_EventClaimCreated_num_compute_units, value) { + if x.NumClaimedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumClaimedComputeUnits) + if !f(fd_EventClaimCreated_num_claimed_compute_units, value) { + return + } + } + if x.NumEstimatedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumEstimatedComputeUnits) + if !f(fd_EventClaimCreated_num_estimated_compute_units, value) { + return + } + } + if x.ClaimedAmountUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + if !f(fd_EventClaimCreated_claimed_amount_upokt, value) { return } } @@ -130,8 +147,12 @@ func (x *fastReflection_EventClaimCreated) Has(fd protoreflect.FieldDescriptor) return x.Claim != nil case "poktroll.proof.EventClaimCreated.num_relays": return x.NumRelays != uint64(0) - case "poktroll.proof.EventClaimCreated.num_compute_units": - return x.NumComputeUnits != uint64(0) + case "poktroll.proof.EventClaimCreated.num_claimed_compute_units": + return x.NumClaimedComputeUnits != uint64(0) + case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": + return x.NumEstimatedComputeUnits != uint64(0) + case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": + return x.ClaimedAmountUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -152,8 +173,12 @@ func (x *fastReflection_EventClaimCreated) Clear(fd protoreflect.FieldDescriptor x.Claim = nil case "poktroll.proof.EventClaimCreated.num_relays": x.NumRelays = uint64(0) - case "poktroll.proof.EventClaimCreated.num_compute_units": - x.NumComputeUnits = uint64(0) + case "poktroll.proof.EventClaimCreated.num_claimed_compute_units": + x.NumClaimedComputeUnits = uint64(0) + case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": + x.NumEstimatedComputeUnits = uint64(0) + case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": + x.ClaimedAmountUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -176,9 +201,15 @@ func (x *fastReflection_EventClaimCreated) Get(descriptor protoreflect.FieldDesc case "poktroll.proof.EventClaimCreated.num_relays": value := x.NumRelays return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventClaimCreated.num_compute_units": - value := x.NumComputeUnits + case "poktroll.proof.EventClaimCreated.num_claimed_compute_units": + value := x.NumClaimedComputeUnits return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": + value := x.NumEstimatedComputeUnits + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": + value := x.ClaimedAmountUpokt + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -203,8 +234,12 @@ func (x *fastReflection_EventClaimCreated) Set(fd protoreflect.FieldDescriptor, x.Claim = value.Message().Interface().(*Claim) case "poktroll.proof.EventClaimCreated.num_relays": x.NumRelays = value.Uint() - case "poktroll.proof.EventClaimCreated.num_compute_units": - x.NumComputeUnits = value.Uint() + case "poktroll.proof.EventClaimCreated.num_claimed_compute_units": + x.NumClaimedComputeUnits = value.Uint() + case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": + x.NumEstimatedComputeUnits = value.Uint() + case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": + x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -230,10 +265,17 @@ func (x *fastReflection_EventClaimCreated) Mutable(fd protoreflect.FieldDescript x.Claim = new(Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) case "poktroll.proof.EventClaimCreated.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventClaimCreated is not mutable")) - case "poktroll.proof.EventClaimCreated.num_compute_units": - panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventClaimCreated is not mutable")) + case "poktroll.proof.EventClaimCreated.num_claimed_compute_units": + panic(fmt.Errorf("field num_claimed_compute_units of message poktroll.proof.EventClaimCreated is not mutable")) + case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": + panic(fmt.Errorf("field num_estimated_compute_units of message poktroll.proof.EventClaimCreated is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -252,8 +294,13 @@ func (x *fastReflection_EventClaimCreated) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.proof.EventClaimCreated.num_relays": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventClaimCreated.num_compute_units": + case "poktroll.proof.EventClaimCreated.num_claimed_compute_units": return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -330,8 +377,15 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { if x.NumRelays != 0 { n += 1 + runtime.Sov(uint64(x.NumRelays)) } - if x.NumComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + if x.NumClaimedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumClaimedComputeUnits)) + } + if x.NumEstimatedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) + } + if x.ClaimedAmountUpokt != nil { + l = options.Size(x.ClaimedAmountUpokt) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -362,10 +416,29 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.NumComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + if x.ClaimedAmountUpokt != nil { + encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + if x.NumEstimatedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumEstimatedComputeUnits)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x28 + } + if x.NumClaimedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumClaimedComputeUnits)) + i-- + dAtA[i] = 0x20 } if x.NumRelays != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) @@ -490,11 +563,11 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { break } } - case 3: + case 4: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) } - x.NumComputeUnits = 0 + x.NumClaimedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -504,11 +577,66 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.NumComputeUnits |= uint64(b&0x7F) << shift + x.NumClaimedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + x.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -545,10 +673,12 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { } var ( - md_EventClaimUpdated protoreflect.MessageDescriptor - fd_EventClaimUpdated_claim protoreflect.FieldDescriptor - fd_EventClaimUpdated_num_relays protoreflect.FieldDescriptor - fd_EventClaimUpdated_num_compute_units protoreflect.FieldDescriptor + md_EventClaimUpdated protoreflect.MessageDescriptor + fd_EventClaimUpdated_claim protoreflect.FieldDescriptor + fd_EventClaimUpdated_num_relays protoreflect.FieldDescriptor + fd_EventClaimUpdated_num_claimed_compute_units protoreflect.FieldDescriptor + fd_EventClaimUpdated_num_estimated_compute_units protoreflect.FieldDescriptor + fd_EventClaimUpdated_claimed_amount_upokt protoreflect.FieldDescriptor ) func init() { @@ -556,7 +686,9 @@ func init() { md_EventClaimUpdated = File_poktroll_proof_event_proto.Messages().ByName("EventClaimUpdated") fd_EventClaimUpdated_claim = md_EventClaimUpdated.Fields().ByName("claim") fd_EventClaimUpdated_num_relays = md_EventClaimUpdated.Fields().ByName("num_relays") - fd_EventClaimUpdated_num_compute_units = md_EventClaimUpdated.Fields().ByName("num_compute_units") + fd_EventClaimUpdated_num_claimed_compute_units = md_EventClaimUpdated.Fields().ByName("num_claimed_compute_units") + fd_EventClaimUpdated_num_estimated_compute_units = md_EventClaimUpdated.Fields().ByName("num_estimated_compute_units") + fd_EventClaimUpdated_claimed_amount_upokt = md_EventClaimUpdated.Fields().ByName("claimed_amount_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimUpdated)(nil) @@ -636,9 +768,21 @@ func (x *fastReflection_EventClaimUpdated) Range(f func(protoreflect.FieldDescri return } } - if x.NumComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.NumComputeUnits) - if !f(fd_EventClaimUpdated_num_compute_units, value) { + if x.NumClaimedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumClaimedComputeUnits) + if !f(fd_EventClaimUpdated_num_claimed_compute_units, value) { + return + } + } + if x.NumEstimatedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumEstimatedComputeUnits) + if !f(fd_EventClaimUpdated_num_estimated_compute_units, value) { + return + } + } + if x.ClaimedAmountUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + if !f(fd_EventClaimUpdated_claimed_amount_upokt, value) { return } } @@ -661,8 +805,12 @@ func (x *fastReflection_EventClaimUpdated) Has(fd protoreflect.FieldDescriptor) return x.Claim != nil case "poktroll.proof.EventClaimUpdated.num_relays": return x.NumRelays != uint64(0) - case "poktroll.proof.EventClaimUpdated.num_compute_units": - return x.NumComputeUnits != uint64(0) + case "poktroll.proof.EventClaimUpdated.num_claimed_compute_units": + return x.NumClaimedComputeUnits != uint64(0) + case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": + return x.NumEstimatedComputeUnits != uint64(0) + case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": + return x.ClaimedAmountUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -683,8 +831,12 @@ func (x *fastReflection_EventClaimUpdated) Clear(fd protoreflect.FieldDescriptor x.Claim = nil case "poktroll.proof.EventClaimUpdated.num_relays": x.NumRelays = uint64(0) - case "poktroll.proof.EventClaimUpdated.num_compute_units": - x.NumComputeUnits = uint64(0) + case "poktroll.proof.EventClaimUpdated.num_claimed_compute_units": + x.NumClaimedComputeUnits = uint64(0) + case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": + x.NumEstimatedComputeUnits = uint64(0) + case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": + x.ClaimedAmountUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -707,9 +859,15 @@ func (x *fastReflection_EventClaimUpdated) Get(descriptor protoreflect.FieldDesc case "poktroll.proof.EventClaimUpdated.num_relays": value := x.NumRelays return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventClaimUpdated.num_compute_units": - value := x.NumComputeUnits + case "poktroll.proof.EventClaimUpdated.num_claimed_compute_units": + value := x.NumClaimedComputeUnits + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": + value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": + value := x.ClaimedAmountUpokt + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -734,8 +892,12 @@ func (x *fastReflection_EventClaimUpdated) Set(fd protoreflect.FieldDescriptor, x.Claim = value.Message().Interface().(*Claim) case "poktroll.proof.EventClaimUpdated.num_relays": x.NumRelays = value.Uint() - case "poktroll.proof.EventClaimUpdated.num_compute_units": - x.NumComputeUnits = value.Uint() + case "poktroll.proof.EventClaimUpdated.num_claimed_compute_units": + x.NumClaimedComputeUnits = value.Uint() + case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": + x.NumEstimatedComputeUnits = value.Uint() + case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": + x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -761,10 +923,17 @@ func (x *fastReflection_EventClaimUpdated) Mutable(fd protoreflect.FieldDescript x.Claim = new(Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) case "poktroll.proof.EventClaimUpdated.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventClaimUpdated is not mutable")) - case "poktroll.proof.EventClaimUpdated.num_compute_units": - panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventClaimUpdated is not mutable")) + case "poktroll.proof.EventClaimUpdated.num_claimed_compute_units": + panic(fmt.Errorf("field num_claimed_compute_units of message poktroll.proof.EventClaimUpdated is not mutable")) + case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": + panic(fmt.Errorf("field num_estimated_compute_units of message poktroll.proof.EventClaimUpdated is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -783,8 +952,13 @@ func (x *fastReflection_EventClaimUpdated) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.proof.EventClaimUpdated.num_relays": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventClaimUpdated.num_compute_units": + case "poktroll.proof.EventClaimUpdated.num_claimed_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -861,8 +1035,15 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { if x.NumRelays != 0 { n += 1 + runtime.Sov(uint64(x.NumRelays)) } - if x.NumComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + if x.NumClaimedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumClaimedComputeUnits)) + } + if x.NumEstimatedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) + } + if x.ClaimedAmountUpokt != nil { + l = options.Size(x.ClaimedAmountUpokt) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -893,10 +1074,29 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.NumComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + if x.ClaimedAmountUpokt != nil { + encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + if x.NumEstimatedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumEstimatedComputeUnits)) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x28 + } + if x.NumClaimedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumClaimedComputeUnits)) + i-- + dAtA[i] = 0x20 } if x.NumRelays != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) @@ -1021,11 +1221,49 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { break } } - case 3: + case 4: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) + } + x.NumClaimedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumClaimedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + x.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - x.NumComputeUnits = 0 + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1035,11 +1273,28 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.NumComputeUnits |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1076,11 +1331,13 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { } var ( - md_EventProofSubmitted protoreflect.MessageDescriptor - fd_EventProofSubmitted_claim protoreflect.FieldDescriptor - fd_EventProofSubmitted_proof protoreflect.FieldDescriptor - fd_EventProofSubmitted_num_relays protoreflect.FieldDescriptor - fd_EventProofSubmitted_num_compute_units protoreflect.FieldDescriptor + md_EventProofSubmitted protoreflect.MessageDescriptor + fd_EventProofSubmitted_claim protoreflect.FieldDescriptor + fd_EventProofSubmitted_proof protoreflect.FieldDescriptor + fd_EventProofSubmitted_num_relays protoreflect.FieldDescriptor + fd_EventProofSubmitted_num_claimed_compute_units protoreflect.FieldDescriptor + fd_EventProofSubmitted_num_estimated_compute_units protoreflect.FieldDescriptor + fd_EventProofSubmitted_claimed_amount_upokt protoreflect.FieldDescriptor ) func init() { @@ -1089,7 +1346,9 @@ func init() { fd_EventProofSubmitted_claim = md_EventProofSubmitted.Fields().ByName("claim") fd_EventProofSubmitted_proof = md_EventProofSubmitted.Fields().ByName("proof") fd_EventProofSubmitted_num_relays = md_EventProofSubmitted.Fields().ByName("num_relays") - fd_EventProofSubmitted_num_compute_units = md_EventProofSubmitted.Fields().ByName("num_compute_units") + fd_EventProofSubmitted_num_claimed_compute_units = md_EventProofSubmitted.Fields().ByName("num_claimed_compute_units") + fd_EventProofSubmitted_num_estimated_compute_units = md_EventProofSubmitted.Fields().ByName("num_estimated_compute_units") + fd_EventProofSubmitted_claimed_amount_upokt = md_EventProofSubmitted.Fields().ByName("claimed_amount_upokt") } var _ protoreflect.Message = (*fastReflection_EventProofSubmitted)(nil) @@ -1175,9 +1434,21 @@ func (x *fastReflection_EventProofSubmitted) Range(f func(protoreflect.FieldDesc return } } - if x.NumComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.NumComputeUnits) - if !f(fd_EventProofSubmitted_num_compute_units, value) { + if x.NumClaimedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumClaimedComputeUnits) + if !f(fd_EventProofSubmitted_num_claimed_compute_units, value) { + return + } + } + if x.NumEstimatedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumEstimatedComputeUnits) + if !f(fd_EventProofSubmitted_num_estimated_compute_units, value) { + return + } + } + if x.ClaimedAmountUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + if !f(fd_EventProofSubmitted_claimed_amount_upokt, value) { return } } @@ -1202,8 +1473,12 @@ func (x *fastReflection_EventProofSubmitted) Has(fd protoreflect.FieldDescriptor return x.Proof != nil case "poktroll.proof.EventProofSubmitted.num_relays": return x.NumRelays != uint64(0) - case "poktroll.proof.EventProofSubmitted.num_compute_units": - return x.NumComputeUnits != uint64(0) + case "poktroll.proof.EventProofSubmitted.num_claimed_compute_units": + return x.NumClaimedComputeUnits != uint64(0) + case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": + return x.NumEstimatedComputeUnits != uint64(0) + case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": + return x.ClaimedAmountUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1226,8 +1501,12 @@ func (x *fastReflection_EventProofSubmitted) Clear(fd protoreflect.FieldDescript x.Proof = nil case "poktroll.proof.EventProofSubmitted.num_relays": x.NumRelays = uint64(0) - case "poktroll.proof.EventProofSubmitted.num_compute_units": - x.NumComputeUnits = uint64(0) + case "poktroll.proof.EventProofSubmitted.num_claimed_compute_units": + x.NumClaimedComputeUnits = uint64(0) + case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": + x.NumEstimatedComputeUnits = uint64(0) + case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": + x.ClaimedAmountUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1253,9 +1532,15 @@ func (x *fastReflection_EventProofSubmitted) Get(descriptor protoreflect.FieldDe case "poktroll.proof.EventProofSubmitted.num_relays": value := x.NumRelays return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventProofSubmitted.num_compute_units": - value := x.NumComputeUnits + case "poktroll.proof.EventProofSubmitted.num_claimed_compute_units": + value := x.NumClaimedComputeUnits + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": + value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": + value := x.ClaimedAmountUpokt + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1282,8 +1567,12 @@ func (x *fastReflection_EventProofSubmitted) Set(fd protoreflect.FieldDescriptor x.Proof = value.Message().Interface().(*Proof) case "poktroll.proof.EventProofSubmitted.num_relays": x.NumRelays = value.Uint() - case "poktroll.proof.EventProofSubmitted.num_compute_units": - x.NumComputeUnits = value.Uint() + case "poktroll.proof.EventProofSubmitted.num_claimed_compute_units": + x.NumClaimedComputeUnits = value.Uint() + case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": + x.NumEstimatedComputeUnits = value.Uint() + case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": + x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1314,10 +1603,17 @@ func (x *fastReflection_EventProofSubmitted) Mutable(fd protoreflect.FieldDescri x.Proof = new(Proof) } return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) case "poktroll.proof.EventProofSubmitted.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventProofSubmitted is not mutable")) - case "poktroll.proof.EventProofSubmitted.num_compute_units": - panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventProofSubmitted is not mutable")) + case "poktroll.proof.EventProofSubmitted.num_claimed_compute_units": + panic(fmt.Errorf("field num_claimed_compute_units of message poktroll.proof.EventProofSubmitted is not mutable")) + case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": + panic(fmt.Errorf("field num_estimated_compute_units of message poktroll.proof.EventProofSubmitted is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1339,8 +1635,13 @@ func (x *fastReflection_EventProofSubmitted) NewField(fd protoreflect.FieldDescr return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.proof.EventProofSubmitted.num_relays": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventProofSubmitted.num_compute_units": + case "poktroll.proof.EventProofSubmitted.num_claimed_compute_units": return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1421,8 +1722,15 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods if x.NumRelays != 0 { n += 1 + runtime.Sov(uint64(x.NumRelays)) } - if x.NumComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + if x.NumClaimedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumClaimedComputeUnits)) + } + if x.NumEstimatedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) + } + if x.ClaimedAmountUpokt != nil { + l = options.Size(x.ClaimedAmountUpokt) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1453,8 +1761,27 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.NumComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + if x.ClaimedAmountUpokt != nil { + encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + if x.NumEstimatedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if x.NumClaimedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } @@ -1633,9 +1960,47 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods } case 4: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) + } + x.NumClaimedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumClaimedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + x.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - x.NumComputeUnits = 0 + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1645,11 +2010,28 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods } b := dAtA[iNdEx] iNdEx++ - x.NumComputeUnits |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1686,11 +2068,13 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods } var ( - md_EventProofUpdated protoreflect.MessageDescriptor - fd_EventProofUpdated_claim protoreflect.FieldDescriptor - fd_EventProofUpdated_proof protoreflect.FieldDescriptor - fd_EventProofUpdated_num_relays protoreflect.FieldDescriptor - fd_EventProofUpdated_num_compute_units protoreflect.FieldDescriptor + md_EventProofUpdated protoreflect.MessageDescriptor + fd_EventProofUpdated_claim protoreflect.FieldDescriptor + fd_EventProofUpdated_proof protoreflect.FieldDescriptor + fd_EventProofUpdated_num_relays protoreflect.FieldDescriptor + fd_EventProofUpdated_num_claimed_compute_units protoreflect.FieldDescriptor + fd_EventProofUpdated_num_estimated_compute_units protoreflect.FieldDescriptor + fd_EventProofUpdated_claimed_amount_upokt protoreflect.FieldDescriptor ) func init() { @@ -1699,7 +2083,9 @@ func init() { fd_EventProofUpdated_claim = md_EventProofUpdated.Fields().ByName("claim") fd_EventProofUpdated_proof = md_EventProofUpdated.Fields().ByName("proof") fd_EventProofUpdated_num_relays = md_EventProofUpdated.Fields().ByName("num_relays") - fd_EventProofUpdated_num_compute_units = md_EventProofUpdated.Fields().ByName("num_compute_units") + fd_EventProofUpdated_num_claimed_compute_units = md_EventProofUpdated.Fields().ByName("num_claimed_compute_units") + fd_EventProofUpdated_num_estimated_compute_units = md_EventProofUpdated.Fields().ByName("num_estimated_compute_units") + fd_EventProofUpdated_claimed_amount_upokt = md_EventProofUpdated.Fields().ByName("claimed_amount_upokt") } var _ protoreflect.Message = (*fastReflection_EventProofUpdated)(nil) @@ -1785,9 +2171,21 @@ func (x *fastReflection_EventProofUpdated) Range(f func(protoreflect.FieldDescri return } } - if x.NumComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.NumComputeUnits) - if !f(fd_EventProofUpdated_num_compute_units, value) { + if x.NumClaimedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumClaimedComputeUnits) + if !f(fd_EventProofUpdated_num_claimed_compute_units, value) { + return + } + } + if x.NumEstimatedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumEstimatedComputeUnits) + if !f(fd_EventProofUpdated_num_estimated_compute_units, value) { + return + } + } + if x.ClaimedAmountUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + if !f(fd_EventProofUpdated_claimed_amount_upokt, value) { return } } @@ -1812,8 +2210,12 @@ func (x *fastReflection_EventProofUpdated) Has(fd protoreflect.FieldDescriptor) return x.Proof != nil case "poktroll.proof.EventProofUpdated.num_relays": return x.NumRelays != uint64(0) - case "poktroll.proof.EventProofUpdated.num_compute_units": - return x.NumComputeUnits != uint64(0) + case "poktroll.proof.EventProofUpdated.num_claimed_compute_units": + return x.NumClaimedComputeUnits != uint64(0) + case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": + return x.NumEstimatedComputeUnits != uint64(0) + case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": + return x.ClaimedAmountUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -1836,8 +2238,12 @@ func (x *fastReflection_EventProofUpdated) Clear(fd protoreflect.FieldDescriptor x.Proof = nil case "poktroll.proof.EventProofUpdated.num_relays": x.NumRelays = uint64(0) - case "poktroll.proof.EventProofUpdated.num_compute_units": - x.NumComputeUnits = uint64(0) + case "poktroll.proof.EventProofUpdated.num_claimed_compute_units": + x.NumClaimedComputeUnits = uint64(0) + case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": + x.NumEstimatedComputeUnits = uint64(0) + case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": + x.ClaimedAmountUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -1863,9 +2269,15 @@ func (x *fastReflection_EventProofUpdated) Get(descriptor protoreflect.FieldDesc case "poktroll.proof.EventProofUpdated.num_relays": value := x.NumRelays return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventProofUpdated.num_compute_units": - value := x.NumComputeUnits + case "poktroll.proof.EventProofUpdated.num_claimed_compute_units": + value := x.NumClaimedComputeUnits + return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": + value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) + case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": + value := x.ClaimedAmountUpokt + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -1892,8 +2304,12 @@ func (x *fastReflection_EventProofUpdated) Set(fd protoreflect.FieldDescriptor, x.Proof = value.Message().Interface().(*Proof) case "poktroll.proof.EventProofUpdated.num_relays": x.NumRelays = value.Uint() - case "poktroll.proof.EventProofUpdated.num_compute_units": - x.NumComputeUnits = value.Uint() + case "poktroll.proof.EventProofUpdated.num_claimed_compute_units": + x.NumClaimedComputeUnits = value.Uint() + case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": + x.NumEstimatedComputeUnits = value.Uint() + case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": + x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -1924,10 +2340,17 @@ func (x *fastReflection_EventProofUpdated) Mutable(fd protoreflect.FieldDescript x.Proof = new(Proof) } return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) case "poktroll.proof.EventProofUpdated.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventProofUpdated is not mutable")) - case "poktroll.proof.EventProofUpdated.num_compute_units": - panic(fmt.Errorf("field num_compute_units of message poktroll.proof.EventProofUpdated is not mutable")) + case "poktroll.proof.EventProofUpdated.num_claimed_compute_units": + panic(fmt.Errorf("field num_claimed_compute_units of message poktroll.proof.EventProofUpdated is not mutable")) + case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": + panic(fmt.Errorf("field num_estimated_compute_units of message poktroll.proof.EventProofUpdated is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -1949,8 +2372,13 @@ func (x *fastReflection_EventProofUpdated) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfMessage(m.ProtoReflect()) case "poktroll.proof.EventProofUpdated.num_relays": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventProofUpdated.num_compute_units": + case "poktroll.proof.EventProofUpdated.num_claimed_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -2031,8 +2459,15 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { if x.NumRelays != 0 { n += 1 + runtime.Sov(uint64(x.NumRelays)) } - if x.NumComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + if x.NumClaimedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumClaimedComputeUnits)) + } + if x.NumEstimatedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) + } + if x.ClaimedAmountUpokt != nil { + l = options.Size(x.ClaimedAmountUpokt) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -2063,8 +2498,27 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.NumComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + if x.ClaimedAmountUpokt != nil { + encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + if x.NumEstimatedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if x.NumClaimedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } @@ -2243,9 +2697,9 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { } case 4: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) } - x.NumComputeUnits = 0 + x.NumClaimedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2255,11 +2709,66 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.NumComputeUnits |= uint64(b&0x7F) << shift + x.NumClaimedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + x.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -2313,9 +2822,11 @@ type EventClaimCreated struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` - NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` + ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` } func (x *EventClaimCreated) Reset() { @@ -2352,22 +2863,38 @@ func (x *EventClaimCreated) GetNumRelays() uint64 { return 0 } -func (x *EventClaimCreated) GetNumComputeUnits() uint64 { +func (x *EventClaimCreated) GetNumClaimedComputeUnits() uint64 { + if x != nil { + return x.NumClaimedComputeUnits + } + return 0 +} + +func (x *EventClaimCreated) GetNumEstimatedComputeUnits() uint64 { if x != nil { - return x.NumComputeUnits + return x.NumEstimatedComputeUnits } return 0 } +func (x *EventClaimCreated) GetClaimedAmountUpokt() *v1beta1.Coin { + if x != nil { + return x.ClaimedAmountUpokt + } + return nil +} + // TODO_TEST: Add coverage for claim updates. type EventClaimUpdated struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` - NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` + ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` } func (x *EventClaimUpdated) Reset() { @@ -2404,22 +2931,38 @@ func (x *EventClaimUpdated) GetNumRelays() uint64 { return 0 } -func (x *EventClaimUpdated) GetNumComputeUnits() uint64 { +func (x *EventClaimUpdated) GetNumClaimedComputeUnits() uint64 { + if x != nil { + return x.NumClaimedComputeUnits + } + return 0 +} + +func (x *EventClaimUpdated) GetNumEstimatedComputeUnits() uint64 { if x != nil { - return x.NumComputeUnits + return x.NumEstimatedComputeUnits } return 0 } +func (x *EventClaimUpdated) GetClaimedAmountUpokt() *v1beta1.Coin { + if x != nil { + return x.ClaimedAmountUpokt + } + return nil +} + type EventProofSubmitted struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` - NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` + ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` } func (x *EventProofSubmitted) Reset() { @@ -2463,23 +3006,39 @@ func (x *EventProofSubmitted) GetNumRelays() uint64 { return 0 } -func (x *EventProofSubmitted) GetNumComputeUnits() uint64 { +func (x *EventProofSubmitted) GetNumClaimedComputeUnits() uint64 { + if x != nil { + return x.NumClaimedComputeUnits + } + return 0 +} + +func (x *EventProofSubmitted) GetNumEstimatedComputeUnits() uint64 { if x != nil { - return x.NumComputeUnits + return x.NumEstimatedComputeUnits } return 0 } +func (x *EventProofSubmitted) GetClaimedAmountUpokt() *v1beta1.Coin { + if x != nil { + return x.ClaimedAmountUpokt + } + return nil +} + // TODO_TEST: Add coverage for proof updates. type EventProofUpdated struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` - Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` - NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` + ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` } func (x *EventProofUpdated) Reset() { @@ -2523,88 +3082,160 @@ func (x *EventProofUpdated) GetNumRelays() uint64 { return 0 } -func (x *EventProofUpdated) GetNumComputeUnits() uint64 { +func (x *EventProofUpdated) GetNumClaimedComputeUnits() uint64 { if x != nil { - return x.NumComputeUnits + return x.NumClaimedComputeUnits } return 0 } +func (x *EventProofUpdated) GetNumEstimatedComputeUnits() uint64 { + if x != nil { + return x.NumEstimatedComputeUnits + } + return 0 +} + +func (x *EventProofUpdated) GetClaimedAmountUpokt() *v1beta1.Coin { + if x != nil { + return x.ClaimedAmountUpokt + } + return nil +} + var File_poktroll_proof_event_proto protoreflect.FileDescriptor var file_poktroll_proof_event_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x14, 0x67, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x1e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, - 0x01, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, - 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, - 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, - 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, - 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, - 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, - 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, - 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0xbd, - 0x01, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x55, 0x70, 0x64, + 0x6f, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, + 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, - 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, - 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, - 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, - 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0xf7, - 0x01, 0x0a, 0x13, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x75, 0x62, - 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, - 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x36, - 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, - 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, - 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, - 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, - 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, - 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, - 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, - 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0xf5, 0x01, 0x0a, 0x11, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, - 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, - 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, - 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2d, - 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, - 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, - 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, - 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, - 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, - 0x42, 0x9e, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, - 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, - 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, - 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, + 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, + 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, + 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, + 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, + 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, + 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, + 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, + 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, + 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, + 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, + 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, + 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0x9b, 0x03, 0x0a, + 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, + 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, + 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, + 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, + 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, + 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, + 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, + 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, + 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, + 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, + 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, + 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, + 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0xd5, 0x03, 0x0a, 0x13, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, + 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, + 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, + 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, + 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, + 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, + 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, + 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, + 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, + 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, + 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, + 0x6b, 0x74, 0x22, 0xd3, 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, + 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, + 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, + 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, + 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, + 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, + 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, + 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, + 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, + 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, + 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, + 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, + 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, + 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, + 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, + 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x42, 0x9e, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, + 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -2626,20 +3257,25 @@ var file_poktroll_proof_event_proto_goTypes = []interface{}{ (*EventProofSubmitted)(nil), // 2: poktroll.proof.EventProofSubmitted (*EventProofUpdated)(nil), // 3: poktroll.proof.EventProofUpdated (*Claim)(nil), // 4: poktroll.proof.Claim - (*Proof)(nil), // 5: poktroll.proof.Proof + (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin + (*Proof)(nil), // 6: poktroll.proof.Proof } var file_poktroll_proof_event_proto_depIdxs = []int32{ - 4, // 0: poktroll.proof.EventClaimCreated.claim:type_name -> poktroll.proof.Claim - 4, // 1: poktroll.proof.EventClaimUpdated.claim:type_name -> poktroll.proof.Claim - 4, // 2: poktroll.proof.EventProofSubmitted.claim:type_name -> poktroll.proof.Claim - 5, // 3: poktroll.proof.EventProofSubmitted.proof:type_name -> poktroll.proof.Proof - 4, // 4: poktroll.proof.EventProofUpdated.claim:type_name -> poktroll.proof.Claim - 5, // 5: poktroll.proof.EventProofUpdated.proof:type_name -> poktroll.proof.Proof - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 4, // 0: poktroll.proof.EventClaimCreated.claim:type_name -> poktroll.proof.Claim + 5, // 1: poktroll.proof.EventClaimCreated.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 4, // 2: poktroll.proof.EventClaimUpdated.claim:type_name -> poktroll.proof.Claim + 5, // 3: poktroll.proof.EventClaimUpdated.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 4, // 4: poktroll.proof.EventProofSubmitted.claim:type_name -> poktroll.proof.Claim + 6, // 5: poktroll.proof.EventProofSubmitted.proof:type_name -> poktroll.proof.Proof + 5, // 6: poktroll.proof.EventProofSubmitted.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 4, // 7: poktroll.proof.EventProofUpdated.claim:type_name -> poktroll.proof.Claim + 6, // 8: poktroll.proof.EventProofUpdated.proof:type_name -> poktroll.proof.Proof + 5, // 9: poktroll.proof.EventProofUpdated.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_poktroll_proof_event_proto_init() } diff --git a/api/poktroll/proof/params.pulsar.go b/api/poktroll/proof/params.pulsar.go index f5d9f9c75..36039d344 100644 --- a/api/poktroll/proof/params.pulsar.go +++ b/api/poktroll/proof/params.pulsar.go @@ -18,18 +18,16 @@ import ( ) var ( - md_Params protoreflect.MessageDescriptor - fd_Params_relay_difficulty_target_hash protoreflect.FieldDescriptor - fd_Params_proof_request_probability protoreflect.FieldDescriptor - fd_Params_proof_requirement_threshold protoreflect.FieldDescriptor - fd_Params_proof_missing_penalty protoreflect.FieldDescriptor - fd_Params_proof_submission_fee protoreflect.FieldDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_proof_request_probability protoreflect.FieldDescriptor + fd_Params_proof_requirement_threshold protoreflect.FieldDescriptor + fd_Params_proof_missing_penalty protoreflect.FieldDescriptor + fd_Params_proof_submission_fee protoreflect.FieldDescriptor ) func init() { file_poktroll_proof_params_proto_init() md_Params = File_poktroll_proof_params_proto.Messages().ByName("Params") - fd_Params_relay_difficulty_target_hash = md_Params.Fields().ByName("relay_difficulty_target_hash") fd_Params_proof_request_probability = md_Params.Fields().ByName("proof_request_probability") fd_Params_proof_requirement_threshold = md_Params.Fields().ByName("proof_requirement_threshold") fd_Params_proof_missing_penalty = md_Params.Fields().ByName("proof_missing_penalty") @@ -101,12 +99,6 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.RelayDifficultyTargetHash) != 0 { - value := protoreflect.ValueOfBytes(x.RelayDifficultyTargetHash) - if !f(fd_Params_relay_difficulty_target_hash, value) { - return - } - } if x.ProofRequestProbability != float32(0) || math.Signbit(float64(x.ProofRequestProbability)) { value := protoreflect.ValueOfFloat32(x.ProofRequestProbability) if !f(fd_Params_proof_request_probability, value) { @@ -146,8 +138,6 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.proof.Params.relay_difficulty_target_hash": - return len(x.RelayDifficultyTargetHash) != 0 case "poktroll.proof.Params.proof_request_probability": return x.ProofRequestProbability != float32(0) || math.Signbit(float64(x.ProofRequestProbability)) case "poktroll.proof.Params.proof_requirement_threshold": @@ -172,8 +162,6 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.proof.Params.relay_difficulty_target_hash": - x.RelayDifficultyTargetHash = nil case "poktroll.proof.Params.proof_request_probability": x.ProofRequestProbability = float32(0) case "poktroll.proof.Params.proof_requirement_threshold": @@ -198,9 +186,6 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.proof.Params.relay_difficulty_target_hash": - value := x.RelayDifficultyTargetHash - return protoreflect.ValueOfBytes(value) case "poktroll.proof.Params.proof_request_probability": value := x.ProofRequestProbability return protoreflect.ValueOfFloat32(value) @@ -233,8 +218,6 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.proof.Params.relay_difficulty_target_hash": - x.RelayDifficultyTargetHash = value.Bytes() case "poktroll.proof.Params.proof_request_probability": x.ProofRequestProbability = float32(value.Float()) case "poktroll.proof.Params.proof_requirement_threshold": @@ -278,8 +261,6 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore x.ProofSubmissionFee = new(v1beta1.Coin) } return protoreflect.ValueOfMessage(x.ProofSubmissionFee.ProtoReflect()) - case "poktroll.proof.Params.relay_difficulty_target_hash": - panic(fmt.Errorf("field relay_difficulty_target_hash of message poktroll.proof.Params is not mutable")) case "poktroll.proof.Params.proof_request_probability": panic(fmt.Errorf("field proof_request_probability of message poktroll.proof.Params is not mutable")) default: @@ -295,8 +276,6 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.proof.Params.relay_difficulty_target_hash": - return protoreflect.ValueOfBytes(nil) case "poktroll.proof.Params.proof_request_probability": return protoreflect.ValueOfFloat32(float32(0)) case "poktroll.proof.Params.proof_requirement_threshold": @@ -377,10 +356,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.RelayDifficultyTargetHash) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } if x.ProofRequestProbability != 0 || math.Signbit(float64(x.ProofRequestProbability)) { n += 5 } @@ -473,13 +448,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x15 } - if len(x.RelayDifficultyTargetHash) > 0 { - i -= len(x.RelayDifficultyTargetHash) - copy(dAtA[i:], x.RelayDifficultyTargetHash) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RelayDifficultyTargetHash))) - i-- - dAtA[i] = 0xa - } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -529,40 +497,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayDifficultyTargetHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.RelayDifficultyTargetHash = append(x.RelayDifficultyTargetHash[:0], dAtA[iNdEx:postIndex]...) - if x.RelayDifficultyTargetHash == nil { - x.RelayDifficultyTargetHash = []byte{} - } - iNdEx = postIndex case 2: if wireType != 5 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequestProbability", wireType) @@ -736,9 +670,6 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // TODO_FOLLOWUP(@olshansk, #690): Either delete this or change it to be named "minimum" - // relay_difficulty_target_hash is the maximum value a relay hash must be less than to be volume/reward applicable. - RelayDifficultyTargetHash []byte `protobuf:"bytes,1,opt,name=relay_difficulty_target_hash,json=relayDifficultyTargetHash,proto3" json:"relay_difficulty_target_hash,omitempty"` // proof_request_probability is the probability of a session requiring a proof // if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. ProofRequestProbability float32 `protobuf:"fixed32,2,opt,name=proof_request_probability,json=proofRequestProbability,proto3" json:"proof_request_probability,omitempty"` @@ -782,13 +713,6 @@ func (*Params) Descriptor() ([]byte, []int) { return file_poktroll_proof_params_proto_rawDescGZIP(), []int{0} } -func (x *Params) GetRelayDifficultyTargetHash() []byte { - if x != nil { - return x.RelayDifficultyTargetHash - } - return nil -} - func (x *Params) GetProofRequestProbability() float32 { if x != nil { return x.ProofRequestProbability @@ -827,53 +751,47 @@ var file_poktroll_proof_params_proto_rawDesc = []byte{ 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb5, 0x04, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x61, 0x0a, 0x1c, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, - 0x63, 0x75, 0x6c, 0x74, 0x79, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x20, 0xea, 0xde, 0x1f, 0x1c, 0x72, 0x65, 0x6c, - 0x61, 0x79, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x5f, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x19, 0x72, 0x65, 0x6c, 0x61, 0x79, - 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x48, 0x61, 0x73, 0x68, 0x12, 0x59, 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x62, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x17, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, - 0x7a, 0x0a, 0x1b, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, - 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, - 0x52, 0x19, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x68, 0x0a, 0x15, 0x70, - 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x6e, - 0x61, 0x6c, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x19, 0xea, 0xde, 0x1f, 0x15, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, - 0x52, 0x13, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x50, 0x65, - 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x14, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, - 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, - 0xea, 0xde, 0x1f, 0x14, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x53, - 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x3a, 0x20, 0xe8, 0xa0, - 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x9f, - 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, - 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, - 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x59, 0x0a, 0x19, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x02, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x52, 0x17, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x50, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x7a, 0x0a, 0x1b, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x1f, 0xea, 0xde, + 0x1f, 0x1b, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x52, 0x19, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, + 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x68, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x6e, 0x61, 0x6c, 0x74, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x19, 0xea, 0xde, 0x1f, 0x15, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x52, 0x13, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x6e, 0x61, 0x6c, + 0x74, 0x79, 0x12, 0x65, 0x0a, 0x14, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, 0x75, 0x62, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, + 0x14, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x75, 0x62, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, + 0xe7, 0xb0, 0x2a, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x9f, 0x01, 0xd8, 0xe2, + 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, + 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/poktroll/service/event.pulsar.go b/api/poktroll/service/event.pulsar.go new file mode 100644 index 000000000..20d2d484e --- /dev/null +++ b/api/poktroll/service/event.pulsar.go @@ -0,0 +1,842 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_EventRelayMiningDifficultyUpdated protoreflect.MessageDescriptor + fd_EventRelayMiningDifficultyUpdated_service_id protoreflect.FieldDescriptor + fd_EventRelayMiningDifficultyUpdated_prev_target_hash_hex_encoded protoreflect.FieldDescriptor + fd_EventRelayMiningDifficultyUpdated_new_target_hash_hex_encoded protoreflect.FieldDescriptor + fd_EventRelayMiningDifficultyUpdated_prev_num_relays_ema protoreflect.FieldDescriptor + fd_EventRelayMiningDifficultyUpdated_new_num_relays_ema protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_event_proto_init() + md_EventRelayMiningDifficultyUpdated = File_poktroll_service_event_proto.Messages().ByName("EventRelayMiningDifficultyUpdated") + fd_EventRelayMiningDifficultyUpdated_service_id = md_EventRelayMiningDifficultyUpdated.Fields().ByName("service_id") + fd_EventRelayMiningDifficultyUpdated_prev_target_hash_hex_encoded = md_EventRelayMiningDifficultyUpdated.Fields().ByName("prev_target_hash_hex_encoded") + fd_EventRelayMiningDifficultyUpdated_new_target_hash_hex_encoded = md_EventRelayMiningDifficultyUpdated.Fields().ByName("new_target_hash_hex_encoded") + fd_EventRelayMiningDifficultyUpdated_prev_num_relays_ema = md_EventRelayMiningDifficultyUpdated.Fields().ByName("prev_num_relays_ema") + fd_EventRelayMiningDifficultyUpdated_new_num_relays_ema = md_EventRelayMiningDifficultyUpdated.Fields().ByName("new_num_relays_ema") +} + +var _ protoreflect.Message = (*fastReflection_EventRelayMiningDifficultyUpdated)(nil) + +type fastReflection_EventRelayMiningDifficultyUpdated EventRelayMiningDifficultyUpdated + +func (x *EventRelayMiningDifficultyUpdated) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventRelayMiningDifficultyUpdated)(x) +} + +func (x *EventRelayMiningDifficultyUpdated) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_event_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventRelayMiningDifficultyUpdated_messageType fastReflection_EventRelayMiningDifficultyUpdated_messageType +var _ protoreflect.MessageType = fastReflection_EventRelayMiningDifficultyUpdated_messageType{} + +type fastReflection_EventRelayMiningDifficultyUpdated_messageType struct{} + +func (x fastReflection_EventRelayMiningDifficultyUpdated_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventRelayMiningDifficultyUpdated)(nil) +} +func (x fastReflection_EventRelayMiningDifficultyUpdated_messageType) New() protoreflect.Message { + return new(fastReflection_EventRelayMiningDifficultyUpdated) +} +func (x fastReflection_EventRelayMiningDifficultyUpdated_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventRelayMiningDifficultyUpdated +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Descriptor() protoreflect.MessageDescriptor { + return md_EventRelayMiningDifficultyUpdated +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Type() protoreflect.MessageType { + return _fastReflection_EventRelayMiningDifficultyUpdated_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) New() protoreflect.Message { + return new(fastReflection_EventRelayMiningDifficultyUpdated) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Interface() protoreflect.ProtoMessage { + return (*EventRelayMiningDifficultyUpdated)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ServiceId != "" { + value := protoreflect.ValueOfString(x.ServiceId) + if !f(fd_EventRelayMiningDifficultyUpdated_service_id, value) { + return + } + } + if x.PrevTargetHashHexEncoded != "" { + value := protoreflect.ValueOfString(x.PrevTargetHashHexEncoded) + if !f(fd_EventRelayMiningDifficultyUpdated_prev_target_hash_hex_encoded, value) { + return + } + } + if x.NewTargetHashHexEncoded != "" { + value := protoreflect.ValueOfString(x.NewTargetHashHexEncoded) + if !f(fd_EventRelayMiningDifficultyUpdated_new_target_hash_hex_encoded, value) { + return + } + } + if x.PrevNumRelaysEma != uint64(0) { + value := protoreflect.ValueOfUint64(x.PrevNumRelaysEma) + if !f(fd_EventRelayMiningDifficultyUpdated_prev_num_relays_ema, value) { + return + } + } + if x.NewNumRelaysEma != uint64(0) { + value := protoreflect.ValueOfUint64(x.NewNumRelaysEma) + if !f(fd_EventRelayMiningDifficultyUpdated_new_num_relays_ema, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.EventRelayMiningDifficultyUpdated.service_id": + return x.ServiceId != "" + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": + return x.PrevTargetHashHexEncoded != "" + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": + return x.NewTargetHashHexEncoded != "" + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": + return x.PrevNumRelaysEma != uint64(0) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_num_relays_ema": + return x.NewNumRelaysEma != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.EventRelayMiningDifficultyUpdated")) + } + panic(fmt.Errorf("message poktroll.service.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.EventRelayMiningDifficultyUpdated.service_id": + x.ServiceId = "" + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": + x.PrevTargetHashHexEncoded = "" + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": + x.NewTargetHashHexEncoded = "" + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": + x.PrevNumRelaysEma = uint64(0) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_num_relays_ema": + x.NewNumRelaysEma = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.EventRelayMiningDifficultyUpdated")) + } + panic(fmt.Errorf("message poktroll.service.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.EventRelayMiningDifficultyUpdated.service_id": + value := x.ServiceId + return protoreflect.ValueOfString(value) + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": + value := x.PrevTargetHashHexEncoded + return protoreflect.ValueOfString(value) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": + value := x.NewTargetHashHexEncoded + return protoreflect.ValueOfString(value) + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": + value := x.PrevNumRelaysEma + return protoreflect.ValueOfUint64(value) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_num_relays_ema": + value := x.NewNumRelaysEma + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.EventRelayMiningDifficultyUpdated")) + } + panic(fmt.Errorf("message poktroll.service.EventRelayMiningDifficultyUpdated does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.EventRelayMiningDifficultyUpdated.service_id": + x.ServiceId = value.Interface().(string) + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": + x.PrevTargetHashHexEncoded = value.Interface().(string) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": + x.NewTargetHashHexEncoded = value.Interface().(string) + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": + x.PrevNumRelaysEma = value.Uint() + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_num_relays_ema": + x.NewNumRelaysEma = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.EventRelayMiningDifficultyUpdated")) + } + panic(fmt.Errorf("message poktroll.service.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.EventRelayMiningDifficultyUpdated.service_id": + panic(fmt.Errorf("field service_id of message poktroll.service.EventRelayMiningDifficultyUpdated is not mutable")) + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": + panic(fmt.Errorf("field prev_target_hash_hex_encoded of message poktroll.service.EventRelayMiningDifficultyUpdated is not mutable")) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": + panic(fmt.Errorf("field new_target_hash_hex_encoded of message poktroll.service.EventRelayMiningDifficultyUpdated is not mutable")) + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": + panic(fmt.Errorf("field prev_num_relays_ema of message poktroll.service.EventRelayMiningDifficultyUpdated is not mutable")) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_num_relays_ema": + panic(fmt.Errorf("field new_num_relays_ema of message poktroll.service.EventRelayMiningDifficultyUpdated is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.EventRelayMiningDifficultyUpdated")) + } + panic(fmt.Errorf("message poktroll.service.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.EventRelayMiningDifficultyUpdated.service_id": + return protoreflect.ValueOfString("") + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": + return protoreflect.ValueOfString("") + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": + return protoreflect.ValueOfString("") + case "poktroll.service.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.service.EventRelayMiningDifficultyUpdated.new_num_relays_ema": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.EventRelayMiningDifficultyUpdated")) + } + panic(fmt.Errorf("message poktroll.service.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.EventRelayMiningDifficultyUpdated", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventRelayMiningDifficultyUpdated) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.ServiceId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.PrevTargetHashHexEncoded) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.NewTargetHashHexEncoded) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.PrevNumRelaysEma != 0 { + n += 1 + runtime.Sov(uint64(x.PrevNumRelaysEma)) + } + if x.NewNumRelaysEma != 0 { + n += 1 + runtime.Sov(uint64(x.NewNumRelaysEma)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventRelayMiningDifficultyUpdated) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.NewNumRelaysEma != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NewNumRelaysEma)) + i-- + dAtA[i] = 0x28 + } + if x.PrevNumRelaysEma != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.PrevNumRelaysEma)) + i-- + dAtA[i] = 0x20 + } + if len(x.NewTargetHashHexEncoded) > 0 { + i -= len(x.NewTargetHashHexEncoded) + copy(dAtA[i:], x.NewTargetHashHexEncoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.NewTargetHashHexEncoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.PrevTargetHashHexEncoded) > 0 { + i -= len(x.PrevTargetHashHexEncoded) + copy(dAtA[i:], x.PrevTargetHashHexEncoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PrevTargetHashHexEncoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.ServiceId) > 0 { + i -= len(x.ServiceId) + copy(dAtA[i:], x.ServiceId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventRelayMiningDifficultyUpdated) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PrevTargetHashHexEncoded", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.PrevTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NewTargetHashHexEncoded", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.NewTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PrevNumRelaysEma", wireType) + } + x.PrevNumRelaysEma = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.PrevNumRelaysEma |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NewNumRelaysEma", wireType) + } + x.NewNumRelaysEma = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NewNumRelaysEma |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/event.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated +// for a given service. +type EventRelayMiningDifficultyUpdated struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + PrevTargetHashHexEncoded string `protobuf:"bytes,2,opt,name=prev_target_hash_hex_encoded,json=prevTargetHashHexEncoded,proto3" json:"prev_target_hash_hex_encoded,omitempty"` + NewTargetHashHexEncoded string `protobuf:"bytes,3,opt,name=new_target_hash_hex_encoded,json=newTargetHashHexEncoded,proto3" json:"new_target_hash_hex_encoded,omitempty"` + PrevNumRelaysEma uint64 `protobuf:"varint,4,opt,name=prev_num_relays_ema,json=prevNumRelaysEma,proto3" json:"prev_num_relays_ema,omitempty"` + NewNumRelaysEma uint64 `protobuf:"varint,5,opt,name=new_num_relays_ema,json=newNumRelaysEma,proto3" json:"new_num_relays_ema,omitempty"` +} + +func (x *EventRelayMiningDifficultyUpdated) Reset() { + *x = EventRelayMiningDifficultyUpdated{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventRelayMiningDifficultyUpdated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventRelayMiningDifficultyUpdated) ProtoMessage() {} + +// Deprecated: Use EventRelayMiningDifficultyUpdated.ProtoReflect.Descriptor instead. +func (*EventRelayMiningDifficultyUpdated) Descriptor() ([]byte, []int) { + return file_poktroll_service_event_proto_rawDescGZIP(), []int{0} +} + +func (x *EventRelayMiningDifficultyUpdated) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *EventRelayMiningDifficultyUpdated) GetPrevTargetHashHexEncoded() string { + if x != nil { + return x.PrevTargetHashHexEncoded + } + return "" +} + +func (x *EventRelayMiningDifficultyUpdated) GetNewTargetHashHexEncoded() string { + if x != nil { + return x.NewTargetHashHexEncoded + } + return "" +} + +func (x *EventRelayMiningDifficultyUpdated) GetPrevNumRelaysEma() uint64 { + if x != nil { + return x.PrevNumRelaysEma + } + return 0 +} + +func (x *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { + if x != nil { + return x.NewNumRelaysEma + } + return 0 +} + +var File_poktroll_service_event_proto protoreflect.FileDescriptor + +var file_poktroll_service_event_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9c, 0x02, 0x0a, 0x21, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, + 0x63, 0x75, 0x6c, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3e, 0x0a, 0x1c, 0x70, + 0x72, 0x65, 0x76, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, + 0x68, 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x18, 0x70, 0x72, 0x65, 0x76, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, + 0x68, 0x48, 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x1b, 0x6e, + 0x65, 0x77, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, + 0x65, 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x17, 0x6e, 0x65, 0x77, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, + 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x13, 0x70, 0x72, 0x65, + 0x76, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x72, 0x65, 0x76, 0x4e, 0x75, 0x6d, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x2b, 0x0a, 0x12, 0x6e, 0x65, 0x77, 0x5f, + 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6e, 0x65, 0x77, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x73, 0x45, 0x6d, 0x61, 0x42, 0xaa, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_event_proto_rawDescOnce sync.Once + file_poktroll_service_event_proto_rawDescData = file_poktroll_service_event_proto_rawDesc +) + +func file_poktroll_service_event_proto_rawDescGZIP() []byte { + file_poktroll_service_event_proto_rawDescOnce.Do(func() { + file_poktroll_service_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_event_proto_rawDescData) + }) + return file_poktroll_service_event_proto_rawDescData +} + +var file_poktroll_service_event_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_event_proto_goTypes = []interface{}{ + (*EventRelayMiningDifficultyUpdated)(nil), // 0: poktroll.service.EventRelayMiningDifficultyUpdated +} +var file_poktroll_service_event_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_event_proto_init() } +func file_poktroll_service_event_proto_init() { + if File_poktroll_service_event_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventRelayMiningDifficultyUpdated); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_event_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_event_proto_goTypes, + DependencyIndexes: file_poktroll_service_event_proto_depIdxs, + MessageInfos: file_poktroll_service_event_proto_msgTypes, + }.Build() + File_poktroll_service_event_proto = out.File + file_poktroll_service_event_proto_rawDesc = nil + file_poktroll_service_event_proto_goTypes = nil + file_poktroll_service_event_proto_depIdxs = nil +} diff --git a/api/poktroll/service/genesis.pulsar.go b/api/poktroll/service/genesis.pulsar.go index b88f2e05e..eb48548c7 100644 --- a/api/poktroll/service/genesis.pulsar.go +++ b/api/poktroll/service/genesis.pulsar.go @@ -66,10 +66,62 @@ func (x *_GenesisState_2_list) IsValid() bool { return x.list != nil } +var _ protoreflect.List = (*_GenesisState_3_list)(nil) + +type _GenesisState_3_list struct { + list *[]*RelayMiningDifficulty +} + +func (x *_GenesisState_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_3_list) AppendMutable() protoreflect.Value { + v := new(RelayMiningDifficulty) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_3_list) NewElement() protoreflect.Value { + v := new(RelayMiningDifficulty) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) IsValid() bool { + return x.list != nil +} + var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor - fd_GenesisState_service_list protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_service_list protoreflect.FieldDescriptor + fd_GenesisState_relayMiningDifficultyList protoreflect.FieldDescriptor ) func init() { @@ -77,6 +129,7 @@ func init() { md_GenesisState = File_poktroll_service_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") fd_GenesisState_service_list = md_GenesisState.Fields().ByName("service_list") + fd_GenesisState_relayMiningDifficultyList = md_GenesisState.Fields().ByName("relayMiningDifficultyList") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -156,6 +209,12 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, return } } + if len(x.RelayMiningDifficultyList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_3_list{list: &x.RelayMiningDifficultyList}) + if !f(fd_GenesisState_relayMiningDifficultyList, value) { + return + } + } } // Has reports whether a field is populated. @@ -175,6 +234,8 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool return x.Params != nil case "poktroll.service.GenesisState.service_list": return len(x.ServiceList) != 0 + case "poktroll.service.GenesisState.relayMiningDifficultyList": + return len(x.RelayMiningDifficultyList) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) @@ -195,6 +256,8 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { x.Params = nil case "poktroll.service.GenesisState.service_list": x.ServiceList = nil + case "poktroll.service.GenesisState.relayMiningDifficultyList": + x.RelayMiningDifficultyList = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) @@ -220,6 +283,12 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto } listValue := &_GenesisState_2_list{list: &x.ServiceList} return protoreflect.ValueOfList(listValue) + case "poktroll.service.GenesisState.relayMiningDifficultyList": + if len(x.RelayMiningDifficultyList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_3_list{}) + } + listValue := &_GenesisState_3_list{list: &x.RelayMiningDifficultyList} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) @@ -246,6 +315,10 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value lv := value.List() clv := lv.(*_GenesisState_2_list) x.ServiceList = *clv.list + case "poktroll.service.GenesisState.relayMiningDifficultyList": + lv := value.List() + clv := lv.(*_GenesisState_3_list) + x.RelayMiningDifficultyList = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) @@ -277,6 +350,12 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p } value := &_GenesisState_2_list{list: &x.ServiceList} return protoreflect.ValueOfList(value) + case "poktroll.service.GenesisState.relayMiningDifficultyList": + if x.RelayMiningDifficultyList == nil { + x.RelayMiningDifficultyList = []*RelayMiningDifficulty{} + } + value := &_GenesisState_3_list{list: &x.RelayMiningDifficultyList} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) @@ -296,6 +375,9 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "poktroll.service.GenesisState.service_list": list := []*shared.Service{} return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + case "poktroll.service.GenesisState.relayMiningDifficultyList": + list := []*RelayMiningDifficulty{} + return protoreflect.ValueOfList(&_GenesisState_3_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) @@ -375,6 +457,12 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } } + if len(x.RelayMiningDifficultyList) > 0 { + for _, e := range x.RelayMiningDifficultyList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -404,6 +492,22 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.RelayMiningDifficultyList) > 0 { + for iNdEx := len(x.RelayMiningDifficultyList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.RelayMiningDifficultyList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } if len(x.ServiceList) > 0 { for iNdEx := len(x.ServiceList) - 1; iNdEx >= 0; iNdEx-- { encoded, err := options.Marshal(x.ServiceList[iNdEx]) @@ -553,6 +657,40 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficultyList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.RelayMiningDifficultyList = append(x.RelayMiningDifficultyList, &RelayMiningDifficulty{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficultyList[len(x.RelayMiningDifficultyList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -608,8 +746,9 @@ type GenesisState struct { unknownFields protoimpl.UnknownFields // params defines all the parameters of the module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - ServiceList []*shared.Service `protobuf:"bytes,2,rep,name=service_list,json=serviceList,proto3" json:"service_list,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + ServiceList []*shared.Service `protobuf:"bytes,2,rep,name=service_list,json=serviceList,proto3" json:"service_list,omitempty"` + RelayMiningDifficultyList []*RelayMiningDifficulty `protobuf:"bytes,3,rep,name=relayMiningDifficultyList,proto3" json:"relayMiningDifficultyList,omitempty"` } func (x *GenesisState) Reset() { @@ -646,6 +785,13 @@ func (x *GenesisState) GetServiceList() []*shared.Service { return nil } +func (x *GenesisState) GetRelayMiningDifficultyList() []*RelayMiningDifficulty { + if x != nil { + return x.RelayMiningDifficultyList + } + return nil +} + var File_poktroll_service_genesis_proto protoreflect.FileDescriptor var file_poktroll_service_genesis_proto_rawDesc = []byte{ @@ -658,7 +804,10 @@ var file_poktroll_service_genesis_proto_rawDesc = []byte{ 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x0c, 0x47, 0x65, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, @@ -667,19 +816,25 @@ var file_poktroll_service_genesis_proto_rawDesc = []byte{ 0x63, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xac, 0x01, 0xd8, 0xe2, 0x1e, - 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, - 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x6b, 0x0a, 0x19, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, + 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x19, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xac, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -696,18 +851,20 @@ func file_poktroll_service_genesis_proto_rawDescGZIP() []byte { var file_poktroll_service_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_service_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: poktroll.service.GenesisState - (*Params)(nil), // 1: poktroll.service.Params - (*shared.Service)(nil), // 2: poktroll.shared.Service + (*GenesisState)(nil), // 0: poktroll.service.GenesisState + (*Params)(nil), // 1: poktroll.service.Params + (*shared.Service)(nil), // 2: poktroll.shared.Service + (*RelayMiningDifficulty)(nil), // 3: poktroll.service.RelayMiningDifficulty } var file_poktroll_service_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.service.GenesisState.params:type_name -> poktroll.service.Params 2, // 1: poktroll.service.GenesisState.service_list:type_name -> poktroll.shared.Service - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 3, // 2: poktroll.service.GenesisState.relayMiningDifficultyList:type_name -> poktroll.service.RelayMiningDifficulty + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_poktroll_service_genesis_proto_init() } @@ -716,6 +873,7 @@ func file_poktroll_service_genesis_proto_init() { return } file_poktroll_service_params_proto_init() + file_poktroll_service_relay_mining_difficulty_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_service_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GenesisState); i { diff --git a/api/poktroll/service/query.pulsar.go b/api/poktroll/service/query.pulsar.go index 702edbeca..a066a4116 100644 --- a/api/poktroll/service/query.pulsar.go +++ b/api/poktroll/service/query.pulsar.go @@ -2671,6 +2671,1869 @@ func (x *fastReflection_QueryAllServicesResponse) ProtoMethods() *protoiface.Met } } +var ( + md_QueryGetRelayMiningDifficultyRequest protoreflect.MessageDescriptor + fd_QueryGetRelayMiningDifficultyRequest_serviceId protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryGetRelayMiningDifficultyRequest = File_poktroll_service_query_proto.Messages().ByName("QueryGetRelayMiningDifficultyRequest") + fd_QueryGetRelayMiningDifficultyRequest_serviceId = md_QueryGetRelayMiningDifficultyRequest.Fields().ByName("serviceId") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetRelayMiningDifficultyRequest)(nil) + +type fastReflection_QueryGetRelayMiningDifficultyRequest QueryGetRelayMiningDifficultyRequest + +func (x *QueryGetRelayMiningDifficultyRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyRequest)(x) +} + +func (x *QueryGetRelayMiningDifficultyRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetRelayMiningDifficultyRequest_messageType fastReflection_QueryGetRelayMiningDifficultyRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetRelayMiningDifficultyRequest_messageType{} + +type fastReflection_QueryGetRelayMiningDifficultyRequest_messageType struct{} + +func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyRequest)(nil) +} +func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyRequest) +} +func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetRelayMiningDifficultyRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetRelayMiningDifficultyRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ServiceId != "" { + value := protoreflect.ValueOfString(x.ServiceId) + if !f(fd_QueryGetRelayMiningDifficultyRequest_serviceId, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyRequest.serviceId": + return x.ServiceId != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyRequest.serviceId": + x.ServiceId = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyRequest.serviceId": + value := x.ServiceId + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyRequest.serviceId": + x.ServiceId = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyRequest.serviceId": + panic(fmt.Errorf("field serviceId of message poktroll.service.QueryGetRelayMiningDifficultyRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyRequest.serviceId": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryGetRelayMiningDifficultyRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.ServiceId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ServiceId) > 0 { + i -= len(x.ServiceId) + copy(dAtA[i:], x.ServiceId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetRelayMiningDifficultyResponse protoreflect.MessageDescriptor + fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryGetRelayMiningDifficultyResponse = File_poktroll_service_query_proto.Messages().ByName("QueryGetRelayMiningDifficultyResponse") + fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty = md_QueryGetRelayMiningDifficultyResponse.Fields().ByName("relayMiningDifficulty") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetRelayMiningDifficultyResponse)(nil) + +type fastReflection_QueryGetRelayMiningDifficultyResponse QueryGetRelayMiningDifficultyResponse + +func (x *QueryGetRelayMiningDifficultyResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyResponse)(x) +} + +func (x *QueryGetRelayMiningDifficultyResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetRelayMiningDifficultyResponse_messageType fastReflection_QueryGetRelayMiningDifficultyResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetRelayMiningDifficultyResponse_messageType{} + +type fastReflection_QueryGetRelayMiningDifficultyResponse_messageType struct{} + +func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetRelayMiningDifficultyResponse)(nil) +} +func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyResponse) +} +func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetRelayMiningDifficultyResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetRelayMiningDifficultyResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetRelayMiningDifficultyResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetRelayMiningDifficultyResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RelayMiningDifficulty != nil { + value := protoreflect.ValueOfMessage(x.RelayMiningDifficulty.ProtoReflect()) + if !f(fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + return x.RelayMiningDifficulty != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + x.RelayMiningDifficulty = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + value := x.RelayMiningDifficulty + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + x.RelayMiningDifficulty = value.Message().Interface().(*RelayMiningDifficulty) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + if x.RelayMiningDifficulty == nil { + x.RelayMiningDifficulty = new(RelayMiningDifficulty) + } + return protoreflect.ValueOfMessage(x.RelayMiningDifficulty.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": + m := new(RelayMiningDifficulty) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryGetRelayMiningDifficultyResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.RelayMiningDifficulty != nil { + l = options.Size(x.RelayMiningDifficulty) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.RelayMiningDifficulty != nil { + encoded, err := options.Marshal(x.RelayMiningDifficulty) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetRelayMiningDifficultyResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.RelayMiningDifficulty == nil { + x.RelayMiningDifficulty = &RelayMiningDifficulty{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficulty); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllRelayMiningDifficultyRequest protoreflect.MessageDescriptor + fd_QueryAllRelayMiningDifficultyRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryAllRelayMiningDifficultyRequest = File_poktroll_service_query_proto.Messages().ByName("QueryAllRelayMiningDifficultyRequest") + fd_QueryAllRelayMiningDifficultyRequest_pagination = md_QueryAllRelayMiningDifficultyRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllRelayMiningDifficultyRequest)(nil) + +type fastReflection_QueryAllRelayMiningDifficultyRequest QueryAllRelayMiningDifficultyRequest + +func (x *QueryAllRelayMiningDifficultyRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyRequest)(x) +} + +func (x *QueryAllRelayMiningDifficultyRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllRelayMiningDifficultyRequest_messageType fastReflection_QueryAllRelayMiningDifficultyRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllRelayMiningDifficultyRequest_messageType{} + +type fastReflection_QueryAllRelayMiningDifficultyRequest_messageType struct{} + +func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyRequest)(nil) +} +func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyRequest) +} +func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllRelayMiningDifficultyRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllRelayMiningDifficultyRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllRelayMiningDifficultyRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllRelayMiningDifficultyRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllRelayMiningDifficultyResponse_1_list)(nil) + +type _QueryAllRelayMiningDifficultyResponse_1_list struct { + list *[]*RelayMiningDifficulty +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) AppendMutable() protoreflect.Value { + v := new(RelayMiningDifficulty) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) NewElement() protoreflect.Value { + v := new(RelayMiningDifficulty) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllRelayMiningDifficultyResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllRelayMiningDifficultyResponse protoreflect.MessageDescriptor + fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty protoreflect.FieldDescriptor + fd_QueryAllRelayMiningDifficultyResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryAllRelayMiningDifficultyResponse = File_poktroll_service_query_proto.Messages().ByName("QueryAllRelayMiningDifficultyResponse") + fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty = md_QueryAllRelayMiningDifficultyResponse.Fields().ByName("relayMiningDifficulty") + fd_QueryAllRelayMiningDifficultyResponse_pagination = md_QueryAllRelayMiningDifficultyResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllRelayMiningDifficultyResponse)(nil) + +type fastReflection_QueryAllRelayMiningDifficultyResponse QueryAllRelayMiningDifficultyResponse + +func (x *QueryAllRelayMiningDifficultyResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyResponse)(x) +} + +func (x *QueryAllRelayMiningDifficultyResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllRelayMiningDifficultyResponse_messageType fastReflection_QueryAllRelayMiningDifficultyResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllRelayMiningDifficultyResponse_messageType{} + +type fastReflection_QueryAllRelayMiningDifficultyResponse_messageType struct{} + +func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllRelayMiningDifficultyResponse)(nil) +} +func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyResponse) +} +func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllRelayMiningDifficultyResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllRelayMiningDifficultyResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllRelayMiningDifficultyResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllRelayMiningDifficultyResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.RelayMiningDifficulty) != 0 { + value := protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty}) + if !f(fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllRelayMiningDifficultyResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + return len(x.RelayMiningDifficulty) != 0 + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + x.RelayMiningDifficulty = nil + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + if len(x.RelayMiningDifficulty) == 0 { + return protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{}) + } + listValue := &_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty} + return protoreflect.ValueOfList(listValue) + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + lv := value.List() + clv := lv.(*_QueryAllRelayMiningDifficultyResponse_1_list) + x.RelayMiningDifficulty = *clv.list + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + if x.RelayMiningDifficulty == nil { + x.RelayMiningDifficulty = []*RelayMiningDifficulty{} + } + value := &_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty} + return protoreflect.ValueOfList(value) + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": + list := []*RelayMiningDifficulty{} + return protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{list: &list}) + case "poktroll.service.QueryAllRelayMiningDifficultyResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllRelayMiningDifficultyResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllRelayMiningDifficultyResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.RelayMiningDifficulty) > 0 { + for _, e := range x.RelayMiningDifficulty { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.RelayMiningDifficulty) > 0 { + for iNdEx := len(x.RelayMiningDifficulty) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.RelayMiningDifficulty[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllRelayMiningDifficultyResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.RelayMiningDifficulty = append(x.RelayMiningDifficulty, &RelayMiningDifficulty{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficulty[len(x.RelayMiningDifficulty)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2897,6 +4760,154 @@ func (x *QueryAllServicesResponse) GetPagination() *v1beta1.PageResponse { return nil } +type QueryGetRelayMiningDifficultyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"` +} + +func (x *QueryGetRelayMiningDifficultyRequest) Reset() { + *x = QueryGetRelayMiningDifficultyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetRelayMiningDifficultyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetRelayMiningDifficultyRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetRelayMiningDifficultyRequest.ProtoReflect.Descriptor instead. +func (*QueryGetRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{6} +} + +func (x *QueryGetRelayMiningDifficultyRequest) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +type QueryGetRelayMiningDifficultyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RelayMiningDifficulty *RelayMiningDifficulty `protobuf:"bytes,1,opt,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty,omitempty"` +} + +func (x *QueryGetRelayMiningDifficultyResponse) Reset() { + *x = QueryGetRelayMiningDifficultyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetRelayMiningDifficultyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetRelayMiningDifficultyResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetRelayMiningDifficultyResponse.ProtoReflect.Descriptor instead. +func (*QueryGetRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{7} +} + +func (x *QueryGetRelayMiningDifficultyResponse) GetRelayMiningDifficulty() *RelayMiningDifficulty { + if x != nil { + return x.RelayMiningDifficulty + } + return nil +} + +type QueryAllRelayMiningDifficultyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllRelayMiningDifficultyRequest) Reset() { + *x = QueryAllRelayMiningDifficultyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllRelayMiningDifficultyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllRelayMiningDifficultyRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllRelayMiningDifficultyRequest.ProtoReflect.Descriptor instead. +func (*QueryAllRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{8} +} + +func (x *QueryAllRelayMiningDifficultyRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllRelayMiningDifficultyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RelayMiningDifficulty []*RelayMiningDifficulty `protobuf:"bytes,1,rep,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllRelayMiningDifficultyResponse) Reset() { + *x = QueryAllRelayMiningDifficultyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllRelayMiningDifficultyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllRelayMiningDifficultyResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllRelayMiningDifficultyResponse.ProtoReflect.Descriptor instead. +func (*QueryAllRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{9} +} + +func (x *QueryAllRelayMiningDifficultyResponse) GetRelayMiningDifficulty() []*RelayMiningDifficulty { + if x != nil { + return x.RelayMiningDifficulty + } + return nil +} + +func (x *QueryAllRelayMiningDifficultyResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + var File_poktroll_service_query_proto protoreflect.FileDescriptor var file_poktroll_service_query_proto_rawDesc = []byte{ @@ -2914,6 +4925,9 @@ var file_poktroll_service_query_proto_rawDesc = []byte{ 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, + 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, @@ -2944,46 +4958,107 @@ var file_poktroll_service_query_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbb, 0x03, - 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x93, - 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, + 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x44, 0x0a, + 0x24, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, + 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x25, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, + 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, + 0x15, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, + 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, + 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6c, + 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, + 0x74, 0x79, 0x22, 0x6e, 0x0a, 0x24, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0xd5, 0x01, 0x0a, 0x25, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, + 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x15, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, + 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, + 0x75, 0x6c, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, + 0x79, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xe0, 0x06, 0x0a, 0x05, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x93, 0x01, 0x0a, 0x07, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, + 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xd4, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, + 0x74, 0x79, 0x12, 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, - 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, + 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x4a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x44, 0x12, 0x42, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, + 0x6c, 0x74, 0x79, 0x2f, 0x7b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x7d, 0x12, + 0xcb, 0x01, 0x0a, 0x18, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, + 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x41, 0x6c, 0x6c, 0x12, 0x36, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, + 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0xaa, 0x01, 0xd8, 0xe2, - 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, - 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, - 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, + 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, + 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0xaa, 0x01, + 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -2998,36 +5073,49 @@ func file_poktroll_service_query_proto_rawDescGZIP() []byte { return file_poktroll_service_query_proto_rawDescData } -var file_poktroll_service_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_service_query_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_poktroll_service_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.service.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.service.QueryParamsResponse - (*QueryGetServiceRequest)(nil), // 2: poktroll.service.QueryGetServiceRequest - (*QueryGetServiceResponse)(nil), // 3: poktroll.service.QueryGetServiceResponse - (*QueryAllServicesRequest)(nil), // 4: poktroll.service.QueryAllServicesRequest - (*QueryAllServicesResponse)(nil), // 5: poktroll.service.QueryAllServicesResponse - (*Params)(nil), // 6: poktroll.service.Params - (*shared.Service)(nil), // 7: poktroll.shared.Service - (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse + (*QueryParamsRequest)(nil), // 0: poktroll.service.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.service.QueryParamsResponse + (*QueryGetServiceRequest)(nil), // 2: poktroll.service.QueryGetServiceRequest + (*QueryGetServiceResponse)(nil), // 3: poktroll.service.QueryGetServiceResponse + (*QueryAllServicesRequest)(nil), // 4: poktroll.service.QueryAllServicesRequest + (*QueryAllServicesResponse)(nil), // 5: poktroll.service.QueryAllServicesResponse + (*QueryGetRelayMiningDifficultyRequest)(nil), // 6: poktroll.service.QueryGetRelayMiningDifficultyRequest + (*QueryGetRelayMiningDifficultyResponse)(nil), // 7: poktroll.service.QueryGetRelayMiningDifficultyResponse + (*QueryAllRelayMiningDifficultyRequest)(nil), // 8: poktroll.service.QueryAllRelayMiningDifficultyRequest + (*QueryAllRelayMiningDifficultyResponse)(nil), // 9: poktroll.service.QueryAllRelayMiningDifficultyResponse + (*Params)(nil), // 10: poktroll.service.Params + (*shared.Service)(nil), // 11: poktroll.shared.Service + (*v1beta1.PageRequest)(nil), // 12: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 13: cosmos.base.query.v1beta1.PageResponse + (*RelayMiningDifficulty)(nil), // 14: poktroll.service.RelayMiningDifficulty } var file_poktroll_service_query_proto_depIdxs = []int32{ - 6, // 0: poktroll.service.QueryParamsResponse.params:type_name -> poktroll.service.Params - 7, // 1: poktroll.service.QueryGetServiceResponse.service:type_name -> poktroll.shared.Service - 8, // 2: poktroll.service.QueryAllServicesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.service.QueryAllServicesResponse.service:type_name -> poktroll.shared.Service - 9, // 4: poktroll.service.QueryAllServicesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 0, // 5: poktroll.service.Query.Params:input_type -> poktroll.service.QueryParamsRequest - 2, // 6: poktroll.service.Query.Service:input_type -> poktroll.service.QueryGetServiceRequest - 4, // 7: poktroll.service.Query.AllServices:input_type -> poktroll.service.QueryAllServicesRequest - 1, // 8: poktroll.service.Query.Params:output_type -> poktroll.service.QueryParamsResponse - 3, // 9: poktroll.service.Query.Service:output_type -> poktroll.service.QueryGetServiceResponse - 5, // 10: poktroll.service.Query.AllServices:output_type -> poktroll.service.QueryAllServicesResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 10, // 0: poktroll.service.QueryParamsResponse.params:type_name -> poktroll.service.Params + 11, // 1: poktroll.service.QueryGetServiceResponse.service:type_name -> poktroll.shared.Service + 12, // 2: poktroll.service.QueryAllServicesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 11, // 3: poktroll.service.QueryAllServicesResponse.service:type_name -> poktroll.shared.Service + 13, // 4: poktroll.service.QueryAllServicesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 14, // 5: poktroll.service.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty:type_name -> poktroll.service.RelayMiningDifficulty + 12, // 6: poktroll.service.QueryAllRelayMiningDifficultyRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 14, // 7: poktroll.service.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty:type_name -> poktroll.service.RelayMiningDifficulty + 13, // 8: poktroll.service.QueryAllRelayMiningDifficultyResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 9: poktroll.service.Query.Params:input_type -> poktroll.service.QueryParamsRequest + 2, // 10: poktroll.service.Query.Service:input_type -> poktroll.service.QueryGetServiceRequest + 4, // 11: poktroll.service.Query.AllServices:input_type -> poktroll.service.QueryAllServicesRequest + 6, // 12: poktroll.service.Query.RelayMiningDifficulty:input_type -> poktroll.service.QueryGetRelayMiningDifficultyRequest + 8, // 13: poktroll.service.Query.RelayMiningDifficultyAll:input_type -> poktroll.service.QueryAllRelayMiningDifficultyRequest + 1, // 14: poktroll.service.Query.Params:output_type -> poktroll.service.QueryParamsResponse + 3, // 15: poktroll.service.Query.Service:output_type -> poktroll.service.QueryGetServiceResponse + 5, // 16: poktroll.service.Query.AllServices:output_type -> poktroll.service.QueryAllServicesResponse + 7, // 17: poktroll.service.Query.RelayMiningDifficulty:output_type -> poktroll.service.QueryGetRelayMiningDifficultyResponse + 9, // 18: poktroll.service.Query.RelayMiningDifficultyAll:output_type -> poktroll.service.QueryAllRelayMiningDifficultyResponse + 14, // [14:19] is the sub-list for method output_type + 9, // [9:14] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_poktroll_service_query_proto_init() } @@ -3036,6 +5124,7 @@ func file_poktroll_service_query_proto_init() { return } file_poktroll_service_params_proto_init() + file_poktroll_service_relay_mining_difficulty_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_service_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryParamsRequest); i { @@ -3109,6 +5198,54 @@ func file_poktroll_service_query_proto_init() { return nil } } + file_poktroll_service_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetRelayMiningDifficultyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetRelayMiningDifficultyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllRelayMiningDifficultyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllRelayMiningDifficultyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3116,7 +5253,7 @@ func file_poktroll_service_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_service_query_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/service/query_grpc.pb.go b/api/poktroll/service/query_grpc.pb.go index 98d68bf29..99ea067f5 100644 --- a/api/poktroll/service/query_grpc.pb.go +++ b/api/poktroll/service/query_grpc.pb.go @@ -19,9 +19,11 @@ import ( const _ = grpc.SupportPackageIsVersion8 const ( - Query_Params_FullMethodName = "/poktroll.service.Query/Params" - Query_Service_FullMethodName = "/poktroll.service.Query/Service" - Query_AllServices_FullMethodName = "/poktroll.service.Query/AllServices" + Query_Params_FullMethodName = "/poktroll.service.Query/Params" + Query_Service_FullMethodName = "/poktroll.service.Query/Service" + Query_AllServices_FullMethodName = "/poktroll.service.Query/AllServices" + Query_RelayMiningDifficulty_FullMethodName = "/poktroll.service.Query/RelayMiningDifficulty" + Query_RelayMiningDifficultyAll_FullMethodName = "/poktroll.service.Query/RelayMiningDifficultyAll" ) // QueryClient is the client API for Query service. @@ -35,6 +37,9 @@ type QueryClient interface { // Queries a list of Service items. Service(ctx context.Context, in *QueryGetServiceRequest, opts ...grpc.CallOption) (*QueryGetServiceResponse, error) AllServices(ctx context.Context, in *QueryAllServicesRequest, opts ...grpc.CallOption) (*QueryAllServicesResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) } type queryClient struct { @@ -75,6 +80,26 @@ func (c *queryClient) AllServices(ctx context.Context, in *QueryAllServicesReque return out, nil } +func (c *queryClient) RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueryGetRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, Query_RelayMiningDifficulty_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueryAllRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, Query_RelayMiningDifficultyAll_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility @@ -86,6 +111,9 @@ type QueryServer interface { // Queries a list of Service items. Service(context.Context, *QueryGetServiceRequest) (*QueryGetServiceResponse, error) AllServices(context.Context, *QueryAllServicesRequest) (*QueryAllServicesResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) mustEmbedUnimplementedQueryServer() } @@ -102,6 +130,12 @@ func (UnimplementedQueryServer) Service(context.Context, *QueryGetServiceRequest func (UnimplementedQueryServer) AllServices(context.Context, *QueryAllServicesRequest) (*QueryAllServicesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllServices not implemented") } +func (UnimplementedQueryServer) RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficulty not implemented") +} +func (UnimplementedQueryServer) RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficultyAll not implemented") +} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. @@ -169,6 +203,42 @@ func _Query_AllServices_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_RelayMiningDifficulty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficulty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_RelayMiningDifficulty_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficulty(ctx, req.(*QueryGetRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RelayMiningDifficultyAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_RelayMiningDifficultyAll_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, req.(*QueryAllRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -188,6 +258,14 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "AllServices", Handler: _Query_AllServices_Handler, }, + { + MethodName: "RelayMiningDifficulty", + Handler: _Query_RelayMiningDifficulty_Handler, + }, + { + MethodName: "RelayMiningDifficultyAll", + Handler: _Query_RelayMiningDifficultyAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/service/query.proto", diff --git a/api/poktroll/service/relay_mining_difficulty.pulsar.go b/api/poktroll/service/relay_mining_difficulty.pulsar.go new file mode 100644 index 000000000..ba6a6bea4 --- /dev/null +++ b/api/poktroll/service/relay_mining_difficulty.pulsar.go @@ -0,0 +1,775 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_RelayMiningDifficulty protoreflect.MessageDescriptor + fd_RelayMiningDifficulty_service_id protoreflect.FieldDescriptor + fd_RelayMiningDifficulty_block_height protoreflect.FieldDescriptor + fd_RelayMiningDifficulty_num_relays_ema protoreflect.FieldDescriptor + fd_RelayMiningDifficulty_target_hash protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_relay_mining_difficulty_proto_init() + md_RelayMiningDifficulty = File_poktroll_service_relay_mining_difficulty_proto.Messages().ByName("RelayMiningDifficulty") + fd_RelayMiningDifficulty_service_id = md_RelayMiningDifficulty.Fields().ByName("service_id") + fd_RelayMiningDifficulty_block_height = md_RelayMiningDifficulty.Fields().ByName("block_height") + fd_RelayMiningDifficulty_num_relays_ema = md_RelayMiningDifficulty.Fields().ByName("num_relays_ema") + fd_RelayMiningDifficulty_target_hash = md_RelayMiningDifficulty.Fields().ByName("target_hash") +} + +var _ protoreflect.Message = (*fastReflection_RelayMiningDifficulty)(nil) + +type fastReflection_RelayMiningDifficulty RelayMiningDifficulty + +func (x *RelayMiningDifficulty) ProtoReflect() protoreflect.Message { + return (*fastReflection_RelayMiningDifficulty)(x) +} + +func (x *RelayMiningDifficulty) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_relay_mining_difficulty_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_RelayMiningDifficulty_messageType fastReflection_RelayMiningDifficulty_messageType +var _ protoreflect.MessageType = fastReflection_RelayMiningDifficulty_messageType{} + +type fastReflection_RelayMiningDifficulty_messageType struct{} + +func (x fastReflection_RelayMiningDifficulty_messageType) Zero() protoreflect.Message { + return (*fastReflection_RelayMiningDifficulty)(nil) +} +func (x fastReflection_RelayMiningDifficulty_messageType) New() protoreflect.Message { + return new(fastReflection_RelayMiningDifficulty) +} +func (x fastReflection_RelayMiningDifficulty_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_RelayMiningDifficulty +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_RelayMiningDifficulty) Descriptor() protoreflect.MessageDescriptor { + return md_RelayMiningDifficulty +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_RelayMiningDifficulty) Type() protoreflect.MessageType { + return _fastReflection_RelayMiningDifficulty_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_RelayMiningDifficulty) New() protoreflect.Message { + return new(fastReflection_RelayMiningDifficulty) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_RelayMiningDifficulty) Interface() protoreflect.ProtoMessage { + return (*RelayMiningDifficulty)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_RelayMiningDifficulty) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ServiceId != "" { + value := protoreflect.ValueOfString(x.ServiceId) + if !f(fd_RelayMiningDifficulty_service_id, value) { + return + } + } + if x.BlockHeight != int64(0) { + value := protoreflect.ValueOfInt64(x.BlockHeight) + if !f(fd_RelayMiningDifficulty_block_height, value) { + return + } + } + if x.NumRelaysEma != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumRelaysEma) + if !f(fd_RelayMiningDifficulty_num_relays_ema, value) { + return + } + } + if len(x.TargetHash) != 0 { + value := protoreflect.ValueOfBytes(x.TargetHash) + if !f(fd_RelayMiningDifficulty_target_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_RelayMiningDifficulty) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.RelayMiningDifficulty.service_id": + return x.ServiceId != "" + case "poktroll.service.RelayMiningDifficulty.block_height": + return x.BlockHeight != int64(0) + case "poktroll.service.RelayMiningDifficulty.num_relays_ema": + return x.NumRelaysEma != uint64(0) + case "poktroll.service.RelayMiningDifficulty.target_hash": + return len(x.TargetHash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.service.RelayMiningDifficulty does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayMiningDifficulty) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.RelayMiningDifficulty.service_id": + x.ServiceId = "" + case "poktroll.service.RelayMiningDifficulty.block_height": + x.BlockHeight = int64(0) + case "poktroll.service.RelayMiningDifficulty.num_relays_ema": + x.NumRelaysEma = uint64(0) + case "poktroll.service.RelayMiningDifficulty.target_hash": + x.TargetHash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.service.RelayMiningDifficulty does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_RelayMiningDifficulty) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.RelayMiningDifficulty.service_id": + value := x.ServiceId + return protoreflect.ValueOfString(value) + case "poktroll.service.RelayMiningDifficulty.block_height": + value := x.BlockHeight + return protoreflect.ValueOfInt64(value) + case "poktroll.service.RelayMiningDifficulty.num_relays_ema": + value := x.NumRelaysEma + return protoreflect.ValueOfUint64(value) + case "poktroll.service.RelayMiningDifficulty.target_hash": + value := x.TargetHash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.service.RelayMiningDifficulty does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayMiningDifficulty) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.RelayMiningDifficulty.service_id": + x.ServiceId = value.Interface().(string) + case "poktroll.service.RelayMiningDifficulty.block_height": + x.BlockHeight = value.Int() + case "poktroll.service.RelayMiningDifficulty.num_relays_ema": + x.NumRelaysEma = value.Uint() + case "poktroll.service.RelayMiningDifficulty.target_hash": + x.TargetHash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.service.RelayMiningDifficulty does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayMiningDifficulty) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayMiningDifficulty.service_id": + panic(fmt.Errorf("field service_id of message poktroll.service.RelayMiningDifficulty is not mutable")) + case "poktroll.service.RelayMiningDifficulty.block_height": + panic(fmt.Errorf("field block_height of message poktroll.service.RelayMiningDifficulty is not mutable")) + case "poktroll.service.RelayMiningDifficulty.num_relays_ema": + panic(fmt.Errorf("field num_relays_ema of message poktroll.service.RelayMiningDifficulty is not mutable")) + case "poktroll.service.RelayMiningDifficulty.target_hash": + panic(fmt.Errorf("field target_hash of message poktroll.service.RelayMiningDifficulty is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.service.RelayMiningDifficulty does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_RelayMiningDifficulty) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayMiningDifficulty.service_id": + return protoreflect.ValueOfString("") + case "poktroll.service.RelayMiningDifficulty.block_height": + return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.service.RelayMiningDifficulty.num_relays_ema": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.service.RelayMiningDifficulty.target_hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayMiningDifficulty")) + } + panic(fmt.Errorf("message poktroll.service.RelayMiningDifficulty does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_RelayMiningDifficulty) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.RelayMiningDifficulty", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_RelayMiningDifficulty) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayMiningDifficulty) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_RelayMiningDifficulty) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_RelayMiningDifficulty) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*RelayMiningDifficulty) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.ServiceId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.BlockHeight != 0 { + n += 1 + runtime.Sov(uint64(x.BlockHeight)) + } + if x.NumRelaysEma != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelaysEma)) + } + l = len(x.TargetHash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*RelayMiningDifficulty) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.TargetHash) > 0 { + i -= len(x.TargetHash) + copy(dAtA[i:], x.TargetHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TargetHash))) + i-- + dAtA[i] = 0x22 + } + if x.NumRelaysEma != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelaysEma)) + i-- + dAtA[i] = 0x18 + } + if x.BlockHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + if len(x.ServiceId) > 0 { + i -= len(x.ServiceId) + copy(dAtA[i:], x.ServiceId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*RelayMiningDifficulty) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayMiningDifficulty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayMiningDifficulty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + x.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.BlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelaysEma", wireType) + } + x.NumRelaysEma = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumRelaysEma |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TargetHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.TargetHash = append(x.TargetHash[:0], dAtA[iNdEx:postIndex]...) + if x.TargetHash == nil { + x.TargetHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/relay_mining_difficulty.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// RelayMiningDifficulty is a message used to store the on-chain Relay Mining +// difficulty associated with a specific service ID. +type RelayMiningDifficulty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The service ID the relay mining difficulty is associated with. + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + // The block height at which this relay mining difficulty was computed. + // This is needed to determine how much time has passed since the last time + // the exponential moving average was computed. + BlockHeight int64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // The exponential moving average of the number of relays for this service. + NumRelaysEma uint64 `protobuf:"varint,3,opt,name=num_relays_ema,json=numRelaysEma,proto3" json:"num_relays_ema,omitempty"` + // The target hash determining the difficulty to mine relays for this service. + // For example, if we use sha256 to hash the (RelayRequest,ReqlayResponse) tuple, + // and the difficulty has 4 leading zero bits, then the target hash would be: + // 0b0000111... (until 32 bytes are filled up). + TargetHash []byte `protobuf:"bytes,4,opt,name=target_hash,json=targetHash,proto3" json:"target_hash,omitempty"` +} + +func (x *RelayMiningDifficulty) Reset() { + *x = RelayMiningDifficulty{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_relay_mining_difficulty_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RelayMiningDifficulty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RelayMiningDifficulty) ProtoMessage() {} + +// Deprecated: Use RelayMiningDifficulty.ProtoReflect.Descriptor instead. +func (*RelayMiningDifficulty) Descriptor() ([]byte, []int) { + return file_poktroll_service_relay_mining_difficulty_proto_rawDescGZIP(), []int{0} +} + +func (x *RelayMiningDifficulty) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *RelayMiningDifficulty) GetBlockHeight() int64 { + if x != nil { + return x.BlockHeight + } + return 0 +} + +func (x *RelayMiningDifficulty) GetNumRelaysEma() uint64 { + if x != nil { + return x.NumRelaysEma + } + return 0 +} + +func (x *RelayMiningDifficulty) GetTargetHash() []byte { + if x != nil { + return x.TargetHash + } + return nil +} + +var File_poktroll_service_relay_mining_difficulty_proto protoreflect.FileDescriptor + +var file_poktroll_service_relay_mining_difficulty_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, + 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa0, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, + 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, + 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x6e, 0x75, + 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x42, 0xba, 0x01, 0xd8, 0xe2, + 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x1a, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, + 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_relay_mining_difficulty_proto_rawDescOnce sync.Once + file_poktroll_service_relay_mining_difficulty_proto_rawDescData = file_poktroll_service_relay_mining_difficulty_proto_rawDesc +) + +func file_poktroll_service_relay_mining_difficulty_proto_rawDescGZIP() []byte { + file_poktroll_service_relay_mining_difficulty_proto_rawDescOnce.Do(func() { + file_poktroll_service_relay_mining_difficulty_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_relay_mining_difficulty_proto_rawDescData) + }) + return file_poktroll_service_relay_mining_difficulty_proto_rawDescData +} + +var file_poktroll_service_relay_mining_difficulty_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_relay_mining_difficulty_proto_goTypes = []interface{}{ + (*RelayMiningDifficulty)(nil), // 0: poktroll.service.RelayMiningDifficulty +} +var file_poktroll_service_relay_mining_difficulty_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_relay_mining_difficulty_proto_init() } +func file_poktroll_service_relay_mining_difficulty_proto_init() { + if File_poktroll_service_relay_mining_difficulty_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_relay_mining_difficulty_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayMiningDifficulty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_relay_mining_difficulty_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_relay_mining_difficulty_proto_goTypes, + DependencyIndexes: file_poktroll_service_relay_mining_difficulty_proto_depIdxs, + MessageInfos: file_poktroll_service_relay_mining_difficulty_proto_msgTypes, + }.Build() + File_poktroll_service_relay_mining_difficulty_proto = out.File + file_poktroll_service_relay_mining_difficulty_proto_rawDesc = nil + file_poktroll_service_relay_mining_difficulty_proto_goTypes = nil + file_poktroll_service_relay_mining_difficulty_proto_depIdxs = nil +} diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index f5d74bcf5..f69665680 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -16,11 +16,13 @@ import ( ) var ( - md_EventClaimExpired protoreflect.MessageDescriptor - fd_EventClaimExpired_claim protoreflect.FieldDescriptor - fd_EventClaimExpired_expiration_reason protoreflect.FieldDescriptor - fd_EventClaimExpired_num_relays protoreflect.FieldDescriptor - fd_EventClaimExpired_num_compute_units protoreflect.FieldDescriptor + md_EventClaimExpired protoreflect.MessageDescriptor + fd_EventClaimExpired_claim protoreflect.FieldDescriptor + fd_EventClaimExpired_expiration_reason protoreflect.FieldDescriptor + fd_EventClaimExpired_num_relays protoreflect.FieldDescriptor + fd_EventClaimExpired_num_claimed_compute_units protoreflect.FieldDescriptor + fd_EventClaimExpired_num_estimated_compute_units protoreflect.FieldDescriptor + fd_EventClaimExpired_claimed_amount_upokt protoreflect.FieldDescriptor ) func init() { @@ -29,7 +31,9 @@ func init() { fd_EventClaimExpired_claim = md_EventClaimExpired.Fields().ByName("claim") fd_EventClaimExpired_expiration_reason = md_EventClaimExpired.Fields().ByName("expiration_reason") fd_EventClaimExpired_num_relays = md_EventClaimExpired.Fields().ByName("num_relays") - fd_EventClaimExpired_num_compute_units = md_EventClaimExpired.Fields().ByName("num_compute_units") + fd_EventClaimExpired_num_claimed_compute_units = md_EventClaimExpired.Fields().ByName("num_claimed_compute_units") + fd_EventClaimExpired_num_estimated_compute_units = md_EventClaimExpired.Fields().ByName("num_estimated_compute_units") + fd_EventClaimExpired_claimed_amount_upokt = md_EventClaimExpired.Fields().ByName("claimed_amount_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimExpired)(nil) @@ -115,9 +119,21 @@ func (x *fastReflection_EventClaimExpired) Range(f func(protoreflect.FieldDescri return } } - if x.NumComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.NumComputeUnits) - if !f(fd_EventClaimExpired_num_compute_units, value) { + if x.NumClaimedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumClaimedComputeUnits) + if !f(fd_EventClaimExpired_num_claimed_compute_units, value) { + return + } + } + if x.NumEstimatedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumEstimatedComputeUnits) + if !f(fd_EventClaimExpired_num_estimated_compute_units, value) { + return + } + } + if x.ClaimedAmountUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + if !f(fd_EventClaimExpired_claimed_amount_upokt, value) { return } } @@ -142,8 +158,12 @@ func (x *fastReflection_EventClaimExpired) Has(fd protoreflect.FieldDescriptor) return x.ExpirationReason != 0 case "poktroll.tokenomics.EventClaimExpired.num_relays": return x.NumRelays != uint64(0) - case "poktroll.tokenomics.EventClaimExpired.num_compute_units": - return x.NumComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_claimed_compute_units": + return x.NumClaimedComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": + return x.NumEstimatedComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": + return x.ClaimedAmountUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -166,8 +186,12 @@ func (x *fastReflection_EventClaimExpired) Clear(fd protoreflect.FieldDescriptor x.ExpirationReason = 0 case "poktroll.tokenomics.EventClaimExpired.num_relays": x.NumRelays = uint64(0) - case "poktroll.tokenomics.EventClaimExpired.num_compute_units": - x.NumComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_claimed_compute_units": + x.NumClaimedComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": + x.NumEstimatedComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": + x.ClaimedAmountUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -193,9 +217,15 @@ func (x *fastReflection_EventClaimExpired) Get(descriptor protoreflect.FieldDesc case "poktroll.tokenomics.EventClaimExpired.num_relays": value := x.NumRelays return protoreflect.ValueOfUint64(value) - case "poktroll.tokenomics.EventClaimExpired.num_compute_units": - value := x.NumComputeUnits + case "poktroll.tokenomics.EventClaimExpired.num_claimed_compute_units": + value := x.NumClaimedComputeUnits return protoreflect.ValueOfUint64(value) + case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": + value := x.NumEstimatedComputeUnits + return protoreflect.ValueOfUint64(value) + case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": + value := x.ClaimedAmountUpokt + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -222,8 +252,12 @@ func (x *fastReflection_EventClaimExpired) Set(fd protoreflect.FieldDescriptor, x.ExpirationReason = (ClaimExpirationReason)(value.Enum()) case "poktroll.tokenomics.EventClaimExpired.num_relays": x.NumRelays = value.Uint() - case "poktroll.tokenomics.EventClaimExpired.num_compute_units": - x.NumComputeUnits = value.Uint() + case "poktroll.tokenomics.EventClaimExpired.num_claimed_compute_units": + x.NumClaimedComputeUnits = value.Uint() + case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": + x.NumEstimatedComputeUnits = value.Uint() + case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": + x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -249,12 +283,19 @@ func (x *fastReflection_EventClaimExpired) Mutable(fd protoreflect.FieldDescript x.Claim = new(proof.Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) case "poktroll.tokenomics.EventClaimExpired.expiration_reason": panic(fmt.Errorf("field expiration_reason of message poktroll.tokenomics.EventClaimExpired is not mutable")) case "poktroll.tokenomics.EventClaimExpired.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.tokenomics.EventClaimExpired is not mutable")) - case "poktroll.tokenomics.EventClaimExpired.num_compute_units": - panic(fmt.Errorf("field num_compute_units of message poktroll.tokenomics.EventClaimExpired is not mutable")) + case "poktroll.tokenomics.EventClaimExpired.num_claimed_compute_units": + panic(fmt.Errorf("field num_claimed_compute_units of message poktroll.tokenomics.EventClaimExpired is not mutable")) + case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": + panic(fmt.Errorf("field num_estimated_compute_units of message poktroll.tokenomics.EventClaimExpired is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -275,8 +316,13 @@ func (x *fastReflection_EventClaimExpired) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfEnum(0) case "poktroll.tokenomics.EventClaimExpired.num_relays": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.tokenomics.EventClaimExpired.num_compute_units": + case "poktroll.tokenomics.EventClaimExpired.num_claimed_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -356,8 +402,15 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { if x.NumRelays != 0 { n += 1 + runtime.Sov(uint64(x.NumRelays)) } - if x.NumComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) + if x.NumClaimedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumClaimedComputeUnits)) + } + if x.NumEstimatedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) + } + if x.ClaimedAmountUpokt != nil { + l = options.Size(x.ClaimedAmountUpokt) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -388,8 +441,27 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.NumComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) + if x.ClaimedAmountUpokt != nil { + encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + if x.NumEstimatedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if x.NumClaimedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } @@ -542,9 +614,47 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { } case 4: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) + } + x.NumClaimedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumClaimedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + x.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) } - x.NumComputeUnits = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -554,11 +664,28 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.NumComputeUnits |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -595,11 +722,13 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { } var ( - md_EventClaimSettled protoreflect.MessageDescriptor - fd_EventClaimSettled_claim protoreflect.FieldDescriptor - fd_EventClaimSettled_proof_requirement protoreflect.FieldDescriptor - fd_EventClaimSettled_num_relays protoreflect.FieldDescriptor - fd_EventClaimSettled_num_compute_units protoreflect.FieldDescriptor + md_EventClaimSettled protoreflect.MessageDescriptor + fd_EventClaimSettled_claim protoreflect.FieldDescriptor + fd_EventClaimSettled_proof_requirement protoreflect.FieldDescriptor + fd_EventClaimSettled_num_relays protoreflect.FieldDescriptor + fd_EventClaimSettled_num_claimed_compute_units protoreflect.FieldDescriptor + fd_EventClaimSettled_num_estimated_compute_units protoreflect.FieldDescriptor + fd_EventClaimSettled_claimed_amount_upokt protoreflect.FieldDescriptor ) func init() { @@ -608,7 +737,9 @@ func init() { fd_EventClaimSettled_claim = md_EventClaimSettled.Fields().ByName("claim") fd_EventClaimSettled_proof_requirement = md_EventClaimSettled.Fields().ByName("proof_requirement") fd_EventClaimSettled_num_relays = md_EventClaimSettled.Fields().ByName("num_relays") - fd_EventClaimSettled_num_compute_units = md_EventClaimSettled.Fields().ByName("num_compute_units") + fd_EventClaimSettled_num_claimed_compute_units = md_EventClaimSettled.Fields().ByName("num_claimed_compute_units") + fd_EventClaimSettled_num_estimated_compute_units = md_EventClaimSettled.Fields().ByName("num_estimated_compute_units") + fd_EventClaimSettled_claimed_amount_upokt = md_EventClaimSettled.Fields().ByName("claimed_amount_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimSettled)(nil) @@ -694,9 +825,21 @@ func (x *fastReflection_EventClaimSettled) Range(f func(protoreflect.FieldDescri return } } - if x.NumComputeUnits != uint64(0) { - value := protoreflect.ValueOfUint64(x.NumComputeUnits) - if !f(fd_EventClaimSettled_num_compute_units, value) { + if x.NumClaimedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumClaimedComputeUnits) + if !f(fd_EventClaimSettled_num_claimed_compute_units, value) { + return + } + } + if x.NumEstimatedComputeUnits != uint64(0) { + value := protoreflect.ValueOfUint64(x.NumEstimatedComputeUnits) + if !f(fd_EventClaimSettled_num_estimated_compute_units, value) { + return + } + } + if x.ClaimedAmountUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + if !f(fd_EventClaimSettled_claimed_amount_upokt, value) { return } } @@ -721,8 +864,12 @@ func (x *fastReflection_EventClaimSettled) Has(fd protoreflect.FieldDescriptor) return x.ProofRequirement != 0 case "poktroll.tokenomics.EventClaimSettled.num_relays": return x.NumRelays != uint64(0) - case "poktroll.tokenomics.EventClaimSettled.num_compute_units": - return x.NumComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimSettled.num_claimed_compute_units": + return x.NumClaimedComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": + return x.NumEstimatedComputeUnits != uint64(0) + case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": + return x.ClaimedAmountUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -745,8 +892,12 @@ func (x *fastReflection_EventClaimSettled) Clear(fd protoreflect.FieldDescriptor x.ProofRequirement = 0 case "poktroll.tokenomics.EventClaimSettled.num_relays": x.NumRelays = uint64(0) - case "poktroll.tokenomics.EventClaimSettled.num_compute_units": - x.NumComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimSettled.num_claimed_compute_units": + x.NumClaimedComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": + x.NumEstimatedComputeUnits = uint64(0) + case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": + x.ClaimedAmountUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -767,613 +918,25 @@ func (x *fastReflection_EventClaimSettled) Get(descriptor protoreflect.FieldDesc value := x.Claim return protoreflect.ValueOfMessage(value.ProtoReflect()) case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - value := x.ProofRequirement - return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) - case "poktroll.tokenomics.EventClaimSettled.num_relays": - value := x.NumRelays - return protoreflect.ValueOfUint64(value) - case "poktroll.tokenomics.EventClaimSettled.num_compute_units": - value := x.NumComputeUnits - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventClaimSettled) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.tokenomics.EventClaimSettled.claim": - x.Claim = value.Message().Interface().(*proof.Claim) - case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - x.ProofRequirement = (proof.ProofRequirementReason)(value.Enum()) - case "poktroll.tokenomics.EventClaimSettled.num_relays": - x.NumRelays = value.Uint() - case "poktroll.tokenomics.EventClaimSettled.num_compute_units": - x.NumComputeUnits = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventClaimSettled) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.EventClaimSettled.claim": - if x.Claim == nil { - x.Claim = new(proof.Claim) - } - return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) - case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - panic(fmt.Errorf("field proof_requirement of message poktroll.tokenomics.EventClaimSettled is not mutable")) - case "poktroll.tokenomics.EventClaimSettled.num_relays": - panic(fmt.Errorf("field num_relays of message poktroll.tokenomics.EventClaimSettled is not mutable")) - case "poktroll.tokenomics.EventClaimSettled.num_compute_units": - panic(fmt.Errorf("field num_compute_units of message poktroll.tokenomics.EventClaimSettled is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventClaimSettled) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.EventClaimSettled.claim": - m := new(proof.Claim) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "poktroll.tokenomics.EventClaimSettled.proof_requirement": - return protoreflect.ValueOfEnum(0) - case "poktroll.tokenomics.EventClaimSettled.num_relays": - return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.tokenomics.EventClaimSettled.num_compute_units": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventClaimSettled) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.EventClaimSettled", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventClaimSettled) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventClaimSettled) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_EventClaimSettled) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventClaimSettled) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Claim != nil { - l = options.Size(x.Claim) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.ProofRequirement != 0 { - n += 1 + runtime.Sov(uint64(x.ProofRequirement)) - } - if x.NumRelays != 0 { - n += 1 + runtime.Sov(uint64(x.NumRelays)) - } - if x.NumComputeUnits != 0 { - n += 1 + runtime.Sov(uint64(x.NumComputeUnits)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventClaimSettled) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.NumComputeUnits != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NumComputeUnits)) - i-- - dAtA[i] = 0x20 - } - if x.NumRelays != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) - i-- - dAtA[i] = 0x18 - } - if x.ProofRequirement != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.ProofRequirement)) - i-- - dAtA[i] = 0x10 - } - if x.Claim != nil { - encoded, err := options.Marshal(x.Claim) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventClaimSettled) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventClaimSettled: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventClaimSettled: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Claim == nil { - x.Claim = &proof.Claim{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequirement", wireType) - } - x.ProofRequirement = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.ProofRequirement |= proof.ProofRequirementReason(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) - } - x.NumRelays = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.NumRelays |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) - } - x.NumComputeUnits = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.NumComputeUnits |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_EventRelayMiningDifficultyUpdated protoreflect.MessageDescriptor - fd_EventRelayMiningDifficultyUpdated_service_id protoreflect.FieldDescriptor - fd_EventRelayMiningDifficultyUpdated_prev_target_hash_hex_encoded protoreflect.FieldDescriptor - fd_EventRelayMiningDifficultyUpdated_new_target_hash_hex_encoded protoreflect.FieldDescriptor - fd_EventRelayMiningDifficultyUpdated_prev_num_relays_ema protoreflect.FieldDescriptor - fd_EventRelayMiningDifficultyUpdated_new_num_relays_ema protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_tokenomics_event_proto_init() - md_EventRelayMiningDifficultyUpdated = File_poktroll_tokenomics_event_proto.Messages().ByName("EventRelayMiningDifficultyUpdated") - fd_EventRelayMiningDifficultyUpdated_service_id = md_EventRelayMiningDifficultyUpdated.Fields().ByName("service_id") - fd_EventRelayMiningDifficultyUpdated_prev_target_hash_hex_encoded = md_EventRelayMiningDifficultyUpdated.Fields().ByName("prev_target_hash_hex_encoded") - fd_EventRelayMiningDifficultyUpdated_new_target_hash_hex_encoded = md_EventRelayMiningDifficultyUpdated.Fields().ByName("new_target_hash_hex_encoded") - fd_EventRelayMiningDifficultyUpdated_prev_num_relays_ema = md_EventRelayMiningDifficultyUpdated.Fields().ByName("prev_num_relays_ema") - fd_EventRelayMiningDifficultyUpdated_new_num_relays_ema = md_EventRelayMiningDifficultyUpdated.Fields().ByName("new_num_relays_ema") -} - -var _ protoreflect.Message = (*fastReflection_EventRelayMiningDifficultyUpdated)(nil) - -type fastReflection_EventRelayMiningDifficultyUpdated EventRelayMiningDifficultyUpdated - -func (x *EventRelayMiningDifficultyUpdated) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventRelayMiningDifficultyUpdated)(x) -} - -func (x *EventRelayMiningDifficultyUpdated) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_EventRelayMiningDifficultyUpdated_messageType fastReflection_EventRelayMiningDifficultyUpdated_messageType -var _ protoreflect.MessageType = fastReflection_EventRelayMiningDifficultyUpdated_messageType{} - -type fastReflection_EventRelayMiningDifficultyUpdated_messageType struct{} - -func (x fastReflection_EventRelayMiningDifficultyUpdated_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventRelayMiningDifficultyUpdated)(nil) -} -func (x fastReflection_EventRelayMiningDifficultyUpdated_messageType) New() protoreflect.Message { - return new(fastReflection_EventRelayMiningDifficultyUpdated) -} -func (x fastReflection_EventRelayMiningDifficultyUpdated_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventRelayMiningDifficultyUpdated -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Descriptor() protoreflect.MessageDescriptor { - return md_EventRelayMiningDifficultyUpdated -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Type() protoreflect.MessageType { - return _fastReflection_EventRelayMiningDifficultyUpdated_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) New() protoreflect.Message { - return new(fastReflection_EventRelayMiningDifficultyUpdated) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Interface() protoreflect.ProtoMessage { - return (*EventRelayMiningDifficultyUpdated)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ServiceId != "" { - value := protoreflect.ValueOfString(x.ServiceId) - if !f(fd_EventRelayMiningDifficultyUpdated_service_id, value) { - return - } - } - if x.PrevTargetHashHexEncoded != "" { - value := protoreflect.ValueOfString(x.PrevTargetHashHexEncoded) - if !f(fd_EventRelayMiningDifficultyUpdated_prev_target_hash_hex_encoded, value) { - return - } - } - if x.NewTargetHashHexEncoded != "" { - value := protoreflect.ValueOfString(x.NewTargetHashHexEncoded) - if !f(fd_EventRelayMiningDifficultyUpdated_new_target_hash_hex_encoded, value) { - return - } - } - if x.PrevNumRelaysEma != uint64(0) { - value := protoreflect.ValueOfUint64(x.PrevNumRelaysEma) - if !f(fd_EventRelayMiningDifficultyUpdated_prev_num_relays_ema, value) { - return - } - } - if x.NewNumRelaysEma != uint64(0) { - value := protoreflect.ValueOfUint64(x.NewNumRelaysEma) - if !f(fd_EventRelayMiningDifficultyUpdated_new_num_relays_ema, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.service_id": - return x.ServiceId != "" - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": - return x.PrevTargetHashHexEncoded != "" - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": - return x.NewTargetHashHexEncoded != "" - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": - return x.PrevNumRelaysEma != uint64(0) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_num_relays_ema": - return x.NewNumRelaysEma != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventRelayMiningDifficultyUpdated")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.service_id": - x.ServiceId = "" - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": - x.PrevTargetHashHexEncoded = "" - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": - x.NewTargetHashHexEncoded = "" - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": - x.PrevNumRelaysEma = uint64(0) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_num_relays_ema": - x.NewNumRelaysEma = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventRelayMiningDifficultyUpdated")) - } - panic(fmt.Errorf("message poktroll.tokenomics.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.service_id": - value := x.ServiceId - return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": - value := x.PrevTargetHashHexEncoded - return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": - value := x.NewTargetHashHexEncoded - return protoreflect.ValueOfString(value) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": - value := x.PrevNumRelaysEma + value := x.ProofRequirement + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "poktroll.tokenomics.EventClaimSettled.num_relays": + value := x.NumRelays return protoreflect.ValueOfUint64(value) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_num_relays_ema": - value := x.NewNumRelaysEma + case "poktroll.tokenomics.EventClaimSettled.num_claimed_compute_units": + value := x.NumClaimedComputeUnits return protoreflect.ValueOfUint64(value) + case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": + value := x.NumEstimatedComputeUnits + return protoreflect.ValueOfUint64(value) + case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": + value := x.ClaimedAmountUpokt + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventRelayMiningDifficultyUpdated")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) } - panic(fmt.Errorf("message poktroll.tokenomics.EventRelayMiningDifficultyUpdated does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", descriptor.FullName())) } } @@ -1387,23 +950,25 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) Get(descriptor protor // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_EventClaimSettled) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.service_id": - x.ServiceId = value.Interface().(string) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": - x.PrevTargetHashHexEncoded = value.Interface().(string) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": - x.NewTargetHashHexEncoded = value.Interface().(string) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": - x.PrevNumRelaysEma = value.Uint() - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_num_relays_ema": - x.NewNumRelaysEma = value.Uint() + case "poktroll.tokenomics.EventClaimSettled.claim": + x.Claim = value.Message().Interface().(*proof.Claim) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + x.ProofRequirement = (proof.ProofRequirementReason)(value.Enum()) + case "poktroll.tokenomics.EventClaimSettled.num_relays": + x.NumRelays = value.Uint() + case "poktroll.tokenomics.EventClaimSettled.num_claimed_compute_units": + x.NumClaimedComputeUnits = value.Uint() + case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": + x.NumEstimatedComputeUnits = value.Uint() + case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": + x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventRelayMiningDifficultyUpdated")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) } - panic(fmt.Errorf("message poktroll.tokenomics.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", fd.FullName())) } } @@ -1417,56 +982,68 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) Set(fd protoreflect.F // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventClaimSettled) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.service_id": - panic(fmt.Errorf("field service_id of message poktroll.tokenomics.EventRelayMiningDifficultyUpdated is not mutable")) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": - panic(fmt.Errorf("field prev_target_hash_hex_encoded of message poktroll.tokenomics.EventRelayMiningDifficultyUpdated is not mutable")) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": - panic(fmt.Errorf("field new_target_hash_hex_encoded of message poktroll.tokenomics.EventRelayMiningDifficultyUpdated is not mutable")) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": - panic(fmt.Errorf("field prev_num_relays_ema of message poktroll.tokenomics.EventRelayMiningDifficultyUpdated is not mutable")) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_num_relays_ema": - panic(fmt.Errorf("field new_num_relays_ema of message poktroll.tokenomics.EventRelayMiningDifficultyUpdated is not mutable")) + case "poktroll.tokenomics.EventClaimSettled.claim": + if x.Claim == nil { + x.Claim = new(proof.Claim) + } + return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + panic(fmt.Errorf("field proof_requirement of message poktroll.tokenomics.EventClaimSettled is not mutable")) + case "poktroll.tokenomics.EventClaimSettled.num_relays": + panic(fmt.Errorf("field num_relays of message poktroll.tokenomics.EventClaimSettled is not mutable")) + case "poktroll.tokenomics.EventClaimSettled.num_claimed_compute_units": + panic(fmt.Errorf("field num_claimed_compute_units of message poktroll.tokenomics.EventClaimSettled is not mutable")) + case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": + panic(fmt.Errorf("field num_estimated_compute_units of message poktroll.tokenomics.EventClaimSettled is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventRelayMiningDifficultyUpdated")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) } - panic(fmt.Errorf("message poktroll.tokenomics.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventClaimSettled) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.service_id": - return protoreflect.ValueOfString("") - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_target_hash_hex_encoded": - return protoreflect.ValueOfString("") - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_target_hash_hex_encoded": - return protoreflect.ValueOfString("") - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.prev_num_relays_ema": + case "poktroll.tokenomics.EventClaimSettled.claim": + m := new(proof.Claim) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.tokenomics.EventClaimSettled.proof_requirement": + return protoreflect.ValueOfEnum(0) + case "poktroll.tokenomics.EventClaimSettled.num_relays": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.tokenomics.EventRelayMiningDifficultyUpdated.new_num_relays_ema": + case "poktroll.tokenomics.EventClaimSettled.num_claimed_compute_units": return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": + return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventRelayMiningDifficultyUpdated")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) } - panic(fmt.Errorf("message poktroll.tokenomics.EventRelayMiningDifficultyUpdated does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.tokenomics.EventClaimSettled does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_EventClaimSettled) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.EventRelayMiningDifficultyUpdated", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.EventClaimSettled", d.FullName())) } panic("unreachable") } @@ -1474,7 +1051,7 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) WhichOneof(d protoref // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_EventClaimSettled) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1485,7 +1062,7 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) GetUnknown() protoref // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_EventClaimSettled) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1497,7 +1074,7 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) SetUnknown(fields pro // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) IsValid() bool { +func (x *fastReflection_EventClaimSettled) IsValid() bool { return x != nil } @@ -1507,9 +1084,9 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventRelayMiningDifficultyUpdated) + x := input.Message.Interface().(*EventClaimSettled) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1521,23 +1098,25 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto var n int var l int _ = l - l = len(x.ServiceId) - if l > 0 { + if x.Claim != nil { + l = options.Size(x.Claim) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.PrevTargetHashHexEncoded) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if x.ProofRequirement != 0 { + n += 1 + runtime.Sov(uint64(x.ProofRequirement)) } - l = len(x.NewTargetHashHexEncoded) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if x.NumRelays != 0 { + n += 1 + runtime.Sov(uint64(x.NumRelays)) + } + if x.NumClaimedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumClaimedComputeUnits)) } - if x.PrevNumRelaysEma != 0 { - n += 1 + runtime.Sov(uint64(x.PrevNumRelaysEma)) + if x.NumEstimatedComputeUnits != 0 { + n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) } - if x.NewNumRelaysEma != 0 { - n += 1 + runtime.Sov(uint64(x.NewNumRelaysEma)) + if x.ClaimedAmountUpokt != nil { + l = options.Size(x.ClaimedAmountUpokt) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1549,7 +1128,7 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventRelayMiningDifficultyUpdated) + x := input.Message.Interface().(*EventClaimSettled) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1568,34 +1147,51 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.NewNumRelaysEma != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.NewNumRelaysEma)) + if x.ClaimedAmountUpokt != nil { + encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + if x.NumEstimatedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumEstimatedComputeUnits)) i-- dAtA[i] = 0x28 } - if x.PrevNumRelaysEma != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.PrevNumRelaysEma)) + if x.NumClaimedComputeUnits != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } - if len(x.NewTargetHashHexEncoded) > 0 { - i -= len(x.NewTargetHashHexEncoded) - copy(dAtA[i:], x.NewTargetHashHexEncoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.NewTargetHashHexEncoded))) + if x.NumRelays != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumRelays)) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x18 } - if len(x.PrevTargetHashHexEncoded) > 0 { - i -= len(x.PrevTargetHashHexEncoded) - copy(dAtA[i:], x.PrevTargetHashHexEncoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PrevTargetHashHexEncoded))) + if x.ProofRequirement != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ProofRequirement)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if len(x.ServiceId) > 0 { - i -= len(x.ServiceId) - copy(dAtA[i:], x.ServiceId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) + if x.Claim != nil { + encoded, err := options.Marshal(x.Claim) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0xa } @@ -1610,7 +1206,7 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventRelayMiningDifficultyUpdated) + x := input.Message.Interface().(*EventClaimSettled) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1642,17 +1238,17 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventClaimSettled: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventClaimSettled: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1662,29 +1258,33 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.ServiceId = string(dAtA[iNdEx:postIndex]) + if x.Claim == nil { + x.Claim = &proof.Claim{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PrevTargetHashHexEncoded", wireType) + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofRequirement", wireType) } - var stringLen uint64 + x.ProofRequirement = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1694,29 +1294,16 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + x.ProofRequirement |= proof.ProofRequirementReason(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.PrevTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NewTargetHashHexEncoded", wireType) + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumRelays", wireType) } - var stringLen uint64 + x.NumRelays = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1726,29 +1313,16 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + x.NumRelays |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.NewTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 4: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PrevNumRelaysEma", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) } - x.PrevNumRelaysEma = 0 + x.NumClaimedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1758,16 +1332,35 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto } b := dAtA[iNdEx] iNdEx++ - x.PrevNumRelaysEma |= uint64(b&0x7F) << shift + x.NumClaimedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 5: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NewNumRelaysEma", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + x.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) } - x.NewNumRelaysEma = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1777,11 +1370,28 @@ func (x *fastReflection_EventRelayMiningDifficultyUpdated) ProtoMethods() *proto } b := dAtA[iNdEx] iNdEx++ - x.NewNumRelaysEma |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ClaimedAmountUpokt == nil { + x.ClaimedAmountUpokt = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1843,7 +1453,7 @@ func (x *EventApplicationOverserviced) ProtoReflect() protoreflect.Message { } func (x *EventApplicationOverserviced) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[3] + mi := &file_poktroll_tokenomics_event_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2483,7 +2093,7 @@ func (x *EventSupplierSlashed) ProtoReflect() protoreflect.Message { } func (x *EventSupplierSlashed) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[4] + mi := &file_poktroll_tokenomics_event_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3083,7 +2693,13 @@ type EventClaimExpired struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` // Number of compute units claimed as a function of the number of relays // and the compute units per relay for the particular service. - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` + // Number of estimated compute units claimed as a function of the number of claimed + // compute units and the relay difficulty multiplier for the particular service. + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` + // The amount of uPOKT claimed to be rewarded for the work done as a function of + // the number of estimated compute units and the compute uints to token multiplier. + ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` } func (x *EventClaimExpired) Reset() { @@ -3127,13 +2743,27 @@ func (x *EventClaimExpired) GetNumRelays() uint64 { return 0 } -func (x *EventClaimExpired) GetNumComputeUnits() uint64 { +func (x *EventClaimExpired) GetNumClaimedComputeUnits() uint64 { + if x != nil { + return x.NumClaimedComputeUnits + } + return 0 +} + +func (x *EventClaimExpired) GetNumEstimatedComputeUnits() uint64 { if x != nil { - return x.NumComputeUnits + return x.NumEstimatedComputeUnits } return 0 } +func (x *EventClaimExpired) GetClaimedAmountUpokt() *v1beta1.Coin { + if x != nil { + return x.ClaimedAmountUpokt + } + return nil +} + // EventClaimSettled is an event emitted whenever a claim is settled. // The proof_required determines whether the claim requires a proof that has been submitted or not type EventClaimSettled struct { @@ -3148,7 +2778,13 @@ type EventClaimSettled struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` // Number of compute units claimed as a function of the number of relays // and the compute units per relay for the particular service. - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units,omitempty"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` + // Number of estimated compute units claimed as a function of the number of claimed + // compute units and the relay difficulty multiplier for the particular service. + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` + // The amount of uPOKT claimed to be rewarded for the work done as a function of + // the number of estimated compute units and the compute uints to token multiplier. + ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` } func (x *EventClaimSettled) Reset() { @@ -3192,80 +2828,25 @@ func (x *EventClaimSettled) GetNumRelays() uint64 { return 0 } -func (x *EventClaimSettled) GetNumComputeUnits() uint64 { +func (x *EventClaimSettled) GetNumClaimedComputeUnits() uint64 { if x != nil { - return x.NumComputeUnits + return x.NumClaimedComputeUnits } return 0 } -// EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated -// for a given service. -type EventRelayMiningDifficultyUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - PrevTargetHashHexEncoded string `protobuf:"bytes,2,opt,name=prev_target_hash_hex_encoded,json=prevTargetHashHexEncoded,proto3" json:"prev_target_hash_hex_encoded,omitempty"` - NewTargetHashHexEncoded string `protobuf:"bytes,3,opt,name=new_target_hash_hex_encoded,json=newTargetHashHexEncoded,proto3" json:"new_target_hash_hex_encoded,omitempty"` - PrevNumRelaysEma uint64 `protobuf:"varint,4,opt,name=prev_num_relays_ema,json=prevNumRelaysEma,proto3" json:"prev_num_relays_ema,omitempty"` - NewNumRelaysEma uint64 `protobuf:"varint,5,opt,name=new_num_relays_ema,json=newNumRelaysEma,proto3" json:"new_num_relays_ema,omitempty"` -} - -func (x *EventRelayMiningDifficultyUpdated) Reset() { - *x = EventRelayMiningDifficultyUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventRelayMiningDifficultyUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventRelayMiningDifficultyUpdated) ProtoMessage() {} - -// Deprecated: Use EventRelayMiningDifficultyUpdated.ProtoReflect.Descriptor instead. -func (*EventRelayMiningDifficultyUpdated) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_event_proto_rawDescGZIP(), []int{2} -} - -func (x *EventRelayMiningDifficultyUpdated) GetServiceId() string { - if x != nil { - return x.ServiceId - } - return "" -} - -func (x *EventRelayMiningDifficultyUpdated) GetPrevTargetHashHexEncoded() string { - if x != nil { - return x.PrevTargetHashHexEncoded - } - return "" -} - -func (x *EventRelayMiningDifficultyUpdated) GetNewTargetHashHexEncoded() string { - if x != nil { - return x.NewTargetHashHexEncoded - } - return "" -} - -func (x *EventRelayMiningDifficultyUpdated) GetPrevNumRelaysEma() uint64 { +func (x *EventClaimSettled) GetNumEstimatedComputeUnits() uint64 { if x != nil { - return x.PrevNumRelaysEma + return x.NumEstimatedComputeUnits } return 0 } -func (x *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { +func (x *EventClaimSettled) GetClaimedAmountUpokt() *v1beta1.Coin { if x != nil { - return x.NewNumRelaysEma + return x.ClaimedAmountUpokt } - return 0 + return nil } // EventApplicationOverserviced is emitted when an application has less stake than @@ -3292,7 +2873,7 @@ type EventApplicationOverserviced struct { func (x *EventApplicationOverserviced) Reset() { *x = EventApplicationOverserviced{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[3] + mi := &file_poktroll_tokenomics_event_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3306,7 +2887,7 @@ func (*EventApplicationOverserviced) ProtoMessage() {} // Deprecated: Use EventApplicationOverserviced.ProtoReflect.Descriptor instead. func (*EventApplicationOverserviced) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_event_proto_rawDescGZIP(), []int{3} + return file_poktroll_tokenomics_event_proto_rawDescGZIP(), []int{2} } func (x *EventApplicationOverserviced) GetApplicationAddr() string { @@ -3355,7 +2936,7 @@ type EventSupplierSlashed struct { func (x *EventSupplierSlashed) Reset() { *x = EventSupplierSlashed{} if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_event_proto_msgTypes[4] + mi := &file_poktroll_tokenomics_event_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3369,7 +2950,7 @@ func (*EventSupplierSlashed) ProtoMessage() {} // Deprecated: Use EventSupplierSlashed.ProtoReflect.Descriptor instead. func (*EventSupplierSlashed) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_event_proto_rawDescGZIP(), []int{4} + return file_poktroll_tokenomics_event_proto_rawDescGZIP(), []int{3} } func (x *EventSupplierSlashed) GetSupplierOperatorAddr() string { @@ -3404,7 +2985,7 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xad, 0x02, 0x0a, 0x11, 0x45, 0x76, 0x65, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8b, 0x04, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, @@ -3419,95 +3000,104 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, - 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, - 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, - 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x22, 0xa9, 0x02, 0x0a, 0x11, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x12, 0x36, - 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, - 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x6a, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, - 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x70, - 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, - 0x73, 0x12, 0x41, 0x0a, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, - 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x15, 0xea, 0xde, - 0x1f, 0x11, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, - 0x69, 0x74, 0x73, 0x52, 0x0f, 0x6e, 0x75, 0x6d, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, - 0x6e, 0x69, 0x74, 0x73, 0x22, 0x9c, 0x02, 0x0a, 0x21, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, - 0x6c, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3e, 0x0a, 0x1c, 0x70, 0x72, 0x65, - 0x76, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x65, - 0x78, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x18, 0x70, 0x72, 0x65, 0x76, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, - 0x65, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x1b, 0x6e, 0x65, 0x77, - 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x65, 0x78, - 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, - 0x6e, 0x65, 0x77, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, - 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x13, 0x70, 0x72, 0x65, 0x76, 0x5f, - 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x72, 0x65, 0x76, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x6c, - 0x61, 0x79, 0x73, 0x45, 0x6d, 0x61, 0x12, 0x2b, 0x0a, 0x12, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x75, - 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0f, 0x6e, 0x65, 0x77, 0x4e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, - 0x45, 0x6d, 0x61, 0x22, 0x81, 0x02, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, - 0x34, 0x0a, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x14, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, - 0x64, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, - 0x64, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, - 0x76, 0x65, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x42, 0x75, 0x72, 0x6e, 0x22, 0xbe, 0x01, 0x0a, 0x14, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x64, - 0x12, 0x34, 0x0a, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x14, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x78, - 0x70, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x10, 0x6e, 0x75, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x43, 0x6c, - 0x61, 0x69, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, - 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, + 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, + 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, + 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, + 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, + 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, + 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, + 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, + 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, - 0x6e, 0x67, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, - 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, - 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, - 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 0x42, 0xbc, 0x01, 0xd8, 0xe2, 0x1e, - 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, - 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, - 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, + 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0x87, 0x04, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, + 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, + 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, + 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x6a, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, + 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x10, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, + 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, + 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, + 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, + 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, + 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, + 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, + 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, + 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, + 0x22, 0x81, 0x02, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x64, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x34, 0x0a, 0x16, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x62, + 0x75, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x42, 0x75, + 0x72, 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, + 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x42, 0x75, 0x72, 0x6e, 0x22, 0xbe, 0x01, 0x0a, 0x14, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x64, 0x12, 0x34, 0x0a, + 0x16, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, + 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x10, 0x6e, 0x75, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x73, 0x12, 0x42, 0x0a, 0x0f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, + 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x21, + 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, + 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, + 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x49, 0x4e, + 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 0x42, 0xbc, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x17, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, + 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3523,31 +3113,32 @@ func file_poktroll_tokenomics_event_proto_rawDescGZIP() []byte { } var file_poktroll_tokenomics_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_poktroll_tokenomics_event_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_poktroll_tokenomics_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_poktroll_tokenomics_event_proto_goTypes = []interface{}{ - (ClaimExpirationReason)(0), // 0: poktroll.tokenomics.ClaimExpirationReason - (*EventClaimExpired)(nil), // 1: poktroll.tokenomics.EventClaimExpired - (*EventClaimSettled)(nil), // 2: poktroll.tokenomics.EventClaimSettled - (*EventRelayMiningDifficultyUpdated)(nil), // 3: poktroll.tokenomics.EventRelayMiningDifficultyUpdated - (*EventApplicationOverserviced)(nil), // 4: poktroll.tokenomics.EventApplicationOverserviced - (*EventSupplierSlashed)(nil), // 5: poktroll.tokenomics.EventSupplierSlashed - (*proof.Claim)(nil), // 6: poktroll.proof.Claim - (proof.ProofRequirementReason)(0), // 7: poktroll.proof.ProofRequirementReason - (*v1beta1.Coin)(nil), // 8: cosmos.base.v1beta1.Coin + (ClaimExpirationReason)(0), // 0: poktroll.tokenomics.ClaimExpirationReason + (*EventClaimExpired)(nil), // 1: poktroll.tokenomics.EventClaimExpired + (*EventClaimSettled)(nil), // 2: poktroll.tokenomics.EventClaimSettled + (*EventApplicationOverserviced)(nil), // 3: poktroll.tokenomics.EventApplicationOverserviced + (*EventSupplierSlashed)(nil), // 4: poktroll.tokenomics.EventSupplierSlashed + (*proof.Claim)(nil), // 5: poktroll.proof.Claim + (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin + (proof.ProofRequirementReason)(0), // 7: poktroll.proof.ProofRequirementReason } var file_poktroll_tokenomics_event_proto_depIdxs = []int32{ - 6, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim + 5, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim 0, // 1: poktroll.tokenomics.EventClaimExpired.expiration_reason:type_name -> poktroll.tokenomics.ClaimExpirationReason - 6, // 2: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim - 7, // 3: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason - 8, // 4: poktroll.tokenomics.EventApplicationOverserviced.expected_burn:type_name -> cosmos.base.v1beta1.Coin - 8, // 5: poktroll.tokenomics.EventApplicationOverserviced.effective_burn:type_name -> cosmos.base.v1beta1.Coin - 8, // 6: poktroll.tokenomics.EventSupplierSlashed.slashing_amount:type_name -> cosmos.base.v1beta1.Coin - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 6, // 2: poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 3: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim + 7, // 4: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason + 6, // 5: poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 6, // 6: poktroll.tokenomics.EventApplicationOverserviced.expected_burn:type_name -> cosmos.base.v1beta1.Coin + 6, // 7: poktroll.tokenomics.EventApplicationOverserviced.effective_burn:type_name -> cosmos.base.v1beta1.Coin + 6, // 8: poktroll.tokenomics.EventSupplierSlashed.slashing_amount:type_name -> cosmos.base.v1beta1.Coin + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_poktroll_tokenomics_event_proto_init() } @@ -3581,18 +3172,6 @@ func file_poktroll_tokenomics_event_proto_init() { } } file_poktroll_tokenomics_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventRelayMiningDifficultyUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_poktroll_tokenomics_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventApplicationOverserviced); i { case 0: return &v.state @@ -3604,7 +3183,7 @@ func file_poktroll_tokenomics_event_proto_init() { return nil } } - file_poktroll_tokenomics_event_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_poktroll_tokenomics_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventSupplierSlashed); i { case 0: return &v.state @@ -3623,7 +3202,7 @@ func file_poktroll_tokenomics_event_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_tokenomics_event_proto_rawDesc, NumEnums: 1, - NumMessages: 5, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/api/poktroll/tokenomics/genesis.pulsar.go b/api/poktroll/tokenomics/genesis.pulsar.go index 4548720da..812075f01 100644 --- a/api/poktroll/tokenomics/genesis.pulsar.go +++ b/api/poktroll/tokenomics/genesis.pulsar.go @@ -14,68 +14,15 @@ import ( sync "sync" ) -var _ protoreflect.List = (*_GenesisState_2_list)(nil) - -type _GenesisState_2_list struct { - list *[]*RelayMiningDifficulty -} - -func (x *_GenesisState_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) - (*x.list)[i] = concreteValue -} - -func (x *_GenesisState_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { - v := new(RelayMiningDifficulty) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GenesisState_2_list) NewElement() protoreflect.Value { - v := new(RelayMiningDifficulty) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) IsValid() bool { - return x.list != nil -} - var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor - fd_GenesisState_relayMiningDifficultyList protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor ) func init() { file_poktroll_tokenomics_genesis_proto_init() md_GenesisState = File_poktroll_tokenomics_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") - fd_GenesisState_relayMiningDifficultyList = md_GenesisState.Fields().ByName("relayMiningDifficultyList") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -149,12 +96,6 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, return } } - if len(x.RelayMiningDifficultyList) != 0 { - value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.RelayMiningDifficultyList}) - if !f(fd_GenesisState_relayMiningDifficultyList, value) { - return - } - } } // Has reports whether a field is populated. @@ -172,8 +113,6 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "poktroll.tokenomics.GenesisState.params": return x.Params != nil - case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": - return len(x.RelayMiningDifficultyList) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -192,8 +131,6 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.tokenomics.GenesisState.params": x.Params = nil - case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": - x.RelayMiningDifficultyList = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -213,12 +150,6 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "poktroll.tokenomics.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": - if len(x.RelayMiningDifficultyList) == 0 { - return protoreflect.ValueOfList(&_GenesisState_2_list{}) - } - listValue := &_GenesisState_2_list{list: &x.RelayMiningDifficultyList} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -241,10 +172,6 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "poktroll.tokenomics.GenesisState.params": x.Params = value.Message().Interface().(*Params) - case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": - lv := value.List() - clv := lv.(*_GenesisState_2_list) - x.RelayMiningDifficultyList = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -270,12 +197,6 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p x.Params = new(Params) } return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": - if x.RelayMiningDifficultyList == nil { - x.RelayMiningDifficultyList = []*RelayMiningDifficulty{} - } - value := &_GenesisState_2_list{list: &x.RelayMiningDifficultyList} - return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -292,9 +213,6 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "poktroll.tokenomics.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "poktroll.tokenomics.GenesisState.relayMiningDifficultyList": - list := []*RelayMiningDifficulty{} - return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) @@ -368,12 +286,6 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.RelayMiningDifficultyList) > 0 { - for _, e := range x.RelayMiningDifficultyList { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -403,22 +315,6 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.RelayMiningDifficultyList) > 0 { - for iNdEx := len(x.RelayMiningDifficultyList) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.RelayMiningDifficultyList[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } if x.Params != nil { encoded, err := options.Marshal(x.Params) if err != nil { @@ -518,40 +414,6 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficultyList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.RelayMiningDifficultyList = append(x.RelayMiningDifficultyList, &RelayMiningDifficulty{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficultyList[len(x.RelayMiningDifficultyList)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -607,8 +469,7 @@ type GenesisState struct { unknownFields protoimpl.UnknownFields // params defines all the parameters of the module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - RelayMiningDifficultyList []*RelayMiningDifficulty `protobuf:"bytes,2,rep,name=relayMiningDifficultyList,proto3" json:"relayMiningDifficultyList,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (x *GenesisState) Reset() { @@ -638,13 +499,6 @@ func (x *GenesisState) GetParams() *Params { return nil } -func (x *GenesisState) GetRelayMiningDifficultyList() []*RelayMiningDifficulty { - if x != nil { - return x.RelayMiningDifficultyList - } - return nil -} - var File_poktroll_tokenomics_genesis_proto protoreflect.FileDescriptor var file_poktroll_tokenomics_genesis_proto_rawDesc = []byte{ @@ -656,34 +510,24 @@ var file_poktroll_tokenomics_genesis_proto_rawDesc = []byte{ 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x31, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, - 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, - 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x6e, 0x0a, 0x19, 0x72, 0x65, 0x6c, 0x61, 0x79, - 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, - 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, - 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, - 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x19, 0x72, 0x65, - 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, - 0x6c, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xbe, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x17, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, - 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, - 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x74, 0x6f, 0x22, 0x4e, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0xbe, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, + 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, + 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -700,18 +544,16 @@ func file_poktroll_tokenomics_genesis_proto_rawDescGZIP() []byte { var file_poktroll_tokenomics_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_tokenomics_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: poktroll.tokenomics.GenesisState - (*Params)(nil), // 1: poktroll.tokenomics.Params - (*RelayMiningDifficulty)(nil), // 2: poktroll.tokenomics.RelayMiningDifficulty + (*GenesisState)(nil), // 0: poktroll.tokenomics.GenesisState + (*Params)(nil), // 1: poktroll.tokenomics.Params } var file_poktroll_tokenomics_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.tokenomics.GenesisState.params:type_name -> poktroll.tokenomics.Params - 2, // 1: poktroll.tokenomics.GenesisState.relayMiningDifficultyList:type_name -> poktroll.tokenomics.RelayMiningDifficulty - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_tokenomics_genesis_proto_init() } @@ -720,7 +562,6 @@ func file_poktroll_tokenomics_genesis_proto_init() { return } file_poktroll_tokenomics_params_proto_init() - file_poktroll_tokenomics_relay_mining_difficulty_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_tokenomics_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GenesisState); i { diff --git a/api/poktroll/tokenomics/query.pulsar.go b/api/poktroll/tokenomics/query.pulsar.go index b3e903f40..505ea2dac 100644 --- a/api/poktroll/tokenomics/query.pulsar.go +++ b/api/poktroll/tokenomics/query.pulsar.go @@ -3,8 +3,6 @@ package tokenomics import ( _ "cosmossdk.io/api/amino" - v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" - _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" @@ -809,1869 +807,6 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } } -var ( - md_QueryGetRelayMiningDifficultyRequest protoreflect.MessageDescriptor - fd_QueryGetRelayMiningDifficultyRequest_serviceId protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_tokenomics_query_proto_init() - md_QueryGetRelayMiningDifficultyRequest = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryGetRelayMiningDifficultyRequest") - fd_QueryGetRelayMiningDifficultyRequest_serviceId = md_QueryGetRelayMiningDifficultyRequest.Fields().ByName("serviceId") -} - -var _ protoreflect.Message = (*fastReflection_QueryGetRelayMiningDifficultyRequest)(nil) - -type fastReflection_QueryGetRelayMiningDifficultyRequest QueryGetRelayMiningDifficultyRequest - -func (x *QueryGetRelayMiningDifficultyRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryGetRelayMiningDifficultyRequest)(x) -} - -func (x *QueryGetRelayMiningDifficultyRequest) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryGetRelayMiningDifficultyRequest_messageType fastReflection_QueryGetRelayMiningDifficultyRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryGetRelayMiningDifficultyRequest_messageType{} - -type fastReflection_QueryGetRelayMiningDifficultyRequest_messageType struct{} - -func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryGetRelayMiningDifficultyRequest)(nil) -} -func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryGetRelayMiningDifficultyRequest) -} -func (x fastReflection_QueryGetRelayMiningDifficultyRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryGetRelayMiningDifficultyRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryGetRelayMiningDifficultyRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryGetRelayMiningDifficultyRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) New() protoreflect.Message { - return new(fastReflection_QueryGetRelayMiningDifficultyRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Interface() protoreflect.ProtoMessage { - return (*QueryGetRelayMiningDifficultyRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ServiceId != "" { - value := protoreflect.ValueOfString(x.ServiceId) - if !f(fd_QueryGetRelayMiningDifficultyRequest_serviceId, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": - return x.ServiceId != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": - x.ServiceId = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": - value := x.ServiceId - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": - x.ServiceId = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": - panic(fmt.Errorf("field serviceId of message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest.serviceId": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryGetRelayMiningDifficultyRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryGetRelayMiningDifficultyRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.ServiceId) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryGetRelayMiningDifficultyRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ServiceId) > 0 { - i -= len(x.ServiceId) - copy(dAtA[i:], x.ServiceId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ServiceId))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryGetRelayMiningDifficultyRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.ServiceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryGetRelayMiningDifficultyResponse protoreflect.MessageDescriptor - fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_tokenomics_query_proto_init() - md_QueryGetRelayMiningDifficultyResponse = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryGetRelayMiningDifficultyResponse") - fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty = md_QueryGetRelayMiningDifficultyResponse.Fields().ByName("relayMiningDifficulty") -} - -var _ protoreflect.Message = (*fastReflection_QueryGetRelayMiningDifficultyResponse)(nil) - -type fastReflection_QueryGetRelayMiningDifficultyResponse QueryGetRelayMiningDifficultyResponse - -func (x *QueryGetRelayMiningDifficultyResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryGetRelayMiningDifficultyResponse)(x) -} - -func (x *QueryGetRelayMiningDifficultyResponse) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryGetRelayMiningDifficultyResponse_messageType fastReflection_QueryGetRelayMiningDifficultyResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryGetRelayMiningDifficultyResponse_messageType{} - -type fastReflection_QueryGetRelayMiningDifficultyResponse_messageType struct{} - -func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryGetRelayMiningDifficultyResponse)(nil) -} -func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryGetRelayMiningDifficultyResponse) -} -func (x fastReflection_QueryGetRelayMiningDifficultyResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryGetRelayMiningDifficultyResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryGetRelayMiningDifficultyResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryGetRelayMiningDifficultyResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) New() protoreflect.Message { - return new(fastReflection_QueryGetRelayMiningDifficultyResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Interface() protoreflect.ProtoMessage { - return (*QueryGetRelayMiningDifficultyResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.RelayMiningDifficulty != nil { - value := protoreflect.ValueOfMessage(x.RelayMiningDifficulty.ProtoReflect()) - if !f(fd_QueryGetRelayMiningDifficultyResponse_relayMiningDifficulty, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": - return x.RelayMiningDifficulty != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": - x.RelayMiningDifficulty = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": - value := x.RelayMiningDifficulty - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": - x.RelayMiningDifficulty = value.Message().Interface().(*RelayMiningDifficulty) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": - if x.RelayMiningDifficulty == nil { - x.RelayMiningDifficulty = new(RelayMiningDifficulty) - } - return protoreflect.ValueOfMessage(x.RelayMiningDifficulty.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty": - m := new(RelayMiningDifficulty) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryGetRelayMiningDifficultyResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryGetRelayMiningDifficultyResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.RelayMiningDifficulty != nil { - l = options.Size(x.RelayMiningDifficulty) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryGetRelayMiningDifficultyResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.RelayMiningDifficulty != nil { - encoded, err := options.Marshal(x.RelayMiningDifficulty) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryGetRelayMiningDifficultyResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.RelayMiningDifficulty == nil { - x.RelayMiningDifficulty = &RelayMiningDifficulty{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficulty); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryAllRelayMiningDifficultyRequest protoreflect.MessageDescriptor - fd_QueryAllRelayMiningDifficultyRequest_pagination protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_tokenomics_query_proto_init() - md_QueryAllRelayMiningDifficultyRequest = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryAllRelayMiningDifficultyRequest") - fd_QueryAllRelayMiningDifficultyRequest_pagination = md_QueryAllRelayMiningDifficultyRequest.Fields().ByName("pagination") -} - -var _ protoreflect.Message = (*fastReflection_QueryAllRelayMiningDifficultyRequest)(nil) - -type fastReflection_QueryAllRelayMiningDifficultyRequest QueryAllRelayMiningDifficultyRequest - -func (x *QueryAllRelayMiningDifficultyRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllRelayMiningDifficultyRequest)(x) -} - -func (x *QueryAllRelayMiningDifficultyRequest) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryAllRelayMiningDifficultyRequest_messageType fastReflection_QueryAllRelayMiningDifficultyRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllRelayMiningDifficultyRequest_messageType{} - -type fastReflection_QueryAllRelayMiningDifficultyRequest_messageType struct{} - -func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllRelayMiningDifficultyRequest)(nil) -} -func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllRelayMiningDifficultyRequest) -} -func (x fastReflection_QueryAllRelayMiningDifficultyRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllRelayMiningDifficultyRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllRelayMiningDifficultyRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryAllRelayMiningDifficultyRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) New() protoreflect.Message { - return new(fastReflection_QueryAllRelayMiningDifficultyRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Interface() protoreflect.ProtoMessage { - return (*QueryAllRelayMiningDifficultyRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Pagination != nil { - value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllRelayMiningDifficultyRequest_pagination, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": - return x.Pagination != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": - x.Pagination = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": - value := x.Pagination - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": - x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": - if x.Pagination == nil { - x.Pagination = new(v1beta1.PageRequest) - } - return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination": - m := new(v1beta1.PageRequest) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllRelayMiningDifficultyRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllRelayMiningDifficultyRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Pagination != nil { - l = options.Size(x.Pagination) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllRelayMiningDifficultyRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Pagination != nil { - encoded, err := options.Marshal(x.Pagination) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllRelayMiningDifficultyRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Pagination == nil { - x.Pagination = &v1beta1.PageRequest{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_QueryAllRelayMiningDifficultyResponse_1_list)(nil) - -type _QueryAllRelayMiningDifficultyResponse_1_list struct { - list *[]*RelayMiningDifficulty -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) - (*x.list)[i] = concreteValue -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*RelayMiningDifficulty) - *x.list = append(*x.list, concreteValue) -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) AppendMutable() protoreflect.Value { - v := new(RelayMiningDifficulty) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) NewElement() protoreflect.Value { - v := new(RelayMiningDifficulty) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_QueryAllRelayMiningDifficultyResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_QueryAllRelayMiningDifficultyResponse protoreflect.MessageDescriptor - fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty protoreflect.FieldDescriptor - fd_QueryAllRelayMiningDifficultyResponse_pagination protoreflect.FieldDescriptor -) - -func init() { - file_poktroll_tokenomics_query_proto_init() - md_QueryAllRelayMiningDifficultyResponse = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryAllRelayMiningDifficultyResponse") - fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty = md_QueryAllRelayMiningDifficultyResponse.Fields().ByName("relayMiningDifficulty") - fd_QueryAllRelayMiningDifficultyResponse_pagination = md_QueryAllRelayMiningDifficultyResponse.Fields().ByName("pagination") -} - -var _ protoreflect.Message = (*fastReflection_QueryAllRelayMiningDifficultyResponse)(nil) - -type fastReflection_QueryAllRelayMiningDifficultyResponse QueryAllRelayMiningDifficultyResponse - -func (x *QueryAllRelayMiningDifficultyResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllRelayMiningDifficultyResponse)(x) -} - -func (x *QueryAllRelayMiningDifficultyResponse) slowProtoReflect() protoreflect.Message { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryAllRelayMiningDifficultyResponse_messageType fastReflection_QueryAllRelayMiningDifficultyResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllRelayMiningDifficultyResponse_messageType{} - -type fastReflection_QueryAllRelayMiningDifficultyResponse_messageType struct{} - -func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllRelayMiningDifficultyResponse)(nil) -} -func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllRelayMiningDifficultyResponse) -} -func (x fastReflection_QueryAllRelayMiningDifficultyResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllRelayMiningDifficultyResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllRelayMiningDifficultyResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryAllRelayMiningDifficultyResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) New() protoreflect.Message { - return new(fastReflection_QueryAllRelayMiningDifficultyResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Interface() protoreflect.ProtoMessage { - return (*QueryAllRelayMiningDifficultyResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.RelayMiningDifficulty) != 0 { - value := protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty}) - if !f(fd_QueryAllRelayMiningDifficultyResponse_relayMiningDifficulty, value) { - return - } - } - if x.Pagination != nil { - value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllRelayMiningDifficultyResponse_pagination, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": - return len(x.RelayMiningDifficulty) != 0 - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": - return x.Pagination != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": - x.RelayMiningDifficulty = nil - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": - x.Pagination = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": - if len(x.RelayMiningDifficulty) == 0 { - return protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{}) - } - listValue := &_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty} - return protoreflect.ValueOfList(listValue) - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": - value := x.Pagination - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": - lv := value.List() - clv := lv.(*_QueryAllRelayMiningDifficultyResponse_1_list) - x.RelayMiningDifficulty = *clv.list - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": - x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": - if x.RelayMiningDifficulty == nil { - x.RelayMiningDifficulty = []*RelayMiningDifficulty{} - } - value := &_QueryAllRelayMiningDifficultyResponse_1_list{list: &x.RelayMiningDifficulty} - return protoreflect.ValueOfList(value) - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": - if x.Pagination == nil { - x.Pagination = new(v1beta1.PageResponse) - } - return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty": - list := []*RelayMiningDifficulty{} - return protoreflect.ValueOfList(&_QueryAllRelayMiningDifficultyResponse_1_list{list: &list}) - case "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination": - m := new(v1beta1.PageResponse) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse")) - } - panic(fmt.Errorf("message poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllRelayMiningDifficultyResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllRelayMiningDifficultyResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.RelayMiningDifficulty) > 0 { - for _, e := range x.RelayMiningDifficulty { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.Pagination != nil { - l = options.Size(x.Pagination) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllRelayMiningDifficultyResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Pagination != nil { - encoded, err := options.Marshal(x.Pagination) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if len(x.RelayMiningDifficulty) > 0 { - for iNdEx := len(x.RelayMiningDifficulty) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.RelayMiningDifficulty[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllRelayMiningDifficultyResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.RelayMiningDifficulty = append(x.RelayMiningDifficulty, &RelayMiningDifficulty{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RelayMiningDifficulty[len(x.RelayMiningDifficulty)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Pagination == nil { - x.Pagination = &v1beta1.PageResponse{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2749,154 +884,6 @@ func (x *QueryParamsResponse) GetParams() *Params { return nil } -type QueryGetRelayMiningDifficultyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceId string `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"` -} - -func (x *QueryGetRelayMiningDifficultyRequest) Reset() { - *x = QueryGetRelayMiningDifficultyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryGetRelayMiningDifficultyRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryGetRelayMiningDifficultyRequest) ProtoMessage() {} - -// Deprecated: Use QueryGetRelayMiningDifficultyRequest.ProtoReflect.Descriptor instead. -func (*QueryGetRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{2} -} - -func (x *QueryGetRelayMiningDifficultyRequest) GetServiceId() string { - if x != nil { - return x.ServiceId - } - return "" -} - -type QueryGetRelayMiningDifficultyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RelayMiningDifficulty *RelayMiningDifficulty `protobuf:"bytes,1,opt,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty,omitempty"` -} - -func (x *QueryGetRelayMiningDifficultyResponse) Reset() { - *x = QueryGetRelayMiningDifficultyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryGetRelayMiningDifficultyResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryGetRelayMiningDifficultyResponse) ProtoMessage() {} - -// Deprecated: Use QueryGetRelayMiningDifficultyResponse.ProtoReflect.Descriptor instead. -func (*QueryGetRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{3} -} - -func (x *QueryGetRelayMiningDifficultyResponse) GetRelayMiningDifficulty() *RelayMiningDifficulty { - if x != nil { - return x.RelayMiningDifficulty - } - return nil -} - -type QueryAllRelayMiningDifficultyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (x *QueryAllRelayMiningDifficultyRequest) Reset() { - *x = QueryAllRelayMiningDifficultyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryAllRelayMiningDifficultyRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryAllRelayMiningDifficultyRequest) ProtoMessage() {} - -// Deprecated: Use QueryAllRelayMiningDifficultyRequest.ProtoReflect.Descriptor instead. -func (*QueryAllRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{4} -} - -func (x *QueryAllRelayMiningDifficultyRequest) GetPagination() *v1beta1.PageRequest { - if x != nil { - return x.Pagination - } - return nil -} - -type QueryAllRelayMiningDifficultyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RelayMiningDifficulty []*RelayMiningDifficulty `protobuf:"bytes,1,rep,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty,omitempty"` - Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (x *QueryAllRelayMiningDifficultyResponse) Reset() { - *x = QueryAllRelayMiningDifficultyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_tokenomics_query_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryAllRelayMiningDifficultyResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryAllRelayMiningDifficultyResponse) ProtoMessage() {} - -// Deprecated: Use QueryAllRelayMiningDifficultyResponse.ProtoReflect.Descriptor instead. -func (*QueryAllRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { - return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{5} -} - -func (x *QueryAllRelayMiningDifficultyResponse) GetRelayMiningDifficulty() []*RelayMiningDifficulty { - if x != nil { - return x.RelayMiningDifficulty - } - return nil -} - -func (x *QueryAllRelayMiningDifficultyResponse) GetPagination() *v1beta1.PageResponse { - if x != nil { - return x.Pagination - } - return nil -} - var File_poktroll_tokenomics_query_proto protoreflect.FileDescriptor var file_poktroll_tokenomics_query_proto_rawDesc = []byte{ @@ -2909,108 +896,38 @@ var file_poktroll_tokenomics_query_proto_rawDesc = []byte{ 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, - 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x31, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, - 0x6c, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x55, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x44, 0x0a, 0x24, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, - 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x8f, 0x01, 0x0a, - 0x25, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, - 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x4d, - 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x61, - 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, - 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, - 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x22, 0x6e, - 0x0a, 0x24, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, - 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xd8, - 0x01, 0x0a, 0x25, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, - 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x15, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, - 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x52, 0x65, - 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, - 0x6c, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6c, 0x61, 0x79, - 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, - 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, - 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xce, 0x04, 0x0a, 0x05, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, - 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, - 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0xdd, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, - 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x39, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, - 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, - 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, - 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x47, 0x12, 0x45, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x66, - 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x2f, 0x7b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x49, 0x64, 0x7d, 0x12, 0xd4, 0x01, 0x0a, 0x18, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, - 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x41, 0x6c, 0x6c, - 0x12, 0x39, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, - 0x75, 0x6c, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x70, 0x6f, + 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x55, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x97, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x42, 0xbc, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, - 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4d, - 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x41, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3b, 0x12, - 0x39, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, - 0x63, 0x73, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, - 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x42, 0xbc, 0x01, 0xd8, 0xe2, 0x1e, - 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, - 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, - 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x73, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3025,36 +942,21 @@ func file_poktroll_tokenomics_query_proto_rawDescGZIP() []byte { return file_poktroll_tokenomics_query_proto_rawDescData } -var file_poktroll_tokenomics_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_tokenomics_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_poktroll_tokenomics_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.tokenomics.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.tokenomics.QueryParamsResponse - (*QueryGetRelayMiningDifficultyRequest)(nil), // 2: poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest - (*QueryGetRelayMiningDifficultyResponse)(nil), // 3: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse - (*QueryAllRelayMiningDifficultyRequest)(nil), // 4: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest - (*QueryAllRelayMiningDifficultyResponse)(nil), // 5: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse - (*Params)(nil), // 6: poktroll.tokenomics.Params - (*RelayMiningDifficulty)(nil), // 7: poktroll.tokenomics.RelayMiningDifficulty - (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse + (*QueryParamsRequest)(nil), // 0: poktroll.tokenomics.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.tokenomics.QueryParamsResponse + (*Params)(nil), // 2: poktroll.tokenomics.Params } var file_poktroll_tokenomics_query_proto_depIdxs = []int32{ - 6, // 0: poktroll.tokenomics.QueryParamsResponse.params:type_name -> poktroll.tokenomics.Params - 7, // 1: poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse.relayMiningDifficulty:type_name -> poktroll.tokenomics.RelayMiningDifficulty - 8, // 2: poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.relayMiningDifficulty:type_name -> poktroll.tokenomics.RelayMiningDifficulty - 9, // 4: poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 0, // 5: poktroll.tokenomics.Query.Params:input_type -> poktroll.tokenomics.QueryParamsRequest - 2, // 6: poktroll.tokenomics.Query.RelayMiningDifficulty:input_type -> poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest - 4, // 7: poktroll.tokenomics.Query.RelayMiningDifficultyAll:input_type -> poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest - 1, // 8: poktroll.tokenomics.Query.Params:output_type -> poktroll.tokenomics.QueryParamsResponse - 3, // 9: poktroll.tokenomics.Query.RelayMiningDifficulty:output_type -> poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse - 5, // 10: poktroll.tokenomics.Query.RelayMiningDifficultyAll:output_type -> poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 2, // 0: poktroll.tokenomics.QueryParamsResponse.params:type_name -> poktroll.tokenomics.Params + 0, // 1: poktroll.tokenomics.Query.Params:input_type -> poktroll.tokenomics.QueryParamsRequest + 1, // 2: poktroll.tokenomics.Query.Params:output_type -> poktroll.tokenomics.QueryParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_tokenomics_query_proto_init() } @@ -3063,7 +965,6 @@ func file_poktroll_tokenomics_query_proto_init() { return } file_poktroll_tokenomics_params_proto_init() - file_poktroll_tokenomics_relay_mining_difficulty_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_tokenomics_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryParamsRequest); i { @@ -3089,54 +990,6 @@ func file_poktroll_tokenomics_query_proto_init() { return nil } } - file_poktroll_tokenomics_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryGetRelayMiningDifficultyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_poktroll_tokenomics_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryGetRelayMiningDifficultyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_poktroll_tokenomics_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllRelayMiningDifficultyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_poktroll_tokenomics_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllRelayMiningDifficultyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3144,7 +997,7 @@ func file_poktroll_tokenomics_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_tokenomics_query_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 2, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/tokenomics/query_grpc.pb.go b/api/poktroll/tokenomics/query_grpc.pb.go index e45017866..f12dade48 100644 --- a/api/poktroll/tokenomics/query_grpc.pb.go +++ b/api/poktroll/tokenomics/query_grpc.pb.go @@ -19,9 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion8 const ( - Query_Params_FullMethodName = "/poktroll.tokenomics.Query/Params" - Query_RelayMiningDifficulty_FullMethodName = "/poktroll.tokenomics.Query/RelayMiningDifficulty" - Query_RelayMiningDifficultyAll_FullMethodName = "/poktroll.tokenomics.Query/RelayMiningDifficultyAll" + Query_Params_FullMethodName = "/poktroll.tokenomics.Query/Params" ) // QueryClient is the client API for Query service. @@ -32,9 +30,6 @@ const ( type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a list of RelayMiningDifficulty items. - RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) - RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) } type queryClient struct { @@ -55,26 +50,6 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(QueryGetRelayMiningDifficultyResponse) - err := c.cc.Invoke(ctx, Query_RelayMiningDifficulty_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(QueryAllRelayMiningDifficultyResponse) - err := c.cc.Invoke(ctx, Query_RelayMiningDifficultyAll_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility @@ -83,9 +58,6 @@ func (c *queryClient) RelayMiningDifficultyAll(ctx context.Context, in *QueryAll type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a list of RelayMiningDifficulty items. - RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) - RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) mustEmbedUnimplementedQueryServer() } @@ -96,12 +68,6 @@ type UnimplementedQueryServer struct { func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (UnimplementedQueryServer) RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficulty not implemented") -} -func (UnimplementedQueryServer) RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficultyAll not implemented") -} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. @@ -133,42 +99,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_RelayMiningDifficulty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetRelayMiningDifficultyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RelayMiningDifficulty(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_RelayMiningDifficulty_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RelayMiningDifficulty(ctx, req.(*QueryGetRelayMiningDifficultyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_RelayMiningDifficultyAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllRelayMiningDifficultyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RelayMiningDifficultyAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_RelayMiningDifficultyAll_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RelayMiningDifficultyAll(ctx, req.(*QueryAllRelayMiningDifficultyRequest)) - } - return interceptor(ctx, in, info, handler) -} - // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -180,14 +110,6 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, - { - MethodName: "RelayMiningDifficulty", - Handler: _Query_RelayMiningDifficulty_Handler, - }, - { - MethodName: "RelayMiningDifficultyAll", - Handler: _Query_RelayMiningDifficultyAll_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/tokenomics/query.proto", diff --git a/docusaurus/docs/protocol/governance/params.md b/docusaurus/docs/protocol/governance/params.md index 37400c7e4..d57425768 100644 --- a/docusaurus/docs/protocol/governance/params.md +++ b/docusaurus/docs/protocol/governance/params.md @@ -9,6 +9,8 @@ sidebar_position: 1 DO NOT EDIT: this file was generated by make docs_update_gov_params_page ::: +- [Access Control](#access-control) +- [Updating governance parameter values](#updating-governance-parameter-values) - [Updating this page](#updating-this-page) - [Adding a new parameter](#adding-a-new-parameter) - [Parameters](#parameters) @@ -35,8 +37,8 @@ Please follow the instructions in [this guide](../../develop/developer_guide/add |Module | Field Type | Field Name |Comment | -|-------|------------|------------|--------|| `application` | `uint64 ` | `max_delegated_gateways` | max_delegated_gateways defines the maximum number of gateways that a single application can delegate to. This is used to prevent performance issues in case the relay ring signature becomes too large. | -| `proof ` | `bytes ` | `relay_difficulty_target_hash` | TODO_FOLLOWUP(@olshansk, #690): Either delete this or change it to be named "minimum" relay_difficulty_target_hash is the maximum value a relay hash must be less than to be volume/reward applicable. | +|-------|------------|------------|--------| +| `application` | `uint64 ` | `max_delegated_gateways` | max_delegated_gateways defines the maximum number of gateways that a single application can delegate to. This is used to prevent performance issues in case the relay ring signature becomes too large. | | `proof ` | `float ` | `proof_request_probability` | proof_request_probability is the probability of a session requiring a proof if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. | | `shared ` | `uint64 ` | `num_blocks_per_session` | num_blocks_per_session is the number of blocks between the session start & end heights. | | `shared ` | `uint64 ` | `grace_period_end_offset_blocks` | grace_period_end_offset_blocks is the number of blocks, after the session end height, during which the supplier can still service payable relays. Suppliers will need to recreate a claim for the previous session (if already created) to get paid for the additional relays. | diff --git a/e2e/tests/0_settlement.feature b/e2e/tests/0_settlement.feature index a4f84e62c..94c4de9cc 100644 --- a/e2e/tests/0_settlement.feature +++ b/e2e/tests/0_settlement.feature @@ -20,7 +20,6 @@ Feature: Tokenomics Namespace # to make sure a proof is required. And the "proof" module parameters are set as follows | name | value | type | - | relay_difficulty_target_hash | ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | bytes | | proof_request_probability | 0.25 | float | | proof_requirement_threshold | 839 | coin | | proof_missing_penalty | 320 | coin | @@ -55,7 +54,6 @@ Feature: Tokenomics Namespace # to make sure a proof is not required. And the "proof" module parameters are set as follows | name | value | type | - | relay_difficulty_target_hash | ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | bytes | | proof_request_probability | 0 | float | | proof_requirement_threshold | 421 | coin | | proof_missing_penalty | 320 | coin | diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index 98ba813d6..ea447957b 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -3,7 +3,6 @@ package e2e import ( - "encoding/hex" "fmt" "strconv" @@ -132,8 +131,6 @@ func (s *suite) newProofMsgUpdateParams(params paramsAnyMap) cosmostypes.Msg { for paramName, paramValue := range params { switch paramName { - case prooftypes.ParamRelayDifficultyTargetHash: - msgUpdateParams.Params.RelayDifficultyTargetHash, _ = hex.DecodeString(string(paramValue.value.([]byte))) case prooftypes.ParamProofRequestProbability: msgUpdateParams.Params.ProofRequestProbability = paramValue.value.(float32) case prooftypes.ParamProofRequirementThreshold: diff --git a/e2e/tests/session.feature b/e2e/tests/session.feature index 715e7319a..d1c3ca1d4 100644 --- a/e2e/tests/session.feature +++ b/e2e/tests/session.feature @@ -6,7 +6,6 @@ Feature: Session Namespace # to make sure a proof is required. And the "proof" module parameters are set as follows | name | value | type | - | relay_difficulty_target_hash | ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | bytes | | proof_request_probability | 0.25 | float | | proof_requirement_threshold | 209 | coin | | proof_missing_penalty | 320 | coin | diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 54b732958..2404d7e06 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -191,7 +191,8 @@ func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBeSuccess require.Equal(s, app.Address, claim.SessionHeader.ApplicationAddress) require.Equal(s, supplier.OperatorAddress, claim.SupplierOperatorAddress) require.Equal(s, serviceId, claim.SessionHeader.ServiceId) - require.Greater(s, claimSettledEvent.NumComputeUnits, uint64(0), "compute units should be greater than 0") + require.Greater(s, claimSettledEvent.NumClaimedComputeUnits, uint64(0), "claimed compute units should be greater than 0") + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt return true } diff --git a/e2e/tests/update_params_test.go b/e2e/tests/update_params_test.go index 63f3b4c01..8dbaee5dc 100644 --- a/e2e/tests/update_params_test.go +++ b/e2e/tests/update_params_test.go @@ -3,7 +3,6 @@ package e2e import ( - "encoding/hex" "encoding/json" "fmt" "reflect" @@ -363,11 +362,6 @@ func (s *suite) assertExpectedModuleParamsUpdated(moduleName string) { params := prooftypes.DefaultParams() paramsMap := s.expectedModuleParams[moduleName] - relayDifficultyTargetHash, ok := paramsMap[prooftypes.ParamRelayDifficultyTargetHash] - if ok { - params.RelayDifficultyTargetHash, _ = hex.DecodeString(string(relayDifficultyTargetHash.value.([]byte))) - } - proofRequestProbability, ok := paramsMap[prooftypes.ParamProofRequestProbability] if ok { params.ProofRequestProbability = proofRequestProbability.value.(float32) diff --git a/pkg/client/interface.go b/pkg/client/interface.go index 502773709..fd294b8e8 100644 --- a/pkg/client/interface.go +++ b/pkg/client/interface.go @@ -9,7 +9,6 @@ //go:generate mockgen -destination=../../testutil/mockclient/session_query_client_mock.go -package=mockclient . SessionQueryClient //go:generate mockgen -destination=../../testutil/mockclient/shared_query_client_mock.go -package=mockclient . SharedQueryClient //go:generate mockgen -destination=../../testutil/mockclient/proof_query_client_mock.go -package=mockclient . ProofQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/tokenomics_query_client_mock.go -package=mockclient . TokenomicsQueryClient //go:generate mockgen -destination=../../testutil/mockclient/service_query_client_mock.go -package=mockclient . ServiceQueryClient //go:generate mockgen -destination=../../testutil/mockclient/bank_query_client_mock.go -package=mockclient . BankQueryClient //go:generate mockgen -destination=../../testutil/mockclient/cosmos_tx_builder_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/client TxBuilder @@ -32,6 +31,7 @@ import ( "github.com/pokt-network/poktroll/pkg/either" "github.com/pokt-network/poktroll/pkg/observable" apptypes "github.com/pokt-network/poktroll/x/application/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -351,24 +351,12 @@ type ProofQueryClient interface { GetParams(ctx context.Context) (ProofParams, error) } -// TokenomicsRelayMiningDifficulty is a go interface type which corresponding to the poktroll.tokenomics.RelayMiningDifficulty -// protobuf message. This is necessary to prevent dependency cycles. -type TokenomicsRelayMiningDifficulty interface { - GetTargetHash() []byte -} - -// TokenomicsQueryClient defines an interface that enables the querying of the -// on-chain tokenomics information -type TokenomicsQueryClient interface { - GetServiceRelayDifficultyTargetHash(ctx context.Context, serviceId string) (TokenomicsRelayMiningDifficulty, error) - // GetParams queries the chain for the current tokenomics module parameters. -} - // ServiceQueryClient defines an interface that enables the querying of the // on-chain service information type ServiceQueryClient interface { // GetService queries the chain for the details of the service provided GetService(ctx context.Context, serviceId string) (sharedtypes.Service, error) + GetServiceRelayDifficultyTargetHash(ctx context.Context, serviceId string) (servicetypes.RelayMiningDifficulty, error) } // BankQueryClient defines an interface that enables the querying of the diff --git a/pkg/client/query/servicequerier.go b/pkg/client/query/servicequerier.go index 9b5cdfc76..af0ec64e9 100644 --- a/pkg/client/query/servicequerier.go +++ b/pkg/client/query/servicequerier.go @@ -60,3 +60,20 @@ func (servq *serviceQuerier) GetService( } return res.Service, nil } + +// GetServiceRelayDifficultyTargetHash queries the onchain data for +// the relay mining difficulty associated with the given service. +func (servq *serviceQuerier) GetServiceRelayDifficultyTargetHash( + ctx context.Context, + serviceId string, +) (servicetypes.RelayMiningDifficulty, error) { + req := &servicetypes.QueryGetRelayMiningDifficultyRequest{ + ServiceId: serviceId, + } + + res, err := servq.serviceQuerier.RelayMiningDifficulty(ctx, req) + if err != nil { + return servicetypes.RelayMiningDifficulty{}, err + } + return res.RelayMiningDifficulty, nil +} diff --git a/pkg/client/query/tokenomicsquerier.go b/pkg/client/query/tokenomicsquerier.go deleted file mode 100644 index 52b4da453..000000000 --- a/pkg/client/query/tokenomicsquerier.go +++ /dev/null @@ -1,55 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// tokenomicsQuerier is a wrapper around the tokenomicstypes.QueryClient that enables the -// querying of on-chain tokenomics module data. -type tokenomicsQuerier struct { - clientConn grpc.ClientConn - tokenomicsQuerier tokenomicstypes.QueryClient -} - -// NewTokenomicsQuerier returns a new instance of a client.TokenomicsQueryClient by -// injecting the dependecies provided by the depinject.Config. -// -// Required dependencies: -// - grpc.ClientConn -func NewTokenomicsQuerier(deps depinject.Config) (client.TokenomicsQueryClient, error) { - querier := &tokenomicsQuerier{} - - if err := depinject.Inject( - deps, - &querier.clientConn, - ); err != nil { - return nil, err - } - - querier.tokenomicsQuerier = tokenomicstypes.NewQueryClient(querier.clientConn) - - return querier, nil -} - -// GetServiceRelayDifficultyTargetHash queries the onchain data for -// the relay mining difficulty associated with the given service. -func (tq *tokenomicsQuerier) GetServiceRelayDifficultyTargetHash( - ctx context.Context, - serviceId string, -) (client.TokenomicsRelayMiningDifficulty, error) { - req := &tokenomicstypes.QueryGetRelayMiningDifficultyRequest{ - ServiceId: serviceId, - } - - res, err := tq.tokenomicsQuerier.RelayMiningDifficulty(ctx, req) - if err != nil { - return nil, err - } - return &res.RelayMiningDifficulty, nil -} diff --git a/pkg/deps/config/suppliers.go b/pkg/deps/config/suppliers.go index aceb81410..c7548f1cb 100644 --- a/pkg/deps/config/suppliers.go +++ b/pkg/deps/config/suppliers.go @@ -466,24 +466,6 @@ func NewSupplyProofQueryClientFn() SupplierFn { } } -// NewSupplyTokenomicsQueryClientFn returns a function which constructs a -// TokenomicsQueryClient instance and returns a new depinject.Config which -// is supplied with the given deps and the new TokenomicsQueryClient. -func NewSupplyTokenomicsQueryClientFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - tokenomicsQuerier, err := query.NewTokenomicsQuerier(deps) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(tokenomicsQuerier)), nil - } -} - // NewSupplyServiceQueryClientFn returns a function which constructs a // NewSupplyServiceQueryClient instance and returns a new depinject.Config which // is supplied with the given deps and the new ServiceQueryClient. diff --git a/pkg/relayer/cmd/cmd.go b/pkg/relayer/cmd/cmd.go index 66681b881..c8f0df94e 100644 --- a/pkg/relayer/cmd/cmd.go +++ b/pkg/relayer/cmd/cmd.go @@ -194,14 +194,13 @@ func setupRelayerDependencies( config.NewSupplyTxClientContextFn(queryNodeGRPCUrl, txNodeRPCUrl), // leaf config.NewSupplyDelegationClientFn(), // leaf config.NewSupplySharedQueryClientFn(), // leaf - config.NewSupplyTokenomicsQueryClientFn(), + config.NewSupplyServiceQueryClientFn(), supplyMiner, config.NewSupplyAccountQuerierFn(), config.NewSupplyBankQuerierFn(), config.NewSupplyApplicationQuerierFn(), config.NewSupplySupplierQuerierFn(), config.NewSupplySessionQuerierFn(), - config.NewSupplyServiceQueryClientFn(), config.NewSupplyProofQueryClientFn(), config.NewSupplyRingCacheFn(), supplyTxFactory, diff --git a/pkg/relayer/miner/miner.go b/pkg/relayer/miner/miner.go index f22a85760..8205ae5f7 100644 --- a/pkg/relayer/miner/miner.go +++ b/pkg/relayer/miner/miner.go @@ -15,7 +15,6 @@ import ( "github.com/pokt-network/poktroll/pkg/observable/filter" "github.com/pokt-network/poktroll/pkg/observable/logging" "github.com/pokt-network/poktroll/pkg/relayer" - prooftypes "github.com/pokt-network/poktroll/x/proof/types" servicetypes "github.com/pokt-network/poktroll/x/service/types" ) @@ -25,16 +24,16 @@ var _ relayer.Miner = (*miner)(nil) // difficulty of each, finally publishing those with sufficient difficulty to // minedRelayObs as they are applicable for relay volume. type miner struct { - // tokenomicsQueryClient is used to query for the relay difficulty target hash of a service. + // serviceQueryClient is used to query for the relay difficulty target hash of a service. // relay_difficulty is the target hash which a relay hash must be less than to be volume/reward applicable. - tokenomicsQueryClient client.TokenomicsQueryClient + serviceQueryClient client.ServiceQueryClient } // NewMiner creates a new miner from the given dependencies and options. It // returns an error if it has not been sufficiently configured or supplied. // // Required Dependencies: -// - ProofQueryClient +// - ServiceQueryClient // // Available options: // - WithRelayDifficultyTargetHash @@ -44,7 +43,7 @@ func NewMiner( ) (*miner, error) { mnr := &miner{} - if err := depinject.Inject(deps, &mnr.tokenomicsQueryClient); err != nil { + if err := depinject.Inject(deps, &mnr.serviceQueryClient); err != nil { return nil, err } @@ -129,11 +128,11 @@ func (mnr *miner) getServiceRelayDifficultyTargetHash(ctx context.Context, req * return nil, fmt.Errorf("invalid session header: %w", err) } - serviceRelayDifficulty, err := mnr.tokenomicsQueryClient.GetServiceRelayDifficultyTargetHash(ctx, sessionHeader.ServiceId) + serviceRelayDifficulty, err := mnr.serviceQueryClient.GetServiceRelayDifficultyTargetHash(ctx, sessionHeader.ServiceId) if err != nil { // TODO_IMPROVE: log the error and a message saying the default relay difficulty target hash // is being used. - return prooftypes.DefaultRelayDifficultyTargetHash, nil + return protocol.BaseRelayDifficultyHashBz, nil } return serviceRelayDifficulty.GetTargetHash(), nil diff --git a/pkg/relayer/miner/miner_test.go b/pkg/relayer/miner/miner_test.go index 01a67c37c..fc0df6b6c 100644 --- a/pkg/relayer/miner/miner_test.go +++ b/pkg/relayer/miner/miner_test.go @@ -49,9 +49,9 @@ func TestMiner_MinedRelays(t *testing.T) { proofQueryClientMock := testqueryclients.NewTestProofQueryClient(t) testqueryclients.SetServiceRelayDifficultyTargetHash(t, testSvcId, testRelayMiningTargetHash) - tokenomicsQueryClientMock := testqueryclients.NewTestTokenomicsQueryClient(t) + serviceQueryClientMock := testqueryclients.NewTestServiceQueryClient(t) - deps := depinject.Supply(proofQueryClientMock, tokenomicsQueryClientMock) + deps := depinject.Supply(proofQueryClientMock, serviceQueryClientMock) mnr, err := miner.NewMiner(deps) require.NoError(t, err) diff --git a/pkg/relayer/session/proof.go b/pkg/relayer/session/proof.go index 1b97e838e..5bb965f34 100644 --- a/pkg/relayer/session/proof.go +++ b/pkg/relayer/session/proof.go @@ -278,7 +278,7 @@ func (rs *relayerSessionsManager) isProofRequired( claim := claimFromSessionTree(sessionTree) // Get the number of compute units accumulated through the given session. - numClaimComputeUnits, err := claim.GetNumComputeUnits() + numClaimComputeUnits, err := claim.GetNumClaimedComputeUnits() if err != nil { return false, err } diff --git a/pkg/relayer/session/session.go b/pkg/relayer/session/session.go index 15fce0220..2578d1b15 100644 --- a/pkg/relayer/session/session.go +++ b/pkg/relayer/session/session.go @@ -65,9 +65,6 @@ type relayerSessionsManager struct { // claim requires a proof. proofQueryClient client.ProofQueryClient - // tokenomicsQueryClient is used to query for the tokenomics module parameters. - tokenomicsQueryClient client.TokenomicsQueryClient - // bankQueryClient is used to query for the bank module parameters. bankQueryClient client.BankQueryClient } @@ -100,7 +97,6 @@ func NewRelayerSessions( &rs.sharedQueryClient, &rs.serviceQueryClient, &rs.proofQueryClient, - &rs.tokenomicsQueryClient, &rs.bankQueryClient, ); err != nil { return nil, err diff --git a/pkg/relayer/session/session_test.go b/pkg/relayer/session/session_test.go index 5b3c24f2f..5fccd391b 100644 --- a/pkg/relayer/session/session_test.go +++ b/pkg/relayer/session/session_test.go @@ -313,7 +313,6 @@ func setupDependencies( sharedQueryClientMock := testqueryclients.NewTestSharedQueryClient(t) serviceQueryClientMock := testqueryclients.NewTestServiceQueryClient(t) proofQueryClientMock := testqueryclients.NewTestProofQueryClientWithParams(t, &proofParams) - tokenomicsQueryClient := testqueryclients.NewTestTokenomicsQueryClient(t) bankQueryClient := testqueryclients.NewTestBankQueryClientWithBalance(t, supplierOperatorBalance) deps := depinject.Supply( @@ -323,7 +322,6 @@ func setupDependencies( sharedQueryClientMock, serviceQueryClientMock, proofQueryClientMock, - tokenomicsQueryClient, bankQueryClient, ) storesDirectoryOpt := testrelayer.WithTempStoresDirectory(t) diff --git a/proto/poktroll/proof/event.proto b/proto/poktroll/proof/event.proto index c1a53ceb8..303e684a9 100644 --- a/proto/poktroll/proof/event.proto +++ b/proto/poktroll/proof/event.proto @@ -4,27 +4,34 @@ package poktroll.proof; option go_package = "github.com/pokt-network/poktroll/x/proof/types"; option (gogoproto.stable_marshaler_all) = true; +import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "poktroll/proof/types.proto"; message EventClaimCreated { poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; - uint64 num_compute_units = 3 [(gogoproto.jsontag) = "num_compute_units"]; + uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; + uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; + cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; } // TODO_TEST: Add coverage for claim updates. message EventClaimUpdated { poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; - uint64 num_compute_units = 3 [(gogoproto.jsontag) = "num_compute_units"]; + uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; + uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; + cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; } message EventProofSubmitted { poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; poktroll.proof.Proof proof = 2 [(gogoproto.jsontag) = "proof"]; uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; - uint64 num_compute_units = 4 [(gogoproto.jsontag) = "num_compute_units"]; + uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; + uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; + cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; } // TODO_TEST: Add coverage for proof updates. @@ -32,5 +39,7 @@ message EventProofUpdated { poktroll.proof.Claim claim = 1 [(gogoproto.jsontag) = "claim"]; poktroll.proof.Proof proof = 2 [(gogoproto.jsontag) = "proof"]; uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; - uint64 num_compute_units = 4 [(gogoproto.jsontag) = "num_compute_units"]; + uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; + uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; + cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; } diff --git a/proto/poktroll/proof/params.proto b/proto/poktroll/proof/params.proto index 2b8a97a22..0af62cebf 100644 --- a/proto/poktroll/proof/params.proto +++ b/proto/poktroll/proof/params.proto @@ -13,10 +13,6 @@ message Params { option (amino.name) = "poktroll/x/proof/Params"; option (gogoproto.equal) = true; - // TODO_FOLLOWUP(@olshansk, #690): Either delete this or change it to be named "minimum" - // relay_difficulty_target_hash is the maximum value a relay hash must be less than to be volume/reward applicable. - bytes relay_difficulty_target_hash = 1 [(gogoproto.jsontag) = "relay_difficulty_target_hash"]; - // proof_request_probability is the probability of a session requiring a proof // if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. float proof_request_probability = 2 [(gogoproto.jsontag) = "proof_request_probability"]; diff --git a/proto/poktroll/service/event.proto b/proto/poktroll/service/event.proto new file mode 100644 index 000000000..c9507e2ce --- /dev/null +++ b/proto/poktroll/service/event.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package poktroll.service; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; +option (gogoproto.stable_marshaler_all) = true; + +import "gogoproto/gogo.proto"; + +// EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated +// for a given service. +message EventRelayMiningDifficultyUpdated { + string service_id = 1; + string prev_target_hash_hex_encoded = 2; + string new_target_hash_hex_encoded = 3; + uint64 prev_num_relays_ema = 4; + uint64 new_num_relays_ema = 5; +} \ No newline at end of file diff --git a/proto/poktroll/service/genesis.proto b/proto/poktroll/service/genesis.proto index e8f505348..be45ef550 100644 --- a/proto/poktroll/service/genesis.proto +++ b/proto/poktroll/service/genesis.proto @@ -9,6 +9,7 @@ import "gogoproto/gogo.proto"; import "poktroll/service/params.proto"; import "poktroll/shared/service.proto"; +import "poktroll/service/relay_mining_difficulty.proto"; // GenesisState defines the service module's genesis state. @@ -17,5 +18,6 @@ message GenesisState { // params defines all the parameters of the module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; repeated poktroll.shared.Service service_list = 2 [(gogoproto.nullable) = false] ; + repeated RelayMiningDifficulty relayMiningDifficultyList = 3 [(gogoproto.nullable) = false] ; } diff --git a/proto/poktroll/service/query.proto b/proto/poktroll/service/query.proto index 4b49a3e82..0f027ab98 100644 --- a/proto/poktroll/service/query.proto +++ b/proto/poktroll/service/query.proto @@ -11,6 +11,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "poktroll/service/params.proto"; import "poktroll/shared/service.proto"; +import "poktroll/service/relay_mining_difficulty.proto"; // Query defines the gRPC querier service. service Query { @@ -30,6 +31,15 @@ service Query { option (google.api.http).get = "/pokt-network/poktroll/service/service"; } + + // Queries a list of RelayMiningDifficulty items. + rpc RelayMiningDifficulty (QueryGetRelayMiningDifficultyRequest) returns (QueryGetRelayMiningDifficultyResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/relay_mining_difficulty/{serviceId}"; + + } + rpc RelayMiningDifficultyAll (QueryAllRelayMiningDifficultyRequest) returns (QueryAllRelayMiningDifficultyResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/relay_mining_difficulty"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} @@ -59,3 +69,19 @@ message QueryAllServicesResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } +message QueryGetRelayMiningDifficultyRequest { + string serviceId = 1; +} + +message QueryGetRelayMiningDifficultyResponse { + RelayMiningDifficulty relayMiningDifficulty = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllRelayMiningDifficultyRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllRelayMiningDifficultyResponse { + repeated RelayMiningDifficulty relayMiningDifficulty = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/poktroll/tokenomics/relay_mining_difficulty.proto b/proto/poktroll/service/relay_mining_difficulty.proto similarity index 92% rename from proto/poktroll/tokenomics/relay_mining_difficulty.proto rename to proto/poktroll/service/relay_mining_difficulty.proto index 36a671d0a..b994c5db5 100644 --- a/proto/poktroll/tokenomics/relay_mining_difficulty.proto +++ b/proto/poktroll/service/relay_mining_difficulty.proto @@ -1,7 +1,7 @@ syntax = "proto3"; -package poktroll.tokenomics; +package poktroll.service; -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; +option go_package = "github.com/pokt-network/poktroll/x/service/types"; option (gogoproto.stable_marshaler_all) = true; import "gogoproto/gogo.proto"; diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index b16f7f001..18dc68ea2 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -25,9 +25,13 @@ message EventClaimExpired { uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; // Number of compute units claimed as a function of the number of relays // and the compute units per relay for the particular service. - uint64 num_compute_units = 4 [(gogoproto.jsontag) = "num_compute_units"]; - // TODO_BETA(@red-0ne): Rename 'num_compute_units' to 'num_claimed_compute_units' - // and introduce a 'num_estimated_compute_units' field. + uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; + // Number of estimated compute units claimed as a function of the number of claimed + // compute units and the relay difficulty multiplier for the particular service. + uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; + // The amount of uPOKT claimed to be rewarded for the work done as a function of + // the number of estimated compute units and the compute uints to token multiplier. + cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; } // EventClaimSettled is an event emitted whenever a claim is settled. @@ -40,19 +44,13 @@ message EventClaimSettled { uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; // Number of compute units claimed as a function of the number of relays // and the compute units per relay for the particular service. - uint64 num_compute_units = 4 [(gogoproto.jsontag) = "num_compute_units"]; - // TODO_BETA(@red-0ne): Rename 'num_compute_units' to 'num_claimed_compute_units' - // and introduce a 'num_estimated_compute_units' field. -} - -// EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated -// for a given service. -message EventRelayMiningDifficultyUpdated { - string service_id = 1; - string prev_target_hash_hex_encoded = 2; - string new_target_hash_hex_encoded = 3; - uint64 prev_num_relays_ema = 4; - uint64 new_num_relays_ema = 5; + uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; + // Number of estimated compute units claimed as a function of the number of claimed + // compute units and the relay difficulty multiplier for the particular service. + uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; + // The amount of uPOKT claimed to be rewarded for the work done as a function of + // the number of estimated compute units and the compute uints to token multiplier. + cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; } // EventApplicationOverserviced is emitted when an application has less stake than diff --git a/proto/poktroll/tokenomics/genesis.proto b/proto/poktroll/tokenomics/genesis.proto index a6fe91264..9b904f849 100644 --- a/proto/poktroll/tokenomics/genesis.proto +++ b/proto/poktroll/tokenomics/genesis.proto @@ -8,13 +8,11 @@ option (gogoproto.stable_marshaler_all) = true; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "poktroll/tokenomics/params.proto"; -import "poktroll/tokenomics/relay_mining_difficulty.proto"; // GenesisState defines the tokenomics module's genesis state. message GenesisState { - + // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - repeated RelayMiningDifficulty relayMiningDifficultyList = 2 [(gogoproto.nullable) = false] ; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/proto/poktroll/tokenomics/query.proto b/proto/poktroll/tokenomics/query.proto index 23888d8a2..325d3ade8 100644 --- a/proto/poktroll/tokenomics/query.proto +++ b/proto/poktroll/tokenomics/query.proto @@ -9,11 +9,8 @@ import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos_proto/cosmos.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "poktroll/tokenomics/params.proto"; -import "poktroll/tokenomics/relay_mining_difficulty.proto"; // Query defines the gRPC querier service. service Query { @@ -23,16 +20,6 @@ service Query { option (google.api.http).get = "/pokt-network/poktroll/tokenomics/params"; } - - // Queries a list of RelayMiningDifficulty items. - rpc RelayMiningDifficulty (QueryGetRelayMiningDifficultyRequest) returns (QueryGetRelayMiningDifficultyResponse) { - option (google.api.http).get = "/pokt-network/poktroll/tokenomics/relay_mining_difficulty/{serviceId}"; - - } - rpc RelayMiningDifficultyAll (QueryAllRelayMiningDifficultyRequest) returns (QueryAllRelayMiningDifficultyResponse) { - option (google.api.http).get = "/pokt-network/poktroll/tokenomics/relay_mining_difficulty"; - - } } // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} @@ -43,21 +30,3 @@ message QueryParamsResponse { // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } - -message QueryGetRelayMiningDifficultyRequest { - string serviceId = 1; -} - -message QueryGetRelayMiningDifficultyResponse { - RelayMiningDifficulty relayMiningDifficulty = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllRelayMiningDifficultyRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllRelayMiningDifficultyResponse { - repeated RelayMiningDifficulty relayMiningDifficulty = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/tests/integration/tokenomics/relay_mining_difficulty_test.go b/tests/integration/service/relay_mining_difficulty_test.go similarity index 94% rename from tests/integration/tokenomics/relay_mining_difficulty_test.go rename to tests/integration/service/relay_mining_difficulty_test.go index eb6ad935c..f3048fed4 100644 --- a/tests/integration/tokenomics/relay_mining_difficulty_test.go +++ b/tests/integration/service/relay_mining_difficulty_test.go @@ -3,7 +3,6 @@ package integration_test import ( "context" "testing" - "time" "github.com/pokt-network/smt" "github.com/pokt-network/smt/kvstore/pebble" @@ -16,10 +15,10 @@ import ( testutil "github.com/pokt-network/poktroll/testutil/integration" "github.com/pokt-network/poktroll/testutil/testrelayer" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) func init() { @@ -91,14 +90,10 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) // TODO_TECHDEBT(@bryanchriswhite): Olshansky is unsure why the +1 is necessary here but it was required to pass the test. integrationApp.NextBlocks(t, int(numBlocksUntilProofWindowCloseHeight)+1) - // TODO_TECHDEBT: Aiming to get PR #771 over the finish line and this is a hacky - // workaround: https://github.com/pokt-network/poktroll/pull/771#issuecomment-2364071636 - time.Sleep(3 * time.Second) - // Check that the expected events are emitted events := sdkCtx.EventManager().Events() - relayMiningEvents := testutilevents.FilterEvents[*tokenomicstypes.EventRelayMiningDifficultyUpdated](t, - events, "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") + relayMiningEvents := testutilevents.FilterEvents[*servicetypes.EventRelayMiningDifficultyUpdated](t, + events, "poktroll.service.EventRelayMiningDifficultyUpdated") require.Len(t, relayMiningEvents, 1, "unexpected number of relay mining difficulty updated events") relayMiningEvent := relayMiningEvents[0] require.Equal(t, "svc1", relayMiningEvent.ServiceId) diff --git a/tests/integration/tokenomics/relay_mining_integration_test.go b/tests/integration/tokenomics/relay_mining_integration_test.go index 9cf1d21a6..3b296b298 100644 --- a/tests/integration/tokenomics/relay_mining_integration_test.go +++ b/tests/integration/tokenomics/relay_mining_integration_test.go @@ -15,9 +15,9 @@ import ( "github.com/pokt-network/poktroll/testutil/testrelayer" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) var ( @@ -140,7 +140,7 @@ func prepareRealClaim( supplier *sharedtypes.Supplier, session *sessiontypes.Session, service *sharedtypes.Service, - relayMiningDifficulty *tokenomicstypes.RelayMiningDifficulty, + relayMiningDifficulty *servicetypes.RelayMiningDifficulty, ) *prooftypes.Claim { t.Helper() diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index ca8354fe7..0c884ffea 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -196,7 +196,6 @@ var ( QueryParamsResponse: prooftypes.QueryParamsResponse{}, }, ValidParams: prooftypes.Params{ - RelayDifficultyTargetHash: ValidRelayDifficultyTargetHash, ProofRequestProbability: 0.1, ProofRequirementThreshold: &ValidProofRequirementThresholdCoin, ProofMissingPenalty: &ValidProofMissingPenaltyCoin, diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index 610824cee..e3bf52440 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -140,6 +140,8 @@ func TokenomicsKeeperWithActorAddrs(t testing.TB) ( }, } + sdkCtx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + ctrl := gomock.NewController(t) // Mock the application keeper. @@ -221,6 +223,12 @@ func TokenomicsKeeperWithActorAddrs(t testing.TB) ( Return(sharedtypes.Service{}, false). AnyTimes() + relayMiningDifficulty := servicekeeper.NewDefaultRelayMiningDifficulty(sdkCtx, log.NewNopLogger(), service.Id, servicekeeper.TargetNumRelays) + mockServiceKeeper.EXPECT(). + GetRelayMiningDifficulty(gomock.Any(), gomock.Any()). + Return(relayMiningDifficulty, true). + AnyTimes() + k := tokenomicskeeper.NewKeeper( cdc, runtime.NewKVStoreService(storeKey), @@ -236,8 +244,6 @@ func TokenomicsKeeperWithActorAddrs(t testing.TB) ( mockServiceKeeper, ) - sdkCtx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) - // Add a block proposer address to the context valAddr, err := cosmostypes.ValAddressFromBech32(sample.ValAddress()) require.NoError(t, err) diff --git a/testutil/testclient/testqueryclients/servicequerier.go b/testutil/testclient/testqueryclients/servicequerier.go index 0557078c0..d68c2ea3c 100644 --- a/testutil/testclient/testqueryclients/servicequerier.go +++ b/testutil/testclient/testqueryclients/servicequerier.go @@ -8,9 +8,19 @@ import ( "github.com/pokt-network/poktroll/testutil/mockclient" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) +// TODO_TECHDEBT: refactor the methods using this variable to avoid having a global scope +// for the map across unit tests run under the same testing.T instance. +// Ditto for other similar package-level variables in this package. +// relayDifficultyTargets is a map of: serviceId -> RelayMiningDifficulty +// It is updated by the SetServiceRelayDifficultyTargetHash, and read by +// the mock tokenomics query client to get a specific service's relay difficulty +// target hash. +var relayDifficultyTargets = make(map[string]*servicetypes.RelayMiningDifficulty) + // TODO_TECHDEBT: refactor the methods using this variable to avoid having a global scope // for the map across unit tests run under the same testing.T instance. // services is a map of: serviceId -> Service @@ -40,6 +50,20 @@ func NewTestServiceQueryClient( }). AnyTimes() + serviceQuerier.EXPECT().GetServiceRelayDifficultyTargetHash(gomock.Any(), gomock.Any()). + DoAndReturn(func( + _ context.Context, + serviceId string, + ) (servicetypes.RelayMiningDifficulty, error) { + relayDifficulty, ok := relayDifficultyTargets[serviceId] + if !ok { + return servicetypes.RelayMiningDifficulty{}, servicetypes.ErrServiceMissingRelayMiningDifficulty.Wrapf("retrieving the relay mining difficulty for service %s", serviceId) + } + + return *relayDifficulty, nil + }). + AnyTimes() + return serviceQuerier } @@ -57,3 +81,22 @@ func AddToExistingServices( delete(services, service.Id) }) } + +// AddServiceRelayDifficultyTargetHash sets the relay difficulty target hash +// for the given service to mock it "existing" on chain. +// It will also remove the service relay difficulty target hashes from the map when the test is cleaned up. +func SetServiceRelayDifficultyTargetHash(t *testing.T, + serviceId string, + relayDifficultyTargetHash []byte, +) { + t.Helper() + + relayDifficultyTargets[serviceId] = &servicetypes.RelayMiningDifficulty{ + ServiceId: serviceId, + TargetHash: relayDifficultyTargetHash, + } + + t.Cleanup(func() { + delete(relayDifficultyTargets, serviceId) + }) +} diff --git a/testutil/testclient/testqueryclients/tokenomicsquerier.go b/testutil/testclient/testqueryclients/tokenomicsquerier.go deleted file mode 100644 index dc8c2e72e..000000000 --- a/testutil/testclient/testqueryclients/tokenomicsquerier.go +++ /dev/null @@ -1,66 +0,0 @@ -package testqueryclients - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/testutil/mockclient" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// TODO_TECHDEBT: refactor the methods using this variable to avoid having a global scope -// for the map across unit tests run under the same testing.T instance. -// Ditto for other similar package-level variables in this package. -// relayDifficultyTargets is a map of: serviceId -> RelayMiningDifficulty -// It is updated by the SetServiceRelayDifficultyTargetHash, and read by -// the mock tokenomics query client to get a specific service's relay difficulty -// target hash. -var relayDifficultyTargets = make(map[string]*tokenomicstypes.RelayMiningDifficulty) - -// NewTestTokenomicsQueryClient creates a mock of the TokenomicsQueryClient -// which allows the caller to call GetSession any times and will return -// the session matching the app address, serviceID and the blockHeight passed. -func NewTestTokenomicsQueryClient( - t *testing.T, -) *mockclient.MockTokenomicsQueryClient { - t.Helper() - ctrl := gomock.NewController(t) - - tokenomicsQuerier := mockclient.NewMockTokenomicsQueryClient(ctrl) - tokenomicsQuerier.EXPECT().GetServiceRelayDifficultyTargetHash(gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - serviceId string, - ) (*tokenomicstypes.RelayMiningDifficulty, error) { - relayDifficulty, ok := relayDifficultyTargets[serviceId] - if !ok { - return nil, tokenomicstypes.ErrTokenomicsMissingRelayMiningDifficulty.Wrapf("retrieving the relay mining difficulty for service %s", serviceId) - } - - return relayDifficulty, nil - }). - AnyTimes() - - return tokenomicsQuerier -} - -// AddServiceRelayDifficultyTargetHash sets the relay difficulty target hash -// for the given service to mock it "existing" on chain. -// It will also remove the service relay difficulty target hashes from the map when the test is cleaned up. -func SetServiceRelayDifficultyTargetHash(t *testing.T, - serviceId string, - relayDifficultyTargetHash []byte, -) { - t.Helper() - - relayDifficultyTargets[serviceId] = &tokenomicstypes.RelayMiningDifficulty{ - ServiceId: serviceId, - TargetHash: relayDifficultyTargetHash, - } - - t.Cleanup(func() { - delete(relayDifficultyTargets, serviceId) - }) -} diff --git a/x/proof/keeper/msg_server_create_claim.go b/x/proof/keeper/msg_server_create_claim.go index dd53f3d78..6bfa498d5 100644 --- a/x/proof/keeper/msg_server_create_claim.go +++ b/x/proof/keeper/msg_server_create_claim.go @@ -80,7 +80,7 @@ func (k msgServer) CreateClaim( } // Get the number of claimed compute units in the claim - numClaimComputeUnits, err = claim.GetNumComputeUnits() + numClaimComputeUnits, err = claim.GetNumClaimedComputeUnits() if err != nil { return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrapf("%v", err).Error()) } @@ -123,17 +123,19 @@ func (k msgServer) CreateClaim( case true: claimUpsertEvent = proto.Message( &types.EventClaimUpdated{ - Claim: &claim, - NumRelays: numRelays, - NumComputeUnits: numClaimComputeUnits, + Claim: &claim, + NumRelays: numRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt }, ) case false: claimUpsertEvent = proto.Message( &types.EventClaimCreated{ - Claim: &claim, - NumRelays: numRelays, - NumComputeUnits: numClaimComputeUnits, + Claim: &claim, + NumRelays: numRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt }, ) } diff --git a/x/proof/keeper/msg_server_create_claim_test.go b/x/proof/keeper/msg_server_create_claim_test.go index 8a34f4fb7..87a8a81fd 100644 --- a/x/proof/keeper/msg_server_create_claim_test.go +++ b/x/proof/keeper/msg_server_create_claim_test.go @@ -51,8 +51,8 @@ func TestMsgServer_CreateClaim_Success(t *testing.T) { ) int64 merkleRoot smt.MerkleSumRoot // The Compute Units Per Relay for the service used in the test. - serviceComputeUnitsPerRelay uint64 - expectedNumComputeUnits uint64 + serviceComputeUnitsPerRelay uint64 + expectedNumClaimedComputeUnits uint64 }{ { desc: "claim message height equals supplier's earliest claim commit height", @@ -64,23 +64,23 @@ func TestMsgServer_CreateClaim_Success(t *testing.T) { supplierOperatorAddr, ) }, - merkleRoot: defaultMerkleRoot, - serviceComputeUnitsPerRelay: computeUnitsPerRelay, - expectedNumComputeUnits: expectedNumComputeUnits, + merkleRoot: defaultMerkleRoot, + serviceComputeUnitsPerRelay: computeUnitsPerRelay, + expectedNumClaimedComputeUnits: expectedNumComputeUnits, }, { - desc: "claim message height equals claim window close height", - getClaimMsgHeight: shared.GetClaimWindowCloseHeight, - merkleRoot: defaultMerkleRoot, - serviceComputeUnitsPerRelay: computeUnitsPerRelay, - expectedNumComputeUnits: expectedNumComputeUnits, + desc: "claim message height equals claim window close height", + getClaimMsgHeight: shared.GetClaimWindowCloseHeight, + merkleRoot: defaultMerkleRoot, + serviceComputeUnitsPerRelay: computeUnitsPerRelay, + expectedNumClaimedComputeUnits: expectedNumComputeUnits, }, { - desc: "claim message for service with >1 compute units per relay", - getClaimMsgHeight: shared.GetClaimWindowCloseHeight, - merkleRoot: customComputeUnitsPerRelayMerkleRoot, - serviceComputeUnitsPerRelay: nonDefaultComputeUnitsPerRelay, - expectedNumComputeUnits: expectedNonDefaultNumComputeUnits, + desc: "claim message for service with >1 compute units per relay", + getClaimMsgHeight: shared.GetClaimWindowCloseHeight, + merkleRoot: customComputeUnitsPerRelayMerkleRoot, + serviceComputeUnitsPerRelay: nonDefaultComputeUnitsPerRelay, + expectedNumClaimedComputeUnits: expectedNonDefaultNumComputeUnits, }, } @@ -175,7 +175,7 @@ func TestMsgServer_CreateClaim_Success(t *testing.T) { require.Len(t, claimCreatedEvents, 1) require.EqualValues(t, &claim, claimCreatedEvents[0].GetClaim()) - require.Equal(t, uint64(test.expectedNumComputeUnits), claimCreatedEvents[0].GetNumComputeUnits()) + require.Equal(t, uint64(test.expectedNumClaimedComputeUnits), claimCreatedEvents[0].GetNumClaimedComputeUnits()) require.Equal(t, uint64(expectedNumRelays), claimCreatedEvents[0].GetNumRelays()) }) } @@ -599,7 +599,7 @@ func TestMsgServer_CreateClaim_Error_ComputeUnitsMismatch(t *testing.T) { // use the test claim message to create a claim object to get the number of relays and compute units in the claim. testClaim := types.Claim{RootHash: testClaimMsg.GetRootHash()} - testClaimNumComputeUnits, err := testClaim.GetNumComputeUnits() + testClaimNumComputeUnits, err := testClaim.GetNumClaimedComputeUnits() require.NoError(t, err) testClaimNumRelays, err := testClaim.GetNumRelays() require.NoError(t, err) diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index ed819784a..b7f90fa36 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -42,10 +42,10 @@ func (k msgServer) SubmitProof( ) (_ *types.MsgSubmitProofResponse, err error) { // Declare claim to reference in telemetry. var ( - claim = new(types.Claim) - isExistingProof bool - numRelays uint64 - numComputeUnits uint64 + claim = new(types.Claim) + isExistingProof bool + numRelays uint64 + numClaimComputeUnits uint64 ) // Defer telemetry calls so that they reference the final values the relevant variables. @@ -54,7 +54,7 @@ func (k msgServer) SubmitProof( if !isExistingProof { telemetry.ClaimCounter(types.ClaimProofStage_PROVEN, 1, err) telemetry.ClaimRelaysCounter(types.ClaimProofStage_PROVEN, numRelays, err) - telemetry.ClaimComputeUnitsCounter(types.ClaimProofStage_PROVEN, numComputeUnits, err) + telemetry.ClaimComputeUnitsCounter(types.ClaimProofStage_PROVEN, numClaimComputeUnits, err) } }() @@ -120,7 +120,7 @@ func (k msgServer) SubmitProof( if err != nil { return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } - numComputeUnits, err = claim.GetNumComputeUnits() + numClaimComputeUnits, err = claim.GetNumClaimedComputeUnits() if err != nil { return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } @@ -139,19 +139,21 @@ func (k msgServer) SubmitProof( case true: proofUpsertEvent = proto.Message( &types.EventProofUpdated{ - Claim: claim, - Proof: &proof, - NumRelays: numRelays, - NumComputeUnits: numComputeUnits, + Claim: claim, + Proof: &proof, + NumRelays: numRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt }, ) case false: proofUpsertEvent = proto.Message( &types.EventProofSubmitted{ - Claim: claim, - Proof: &proof, - NumRelays: numRelays, - NumComputeUnits: numComputeUnits, + Claim: claim, + Proof: &proof, + NumRelays: numRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt }, ) } @@ -225,7 +227,7 @@ func (k Keeper) ProofRequirementForClaim(ctx context.Context, claim *types.Claim // is retrieved from the store and validated, on-chain, at time of creation. // TODO(@red-0ne, #781): Ensure we're using the scaled/estimated compute units here. var numClaimComputeUnits uint64 - numClaimComputeUnits, err = claim.GetNumComputeUnits() + numClaimComputeUnits, err = claim.GetNumClaimedComputeUnits() if err != nil { return requirementReason, err } diff --git a/x/proof/keeper/msg_server_submit_proof_test.go b/x/proof/keeper/msg_server_submit_proof_test.go index aca0937e1..d05e0a7d1 100644 --- a/x/proof/keeper/msg_server_submit_proof_test.go +++ b/x/proof/keeper/msg_server_submit_proof_test.go @@ -46,8 +46,7 @@ var ( // - the relay difficulty target hash to the easiest difficulty so that these tests don't need to mine for valid relays. // - the proof request probability to 1 so that all test sessions require a proof. testProofParams = prooftypes.Params{ - RelayDifficultyTargetHash: protocol.BaseRelayDifficultyHashBz, - ProofRequestProbability: 1, + ProofRequestProbability: 1, } ) @@ -99,7 +98,6 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { // Set proof keeper params to disable relay mining and always require a proof. proofParams := keepers.Keeper.GetParams(ctx) proofParams.ProofRequestProbability = testProofParams.ProofRequestProbability - proofParams.RelayDifficultyTargetHash = testProofParams.RelayDifficultyTargetHash err := keepers.Keeper.SetParams(ctx, proofParams) require.NoError(t, err) @@ -157,7 +155,7 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { // Submit the corresponding proof. numRelays := uint64(5) - numComputeUnits := numRelays * service.ComputeUnitsPerRelay + numClaimComputeUnits := numRelays * service.ComputeUnitsPerRelay sessionTree := testtree.NewFilledSessionTree( ctx, t, numRelays, service.ComputeUnitsPerRelay, @@ -240,7 +238,8 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) { require.EqualValues(t, claim, proofSubmittedEvent.GetClaim()) require.EqualValues(t, &proofs[0], proofSubmittedEvent.GetProof()) require.Equal(t, uint64(numRelays), proofSubmittedEvent.GetNumRelays()) - require.Equal(t, uint64(numComputeUnits), proofSubmittedEvent.GetNumComputeUnits()) + require.Equal(t, uint64(numClaimComputeUnits), proofSubmittedEvent.GetNumClaimedComputeUnits()) + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt assertions }) } } @@ -259,7 +258,6 @@ func TestMsgServer_SubmitProof_Error_OutsideOfWindow(t *testing.T) { // Set proof keeper params to disable relaymining and always require a proof. proofParams := keepers.Keeper.GetParams(ctx) proofParams.ProofRequestProbability = testProofParams.ProofRequestProbability - proofParams.RelayDifficultyTargetHash = testProofParams.RelayDifficultyTargetHash err := keepers.Keeper.SetParams(ctx, proofParams) require.NoError(t, err) @@ -705,7 +703,6 @@ func TestMsgServer_SubmitProof_FailSubmittingNonRequiredProof(t *testing.T) { // Set proof keeper params to disable relay mining but never require a proof. proofParams := keepers.Keeper.GetParams(ctx) proofParams.ProofRequestProbability = 0 - proofParams.RelayDifficultyTargetHash = testProofParams.RelayDifficultyTargetHash err := keepers.Keeper.SetParams(ctx, proofParams) require.NoError(t, err) diff --git a/x/proof/keeper/msg_server_update_param.go b/x/proof/keeper/msg_server_update_param.go index df698a38b..d98db8206 100644 --- a/x/proof/keeper/msg_server_update_param.go +++ b/x/proof/keeper/msg_server_update_param.go @@ -23,13 +23,6 @@ func (k msgServer) UpdateParam( params := k.GetParams(ctx) switch msg.Name { - case types.ParamRelayDifficultyTargetHash: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsBytes) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.RelayDifficultyTargetHash = value.AsBytes case types.ParamProofRequestProbability: value, ok := msg.AsType.(*types.MsgUpdateParam_AsFloat) if !ok { diff --git a/x/proof/keeper/msg_server_update_param_test.go b/x/proof/keeper/msg_server_update_param_test.go index 52078f52a..ba3a39c31 100644 --- a/x/proof/keeper/msg_server_update_param_test.go +++ b/x/proof/keeper/msg_server_update_param_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "encoding/hex" "testing" "cosmossdk.io/math" @@ -16,33 +15,6 @@ import ( prooftypes "github.com/pokt-network/poktroll/x/proof/types" ) -func TestMsgUpdateParam_UpdateMinRelayDifficultyBitsOnly(t *testing.T) { - expectedRelayDifficultyTargetHash, _ := hex.DecodeString("0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff") - - // Set the parameters to their default values - k, msgSrv, ctx := setupMsgServer(t) - defaultParams := prooftypes.DefaultParams() - require.NoError(t, k.SetParams(ctx, defaultParams)) - - // Ensure the default values are different from the new values we want to set - require.NotEqual(t, expectedRelayDifficultyTargetHash, defaultParams.RelayDifficultyTargetHash) - - // Update the min stake. - updateParamMsg := &prooftypes.MsgUpdateParam{ - Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), - Name: prooftypes.ParamRelayDifficultyTargetHash, - AsType: &prooftypes.MsgUpdateParam_AsBytes{AsBytes: expectedRelayDifficultyTargetHash}, - } - res, err := msgSrv.UpdateParam(ctx, updateParamMsg) - require.NoError(t, err) - - require.NotEqual(t, defaultParams.RelayDifficultyTargetHash, res.Params.RelayDifficultyTargetHash) - require.Equal(t, expectedRelayDifficultyTargetHash, res.Params.RelayDifficultyTargetHash) - - // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "RelayDifficultyTargetHash") -} - func TestMsgUpdateParam_UpdateProofRequestProbabilityOnly(t *testing.T) { var expectedProofRequestProbability float32 = 0.1 diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index f50570c46..2c6739855 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -42,9 +42,8 @@ func TestMsgUpdateParams(t *testing.T) { params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{ - ProofMissingPenalty: &types.DefaultProofMissingPenalty, - ProofSubmissionFee: &types.MinProofSubmissionFee, - RelayDifficultyTargetHash: types.DefaultRelayDifficultyTargetHash, + ProofMissingPenalty: &types.DefaultProofMissingPenalty, + ProofSubmissionFee: &types.MinProofSubmissionFee, }, }, shouldError: false, diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go index 50370a3d2..128ada551 100644 --- a/x/proof/keeper/params_test.go +++ b/x/proof/keeper/params_test.go @@ -19,35 +19,6 @@ func TestGetParams(t *testing.T) { require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) } -func TestParams_ValidateMinRelayDifficulty(t *testing.T) { - tests := []struct { - desc string - relayDifficultyTargetHash any - expectedErr error - }{ - { - desc: "invalid type", - relayDifficultyTargetHash: int64(-1), - expectedErr: prooftypes.ErrProofParamInvalid.Wrapf("invalid parameter type: int64"), - }, - { - desc: "valid RelayDifficultyTargetHash", - relayDifficultyTargetHash: prooftypes.DefaultRelayDifficultyTargetHash, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := prooftypes.ValidateRelayDifficultyTargetHash(tt.relayDifficultyTargetHash) - if tt.expectedErr != nil { - require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErr.Error()) - } else { - require.NoError(t, err) - } - }) - } -} func TestParams_ValidateProofRequestProbability(t *testing.T) { tests := []struct { diff --git a/x/proof/keeper/proof_validation.go b/x/proof/keeper/proof_validation.go index f771ca626..46a0af656 100644 --- a/x/proof/keeper/proof_validation.go +++ b/x/proof/keeper/proof_validation.go @@ -36,6 +36,7 @@ import ( "github.com/pokt-network/poktroll/pkg/crypto/protocol" "github.com/pokt-network/poktroll/x/proof/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" ) @@ -162,19 +163,17 @@ func (k Keeper) EnsureValidProof( } logger.Debug("successfully verified relay response signature") - // Get the proof module's governance parameters. - // TODO_BETA(@red-0ne): Ensure we use the difficulty from the service and add - // a test for a proof with an invalid difficulty. - params := k.GetParams(ctx) - serviceRelayDifficultyTargetHash := params.RelayDifficultyTargetHash - if len(serviceRelayDifficultyTargetHash) == 0 { - serviceRelayDifficultyTargetHash = types.DefaultRelayDifficultyTargetHash + // Get the service's relay mining difficulty. + serviceRelayDifficulty, found := k.serviceKeeper.GetRelayMiningDifficulty(ctx, sessionHeader.GetServiceId()) + if !found { + // If the relay mining difficulty is not found, use the default relay mining difficulty. + serviceRelayDifficulty = servicekeeper.NewDefaultRelayMiningDifficulty(ctx, k.Logger(), sessionHeader.GetServiceId(), servicekeeper.TargetNumRelays) } // Verify the relay difficulty is above the minimum required to earn rewards. if err = validateRelayDifficulty( relayBz, - serviceRelayDifficultyTargetHash, + serviceRelayDifficulty.GetTargetHash(), ); err != nil { return types.ErrProofInvalidRelayDifficulty.Wrapf("failed to validate relay difficulty for service %s due to: %v", sessionHeader.ServiceId, err) } diff --git a/x/proof/keeper/proof_validation_test.go b/x/proof/keeper/proof_validation_test.go index 13222338d..8d118eade 100644 --- a/x/proof/keeper/proof_validation_test.go +++ b/x/proof/keeper/proof_validation_test.go @@ -1,10 +1,12 @@ package keeper_test import ( + "context" "encoding/hex" "testing" "cosmossdk.io/depinject" + "cosmossdk.io/log" ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" "github.com/cosmos/cosmos-sdk/crypto/keyring" cosmostypes "github.com/cosmos/cosmos-sdk/types" @@ -22,6 +24,7 @@ import ( "github.com/pokt-network/poktroll/testutil/testtree" "github.com/pokt-network/poktroll/x/proof/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" servicetypes "github.com/pokt-network/poktroll/x/service/types" "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" @@ -588,17 +591,12 @@ func TestEnsureValidProof_Error(t *testing.T) { { desc: "relay difficulty must be greater than or equal to a high difficulty (low target hash)", newProof: func(t *testing.T) *prooftypes.Proof { - // Set the minimum relay difficulty to a non-zero value such that the relays - // constructed by the test helpers have a negligible chance of being valid. - err = keepers.Keeper.SetParams(ctx, prooftypes.Params{ - RelayDifficultyTargetHash: lowTargetHash, - }) - require.NoError(t, err) - + serviceId := validSessionHeader.GetServiceId() + logger := log.NewNopLogger() + setRelayMiningDifficultyHash(ctx, keepers.ServiceKeeper, serviceId, lowTargetHash, logger) // Reset the minimum relay difficulty to zero after this test case. t.Cleanup(func() { - err = keepers.Keeper.SetParams(ctx, prooftypes.DefaultParams()) - require.NoError(t, err) + setRelayMiningDifficultyHash(ctx, keepers.ServiceKeeper, serviceId, protocol.BaseRelayDifficultyHashBz, logger) }) // Construct a proof message with a session tree containing @@ -777,3 +775,15 @@ func TestEnsureValidProof_Error(t *testing.T) { }) } } + +func setRelayMiningDifficultyHash( + ctx context.Context, + serviceKeeper prooftypes.ServiceKeeper, + serviceId string, + targetHash []byte, + logger log.Logger, +) { + relayMiningDifficulty := servicekeeper.NewDefaultRelayMiningDifficulty(ctx, logger, serviceId, servicekeeper.TargetNumRelays) + relayMiningDifficulty.TargetHash = targetHash + serviceKeeper.SetRelayMiningDifficulty(ctx, relayMiningDifficulty) +} diff --git a/x/proof/types/claim.go b/x/proof/types/claim.go index a2f46fb1f..37b144d6d 100644 --- a/x/proof/types/claim.go +++ b/x/proof/types/claim.go @@ -7,9 +7,9 @@ import ( poktrand "github.com/pokt-network/poktroll/pkg/crypto/rand" ) -// GetNumComputeUnits returns the number of compute units for a given claim +// GetNumClaimedComputeUnits returns the number of compute units for a given claim // as determined by the sum of the root hash. -func (claim *Claim) GetNumComputeUnits() (numComputeUnits uint64, err error) { +func (claim *Claim) GetNumClaimedComputeUnits() (numClaimedComputeUnits uint64, err error) { return smt.MerkleSumRoot(claim.GetRootHash()).Sum() } diff --git a/x/proof/types/event.pb.go b/x/proof/types/event.pb.go index 2ef856138..6660aa44e 100644 --- a/x/proof/types/event.pb.go +++ b/x/proof/types/event.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -24,9 +25,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type EventClaimCreated struct { - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` - NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` - NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` + ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` } func (m *EventClaimCreated) Reset() { *m = EventClaimCreated{} } @@ -72,18 +75,34 @@ func (m *EventClaimCreated) GetNumRelays() uint64 { return 0 } -func (m *EventClaimCreated) GetNumComputeUnits() uint64 { +func (m *EventClaimCreated) GetNumClaimedComputeUnits() uint64 { if m != nil { - return m.NumComputeUnits + return m.NumClaimedComputeUnits } return 0 } +func (m *EventClaimCreated) GetNumEstimatedComputeUnits() uint64 { + if m != nil { + return m.NumEstimatedComputeUnits + } + return 0 +} + +func (m *EventClaimCreated) GetClaimedAmountUpokt() *types.Coin { + if m != nil { + return m.ClaimedAmountUpokt + } + return nil +} + // TODO_TEST: Add coverage for claim updates. type EventClaimUpdated struct { - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` - NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` - NumComputeUnits uint64 `protobuf:"varint,3,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` + ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` } func (m *EventClaimUpdated) Reset() { *m = EventClaimUpdated{} } @@ -129,18 +148,34 @@ func (m *EventClaimUpdated) GetNumRelays() uint64 { return 0 } -func (m *EventClaimUpdated) GetNumComputeUnits() uint64 { +func (m *EventClaimUpdated) GetNumClaimedComputeUnits() uint64 { if m != nil { - return m.NumComputeUnits + return m.NumClaimedComputeUnits } return 0 } +func (m *EventClaimUpdated) GetNumEstimatedComputeUnits() uint64 { + if m != nil { + return m.NumEstimatedComputeUnits + } + return 0 +} + +func (m *EventClaimUpdated) GetClaimedAmountUpokt() *types.Coin { + if m != nil { + return m.ClaimedAmountUpokt + } + return nil +} + type EventProofSubmitted struct { - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` - Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` - NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` + ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` } func (m *EventProofSubmitted) Reset() { *m = EventProofSubmitted{} } @@ -193,19 +228,35 @@ func (m *EventProofSubmitted) GetNumRelays() uint64 { return 0 } -func (m *EventProofSubmitted) GetNumComputeUnits() uint64 { +func (m *EventProofSubmitted) GetNumClaimedComputeUnits() uint64 { if m != nil { - return m.NumComputeUnits + return m.NumClaimedComputeUnits } return 0 } +func (m *EventProofSubmitted) GetNumEstimatedComputeUnits() uint64 { + if m != nil { + return m.NumEstimatedComputeUnits + } + return 0 +} + +func (m *EventProofSubmitted) GetClaimedAmountUpokt() *types.Coin { + if m != nil { + return m.ClaimedAmountUpokt + } + return nil +} + // TODO_TEST: Add coverage for proof updates. type EventProofUpdated struct { - Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` - Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` - NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim"` + Proof *Proof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"` + NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` + ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` } func (m *EventProofUpdated) Reset() { *m = EventProofUpdated{} } @@ -258,13 +309,27 @@ func (m *EventProofUpdated) GetNumRelays() uint64 { return 0 } -func (m *EventProofUpdated) GetNumComputeUnits() uint64 { +func (m *EventProofUpdated) GetNumClaimedComputeUnits() uint64 { if m != nil { - return m.NumComputeUnits + return m.NumClaimedComputeUnits } return 0 } +func (m *EventProofUpdated) GetNumEstimatedComputeUnits() uint64 { + if m != nil { + return m.NumEstimatedComputeUnits + } + return 0 +} + +func (m *EventProofUpdated) GetClaimedAmountUpokt() *types.Coin { + if m != nil { + return m.ClaimedAmountUpokt + } + return nil +} + func init() { proto.RegisterType((*EventClaimCreated)(nil), "poktroll.proof.EventClaimCreated") proto.RegisterType((*EventClaimUpdated)(nil), "poktroll.proof.EventClaimUpdated") @@ -275,29 +340,36 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/event.proto", fileDescriptor_dd4c19e04487fbec) } var fileDescriptor_dd4c19e04487fbec = []byte{ - // 341 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0xc8, 0xcf, 0x2e, - 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x28, 0xca, 0xcf, 0x4f, 0xd3, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, - 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xc9, 0xe9, 0x81, 0xe5, 0xa4, 0x44, 0xd2, - 0xf3, 0xd3, 0xf3, 0xc1, 0x52, 0xfa, 0x20, 0x16, 0x44, 0x95, 0x14, 0xba, 0x09, 0x25, 0x95, 0x05, - 0xa9, 0xc5, 0x10, 0x39, 0xa5, 0xbd, 0x8c, 0x5c, 0x82, 0xae, 0x20, 0x13, 0x9d, 0x73, 0x12, 0x33, - 0x73, 0x9d, 0x8b, 0x52, 0x13, 0x4b, 0x52, 0x53, 0x84, 0xcc, 0xb8, 0x58, 0x93, 0x41, 0x7c, 0x09, - 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x51, 0x3d, 0x54, 0x7b, 0xf4, 0xc0, 0x8a, 0x9d, 0x38, 0x5f, - 0xdd, 0x93, 0x87, 0xa8, 0x0b, 0x82, 0x50, 0x42, 0xba, 0x5c, 0x5c, 0x79, 0xa5, 0xb9, 0xf1, 0x45, - 0xa9, 0x39, 0x89, 0x95, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x2c, 0x4e, 0x7c, 0xaf, 0xee, 0xc9, - 0x23, 0x89, 0x06, 0x71, 0xe6, 0x95, 0xe6, 0x06, 0x81, 0x99, 0x42, 0x8e, 0x5c, 0x82, 0x20, 0x89, - 0xe4, 0xfc, 0xdc, 0x82, 0xd2, 0x92, 0xd4, 0xf8, 0xd2, 0xbc, 0xcc, 0x92, 0x62, 0x09, 0x66, 0xb0, - 0x2e, 0xd1, 0x57, 0xf7, 0xe4, 0x31, 0x25, 0x83, 0xf8, 0xf3, 0x4a, 0x73, 0x9d, 0x21, 0x22, 0xa1, - 0x20, 0x01, 0x34, 0xf7, 0x87, 0x16, 0xa4, 0x0c, 0x31, 0xf7, 0x7f, 0x67, 0xe4, 0x12, 0x06, 0xbb, - 0x3f, 0x00, 0xe4, 0xb0, 0xe0, 0xd2, 0xa4, 0xdc, 0xcc, 0x12, 0x4a, 0x7c, 0x60, 0xc6, 0xc5, 0x0a, - 0x56, 0x00, 0x76, 0x3c, 0x16, 0x7d, 0x60, 0x6b, 0x20, 0xfa, 0xc0, 0x02, 0x41, 0x10, 0x0a, 0xcd, - 0xe7, 0xcc, 0x64, 0xf9, 0x9c, 0x85, 0x24, 0x9f, 0x7f, 0x85, 0xc5, 0x1c, 0xd8, 0x49, 0x94, 0xc6, - 0xdc, 0x90, 0xf1, 0xb7, 0x93, 0xcf, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0xde, 0x78, - 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, - 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x97, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, - 0x0f, 0xf2, 0x82, 0x6e, 0x5e, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0x3c, 0x0f, 0x57, 0x20, - 0xe7, 0xe2, 0x24, 0x36, 0x70, 0x36, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xfc, 0x84, 0x01, - 0x75, 0x26, 0x04, 0x00, 0x00, + // 456 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x95, 0x41, 0x6b, 0xdb, 0x30, + 0x14, 0xc7, 0xe3, 0xa5, 0x29, 0x54, 0x83, 0xc2, 0xbc, 0x6e, 0xb8, 0x19, 0x93, 0xcb, 0x4e, 0xbd, + 0x54, 0xa2, 0x1b, 0xf4, 0xbe, 0x98, 0xde, 0x76, 0x18, 0x1e, 0x81, 0xb1, 0xc3, 0x82, 0xed, 0x68, + 0x99, 0x69, 0xa4, 0x67, 0x6c, 0xa9, 0x5b, 0xbf, 0xc5, 0xee, 0xfb, 0x42, 0x3b, 0x16, 0xc6, 0xa0, + 0x27, 0x33, 0x92, 0x9b, 0x3f, 0xc5, 0xd0, 0x53, 0x3c, 0x5a, 0xd3, 0xed, 0x92, 0x4b, 0x0e, 0x39, + 0x49, 0xfe, 0xff, 0xff, 0x4f, 0x92, 0xdf, 0x0f, 0x21, 0x32, 0x2c, 0xe0, 0x42, 0x97, 0x30, 0x9f, + 0xf3, 0xa2, 0x04, 0xf8, 0xc4, 0xc5, 0xa5, 0x50, 0x9a, 0x15, 0x25, 0x68, 0xf0, 0xf7, 0x5b, 0x8f, + 0xa1, 0x37, 0xa4, 0x19, 0x54, 0x12, 0x2a, 0x9e, 0x26, 0x95, 0xe0, 0x97, 0xa7, 0xa9, 0xd0, 0xc9, + 0x29, 0xcf, 0x20, 0x57, 0x2e, 0x3f, 0x3c, 0x98, 0xc1, 0x0c, 0x70, 0xca, 0xed, 0x6c, 0xa5, 0x76, + 0x77, 0xd0, 0x57, 0x85, 0xa8, 0x9c, 0xf7, 0xe2, 0x7b, 0x9f, 0x3c, 0x3a, 0xb7, 0x3b, 0x46, 0xf3, + 0x24, 0x97, 0x51, 0x29, 0x12, 0x2d, 0xa6, 0xfe, 0x19, 0x19, 0x64, 0xf6, 0x3b, 0xf0, 0x8e, 0xbc, + 0xe3, 0x87, 0x2f, 0x9f, 0xb0, 0xbb, 0xe7, 0x60, 0x18, 0x1e, 0xed, 0x35, 0x75, 0xe8, 0x72, 0xb1, + 0x1b, 0xfc, 0x13, 0x42, 0x94, 0x91, 0x93, 0x52, 0xcc, 0x93, 0xab, 0x2a, 0x78, 0x70, 0xe4, 0x1d, + 0xef, 0x8c, 0xf6, 0x9b, 0x3a, 0xbc, 0xa5, 0xc6, 0x7b, 0xca, 0xc8, 0x18, 0xa7, 0xfe, 0x7b, 0x72, + 0x68, 0x0d, 0xac, 0x15, 0xd3, 0x49, 0x06, 0xb2, 0x30, 0x5a, 0x4c, 0x8c, 0xca, 0x75, 0x15, 0xec, + 0x60, 0xf5, 0xf3, 0xa6, 0x0e, 0xff, 0x1d, 0x8a, 0x9f, 0x2a, 0x23, 0x23, 0xe7, 0x44, 0xce, 0x18, + 0x5b, 0xdd, 0xff, 0x48, 0x9e, 0xd9, 0x22, 0x51, 0xe9, 0x5c, 0xda, 0x3f, 0xea, 0xac, 0x3d, 0xc0, + 0xb5, 0xc3, 0xa6, 0x0e, 0xff, 0x17, 0x8b, 0x03, 0x65, 0xe4, 0x79, 0xeb, 0xdd, 0x59, 0x5f, 0x90, + 0x83, 0xf6, 0x40, 0x89, 0x04, 0xa3, 0xf4, 0xc4, 0xd8, 0x16, 0x05, 0xbb, 0xd8, 0xaf, 0x43, 0xe6, + 0x38, 0x31, 0xcb, 0x89, 0xad, 0x38, 0xb1, 0x08, 0x72, 0x35, 0x0a, 0x9a, 0x3a, 0xbc, 0xb7, 0x34, + 0xf6, 0x57, 0xea, 0x6b, 0x14, 0xc7, 0x56, 0xeb, 0xd0, 0x19, 0x17, 0xd3, 0x2d, 0x9d, 0x0d, 0xa2, + 0xf3, 0xab, 0x4f, 0x1e, 0x23, 0x9d, 0xb7, 0xb6, 0xed, 0xef, 0x4c, 0x2a, 0x73, 0xbd, 0x0e, 0x9f, + 0x33, 0x32, 0xc0, 0x00, 0xa2, 0xb9, 0xa7, 0x0e, 0xb7, 0x71, 0x75, 0x28, 0xc4, 0x6e, 0xe8, 0x70, + 0xed, 0x6f, 0xb9, 0xae, 0xc9, 0xf5, 0x67, 0x7b, 0xeb, 0xb0, 0xe1, 0xeb, 0xde, 0xba, 0x2d, 0xd5, + 0x8d, 0xa0, 0x3a, 0x7a, 0xf3, 0x63, 0x41, 0xbd, 0xeb, 0x05, 0xf5, 0x6e, 0x16, 0xd4, 0xfb, 0xbd, + 0xa0, 0xde, 0xb7, 0x25, 0xed, 0x5d, 0x2f, 0x69, 0xef, 0x66, 0x49, 0x7b, 0x1f, 0xd8, 0x2c, 0xd7, + 0x9f, 0x4d, 0xca, 0x32, 0x90, 0xdc, 0xc6, 0x4f, 0x94, 0xd0, 0x5f, 0xa0, 0xbc, 0xe0, 0x7f, 0xdf, + 0xce, 0xaf, 0xb7, 0x5f, 0xcf, 0x74, 0x17, 0x9f, 0xcf, 0x57, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x9b, 0x4e, 0x00, 0x80, 0xbe, 0x07, 0x00, 0x00, } func (m *EventClaimCreated) Marshal() (dAtA []byte, err error) { @@ -320,10 +392,27 @@ func (m *EventClaimCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.NumComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + if m.ClaimedAmountUpokt != nil { + { + size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x18 + dAtA[i] = 0x32 + } + if m.NumEstimatedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if m.NumClaimedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumClaimedComputeUnits)) + i-- + dAtA[i] = 0x20 } if m.NumRelays != 0 { i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) @@ -365,10 +454,27 @@ func (m *EventClaimUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.NumComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + if m.ClaimedAmountUpokt != nil { + { + size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x18 + dAtA[i] = 0x32 + } + if m.NumEstimatedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if m.NumClaimedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumClaimedComputeUnits)) + i-- + dAtA[i] = 0x20 } if m.NumRelays != 0 { i = encodeVarintEvent(dAtA, i, uint64(m.NumRelays)) @@ -410,8 +516,25 @@ func (m *EventProofSubmitted) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.NumComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + if m.ClaimedAmountUpokt != nil { + { + size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.NumEstimatedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if m.NumClaimedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } @@ -467,8 +590,25 @@ func (m *EventProofUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.NumComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + if m.ClaimedAmountUpokt != nil { + { + size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.NumEstimatedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if m.NumClaimedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } @@ -528,8 +668,15 @@ func (m *EventClaimCreated) Size() (n int) { if m.NumRelays != 0 { n += 1 + sovEvent(uint64(m.NumRelays)) } - if m.NumComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.NumComputeUnits)) + if m.NumClaimedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumClaimedComputeUnits)) + } + if m.NumEstimatedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) + } + if m.ClaimedAmountUpokt != nil { + l = m.ClaimedAmountUpokt.Size() + n += 1 + l + sovEvent(uint64(l)) } return n } @@ -547,8 +694,15 @@ func (m *EventClaimUpdated) Size() (n int) { if m.NumRelays != 0 { n += 1 + sovEvent(uint64(m.NumRelays)) } - if m.NumComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.NumComputeUnits)) + if m.NumClaimedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumClaimedComputeUnits)) + } + if m.NumEstimatedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) + } + if m.ClaimedAmountUpokt != nil { + l = m.ClaimedAmountUpokt.Size() + n += 1 + l + sovEvent(uint64(l)) } return n } @@ -570,8 +724,15 @@ func (m *EventProofSubmitted) Size() (n int) { if m.NumRelays != 0 { n += 1 + sovEvent(uint64(m.NumRelays)) } - if m.NumComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.NumComputeUnits)) + if m.NumClaimedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumClaimedComputeUnits)) + } + if m.NumEstimatedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) + } + if m.ClaimedAmountUpokt != nil { + l = m.ClaimedAmountUpokt.Size() + n += 1 + l + sovEvent(uint64(l)) } return n } @@ -593,8 +754,15 @@ func (m *EventProofUpdated) Size() (n int) { if m.NumRelays != 0 { n += 1 + sovEvent(uint64(m.NumRelays)) } - if m.NumComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.NumComputeUnits)) + if m.NumClaimedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumClaimedComputeUnits)) + } + if m.NumEstimatedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) + } + if m.ClaimedAmountUpokt != nil { + l = m.ClaimedAmountUpokt.Size() + n += 1 + l + sovEvent(uint64(l)) } return n } @@ -689,11 +857,11 @@ func (m *EventClaimCreated) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) } - m.NumComputeUnits = 0 + m.NumClaimedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -703,11 +871,66 @@ func (m *EventClaimCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NumComputeUnits |= uint64(b&0x7F) << shift + m.NumClaimedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + m.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ClaimedAmountUpokt == nil { + m.ClaimedAmountUpokt = &types.Coin{} + } + if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) @@ -813,11 +1036,11 @@ func (m *EventClaimUpdated) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) } - m.NumComputeUnits = 0 + m.NumClaimedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -827,11 +1050,66 @@ func (m *EventClaimUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NumComputeUnits |= uint64(b&0x7F) << shift + m.NumClaimedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + m.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ClaimedAmountUpokt == nil { + m.ClaimedAmountUpokt = &types.Coin{} + } + if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) @@ -975,9 +1253,47 @@ func (m *EventProofSubmitted) Unmarshal(dAtA []byte) error { } case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) + } + m.NumClaimedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumClaimedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + m.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) } - m.NumComputeUnits = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -987,11 +1303,28 @@ func (m *EventProofSubmitted) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NumComputeUnits |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ClaimedAmountUpokt == nil { + m.ClaimedAmountUpokt = &types.Coin{} + } + if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) @@ -1135,9 +1468,9 @@ func (m *EventProofUpdated) Unmarshal(dAtA []byte) error { } case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) } - m.NumComputeUnits = 0 + m.NumClaimedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -1147,11 +1480,66 @@ func (m *EventProofUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NumComputeUnits |= uint64(b&0x7F) << shift + m.NumClaimedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + m.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ClaimedAmountUpokt == nil { + m.ClaimedAmountUpokt = &types.Coin{} + } + if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) diff --git a/x/proof/types/expected_keepers.go b/x/proof/types/expected_keepers.go index 1f546b557..66103d2b8 100644 --- a/x/proof/types/expected_keepers.go +++ b/x/proof/types/expected_keepers.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" apptypes "github.com/pokt-network/poktroll/x/application/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -58,6 +59,8 @@ type SharedKeeper interface { // ServiceKeeper defines the expected interface for the Service module. type ServiceKeeper interface { GetService(ctx context.Context, serviceID string) (sharedtypes.Service, bool) + GetRelayMiningDifficulty(ctx context.Context, serviceID string) (servicetypes.RelayMiningDifficulty, bool) // Only used for testing & simulation SetService(ctx context.Context, service sharedtypes.Service) + SetRelayMiningDifficulty(ctx context.Context, relayMiningDifficulty servicetypes.RelayMiningDifficulty) } diff --git a/x/proof/types/message_update_param.go b/x/proof/types/message_update_param.go index 9f1a26539..b4ed1960d 100644 --- a/x/proof/types/message_update_param.go +++ b/x/proof/types/message_update_param.go @@ -49,8 +49,6 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { - case ParamRelayDifficultyTargetHash: - return msg.paramTypeIsBytes() case ParamProofRequestProbability: return msg.paramTypeIsFloat() case ParamProofRequirementThreshold: @@ -64,18 +62,6 @@ func (msg *MsgUpdateParam) ValidateBasic() error { } } -// paramTypeIsBytes checks if the parameter type is a byte slice, returning an error if not. -func (msg *MsgUpdateParam) paramTypeIsBytes() error { - if _, ok := msg.AsType.(*MsgUpdateParam_AsBytes); !ok { - return ErrProofParamInvalid.Wrapf( - "invalid type for param %q expected %T, got %T", - msg.Name, &MsgUpdateParam_AsBytes{}, - msg.AsType, - ) - } - return nil -} - // paramTypeIsFloat checks if the parameter type is Float, returning an error if not. func (msg *MsgUpdateParam) paramTypeIsFloat() error { if _, ok := msg.AsType.(*MsgUpdateParam_AsFloat); !ok { diff --git a/x/proof/types/message_update_param_test.go b/x/proof/types/message_update_param_test.go index d89a323ad..470e95498 100644 --- a/x/proof/types/message_update_param_test.go +++ b/x/proof/types/message_update_param_test.go @@ -28,7 +28,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { name: "invalid: param name incorrect (non-existent)", msg: MsgUpdateParam{ Authority: sample.AccAddress(), - Name: "WRONG_relay_difficulty_target_hash", + Name: "non_existent", AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, }, @@ -37,7 +37,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { name: "invalid: incorrect param type", msg: MsgUpdateParam{ Authority: sample.AccAddress(), - Name: ParamRelayDifficultyTargetHash, + Name: ParamProofMissingPenalty, AsType: &MsgUpdateParam_AsString{AsString: "invalid"}, }, expectedErr: ErrProofParamInvalid, @@ -45,8 +45,8 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { name: "valid: correct authority, param name, and type", msg: MsgUpdateParam{ Authority: sample.AccAddress(), - Name: ParamRelayDifficultyTargetHash, - AsType: &MsgUpdateParam_AsBytes{AsBytes: DefaultRelayDifficultyTargetHash}, + Name: ParamProofMissingPenalty, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultProofMissingPenalty}, }, expectedErr: nil, diff --git a/x/proof/types/params.go b/x/proof/types/params.go index 9b35c3871..2a46bda77 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -7,20 +7,12 @@ import ( "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto/protocol" ) var ( _ client.ProofParams = (*Params)(nil) _ paramtypes.ParamSet = (*Params)(nil) - // TODO_TECHDEBT(#690): Delete this parameter and just use "protocol.BaseRelayDifficultyHashBz" - // as a hard-coded version. This param was originally intended to be a "minimum", - // but the minimum equivalent of "0" in this case is "BaseRelayDifficultyHashBz". - KeyRelayDifficultyTargetHash = []byte("RelayDifficultyTargetHash") - ParamRelayDifficultyTargetHash = "relay_difficulty_target_hash" - DefaultRelayDifficultyTargetHash = protocol.BaseRelayDifficultyHashBz - // TODO_BETA(@red-0ne): Iterate on the parameters below by adding unit suffixes and // consider having the proof_requirement_threshold to be a function of the supplier's stake amount. @@ -54,14 +46,12 @@ func ParamKeyTable() paramtypes.KeyTable { // NewParams creates a new Params instance func NewParams( - relayDifficultyTargetHash []byte, proofRequestProbability float32, proofRequirementThreshold *cosmostypes.Coin, proofMissingPenalty *cosmostypes.Coin, proofSubmissionFee *cosmostypes.Coin, ) Params { return Params{ - RelayDifficultyTargetHash: relayDifficultyTargetHash, ProofRequestProbability: proofRequestProbability, ProofRequirementThreshold: proofRequirementThreshold, ProofMissingPenalty: proofMissingPenalty, @@ -72,7 +62,6 @@ func NewParams( // DefaultParams returns a default set of parameters func DefaultParams() Params { return NewParams( - DefaultRelayDifficultyTargetHash, DefaultProofRequestProbability, &DefaultProofRequirementThreshold, &DefaultProofMissingPenalty, @@ -83,11 +72,6 @@ func DefaultParams() Params { // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair( - KeyRelayDifficultyTargetHash, - &p.RelayDifficultyTargetHash, - ValidateRelayDifficultyTargetHash, - ), paramtypes.NewParamSetPair( KeyProofRequestProbability, &p.ProofRequestProbability, @@ -113,11 +97,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { // ValidateBasic does a sanity check on the provided params. func (params *Params) ValidateBasic() error { - // Validate the ComputeUnitsToTokensMultiplier - if err := ValidateRelayDifficultyTargetHash(params.RelayDifficultyTargetHash); err != nil { - return err - } - if err := ValidateProofRequestProbability(params.ProofRequestProbability); err != nil { return err } @@ -137,26 +116,6 @@ func (params *Params) ValidateBasic() error { return nil } -// ValidateRelayDifficultyTargetHash validates the MinRelayDifficultyBits param. -// NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateRelayDifficultyTargetHash(v interface{}) error { - relayDifficultyTargetHash, ok := v.([]byte) - if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) - } - - if len(relayDifficultyTargetHash) != protocol.RelayHasherSize { - return ErrProofParamInvalid.Wrapf( - "invalid RelayDifficultyTargetHash: (%x); length wanted: %d; got: %d", - relayDifficultyTargetHash, - 32, - len(relayDifficultyTargetHash), - ) - } - - return nil -} - // ValidateProofRequestProbability validates the ProofRequestProbability param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. func ValidateProofRequestProbability(v interface{}) error { diff --git a/x/proof/types/params.pb.go b/x/proof/types/params.pb.go index 6302cfa71..b84b9ab41 100644 --- a/x/proof/types/params.pb.go +++ b/x/proof/types/params.pb.go @@ -4,7 +4,6 @@ package types import ( - bytes "bytes" encoding_binary "encoding/binary" fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" @@ -29,9 +28,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - // TODO_FOLLOWUP(@olshansk, #690): Either delete this or change it to be named "minimum" - // relay_difficulty_target_hash is the maximum value a relay hash must be less than to be volume/reward applicable. - RelayDifficultyTargetHash []byte `protobuf:"bytes,1,opt,name=relay_difficulty_target_hash,json=relayDifficultyTargetHash,proto3" json:"relay_difficulty_target_hash"` // proof_request_probability is the probability of a session requiring a proof // if it's cost (i.e. compute unit consumption) is below the ProofRequirementThreshold. ProofRequestProbability float32 `protobuf:"fixed32,2,opt,name=proof_request_probability,json=proofRequestProbability,proto3" json:"proof_request_probability"` @@ -84,13 +80,6 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetRelayDifficultyTargetHash() []byte { - if m != nil { - return m.RelayDifficultyTargetHash - } - return nil -} - func (m *Params) GetProofRequestProbability() float32 { if m != nil { return m.ProofRequestProbability @@ -126,35 +115,32 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/params.proto", fileDescriptor_2ad689ad5bf3a2d7) } var fileDescriptor_2ad689ad5bf3a2d7 = []byte{ - // 439 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x31, 0x6e, 0xd4, 0x40, - 0x14, 0x86, 0x77, 0x42, 0x48, 0x61, 0x10, 0x12, 0x26, 0x28, 0x76, 0x02, 0xb6, 0x45, 0xb5, 0x42, - 0xc2, 0xa3, 0x40, 0x47, 0xb9, 0x20, 0x44, 0x01, 0xd2, 0xca, 0xa4, 0x81, 0x66, 0x34, 0xde, 0xbc, - 0xb5, 0x47, 0xb1, 0xe7, 0x99, 0x99, 0x59, 0xc0, 0x1c, 0x81, 0x8a, 0x23, 0x70, 0x04, 0x1a, 0xee, - 0x40, 0x99, 0x32, 0x95, 0x85, 0x76, 0x0b, 0x90, 0x4f, 0x81, 0x76, 0x66, 0xb3, 0x29, 0x08, 0xd9, - 0xc6, 0x1a, 0xfd, 0xdf, 0xfb, 0xdf, 0x6f, 0x3d, 0xfd, 0xde, 0x41, 0x83, 0x27, 0x46, 0x61, 0x55, - 0xd1, 0x46, 0x21, 0x4e, 0x69, 0xc3, 0x15, 0xaf, 0x75, 0xda, 0x28, 0x34, 0xe8, 0xdf, 0x3a, 0x87, - 0xa9, 0x85, 0xfb, 0xb7, 0x79, 0x2d, 0x24, 0x52, 0xfb, 0x75, 0x23, 0xfb, 0xbb, 0x05, 0x16, 0x68, - 0x9f, 0x74, 0xf9, 0x5a, 0xa9, 0xd1, 0x04, 0x75, 0x8d, 0x9a, 0xe6, 0x5c, 0x03, 0xfd, 0x70, 0x98, - 0x83, 0xe1, 0x87, 0x74, 0x82, 0x42, 0x3a, 0xfe, 0xe0, 0xc7, 0xb6, 0xb7, 0x33, 0xb6, 0x49, 0x3e, - 0xf7, 0xee, 0x29, 0xa8, 0x78, 0xcb, 0x8e, 0xc5, 0x74, 0x2a, 0x26, 0xb3, 0xca, 0xb4, 0xcc, 0x70, - 0x55, 0x80, 0x61, 0x25, 0xd7, 0x65, 0x40, 0x12, 0x32, 0xbc, 0x39, 0x4a, 0xfa, 0x2e, 0xbe, 0x72, - 0x2e, 0x0b, 0x2d, 0x7d, 0xbe, 0x86, 0x47, 0x96, 0xbd, 0xe4, 0xba, 0xf4, 0xdf, 0x7a, 0xa1, 0xfd, - 0x7f, 0xa6, 0xe0, 0xfd, 0x0c, 0xb4, 0x61, 0x8d, 0xc2, 0x9c, 0xe7, 0xa2, 0x12, 0xa6, 0x0d, 0xb6, - 0x12, 0x32, 0xdc, 0x1a, 0xdd, 0xef, 0xbb, 0xf8, 0xff, 0x43, 0xd9, 0x9e, 0x45, 0x99, 0x23, 0xe3, - 0x0b, 0xe0, 0x7f, 0xf6, 0x0e, 0x2e, 0x5c, 0x42, 0x41, 0x0d, 0xd2, 0x30, 0x53, 0x2a, 0xd0, 0x25, - 0x56, 0xc7, 0xc1, 0xb5, 0x84, 0x0c, 0x6f, 0x3c, 0x0e, 0x53, 0x77, 0x8e, 0x74, 0x79, 0x8e, 0x74, - 0x75, 0x8e, 0xf4, 0x19, 0x0a, 0x39, 0x8a, 0xfb, 0x2e, 0xbe, 0x6a, 0x43, 0x16, 0xae, 0x93, 0x57, - 0xec, 0xe8, 0x1c, 0xf9, 0xa5, 0x77, 0xd7, 0x39, 0x6b, 0xa1, 0xb5, 0x90, 0x05, 0x6b, 0x40, 0xf2, - 0xca, 0xb4, 0xc1, 0xf6, 0xa6, 0xd4, 0xb0, 0xef, 0xe2, 0xcb, 0xbd, 0xd9, 0x1d, 0x2b, 0xbf, 0x76, - 0xea, 0xd8, 0x89, 0x3e, 0x78, 0xbb, 0x6e, 0x5a, 0xcf, 0x72, 0x6b, 0x40, 0xc9, 0xa6, 0x00, 0xc1, - 0xf5, 0x4d, 0x41, 0x41, 0xdf, 0xc5, 0x97, 0x5a, 0x33, 0xdf, 0xaa, 0x6f, 0xd6, 0xe2, 0x0b, 0x80, - 0xa7, 0xc9, 0x9f, 0x6f, 0x31, 0xf9, 0xf2, 0xfb, 0xfb, 0xc3, 0xbd, 0x75, 0x29, 0x3f, 0xad, 0x6a, - 0xe9, 0xca, 0x32, 0x7a, 0xf5, 0x73, 0x1e, 0x91, 0xd3, 0x79, 0x44, 0xce, 0xe6, 0x11, 0xf9, 0x35, - 0x8f, 0xc8, 0xd7, 0x45, 0x34, 0x38, 0x5d, 0x44, 0x83, 0xb3, 0x45, 0x34, 0x78, 0x97, 0x16, 0xc2, - 0x94, 0xb3, 0x3c, 0x9d, 0x60, 0x4d, 0x97, 0x1b, 0x1e, 0x49, 0x30, 0x1f, 0x51, 0x9d, 0xd0, 0x7f, - 0xd6, 0x99, 0xb6, 0x01, 0x9d, 0xef, 0xd8, 0x32, 0x3e, 0xf9, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x63, - 0xa4, 0x76, 0xd5, 0x04, 0x03, 0x00, 0x00, + // 390 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0xce, 0xd2, 0x40, + 0x14, 0x85, 0x29, 0x28, 0x8b, 0x9a, 0x98, 0x58, 0x31, 0xb4, 0x10, 0xa7, 0xc4, 0x15, 0x31, 0x71, + 0x26, 0xe8, 0xce, 0x25, 0x26, 0xae, 0x34, 0x21, 0xd5, 0x8d, 0x6e, 0x9a, 0x16, 0x87, 0x76, 0x42, + 0x3b, 0xb7, 0xce, 0x0c, 0x2a, 0x3e, 0x82, 0x2b, 0x1f, 0xc1, 0x47, 0xf0, 0x31, 0x5c, 0x12, 0x57, + 0xac, 0x1a, 0x53, 0x16, 0x9a, 0x3e, 0x85, 0x61, 0xa6, 0xc0, 0xe2, 0xe7, 0xff, 0xd9, 0x34, 0x93, + 0xf3, 0xdd, 0x73, 0xce, 0x4d, 0x7a, 0xed, 0x61, 0x01, 0x4b, 0x25, 0x20, 0xcb, 0x48, 0x21, 0x00, + 0x16, 0xa4, 0x88, 0x44, 0x94, 0x4b, 0x5c, 0x08, 0x50, 0xe0, 0xdc, 0x3d, 0x40, 0xac, 0xe1, 0xe0, + 0x5e, 0x94, 0x33, 0x0e, 0x44, 0x7f, 0xcd, 0xc8, 0xa0, 0x97, 0x40, 0x02, 0xfa, 0x49, 0xf6, 0xaf, + 0x46, 0x45, 0x73, 0x90, 0x39, 0x48, 0x12, 0x47, 0x92, 0x92, 0x4f, 0x93, 0x98, 0xaa, 0x68, 0x42, + 0xe6, 0xc0, 0xb8, 0xe1, 0x8f, 0x7e, 0x77, 0xec, 0xee, 0x4c, 0x37, 0x39, 0xef, 0x6c, 0x4f, 0x87, + 0x87, 0x82, 0x7e, 0x5c, 0x51, 0xa9, 0xc2, 0x42, 0x40, 0x1c, 0xc5, 0x2c, 0x63, 0x6a, 0xed, 0xb6, + 0x47, 0xd6, 0xb8, 0x3d, 0x7d, 0x58, 0x97, 0xfe, 0xf5, 0x43, 0x41, 0x5f, 0xa3, 0xc0, 0x90, 0xd9, + 0x09, 0x38, 0x5f, 0xed, 0xe1, 0xc9, 0xc5, 0x04, 0xcd, 0x29, 0x57, 0xa1, 0x4a, 0x05, 0x95, 0x29, + 0x64, 0x1f, 0xdc, 0xce, 0xc8, 0x1a, 0xdf, 0x79, 0xea, 0x61, 0xb3, 0x2b, 0xde, 0xef, 0x8a, 0x9b, + 0x5d, 0xf1, 0x0b, 0x60, 0x7c, 0xea, 0xd7, 0xa5, 0x7f, 0x53, 0x42, 0xe0, 0x1d, 0x9b, 0x1b, 0xf6, + 0xf6, 0x80, 0x9c, 0xd4, 0x7e, 0x60, 0x9c, 0x39, 0x93, 0x92, 0xf1, 0x24, 0x2c, 0x28, 0x8f, 0x32, + 0xb5, 0x76, 0x6f, 0x5d, 0x6a, 0xf5, 0xea, 0xd2, 0x3f, 0xef, 0x0d, 0xee, 0x6b, 0xf9, 0xb5, 0x51, + 0x67, 0x46, 0x74, 0xa8, 0xdd, 0x33, 0xd3, 0x72, 0x15, 0x6b, 0x03, 0xf0, 0x70, 0x41, 0xa9, 0x7b, + 0xfb, 0x52, 0x91, 0x5b, 0x97, 0xfe, 0x59, 0x6b, 0xe0, 0x68, 0xf5, 0xcd, 0x51, 0x7c, 0x49, 0xe9, + 0xf3, 0xd1, 0xbf, 0x1f, 0xbe, 0xf5, 0xed, 0xef, 0xcf, 0xc7, 0xfd, 0xe3, 0xc5, 0x7c, 0x69, 0x6e, + 0xc6, 0xfc, 0xc9, 0xe9, 0xab, 0x5f, 0x15, 0xb2, 0x36, 0x15, 0xb2, 0xb6, 0x15, 0xb2, 0xfe, 0x54, + 0xc8, 0xfa, 0xbe, 0x43, 0xad, 0xcd, 0x0e, 0xb5, 0xb6, 0x3b, 0xd4, 0x7a, 0x8f, 0x13, 0xa6, 0xd2, + 0x55, 0x8c, 0xe7, 0x90, 0x93, 0x7d, 0xc2, 0x13, 0x4e, 0xd5, 0x67, 0x10, 0x4b, 0x72, 0x25, 0x4e, + 0xad, 0x0b, 0x2a, 0xe3, 0xae, 0xbe, 0x94, 0x67, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x68, 0xf0, + 0x63, 0xa9, 0xa1, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -176,9 +162,6 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } - if !bytes.Equal(this.RelayDifficultyTargetHash, that1.RelayDifficultyTargetHash) { - return false - } if this.ProofRequestProbability != that1.ProofRequestProbability { return false } @@ -255,13 +238,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x15 } - if len(m.RelayDifficultyTargetHash) > 0 { - i -= len(m.RelayDifficultyTargetHash) - copy(dAtA[i:], m.RelayDifficultyTargetHash) - i = encodeVarintParams(dAtA, i, uint64(len(m.RelayDifficultyTargetHash))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } @@ -282,10 +258,6 @@ func (m *Params) Size() (n int) { } var l int _ = l - l = len(m.RelayDifficultyTargetHash) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } if m.ProofRequestProbability != 0 { n += 5 } @@ -339,40 +311,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RelayDifficultyTargetHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RelayDifficultyTargetHash = append(m.RelayDifficultyTargetHash[:0], dAtA[iNdEx:postIndex]...) - if m.RelayDifficultyTargetHash == nil { - m.RelayDifficultyTargetHash = []byte{} - } - iNdEx = postIndex case 2: if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field ProofRequestProbability", wireType) diff --git a/x/tokenomics/keeper/query_relay_mining_difficulty.go b/x/service/keeper/query_relay_mining_difficulty.go similarity index 97% rename from x/tokenomics/keeper/query_relay_mining_difficulty.go rename to x/service/keeper/query_relay_mining_difficulty.go index 6b7b2f36d..67fdc3077 100644 --- a/x/tokenomics/keeper/query_relay_mining_difficulty.go +++ b/x/service/keeper/query_relay_mining_difficulty.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/pokt-network/poktroll/x/service/types" ) func (k Keeper) RelayMiningDifficultyAll(ctx context.Context, req *types.QueryAllRelayMiningDifficultyRequest) (*types.QueryAllRelayMiningDifficultyResponse, error) { diff --git a/x/tokenomics/keeper/query_relay_mining_difficulty_test.go b/x/service/keeper/query_relay_mining_difficulty_test.go similarity index 95% rename from x/tokenomics/keeper/query_relay_mining_difficulty_test.go rename to x/service/keeper/query_relay_mining_difficulty_test.go index 7146cfdb3..3e42c4151 100644 --- a/x/tokenomics/keeper/query_relay_mining_difficulty_test.go +++ b/x/service/keeper/query_relay_mining_difficulty_test.go @@ -11,14 +11,14 @@ import ( keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/pokt-network/poktroll/x/service/types" ) // Prevent strconv unused error var _ = strconv.IntSize func TestRelayMiningDifficultyQuerySingle(t *testing.T) { - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) msgs := createNRelayMiningDifficulty(keeper, ctx, 2) tests := []struct { desc string @@ -69,7 +69,7 @@ func TestRelayMiningDifficultyQuerySingle(t *testing.T) { } func TestRelayMiningDifficultyQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) msgs := createNRelayMiningDifficulty(keeper, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllRelayMiningDifficultyRequest { diff --git a/x/tokenomics/keeper/relay_mining_difficulty.go b/x/service/keeper/relay_mining_difficulty.go similarity index 97% rename from x/tokenomics/keeper/relay_mining_difficulty.go rename to x/service/keeper/relay_mining_difficulty.go index 1b16e5fbe..191d97a5c 100644 --- a/x/tokenomics/keeper/relay_mining_difficulty.go +++ b/x/service/keeper/relay_mining_difficulty.go @@ -8,7 +8,7 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/runtime" - "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/pokt-network/poktroll/x/service/types" ) // SetRelayMiningDifficulty set a specific relayMiningDifficulty in the store from its index diff --git a/x/tokenomics/keeper/relay_mining_difficulty_test.go b/x/service/keeper/relay_mining_difficulty_test.go similarity index 85% rename from x/tokenomics/keeper/relay_mining_difficulty_test.go rename to x/service/keeper/relay_mining_difficulty_test.go index 3644fe4c8..37bf9ebee 100644 --- a/x/tokenomics/keeper/relay_mining_difficulty_test.go +++ b/x/service/keeper/relay_mining_difficulty_test.go @@ -9,8 +9,8 @@ import ( keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" ) // Prevent strconv unused error @@ -27,7 +27,7 @@ func createNRelayMiningDifficulty(keeper keeper.Keeper, ctx context.Context, n i } func TestRelayMiningDifficultyGet(t *testing.T) { - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) difficulties := createNRelayMiningDifficulty(keeper, ctx, 10) for _, difficulty := range difficulties { rst, found := keeper.GetRelayMiningDifficulty(ctx, @@ -41,7 +41,7 @@ func TestRelayMiningDifficultyGet(t *testing.T) { } } func TestRelayMiningDifficultyRemove(t *testing.T) { - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) difficulties := createNRelayMiningDifficulty(keeper, ctx, 10) for _, difficulty := range difficulties { keeper.RemoveRelayMiningDifficulty(ctx, @@ -55,7 +55,7 @@ func TestRelayMiningDifficultyRemove(t *testing.T) { } func TestRelayMiningDifficultyGetAll(t *testing.T) { - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) difficulties := createNRelayMiningDifficulty(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(difficulties), diff --git a/x/tokenomics/keeper/scale_difficulty_test.go b/x/service/keeper/scale_difficulty_test.go similarity index 100% rename from x/tokenomics/keeper/scale_difficulty_test.go rename to x/service/keeper/scale_difficulty_test.go diff --git a/x/service/keeper/update_relay_mining_difficulty.go b/x/service/keeper/update_relay_mining_difficulty.go new file mode 100644 index 000000000..f4aaf2a4e --- /dev/null +++ b/x/service/keeper/update_relay_mining_difficulty.go @@ -0,0 +1,165 @@ +package keeper + +import ( + "bytes" + "context" + "encoding/hex" + "fmt" + "math/big" + + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/pkg/crypto/protocol" + "github.com/pokt-network/poktroll/x/service/types" +) + +// TargetNumRelays is the target number of relays we want the network to mine for +// a specific service across all applications & suppliers per session. +// This number determines the total number of leafs to be created across in +// the off-chain SMTs, across all suppliers, for each service. +// It indirectly drives the off-chain resource requirements of the network +// in additional to playing a critical role in Relay Mining. +// TODO_MAINNET(#542): Make this a governance parameter and figure out the correct value. +const TargetNumRelays = uint64(10e4) + +// Exponential moving average (ema) smoothing factor, commonly known as alpha. +// Usually, alpha = 2 / (N+1), where N is the number of periods. +// Large alpha -> more weight on recent data; less smoothing and fast response. +// Small alpha -> more weight on past data; more smoothing and slow response. +// +// TODO_MAINNET: Use a language agnostic float implementation or arithmetic library +// to ensure deterministic results across different language implementations of the +// protocol. +// +// TODO_MAINNET(@olshansk, @rawthil): Play around with the value N for EMA to +// capture what the memory should be. +var emaSmoothingFactor = new(big.Float).SetFloat64(0.1) + +// UpdateRelayMiningDifficulty updates the on-chain relay mining difficulty +// based on the amount of on-chain relays for each service, given a map of serviceId->numRelays. +func (k Keeper) UpdateRelayMiningDifficulty( + ctx context.Context, + relaysPerServiceMap map[string]uint64, +) (difficultyPerServiceMap map[string]types.RelayMiningDifficulty, err error) { + logger := k.Logger().With("method", "UpdateRelayMiningDifficulty") + sdkCtx := sdk.UnwrapSDKContext(ctx) + + difficultyPerServiceMap = make(map[string]types.RelayMiningDifficulty, len(relaysPerServiceMap)) + for serviceId, numRelays := range relaysPerServiceMap { + prevDifficulty, found := k.GetRelayMiningDifficulty(ctx, serviceId) + if !found { + prevDifficulty = NewDefaultRelayMiningDifficulty(ctx, logger, serviceId, numRelays) + } + + // TODO_MAINNET(@Olshansk): We could potentially compute the smoothing factor + // using a common formula, such as alpha = 2 / (N+1), where N is the number + // of periods. + // N := ctx.BlockHeight() - prevDifficulty.BlockHeight + // alpha := 2 / (1 + N) + alpha := emaSmoothingFactor + + // Compute the updated EMA of the number of relays. + prevRelaysEma := prevDifficulty.NumRelaysEma + newRelaysEma := computeEma(alpha, prevRelaysEma, numRelays) + + // CRITICAL_DEV_NOTE: We changed this code to pass in "BaseRelayDifficultyHashBz" instead of "prevDifficulty.TargetHash" + // to "ComputeNewDifficultyTargetHash" because we used to have 2 moving variables: + // 1. Input difficulty + // 2. Relays EMA + // However, since the "TargetNumRelays" remained constant, the following case would keep scaling down the difficulty: + // - newRelaysEma = 100 -> scaled by 10 / 100 -> scaled down by 0.1 + // - newRelaysEma = 50 -> scaled by 10 / 50 -> scaled down by 0.2 + // - newRelaysEma = 20 -> scaled by 10 / 20 -> scaled down by 0.5 + // We kept scaling down even though numRelaysEma was decreasing. + // To avoid continuing to increase the difficulty (i.e. scaling down), the + // relative starting difficulty has to be kept constant. + difficultyHash := protocol.ComputeNewDifficultyTargetHash(protocol.BaseRelayDifficultyHashBz, TargetNumRelays, newRelaysEma) + newDifficulty := types.RelayMiningDifficulty{ + ServiceId: serviceId, + BlockHeight: sdkCtx.BlockHeight(), + NumRelaysEma: newRelaysEma, + TargetHash: difficultyHash, + } + k.SetRelayMiningDifficulty(ctx, newDifficulty) + + // Emit an event for the updated relay mining difficulty regardless of + // whether the difficulty changed or not. + + relayMiningDifficultyUpdateEvent := types.EventRelayMiningDifficultyUpdated{ + ServiceId: serviceId, + PrevTargetHashHexEncoded: hex.EncodeToString(prevDifficulty.TargetHash), + NewTargetHashHexEncoded: hex.EncodeToString(newDifficulty.TargetHash), + PrevNumRelaysEma: prevDifficulty.NumRelaysEma, + NewNumRelaysEma: newDifficulty.NumRelaysEma, + } + if err := sdkCtx.EventManager().EmitTypedEvent(&relayMiningDifficultyUpdateEvent); err != nil { + return nil, err + } + + // Output the appropriate log message based on whether the difficulty was initialized, updated or unchanged. + var logMessage string + switch { + case !found: + logMessage = fmt.Sprintf("Initialized RelayMiningDifficulty for service %s at height %d with difficulty %x", serviceId, sdkCtx.BlockHeight(), newDifficulty.TargetHash) + case !bytes.Equal(prevDifficulty.TargetHash, newDifficulty.TargetHash): + logMessage = fmt.Sprintf("Updated RelayMiningDifficulty for service %s at height %d from %x to %x", serviceId, sdkCtx.BlockHeight(), prevDifficulty.TargetHash, newDifficulty.TargetHash) + default: + logMessage = fmt.Sprintf("No change in RelayMiningDifficulty for service %s at height %d. Current difficulty: %x", serviceId, sdkCtx.BlockHeight(), newDifficulty.TargetHash) + } + logger.Info(logMessage) + + // Store the updated difficulty in the map for telemetry. + // This is done to only emit the telemetry event if all the difficulties + // are updated successfully. + difficultyPerServiceMap[serviceId] = newDifficulty + } + + return difficultyPerServiceMap, nil +} + +// computeEma computes the EMA at time t, given the EMA at time t-1, the raw +// data revealed at time t, and the smoothing factor α. +// Src: https://en.wikipedia.org/wiki/Exponential_smoothing +// +// TODO_MAINNET: Use a language agnostic float implementation or arithmetic library +// to ensure deterministic results across different language implementations of the +// protocol. +func computeEma(alpha *big.Float, prevEma, currValue uint64) uint64 { + oneMinusAlpha := new(big.Float).Sub(new(big.Float).SetInt64(1), alpha) + prevEmaFloat := new(big.Float).SetUint64(prevEma) + + weightedCurrentContribution := new(big.Float).Mul(alpha, new(big.Float).SetUint64(currValue)) + weightedPreviousContribution := new(big.Float).Mul(oneMinusAlpha, prevEmaFloat) + newEma, _ := new(big.Float).Add(weightedCurrentContribution, weightedPreviousContribution).Uint64() + return newEma +} + +// NewDefaultRelayMiningDifficulty is a helper that creates a new RelayMiningDifficulty +// structure if one is not available. It is often used to set the default when a service's +// difficulty is being initialized for the first time. +func NewDefaultRelayMiningDifficulty( + ctx context.Context, + logger log.Logger, + serviceId string, + numRelays uint64, +) types.RelayMiningDifficulty { + logger = logger.With("helper", "NewDefaultRelayMiningDifficulty") + + // Compute the target hash based on the number of relays seen for the first time. + newDifficultyHash := protocol.ComputeNewDifficultyTargetHash(protocol.BaseRelayDifficultyHashBz, TargetNumRelays, numRelays) + + logger.Warn(types.ErrServiceMissingRelayMiningDifficulty.Wrapf( + "No previous relay mining difficulty found for service %s.\n"+ + "Creating a new relay mining difficulty with %d relays and an initial target hash %x", + serviceId, numRelays, newDifficultyHash).Error()) + + // Return a new RelayMiningDifficulty with the computed target hash. + return types.RelayMiningDifficulty{ + ServiceId: serviceId, + BlockHeight: sdk.UnwrapSDKContext(ctx).BlockHeight(), + NumRelaysEma: numRelays, + TargetHash: newDifficultyHash, + } + +} diff --git a/x/tokenomics/keeper/update_relay_mining_difficulty_test.go b/x/service/keeper/update_relay_mining_difficulty_test.go similarity index 87% rename from x/tokenomics/keeper/update_relay_mining_difficulty_test.go rename to x/service/keeper/update_relay_mining_difficulty_test.go index 70ce23846..f355d0977 100644 --- a/x/tokenomics/keeper/update_relay_mining_difficulty_test.go +++ b/x/service/keeper/update_relay_mining_difficulty_test.go @@ -10,16 +10,14 @@ import ( "github.com/pokt-network/poktroll/pkg/crypto/protocol" testutilevents "github.com/pokt-network/poktroll/testutil/events" keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - tokenomicskeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" + servicetypes "github.com/pokt-network/poktroll/x/service/types" ) func TestComputeNewDifficultyHash_MonotonicallyIncreasingRelays(t *testing.T) { svcId := "svc1" - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) prevEMA := uint64(0) prevTargetHash := protocol.BaseRelayDifficultyHashBz @@ -53,7 +51,7 @@ func TestComputeNewDifficultyHash_MonotonicallyIncreasingRelays(t *testing.T) { func TestComputeNewDifficultyHash_MonotonicallyDecreasingRelays(t *testing.T) { svcId := "svc1" - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) prevEMA := uint64(0) prevTargetHash := protocol.BaseRelayDifficultyHashBz @@ -91,7 +89,7 @@ func TestComputeNewDifficultyHash_MonotonicallyDecreasingRelays(t *testing.T) { // a flow testing a few different scenarios, but does not cover the full range // of edge or use cases. func TestUpdateRelayMiningDifficulty_Base(t *testing.T) { - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) sdkCtx := cosmostypes.UnwrapSDKContext(ctx) // Introduce svc1 for the first time @@ -152,7 +150,7 @@ func TestUpdateRelayMiningDifficulty_Base(t *testing.T) { require.True(t, found) require.Less(t, difficultySvc22.NumRelaysEma, difficultySvc21.NumRelaysEma) // Since the relays EMA is lower than the target, the difficulty hash is all 1s - require.Less(t, difficultySvc22.NumRelaysEma, tokenomicskeeper.TargetNumRelays) + require.Less(t, difficultySvc22.NumRelaysEma, servicekeeper.TargetNumRelays) require.Equal(t, difficultySvc22.TargetHash, makeBytesFullOfOnes(32)) // svc3 is new so the relay ema is equal to the first value provided @@ -162,8 +160,8 @@ func TestUpdateRelayMiningDifficulty_Base(t *testing.T) { // Confirm a relay mining difficulty update event was emitted events := sdkCtx.EventManager().Events() - expectedEvents := testutilevents.FilterEvents[*tokenomicstypes.EventRelayMiningDifficultyUpdated](t, - events, "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") + expectedEvents := testutilevents.FilterEvents[*servicetypes.EventRelayMiningDifficultyUpdated](t, + events, "poktroll.service.EventRelayMiningDifficultyUpdated") require.Len(t, expectedEvents, 6) // 3 for svc1, 2 for svc2, 1 for svc3 } @@ -171,33 +169,33 @@ func TestUpdateRelayMiningDifficulty_FirstDifficulty(t *testing.T) { tests := []struct { desc string numRelays uint64 - expectedRelayMiningDifficulty types.RelayMiningDifficulty + expectedRelayMiningDifficulty servicetypes.RelayMiningDifficulty }{ { desc: "First Difficulty way below target", - numRelays: keeper.TargetNumRelays / 1e3, - expectedRelayMiningDifficulty: types.RelayMiningDifficulty{ + numRelays: servicekeeper.TargetNumRelays / 1e3, + expectedRelayMiningDifficulty: servicetypes.RelayMiningDifficulty{ ServiceId: "svc1", BlockHeight: 1, - NumRelaysEma: keeper.TargetNumRelays / 1e3, + NumRelaysEma: servicekeeper.TargetNumRelays / 1e3, TargetHash: defaultDifficulty(), // default difficulty without any leading 0 bits }, }, { desc: "First Difficulty equal to target", - numRelays: keeper.TargetNumRelays, - expectedRelayMiningDifficulty: types.RelayMiningDifficulty{ + numRelays: servicekeeper.TargetNumRelays, + expectedRelayMiningDifficulty: servicetypes.RelayMiningDifficulty{ ServiceId: "svc1", BlockHeight: 1, - NumRelaysEma: keeper.TargetNumRelays, + NumRelaysEma: servicekeeper.TargetNumRelays, TargetHash: defaultDifficulty(), // default difficulty without any leading 0 bits }, }, { desc: "First Difficulty way above target", - numRelays: keeper.TargetNumRelays * 1e3, - expectedRelayMiningDifficulty: types.RelayMiningDifficulty{ + numRelays: servicekeeper.TargetNumRelays * 1e3, + expectedRelayMiningDifficulty: servicetypes.RelayMiningDifficulty{ ServiceId: "svc1", BlockHeight: 1, - NumRelaysEma: keeper.TargetNumRelays * 1e3, + NumRelaysEma: servicekeeper.TargetNumRelays * 1e3, TargetHash: append( []byte{0b00000000}, // at least 8 leading 0 bits makeBytesFullOfOnes(31)..., @@ -207,7 +205,7 @@ func TestUpdateRelayMiningDifficulty_FirstDifficulty(t *testing.T) { } for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { - keeper, ctx := keepertest.TokenomicsKeeper(t) + keeper, ctx := keepertest.ServiceKeeper(t) relaysPerServiceMap := map[string]uint64{ "svc1": tt.numRelays, } diff --git a/x/service/module/genesis.go b/x/service/module/genesis.go index 96a1f6275..91be88ed2 100644 --- a/x/service/module/genesis.go +++ b/x/service/module/genesis.go @@ -13,6 +13,10 @@ func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisSta for _, service := range genState.ServiceList { k.SetService(ctx, service) } + // Set all the relayMiningDifficulty + for _, difficulty := range genState.RelayMiningDifficultyList { + k.SetRelayMiningDifficulty(ctx, difficulty) + } // this line is used by starport scaffolding # genesis/module/init if err := k.SetParams(ctx, genState.Params); err != nil { panic(err) @@ -25,6 +29,7 @@ func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis.Params = k.GetParams(ctx) genesis.ServiceList = k.GetAllServices(ctx) + genesis.RelayMiningDifficultyList = k.GetAllRelayMiningDifficulty(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/service/module/genesis_test.go b/x/service/module/genesis_test.go index c95032594..0b7eb295d 100644 --- a/x/service/module/genesis_test.go +++ b/x/service/module/genesis_test.go @@ -26,6 +26,15 @@ func TestGenesis(t *testing.T) { Name: "service two", }, }, + + RelayMiningDifficultyList: []types.RelayMiningDifficulty{ + { + ServiceId: "0", + }, + { + ServiceId: "1", + }, + }, // this line is used by starport scaffolding # genesis/test/state } @@ -38,5 +47,6 @@ func TestGenesis(t *testing.T) { nullify.Fill(got) require.ElementsMatch(t, genesisState.ServiceList, got.ServiceList) + require.ElementsMatch(t, genesisState.RelayMiningDifficultyList, got.RelayMiningDifficultyList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/service/types/errors.go b/x/service/types/errors.go index d593be500..b5e6797b8 100644 --- a/x/service/types/errors.go +++ b/x/service/types/errors.go @@ -6,19 +6,20 @@ import sdkerrors "cosmossdk.io/errors" // x/service module sentinel errors var ( - ErrServiceInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1101, "duplicate index when adding a new service") - ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid address when adding a new service") - ErrServiceMissingID = sdkerrors.Register(ModuleName, 1103, "missing service ID") - ErrServiceMissingName = sdkerrors.Register(ModuleName, 1104, "missing service name") - ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 1105, "service already exists") - ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 1106, "invalid ServiceFee") - ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 1107, "account not found") - ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 1108, "not enough funds to add service") - ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 1109, "failed to deduct fee") - ErrServiceInvalidRelayResponse = sdkerrors.Register(ModuleName, 1110, "invalid relay response") - ErrServiceInvalidRelayRequest = sdkerrors.Register(ModuleName, 1111, "invalid relay request") - ErrServiceInvalidOwnerAddress = sdkerrors.Register(ModuleName, 1113, "invalid owner address") - ErrServiceParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") - ErrServiceParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") + ErrServiceInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1101, "duplicate index when adding a new service") + ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid address when adding a new service") + ErrServiceMissingID = sdkerrors.Register(ModuleName, 1103, "missing service ID") + ErrServiceMissingName = sdkerrors.Register(ModuleName, 1104, "missing service name") + ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 1105, "service already exists") + ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 1106, "invalid ServiceFee") + ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 1107, "account not found") + ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 1108, "not enough funds to add service") + ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 1109, "failed to deduct fee") + ErrServiceInvalidRelayResponse = sdkerrors.Register(ModuleName, 1110, "invalid relay response") + ErrServiceInvalidRelayRequest = sdkerrors.Register(ModuleName, 1111, "invalid relay request") + ErrServiceInvalidOwnerAddress = sdkerrors.Register(ModuleName, 1113, "invalid owner address") + ErrServiceParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") + ErrServiceParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") + ErrServiceMissingRelayMiningDifficulty = sdkerrors.Register(ModuleName, 1116, "missing relay mining difficulty") ) diff --git a/x/service/types/event.pb.go b/x/service/types/event.pb.go new file mode 100644 index 000000000..b85ba4263 --- /dev/null +++ b/x/service/types/event.pb.go @@ -0,0 +1,495 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: poktroll/service/event.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated +// for a given service. +type EventRelayMiningDifficultyUpdated struct { + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + PrevTargetHashHexEncoded string `protobuf:"bytes,2,opt,name=prev_target_hash_hex_encoded,json=prevTargetHashHexEncoded,proto3" json:"prev_target_hash_hex_encoded,omitempty"` + NewTargetHashHexEncoded string `protobuf:"bytes,3,opt,name=new_target_hash_hex_encoded,json=newTargetHashHexEncoded,proto3" json:"new_target_hash_hex_encoded,omitempty"` + PrevNumRelaysEma uint64 `protobuf:"varint,4,opt,name=prev_num_relays_ema,json=prevNumRelaysEma,proto3" json:"prev_num_relays_ema,omitempty"` + NewNumRelaysEma uint64 `protobuf:"varint,5,opt,name=new_num_relays_ema,json=newNumRelaysEma,proto3" json:"new_num_relays_ema,omitempty"` +} + +func (m *EventRelayMiningDifficultyUpdated) Reset() { *m = EventRelayMiningDifficultyUpdated{} } +func (m *EventRelayMiningDifficultyUpdated) String() string { return proto.CompactTextString(m) } +func (*EventRelayMiningDifficultyUpdated) ProtoMessage() {} +func (*EventRelayMiningDifficultyUpdated) Descriptor() ([]byte, []int) { + return fileDescriptor_a49225ecd38336fe, []int{0} +} +func (m *EventRelayMiningDifficultyUpdated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventRelayMiningDifficultyUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EventRelayMiningDifficultyUpdated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventRelayMiningDifficultyUpdated.Merge(m, src) +} +func (m *EventRelayMiningDifficultyUpdated) XXX_Size() int { + return m.Size() +} +func (m *EventRelayMiningDifficultyUpdated) XXX_DiscardUnknown() { + xxx_messageInfo_EventRelayMiningDifficultyUpdated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventRelayMiningDifficultyUpdated proto.InternalMessageInfo + +func (m *EventRelayMiningDifficultyUpdated) GetServiceId() string { + if m != nil { + return m.ServiceId + } + return "" +} + +func (m *EventRelayMiningDifficultyUpdated) GetPrevTargetHashHexEncoded() string { + if m != nil { + return m.PrevTargetHashHexEncoded + } + return "" +} + +func (m *EventRelayMiningDifficultyUpdated) GetNewTargetHashHexEncoded() string { + if m != nil { + return m.NewTargetHashHexEncoded + } + return "" +} + +func (m *EventRelayMiningDifficultyUpdated) GetPrevNumRelaysEma() uint64 { + if m != nil { + return m.PrevNumRelaysEma + } + return 0 +} + +func (m *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { + if m != nil { + return m.NewNumRelaysEma + } + return 0 +} + +func init() { + proto.RegisterType((*EventRelayMiningDifficultyUpdated)(nil), "poktroll.service.EventRelayMiningDifficultyUpdated") +} + +func init() { proto.RegisterFile("poktroll/service/event.proto", fileDescriptor_a49225ecd38336fe) } + +var fileDescriptor_a49225ecd38336fe = []byte{ + // 320 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x41, 0x4b, 0xc3, 0x30, + 0x14, 0xc7, 0x97, 0x39, 0x85, 0xe5, 0xe2, 0xa8, 0x82, 0x45, 0x67, 0x98, 0x9e, 0x06, 0xb2, 0x55, + 0xf0, 0x2a, 0x1e, 0xc4, 0xc1, 0x3c, 0xb8, 0xc3, 0xd0, 0x8b, 0x97, 0x90, 0xb5, 0x6f, 0x6d, 0x58, + 0x9b, 0x94, 0x34, 0x5d, 0xb7, 0x6f, 0xe1, 0x07, 0xf0, 0x03, 0x79, 0xdc, 0x71, 0x47, 0xe9, 0xbe, + 0x88, 0x24, 0xab, 0x43, 0x44, 0x6f, 0x21, 0xff, 0xdf, 0xef, 0x3d, 0xde, 0x7b, 0xb8, 0x9d, 0xca, + 0x99, 0x56, 0x32, 0x8e, 0xbd, 0x0c, 0xd4, 0x9c, 0xfb, 0xe0, 0xc1, 0x1c, 0x84, 0xee, 0xa7, 0x4a, + 0x6a, 0xe9, 0xb4, 0xbe, 0xd3, 0x7e, 0x95, 0x9e, 0x1e, 0x87, 0x32, 0x94, 0x36, 0xf4, 0xcc, 0x6b, + 0xcb, 0x5d, 0xbe, 0xd7, 0xf1, 0xc5, 0xc0, 0x78, 0x63, 0x88, 0xd9, 0xf2, 0x89, 0x0b, 0x2e, 0xc2, + 0x07, 0x3e, 0x9d, 0x72, 0x3f, 0x8f, 0xf5, 0xf2, 0x25, 0x0d, 0x98, 0x86, 0xc0, 0x39, 0xc7, 0xb8, + 0x2a, 0x43, 0x79, 0xe0, 0xa2, 0x0e, 0xea, 0x36, 0xc7, 0xcd, 0xea, 0xe7, 0x31, 0x70, 0xee, 0x70, + 0x3b, 0x55, 0x30, 0xa7, 0x9a, 0xa9, 0x10, 0x34, 0x8d, 0x58, 0x16, 0xd1, 0x08, 0x16, 0x14, 0x84, + 0x2f, 0x03, 0x08, 0xdc, 0xba, 0x15, 0x5c, 0xc3, 0x3c, 0x5b, 0x64, 0xc8, 0xb2, 0x68, 0x08, 0x8b, + 0xc1, 0x36, 0x77, 0x6e, 0xf1, 0x99, 0x80, 0xe2, 0x5f, 0x7d, 0xcf, 0xea, 0x27, 0x02, 0x8a, 0x3f, + 0xed, 0x1e, 0x3e, 0xb2, 0xdd, 0x45, 0x9e, 0x50, 0x65, 0xa6, 0xc8, 0x28, 0x24, 0xcc, 0x6d, 0x74, + 0x50, 0xb7, 0x31, 0x6e, 0x99, 0x68, 0x94, 0x27, 0x76, 0xbc, 0x6c, 0x90, 0x30, 0xe7, 0x0a, 0x3b, + 0xa6, 0xd9, 0x2f, 0x7a, 0xdf, 0xd2, 0x87, 0x02, 0x8a, 0x9f, 0xf0, 0xfd, 0xe8, 0xa3, 0x24, 0x68, + 0x55, 0x12, 0xb4, 0x2e, 0x09, 0xfa, 0x2c, 0x09, 0x7a, 0xdb, 0x90, 0xda, 0x6a, 0x43, 0x6a, 0xeb, + 0x0d, 0xa9, 0xbd, 0x5e, 0x87, 0x5c, 0x47, 0xf9, 0xa4, 0xef, 0xcb, 0xc4, 0x33, 0xfb, 0xee, 0x09, + 0xd0, 0x85, 0x54, 0x33, 0x6f, 0x77, 0x9a, 0xc5, 0xee, 0x38, 0x7a, 0x99, 0x42, 0x36, 0x39, 0xb0, + 0x5b, 0xbf, 0xf9, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x37, 0x95, 0x7d, 0xbd, 0x01, 0x00, 0x00, +} + +func (m *EventRelayMiningDifficultyUpdated) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventRelayMiningDifficultyUpdated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventRelayMiningDifficultyUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NewNumRelaysEma != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NewNumRelaysEma)) + i-- + dAtA[i] = 0x28 + } + if m.PrevNumRelaysEma != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.PrevNumRelaysEma)) + i-- + dAtA[i] = 0x20 + } + if len(m.NewTargetHashHexEncoded) > 0 { + i -= len(m.NewTargetHashHexEncoded) + copy(dAtA[i:], m.NewTargetHashHexEncoded) + i = encodeVarintEvent(dAtA, i, uint64(len(m.NewTargetHashHexEncoded))) + i-- + dAtA[i] = 0x1a + } + if len(m.PrevTargetHashHexEncoded) > 0 { + i -= len(m.PrevTargetHashHexEncoded) + copy(dAtA[i:], m.PrevTargetHashHexEncoded) + i = encodeVarintEvent(dAtA, i, uint64(len(m.PrevTargetHashHexEncoded))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceId) > 0 { + i -= len(m.ServiceId) + copy(dAtA[i:], m.ServiceId) + i = encodeVarintEvent(dAtA, i, uint64(len(m.ServiceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + offset -= sovEvent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventRelayMiningDifficultyUpdated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceId) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.PrevTargetHashHexEncoded) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.NewTargetHashHexEncoded) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + if m.PrevNumRelaysEma != 0 { + n += 1 + sovEvent(uint64(m.PrevNumRelaysEma)) + } + if m.NewNumRelaysEma != 0 { + n += 1 + sovEvent(uint64(m.NewNumRelaysEma)) + } + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventRelayMiningDifficultyUpdated) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevTargetHashHexEncoded", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrevTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewTargetHashHexEncoded", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevNumRelaysEma", wireType) + } + m.PrevNumRelaysEma = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrevNumRelaysEma |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewNumRelaysEma", wireType) + } + m.NewNumRelaysEma = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NewNumRelaysEma |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvent + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvent + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvent + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/service/types/genesis.go b/x/service/types/genesis.go index b8d040cb5..eeab9e17f 100644 --- a/x/service/types/genesis.go +++ b/x/service/types/genesis.go @@ -5,7 +5,8 @@ import sharedtypes "github.com/pokt-network/poktroll/x/shared/types" // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - ServiceList: []sharedtypes.Service{}, + ServiceList: []sharedtypes.Service{}, + RelayMiningDifficultyList: []RelayMiningDifficulty{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -15,9 +16,24 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Check for duplicated index in services + if err := validateServiceList(gs.ServiceList); err != nil { + return err + } + + // Check for duplicated index in relayMiningDifficulty + if err := validateRelayMiningDifficultyList(gs.RelayMiningDifficultyList); err != nil { + return err + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.ValidateBasic() +} + +// validateServiceList validates the service list. +func validateServiceList(serviceList []sharedtypes.Service) error { serviceIDMap := make(map[string]struct{}) serviceNameMap := make(map[string]struct{}) - for _, service := range gs.ServiceList { + for _, service := range serviceList { serviceID := string(ServiceKey(service.Id)) if _, ok := serviceIDMap[serviceID]; ok { return ErrServiceDuplicateIndex.Wrapf("duplicated ID for service: %v", service) @@ -29,7 +45,21 @@ func (gs GenesisState) Validate() error { } serviceNameMap[serviceName] = struct{}{} } - // this line is used by starport scaffolding # genesis/types/validate - return gs.Params.ValidateBasic() + return nil +} + +// validateRelayMiningDifficultyList validates the relayMiningDifficulty list. +func validateRelayMiningDifficultyList(relayMiningDifficultyList []RelayMiningDifficulty) error { + relayMiningDifficultyIndexMap := make(map[string]struct{}) + + for _, elem := range relayMiningDifficultyList { + index := string(RelayMiningDifficultyKey(elem.ServiceId)) + if _, ok := relayMiningDifficultyIndexMap[index]; ok { + return ErrServiceDuplicateIndex.Wrapf("duplicated index for relayMiningDifficulty: %s", index) + } + relayMiningDifficultyIndexMap[index] = struct{}{} + } + + return nil } diff --git a/x/service/types/genesis.pb.go b/x/service/types/genesis.pb.go index 1385a8f50..f31fb606f 100644 --- a/x/service/types/genesis.pb.go +++ b/x/service/types/genesis.pb.go @@ -28,8 +28,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the service module's genesis state. type GenesisState struct { // params defines all the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - ServiceList []types.Service `protobuf:"bytes,2,rep,name=service_list,json=serviceList,proto3" json:"service_list"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + ServiceList []types.Service `protobuf:"bytes,2,rep,name=service_list,json=serviceList,proto3" json:"service_list"` + RelayMiningDifficultyList []RelayMiningDifficulty `protobuf:"bytes,3,rep,name=relayMiningDifficultyList,proto3" json:"relayMiningDifficultyList"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -75,6 +76,13 @@ func (m *GenesisState) GetServiceList() []types.Service { return nil } +func (m *GenesisState) GetRelayMiningDifficultyList() []RelayMiningDifficulty { + if m != nil { + return m.RelayMiningDifficultyList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "poktroll.service.GenesisState") } @@ -82,24 +90,28 @@ func init() { func init() { proto.RegisterFile("poktroll/service/genesis.proto", fileDescriptor_b6c2ff81e712a1a4) } var fileDescriptor_b6c2ff81e712a1a4 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto + // 322 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xc9, 0xeb, 0x41, 0xe5, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0x65, 0x31, 0x8c, 0x2e, 0x48, 0x2c, 0x4a, - 0xcc, 0x2d, 0xc6, 0x94, 0xce, 0x48, 0x2c, 0x4a, 0x4d, 0x81, 0xa9, 0x82, 0x48, 0x2b, 0xf5, 0x31, - 0x72, 0xf1, 0xb8, 0x43, 0x9c, 0x12, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xcd, 0xc5, 0x06, 0xd1, - 0x2f, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xa1, 0x87, 0xee, 0x34, 0xbd, 0x00, 0xb0, 0xbc, - 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x6a, 0x11, 0x72, - 0xe4, 0xe2, 0x81, 0x2a, 0x8a, 0xcf, 0xc9, 0x2c, 0x2e, 0x91, 0x60, 0x52, 0x60, 0x46, 0x33, 0x02, - 0xec, 0x06, 0xbd, 0x60, 0x88, 0x22, 0x27, 0x16, 0x90, 0x11, 0x41, 0xdc, 0x50, 0x3d, 0x3e, 0x99, - 0xc5, 0x25, 0x4e, 0x7e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, - 0x1c, 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, - 0x50, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0xb8, 0x2f, 0x2b, 0xe0, 0xc1, 0x50, - 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xa7, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xcb, - 0x1e, 0x0f, 0xf5, 0x82, 0x01, 0x00, 0x00, + 0xcc, 0x2d, 0xc6, 0x94, 0xce, 0x48, 0x2c, 0x4a, 0x4d, 0x81, 0xa9, 0x82, 0x4a, 0xeb, 0x61, 0xe8, + 0x2e, 0x4a, 0xcd, 0x49, 0xac, 0x8c, 0xcf, 0xcd, 0xcc, 0xcb, 0xcc, 0x4b, 0x8f, 0x4f, 0xc9, 0x4c, + 0x4b, 0xcb, 0x4c, 0x2e, 0xcd, 0x29, 0xa9, 0x84, 0xa8, 0x57, 0xfa, 0xcd, 0xc8, 0xc5, 0xe3, 0x0e, + 0x71, 0x7a, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x35, 0x17, 0x1b, 0xc4, 0x3e, 0x09, 0x46, 0x05, + 0x46, 0x0d, 0x6e, 0x23, 0x09, 0x3d, 0x74, 0xaf, 0xe8, 0x05, 0x80, 0xe5, 0x9d, 0x38, 0x4f, 0xdc, + 0x93, 0x67, 0x58, 0xf1, 0x7c, 0x83, 0x16, 0x63, 0x10, 0x54, 0x8b, 0x90, 0x23, 0x17, 0x0f, 0x54, + 0x51, 0x7c, 0x4e, 0x66, 0x71, 0x89, 0x04, 0x93, 0x02, 0x33, 0x9a, 0x11, 0x60, 0x37, 0xeb, 0x05, + 0x43, 0x14, 0x39, 0xb1, 0x80, 0x8c, 0x08, 0xe2, 0x86, 0xea, 0xf1, 0xc9, 0x2c, 0x2e, 0x11, 0xca, + 0xe6, 0x92, 0x04, 0xbb, 0xd8, 0x17, 0xec, 0x60, 0x17, 0xb8, 0x7b, 0x41, 0x92, 0x12, 0xcc, 0x60, + 0xf3, 0xd4, 0x31, 0x9d, 0x14, 0x84, 0x4d, 0x0b, 0xd4, 0x78, 0xdc, 0xe6, 0x39, 0xf9, 0x9d, 0x78, + 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x8d, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, + 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, 0x99, + 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x1b, 0x75, 0xf3, 0x52, 0x4b, 0xca, + 0xf3, 0x8b, 0xb2, 0xf5, 0xe1, 0x61, 0x5c, 0x01, 0x0f, 0xe5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, + 0x36, 0x70, 0xa0, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x34, 0x0b, 0xbf, 0x1f, 0x02, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -122,6 +134,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RelayMiningDifficultyList) > 0 { + for iNdEx := len(m.RelayMiningDifficultyList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RelayMiningDifficultyList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } if len(m.ServiceList) > 0 { for iNdEx := len(m.ServiceList) - 1; iNdEx >= 0; iNdEx-- { { @@ -174,6 +200,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.RelayMiningDifficultyList) > 0 { + for _, e := range m.RelayMiningDifficultyList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -279,6 +311,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficultyList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RelayMiningDifficultyList = append(m.RelayMiningDifficultyList, RelayMiningDifficulty{}) + if err := m.RelayMiningDifficultyList[len(m.RelayMiningDifficultyList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go index aa90380bc..66017e75d 100644 --- a/x/service/types/genesis_test.go +++ b/x/service/types/genesis_test.go @@ -45,10 +45,33 @@ func TestGenesisState_Validate(t *testing.T) { ServiceList: []sharedtypes.Service{ *svc1, *svc2, }, + RelayMiningDifficultyList: []types.RelayMiningDifficulty{ + { + ServiceId: "0", + }, + { + ServiceId: "1", + }, + }, // this line is used by starport scaffolding # types/genesis/validField }, expectedErr: nil, }, + { + desc: "invalid - duplicated relayMiningDifficulty", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + RelayMiningDifficultyList: []types.RelayMiningDifficulty{ + { + ServiceId: "0", + }, + { + ServiceId: "0", + }, + }, + }, + expectedErr: types.ErrServiceDuplicateIndex, + }, { desc: "invalid - duplicate service ID", genState: &types.GenesisState{ diff --git a/x/tokenomics/types/key_relay_mining_difficulty.go b/x/service/types/key_relay_mining_difficulty.go similarity index 100% rename from x/tokenomics/types/key_relay_mining_difficulty.go rename to x/service/types/key_relay_mining_difficulty.go diff --git a/x/service/types/query.pb.go b/x/service/types/query.pb.go index 15c598d4e..15d6ffb31 100644 --- a/x/service/types/query.pb.go +++ b/x/service/types/query.pb.go @@ -276,6 +276,174 @@ func (m *QueryAllServicesResponse) GetPagination() *query.PageResponse { return nil } +type QueryGetRelayMiningDifficultyRequest struct { + ServiceId string `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"` +} + +func (m *QueryGetRelayMiningDifficultyRequest) Reset() { *m = QueryGetRelayMiningDifficultyRequest{} } +func (m *QueryGetRelayMiningDifficultyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetRelayMiningDifficultyRequest) ProtoMessage() {} +func (*QueryGetRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_cc8a7bc9eee3e426, []int{6} +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRelayMiningDifficultyRequest.Merge(m, src) +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRelayMiningDifficultyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRelayMiningDifficultyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRelayMiningDifficultyRequest proto.InternalMessageInfo + +func (m *QueryGetRelayMiningDifficultyRequest) GetServiceId() string { + if m != nil { + return m.ServiceId + } + return "" +} + +type QueryGetRelayMiningDifficultyResponse struct { + RelayMiningDifficulty RelayMiningDifficulty `protobuf:"bytes,1,opt,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty"` +} + +func (m *QueryGetRelayMiningDifficultyResponse) Reset() { *m = QueryGetRelayMiningDifficultyResponse{} } +func (m *QueryGetRelayMiningDifficultyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetRelayMiningDifficultyResponse) ProtoMessage() {} +func (*QueryGetRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cc8a7bc9eee3e426, []int{7} +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRelayMiningDifficultyResponse.Merge(m, src) +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRelayMiningDifficultyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRelayMiningDifficultyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRelayMiningDifficultyResponse proto.InternalMessageInfo + +func (m *QueryGetRelayMiningDifficultyResponse) GetRelayMiningDifficulty() RelayMiningDifficulty { + if m != nil { + return m.RelayMiningDifficulty + } + return RelayMiningDifficulty{} +} + +type QueryAllRelayMiningDifficultyRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRelayMiningDifficultyRequest) Reset() { *m = QueryAllRelayMiningDifficultyRequest{} } +func (m *QueryAllRelayMiningDifficultyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllRelayMiningDifficultyRequest) ProtoMessage() {} +func (*QueryAllRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_cc8a7bc9eee3e426, []int{8} +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRelayMiningDifficultyRequest.Merge(m, src) +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRelayMiningDifficultyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRelayMiningDifficultyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRelayMiningDifficultyRequest proto.InternalMessageInfo + +func (m *QueryAllRelayMiningDifficultyRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllRelayMiningDifficultyResponse struct { + RelayMiningDifficulty []RelayMiningDifficulty `protobuf:"bytes,1,rep,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRelayMiningDifficultyResponse) Reset() { *m = QueryAllRelayMiningDifficultyResponse{} } +func (m *QueryAllRelayMiningDifficultyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllRelayMiningDifficultyResponse) ProtoMessage() {} +func (*QueryAllRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cc8a7bc9eee3e426, []int{9} +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRelayMiningDifficultyResponse.Merge(m, src) +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRelayMiningDifficultyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRelayMiningDifficultyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRelayMiningDifficultyResponse proto.InternalMessageInfo + +func (m *QueryAllRelayMiningDifficultyResponse) GetRelayMiningDifficulty() []RelayMiningDifficulty { + if m != nil { + return m.RelayMiningDifficulty + } + return nil +} + +func (m *QueryAllRelayMiningDifficultyResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "poktroll.service.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "poktroll.service.QueryParamsResponse") @@ -283,45 +451,60 @@ func init() { proto.RegisterType((*QueryGetServiceResponse)(nil), "poktroll.service.QueryGetServiceResponse") proto.RegisterType((*QueryAllServicesRequest)(nil), "poktroll.service.QueryAllServicesRequest") proto.RegisterType((*QueryAllServicesResponse)(nil), "poktroll.service.QueryAllServicesResponse") + proto.RegisterType((*QueryGetRelayMiningDifficultyRequest)(nil), "poktroll.service.QueryGetRelayMiningDifficultyRequest") + proto.RegisterType((*QueryGetRelayMiningDifficultyResponse)(nil), "poktroll.service.QueryGetRelayMiningDifficultyResponse") + proto.RegisterType((*QueryAllRelayMiningDifficultyRequest)(nil), "poktroll.service.QueryAllRelayMiningDifficultyRequest") + proto.RegisterType((*QueryAllRelayMiningDifficultyResponse)(nil), "poktroll.service.QueryAllRelayMiningDifficultyResponse") } func init() { proto.RegisterFile("poktroll/service/query.proto", fileDescriptor_cc8a7bc9eee3e426) } var fileDescriptor_cc8a7bc9eee3e426 = []byte{ - // 517 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x29, 0xa4, 0xea, 0x55, 0x42, 0x70, 0x54, 0x10, 0x59, 0xc5, 0x20, 0x8b, 0xb6, - 0x21, 0x28, 0x77, 0xb4, 0x5d, 0x90, 0x98, 0xc8, 0x40, 0x37, 0x54, 0xdc, 0x8d, 0xed, 0x92, 0x9c, - 0xdc, 0x53, 0x1d, 0x9f, 0xeb, 0xbb, 0x14, 0x2a, 0xc4, 0x82, 0xf8, 0x00, 0x48, 0x65, 0x65, 0x67, - 0x64, 0xe7, 0x0b, 0x74, 0xac, 0xc4, 0xd2, 0x09, 0xa1, 0x04, 0x89, 0xaf, 0x81, 0x7c, 0xf7, 0x0c, - 0x29, 0xae, 0x95, 0xb0, 0x24, 0x96, 0xdf, 0xff, 0xfd, 0xff, 0xbf, 0xbb, 0xf7, 0x64, 0xbc, 0x9a, - 0xaa, 0x03, 0x93, 0xa9, 0x38, 0x66, 0x5a, 0x64, 0x47, 0xb2, 0x2f, 0xd8, 0xe1, 0x48, 0x64, 0xc7, - 0x34, 0xcd, 0x94, 0x51, 0xe4, 0x7a, 0x51, 0xa5, 0x50, 0xf5, 0x6e, 0xf0, 0xa1, 0x4c, 0x14, 0xb3, - 0xbf, 0x4e, 0xe4, 0xad, 0x44, 0x2a, 0x52, 0xf6, 0x91, 0xe5, 0x4f, 0xf0, 0x76, 0x35, 0x52, 0x2a, - 0x8a, 0x05, 0xe3, 0xa9, 0x64, 0x3c, 0x49, 0x94, 0xe1, 0x46, 0xaa, 0x44, 0x43, 0xb5, 0xdd, 0x57, - 0x7a, 0xa8, 0x34, 0xeb, 0x71, 0x0d, 0x89, 0xec, 0x68, 0xb3, 0x27, 0x0c, 0xdf, 0x64, 0x29, 0x8f, - 0x64, 0x62, 0xc5, 0xa0, 0xbd, 0x53, 0x42, 0x4c, 0x79, 0xc6, 0x87, 0xba, 0x5c, 0xde, 0xe7, 0x99, - 0x18, 0x14, 0x2a, 0x57, 0x0e, 0x56, 0x30, 0x79, 0x91, 0xfb, 0xef, 0xda, 0x9e, 0x50, 0x1c, 0x8e, - 0x84, 0x36, 0x41, 0x88, 0x6f, 0x5e, 0x78, 0xab, 0x53, 0x95, 0x68, 0x41, 0x9e, 0xe0, 0x86, 0xf3, - 0x6e, 0xa2, 0x7b, 0xa8, 0xb5, 0xbc, 0xd5, 0xa4, 0xff, 0x5e, 0x00, 0x75, 0x1d, 0xdd, 0xa5, 0xd3, - 0xef, 0x77, 0x6b, 0x9f, 0x7f, 0x7d, 0x69, 0xa3, 0x10, 0x5a, 0x82, 0x16, 0xbe, 0x65, 0x3d, 0x77, - 0x84, 0xd9, 0x73, 0x62, 0x48, 0x23, 0xd7, 0x70, 0x5d, 0x0e, 0xac, 0xe5, 0x52, 0x58, 0x97, 0x83, - 0x60, 0x0f, 0xdf, 0x2e, 0x29, 0x81, 0xe0, 0x31, 0x5e, 0x84, 0xa4, 0x4b, 0x10, 0xec, 0xf9, 0x28, - 0xb4, 0x74, 0xaf, 0xe4, 0x08, 0x61, 0x21, 0x0f, 0x38, 0x98, 0x3e, 0x8d, 0x63, 0x50, 0x14, 0xa7, - 0x25, 0xcf, 0x30, 0xfe, 0x7b, 0xab, 0xe0, 0xbb, 0x4e, 0xdd, 0x08, 0x68, 0x3e, 0x02, 0xea, 0x86, - 0x0e, 0x23, 0xa0, 0xbb, 0x3c, 0x2a, 0xd8, 0xc3, 0xa9, 0xce, 0xe0, 0x13, 0xc2, 0xcd, 0x72, 0xc6, - 0x65, 0xe4, 0x0b, 0xff, 0x41, 0x4e, 0x76, 0x2e, 0xe0, 0xd5, 0x2d, 0xde, 0xc6, 0x4c, 0x3c, 0x17, - 0x3b, 0xcd, 0xb7, 0xf5, 0x75, 0x01, 0x5f, 0xb5, 0x7c, 0xe4, 0x3d, 0xc2, 0x0d, 0x37, 0x29, 0x72, - 0xbf, 0x3c, 0xc3, 0xf2, 0x42, 0x78, 0x6b, 0x33, 0x54, 0x2e, 0x2d, 0xe8, 0xbc, 0xfb, 0xf6, 0xf3, - 0xa4, 0xbe, 0x41, 0xd6, 0x58, 0x2e, 0xef, 0x24, 0xc2, 0xbc, 0x52, 0xd9, 0x01, 0xab, 0xd8, 0x50, - 0x72, 0x82, 0xf0, 0x22, 0x1c, 0x9a, 0xb4, 0x2a, 0x12, 0x4a, 0xeb, 0xe2, 0x3d, 0x98, 0x43, 0x09, - 0x3c, 0xdb, 0x96, 0xa7, 0x43, 0x1e, 0xce, 0xe0, 0x29, 0xfe, 0xdf, 0xc8, 0xc1, 0x5b, 0xf2, 0x11, - 0xe1, 0xe5, 0xa9, 0x09, 0x92, 0xaa, 0xbc, 0xf2, 0x26, 0x79, 0xed, 0x79, 0xa4, 0xc0, 0x46, 0x2d, - 0x5b, 0x8b, 0xac, 0xcf, 0xc7, 0xd6, 0x7d, 0x7e, 0x3a, 0xf6, 0xd1, 0xd9, 0xd8, 0x47, 0xe7, 0x63, - 0x1f, 0xfd, 0x18, 0xfb, 0xe8, 0xc3, 0xc4, 0xaf, 0x9d, 0x4d, 0xfc, 0xda, 0xf9, 0xc4, 0xaf, 0xbd, - 0x7c, 0x14, 0x49, 0xb3, 0x3f, 0xea, 0xd1, 0xbe, 0x1a, 0x56, 0xf8, 0xbd, 0xfe, 0xe3, 0x68, 0x8e, - 0x53, 0xa1, 0x7b, 0x0d, 0xfb, 0x01, 0xd8, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x22, 0x58, 0x15, - 0xda, 0xe3, 0x04, 0x00, 0x00, + // 689 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x6b, 0xd4, 0x40, + 0x14, 0xde, 0xd9, 0xea, 0x96, 0x4e, 0x41, 0x74, 0x6c, 0x75, 0x59, 0x6a, 0x94, 0xd0, 0x1f, 0x6b, + 0xa5, 0x33, 0xb6, 0x85, 0x5a, 0x10, 0x84, 0x2e, 0xc5, 0xa2, 0xa0, 0xd4, 0xf4, 0xe6, 0xa5, 0xcc, + 0xee, 0x4e, 0xd3, 0xa1, 0xd9, 0x4c, 0x9a, 0x64, 0xab, 0xa5, 0xf4, 0x22, 0x1e, 0x3d, 0x08, 0xf5, + 0xea, 0xdd, 0xa3, 0x7f, 0x46, 0xc1, 0x4b, 0x41, 0x85, 0x9e, 0xa4, 0x6c, 0x05, 0xff, 0x0d, 0xd9, + 0xc9, 0x4b, 0x7f, 0x98, 0xa4, 0x69, 0xa5, 0x97, 0xdd, 0x90, 0xf9, 0xde, 0xfb, 0xbe, 0xef, 0xbd, + 0x37, 0x2f, 0x78, 0xc8, 0x53, 0x6b, 0xa1, 0xaf, 0x1c, 0x87, 0x05, 0xc2, 0xdf, 0x90, 0x0d, 0xc1, + 0xd6, 0xdb, 0xc2, 0xdf, 0xa4, 0x9e, 0xaf, 0x42, 0x45, 0xae, 0xc7, 0xa7, 0x14, 0x4e, 0x2b, 0x37, + 0x78, 0x4b, 0xba, 0x8a, 0xe9, 0xdf, 0x08, 0x54, 0x19, 0xb0, 0x95, 0xad, 0xf4, 0x23, 0xeb, 0x3e, + 0xc1, 0xdb, 0x21, 0x5b, 0x29, 0xdb, 0x11, 0x8c, 0x7b, 0x92, 0x71, 0xd7, 0x55, 0x21, 0x0f, 0xa5, + 0x72, 0x03, 0x38, 0x1d, 0x6f, 0xa8, 0xa0, 0xa5, 0x02, 0x56, 0xe7, 0x01, 0x30, 0xb2, 0x8d, 0xc9, + 0xba, 0x08, 0xf9, 0x24, 0xf3, 0xb8, 0x2d, 0x5d, 0x0d, 0x06, 0xec, 0x9d, 0x84, 0x44, 0x8f, 0xfb, + 0xbc, 0x15, 0x24, 0x8f, 0x57, 0xb9, 0x2f, 0x9a, 0x31, 0x0a, 0x8e, 0x69, 0x22, 0xda, 0x17, 0x0e, + 0xdf, 0x5c, 0x6e, 0x49, 0x57, 0xba, 0xf6, 0x72, 0x53, 0xae, 0xac, 0xc8, 0x46, 0xdb, 0x09, 0xc1, + 0xb2, 0x39, 0x80, 0xc9, 0xab, 0xae, 0x9e, 0x45, 0xcd, 0x61, 0x89, 0xf5, 0xb6, 0x08, 0x42, 0xd3, + 0xc2, 0x37, 0x4f, 0xbd, 0x0d, 0x3c, 0xe5, 0x06, 0x82, 0x3c, 0xc6, 0xa5, 0x48, 0x4b, 0x19, 0xdd, + 0x43, 0xd5, 0xfe, 0xa9, 0x32, 0xfd, 0xb7, 0x60, 0x34, 0x8a, 0xa8, 0xf5, 0xed, 0xfe, 0xba, 0x5b, + 0xf8, 0xf2, 0xe7, 0xeb, 0x38, 0xb2, 0x20, 0xc4, 0xac, 0xe2, 0x5b, 0x3a, 0xe7, 0x82, 0x08, 0x97, + 0x22, 0x30, 0xb0, 0x91, 0x6b, 0xb8, 0x28, 0x9b, 0x3a, 0x65, 0x9f, 0x55, 0x94, 0x4d, 0x73, 0x09, + 0xdf, 0x4e, 0x20, 0x41, 0xc1, 0x2c, 0xee, 0x05, 0xa6, 0x14, 0x09, 0xba, 0x1e, 0x14, 0x42, 0x6a, + 0x57, 0xba, 0x12, 0xac, 0x18, 0x6e, 0x72, 0x48, 0x3a, 0xe7, 0x38, 0x80, 0x88, 0xdd, 0x92, 0xa7, + 0x18, 0x1f, 0x77, 0x01, 0xf2, 0x8e, 0xd2, 0xa8, 0x65, 0xb4, 0xdb, 0x32, 0x1a, 0x0d, 0x09, 0xb4, + 0x8c, 0x2e, 0x72, 0x3b, 0xd6, 0x6e, 0x9d, 0x88, 0x34, 0x3f, 0x23, 0x5c, 0x4e, 0x72, 0xa4, 0x29, + 0xef, 0xb9, 0x80, 0x72, 0xb2, 0x70, 0x4a, 0x5e, 0x51, 0xcb, 0x1b, 0xcb, 0x95, 0x17, 0xd1, 0x9e, + 0xd2, 0x37, 0x8f, 0x87, 0xe3, 0xba, 0x5a, 0xdd, 0xa1, 0x78, 0xa1, 0x67, 0x62, 0xfe, 0x68, 0x24, + 0xe2, 0x7a, 0x0c, 0xe1, 0x3e, 0xe0, 0x7e, 0x16, 0xb7, 0xe5, 0xf8, 0x85, 0xf9, 0x01, 0xe1, 0x91, + 0x9c, 0x34, 0x60, 0xb9, 0x81, 0x07, 0xfd, 0x34, 0x00, 0x94, 0x78, 0x2c, 0x39, 0x3d, 0xa9, 0xf9, + 0xa0, 0x1e, 0xe9, 0xb9, 0x4c, 0x17, 0x4c, 0xcd, 0x39, 0xce, 0x99, 0xa6, 0x2e, 0xab, 0xc9, 0x3f, + 0x63, 0xfb, 0xd9, 0x84, 0xf9, 0xf6, 0x7b, 0x2e, 0xcb, 0xfe, 0xa5, 0x0d, 0xc7, 0xd4, 0x41, 0x09, + 0x5f, 0xd5, 0xbe, 0xc8, 0x7b, 0x84, 0x4b, 0xd1, 0x35, 0x26, 0xc3, 0x49, 0x8d, 0xc9, 0x6d, 0x51, + 0x19, 0xc9, 0x41, 0x45, 0x6c, 0xe6, 0xc4, 0xbb, 0xef, 0xbf, 0x77, 0x8a, 0x63, 0x64, 0x84, 0x75, + 0xe1, 0x13, 0xae, 0x08, 0xdf, 0x28, 0x7f, 0x8d, 0x65, 0xac, 0x3b, 0xb2, 0x83, 0x70, 0x2f, 0xdc, + 0x08, 0x52, 0xcd, 0x60, 0x48, 0xec, 0x92, 0xca, 0xfd, 0x73, 0x20, 0x41, 0xcf, 0xb4, 0xd6, 0x33, + 0x41, 0x1e, 0xe4, 0xe8, 0x89, 0xff, 0xb7, 0x64, 0x73, 0x9b, 0x7c, 0x42, 0xb8, 0xff, 0xc4, 0xf5, + 0x26, 0x59, 0x7c, 0xc9, 0x35, 0x53, 0x19, 0x3f, 0x0f, 0x14, 0xb4, 0x51, 0xad, 0xad, 0x4a, 0x46, + 0xcf, 0xa7, 0x8d, 0xfc, 0x40, 0x78, 0x30, 0x75, 0x7a, 0xc8, 0x4c, 0x76, 0x41, 0xce, 0xba, 0x2f, + 0x95, 0x47, 0x17, 0x8e, 0x03, 0xe9, 0xcf, 0xb5, 0xf4, 0x79, 0x52, 0xcb, 0x91, 0x9e, 0xf1, 0x5d, + 0x62, 0x5b, 0x47, 0xab, 0x66, 0x9b, 0x7c, 0x43, 0xb8, 0x9c, 0xca, 0x36, 0xe7, 0x38, 0x99, 0xce, + 0x72, 0x36, 0x41, 0xa6, 0xb3, 0xbc, 0x0b, 0x6d, 0x3e, 0xd1, 0xce, 0x66, 0xc9, 0xcc, 0xff, 0x39, + 0xab, 0xbd, 0xdc, 0xed, 0x18, 0x68, 0xaf, 0x63, 0xa0, 0xfd, 0x8e, 0x81, 0x0e, 0x3a, 0x06, 0xfa, + 0x78, 0x68, 0x14, 0xf6, 0x0e, 0x8d, 0xc2, 0xfe, 0xa1, 0x51, 0x78, 0xfd, 0xd0, 0x96, 0xe1, 0x6a, + 0xbb, 0x4e, 0x1b, 0xaa, 0x95, 0x91, 0xff, 0xed, 0x11, 0x43, 0xb8, 0xe9, 0x89, 0xa0, 0x5e, 0xd2, + 0x9f, 0xf0, 0xe9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x93, 0xde, 0x52, 0x8d, 0xd5, 0x08, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -341,6 +524,9 @@ type QueryClient interface { // Queries a list of Service items. Service(ctx context.Context, in *QueryGetServiceRequest, opts ...grpc.CallOption) (*QueryGetServiceResponse, error) AllServices(ctx context.Context, in *QueryAllServicesRequest, opts ...grpc.CallOption) (*QueryAllServicesResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) } type queryClient struct { @@ -378,6 +564,24 @@ func (c *queryClient) AllServices(ctx context.Context, in *QueryAllServicesReque return out, nil } +func (c *queryClient) RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) { + out := new(QueryGetRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, "/poktroll.service.Query/RelayMiningDifficulty", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) { + out := new(QueryAllRelayMiningDifficultyResponse) + err := c.cc.Invoke(ctx, "/poktroll.service.Query/RelayMiningDifficultyAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -385,6 +589,9 @@ type QueryServer interface { // Queries a list of Service items. Service(context.Context, *QueryGetServiceRequest) (*QueryGetServiceResponse, error) AllServices(context.Context, *QueryAllServicesRequest) (*QueryAllServicesResponse, error) + // Queries a list of RelayMiningDifficulty items. + RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) + RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -400,6 +607,12 @@ func (*UnimplementedQueryServer) Service(ctx context.Context, req *QueryGetServi func (*UnimplementedQueryServer) AllServices(ctx context.Context, req *QueryAllServicesRequest) (*QueryAllServicesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllServices not implemented") } +func (*UnimplementedQueryServer) RelayMiningDifficulty(ctx context.Context, req *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficulty not implemented") +} +func (*UnimplementedQueryServer) RelayMiningDifficultyAll(ctx context.Context, req *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficultyAll not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -459,6 +672,42 @@ func _Query_AllServices_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_RelayMiningDifficulty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficulty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.service.Query/RelayMiningDifficulty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficulty(ctx, req.(*QueryGetRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RelayMiningDifficultyAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRelayMiningDifficultyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.service.Query/RelayMiningDifficultyAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RelayMiningDifficultyAll(ctx, req.(*QueryAllRelayMiningDifficultyRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "poktroll.service.Query", HandlerType: (*QueryServer)(nil), @@ -475,6 +724,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AllServices", Handler: _Query_AllServices_Handler, }, + { + MethodName: "RelayMiningDifficulty", + Handler: _Query_RelayMiningDifficulty_Handler, + }, + { + MethodName: "RelayMiningDifficultyAll", + Handler: _Query_RelayMiningDifficultyAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/service/query.proto", @@ -683,100 +940,601 @@ func (m *QueryAllServicesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryGetRelayMiningDifficultyRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } + +func (m *QueryGetRelayMiningDifficultyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRelayMiningDifficultyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + if len(m.ServiceId) > 0 { + i -= len(m.ServiceId) + copy(dAtA[i:], m.ServiceId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetRelayMiningDifficultyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryGetRelayMiningDifficultyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRelayMiningDifficultyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + { + size, err := m.RelayMiningDifficulty.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryGetServiceRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAllRelayMiningDifficultyRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryAllRelayMiningDifficultyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRelayMiningDifficultyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryGetServiceResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAllRelayMiningDifficultyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllRelayMiningDifficultyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRelayMiningDifficultyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RelayMiningDifficulty) > 0 { + for iNdEx := len(m.RelayMiningDifficulty) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RelayMiningDifficulty[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetServiceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetServiceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Service.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllServicesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllServicesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Service) > 0 { + for _, e := range m.Service { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRelayMiningDifficultyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRelayMiningDifficultyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RelayMiningDifficulty.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllRelayMiningDifficultyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllRelayMiningDifficultyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RelayMiningDifficulty) > 0 { + for _, e := range m.RelayMiningDifficulty { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetServiceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetServiceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - var l int - _ = l - l = m.Service.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} -func (m *QueryAllServicesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n + return nil } - -func (m *QueryAllServicesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Service) > 0 { - for _, e := range m.Service { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryGetServiceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Service.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllServicesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -799,12 +1557,48 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllServicesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -826,7 +1620,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllServicesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -849,15 +1643,15 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllServicesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllServicesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -884,7 +1678,44 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Service = append(m.Service, types.Service{}) + if err := m.Service[len(m.Service)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -909,7 +1740,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetServiceRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetRelayMiningDifficultyRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -932,15 +1763,15 @@ func (m *QueryGetServiceRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetServiceRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -968,7 +1799,7 @@ func (m *QueryGetServiceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Id = string(dAtA[iNdEx:postIndex]) + m.ServiceId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -991,7 +1822,7 @@ func (m *QueryGetServiceRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetServiceResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetRelayMiningDifficultyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1014,15 +1845,15 @@ func (m *QueryGetServiceResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetServiceResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1049,7 +1880,7 @@ func (m *QueryGetServiceResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Service.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RelayMiningDifficulty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1074,7 +1905,7 @@ func (m *QueryGetServiceResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllServicesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllRelayMiningDifficultyRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1097,10 +1928,10 @@ func (m *QueryAllServicesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllServicesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1160,7 +1991,7 @@ func (m *QueryAllServicesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllServicesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllRelayMiningDifficultyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1183,15 +2014,15 @@ func (m *QueryAllServicesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllServicesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllServicesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1218,8 +2049,8 @@ func (m *QueryAllServicesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Service = append(m.Service, types.Service{}) - if err := m.Service[len(m.Service)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RelayMiningDifficulty = append(m.RelayMiningDifficulty, RelayMiningDifficulty{}) + if err := m.RelayMiningDifficulty[len(m.RelayMiningDifficulty)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/service/types/query.pb.gw.go b/x/service/types/query.pb.gw.go index 621e80775..f39c1c38d 100644 --- a/x/service/types/query.pb.gw.go +++ b/x/service/types/query.pb.gw.go @@ -141,6 +141,96 @@ func local_request_Query_AllServices_0(ctx context.Context, marshaler runtime.Ma } +func request_Query_RelayMiningDifficulty_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["serviceId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serviceId") + } + + protoReq.ServiceId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serviceId", err) + } + + msg, err := client.RelayMiningDifficulty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RelayMiningDifficulty_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["serviceId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serviceId") + } + + protoReq.ServiceId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serviceId", err) + } + + msg, err := server.RelayMiningDifficulty(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_RelayMiningDifficultyAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RelayMiningDifficultyAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RelayMiningDifficultyAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RelayMiningDifficultyAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RelayMiningDifficultyAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRelayMiningDifficultyRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RelayMiningDifficultyAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RelayMiningDifficultyAll(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -216,6 +306,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_RelayMiningDifficulty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RelayMiningDifficulty_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficulty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RelayMiningDifficultyAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RelayMiningDifficultyAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficultyAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -317,6 +453,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_RelayMiningDifficulty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RelayMiningDifficulty_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficulty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RelayMiningDifficultyAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RelayMiningDifficultyAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RelayMiningDifficultyAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -326,6 +502,10 @@ var ( pattern_Query_Service_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"pokt-network", "poktroll", "service", "id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_AllServices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 2}, []string{"pokt-network", "poktroll", "service"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RelayMiningDifficulty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"pokt-network", "poktroll", "service", "relay_mining_difficulty", "serviceId"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RelayMiningDifficultyAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"pokt-network", "poktroll", "service", "relay_mining_difficulty"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -334,4 +514,8 @@ var ( forward_Query_Service_0 = runtime.ForwardResponseMessage forward_Query_AllServices_0 = runtime.ForwardResponseMessage + + forward_Query_RelayMiningDifficulty_0 = runtime.ForwardResponseMessage + + forward_Query_RelayMiningDifficultyAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/tokenomics/types/relay_mining_difficulty.pb.go b/x/service/types/relay_mining_difficulty.pb.go similarity index 83% rename from x/tokenomics/types/relay_mining_difficulty.pb.go rename to x/service/types/relay_mining_difficulty.pb.go index 981a19384..bb0b0d17b 100644 --- a/x/tokenomics/types/relay_mining_difficulty.pb.go +++ b/x/service/types/relay_mining_difficulty.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: poktroll/tokenomics/relay_mining_difficulty.proto +// source: poktroll/service/relay_mining_difficulty.proto package types @@ -45,7 +45,7 @@ func (m *RelayMiningDifficulty) Reset() { *m = RelayMiningDifficulty{} } func (m *RelayMiningDifficulty) String() string { return proto.CompactTextString(m) } func (*RelayMiningDifficulty) ProtoMessage() {} func (*RelayMiningDifficulty) Descriptor() ([]byte, []int) { - return fileDescriptor_1777fca7cd39aaea, []int{0} + return fileDescriptor_a9633b1df92612ec, []int{0} } func (m *RelayMiningDifficulty) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -99,34 +99,33 @@ func (m *RelayMiningDifficulty) GetTargetHash() []byte { } func init() { - proto.RegisterType((*RelayMiningDifficulty)(nil), "poktroll.tokenomics.RelayMiningDifficulty") + proto.RegisterType((*RelayMiningDifficulty)(nil), "poktroll.service.RelayMiningDifficulty") } func init() { - proto.RegisterFile("poktroll/tokenomics/relay_mining_difficulty.proto", fileDescriptor_1777fca7cd39aaea) + proto.RegisterFile("poktroll/service/relay_mining_difficulty.proto", fileDescriptor_a9633b1df92612ec) } -var fileDescriptor_1777fca7cd39aaea = []byte{ - // 292 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xb1, 0x4e, 0xf3, 0x30, - 0x14, 0x85, 0xeb, 0xbf, 0xd5, 0x2f, 0xd5, 0xad, 0x18, 0x02, 0x48, 0x11, 0x12, 0x26, 0x20, 0x86, - 0x2c, 0x34, 0x42, 0x7d, 0x03, 0x04, 0x52, 0x19, 0x18, 0xc8, 0xc8, 0x62, 0x39, 0x89, 0x6b, 0x5b, - 0x89, 0xed, 0xc8, 0x76, 0x80, 0xbc, 0x05, 0x8f, 0xc0, 0xe3, 0x30, 0x76, 0xec, 0x88, 0x92, 0x17, - 0x41, 0x71, 0xa1, 0xb0, 0x59, 0x9f, 0xef, 0x39, 0xf7, 0x9e, 0x03, 0xaf, 0x6b, 0x5d, 0x3a, 0xa3, - 0xab, 0x2a, 0x71, 0xba, 0xa4, 0x4a, 0x4b, 0x91, 0xdb, 0xc4, 0xd0, 0x8a, 0xb4, 0x58, 0x0a, 0x25, - 0x14, 0xc3, 0x85, 0x58, 0xaf, 0x45, 0xde, 0x54, 0xae, 0x5d, 0xd4, 0x46, 0x3b, 0x1d, 0x1c, 0xfe, - 0x48, 0x16, 0xbf, 0x92, 0x93, 0x23, 0xa6, 0x99, 0xf6, 0xff, 0xc9, 0xf0, 0xda, 0x8d, 0x5e, 0xbc, - 0x03, 0x78, 0x9c, 0x0e, 0x66, 0x0f, 0xde, 0xeb, 0x76, 0x6f, 0x15, 0x9c, 0x42, 0x68, 0xa9, 0x79, - 0x16, 0x39, 0xc5, 0xa2, 0x08, 0x41, 0x04, 0xe2, 0x69, 0x3a, 0xfd, 0x26, 0xf7, 0x45, 0x70, 0x0e, - 0xe7, 0x59, 0xa5, 0xf3, 0x12, 0x73, 0x2a, 0x18, 0x77, 0xe1, 0xbf, 0x08, 0xc4, 0xe3, 0x74, 0xe6, - 0xd9, 0xca, 0xa3, 0xe0, 0x12, 0x1e, 0xa8, 0x46, 0x62, 0x7f, 0xab, 0xc5, 0x54, 0x92, 0x70, 0x1c, - 0x81, 0x78, 0x92, 0xce, 0x55, 0x23, 0xfd, 0x4e, 0x7b, 0x27, 0x49, 0x70, 0x06, 0x67, 0x8e, 0x18, - 0x46, 0x1d, 0xe6, 0xc4, 0xf2, 0x70, 0x12, 0x81, 0x78, 0x9e, 0xc2, 0x1d, 0x5a, 0x11, 0xcb, 0x6f, - 0x1e, 0x3f, 0x3a, 0x04, 0x36, 0x1d, 0x02, 0xdb, 0x0e, 0x81, 0xcf, 0x0e, 0x81, 0xb7, 0x1e, 0x8d, - 0x36, 0x3d, 0x1a, 0x6d, 0x7b, 0x34, 0x7a, 0x5a, 0x32, 0xe1, 0x78, 0x93, 0x2d, 0x72, 0x2d, 0x93, - 0x21, 0xf6, 0x95, 0xa2, 0xee, 0x45, 0x9b, 0x32, 0xd9, 0xd7, 0xf6, 0xfa, 0xb7, 0x38, 0xd7, 0xd6, - 0xd4, 0x66, 0xff, 0x7d, 0xf8, 0xe5, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0x9e, 0x74, 0x57, - 0x5c, 0x01, 0x00, 0x00, +var fileDescriptor_a9633b1df92612ec = []byte{ + // 285 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0xc1, 0x4a, 0xf4, 0x30, + 0x14, 0x85, 0x27, 0xff, 0x0c, 0x3f, 0x4c, 0x66, 0x10, 0x29, 0x0a, 0x45, 0x30, 0x56, 0x71, 0xd1, + 0x8d, 0xad, 0xe0, 0x1b, 0x88, 0xc2, 0xb8, 0xd0, 0x45, 0x97, 0x6e, 0x42, 0xda, 0x66, 0x92, 0xd0, + 0xa6, 0x29, 0x49, 0xaa, 0xf6, 0x2d, 0x7c, 0x04, 0x1f, 0xc7, 0xe5, 0x2c, 0x67, 0x29, 0xed, 0x8b, + 0x48, 0x33, 0xb5, 0xbb, 0xf0, 0xe5, 0xdc, 0x73, 0xef, 0x39, 0x30, 0xaa, 0x55, 0x61, 0xb5, 0x2a, + 0xcb, 0xd8, 0x50, 0xfd, 0x26, 0x32, 0x1a, 0x6b, 0x5a, 0x92, 0x16, 0x4b, 0x51, 0x89, 0x8a, 0xe1, + 0x5c, 0x6c, 0xb7, 0x22, 0x6b, 0x4a, 0xdb, 0x46, 0xb5, 0x56, 0x56, 0x79, 0xc7, 0x7f, 0xfa, 0x68, + 0xd4, 0x9f, 0x9d, 0x30, 0xc5, 0x94, 0xfb, 0x8c, 0x87, 0xd7, 0x41, 0x77, 0xf5, 0x05, 0xe0, 0x69, + 0x32, 0x38, 0x3d, 0x3b, 0xa3, 0x87, 0xc9, 0xc7, 0x3b, 0x87, 0x70, 0x1c, 0xc5, 0x22, 0xf7, 0x41, + 0x00, 0xc2, 0x65, 0xb2, 0x1c, 0xc9, 0x53, 0xee, 0x5d, 0xc2, 0x75, 0x5a, 0xaa, 0xac, 0xc0, 0x9c, + 0x0a, 0xc6, 0xad, 0xff, 0x2f, 0x00, 0xe1, 0x3c, 0x59, 0x39, 0xb6, 0x71, 0xc8, 0xbb, 0x86, 0x47, + 0x55, 0x23, 0xb1, 0x3b, 0xd4, 0x60, 0x2a, 0x89, 0x3f, 0x0f, 0x40, 0xb8, 0x48, 0xd6, 0x55, 0x23, + 0xdd, 0x4e, 0xf3, 0x28, 0x89, 0x77, 0x01, 0x57, 0x96, 0x68, 0x46, 0x2d, 0xe6, 0xc4, 0x70, 0x7f, + 0x11, 0x80, 0x70, 0x9d, 0xc0, 0x03, 0xda, 0x10, 0xc3, 0xef, 0x5f, 0xbe, 0x3b, 0x04, 0x76, 0x1d, + 0x02, 0xfb, 0x0e, 0x81, 0x9f, 0x0e, 0x81, 0xcf, 0x1e, 0xcd, 0x76, 0x3d, 0x9a, 0xed, 0x7b, 0x34, + 0x7b, 0xbd, 0x65, 0xc2, 0xf2, 0x26, 0x8d, 0x32, 0x25, 0xe3, 0x21, 0xf3, 0x4d, 0x45, 0xed, 0xbb, + 0xd2, 0x45, 0x3c, 0x15, 0xf6, 0x31, 0x55, 0x66, 0xdb, 0x9a, 0x9a, 0xf4, 0xbf, 0x4b, 0x7e, 0xf7, + 0x1b, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x5c, 0x12, 0x62, 0x53, 0x01, 0x00, 0x00, } func (m *RelayMiningDifficulty) Marshal() (dAtA []byte, err error) { diff --git a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go index 079e28e85..f2870c114 100644 --- a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go +++ b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go @@ -241,11 +241,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequiredAndNotProv sharedParams := s.keepers.SharedKeeper.GetParams(ctx) // Retrieve the number of compute units in the claim - numComputeUnits, err := s.claim.GetNumComputeUnits() + numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() require.NoError(t, err) // -1 to push threshold below s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numComputeUnits-1) + proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits-1) require.NoError(t, err) // Set the proof missing penalty to half the supplier's stake so it is not @@ -303,6 +303,7 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequiredAndNotProv require.Equal(t, tokenomicstypes.ClaimExpirationReason_PROOF_MISSING, expectedClaimExpiredEvent.GetExpirationReason()) require.Equal(t, s.numRelays, expectedClaimExpiredEvent.GetNumRelays()) // TODO(@red-0ne, #781): Ensure other claim expiration event fields are validated once added + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt // Confirm that a slashing event was emitted expectedSlashingEvents := testutilevents.FilterEvents[*tokenomicstypes.EventSupplierSlashed](t, events, "poktroll.tokenomics.EventSupplierSlashed") @@ -322,11 +323,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimSettled_ProofRequiredAndProvide sharedParams := s.keepers.SharedKeeper.GetParams(ctx) // Retrieve the number of compute units in the claim - numComputeUnits, err := s.claim.GetNumComputeUnits() + numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() require.NoError(t, err) // -1 to push threshold below s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numComputeUnits-1) + proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits-1) require.NoError(t, err) // Set the proof parameters such that s.claim requires a proof because: @@ -453,11 +454,11 @@ func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_Vi sharedParams := s.keepers.SharedKeeper.GetParams(ctx) // Retrieve the number of compute units in the claim - numComputeUnits, err := s.claim.GetNumComputeUnits() + numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() require.NoError(t, err) // +1 so its not required via probability - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numComputeUnits+1) + proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits+1) require.NoError(t, err) // Set the proof parameters such that s.claim requires a proof because: @@ -500,6 +501,7 @@ func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_Vi require.Equal(t, prooftypes.ProofRequirementReason_PROBABILISTIC, expectedEvent.GetProofRequirement()) require.Equal(t, s.numRelays, expectedEvent.GetNumRelays()) // TODO(@red-0ne, #781): Ensure other claim expiration event fields are validated once added + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt } func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { @@ -509,11 +511,11 @@ func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { sharedParams := s.keepers.SharedKeeper.GetParams(ctx) // Retrieve the number of compute units in the claim - numComputeUnits, err := s.claim.GetNumComputeUnits() + numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() require.NoError(t, err) // +1 to push threshold above s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numComputeUnits+1) + proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits+1) require.NoError(t, err) // Set the proof parameters such that s.claim DOES NOT require a proof because: @@ -581,11 +583,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimPendingAfterSettlement() { sharedParams := s.keepers.SharedKeeper.GetParams(ctx) // Retrieve the number of compute units in the claim - numComputeUnits, err := s.claim.GetNumComputeUnits() + numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() require.NoError(t, err) // +1 to push threshold above s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numComputeUnits+1) + proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits+1) require.NoError(t, err) // Set the proof parameters such that s.claim DOES NOT require a proof @@ -669,11 +671,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_SupplierUnstaked() { sharedParams := s.keepers.SharedKeeper.GetParams(ctx) // Retrieve the number of compute units in the claim - numComputeUnits, err := s.claim.GetNumComputeUnits() + numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() require.NoError(t, err) // -1 to push threshold below s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numComputeUnits-1) + proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits-1) require.NoError(t, err) // Set the proof parameters such that s.claim requires a proof because: diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index 321196f1d..c0f9917c8 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -66,9 +66,9 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( return settledResult, expiredResult, err } - // DEV_NOTE: We are assuming that (numRelays := numComputeUnits * service.ComputeUnitsPerRelay) + // DEV_NOTE: We are assuming that (numClaimComputeUnits := numComputeUnits * service.ComputeUnitsPerRelay) // because this code path is only reached if that has already been validated. - numClaimComputeUnits, err = claim.GetNumComputeUnits() + numClaimComputeUnits, err = claim.GetNumClaimedComputeUnits() if err != nil { return settledResult, expiredResult, err } @@ -113,10 +113,11 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( // Proof was required but is invalid or not found. // Emit an event that a claim has expired and being removed without being settled. claimExpiredEvent := tokenomicstypes.EventClaimExpired{ - Claim: &claim, - ExpirationReason: expirationReason, - NumRelays: numClaimRelays, - NumComputeUnits: numClaimComputeUnits, + Claim: &claim, + ExpirationReason: expirationReason, + NumRelays: numClaimRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt } if err = ctx.EventManager().EmitTypedEvent(&claimExpiredEvent); err != nil { return settledResult, expiredResult, err @@ -159,9 +160,10 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( } claimSettledEvent := tokenomicstypes.EventClaimSettled{ - Claim: &claim, - NumRelays: numClaimRelays, - NumComputeUnits: numClaimComputeUnits, + Claim: &claim, + NumRelays: numClaimRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt ProofRequirement: proofRequirement, } @@ -170,10 +172,11 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( } if err = ctx.EventManager().EmitTypedEvent(&prooftypes.EventProofUpdated{ - Claim: &claim, - Proof: nil, - NumRelays: 0, - NumComputeUnits: 0, + Claim: &claim, + Proof: nil, + NumRelays: 0, + NumClaimedComputeUnits: 0, + // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt }); err != nil { return settledResult, expiredResult, err } diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 4ff96e027..dd9058eec 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -16,13 +16,14 @@ import ( "github.com/pokt-network/poktroll/telemetry" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" "github.com/pokt-network/poktroll/x/tokenomics" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" - tokenomictypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) var ( @@ -100,7 +101,7 @@ type TokenLogicModuleProcessor func( *apptypes.Application, *sharedtypes.Supplier, cosmostypes.Coin, // This is the "actualSettlementCoin" rather than just the "claimCoin" because of how settlement functions; see ensureClaimAmountLimits for details. - *tokenomictypes.RelayMiningDifficulty, + *servicetypes.RelayMiningDifficulty, ) error // tokenLogicModuleProcessorMap is a map of TLMs to their respective independent processors. @@ -177,7 +178,7 @@ func (k Keeper) ProcessTokenLogicModules( } // Retrieve the sum (i.e. number of compute units) to determine the amount of work done - numClaimComputeUnits, err := claim.GetNumComputeUnits() + numClaimComputeUnits, err := claim.GetNumClaimedComputeUnits() if err != nil { return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf("failed to retrieve numClaimComputeUnits: %s", err) } @@ -265,16 +266,16 @@ func (k Keeper) ProcessTokenLogicModules( logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) compute units, equal to (%s) claimed", numClaimComputeUnits, actualSettlementCoin)) // Retrieving the relay mining difficulty for the service at hand - relayMiningDifficulty, found := k.GetRelayMiningDifficulty(ctx, service.Id) + relayMiningDifficulty, found := k.serviceKeeper.GetRelayMiningDifficulty(ctx, service.Id) if !found { - relayMiningDifficulty = newDefaultRelayMiningDifficulty(ctx, logger, service.Id, numRelays) + relayMiningDifficulty = servicekeeper.NewDefaultRelayMiningDifficulty(ctx, logger, service.Id, servicekeeper.TargetNumRelays) } // Execute all the token logic modules processors for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { logger.Info(fmt.Sprintf("Starting TLM processing: %q", tlm)) if err := tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { - return tokenomictypes.ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm, err) + return tokenomicstypes.ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm, err) } logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) } @@ -304,7 +305,7 @@ func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( application *apptypes.Application, supplier *sharedtypes.Supplier, settlementCoin cosmostypes.Coin, - relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, + relayMiningDifficulty *servicetypes.RelayMiningDifficulty, ) error { logger := k.Logger().With("method", "TokenLogicModuleRelayBurnEqualsMint") @@ -365,7 +366,7 @@ func (k Keeper) TokenLogicModuleGlobalMint( application *apptypes.Application, supplier *sharedtypes.Supplier, settlementCoin cosmostypes.Coin, - relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, + relayMiningDifficulty *servicetypes.RelayMiningDifficulty, ) error { logger := k.Logger().With("method", "TokenLogicModuleGlobalMint") @@ -382,16 +383,16 @@ func (k Keeper) TokenLogicModuleGlobalMint( } // Mint new uPOKT to the tokenomics module account - if err := k.bankKeeper.MintCoins(ctx, tokenomictypes.ModuleName, sdk.NewCoins(newMintCoin)); err != nil { + if err := k.bankKeeper.MintCoins(ctx, tokenomicstypes.ModuleName, sdk.NewCoins(newMintCoin)); err != nil { return tokenomicstypes.ErrTokenomicsModuleMintFailed.Wrapf( "minting (%s) to the tokenomics module account: %v", newMintCoin, err) } logger.Info(fmt.Sprintf("minted (%s) to the tokenomics module account", newMintCoin)) // Send a portion of the rewards to the application - appCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, application.GetAddress(), &newMintAmtFloat, MintAllocationApplication) + appCoin, err := k.sendRewardsToAccount(ctx, tokenomicstypes.ModuleName, application.GetAddress(), &newMintAmtFloat, MintAllocationApplication) if err != nil { - return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to application: %v", err) + return tokenomicstypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to application: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the application with address %q", appCoin, application.Address)) @@ -417,24 +418,24 @@ func (k Keeper) TokenLogicModuleGlobalMint( logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the supplier with address %q", supplierCoin, supplier.OperatorAddress)) // Send a portion of the rewards to the DAO - daoCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, k.GetAuthority(), &newMintAmtFloat, MintAllocationDAO) + daoCoin, err := k.sendRewardsToAccount(ctx, tokenomicstypes.ModuleName, k.GetAuthority(), &newMintAmtFloat, MintAllocationDAO) if err != nil { - return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to DAO: %v", err) + return tokenomicstypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to DAO: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the DAO with address %q", daoCoin, k.GetAuthority())) // Send a portion of the rewards to the source owner - serviceCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, service.OwnerAddress, &newMintAmtFloat, MintAllocationSourceOwner) + serviceCoin, err := k.sendRewardsToAccount(ctx, tokenomicstypes.ModuleName, service.OwnerAddress, &newMintAmtFloat, MintAllocationSourceOwner) if err != nil { - return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to source owner: %v", err) + return tokenomicstypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to source owner: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the source owner with address %q", serviceCoin, service.OwnerAddress)) // Send a portion of the rewards to the block proposer proposerAddr := cosmostypes.AccAddress(sdk.UnwrapSDKContext(ctx).BlockHeader().ProposerAddress).String() - proposerCoin, err := k.sendRewardsToAccount(ctx, tokenomictypes.ModuleName, proposerAddr, &newMintAmtFloat, MintAllocationProposer) + proposerCoin, err := k.sendRewardsToAccount(ctx, tokenomicstypes.ModuleName, proposerAddr, &newMintAmtFloat, MintAllocationProposer) if err != nil { - return tokenomictypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to proposer: %v", err) + return tokenomicstypes.ErrTokenomicsSendingMintRewards.Wrapf("sending rewards to proposer: %v", err) } logger.Debug(fmt.Sprintf("sent (%v) newley minted coins from the tokenomics module to the proposer with address %q", proposerCoin, proposerAddr)) @@ -469,7 +470,7 @@ func (k Keeper) ensureMintedCoinsAreDistributed( // Discrepancy exists and is too large, return an error if isPercentDifferenceTooLarge && isAbsDifferenceSignificant { - return tokenomictypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( + return tokenomicstypes.ErrTokenomicsAmountMismatchTooLarge.Wrapf( "the total distributed coins (%v) do not equal the amount of newly minted coins (%v) with a percent difference of (%f). Likely floating point arithmetic.\n"+ "appCoin: %v, supplierCoin: %v, daoCoin: %v, serviceCoin: %v, proposerCoin: %v", totalMintDistributedCoin, newMintCoin, percentDifference, diff --git a/x/tokenomics/keeper/update_relay_mining_difficulty.go b/x/tokenomics/keeper/update_relay_mining_difficulty.go index 395af022c..298578e4c 100644 --- a/x/tokenomics/keeper/update_relay_mining_difficulty.go +++ b/x/tokenomics/keeper/update_relay_mining_difficulty.go @@ -1,167 +1,19 @@ package keeper import ( - "bytes" "context" - "encoding/hex" - "fmt" - "math/big" - "cosmossdk.io/log" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/pkg/crypto/protocol" - prooftypes "github.com/pokt-network/poktroll/x/proof/types" - "github.com/pokt-network/poktroll/x/tokenomics/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/pokt-network/poktroll/x/service/types" ) -// TargetNumRelays is the target number of relays we want the network to mine for -// a specific service across all applications & suppliers per session. -// This number determines the total number of leafs to be created across in -// the off-chain SMTs, across all suppliers, for each service. -// It indirectly drives the off-chain resource requirements of the network -// in additional to playing a critical role in Relay Mining. -// TODO_MAINNET(#542): Make this a governance parameter and figure out the correct value. -const TargetNumRelays = uint64(10e4) - -// Exponential moving average (ema) smoothing factor, commonly known as alpha. -// Usually, alpha = 2 / (N+1), where N is the number of periods. -// Large alpha -> more weight on recent data; less smoothing and fast response. -// Small alpha -> more weight on past data; more smoothing and slow response. -// -// TODO_MAINNET: Use a language agnostic float implementation or arithmetic library -// to ensure deterministic results across different language implementations of the -// protocol. -// -// TODO_MAINNET(@olshansk, @rawthil): Play around with the value N for EMA to -// capture what the memory should be. -var emaSmoothingFactor = new(big.Float).SetFloat64(0.1) - // UpdateRelayMiningDifficulty updates the on-chain relay mining difficulty // based on the amount of on-chain relays for each service, given a map of serviceId->numRelays. +// This is a wrapper around the service keeper's UpdateRelayMiningDifficulty method +// to allow the tokenomics EndBlocker to update the relay mining difficulty after +// all claims have settled. func (k Keeper) UpdateRelayMiningDifficulty( ctx context.Context, relaysPerServiceMap map[string]uint64, ) (difficultyPerServiceMap map[string]types.RelayMiningDifficulty, err error) { - logger := k.Logger().With("method", "UpdateRelayMiningDifficulty") - sdkCtx := sdk.UnwrapSDKContext(ctx) - - difficultyPerServiceMap = make(map[string]types.RelayMiningDifficulty, len(relaysPerServiceMap)) - for serviceId, numRelays := range relaysPerServiceMap { - prevDifficulty, found := k.GetRelayMiningDifficulty(ctx, serviceId) - if !found { - prevDifficulty = newDefaultRelayMiningDifficulty(ctx, logger, serviceId, numRelays) - } - - // TODO_MAINNET(@Olshansk): We could potentially compute the smoothing factor - // using a common formula, such as alpha = 2 / (N+1), where N is the number - // of periods. - // N := ctx.BlockHeight() - prevDifficulty.BlockHeight - // alpha := 2 / (1 + N) - alpha := emaSmoothingFactor - - // Compute the updated EMA of the number of relays. - prevRelaysEma := prevDifficulty.NumRelaysEma - newRelaysEma := computeEma(alpha, prevRelaysEma, numRelays) - - // CRITICAL_DEV_NOTE: We changed this code to pass in "DefaultRelayDifficultyTargetHash" instead of "prevDifficulty.TargetHash" - // to "ComputeNewDifficultyTargetHash" because we used to have 2 moving variables: - // 1. Input difficulty - // 2. Relays EMA - // However, since the "TargetNumRelays" remained constant, the following case would keep scaling down the difficulty: - // - newRelaysEma = 100 -> scaled by 10 / 100 -> scaled down by 0.1 - // - newRelaysEma = 50 -> scaled by 10 / 50 -> scaled down by 0.2 - // - newRelaysEma = 20 -> scaled by 10 / 20 -> scaled down by 0.5 - // We kept scaling down even though numRelaysEma was decreasing. - // To avoid continuing to increase the difficulty (i.e. scaling down), the - // relative starting difficulty has to be kept constant. - difficultyHash := protocol.ComputeNewDifficultyTargetHash(prooftypes.DefaultRelayDifficultyTargetHash, TargetNumRelays, newRelaysEma) - newDifficulty := types.RelayMiningDifficulty{ - ServiceId: serviceId, - BlockHeight: sdkCtx.BlockHeight(), - NumRelaysEma: newRelaysEma, - TargetHash: difficultyHash, - } - k.SetRelayMiningDifficulty(ctx, newDifficulty) - - // Emit an event for the updated relay mining difficulty regardless of - // whether the difficulty changed or not. - - relayMiningDifficultyUpdateEvent := types.EventRelayMiningDifficultyUpdated{ - ServiceId: serviceId, - PrevTargetHashHexEncoded: hex.EncodeToString(prevDifficulty.TargetHash), - NewTargetHashHexEncoded: hex.EncodeToString(newDifficulty.TargetHash), - PrevNumRelaysEma: prevDifficulty.NumRelaysEma, - NewNumRelaysEma: newDifficulty.NumRelaysEma, - } - if err := sdkCtx.EventManager().EmitTypedEvent(&relayMiningDifficultyUpdateEvent); err != nil { - return nil, err - } - - // Output the appropriate log message based on whether the difficulty was initialized, updated or unchanged. - var logMessage string - switch { - case !found: - logMessage = fmt.Sprintf("Initialized RelayMiningDifficulty for service %s at height %d with difficulty %x", serviceId, sdkCtx.BlockHeight(), newDifficulty.TargetHash) - case !bytes.Equal(prevDifficulty.TargetHash, newDifficulty.TargetHash): - logMessage = fmt.Sprintf("Updated RelayMiningDifficulty for service %s at height %d from %x to %x", serviceId, sdkCtx.BlockHeight(), prevDifficulty.TargetHash, newDifficulty.TargetHash) - default: - logMessage = fmt.Sprintf("No change in RelayMiningDifficulty for service %s at height %d. Current difficulty: %x", serviceId, sdkCtx.BlockHeight(), newDifficulty.TargetHash) - } - logger.Info(logMessage) - - // Store the updated difficulty in the map for telemetry. - // This is done to only emit the telemetry event if all the difficulties - // are updated successfully. - difficultyPerServiceMap[serviceId] = newDifficulty - } - - return difficultyPerServiceMap, nil -} - -// computeEma computes the EMA at time t, given the EMA at time t-1, the raw -// data revealed at time t, and the smoothing factor α. -// Src: https://en.wikipedia.org/wiki/Exponential_smoothing -// -// TODO_MAINNET: Use a language agnostic float implementation or arithmetic library -// to ensure deterministic results across different language implementations of the -// protocol. -func computeEma(alpha *big.Float, prevEma, currValue uint64) uint64 { - oneMinusAlpha := new(big.Float).Sub(new(big.Float).SetInt64(1), alpha) - prevEmaFloat := new(big.Float).SetUint64(prevEma) - - weightedCurrentContribution := new(big.Float).Mul(alpha, new(big.Float).SetUint64(currValue)) - weightedPreviousContribution := new(big.Float).Mul(oneMinusAlpha, prevEmaFloat) - newEma, _ := new(big.Float).Add(weightedCurrentContribution, weightedPreviousContribution).Uint64() - return newEma -} - -// newDefaultRelayMiningDifficulty is a helper that creates a new RelayMiningDifficulty -// structure if one is not available. It is often used to set the default when a service's -// difficulty is being initialized for the first time. -func newDefaultRelayMiningDifficulty( - ctx context.Context, - logger log.Logger, - serviceId string, - numRelays uint64, -) tokenomicstypes.RelayMiningDifficulty { - logger = logger.With("helper", "NewDefaultRelayMiningDifficulty") - - // Compute the target hash based on the number of relays seen for the first time. - newDifficultyHash := protocol.ComputeNewDifficultyTargetHash(prooftypes.DefaultRelayDifficultyTargetHash, TargetNumRelays, numRelays) - - logger.Warn(types.ErrTokenomicsMissingRelayMiningDifficulty.Wrapf( - "No previous relay mining difficulty found for service %s.\n"+ - "Creating a new relay mining difficulty with %d relays and an initial target hash %x", - serviceId, numRelays, newDifficultyHash).Error()) - - // Return a new RelayMiningDifficulty with the computed target hash. - return tokenomicstypes.RelayMiningDifficulty{ - ServiceId: serviceId, - BlockHeight: sdk.UnwrapSDKContext(ctx).BlockHeight(), - NumRelaysEma: numRelays, - TargetHash: newDifficultyHash, - } - + return k.serviceKeeper.UpdateRelayMiningDifficulty(ctx, relaysPerServiceMap) } diff --git a/x/tokenomics/module/genesis.go b/x/tokenomics/module/genesis.go index e4e09b61d..c877263d1 100644 --- a/x/tokenomics/module/genesis.go +++ b/x/tokenomics/module/genesis.go @@ -9,10 +9,6 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the relayMiningDifficulty - for _, difficulty := range genState.RelayMiningDifficultyList { - k.SetRelayMiningDifficulty(ctx, difficulty) - } // this line is used by starport scaffolding # genesis/module/init if err := k.SetParams(ctx, genState.Params); err != nil { panic(err) @@ -24,7 +20,6 @@ func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.RelayMiningDifficultyList = k.GetAllRelayMiningDifficulty(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/tokenomics/module/genesis_test.go b/x/tokenomics/module/genesis_test.go index d9d206ef5..d50e182d6 100644 --- a/x/tokenomics/module/genesis_test.go +++ b/x/tokenomics/module/genesis_test.go @@ -14,15 +14,6 @@ import ( func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), - - RelayMiningDifficultyList: []types.RelayMiningDifficulty{ - { - ServiceId: "0", - }, - { - ServiceId: "1", - }, - }, // this line is used by starport scaffolding # genesis/test/state } @@ -34,6 +25,5 @@ func TestGenesis(t *testing.T) { nullify.Fill(&genesisState) nullify.Fill(got) - require.ElementsMatch(t, genesisState.RelayMiningDifficultyList, got.RelayMiningDifficultyList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index 05afa3e9e..2d80c19ea 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -24,17 +24,16 @@ var ( ErrTokenomicsParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") ErrTokenomicsUnmarshalInvalid = sdkerrors.Register(ModuleName, 1116, "failed to unmarshal the provided bytes") ErrTokenomicsDuplicateIndex = sdkerrors.Register(ModuleName, 1117, "cannot have a duplicate index") - ErrTokenomicsMissingRelayMiningDifficulty = sdkerrors.Register(ModuleName, 1118, "missing relay mining difficulty") - ErrTokenomicsEmittingEventFailed = sdkerrors.Register(ModuleName, 1119, "failed to emit event") - ErrTokenomicsServiceNotFound = sdkerrors.Register(ModuleName, 1120, "service not found") - ErrTokenomicsModuleMintFailed = sdkerrors.Register(ModuleName, 1121, "failed to mint uPOKT to tokenomics module account") - ErrTokenomicsSendingMintRewards = sdkerrors.Register(ModuleName, 1122, "failed to send minted rewards") - ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1123, "failed to mint uPOKT to supplier module account") - ErrTokenomicsSupplierOwnerAddressInvalid = sdkerrors.Register(ModuleName, 1124, "the supplier owner address in the claim is not a valid bech32 address") - ErrTokenomicsSupplierRevShareFailed = sdkerrors.Register(ModuleName, 1125, "failed to send rev share to supplier shareholders") - ErrTokenomicsApplicationReimbursementRequestFailed = sdkerrors.Register(ModuleName, 1126, "failed to send application reimbursement request event") - ErrTokenomicsAmountMismatchTooLarge = sdkerrors.Register(ModuleName, 1127, "an unexpected amount mismatch occurred") - ErrTokenomicsMintAmountZero = sdkerrors.Register(ModuleName, 1128, "mint amount cannot be zero") - ErrTokenomicsTLMError = sdkerrors.Register(ModuleName, 1129, "failed to process TLM") - ErrTokenomicsCalculation = sdkerrors.Register(ModuleName, 1130, "tokenomics calculation error") + ErrTokenomicsEmittingEventFailed = sdkerrors.Register(ModuleName, 1118, "failed to emit event") + ErrTokenomicsServiceNotFound = sdkerrors.Register(ModuleName, 1119, "service not found") + ErrTokenomicsModuleMintFailed = sdkerrors.Register(ModuleName, 1120, "failed to mint uPOKT to tokenomics module account") + ErrTokenomicsSendingMintRewards = sdkerrors.Register(ModuleName, 1121, "failed to send minted rewards") + ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1122, "failed to mint uPOKT to supplier module account") + ErrTokenomicsSupplierOwnerAddressInvalid = sdkerrors.Register(ModuleName, 1123, "the supplier owner address in the claim is not a valid bech32 address") + ErrTokenomicsSupplierRevShareFailed = sdkerrors.Register(ModuleName, 1124, "failed to send rev share to supplier shareholders") + ErrTokenomicsApplicationReimbursementRequestFailed = sdkerrors.Register(ModuleName, 1125, "failed to send application reimbursement request event") + ErrTokenomicsAmountMismatchTooLarge = sdkerrors.Register(ModuleName, 1126, "an unexpected amount mismatch occurred") + ErrTokenomicsMintAmountZero = sdkerrors.Register(ModuleName, 1127, "mint amount cannot be zero") + ErrTokenomicsTLMError = sdkerrors.Register(ModuleName, 1128, "failed to process TLM") + ErrTokenomicsCalculation = sdkerrors.Register(ModuleName, 1129, "tokenomics calculation error") ) diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 889236fed..24a5b1e9d 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -64,7 +64,13 @@ type EventClaimExpired struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` // Number of compute units claimed as a function of the number of relays // and the compute units per relay for the particular service. - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` + // Number of estimated compute units claimed as a function of the number of claimed + // compute units and the relay difficulty multiplier for the particular service. + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` + // The amount of uPOKT claimed to be rewarded for the work done as a function of + // the number of estimated compute units and the compute uints to token multiplier. + ClaimedAmountUpokt *types1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` } func (m *EventClaimExpired) Reset() { *m = EventClaimExpired{} } @@ -117,13 +123,27 @@ func (m *EventClaimExpired) GetNumRelays() uint64 { return 0 } -func (m *EventClaimExpired) GetNumComputeUnits() uint64 { +func (m *EventClaimExpired) GetNumClaimedComputeUnits() uint64 { if m != nil { - return m.NumComputeUnits + return m.NumClaimedComputeUnits } return 0 } +func (m *EventClaimExpired) GetNumEstimatedComputeUnits() uint64 { + if m != nil { + return m.NumEstimatedComputeUnits + } + return 0 +} + +func (m *EventClaimExpired) GetClaimedAmountUpokt() *types1.Coin { + if m != nil { + return m.ClaimedAmountUpokt + } + return nil +} + // EventClaimSettled is an event emitted whenever a claim is settled. // The proof_required determines whether the claim requires a proof that has been submitted or not type EventClaimSettled struct { @@ -134,7 +154,13 @@ type EventClaimSettled struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` // Number of compute units claimed as a function of the number of relays // and the compute units per relay for the particular service. - NumComputeUnits uint64 `protobuf:"varint,4,opt,name=num_compute_units,json=numComputeUnits,proto3" json:"num_compute_units"` + NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` + // Number of estimated compute units claimed as a function of the number of claimed + // compute units and the relay difficulty multiplier for the particular service. + NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` + // The amount of uPOKT claimed to be rewarded for the work done as a function of + // the number of estimated compute units and the compute uints to token multiplier. + ClaimedAmountUpokt *types1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` } func (m *EventClaimSettled) Reset() { *m = EventClaimSettled{} } @@ -187,85 +213,25 @@ func (m *EventClaimSettled) GetNumRelays() uint64 { return 0 } -func (m *EventClaimSettled) GetNumComputeUnits() uint64 { +func (m *EventClaimSettled) GetNumClaimedComputeUnits() uint64 { if m != nil { - return m.NumComputeUnits + return m.NumClaimedComputeUnits } return 0 } -// EventRelayMiningDifficultyUpdated is an event emitted whenever the relay mining difficulty is updated -// for a given service. -type EventRelayMiningDifficultyUpdated struct { - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - PrevTargetHashHexEncoded string `protobuf:"bytes,2,opt,name=prev_target_hash_hex_encoded,json=prevTargetHashHexEncoded,proto3" json:"prev_target_hash_hex_encoded,omitempty"` - NewTargetHashHexEncoded string `protobuf:"bytes,3,opt,name=new_target_hash_hex_encoded,json=newTargetHashHexEncoded,proto3" json:"new_target_hash_hex_encoded,omitempty"` - PrevNumRelaysEma uint64 `protobuf:"varint,4,opt,name=prev_num_relays_ema,json=prevNumRelaysEma,proto3" json:"prev_num_relays_ema,omitempty"` - NewNumRelaysEma uint64 `protobuf:"varint,5,opt,name=new_num_relays_ema,json=newNumRelaysEma,proto3" json:"new_num_relays_ema,omitempty"` -} - -func (m *EventRelayMiningDifficultyUpdated) Reset() { *m = EventRelayMiningDifficultyUpdated{} } -func (m *EventRelayMiningDifficultyUpdated) String() string { return proto.CompactTextString(m) } -func (*EventRelayMiningDifficultyUpdated) ProtoMessage() {} -func (*EventRelayMiningDifficultyUpdated) Descriptor() ([]byte, []int) { - return fileDescriptor_a78874bbf91a58c7, []int{2} -} -func (m *EventRelayMiningDifficultyUpdated) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventRelayMiningDifficultyUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *EventRelayMiningDifficultyUpdated) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventRelayMiningDifficultyUpdated.Merge(m, src) -} -func (m *EventRelayMiningDifficultyUpdated) XXX_Size() int { - return m.Size() -} -func (m *EventRelayMiningDifficultyUpdated) XXX_DiscardUnknown() { - xxx_messageInfo_EventRelayMiningDifficultyUpdated.DiscardUnknown(m) -} - -var xxx_messageInfo_EventRelayMiningDifficultyUpdated proto.InternalMessageInfo - -func (m *EventRelayMiningDifficultyUpdated) GetServiceId() string { - if m != nil { - return m.ServiceId - } - return "" -} - -func (m *EventRelayMiningDifficultyUpdated) GetPrevTargetHashHexEncoded() string { - if m != nil { - return m.PrevTargetHashHexEncoded - } - return "" -} - -func (m *EventRelayMiningDifficultyUpdated) GetNewTargetHashHexEncoded() string { +func (m *EventClaimSettled) GetNumEstimatedComputeUnits() uint64 { if m != nil { - return m.NewTargetHashHexEncoded - } - return "" -} - -func (m *EventRelayMiningDifficultyUpdated) GetPrevNumRelaysEma() uint64 { - if m != nil { - return m.PrevNumRelaysEma + return m.NumEstimatedComputeUnits } return 0 } -func (m *EventRelayMiningDifficultyUpdated) GetNewNumRelaysEma() uint64 { +func (m *EventClaimSettled) GetClaimedAmountUpokt() *types1.Coin { if m != nil { - return m.NewNumRelaysEma + return m.ClaimedAmountUpokt } - return 0 + return nil } // EventApplicationOverserviced is emitted when an application has less stake than @@ -289,7 +255,7 @@ func (m *EventApplicationOverserviced) Reset() { *m = EventApplicationOv func (m *EventApplicationOverserviced) String() string { return proto.CompactTextString(m) } func (*EventApplicationOverserviced) ProtoMessage() {} func (*EventApplicationOverserviced) Descriptor() ([]byte, []int) { - return fileDescriptor_a78874bbf91a58c7, []int{3} + return fileDescriptor_a78874bbf91a58c7, []int{2} } func (m *EventApplicationOverserviced) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -357,7 +323,7 @@ func (m *EventSupplierSlashed) Reset() { *m = EventSupplierSlashed{} } func (m *EventSupplierSlashed) String() string { return proto.CompactTextString(m) } func (*EventSupplierSlashed) ProtoMessage() {} func (*EventSupplierSlashed) Descriptor() ([]byte, []int) { - return fileDescriptor_a78874bbf91a58c7, []int{4} + return fileDescriptor_a78874bbf91a58c7, []int{3} } func (m *EventSupplierSlashed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -407,7 +373,6 @@ func init() { proto.RegisterEnum("poktroll.tokenomics.ClaimExpirationReason", ClaimExpirationReason_name, ClaimExpirationReason_value) proto.RegisterType((*EventClaimExpired)(nil), "poktroll.tokenomics.EventClaimExpired") proto.RegisterType((*EventClaimSettled)(nil), "poktroll.tokenomics.EventClaimSettled") - proto.RegisterType((*EventRelayMiningDifficultyUpdated)(nil), "poktroll.tokenomics.EventRelayMiningDifficultyUpdated") proto.RegisterType((*EventApplicationOverserviced)(nil), "poktroll.tokenomics.EventApplicationOverserviced") proto.RegisterType((*EventSupplierSlashed)(nil), "poktroll.tokenomics.EventSupplierSlashed") } @@ -415,58 +380,54 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 812 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x95, 0xc1, 0x72, 0xdb, 0x44, - 0x18, 0xc7, 0x23, 0x37, 0x65, 0xc6, 0x5b, 0x92, 0xd8, 0xdb, 0x04, 0x4c, 0x68, 0x9d, 0x34, 0x07, - 0x26, 0x14, 0x22, 0x4d, 0x53, 0x86, 0x13, 0xd3, 0xc1, 0x4e, 0x54, 0xaa, 0x19, 0x6a, 0x07, 0xb9, - 0x61, 0x18, 0x2e, 0xcb, 0x5a, 0xfa, 0x6c, 0x2f, 0x91, 0x76, 0xc5, 0xee, 0xca, 0x71, 0x8e, 0xbc, - 0x01, 0x0f, 0xc0, 0x0b, 0x70, 0xe0, 0x15, 0x38, 0x73, 0xec, 0xb1, 0xa7, 0x0c, 0x93, 0xdc, 0xf2, - 0x14, 0xcc, 0xae, 0xe4, 0xd8, 0x24, 0xa1, 0x39, 0x70, 0xe0, 0x92, 0xac, 0xbf, 0xef, 0xff, 0xff, - 0x3e, 0xed, 0x6f, 0xac, 0xbf, 0xd1, 0x46, 0x26, 0x8e, 0xb4, 0x14, 0x49, 0xe2, 0x69, 0x71, 0x04, - 0x5c, 0xa4, 0x2c, 0x52, 0x1e, 0x8c, 0x81, 0x6b, 0x37, 0x93, 0x42, 0x0b, 0x7c, 0x7f, 0x2a, 0x70, - 0x67, 0x82, 0xf5, 0x66, 0x24, 0x54, 0x2a, 0x94, 0xd7, 0xa7, 0x0a, 0xbc, 0xf1, 0x93, 0x3e, 0x68, - 0xfa, 0xc4, 0x8b, 0x04, 0xe3, 0x85, 0x69, 0x7d, 0x75, 0x28, 0x86, 0xc2, 0x1e, 0x3d, 0x73, 0x2a, - 0xab, 0xeb, 0x97, 0xbb, 0x32, 0x29, 0xc4, 0xc0, 0xd3, 0x27, 0x19, 0xa8, 0xa2, 0xb7, 0xf5, 0x7b, - 0x05, 0xd5, 0x7d, 0xb3, 0x76, 0x2f, 0xa1, 0x2c, 0xf5, 0x27, 0x19, 0x93, 0x10, 0xe3, 0xcf, 0xd1, - 0xdd, 0xc8, 0x7c, 0x6e, 0x38, 0x9b, 0xce, 0xf6, 0xbd, 0xdd, 0x35, 0xf7, 0xf2, 0x61, 0xec, 0x04, - 0xd7, 0x8a, 0xdb, 0xd5, 0x8b, 0xd3, 0x8d, 0x42, 0x17, 0x16, 0xff, 0x30, 0x47, 0x75, 0x30, 0x23, - 0xa8, 0x66, 0x82, 0x13, 0x09, 0x54, 0x09, 0xde, 0xa8, 0x6c, 0x3a, 0xdb, 0xcb, 0xbb, 0x8f, 0xdd, - 0x1b, 0x2e, 0xe4, 0xce, 0xb6, 0x5a, 0x4b, 0x68, 0x1d, 0xed, 0xb5, 0x8b, 0xd3, 0x8d, 0xeb, 0x83, - 0xc2, 0x1a, 0x5c, 0x11, 0xe2, 0x1d, 0x84, 0x78, 0x9e, 0x12, 0x09, 0x09, 0x3d, 0x51, 0x8d, 0x3b, - 0x9b, 0xce, 0xf6, 0x62, 0x7b, 0xf9, 0xe2, 0x74, 0x63, 0xae, 0x1a, 0x56, 0x79, 0x9e, 0x86, 0xf6, - 0x88, 0x5b, 0xa8, 0x6e, 0x1a, 0x91, 0x48, 0xb3, 0x5c, 0x03, 0xc9, 0x39, 0xd3, 0xaa, 0xb1, 0x68, - 0x5d, 0x76, 0xe5, 0xb5, 0x66, 0xb8, 0xc2, 0xf3, 0x74, 0xaf, 0xa8, 0x1c, 0x9a, 0xc2, 0xd6, 0x6f, - 0xff, 0xe0, 0xd5, 0x03, 0xad, 0x93, 0xff, 0xc0, 0xeb, 0x47, 0x54, 0xb7, 0x02, 0x22, 0xe1, 0xa7, - 0x9c, 0x49, 0x48, 0x81, 0xeb, 0x92, 0xd7, 0x47, 0x57, 0x67, 0x1c, 0x98, 0xbf, 0xe1, 0x4c, 0x37, - 0xcf, 0xea, 0xda, 0x90, 0xb0, 0x96, 0x5d, 0x91, 0xff, 0x0f, 0xac, 0x7e, 0xad, 0xa0, 0x47, 0x96, - 0x95, 0x1d, 0xf9, 0x92, 0x71, 0xc6, 0x87, 0xfb, 0x6c, 0x30, 0x60, 0x51, 0x9e, 0xe8, 0x93, 0xc3, - 0x2c, 0xa6, 0x1a, 0x62, 0xfc, 0x10, 0x21, 0x05, 0x72, 0xcc, 0x22, 0x20, 0x2c, 0xb6, 0x00, 0xab, - 0x61, 0xb5, 0xac, 0x04, 0x31, 0x7e, 0x86, 0x1e, 0x64, 0x12, 0xc6, 0x44, 0x53, 0x39, 0x04, 0x4d, - 0x46, 0x54, 0x8d, 0xc8, 0x08, 0x26, 0x04, 0x78, 0x24, 0x62, 0x88, 0x2d, 0xad, 0x6a, 0xd8, 0x30, - 0x9a, 0x57, 0x56, 0xf2, 0x82, 0xaa, 0xd1, 0x0b, 0x98, 0xf8, 0x45, 0x1f, 0x7f, 0x81, 0x3e, 0xe4, - 0x70, 0xfc, 0xaf, 0xf6, 0x3b, 0xd6, 0xfe, 0x3e, 0x87, 0xe3, 0x1b, 0xdd, 0x3b, 0xe8, 0xbe, 0xdd, - 0x3e, 0x63, 0x44, 0x20, 0xa5, 0x05, 0x07, 0xc3, 0x18, 0xc6, 0x9d, 0x29, 0x31, 0x3f, 0xa5, 0xf8, - 0x13, 0x84, 0xcd, 0xb2, 0x2b, 0xea, 0xbb, 0x56, 0xbd, 0xc2, 0xe1, 0x78, 0x5e, 0xbc, 0xf5, 0x73, - 0x05, 0x3d, 0xb0, 0x78, 0x5a, 0x59, 0x96, 0xb0, 0xc8, 0x7e, 0xaf, 0xbb, 0x63, 0x90, 0xe5, 0xdd, - 0x63, 0xfc, 0x31, 0xaa, 0xd1, 0x59, 0x8b, 0xd0, 0x38, 0x96, 0x25, 0x9f, 0x95, 0xb9, 0x7a, 0x2b, - 0x8e, 0x25, 0xfe, 0x0c, 0xbd, 0xa7, 0x72, 0x53, 0x03, 0x49, 0x44, 0x06, 0x92, 0x6a, 0x21, 0x0b, - 0x43, 0xc1, 0x67, 0x75, 0xda, 0xed, 0x96, 0x4d, 0xeb, 0x7a, 0x86, 0x96, 0x60, 0x92, 0x41, 0xa4, - 0x21, 0x26, 0xfd, 0x5c, 0x72, 0x4b, 0xe3, 0xde, 0xee, 0x07, 0x6e, 0x11, 0x33, 0xae, 0x89, 0x19, - 0xb7, 0x8c, 0x19, 0x77, 0x4f, 0x30, 0x1e, 0xbe, 0x3b, 0xd5, 0xb7, 0x73, 0xc9, 0xf1, 0x97, 0x68, - 0x19, 0x06, 0x03, 0x88, 0x34, 0x1b, 0x43, 0x31, 0x60, 0xf1, 0xb6, 0x01, 0x4b, 0x97, 0x06, 0x33, - 0x61, 0xeb, 0x0f, 0x07, 0xad, 0x5a, 0x06, 0xbd, 0xf2, 0xf9, 0x7a, 0x09, 0x55, 0x23, 0x88, 0xdf, - 0x72, 0x21, 0xe7, 0x2d, 0x17, 0xfa, 0x14, 0x61, 0xc3, 0x1e, 0x8a, 0x18, 0x23, 0xf6, 0x25, 0x53, - 0x16, 0xc1, 0x62, 0x58, 0xe3, 0xf9, 0x34, 0xdf, 0xec, 0xeb, 0xa8, 0x70, 0x1b, 0xad, 0x28, 0xb3, - 0x8e, 0xf1, 0x21, 0xa1, 0xa9, 0xc8, 0xb9, 0xbe, 0x1d, 0xc0, 0xf2, 0xd4, 0xd1, 0xb2, 0x86, 0xc7, - 0x3f, 0xa0, 0xb5, 0x1b, 0x33, 0x0c, 0x3f, 0x42, 0x0f, 0xfd, 0xef, 0x0e, 0x82, 0xb0, 0xf5, 0x2a, - 0xe8, 0x76, 0x48, 0xe8, 0xb7, 0x7a, 0xdd, 0x0e, 0x39, 0xec, 0xf4, 0x0e, 0xfc, 0xbd, 0xe0, 0x79, - 0xe0, 0xef, 0xd7, 0x16, 0x70, 0x1d, 0x2d, 0x1d, 0x84, 0xdd, 0xee, 0x73, 0xf2, 0x32, 0xe8, 0xf5, - 0x82, 0xce, 0x57, 0x35, 0x67, 0x56, 0x0a, 0x3a, 0xdf, 0xb6, 0xbe, 0x0e, 0xf6, 0x6b, 0x95, 0xf6, - 0x37, 0x7f, 0x9e, 0x35, 0x9d, 0xd7, 0x67, 0x4d, 0xe7, 0xcd, 0x59, 0xd3, 0xf9, 0xeb, 0xac, 0xe9, - 0xfc, 0x72, 0xde, 0x5c, 0x78, 0x7d, 0xde, 0x5c, 0x78, 0x73, 0xde, 0x5c, 0xf8, 0xfe, 0xe9, 0x90, - 0xe9, 0x51, 0xde, 0x77, 0x23, 0x91, 0x7a, 0x26, 0x30, 0x76, 0x38, 0xe8, 0x63, 0x21, 0x8f, 0xbc, - 0xcb, 0xcc, 0x9f, 0xcc, 0xff, 0xc2, 0xd8, 0xe8, 0xef, 0xbf, 0x63, 0xb3, 0xff, 0xe9, 0xdf, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x43, 0x7d, 0x6b, 0xef, 0x85, 0x06, 0x00, 0x00, + // 744 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xcd, 0x53, 0xdb, 0x46, + 0x14, 0xb7, 0x5c, 0xc3, 0x0c, 0xdb, 0x62, 0x6c, 0xd5, 0x30, 0x86, 0x16, 0x89, 0x72, 0xe8, 0x50, + 0xa6, 0x48, 0x03, 0x74, 0x7a, 0xec, 0xd4, 0x36, 0xa6, 0xa3, 0x99, 0xc6, 0x76, 0xd6, 0x21, 0xc3, + 0xe4, 0x10, 0x45, 0x96, 0x1e, 0x46, 0xc1, 0xda, 0x55, 0x56, 0x2b, 0x07, 0x8e, 0x39, 0xe5, 0x90, + 0x4b, 0xfe, 0xa2, 0x9c, 0x73, 0xe4, 0xc8, 0xc9, 0x93, 0x31, 0x37, 0xff, 0x15, 0x99, 0x5d, 0xf9, + 0x8b, 0x8f, 0x98, 0x43, 0x72, 0xcc, 0xc5, 0x96, 0xdf, 0xef, 0x63, 0x77, 0xdf, 0xfb, 0x59, 0x8b, + 0xf4, 0x90, 0x9e, 0x71, 0x46, 0x3b, 0x1d, 0x93, 0xd3, 0x33, 0x20, 0x34, 0xf0, 0xdd, 0xc8, 0x84, + 0x2e, 0x10, 0x6e, 0x84, 0x8c, 0x72, 0xaa, 0xfe, 0x3c, 0x22, 0x18, 0x13, 0xc2, 0x9a, 0xe6, 0xd2, + 0x28, 0xa0, 0x91, 0xd9, 0x72, 0x22, 0x30, 0xbb, 0xbb, 0x2d, 0xe0, 0xce, 0xae, 0xe9, 0x52, 0x9f, + 0x24, 0xa2, 0xb5, 0x42, 0x9b, 0xb6, 0xa9, 0x7c, 0x34, 0xc5, 0xd3, 0xb0, 0xba, 0x36, 0x5e, 0x2b, + 0x64, 0x94, 0x9e, 0x98, 0xfc, 0x22, 0x84, 0x28, 0xc1, 0x36, 0xdf, 0x65, 0x50, 0xbe, 0x2a, 0x96, + 0xad, 0x74, 0x1c, 0x3f, 0xa8, 0x9e, 0x87, 0x3e, 0x03, 0x4f, 0xfd, 0x1b, 0xcd, 0xb9, 0xe2, 0x77, + 0x51, 0xd9, 0x50, 0xb6, 0x7e, 0xdc, 0x5b, 0x36, 0xc6, 0x9b, 0x91, 0x0e, 0x86, 0x24, 0x97, 0x17, + 0x06, 0x3d, 0x3d, 0xe1, 0xe1, 0xe4, 0x4b, 0x25, 0x28, 0x0f, 0xc2, 0xc2, 0xe1, 0x3e, 0x25, 0x36, + 0x03, 0x27, 0xa2, 0xa4, 0x98, 0xde, 0x50, 0xb6, 0xb2, 0x7b, 0xdb, 0xc6, 0x3d, 0x07, 0x32, 0x26, + 0xab, 0x4a, 0x09, 0x96, 0x8a, 0xf2, 0xf2, 0xa0, 0xa7, 0xdf, 0x35, 0xc2, 0x39, 0xb8, 0x45, 0x54, + 0x77, 0x10, 0x22, 0x71, 0x60, 0x33, 0xe8, 0x38, 0x17, 0x51, 0xf1, 0x87, 0x0d, 0x65, 0x2b, 0x53, + 0xce, 0x0e, 0x7a, 0xfa, 0x54, 0x15, 0x2f, 0x90, 0x38, 0xc0, 0xf2, 0x51, 0x3d, 0x46, 0xab, 0x02, + 0x90, 0x7b, 0x05, 0xcf, 0x76, 0x69, 0x10, 0xc6, 0x1c, 0xec, 0x98, 0xf8, 0x3c, 0x2a, 0x66, 0xa4, + 0x7a, 0x7d, 0xd0, 0xd3, 0xbf, 0x4c, 0xc2, 0x2b, 0x24, 0x0e, 0x2a, 0x09, 0x52, 0x49, 0x80, 0x23, + 0x51, 0x57, 0x9f, 0xa3, 0x5f, 0x84, 0x08, 0x22, 0xee, 0x07, 0x0e, 0xbf, 0xe3, 0x3d, 0x27, 0xbd, + 0xf5, 0x41, 0x4f, 0x9f, 0x45, 0xc3, 0x45, 0x12, 0x07, 0xd5, 0x11, 0x76, 0xc3, 0x1f, 0x50, 0x61, + 0xb4, 0x21, 0x27, 0xa0, 0x31, 0xe1, 0x76, 0x2c, 0xda, 0x59, 0x9c, 0x97, 0xf3, 0x59, 0x35, 0x92, + 0x5c, 0x18, 0x22, 0x17, 0xc6, 0x30, 0x17, 0x46, 0x85, 0xfa, 0xa4, 0x5c, 0x1c, 0xf4, 0xf4, 0x7b, + 0xa5, 0x58, 0x1d, 0x56, 0x4b, 0xb2, 0x78, 0x24, 0x6a, 0x9b, 0x6f, 0x6f, 0xa4, 0xa1, 0x09, 0x9c, + 0x77, 0xbe, 0x22, 0x0d, 0x2f, 0x51, 0x5e, 0x12, 0x6c, 0x06, 0xaf, 0x62, 0x9f, 0x41, 0x00, 0x84, + 0x0f, 0xd3, 0xf0, 0xfb, 0x6d, 0x8f, 0x86, 0xf8, 0xc4, 0x13, 0xde, 0x74, 0x12, 0xee, 0x98, 0xe0, + 0x5c, 0x78, 0x8b, 0xfe, 0x3d, 0x09, 0xdf, 0x38, 0x09, 0x6f, 0xd2, 0xe8, 0x57, 0x99, 0x84, 0x52, + 0x18, 0x76, 0x7c, 0x57, 0xfe, 0xe9, 0xea, 0x5d, 0x60, 0x11, 0xb0, 0xae, 0xef, 0x82, 0xa7, 0xfe, + 0x81, 0x72, 0xce, 0x04, 0xb2, 0x1d, 0xcf, 0x63, 0x32, 0x1f, 0x0b, 0x78, 0x69, 0xaa, 0x5e, 0xf2, + 0x3c, 0xa6, 0xfe, 0x85, 0x56, 0xa2, 0x58, 0xd4, 0x80, 0xd9, 0x34, 0x04, 0xe6, 0x70, 0xca, 0x12, + 0x41, 0x5a, 0x0a, 0x0a, 0x23, 0xb4, 0x3e, 0x04, 0xa5, 0xea, 0x1f, 0xb4, 0x08, 0xe7, 0x21, 0xb8, + 0xa2, 0x39, 0xad, 0x98, 0x11, 0x39, 0xd4, 0x59, 0x27, 0xc4, 0x3f, 0x8d, 0xf8, 0xe5, 0x98, 0x11, + 0xf5, 0x5f, 0x94, 0x85, 0x93, 0x13, 0x70, 0xb9, 0xdf, 0x85, 0xc4, 0x20, 0xf3, 0x90, 0xc1, 0xe2, + 0x58, 0x20, 0x1c, 0x36, 0x3f, 0x28, 0xa8, 0x20, 0x7b, 0xd0, 0x1c, 0xee, 0xaf, 0xd9, 0x71, 0xa2, + 0x53, 0xf0, 0x66, 0x1c, 0x48, 0x99, 0x71, 0xa0, 0x3f, 0x91, 0x2a, 0x47, 0x9e, 0xbc, 0x63, 0x93, + 0x58, 0x45, 0xb2, 0x05, 0x19, 0x9c, 0x13, 0xf3, 0x4e, 0x00, 0x19, 0xaa, 0x48, 0x2d, 0xa3, 0xa5, + 0x48, 0x2c, 0xe7, 0x93, 0xf6, 0x70, 0x5a, 0x0f, 0x37, 0x20, 0x3b, 0x52, 0x24, 0x93, 0xdc, 0x7e, + 0x81, 0x96, 0xef, 0x7d, 0xc1, 0xaa, 0xbf, 0xa1, 0xf5, 0xea, 0x71, 0xc3, 0xc2, 0xa5, 0x27, 0x56, + 0xbd, 0x66, 0xe3, 0x6a, 0xa9, 0x59, 0xaf, 0xd9, 0x47, 0xb5, 0x66, 0xa3, 0x5a, 0xb1, 0x0e, 0xad, + 0xea, 0x41, 0x2e, 0xa5, 0xe6, 0xd1, 0x62, 0x03, 0xd7, 0xeb, 0x87, 0xf6, 0x23, 0xab, 0xd9, 0xb4, + 0x6a, 0xff, 0xe5, 0x94, 0x49, 0xc9, 0xaa, 0x3d, 0x2d, 0xfd, 0x6f, 0x1d, 0xe4, 0xd2, 0xe5, 0xc7, + 0x1f, 0xfb, 0x9a, 0x72, 0xd9, 0xd7, 0x94, 0xab, 0xbe, 0xa6, 0x7c, 0xea, 0x6b, 0xca, 0xfb, 0x6b, + 0x2d, 0x75, 0x79, 0xad, 0xa5, 0xae, 0xae, 0xb5, 0xd4, 0xb3, 0xfd, 0xb6, 0xcf, 0x4f, 0xe3, 0x96, + 0xe1, 0xd2, 0xc0, 0x14, 0xa9, 0xda, 0x21, 0xc0, 0x5f, 0x53, 0x76, 0x66, 0x8e, 0x2f, 0xa4, 0xf3, + 0xe9, 0xeb, 0x4f, 0xde, 0x4b, 0xad, 0x79, 0x79, 0x31, 0xed, 0x7f, 0x0e, 0x00, 0x00, 0xff, 0xff, + 0x3e, 0x16, 0x9d, 0x3a, 0x22, 0x07, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -489,8 +450,25 @@ func (m *EventClaimExpired) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.NumComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + if m.ClaimedAmountUpokt != nil { + { + size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.NumEstimatedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if m.NumClaimedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } @@ -539,8 +517,25 @@ func (m *EventClaimSettled) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.NumComputeUnits != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.NumComputeUnits)) + if m.ClaimedAmountUpokt != nil { + { + size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.NumEstimatedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumEstimatedComputeUnits)) + i-- + dAtA[i] = 0x28 + } + if m.NumClaimedComputeUnits != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.NumClaimedComputeUnits)) i-- dAtA[i] = 0x20 } @@ -569,60 +564,6 @@ func (m *EventClaimSettled) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventRelayMiningDifficultyUpdated) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventRelayMiningDifficultyUpdated) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventRelayMiningDifficultyUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NewNumRelaysEma != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.NewNumRelaysEma)) - i-- - dAtA[i] = 0x28 - } - if m.PrevNumRelaysEma != 0 { - i = encodeVarintEvent(dAtA, i, uint64(m.PrevNumRelaysEma)) - i-- - dAtA[i] = 0x20 - } - if len(m.NewTargetHashHexEncoded) > 0 { - i -= len(m.NewTargetHashHexEncoded) - copy(dAtA[i:], m.NewTargetHashHexEncoded) - i = encodeVarintEvent(dAtA, i, uint64(len(m.NewTargetHashHexEncoded))) - i-- - dAtA[i] = 0x1a - } - if len(m.PrevTargetHashHexEncoded) > 0 { - i -= len(m.PrevTargetHashHexEncoded) - copy(dAtA[i:], m.PrevTargetHashHexEncoded) - i = encodeVarintEvent(dAtA, i, uint64(len(m.PrevTargetHashHexEncoded))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceId) > 0 { - i -= len(m.ServiceId) - copy(dAtA[i:], m.ServiceId) - i = encodeVarintEvent(dAtA, i, uint64(len(m.ServiceId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *EventApplicationOverserviced) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -758,8 +699,15 @@ func (m *EventClaimExpired) Size() (n int) { if m.NumRelays != 0 { n += 1 + sovEvent(uint64(m.NumRelays)) } - if m.NumComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.NumComputeUnits)) + if m.NumClaimedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumClaimedComputeUnits)) + } + if m.NumEstimatedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) + } + if m.ClaimedAmountUpokt != nil { + l = m.ClaimedAmountUpokt.Size() + n += 1 + l + sovEvent(uint64(l)) } return n } @@ -780,36 +728,16 @@ func (m *EventClaimSettled) Size() (n int) { if m.NumRelays != 0 { n += 1 + sovEvent(uint64(m.NumRelays)) } - if m.NumComputeUnits != 0 { - n += 1 + sovEvent(uint64(m.NumComputeUnits)) + if m.NumClaimedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumClaimedComputeUnits)) } - return n -} - -func (m *EventRelayMiningDifficultyUpdated) Size() (n int) { - if m == nil { - return 0 + if m.NumEstimatedComputeUnits != 0 { + n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) } - var l int - _ = l - l = len(m.ServiceId) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - l = len(m.PrevTargetHashHexEncoded) - if l > 0 { + if m.ClaimedAmountUpokt != nil { + l = m.ClaimedAmountUpokt.Size() n += 1 + l + sovEvent(uint64(l)) } - l = len(m.NewTargetHashHexEncoded) - if l > 0 { - n += 1 + l + sovEvent(uint64(l)) - } - if m.PrevNumRelaysEma != 0 { - n += 1 + sovEvent(uint64(m.PrevNumRelaysEma)) - } - if m.NewNumRelaysEma != 0 { - n += 1 + sovEvent(uint64(m.NewNumRelaysEma)) - } return n } @@ -969,9 +897,47 @@ func (m *EventClaimExpired) Unmarshal(dAtA []byte) error { } case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) + } + m.NumClaimedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumClaimedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) + } + m.NumEstimatedComputeUnits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) } - m.NumComputeUnits = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -981,11 +947,28 @@ func (m *EventClaimExpired) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NumComputeUnits |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ClaimedAmountUpokt == nil { + m.ClaimedAmountUpokt = &types1.Coin{} + } + if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) @@ -1112,9 +1095,9 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { } case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumComputeUnits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NumClaimedComputeUnits", wireType) } - m.NumComputeUnits = 0 + m.NumClaimedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -1124,66 +1107,16 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NumComputeUnits |= uint64(b&0x7F) << shift + m.NumClaimedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } - default: - iNdEx = preIndex - skippy, err := skipEvent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventRelayMiningDifficultyUpdated) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventRelayMiningDifficultyUpdated: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumEstimatedComputeUnits", wireType) } - var stringLen uint64 + m.NumEstimatedComputeUnits = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -1193,29 +1126,16 @@ func (m *EventRelayMiningDifficultyUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.NumEstimatedComputeUnits |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevTargetHashHexEncoded", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvent @@ -1225,94 +1145,28 @@ func (m *EventRelayMiningDifficultyUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthEvent } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthEvent } if postIndex > l { return io.ErrUnexpectedEOF } - m.PrevTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewTargetHashHexEncoded", wireType) + if m.ClaimedAmountUpokt == nil { + m.ClaimedAmountUpokt = &types1.Coin{} } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.NewTargetHashHexEncoded = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevNumRelaysEma", wireType) - } - m.PrevNumRelaysEma = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PrevNumRelaysEma |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NewNumRelaysEma", wireType) - } - m.NewNumRelaysEma = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NewNumRelaysEma |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go index 6cb4318d9..084436e0e 100644 --- a/x/tokenomics/types/expected_keepers.go +++ b/x/tokenomics/types/expected_keepers.go @@ -11,6 +11,7 @@ import ( apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -84,6 +85,8 @@ type SupplierKeeper interface { type ServiceKeeper interface { GetService(ctx context.Context, serviceID string) (sharedtypes.Service, bool) + GetRelayMiningDifficulty(ctx context.Context, serviceID string) (servicetypes.RelayMiningDifficulty, bool) + UpdateRelayMiningDifficulty(ctx context.Context, relaysPerServiceMap map[string]uint64) (map[string]servicetypes.RelayMiningDifficulty, error) // Only used for testing & simulation SetService(ctx context.Context, service sharedtypes.Service) } diff --git a/x/tokenomics/types/genesis.go b/x/tokenomics/types/genesis.go index 2d38fc760..099ccffee 100644 --- a/x/tokenomics/types/genesis.go +++ b/x/tokenomics/types/genesis.go @@ -3,7 +3,6 @@ package types // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - RelayMiningDifficultyList: []RelayMiningDifficulty{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -12,16 +11,6 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - // Check for duplicated index in relayMiningDifficulty - relayMiningDifficultyIndexMap := make(map[string]struct{}) - - for _, elem := range gs.RelayMiningDifficultyList { - index := string(RelayMiningDifficultyKey(elem.ServiceId)) - if _, ok := relayMiningDifficultyIndexMap[index]; ok { - return ErrTokenomicsDuplicateIndex.Wrapf("duplicated index for relayMiningDifficulty: %s", index) - } - relayMiningDifficultyIndexMap[index] = struct{}{} - } // this line is used by starport scaffolding # genesis/types/validate return gs.Params.ValidateBasic() diff --git a/x/tokenomics/types/genesis.pb.go b/x/tokenomics/types/genesis.pb.go index 72f5188ed..b5fd44dff 100644 --- a/x/tokenomics/types/genesis.pb.go +++ b/x/tokenomics/types/genesis.pb.go @@ -27,8 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the tokenomics module's genesis state. type GenesisState struct { // params defines all the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - RelayMiningDifficultyList []RelayMiningDifficulty `protobuf:"bytes,2,rep,name=relayMiningDifficultyList,proto3" json:"relayMiningDifficultyList"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -67,13 +66,6 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetRelayMiningDifficultyList() []RelayMiningDifficulty { - if m != nil { - return m.RelayMiningDifficultyList - } - return nil -} - func init() { proto.RegisterType((*GenesisState)(nil), "poktroll.tokenomics.GenesisState") } @@ -81,26 +73,21 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/genesis.proto", fileDescriptor_a4de321d172b0811) } var fileDescriptor_a4de321d172b0811 = []byte{ - // 289 bytes of a gzipped FileDescriptorProto + // 220 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0xcb, 0xcf, 0xcd, 0x4c, 0x2e, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x29, 0xd1, 0x43, 0x28, 0x91, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x75, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x15, 0x55, 0xc0, 0x66, 0x41, - 0x41, 0x62, 0x51, 0x62, 0x2e, 0xd4, 0x7c, 0x29, 0x43, 0x6c, 0x2a, 0x8a, 0x52, 0x73, 0x12, 0x2b, - 0xe3, 0x73, 0x33, 0xf3, 0x32, 0xf3, 0xd2, 0xe3, 0x53, 0x32, 0xd3, 0xd2, 0x32, 0x93, 0x4b, 0x73, - 0x4a, 0x2a, 0x21, 0x5a, 0x94, 0xf6, 0x31, 0x72, 0xf1, 0xb8, 0x43, 0x1c, 0x19, 0x5c, 0x92, 0x58, - 0x92, 0x2a, 0x64, 0xc7, 0xc5, 0x06, 0x31, 0x53, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x5a, - 0x0f, 0x8b, 0xa3, 0xf5, 0x02, 0xc0, 0x4a, 0x9c, 0x38, 0x4f, 0xdc, 0x93, 0x67, 0x58, 0xf1, 0x7c, - 0x83, 0x16, 0x63, 0x10, 0x54, 0x97, 0x50, 0x1e, 0x97, 0x24, 0xd8, 0x46, 0x5f, 0xb0, 0x85, 0x2e, - 0x70, 0xfb, 0x7c, 0x32, 0x8b, 0x4b, 0x24, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0xb4, 0xb0, 0x1a, - 0x19, 0x84, 0x4d, 0x97, 0x13, 0x0b, 0xc8, 0x86, 0x20, 0xdc, 0x46, 0x3a, 0x05, 0x9e, 0x78, 0x24, - 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x8d, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, - 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xc6, 0xe9, 0x99, 0x25, - 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x4b, 0x75, 0xf3, 0x52, 0x4b, 0xca, 0xf3, - 0x8b, 0xb2, 0xf5, 0xe1, 0x21, 0x55, 0x81, 0x1c, 0x56, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, - 0xe0, 0xa0, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xfa, 0xac, 0xa4, 0x6f, 0xd2, 0x01, 0x00, - 0x00, + 0x41, 0x62, 0x51, 0x62, 0x2e, 0xd4, 0x7c, 0x25, 0x3f, 0x2e, 0x1e, 0x77, 0x88, 0x85, 0xc1, 0x25, + 0x89, 0x25, 0xa9, 0x42, 0x76, 0x5c, 0x6c, 0x10, 0x79, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, + 0x69, 0x3d, 0x2c, 0x0e, 0xd0, 0x0b, 0x00, 0x2b, 0x71, 0xe2, 0x3c, 0x71, 0x4f, 0x9e, 0x61, 0xc5, + 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x50, 0x5d, 0x4e, 0x81, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, + 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x71, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x5c, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0xb8, + 0x3b, 0x2b, 0x90, 0x5d, 0x5a, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0xa9, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0x26, 0x41, 0xdb, 0xc7, 0x2e, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -123,20 +110,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.RelayMiningDifficultyList) > 0 { - for iNdEx := len(m.RelayMiningDifficultyList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RelayMiningDifficultyList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -169,12 +142,6 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.RelayMiningDifficultyList) > 0 { - for _, e := range m.RelayMiningDifficultyList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -246,40 +213,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficultyList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RelayMiningDifficultyList = append(m.RelayMiningDifficultyList, RelayMiningDifficulty{}) - if err := m.RelayMiningDifficultyList[len(m.RelayMiningDifficultyList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/tokenomics/types/genesis_test.go b/x/tokenomics/types/genesis_test.go index 737132e3c..0e84dc6be 100644 --- a/x/tokenomics/types/genesis_test.go +++ b/x/tokenomics/types/genesis_test.go @@ -23,32 +23,10 @@ func TestGenesisState_Validate(t *testing.T) { desc: "valid genesis state", genState: &types.GenesisState{ Params: types.Params{}, - RelayMiningDifficultyList: []types.RelayMiningDifficulty{ - { - ServiceId: "0", - }, - { - ServiceId: "1", - }, - }, // this line is used by starport scaffolding # types/genesis/validField }, isValid: true, }, - { - desc: "duplicated relayMiningDifficulty", - genState: &types.GenesisState{ - RelayMiningDifficultyList: []types.RelayMiningDifficulty{ - { - ServiceId: "0", - }, - { - ServiceId: "0", - }, - }, - }, - isValid: false, - }, // this line is used by starport scaffolding # types/genesis/testcase } for _, test := range tests { diff --git a/x/tokenomics/types/query.pb.go b/x/tokenomics/types/query.pb.go index 70675f20f..51dc467a8 100644 --- a/x/tokenomics/types/query.pb.go +++ b/x/tokenomics/types/query.pb.go @@ -7,8 +7,6 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types" - query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -108,223 +106,35 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -type QueryGetRelayMiningDifficultyRequest struct { - ServiceId string `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"` -} - -func (m *QueryGetRelayMiningDifficultyRequest) Reset() { *m = QueryGetRelayMiningDifficultyRequest{} } -func (m *QueryGetRelayMiningDifficultyRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetRelayMiningDifficultyRequest) ProtoMessage() {} -func (*QueryGetRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_19d6daded0c54373, []int{2} -} -func (m *QueryGetRelayMiningDifficultyRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetRelayMiningDifficultyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *QueryGetRelayMiningDifficultyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetRelayMiningDifficultyRequest.Merge(m, src) -} -func (m *QueryGetRelayMiningDifficultyRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetRelayMiningDifficultyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetRelayMiningDifficultyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetRelayMiningDifficultyRequest proto.InternalMessageInfo - -func (m *QueryGetRelayMiningDifficultyRequest) GetServiceId() string { - if m != nil { - return m.ServiceId - } - return "" -} - -type QueryGetRelayMiningDifficultyResponse struct { - RelayMiningDifficulty RelayMiningDifficulty `protobuf:"bytes,1,opt,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty"` -} - -func (m *QueryGetRelayMiningDifficultyResponse) Reset() { *m = QueryGetRelayMiningDifficultyResponse{} } -func (m *QueryGetRelayMiningDifficultyResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetRelayMiningDifficultyResponse) ProtoMessage() {} -func (*QueryGetRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_19d6daded0c54373, []int{3} -} -func (m *QueryGetRelayMiningDifficultyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetRelayMiningDifficultyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *QueryGetRelayMiningDifficultyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetRelayMiningDifficultyResponse.Merge(m, src) -} -func (m *QueryGetRelayMiningDifficultyResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetRelayMiningDifficultyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetRelayMiningDifficultyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetRelayMiningDifficultyResponse proto.InternalMessageInfo - -func (m *QueryGetRelayMiningDifficultyResponse) GetRelayMiningDifficulty() RelayMiningDifficulty { - if m != nil { - return m.RelayMiningDifficulty - } - return RelayMiningDifficulty{} -} - -type QueryAllRelayMiningDifficultyRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllRelayMiningDifficultyRequest) Reset() { *m = QueryAllRelayMiningDifficultyRequest{} } -func (m *QueryAllRelayMiningDifficultyRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllRelayMiningDifficultyRequest) ProtoMessage() {} -func (*QueryAllRelayMiningDifficultyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_19d6daded0c54373, []int{4} -} -func (m *QueryAllRelayMiningDifficultyRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllRelayMiningDifficultyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *QueryAllRelayMiningDifficultyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllRelayMiningDifficultyRequest.Merge(m, src) -} -func (m *QueryAllRelayMiningDifficultyRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllRelayMiningDifficultyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllRelayMiningDifficultyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllRelayMiningDifficultyRequest proto.InternalMessageInfo - -func (m *QueryAllRelayMiningDifficultyRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -type QueryAllRelayMiningDifficultyResponse struct { - RelayMiningDifficulty []RelayMiningDifficulty `protobuf:"bytes,1,rep,name=relayMiningDifficulty,proto3" json:"relayMiningDifficulty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllRelayMiningDifficultyResponse) Reset() { *m = QueryAllRelayMiningDifficultyResponse{} } -func (m *QueryAllRelayMiningDifficultyResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllRelayMiningDifficultyResponse) ProtoMessage() {} -func (*QueryAllRelayMiningDifficultyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_19d6daded0c54373, []int{5} -} -func (m *QueryAllRelayMiningDifficultyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllRelayMiningDifficultyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil -} -func (m *QueryAllRelayMiningDifficultyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllRelayMiningDifficultyResponse.Merge(m, src) -} -func (m *QueryAllRelayMiningDifficultyResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllRelayMiningDifficultyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllRelayMiningDifficultyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllRelayMiningDifficultyResponse proto.InternalMessageInfo - -func (m *QueryAllRelayMiningDifficultyResponse) GetRelayMiningDifficulty() []RelayMiningDifficulty { - if m != nil { - return m.RelayMiningDifficulty - } - return nil -} - -func (m *QueryAllRelayMiningDifficultyResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - func init() { proto.RegisterType((*QueryParamsRequest)(nil), "poktroll.tokenomics.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "poktroll.tokenomics.QueryParamsResponse") - proto.RegisterType((*QueryGetRelayMiningDifficultyRequest)(nil), "poktroll.tokenomics.QueryGetRelayMiningDifficultyRequest") - proto.RegisterType((*QueryGetRelayMiningDifficultyResponse)(nil), "poktroll.tokenomics.QueryGetRelayMiningDifficultyResponse") - proto.RegisterType((*QueryAllRelayMiningDifficultyRequest)(nil), "poktroll.tokenomics.QueryAllRelayMiningDifficultyRequest") - proto.RegisterType((*QueryAllRelayMiningDifficultyResponse)(nil), "poktroll.tokenomics.QueryAllRelayMiningDifficultyResponse") } func init() { proto.RegisterFile("poktroll/tokenomics/query.proto", fileDescriptor_19d6daded0c54373) } var fileDescriptor_19d6daded0c54373 = []byte{ - // 575 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xc7, 0x33, 0xb5, 0x06, 0x32, 0x9e, 0x9c, 0xb6, 0x50, 0x63, 0xd9, 0x96, 0x45, 0x6d, 0x08, - 0xb8, 0x63, 0xda, 0x53, 0x15, 0x84, 0x84, 0x6a, 0xf0, 0x50, 0x68, 0x17, 0xbc, 0x78, 0x09, 0x93, - 0xed, 0x64, 0x1d, 0xb2, 0x3b, 0xb3, 0xdd, 0x9d, 0x54, 0x83, 0x78, 0xf1, 0x2e, 0x0a, 0x7e, 0x09, - 0x8f, 0x7e, 0x8c, 0x9e, 0xa4, 0xa0, 0x87, 0x5c, 0x14, 0x49, 0x04, 0xbf, 0x86, 0xec, 0xcc, 0xa4, - 0x49, 0x71, 0x37, 0x0b, 0xc5, 0xcb, 0xb2, 0x3b, 0xf3, 0xde, 0xfb, 0xff, 0x7f, 0x6f, 0xde, 0x0e, - 0xdc, 0x8c, 0x44, 0x5f, 0xc6, 0x22, 0x08, 0xb0, 0x14, 0x7d, 0xca, 0x45, 0xc8, 0xbc, 0x04, 0x9f, - 0x0c, 0x68, 0x3c, 0x74, 0xa2, 0x58, 0x48, 0x81, 0x56, 0xa6, 0x01, 0xce, 0x2c, 0xa0, 0x7a, 0x93, - 0x84, 0x8c, 0x0b, 0xac, 0x9e, 0x3a, 0xae, 0xba, 0xea, 0x0b, 0x5f, 0xa8, 0x57, 0x9c, 0xbe, 0x99, - 0xd5, 0x0d, 0x5f, 0x08, 0x3f, 0xa0, 0x98, 0x44, 0x0c, 0x13, 0xce, 0x85, 0x24, 0x92, 0x09, 0x9e, - 0x98, 0xdd, 0x5b, 0x9e, 0x48, 0x42, 0x91, 0x74, 0x74, 0x9a, 0xfe, 0x30, 0x5b, 0x75, 0xfd, 0x85, - 0xbb, 0x24, 0xa1, 0xda, 0x0f, 0x3e, 0x6d, 0x74, 0xa9, 0x24, 0x0d, 0x1c, 0x11, 0x9f, 0x71, 0x55, - 0xc7, 0xc4, 0x5a, 0xf3, 0xb1, 0xd3, 0x28, 0x4f, 0xb0, 0xe9, 0xfe, 0x56, 0x16, 0x63, 0x44, 0x62, - 0x12, 0x4e, 0xd5, 0x1a, 0x59, 0x11, 0x31, 0x0d, 0xc8, 0xb0, 0x13, 0x32, 0xce, 0xb8, 0xdf, 0x39, - 0x66, 0xbd, 0x1e, 0xf3, 0x06, 0x81, 0x34, 0x7d, 0xb1, 0x57, 0x21, 0x3a, 0x4a, 0x6d, 0x1d, 0xaa, - 0x3a, 0x2e, 0x3d, 0x19, 0xd0, 0x44, 0xda, 0xcf, 0xe1, 0xca, 0xa5, 0xd5, 0x24, 0x12, 0x3c, 0xa1, - 0xe8, 0x31, 0x2c, 0x6b, 0xbd, 0x75, 0xb0, 0x05, 0x6a, 0x37, 0x76, 0x6e, 0x3b, 0x19, 0x5d, 0x75, - 0x74, 0x52, 0xab, 0x72, 0xf6, 0x73, 0xb3, 0xf4, 0xf9, 0xcf, 0x97, 0x3a, 0x70, 0x4d, 0x96, 0xbd, - 0x0f, 0xef, 0xa8, 0xb2, 0x6d, 0x2a, 0xdd, 0xd4, 0xd5, 0x81, 0x32, 0xb5, 0x7f, 0xe1, 0xc9, 0xc8, - 0xa3, 0x0d, 0x58, 0x49, 0x68, 0x7c, 0xca, 0x3c, 0xfa, 0xec, 0x58, 0x49, 0x55, 0xdc, 0xd9, 0x82, - 0xfd, 0x01, 0xc0, 0xbb, 0x05, 0x65, 0x8c, 0xdf, 0x1e, 0x5c, 0x8b, 0xb3, 0x02, 0x8c, 0xfd, 0x7a, - 0xa6, 0xfd, 0xcc, 0x92, 0xad, 0xe5, 0x94, 0xc6, 0xcd, 0x2e, 0x67, 0x73, 0xc3, 0xd5, 0x0c, 0x82, - 0x85, 0x5c, 0x4f, 0x21, 0x9c, 0x9d, 0xba, 0x31, 0x71, 0xcf, 0x31, 0x03, 0x93, 0x1e, 0xbb, 0xa3, - 0x47, 0xd6, 0x1c, 0xbe, 0x73, 0x48, 0x7c, 0x6a, 0x72, 0xdd, 0xb9, 0x4c, 0x7b, 0x34, 0xed, 0x40, - 0xbe, 0x60, 0x71, 0x07, 0xae, 0xfd, 0xc7, 0x0e, 0xa0, 0xf6, 0x25, 0xb2, 0x25, 0x45, 0xb6, 0x5d, - 0x48, 0xa6, 0x4d, 0xce, 0xa3, 0xed, 0x7c, 0x5d, 0x86, 0xd7, 0x15, 0x1a, 0x7a, 0x0f, 0x60, 0x59, - 0x8f, 0x12, 0xda, 0xce, 0xb4, 0xf9, 0xef, 0xdc, 0x56, 0x6b, 0xc5, 0x81, 0x5a, 0xd3, 0x7e, 0xf0, - 0xee, 0xdb, 0xef, 0x4f, 0x4b, 0x75, 0x54, 0xc3, 0x69, 0xc6, 0x7d, 0x4e, 0xe5, 0x2b, 0x11, 0xf7, - 0x71, 0xfe, 0x2f, 0x86, 0x7e, 0x00, 0xb8, 0x96, 0xd9, 0x19, 0xb4, 0x97, 0xaf, 0x5a, 0x30, 0xe9, - 0xd5, 0x87, 0x57, 0x49, 0x35, 0x08, 0x07, 0x0a, 0xa1, 0x8d, 0x9e, 0x14, 0x23, 0xe4, 0xdc, 0x01, - 0xf8, 0xcd, 0xc5, 0x5f, 0xf5, 0x16, 0x7d, 0x07, 0x70, 0x3d, 0x53, 0xb0, 0x19, 0x04, 0x8b, 0x10, - 0x0b, 0x86, 0x7e, 0x11, 0x62, 0xd1, 0xf8, 0xda, 0x4d, 0x85, 0xf8, 0x08, 0xed, 0x5d, 0x19, 0xb1, - 0x75, 0x74, 0x36, 0xb6, 0xc0, 0xf9, 0xd8, 0x02, 0xa3, 0xb1, 0x05, 0x7e, 0x8d, 0x2d, 0xf0, 0x71, - 0x62, 0x95, 0xce, 0x27, 0x56, 0x69, 0x34, 0xb1, 0x4a, 0x2f, 0x76, 0x7d, 0x26, 0x5f, 0x0e, 0xba, - 0x8e, 0x27, 0xc2, 0x1c, 0x89, 0xd7, 0xf3, 0x22, 0x72, 0x18, 0xd1, 0xa4, 0x5b, 0x56, 0x57, 0xe7, - 0xee, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4a, 0x5a, 0x86, 0x05, 0x75, 0x06, 0x00, 0x00, + // 314 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0xc8, 0xcf, 0x2e, + 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0xcb, 0xcf, 0xcd, 0x4c, 0x2e, 0xd6, + 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x29, 0xd0, + 0x43, 0x28, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x75, 0x52, 0x22, + 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x15, 0x95, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, + 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, + 0x2b, 0x86, 0xca, 0x4a, 0x26, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xc7, 0x43, 0xb4, 0x41, 0x38, 0x50, + 0x29, 0x05, 0x6c, 0xee, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0xaa, 0x50, 0x12, 0xe1, 0x12, 0x0a, + 0x04, 0xb9, 0x33, 0x00, 0x2c, 0x18, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0xa2, 0x14, 0xca, 0x25, + 0x8c, 0x22, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x64, 0xc7, 0xc5, 0x06, 0xd1, 0x2c, 0xc1, + 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xad, 0x87, 0xc5, 0x5b, 0x7a, 0x10, 0x4d, 0x4e, 0x9c, 0x27, + 0xee, 0xc9, 0x33, 0xac, 0x78, 0xbe, 0x41, 0x8b, 0x31, 0x08, 0xaa, 0xcb, 0x68, 0x3a, 0x23, 0x17, + 0x2b, 0xd8, 0x5c, 0xa1, 0x5e, 0x46, 0x2e, 0x36, 0x88, 0x3a, 0x21, 0x75, 0xac, 0x86, 0x60, 0x3a, + 0x4a, 0x4a, 0x83, 0xb0, 0x42, 0x88, 0x3b, 0x95, 0x0c, 0x9a, 0x2e, 0x3f, 0x99, 0xcc, 0xa4, 0x25, + 0xa4, 0xa1, 0x0f, 0xd2, 0xa1, 0x9b, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x8f, 0x3b, 0x30, + 0x9c, 0x02, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, + 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, + 0x28, 0xe3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x1c, 0x26, 0x56, 0x20, + 0x9b, 0x59, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x60, 0x63, 0x40, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x9f, 0xe5, 0xec, 0x63, 0x1c, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -341,9 +151,6 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a list of RelayMiningDifficulty items. - RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) - RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) } type queryClient struct { @@ -363,31 +170,10 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) RelayMiningDifficulty(ctx context.Context, in *QueryGetRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryGetRelayMiningDifficultyResponse, error) { - out := new(QueryGetRelayMiningDifficultyResponse) - err := c.cc.Invoke(ctx, "/poktroll.tokenomics.Query/RelayMiningDifficulty", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) RelayMiningDifficultyAll(ctx context.Context, in *QueryAllRelayMiningDifficultyRequest, opts ...grpc.CallOption) (*QueryAllRelayMiningDifficultyResponse, error) { - out := new(QueryAllRelayMiningDifficultyResponse) - err := c.cc.Invoke(ctx, "/poktroll.tokenomics.Query/RelayMiningDifficultyAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a list of RelayMiningDifficulty items. - RelayMiningDifficulty(context.Context, *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) - RelayMiningDifficultyAll(context.Context, *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -397,12 +183,6 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) RelayMiningDifficulty(ctx context.Context, req *QueryGetRelayMiningDifficultyRequest) (*QueryGetRelayMiningDifficultyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficulty not implemented") -} -func (*UnimplementedQueryServer) RelayMiningDifficultyAll(ctx context.Context, req *QueryAllRelayMiningDifficultyRequest) (*QueryAllRelayMiningDifficultyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RelayMiningDifficultyAll not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -426,42 +206,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_RelayMiningDifficulty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetRelayMiningDifficultyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RelayMiningDifficulty(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/poktroll.tokenomics.Query/RelayMiningDifficulty", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RelayMiningDifficulty(ctx, req.(*QueryGetRelayMiningDifficultyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_RelayMiningDifficultyAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllRelayMiningDifficultyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RelayMiningDifficultyAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/poktroll.tokenomics.Query/RelayMiningDifficultyAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RelayMiningDifficultyAll(ctx, req.(*QueryAllRelayMiningDifficultyRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "poktroll.tokenomics.Query", HandlerType: (*QueryServer)(nil), @@ -470,14 +214,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, - { - MethodName: "RelayMiningDifficulty", - Handler: _Query_RelayMiningDifficulty_Handler, - }, - { - MethodName: "RelayMiningDifficultyAll", - Handler: _Query_RelayMiningDifficultyAll_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/tokenomics/query.proto", @@ -539,153 +275,6 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryGetRelayMiningDifficultyRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetRelayMiningDifficultyRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetRelayMiningDifficultyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ServiceId) > 0 { - i -= len(m.ServiceId) - copy(dAtA[i:], m.ServiceId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryGetRelayMiningDifficultyResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryGetRelayMiningDifficultyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetRelayMiningDifficultyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.RelayMiningDifficulty.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryAllRelayMiningDifficultyRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllRelayMiningDifficultyRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllRelayMiningDifficultyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllRelayMiningDifficultyResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryAllRelayMiningDifficultyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllRelayMiningDifficultyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.RelayMiningDifficulty) > 0 { - for iNdEx := len(m.RelayMiningDifficulty) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RelayMiningDifficulty[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -717,64 +306,8 @@ func (m *QueryParamsResponse) Size() (n int) { return n } -func (m *QueryGetRelayMiningDifficultyRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetRelayMiningDifficultyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RelayMiningDifficulty.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAllRelayMiningDifficultyRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllRelayMiningDifficultyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.RelayMiningDifficulty) > 0 { - for _, e := range m.RelayMiningDifficulty { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -912,377 +445,6 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetRelayMiningDifficultyRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetRelayMiningDifficultyResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RelayMiningDifficulty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllRelayMiningDifficultyRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRelayMiningDifficultyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllRelayMiningDifficultyResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllRelayMiningDifficultyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RelayMiningDifficulty", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RelayMiningDifficulty = append(m.RelayMiningDifficulty, RelayMiningDifficulty{}) - if err := m.RelayMiningDifficulty[len(m.RelayMiningDifficulty)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenomics/types/query.pb.gw.go b/x/tokenomics/types/query.pb.gw.go index 15d7f5446..08c31f3c5 100644 --- a/x/tokenomics/types/query.pb.gw.go +++ b/x/tokenomics/types/query.pb.gw.go @@ -51,96 +51,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_RelayMiningDifficulty_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetRelayMiningDifficultyRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["serviceId"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serviceId") - } - - protoReq.ServiceId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serviceId", err) - } - - msg, err := client.RelayMiningDifficulty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_RelayMiningDifficulty_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetRelayMiningDifficultyRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["serviceId"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serviceId") - } - - protoReq.ServiceId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serviceId", err) - } - - msg, err := server.RelayMiningDifficulty(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_RelayMiningDifficultyAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_RelayMiningDifficultyAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllRelayMiningDifficultyRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RelayMiningDifficultyAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.RelayMiningDifficultyAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_RelayMiningDifficultyAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllRelayMiningDifficultyRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RelayMiningDifficultyAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.RelayMiningDifficultyAll(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -170,52 +80,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_RelayMiningDifficulty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_RelayMiningDifficulty_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RelayMiningDifficulty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_RelayMiningDifficultyAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_RelayMiningDifficultyAll_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RelayMiningDifficultyAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -277,61 +141,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_RelayMiningDifficulty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_RelayMiningDifficulty_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RelayMiningDifficulty_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_RelayMiningDifficultyAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_RelayMiningDifficultyAll_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RelayMiningDifficultyAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"pokt-network", "poktroll", "tokenomics", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_RelayMiningDifficulty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"pokt-network", "poktroll", "tokenomics", "relay_mining_difficulty", "serviceId"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_RelayMiningDifficultyAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"pokt-network", "poktroll", "tokenomics", "relay_mining_difficulty"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_RelayMiningDifficulty_0 = runtime.ForwardResponseMessage - - forward_Query_RelayMiningDifficultyAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/tokenomics/types/tx.pb.go b/x/tokenomics/types/tx.pb.go index e4fec264c..9f18a148c 100644 --- a/x/tokenomics/types/tx.pb.go +++ b/x/tokenomics/types/tx.pb.go @@ -125,7 +125,6 @@ type MsgUpdateParam struct { // specified in the `Params` message in `proof/params.proto.` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: - // // *MsgUpdateParam_AsString // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes From b60dac9884ac1e9281ff0b2a49226d9c1958b35e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 11 Oct 2024 17:26:23 +0200 Subject: [PATCH 04/13] [Application] Enforce minimum stake when burning (#848) ## Summary Updates `ProcessTokenLogicModules()` logic to unbond applications whose stake is below the minimum **after** processing all TLMs. ## Dependencies - #809 - #843 - #844 - #845 - #847 ## Dependents - #849 - #850 - #857 - #852 - #861 - #851 - #863 ## Issue - #612 ## Type of change Select one or more from the following: - [x] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [x] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [x] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- config.yml | 6 +- pkg/crypto/rings/client.go | 1 + .../integration/application/min_stake_test.go | 188 ++++++++++++++++++ testutil/keeper/tokenomics.go | 4 + testutil/testkeyring/accounts.go | 4 +- .../keeper/msg_server_stake_application.go | 9 +- .../keeper/msg_server_unstake_application.go | 2 + .../msg_server_unstake_application_test.go | 8 + x/application/keeper/unbond_applications.go | 56 ++++-- x/application/types/application.go | 5 +- x/shared/types/params.go | 3 + x/tokenomics/keeper/settle_pending_claims.go | 33 +++ x/tokenomics/keeper/token_logic_modules.go | 13 +- .../keeper/token_logic_modules_test.go | 6 +- x/tokenomics/types/expected_keepers.go | 1 + 15 files changed, 304 insertions(+), 35 deletions(-) create mode 100644 tests/integration/application/min_stake_test.go diff --git a/config.yml b/config.yml index b8c9aed5c..57db72f1a 100644 --- a/config.yml +++ b/config.yml @@ -167,7 +167,7 @@ genesis: max_delegated_gateways: "7" min_stake: # TODO_MAINNET: Determine realistic amount for minimum application stake amount. - amount: "1000000" # 1 POKT + amount: "100000000" # 100 POKT denom: upokt applicationList: - address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 @@ -179,7 +179,7 @@ genesis: stake: # NB: This value should be exactly 1upokt smaller than the value in # `supplier1_stake_config.yaml` so that the stake command causes a state change. - amount: "1000068" + amount: "100000068" # ~100 POKT denom: upokt - address: pokt1ad28jdap2zfanjd7hpkh984yveney6k9a42man delegatee_gateway_addresses: [] @@ -190,7 +190,7 @@ genesis: stake: # NB: This value should be exactly 1upokt smaller than the value in # `supplier1_stake_config.yaml` so that the stake command causes a state change. - amount: "1000068" + amount: "100000068" # ~100 POKT denom: upokt supplier: supplierList: diff --git a/pkg/crypto/rings/client.go b/pkg/crypto/rings/client.go index 62489792b..53ab1f3ae 100644 --- a/pkg/crypto/rings/client.go +++ b/pkg/crypto/rings/client.go @@ -46,6 +46,7 @@ type ringClient struct { // - polylog.Logger // - client.ApplicationQueryClient // - client.AccountQueryClient +// - client.SharedQueryClient func NewRingClient(deps depinject.Config) (_ crypto.RingClient, err error) { rc := new(ringClient) diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go new file mode 100644 index 000000000..014d129db --- /dev/null +++ b/tests/integration/application/min_stake_test.go @@ -0,0 +1,188 @@ +package application + +import ( + "context" + "testing" + + cosmoslog "cosmossdk.io/log" + "cosmossdk.io/math" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "github.com/pokt-network/poktroll/app/volatile" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" + "github.com/pokt-network/poktroll/testutil/keeper" + testproof "github.com/pokt-network/poktroll/testutil/proof" + "github.com/pokt-network/poktroll/testutil/sample" + apptypes "github.com/pokt-network/poktroll/x/application/types" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + "github.com/pokt-network/poktroll/x/shared" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +type applicationMinStakeTestSuite struct { + suite.Suite + + ctx context.Context + keepers keeper.TokenomicsModuleKeepers + + serviceId, + appBech32, + supplierBech32 string + + appStake *cosmostypes.Coin + + numRelays, + numComputeUnitsPerRelay uint64 +} + +func TestApplicationMinStakeTestSuite(t *testing.T) { + cmd.InitSDKConfig() + + suite.Run(t, new(applicationMinStakeTestSuite)) +} + +func (s *applicationMinStakeTestSuite) SetupTest() { + s.keepers, s.ctx = keeper.NewTokenomicsModuleKeepers(s.T(), cosmoslog.NewNopLogger()) + + s.serviceId = "svc1" + s.appBech32 = sample.AccAddress() + s.supplierBech32 = sample.AccAddress() + s.appStake = &apptypes.DefaultMinStake + s.numRelays = 10 + s.numComputeUnitsPerRelay = 1 + + // Set block height to 1. + s.ctx = cosmostypes.UnwrapSDKContext(s.ctx).WithBlockHeight(1) +} + +func (s *applicationMinStakeTestSuite) TestAppCannotStakeLessThanMinStake() { + s.T().Skip("this case is well covered in x/application/keeper/msg_server_stake_application_test.go") +} + +func (s *applicationMinStakeTestSuite) TestAppIsUnbondedIfBelowMinStakeWhenSettling() { + // Assert that the application's initial bank balance is 0. + appBalance := s.getAppBalance() + require.Equal(s.T(), int64(0), appBalance.Amount.Int64()) + + // Add service 1 + s.addService() + + // Stake an application for service 1 with min stake. + s.stakeApp() + + // Stake a supplier for service 1. + s.stakeSupplier() + + // Get the session header. + sessionHeader := s.getSessionHeader() + + // Create a claim whose settlement amount drops the application below min stake + claim := s.getClaim(sessionHeader) + s.keepers.ProofKeeper.UpsertClaim(s.ctx, *claim) + + // Set the current height to the claim settlement height. + sdkCtx := cosmostypes.UnwrapSDKContext(s.ctx) + currentHeight := sdkCtx.BlockHeight() + sharedParams := s.keepers.SharedKeeper.GetParams(s.ctx) + currentSessionEndHeight := shared.GetSessionEndHeight(&sharedParams, currentHeight) + claimSettlementHeight := currentSessionEndHeight + int64(sharedtypes.GetSessionEndToProofWindowCloseBlocks(&sharedParams)) + 1 + sdkCtx = sdkCtx.WithBlockHeight(claimSettlementHeight) + s.ctx = sdkCtx + + // Settle pending claims; this should cause the application to be unbonded. + _, _, err := s.keepers.Keeper.SettlePendingClaims(sdkCtx) + require.NoError(s.T(), err) + + // Assert that the application was unbonded. + _, isAppFound := s.keepers.ApplicationKeeper.GetApplication(s.ctx, s.appBech32) + require.False(s.T(), isAppFound) + + // Assert that the application's stake was returned to its bank balance. + expectedAppBurn := math.NewInt(int64(s.numRelays * s.numComputeUnitsPerRelay * sharedtypes.DefaultComputeUnitsToTokensMultiplier)) + expectedAppBalance := s.appStake.SubAmount(expectedAppBurn) + appBalance = s.getAppBalance() + require.Equal(s.T(), expectedAppBalance.Amount.Int64(), appBalance.Amount.Int64()) + +} + +// addService adds the test service to the service module state. +func (s *applicationMinStakeTestSuite) addService() { + s.keepers.ServiceKeeper.SetService(s.ctx, sharedtypes.Service{ + Id: s.serviceId, + ComputeUnitsPerRelay: 1, + OwnerAddress: sample.AccAddress(), // random address. + }) +} + +// stakeApp stakes an application for service 1 with min stake. +func (s *applicationMinStakeTestSuite) stakeApp() { + s.keepers.ApplicationKeeper.SetApplication(s.ctx, apptypes.Application{ + Address: s.appBech32, + Stake: s.appStake, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{{ServiceId: s.serviceId}}, + }) +} + +// stakeSupplier stakes a supplier for service 1. +func (s *applicationMinStakeTestSuite) stakeSupplier() { + // TODO_UPNEXT(@bryanchriswhite, #612): Replace supplierStake with suppleirtypes.DefaultMinStake. + supplierStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 1000000) // 1 POKT. + s.keepers.SupplierKeeper.SetSupplier(s.ctx, sharedtypes.Supplier{ + OwnerAddress: s.supplierBech32, + OperatorAddress: s.supplierBech32, + Stake: &supplierStake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + ServiceId: s.serviceId, + RevShare: []*sharedtypes.ServiceRevenueShare{ + { + Address: s.supplierBech32, + RevSharePercentage: 100, + }, + }, + }, + }, + }) +} + +// getSessionHeader gets the session header for the test session. +func (s *applicationMinStakeTestSuite) getSessionHeader() *sessiontypes.SessionHeader { + sdkCtx := cosmostypes.UnwrapSDKContext(s.ctx) + currentHeight := sdkCtx.BlockHeight() + sessionRes, err := s.keepers.SessionKeeper.GetSession(s.ctx, &sessiontypes.QueryGetSessionRequest{ + ApplicationAddress: s.appBech32, + ServiceId: s.serviceId, + BlockHeight: currentHeight, + }) + require.NoError(s.T(), err) + + return sessionRes.GetSession().GetHeader() +} + +// getClaim creates a claim whose settlement amount drops the application below min stake. +func (s *applicationMinStakeTestSuite) getClaim( + sessionHeader *sessiontypes.SessionHeader, +) *prooftypes.Claim { + claimRoot := testproof.SmstRootWithSumAndCount(s.numRelays*s.numComputeUnitsPerRelay, s.numRelays) + + return &prooftypes.Claim{ + SupplierOperatorAddress: s.supplierBech32, + SessionHeader: sessionHeader, + RootHash: claimRoot, + } +} + +// getAppBalance returns the bank module balance for the application. +func (s *applicationMinStakeTestSuite) getAppBalance() *cosmostypes.Coin { + appBalRes, err := s.keepers.BankKeeper.Balance(s.ctx, &banktypes.QueryBalanceRequest{ + Address: s.appBech32, Denom: volatile.DenomuPOKT, + }) + require.NoError(s.T(), err) + + return appBalRes.GetBalance() +} diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index e3bf52440..d6a50ed25 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -160,6 +160,10 @@ func TokenomicsKeeperWithActorAddrs(t testing.TB) ( mockApplicationKeeper.EXPECT(). SetApplication(gomock.Any(), gomock.Any()). AnyTimes() + mockApplicationKeeper.EXPECT(). + UnbondApplication(gomock.Any(), gomock.Any()). + Return(nil). + AnyTimes() // Mock the supplier keeper. mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) diff --git a/testutil/testkeyring/accounts.go b/testutil/testkeyring/accounts.go index af0db469e..c28a1f4d5 100644 --- a/testutil/testkeyring/accounts.go +++ b/testutil/testkeyring/accounts.go @@ -117,10 +117,12 @@ func (iter *PreGeneratedAccountIterator) Next() (_ *PreGeneratedAccount, ok bool return iter.accounts[currentIndex], true } +// MustNext returns the next account in the iterator. It panics if the iterator +// is out of accounts; see testutil/testkeyring/gen_accounts. func (iter *PreGeneratedAccountIterator) MustNext() *PreGeneratedAccount { account, ok := iter.Next() if !ok { - panic("insufficient number of pre-generated accounts") + panic("insufficient number of pre-generated accounts; see testutil/testkeyring/gen_accounts") } return account } diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index 92153258c..3bbd22f0d 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -51,6 +51,7 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl logger.Info(fmt.Sprintf("Application is going to escrow an additional %+v coins", coinsToEscrow)) // If the application has initiated an unstake action, cancel it since it is staking again. + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingCanceled event was emitted. foundApp.UnstakeSessionEndHeight = types.ApplicationNotUnstaking } @@ -67,12 +68,14 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl // MUST ALWAYS have at least minimum stake. minStake := k.GetParams(ctx).MinStake + // TODO_CONSIDERATION: If we support multiple native tokens, we will need to + // start checking the denom here. if msg.Stake.Amount.LT(minStake.Amount) { - errFmt := "application %q must stake at least %s" - logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) + err = fmt.Errorf("application %q must stake at least %s", msg.GetAddress(), minStake) + logger.Info(err.Error()) return nil, status.Error( codes.InvalidArgument, - types.ErrAppInvalidStake.Wrapf(errFmt, msg.Address, minStake).Error(), + types.ErrAppInvalidStake.Wrapf("%s", err).Error(), ) } diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go index ac122c68b..f077fce85 100644 --- a/x/application/keeper/msg_server_unstake_application.go +++ b/x/application/keeper/msg_server_unstake_application.go @@ -61,6 +61,8 @@ func (k msgServer) UnstakeApplication( foundApp.UnstakeSessionEndHeight = uint64(shared.GetSessionEndHeight(&sharedParams, currentHeight)) k.SetApplication(ctx, foundApp) + // TODO_UPNEXT:(@bryanchriswhite): emit a new EventApplicationUnbondingBegin event. + isSuccessful = true return &types.MsgUnstakeApplicationResponse{}, nil } diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go index a5ed5801f..e57a8b234 100644 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ b/x/application/keeper/msg_server_unstake_application_test.go @@ -57,6 +57,8 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingBegin event was emitted. + // Make sure the application entered the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, unstakingAppAddr) require.True(t, isAppFound) @@ -70,6 +72,8 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { err = applicationModuleKeepers.EndBlockerUnbondApplications(ctx) require.NoError(t, err) + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingEnd event was emitted. + // Make sure the unstaking application is removed from the applications list when // the unbonding period is over. _, isAppFound = applicationModuleKeepers.GetApplication(ctx, unstakingAppAddr) @@ -105,6 +109,8 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingBegin event was emitted. + // Make sure the application entered the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) require.True(t, isAppFound) @@ -117,6 +123,8 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { _, err = srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingCanceled event was emitted. + // Make sure the application is no longer in the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) require.True(t, isAppFound) diff --git a/x/application/keeper/unbond_applications.go b/x/application/keeper/unbond_applications.go index f0d98b0e6..1ff38f4eb 100644 --- a/x/application/keeper/unbond_applications.go +++ b/x/application/keeper/unbond_applications.go @@ -7,7 +7,7 @@ import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/application/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" "github.com/pokt-network/poktroll/x/shared" ) @@ -22,8 +22,6 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { return nil } - logger := k.Logger().With("method", "UnbondApplication") - // Iterate over all applications and unbond the ones that have finished the unbonding period. // TODO_IMPROVE: Use an index to iterate over the applications that have initiated // the unbonding action instead of iterating over all of them. @@ -33,7 +31,7 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { continue } - unbondingHeight := types.GetApplicationUnbondingHeight(&sharedParams, &application) + unbondingHeight := apptypes.GetApplicationUnbondingHeight(&sharedParams, &application) // If the unbonding height is ahead of the current height, the application // stays in the unbonding state. @@ -41,29 +39,43 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { continue } - // Retrieve the account address of the application. - applicationAccAddress, err := cosmostypes.AccAddressFromBech32(application.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", application.Address)) + if err := k.UnbondApplication(ctx, &application); err != nil { return err } - // Send the coins from the application pool back to the application - err = k.bankKeeper.SendCoinsFromModuleToAccount( - ctx, types.ModuleName, applicationAccAddress, []sdk.Coin{*application.Stake}, - ) - if err != nil { - logger.Error(fmt.Sprintf( - "could not send %v coins from module %s to account %s due to %v", - application.Stake, applicationAccAddress, types.ModuleName, err, - )) - return err - } + // TODO_UPNEXT(@bryanchriswhite): emit a new EventApplicationUnbondingEnd event. + } - // Update the Application in the store - k.RemoveApplication(ctx, applicationAccAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the application: %+v", application)) + return nil +} + +// UnbondApplication transfers the application stake to the bank module balance for the +// corresponding account and removes the application from the application module state. +func (k Keeper) UnbondApplication(ctx context.Context, app *apptypes.Application) error { + logger := k.Logger().With("method", "UnbondApplication") + + // Retrieve the account address of the application. + appAddr, err := cosmostypes.AccAddressFromBech32(app.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", app.Address)) + return err } + // Send the coins from the application pool back to the application. + err = k.bankKeeper.SendCoinsFromModuleToAccount( + ctx, apptypes.ModuleName, appAddr, []sdk.Coin{*app.Stake}, + ) + if err != nil { + logger.Error(fmt.Sprintf( + "could not send %v coins from module %s to account %s due to %v", + app.Stake, appAddr, apptypes.ModuleName, err, + )) + return err + } + + // Remove the Application from the store. + k.RemoveApplication(ctx, app.GetAddress()) + logger.Info(fmt.Sprintf("Successfully removed the application: %+v", app)) + return nil } diff --git a/x/application/types/application.go b/x/application/types/application.go index b4a33cd5b..c584d75a1 100644 --- a/x/application/types/application.go +++ b/x/application/types/application.go @@ -4,7 +4,10 @@ import sharedtypes "github.com/pokt-network/poktroll/x/shared/types" // ApplicationNotUnstaking is the value of `unstake_session_end_height` if the // application is not actively in the unbonding period. -const ApplicationNotUnstaking uint64 = 0 +const ( + ApplicationNotUnstaking uint64 = iota + ApplicationBelowMinStake +) // IsUnbonding returns true if the application is actively unbonding. // It determines if the application has submitted an unstake message, in which case diff --git a/x/shared/types/params.go b/x/shared/types/params.go index d5921f62d..17bc7b964 100644 --- a/x/shared/types/params.go +++ b/x/shared/types/params.go @@ -168,6 +168,9 @@ func (params *Params) ValidateBasic() error { return err } + // TODO_MAINNET(@bryanchriswhite): Add validation which ensures that + // SessionEndToProofWindowCloseBlocks is a multiple of NumBlocksPerSession. + return nil } diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index c0f9917c8..04d8b1fc5 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" "cosmossdk.io/math" @@ -8,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" "github.com/pokt-network/poktroll/app/volatile" + apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" @@ -202,6 +204,10 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( logger.Info(fmt.Sprintf("Successfully settled claim for session ID %q at block height %d", claim.SessionHeader.SessionId, blockHeight)) } + // Unbond applications whose post-settlement stake has dropped below the + // application minimum stake requirement. + k.unbondApplicationsBelowMinStake(ctx, expiringClaims) + // Slash all the suppliers that have been marked for slashing slashingCount times. for supplierOperatorAddress, slashingCount := range supplierToExpiredClaimCount { if err := k.slashSupplierStake(ctx, supplierOperatorAddress, slashingCount); err != nil { @@ -225,6 +231,11 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( // If the proof window closes and a proof IS NOT required -> settle the claim. // If the proof window closes and a proof IS required -> only settle it if a proof is available. func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes.Claim, err error) { + // TODO_IMPROVE(@bryanchriswhite): + // 1. Move height logic up to SettlePendingClaims. + // 2. Ensure that claims are only settled or expired on a session end height. + // 2a. This likely also requires adding validation to the shared module params. + blockHeight := ctx.BlockHeight() // NB: This error can be safely ignored as on-chain SharedQueryClient implementation cannot return an error. @@ -264,6 +275,28 @@ func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes. return expiringClaims, nil } +// unbondApplicationsBelowMinStake unbonds applications whose post-settlement stake has dropped below the +// application minimum stake requirement. +func (k Keeper) unbondApplicationsBelowMinStake(ctx context.Context, claims []prooftypes.Claim) { + logger := k.logger.With("method", "unbondApplicationsBelowMinStake") + + for _, claim := range claims { + app, isAppFound := k.applicationKeeper.GetApplication(ctx, claim.SessionHeader.ApplicationAddress) + if !isAppFound { + logger.Error(apptypes.ErrAppNotFound.Wrapf("application address: %q", claim.SessionHeader.ApplicationAddress).Error()) + continue + } + + // Unbond the application because it has less than the minimum stake. + if app.GetUnstakeSessionEndHeight() == apptypes.ApplicationBelowMinStake { + if err := k.applicationKeeper.UnbondApplication(ctx, &app); err != nil { + logger.Error(fmt.Sprintf("unbonding application (%+v): %s", app, err)) + continue + } + } + } +} + // slashSupplierStake slashes the stake of a supplier and transfers the total // slashing amount from the supplier bank module to the tokenomics module account. func (k Keeper) slashSupplierStake( diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index dd9058eec..fac928341 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -274,13 +274,22 @@ func (k Keeper) ProcessTokenLogicModules( // Execute all the token logic modules processors for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { logger.Info(fmt.Sprintf("Starting TLM processing: %q", tlm)) - if err := tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { + if err = tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { return tokenomicstypes.ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm, err) } logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) } - // State mutation: update the application's on-chain record + // TODO_CONSIDERATION: If we support multiple native tokens, we will need to + // start checking the denom here. + if application.Stake.Amount.LT(apptypes.DefaultMinStake.Amount) { + // Mark the application as unbonding if it has less than the minimum stake. + application.UnstakeSessionEndHeight = apptypes.ApplicationBelowMinStake + + // TODO_UPNEXT:(@bryanchriswhite): emit a new EventApplicationUnbondedBelowMinStake event. + } + + // State mutation: update the application's on-chain record. k.applicationKeeper.SetApplication(ctx, application) logger.Info(fmt.Sprintf("updated on-chain application record with address %q", application.Address)) diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index d90691bd6..812090ae7 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -42,7 +42,7 @@ func init() { func TestProcessTokenLogicModules_TLMBurnEqualsMint_Valid(t *testing.T) { // Test Parameters - appInitialStake := math.NewInt(1000000) + appInitialStake := apptypes.DefaultMinStake.Amount.Mul(math.NewInt(2)) supplierInitialStake := math.NewInt(1000000) supplierRevShareRatios := []float32{12.5, 37.5, 50} globalComputeUnitsToTokensMultiplier := uint64(1) @@ -169,7 +169,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMint_Valid(t *testing.T) { func TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxClaimableAmount(t *testing.T) { // Test Parameters globalComputeUnitsToTokensMultiplier := uint64(1) - serviceComputeUnitsPerRelay := uint64(1) + serviceComputeUnitsPerRelay := uint64(100) service := prepareTestService(serviceComputeUnitsPerRelay) numRelays := uint64(1000) // By a single supplier for application in this session supplierInitialStake := math.NewInt(1000000) @@ -314,7 +314,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxCl func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t *testing.T) { // Test Parameters - appInitialStake := math.NewInt(1000000) + appInitialStake := apptypes.DefaultMinStake.Amount.Mul(math.NewInt(2)) supplierInitialStake := math.NewInt(1000000) supplierRevShareRatios := []float32{12.5, 37.5, 50} globalComputeUnitsToTokensMultiplier := uint64(1) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go index 084436e0e..6d198a320 100644 --- a/x/tokenomics/types/expected_keepers.go +++ b/x/tokenomics/types/expected_keepers.go @@ -44,6 +44,7 @@ type ApplicationKeeper interface { GetApplication(ctx context.Context, appAddr string) (app apptypes.Application, found bool) SetApplication(ctx context.Context, app apptypes.Application) GetAllApplications(ctx context.Context) []apptypes.Application + UnbondApplication(ctx context.Context, app *apptypes.Application) error } type ProofKeeper interface { From b975a2adac7a99fc611c49a1e132ea4422a39288 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 12:43:34 +0200 Subject: [PATCH 05/13] [Supplier] Add `MsgUpdateParam` to application module (#849) ## Summary ```bash ignite scaffold message update-param --module supplier --signer authority name as_type --response params ``` Adds the `MsgUpdateParam` message so that the supplier module may update individual parameters following section 0 from the updated docs (see #839). ## Dependencies - #809 - #843 - #844 - #845 - #847 - #848 ## Dependents - #850 - #857 - #852 - #861 - #851 - #863 ## Issue - #612 ## Type of change Select one or more from the following: - [x] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [x] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [x] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- api/poktroll/supplier/tx.pulsar.go | 1300 ++++++++++++++++- api/poktroll/supplier/tx_grpc.pb.go | 38 + proto/poktroll/supplier/tx.proto | 47 +- .../integration/application/min_stake_test.go | 5 + testutil/integration/suites/param_configs.go | 2 + .../authz/dao_genesis_authorizations.json | 9 + x/supplier/keeper/msg_server_update_param.go | 37 + x/supplier/module/autocli.go | 6 + x/supplier/module/simulation.go | 23 + x/supplier/simulation/update_param.go | 30 + x/supplier/types/codec.go | 3 + x/supplier/types/errors.go | 1 + x/supplier/types/message_update_param.go | 49 + x/supplier/types/message_update_param_test.go | 55 + x/supplier/types/tx.pb.go | 629 +++++++- 15 files changed, 2128 insertions(+), 106 deletions(-) create mode 100644 x/supplier/keeper/msg_server_update_param.go create mode 100644 x/supplier/simulation/update_param.go create mode 100644 x/supplier/types/message_update_param.go create mode 100644 x/supplier/types/message_update_param_test.go diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index ec93f9704..1d2057b01 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -2834,6 +2834,1043 @@ func (x *fastReflection_MsgUnstakeSupplierResponse) ProtoMethods() *protoiface.M } } +var ( + md_MsgUpdateParam protoreflect.MessageDescriptor + fd_MsgUpdateParam_authority protoreflect.FieldDescriptor + fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUpdateParam = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUpdateParam") + fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") + fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) + +type fastReflection_MsgUpdateParam MsgUpdateParam + +func (x *MsgUpdateParam) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(x) +} + +func (x *MsgUpdateParam) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParam_messageType fastReflection_MsgUpdateParam_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParam_messageType{} + +type fastReflection_MsgUpdateParam_messageType struct{} + +func (x fastReflection_MsgUpdateParam_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(nil) +} +func (x fastReflection_MsgUpdateParam_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} +func (x fastReflection_MsgUpdateParam_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParam) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParam) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParam_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParam) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParam) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParam)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParam_authority, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_MsgUpdateParam_name, value) { + return + } + } + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + v := o.AsCoin + value := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(fd_MsgUpdateParam_as_coin, value) { + return + } + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParam.authority": + return x.Authority != "" + case "poktroll.supplier.MsgUpdateParam.name": + return x.Name != "" + case "poktroll.supplier.MsgUpdateParam.as_coin": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return true + } else { + return false + } + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParam.authority": + x.Authority = "" + case "poktroll.supplier.MsgUpdateParam.name": + x.Name = "" + case "poktroll.supplier.MsgUpdateParam.as_coin": + x.AsType = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.MsgUpdateParam.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgUpdateParam.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgUpdateParam.as_coin": + if x.AsType == nil { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) + } else { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParam.authority": + x.Authority = value.Interface().(string) + case "poktroll.supplier.MsgUpdateParam.name": + x.Name = value.Interface().(string) + case "poktroll.supplier.MsgUpdateParam.as_coin": + cv := value.Message().Interface().(*v1beta1.Coin) + x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParam.as_coin": + if x.AsType == nil { + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + switch m := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) + default: + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + case "poktroll.supplier.MsgUpdateParam.authority": + panic(fmt.Errorf("field authority of message poktroll.supplier.MsgUpdateParam is not mutable")) + case "poktroll.supplier.MsgUpdateParam.name": + panic(fmt.Errorf("field name of message poktroll.supplier.MsgUpdateParam is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParam.authority": + return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgUpdateParam.name": + return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgUpdateParam.as_coin": + value := &v1beta1.Coin{} + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + case "poktroll.supplier.MsgUpdateParam.asType": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return x.Descriptor().Fields().ByName("as_coin") + } + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUpdateParam", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParam) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParam) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParam) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + if x == nil { + break + } + l = options.Size(x.AsCoin) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + encoded, err := options.Marshal(x.AsCoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParam) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + v := &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + x.AsType = &MsgUpdateParam_AsCoin{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamResponse protoreflect.MessageDescriptor + fd_MsgUpdateParamResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUpdateParamResponse = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUpdateParamResponse") + fd_MsgUpdateParamResponse_params = md_MsgUpdateParamResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamResponse)(nil) + +type fastReflection_MsgUpdateParamResponse MsgUpdateParamResponse + +func (x *MsgUpdateParamResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(x) +} + +func (x *MsgUpdateParamResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamResponse_messageType fastReflection_MsgUpdateParamResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamResponse_messageType{} + +type fastReflection_MsgUpdateParamResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(nil) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParamResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParamResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParamResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.MsgUpdateParamResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParamResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParamResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParamResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUpdateParamResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3084,6 +4121,114 @@ func (*MsgUnstakeSupplierResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{5} } +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` +} + +func (x *MsgUpdateParam) Reset() { + *x = MsgUpdateParam{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParam) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParam) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParam.ProtoReflect.Descriptor instead. +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgUpdateParam) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParam) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if x != nil { + return x.AsType + } + return nil +} + +func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *v1beta1.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + +type MsgUpdateParamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParamResponse) Reset() { + *x = MsgUpdateParamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{7} +} + +func (x *MsgUpdateParamResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + var File_poktroll_supplier_tx_proto protoreflect.FileDescriptor var file_poktroll_supplier_tx_proto_rawDesc = []byte{ @@ -3149,38 +4294,60 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb8, 0x02, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xac, 0x01, 0x0a, 0x0e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, + 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, + 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, + 0x08, 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4b, 0x0a, 0x16, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x95, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, + 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, - 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, - 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xad, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, - 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, + 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, + 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0b, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x29, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xad, + 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3195,7 +4362,7 @@ func file_poktroll_supplier_tx_proto_rawDescGZIP() []byte { return file_poktroll_supplier_tx_proto_rawDescData } -var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse @@ -3203,25 +4370,31 @@ var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ (*MsgStakeSupplierResponse)(nil), // 3: poktroll.supplier.MsgStakeSupplierResponse (*MsgUnstakeSupplier)(nil), // 4: poktroll.supplier.MsgUnstakeSupplier (*MsgUnstakeSupplierResponse)(nil), // 5: poktroll.supplier.MsgUnstakeSupplierResponse - (*Params)(nil), // 6: poktroll.supplier.Params - (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin - (*shared.SupplierServiceConfig)(nil), // 8: poktroll.shared.SupplierServiceConfig + (*MsgUpdateParam)(nil), // 6: poktroll.supplier.MsgUpdateParam + (*MsgUpdateParamResponse)(nil), // 7: poktroll.supplier.MsgUpdateParamResponse + (*Params)(nil), // 8: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin + (*shared.SupplierServiceConfig)(nil), // 10: poktroll.shared.SupplierServiceConfig } var file_poktroll_supplier_tx_proto_depIdxs = []int32{ - 6, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params - 7, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin - 8, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig - 0, // 3: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams - 2, // 4: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier - 4, // 5: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier - 1, // 6: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse - 3, // 7: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse - 5, // 8: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 8, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params + 9, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin + 10, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig + 9, // 3: poktroll.supplier.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin + 8, // 4: poktroll.supplier.MsgUpdateParamResponse.params:type_name -> poktroll.supplier.Params + 0, // 5: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams + 2, // 6: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier + 4, // 7: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier + 6, // 8: poktroll.supplier.Msg.UpdateParam:input_type -> poktroll.supplier.MsgUpdateParam + 1, // 9: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse + 3, // 10: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse + 5, // 11: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse + 7, // 12: poktroll.supplier.Msg.UpdateParam:output_type -> poktroll.supplier.MsgUpdateParamResponse + 9, // [9:13] is the sub-list for method output_type + 5, // [5:9] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_poktroll_supplier_tx_proto_init() } @@ -3303,6 +4476,33 @@ func file_poktroll_supplier_tx_proto_init() { return nil } } + file_poktroll_supplier_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParam); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_poktroll_supplier_tx_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -3310,7 +4510,7 @@ func file_poktroll_supplier_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_supplier_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/supplier/tx_grpc.pb.go b/api/poktroll/supplier/tx_grpc.pb.go index a95a976c9..1e175c012 100644 --- a/api/poktroll/supplier/tx_grpc.pb.go +++ b/api/poktroll/supplier/tx_grpc.pb.go @@ -22,6 +22,7 @@ const ( Msg_UpdateParams_FullMethodName = "/poktroll.supplier.Msg/UpdateParams" Msg_StakeSupplier_FullMethodName = "/poktroll.supplier.Msg/StakeSupplier" Msg_UnstakeSupplier_FullMethodName = "/poktroll.supplier.Msg/UnstakeSupplier" + Msg_UpdateParam_FullMethodName = "/poktroll.supplier.Msg/UpdateParam" ) // MsgClient is the client API for Msg service. @@ -35,6 +36,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) StakeSupplier(ctx context.Context, in *MsgStakeSupplier, opts ...grpc.CallOption) (*MsgStakeSupplierResponse, error) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, opts ...grpc.CallOption) (*MsgUnstakeSupplierResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -75,6 +77,16 @@ func (c *msgClient) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParam_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -86,6 +98,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) StakeSupplier(context.Context, *MsgStakeSupplier) (*MsgStakeSupplierResponse, error) UnstakeSupplier(context.Context, *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) mustEmbedUnimplementedMsgServer() } @@ -102,6 +115,9 @@ func (UnimplementedMsgServer) StakeSupplier(context.Context, *MsgStakeSupplier) func (UnimplementedMsgServer) UnstakeSupplier(context.Context, *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnstakeSupplier not implemented") } +func (UnimplementedMsgServer) UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -169,6 +185,24 @@ func _Msg_UnstakeSupplier_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpdateParam_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -188,6 +222,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UnstakeSupplier", Handler: _Msg_UnstakeSupplier_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/supplier/tx.proto", diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 1e13c9d71..b9431d520 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.supplier; option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; @@ -9,33 +10,28 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; - import "poktroll/supplier/params.proto"; import "poktroll/shared/service.proto"; - // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); rpc StakeSupplier (MsgStakeSupplier ) returns (MsgStakeSupplierResponse ); rpc UnstakeSupplier (MsgUnstakeSupplier) returns (MsgUnstakeSupplierResponse); + rpc UpdateParam (MsgUpdateParam ) returns (MsgUpdateParamResponse ); } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the - // latest Cosmos SDK version. We should look into either improving this ourselves - // or seeing if it is on their roadmap. - // params defines the x/supplier parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -47,22 +43,37 @@ message MsgUpdateParamsResponse {} message MsgStakeSupplier { option (cosmos.msg.v1.signer) = "signer"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) - string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the owner (i.e. custodial, staker) - string operator_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial) - cosmos.base.v1beta1.Coin stake = 4; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) - repeated poktroll.shared.SupplierServiceConfig services = 5; // The list of services this supplier is staked to provide service for + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) + string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the owner (i.e. custodial, staker) + string operator_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial) + cosmos.base.v1beta1.Coin stake = 4; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + repeated poktroll.shared.SupplierServiceConfig services = 5; // The list of services this supplier is staked to provide service for } message MsgStakeSupplierResponse {} message MsgUnstakeSupplier { option (cosmos.msg.v1.signer) = "signer"; - - string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) string operator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial) } message MsgUnstakeSupplierResponse {} +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +message MsgUpdateParam { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + string name = 2; + oneof asType { + cosmos.base.v1beta1.Coin as_coin = 3; + } +} + +message MsgUpdateParamResponse { + Params params = 1; +} + diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go index 014d129db..0815dba96 100644 --- a/tests/integration/application/min_stake_test.go +++ b/tests/integration/application/min_stake_test.go @@ -49,6 +49,11 @@ func TestApplicationMinStakeTestSuite(t *testing.T) { func (s *applicationMinStakeTestSuite) SetupTest() { s.keepers, s.ctx = keeper.NewTokenomicsModuleKeepers(s.T(), cosmoslog.NewNopLogger()) + proofParams := prooftypes.DefaultParams() + proofParams.ProofRequestProbability = 0 + err := s.keepers.ProofKeeper.SetParams(s.ctx, proofParams) + require.NoError(s.T(), err) + s.serviceId = "svc1" s.appBech32 = sample.AccAddress() s.supplierBech32 = sample.AccAddress() diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 0c884ffea..740a7693d 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -178,6 +178,8 @@ var ( ParamsMsgs: ModuleParamsMessages{ MsgUpdateParams: suppliertypes.MsgUpdateParams{}, MsgUpdateParamsResponse: suppliertypes.MsgUpdateParamsResponse{}, + MsgUpdateParam: suppliertypes.MsgUpdateParam{}, + MsgUpdateParamResponse: suppliertypes.MsgUpdateParamResponse{}, QueryParamsRequest: suppliertypes.QueryParamsRequest{}, QueryParamsResponse: suppliertypes.QueryParamsResponse{}, }, diff --git a/tools/scripts/authz/dao_genesis_authorizations.json b/tools/scripts/authz/dao_genesis_authorizations.json index 6f257a438..1dd6992f5 100644 --- a/tools/scripts/authz/dao_genesis_authorizations.json +++ b/tools/scripts/authz/dao_genesis_authorizations.json @@ -161,6 +161,15 @@ }, "expiration": "2500-01-01T00:00:00Z" }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.supplier.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, { "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go new file mode 100644 index 000000000..35efa6581 --- /dev/null +++ b/x/supplier/keeper/msg_server_update_param.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "context" + + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +// UpdateParam updates a single parameter in the proof module and returns +// all active parameters. +func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdateParam) (*suppliertypes.MsgUpdateParamResponse, error) { + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + if k.GetAuthority() != msg.Authority { + return nil, suppliertypes.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + // TODO_UPNEXT(@bryanchriswhite, #612): uncomment & add a min_stake case. + + //params := k.GetParams(ctx) + + switch msg.Name { + default: + return nil, suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + //if err := k.SetParams(ctx, params); err != nil { + // return nil, err + //} + // + //updatedParams := k.GetParams(ctx) + //return &suppliertypes.MsgUpdateParamResponse{ + // Params: &updatedParams, + //}, nil +} diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index 6a3afe3a9..716e3774f 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -51,6 +51,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { // Short: "Send a unstake-supplier tx", // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, //}, + //{ + // RpcMethod: "UpdateParam", + // Use: "update-param [name] [as-type]", + // Short: "Send a update-param tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "name"}, {ProtoField: "asType"}}, + //}, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/supplier/module/simulation.go b/x/supplier/module/simulation.go index cf9e6236f..3f0c913e2 100644 --- a/x/supplier/module/simulation.go +++ b/x/supplier/module/simulation.go @@ -31,6 +31,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUnstakeSupplier int = 100 + opWeightMsgUpdateParam = "op_weight_msg_update_param" + // TODO: Determine the simulation weight value + defaultWeightMsgUpdateParam int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -81,6 +85,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.supplierKeeper), )) + var weightMsgUpdateParam int + simState.AppParams.GetOrGenerate(opWeightMsgUpdateParam, &weightMsgUpdateParam, nil, + func(_ *rand.Rand) { + weightMsgUpdateParam = defaultWeightMsgUpdateParam + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUpdateParam, + suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.supplierKeeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -105,6 +120,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgUpdateParam, + defaultWeightMsgUpdateParam, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.supplierKeeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/supplier/simulation/update_param.go b/x/supplier/simulation/update_param.go new file mode 100644 index 000000000..cf9b8aa8e --- /dev/null +++ b/x/supplier/simulation/update_param.go @@ -0,0 +1,30 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func SimulateMsgUpdateParam( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgUpdateParam{ + Authority: simAccount.Address.String(), + } + + // TODO: Handling the UpdateParam simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UpdateParam simulation not implemented"), nil, nil + } +} diff --git a/x/supplier/types/codec.go b/x/supplier/types/codec.go index 9ecbe1202..185211e8a 100644 --- a/x/supplier/types/codec.go +++ b/x/supplier/types/codec.go @@ -14,6 +14,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUnstakeSupplier{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParam{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go index 622d7ed00..0759a9db6 100644 --- a/x/supplier/types/errors.go +++ b/x/supplier/types/errors.go @@ -18,4 +18,5 @@ var ( ErrSupplierIsUnstaking = sdkerrors.Register(ModuleName, 1109, "supplier is in unbonding period") ErrSupplierParamsInvalid = sdkerrors.Register(ModuleName, 1110, "invalid supplier params") ErrSupplierServiceNotFound = sdkerrors.Register(ModuleName, 1111, "service not found") + ErrSupplierParamInvalid = sdkerrors.Register(ModuleName, 1112, "the provided param is invalid") ) diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go new file mode 100644 index 000000000..5819e1ed2 --- /dev/null +++ b/x/supplier/types/message_update_param.go @@ -0,0 +1,49 @@ +package types + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ cosmostypes.Msg = (*MsgUpdateParam)(nil) + +func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdateParam { + var asTypeIface isMsgUpdateParam_AsType + + switch t := asType.(type) { + case *cosmostypes.Coin: + asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} + default: + panic(fmt.Sprintf("unexpected param value type: %T", asType)) + } + + return &MsgUpdateParam{ + Authority: authority, + Name: name, + AsType: asTypeIface, + } +} + +func (msg *MsgUpdateParam) ValidateBasic() error { + _, err := cosmostypes.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + + // Parameter value MUST NOT be nil. + if msg.AsType == nil { + return ErrSupplierParamInvalid.Wrap("missing param AsType") + } + + // Parameter name MUST be supported by this module. + switch msg.Name { + // TODO_UPNEXT(@bryanchriswhite, #612): replace with min_stake param name and call validation function. + case "": + return nil + default: + return ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) + } +} diff --git a/x/supplier/types/message_update_param_test.go b/x/supplier/types/message_update_param_test.go new file mode 100644 index 000000000..96136ded1 --- /dev/null +++ b/x/supplier/types/message_update_param_test.go @@ -0,0 +1,55 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUpdateParam_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUpdateParam + err error + }{ + { + name: "invalid: authority address invalid", + msg: MsgUpdateParam{ + Authority: "invalid_address", + Name: "", // Doesn't matter for this test + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "invalid: param name incorrect (non-existent)", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: "non_existent", + // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + err: ErrSupplierParamInvalid, + }, { + name: "valid: correct address, param name, and type", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: "", + // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/supplier/types/tx.pb.go b/x/supplier/types/tx.pb.go index d08f9199e..0c48ba0c3 100644 --- a/x/supplier/types/tx.pb.go +++ b/x/supplier/types/tx.pb.go @@ -303,6 +303,133 @@ func (m *MsgUnstakeSupplierResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnstakeSupplierResponse proto.InternalMessageInfo +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` +} + +func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } +func (m *MsgUpdateParam) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParam) ProtoMessage() {} +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return fileDescriptor_63b974929807ef57, []int{6} +} +func (m *MsgUpdateParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *MsgUpdateParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParam.Merge(m, src) +} +func (m *MsgUpdateParam) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParam) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParam.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *types.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin,omitempty"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + +func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if m != nil { + return m.AsType + } + return nil +} + +func (m *MsgUpdateParam) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParam) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgUpdateParam) GetAsCoin() *types.Coin { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } +} + +type MsgUpdateParamResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *MsgUpdateParamResponse) Reset() { *m = MsgUpdateParamResponse{} } +func (m *MsgUpdateParamResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamResponse) ProtoMessage() {} +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_63b974929807ef57, []int{7} +} +func (m *MsgUpdateParamResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *MsgUpdateParamResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamResponse.Merge(m, src) +} +func (m *MsgUpdateParamResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamResponse proto.InternalMessageInfo + +func (m *MsgUpdateParamResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.supplier.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.supplier.MsgUpdateParamsResponse") @@ -310,49 +437,57 @@ func init() { proto.RegisterType((*MsgStakeSupplierResponse)(nil), "poktroll.supplier.MsgStakeSupplierResponse") proto.RegisterType((*MsgUnstakeSupplier)(nil), "poktroll.supplier.MsgUnstakeSupplier") proto.RegisterType((*MsgUnstakeSupplierResponse)(nil), "poktroll.supplier.MsgUnstakeSupplierResponse") + proto.RegisterType((*MsgUpdateParam)(nil), "poktroll.supplier.MsgUpdateParam") + proto.RegisterType((*MsgUpdateParamResponse)(nil), "poktroll.supplier.MsgUpdateParamResponse") } func init() { proto.RegisterFile("poktroll/supplier/tx.proto", fileDescriptor_63b974929807ef57) } var fileDescriptor_63b974929807ef57 = []byte{ - // 588 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x31, 0x8f, 0x12, 0x41, - 0x18, 0x65, 0x41, 0x88, 0x0c, 0x77, 0xe1, 0x6e, 0x73, 0xc9, 0x2d, 0x1b, 0x5d, 0x09, 0x17, 0x0d, - 0xc1, 0xb0, 0x23, 0x98, 0x5c, 0x71, 0xd1, 0x42, 0xa8, 0x89, 0x06, 0x62, 0x63, 0xe1, 0x65, 0x80, - 0x71, 0xd8, 0x00, 0x3b, 0x9b, 0x99, 0x81, 0xbb, 0xeb, 0x8c, 0xa5, 0x95, 0xa5, 0x3f, 0xc1, 0x92, - 0xc2, 0xc2, 0xce, 0xf6, 0x62, 0x75, 0xb1, 0xba, 0xca, 0x18, 0x28, 0xf8, 0x1b, 0x66, 0x77, 0x67, - 0x40, 0x16, 0x94, 0x33, 0x36, 0xc0, 0xcc, 0x7b, 0xef, 0xfb, 0xde, 0xbc, 0xf9, 0x06, 0x60, 0x7a, - 0xb4, 0x2f, 0x18, 0x1d, 0x0c, 0x20, 0x1f, 0x79, 0xde, 0xc0, 0xc1, 0x0c, 0x8a, 0x73, 0xdb, 0x63, - 0x54, 0x50, 0x7d, 0x5f, 0x61, 0xb6, 0xc2, 0xcc, 0x7d, 0x34, 0x74, 0x5c, 0x0a, 0x83, 0xcf, 0x90, - 0x65, 0x1e, 0x76, 0x28, 0x1f, 0x52, 0x0e, 0x87, 0x9c, 0xc0, 0x71, 0xc5, 0xff, 0x92, 0x40, 0x2e, - 0x04, 0x4e, 0x83, 0x15, 0x0c, 0x17, 0x12, 0x3a, 0x20, 0x94, 0xd0, 0x70, 0xdf, 0xff, 0x25, 0x77, - 0x2d, 0x59, 0xa9, 0x8d, 0x38, 0x86, 0xe3, 0x4a, 0x1b, 0x0b, 0x54, 0x81, 0x1d, 0xea, 0xb8, 0x0a, - 0x5f, 0xf7, 0xea, 0x21, 0x86, 0x86, 0xaa, 0xea, 0xdd, 0x25, 0xde, 0x43, 0x0c, 0x77, 0x21, 0xc7, - 0x6c, 0xec, 0x74, 0x70, 0x08, 0x17, 0xbe, 0x6a, 0x20, 0xdb, 0xe0, 0xe4, 0xa5, 0xd7, 0x45, 0x02, - 0xbf, 0x08, 0x84, 0xfa, 0x31, 0x48, 0xa3, 0x91, 0xe8, 0x51, 0xe6, 0x88, 0x0b, 0x43, 0xcb, 0x6b, - 0xc5, 0x74, 0xcd, 0xf8, 0xfe, 0xb9, 0x7c, 0x20, 0xdd, 0x3e, 0xeb, 0x76, 0x19, 0xe6, 0xbc, 0x25, - 0x98, 0xe3, 0x92, 0xe6, 0x92, 0xaa, 0x3f, 0x01, 0xa9, 0xb0, 0xb5, 0x11, 0xcf, 0x6b, 0xc5, 0x4c, - 0x35, 0x67, 0xaf, 0x65, 0x65, 0x87, 0x2d, 0x6a, 0xe9, 0xcb, 0x1f, 0xf7, 0x62, 0x9f, 0xe6, 0x93, - 0x92, 0xd6, 0x94, 0x9a, 0x93, 0xe3, 0x77, 0xf3, 0x49, 0x69, 0x59, 0xed, 0xfd, 0x7c, 0x52, 0x3a, - 0x5a, 0x78, 0x3f, 0x5f, 0x9e, 0x2e, 0xe2, 0xb6, 0x90, 0x03, 0x87, 0x91, 0xad, 0x26, 0xe6, 0x1e, - 0x75, 0x39, 0x2e, 0x7c, 0x8b, 0x83, 0xbd, 0x06, 0x27, 0x2d, 0x81, 0xfa, 0xb8, 0x25, 0xf5, 0xfa, - 0x23, 0x90, 0xe2, 0x0e, 0x71, 0x31, 0xdb, 0x7a, 0x34, 0xc9, 0xd3, 0x9f, 0x82, 0x5d, 0x7a, 0xe6, - 0x62, 0x76, 0x8a, 0x42, 0x38, 0x38, 0xde, 0xdf, 0x84, 0x3b, 0x01, 0x5d, 0xee, 0xe9, 0x75, 0xb0, - 0x47, 0x3d, 0xcc, 0x90, 0xa0, 0xcb, 0x0a, 0x89, 0x2d, 0x15, 0xb2, 0x4a, 0xa1, 0x8a, 0x40, 0x90, - 0xe4, 0xfe, 0x31, 0x8c, 0x5b, 0x32, 0x5a, 0x29, 0xf3, 0xc7, 0xc2, 0x96, 0x63, 0x61, 0xd7, 0xa9, - 0xe3, 0x36, 0x43, 0x9e, 0x5e, 0x03, 0xb7, 0xe5, 0x4d, 0x73, 0x23, 0x99, 0x4f, 0x14, 0x33, 0xd5, - 0x07, 0xbf, 0x5d, 0x47, 0x30, 0x0a, 0xb6, 0xca, 0xa4, 0x15, 0x12, 0xeb, 0xd4, 0x7d, 0xe3, 0x90, - 0xe6, 0x42, 0x77, 0x92, 0xf1, 0xaf, 0x44, 0xa6, 0x50, 0x30, 0x81, 0x11, 0xcd, 0x72, 0x11, 0xf4, - 0x47, 0x0d, 0xe8, 0xfe, 0x25, 0xb8, 0xfc, 0x3f, 0xa3, 0xde, 0x94, 0x55, 0xfc, 0x1f, 0xb3, 0x5a, - 0xb5, 0x7d, 0x07, 0x98, 0xeb, 0xce, 0x94, 0xf1, 0xea, 0x97, 0x38, 0x48, 0x34, 0x38, 0xd1, 0x5f, - 0x83, 0x9d, 0x95, 0x27, 0x50, 0xd8, 0x30, 0xba, 0x91, 0x29, 0x33, 0x4b, 0xdb, 0x39, 0xaa, 0x8f, - 0x8e, 0xc0, 0xee, 0xea, 0x14, 0x1e, 0x6d, 0x16, 0xaf, 0x90, 0xcc, 0x87, 0x37, 0x20, 0x2d, 0x5a, - 0x10, 0x90, 0x8d, 0xe6, 0x7f, 0xff, 0x0f, 0x0e, 0x57, 0x69, 0x66, 0xf9, 0x46, 0x34, 0xd5, 0xc8, - 0x4c, 0xbe, 0xf5, 0xdf, 0x6d, 0xed, 0xf9, 0xe5, 0xd4, 0xd2, 0xae, 0xa6, 0x96, 0x76, 0x3d, 0xb5, - 0xb4, 0x9f, 0x53, 0x4b, 0xfb, 0x30, 0xb3, 0x62, 0x57, 0x33, 0x2b, 0x76, 0x3d, 0xb3, 0x62, 0xaf, - 0x2a, 0xc4, 0x11, 0xbd, 0x51, 0xdb, 0xee, 0xd0, 0x21, 0xf4, 0xab, 0x97, 0x5d, 0x2c, 0xce, 0x28, - 0xeb, 0xc3, 0x4d, 0x4f, 0x5a, 0x5c, 0x78, 0x98, 0xb7, 0x53, 0xc1, 0x3f, 0xd2, 0xe3, 0x5f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xb5, 0x70, 0x92, 0x1e, 0x7e, 0x05, 0x00, 0x00, + // 678 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xbf, 0x6f, 0xd3, 0x4e, + 0x14, 0xcf, 0x35, 0x6d, 0xbe, 0xed, 0x4b, 0x7f, 0x9e, 0xaa, 0x6f, 0x53, 0x0b, 0x4c, 0x49, 0x05, + 0x2a, 0x41, 0xf5, 0x91, 0x82, 0x3a, 0x54, 0x30, 0x90, 0x2e, 0x48, 0xa8, 0x02, 0x39, 0xb0, 0x80, + 0x44, 0x75, 0x49, 0x0e, 0xd7, 0x6a, 0xe3, 0xb3, 0xee, 0xae, 0xbf, 0x36, 0xc4, 0xc8, 0xc4, 0x82, + 0xc4, 0x9f, 0xc0, 0xc0, 0xd0, 0x81, 0x9d, 0xb5, 0x62, 0xaa, 0x98, 0x3a, 0x21, 0x94, 0x0e, 0xfd, + 0x37, 0x90, 0xed, 0xb3, 0x53, 0xa7, 0xa1, 0x2e, 0xb0, 0x24, 0xe7, 0x7b, 0x9f, 0xcf, 0xbb, 0xcf, + 0x7d, 0xde, 0x7b, 0x07, 0x86, 0xcf, 0x37, 0x95, 0xe0, 0x5b, 0x5b, 0x44, 0x6e, 0xfb, 0xfe, 0x96, + 0xcb, 0x04, 0x51, 0x7b, 0x96, 0x2f, 0xb8, 0xe2, 0x78, 0x2a, 0x8e, 0x59, 0x71, 0xcc, 0x98, 0xa2, + 0x6d, 0xd7, 0xe3, 0x24, 0xfc, 0x8d, 0x50, 0xc6, 0x4c, 0x93, 0xcb, 0x36, 0x97, 0xa4, 0x2d, 0x1d, + 0xb2, 0x53, 0x0d, 0xfe, 0x74, 0x60, 0x36, 0x0a, 0xac, 0x87, 0x5f, 0x24, 0xfa, 0xd0, 0xa1, 0x69, + 0x87, 0x3b, 0x3c, 0xda, 0x0f, 0x56, 0x7a, 0xd7, 0xd4, 0x99, 0x1a, 0x54, 0x32, 0xb2, 0x53, 0x6d, + 0x30, 0x45, 0xab, 0xa4, 0xc9, 0x5d, 0x2f, 0x8e, 0x9f, 0xd7, 0xea, 0x53, 0x41, 0xdb, 0x71, 0xd6, + 0xab, 0xdd, 0xf8, 0x06, 0x15, 0xac, 0x45, 0x24, 0x13, 0x3b, 0x6e, 0x93, 0x45, 0xe1, 0xf2, 0x57, + 0x04, 0x13, 0x6b, 0xd2, 0x79, 0xee, 0xb7, 0xa8, 0x62, 0x4f, 0x43, 0x22, 0x5e, 0x86, 0x11, 0xba, + 0xad, 0x36, 0xb8, 0x70, 0xd5, 0x7e, 0x09, 0xcd, 0xa1, 0x85, 0x91, 0x5a, 0xe9, 0xfb, 0x97, 0xc5, + 0x69, 0xad, 0xf6, 0x61, 0xab, 0x25, 0x98, 0x94, 0x75, 0x25, 0x5c, 0xcf, 0xb1, 0xbb, 0x50, 0x7c, + 0x1f, 0x0a, 0xd1, 0xd1, 0xa5, 0x81, 0x39, 0xb4, 0x50, 0x5c, 0x9a, 0xb5, 0xce, 0x79, 0x65, 0x45, + 0x47, 0xd4, 0x46, 0x0e, 0x7f, 0x5c, 0xcb, 0x7d, 0x3a, 0x3d, 0xa8, 0x20, 0x5b, 0x73, 0x56, 0x96, + 0xdf, 0x9e, 0x1e, 0x54, 0xba, 0xd9, 0xde, 0x9d, 0x1e, 0x54, 0xe6, 0x13, 0xed, 0x7b, 0xdd, 0xdb, + 0xf5, 0xa8, 0x2d, 0xcf, 0xc2, 0x4c, 0xcf, 0x96, 0xcd, 0xa4, 0xcf, 0x3d, 0xc9, 0xca, 0xdf, 0x06, + 0x60, 0x72, 0x4d, 0x3a, 0x75, 0x45, 0x37, 0x59, 0x5d, 0xf3, 0xf1, 0x1d, 0x28, 0x48, 0xd7, 0xf1, + 0x98, 0xc8, 0xbc, 0x9a, 0xc6, 0xe1, 0x07, 0x30, 0xc6, 0x77, 0x3d, 0x26, 0xd6, 0x69, 0x14, 0x0e, + 0xaf, 0x77, 0x11, 0x71, 0x34, 0x84, 0xeb, 0x3d, 0xbc, 0x0a, 0x93, 0xdc, 0x67, 0x82, 0x2a, 0xde, + 0xcd, 0x90, 0xcf, 0xc8, 0x30, 0x11, 0x33, 0xe2, 0x24, 0x04, 0x86, 0x64, 0x70, 0x8d, 0xd2, 0xa0, + 0xb6, 0x56, 0xd3, 0x82, 0xb6, 0xb0, 0x74, 0x5b, 0x58, 0xab, 0xdc, 0xf5, 0xec, 0x08, 0x87, 0x6b, + 0x30, 0xac, 0x2b, 0x2d, 0x4b, 0x43, 0x73, 0xf9, 0x85, 0xe2, 0xd2, 0xcd, 0x33, 0xe5, 0x08, 0x5b, + 0xc1, 0x8a, 0x3d, 0xa9, 0x47, 0xc0, 0x55, 0xee, 0xbd, 0x76, 0x1d, 0x3b, 0xe1, 0xad, 0x14, 0x83, + 0x92, 0x68, 0x17, 0xca, 0x06, 0x94, 0x7a, 0xbd, 0x4c, 0x8c, 0xfe, 0x88, 0x00, 0x07, 0x45, 0xf0, + 0xe4, 0x3f, 0x5a, 0xdd, 0xcf, 0xab, 0x81, 0x3f, 0xf4, 0x2a, 0x2d, 0xfb, 0x0a, 0x18, 0xe7, 0x95, + 0x25, 0xc2, 0x3f, 0x23, 0x18, 0x4f, 0x77, 0xcf, 0x5f, 0x77, 0x3f, 0x86, 0x41, 0x8f, 0xb6, 0x59, + 0x24, 0xd7, 0x0e, 0xd7, 0xf8, 0x1e, 0xfc, 0x47, 0xe5, 0x7a, 0x30, 0xad, 0x61, 0xc5, 0x2f, 0xaa, + 0xdb, 0xa3, 0x9c, 0x5d, 0xa0, 0x32, 0x58, 0xad, 0x8c, 0xa7, 0x27, 0xa1, 0x36, 0x0c, 0x05, 0x2a, + 0x9f, 0xed, 0xfb, 0xac, 0xfc, 0x18, 0xfe, 0x4f, 0xab, 0x8d, 0x2f, 0x82, 0xab, 0xc9, 0xec, 0xa1, + 0x8c, 0xd9, 0x8b, 0x07, 0x6e, 0xe9, 0x43, 0x1e, 0xf2, 0x6b, 0xd2, 0xc1, 0xaf, 0x60, 0x34, 0x35, + 0xfe, 0xe5, 0x3e, 0xd4, 0x9e, 0x09, 0x33, 0x2a, 0xd9, 0x98, 0x44, 0x1a, 0x85, 0xb1, 0xf4, 0x04, + 0xce, 0xf7, 0x27, 0xa7, 0x40, 0xc6, 0xed, 0x4b, 0x80, 0x92, 0x23, 0x1c, 0x98, 0xe8, 0xed, 0xbd, + 0x1b, 0xbf, 0x51, 0x98, 0x86, 0x19, 0x8b, 0x97, 0x82, 0x25, 0x07, 0xbd, 0x84, 0xe2, 0xd9, 0x5e, + 0xb9, 0x9e, 0x69, 0x83, 0x71, 0x2b, 0x13, 0x12, 0x27, 0x37, 0x86, 0xde, 0x04, 0x0f, 0x62, 0xed, + 0xc9, 0x61, 0xc7, 0x44, 0x47, 0x1d, 0x13, 0x1d, 0x77, 0x4c, 0xf4, 0xb3, 0x63, 0xa2, 0xf7, 0x27, + 0x66, 0xee, 0xe8, 0xc4, 0xcc, 0x1d, 0x9f, 0x98, 0xb9, 0x17, 0x55, 0xc7, 0x55, 0x1b, 0xdb, 0x0d, + 0xab, 0xc9, 0xdb, 0x24, 0xc8, 0xbc, 0xe8, 0x31, 0xb5, 0xcb, 0xc5, 0x26, 0xe9, 0xf7, 0x56, 0xaa, + 0x7d, 0x9f, 0xc9, 0x46, 0x21, 0x7c, 0xea, 0xef, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x63, + 0xdc, 0x7f, 0xd7, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -372,6 +507,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) StakeSupplier(ctx context.Context, in *MsgStakeSupplier, opts ...grpc.CallOption) (*MsgStakeSupplierResponse, error) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, opts ...grpc.CallOption) (*MsgUnstakeSupplierResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -409,6 +545,15 @@ func (c *msgClient) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, "/poktroll.supplier.Msg/UpdateParam", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module @@ -416,6 +561,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) StakeSupplier(context.Context, *MsgStakeSupplier) (*MsgStakeSupplierResponse, error) UnstakeSupplier(context.Context, *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -431,6 +577,9 @@ func (*UnimplementedMsgServer) StakeSupplier(ctx context.Context, req *MsgStakeS func (*UnimplementedMsgServer) UnstakeSupplier(ctx context.Context, req *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnstakeSupplier not implemented") } +func (*UnimplementedMsgServer) UpdateParam(ctx context.Context, req *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -490,6 +639,24 @@ func _Msg_UnstakeSupplier_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.supplier.Msg/UpdateParam", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "poktroll.supplier.Msg", HandlerType: (*MsgServer)(nil), @@ -506,6 +673,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UnstakeSupplier", Handler: _Msg_UnstakeSupplier_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/supplier/tx.proto", @@ -727,6 +898,108 @@ func (m *MsgUnstakeSupplierResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *MsgUpdateParam) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AsType != nil { + { + size := m.AsType.Size() + i -= size + if _, err := m.AsType.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsCoin != nil { + { + size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *MsgUpdateParamResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -828,6 +1101,51 @@ func (m *MsgUnstakeSupplierResponse) Size() (n int) { return n } +func (m *MsgUpdateParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AsType != nil { + n += m.AsType.Size() + } + return n +} + +func (m *MsgUpdateParam_AsCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsCoin != nil { + l = m.AsCoin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} +func (m *MsgUpdateParamResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1429,6 +1747,241 @@ func (m *MsgUnstakeSupplierResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types.Coin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.AsType = &MsgUpdateParam_AsCoin{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From c8f5230f1250f30064e90b53ceb3dedb44c62d2b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 13:38:38 +0200 Subject: [PATCH 06/13] [Supplier] Add `min_stake` supplier module param (#850) ## Summary - Adds the `min_stake` param to the supplier module following section 0 from the updated docs (see https://github.com/pokt-network/poktroll/pull/839). - Adds missing validation unit test coverage around existing application module param, max_delegated_gateways. - Pushes validation from the MsgUpdateParam handler down into MsgUpdateParam#ValidateBasic(). - Ensures Params#Valid() is called prior to setting params in MsgUpdateParam handler. - Updates error returns in the same handler to ensure all error paths return appropriate gRPC status errors. ## Dependencies - #809 - #843 - #844 - #845 - #847 - #848 - #849 ## Dependents - #857 - #852 - #861 - #851 - #863 ## Issue - #612 ## Type of change Select one or more from the following: - [x] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [x] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- api/poktroll/supplier/params.pulsar.go | 147 +++++++++++++++--- config.yml | 5 + makefiles/params.mk | 15 +- proto/poktroll/supplier/params.proto | 5 + testutil/integration/suites/param_configs.go | 7 +- tools/scripts/params/supplier_all.json | 16 ++ tools/scripts/params/supplier_min_stake.json | 15 ++ .../keeper/msg_server_stake_supplier.go | 58 ++++--- .../keeper/msg_server_stake_supplier_test.go | 9 +- x/supplier/keeper/msg_server_update_param.go | 56 +++++-- .../keeper/msg_server_update_param_test.go | 41 +++++ x/supplier/keeper/msg_update_params_test.go | 26 +++- x/supplier/keeper/params_test.go | 48 +++++- x/supplier/types/genesis_test.go | 12 ++ x/supplier/types/message_update_param.go | 24 ++- x/supplier/types/message_update_param_test.go | 8 +- x/supplier/types/params.go | 61 +++++++- x/supplier/types/params.pb.go | 90 +++++++++-- 18 files changed, 544 insertions(+), 99 deletions(-) create mode 100644 tools/scripts/params/supplier_all.json create mode 100644 tools/scripts/params/supplier_min_stake.json create mode 100644 x/supplier/keeper/msg_server_update_param_test.go diff --git a/api/poktroll/supplier/params.pulsar.go b/api/poktroll/supplier/params.pulsar.go index da1387d1d..bb3c96973 100644 --- a/api/poktroll/supplier/params.pulsar.go +++ b/api/poktroll/supplier/params.pulsar.go @@ -3,6 +3,7 @@ package supplier import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,12 +16,14 @@ import ( ) var ( - md_Params protoreflect.MessageDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_min_stake protoreflect.FieldDescriptor ) func init() { file_poktroll_supplier_params_proto_init() md_Params = File_poktroll_supplier_params_proto.Messages().ByName("Params") + fd_Params_min_stake = md_Params.Fields().ByName("min_stake") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -88,6 +91,12 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.MinStake != nil { + value := protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) + if !f(fd_Params_min_stake, value) { + return + } + } } // Has reports whether a field is populated. @@ -103,6 +112,8 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + return x.MinStake != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -119,6 +130,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + x.MinStake = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -135,6 +148,9 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "poktroll.supplier.Params.min_stake": + value := x.MinStake + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -155,6 +171,8 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + x.MinStake = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -175,6 +193,11 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + if x.MinStake == nil { + x.MinStake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -188,6 +211,9 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -257,6 +283,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l + if x.MinStake != nil { + l = options.Size(x.MinStake) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -286,6 +316,20 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.MinStake != nil { + encoded, err := options.Marshal(x.MinStake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -335,6 +379,42 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.MinStake == nil { + x.MinStake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MinStake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -388,6 +468,10 @@ type Params struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // min_stake is the minimum amount of uPOKT that a supplier must stake to be + // included in network sessions and remain staked. + MinStake *v1beta1.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` } func (x *Params) Reset() { @@ -410,6 +494,13 @@ func (*Params) Descriptor() ([]byte, []int) { return file_poktroll_supplier_params_proto_rawDescGZIP(), []int{0} } +func (x *Params) GetMinStake() *v1beta1.Coin { + if x != nil { + return x.MinStake + } + return nil +} + var File_poktroll_supplier_params_proto protoreflect.FileDescriptor var file_poktroll_supplier_params_proto_rawDesc = []byte{ @@ -418,22 +509,30 @@ var file_poktroll_supplier_params_proto_rawDesc = []byte{ 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x06, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x23, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, - 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xb1, 0x01, 0xd8, 0xe2, - 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, - 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x01, 0x0a, + 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x21, 0xea, 0xde, 0x1f, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0xf2, 0xde, 0x1f, 0x10, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, + 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x22, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x3a, 0x23, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x1a, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xb1, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -450,14 +549,16 @@ func file_poktroll_supplier_params_proto_rawDescGZIP() []byte { var file_poktroll_supplier_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_supplier_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: poktroll.supplier.Params + (*Params)(nil), // 0: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } var file_poktroll_supplier_params_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: poktroll.supplier.Params.min_stake:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_supplier_params_proto_init() } diff --git a/config.yml b/config.yml index 57db72f1a..5ce114e81 100644 --- a/config.yml +++ b/config.yml @@ -193,6 +193,11 @@ genesis: amount: "100000068" # ~100 POKT denom: upokt supplier: + params: + # TODO_MAINNET: Determine realistic amount for minimum gateway stake amount. + min_stake: + amount: "1000000" # 1 POKT + denom: upokt supplierList: - owner_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj operator_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj diff --git a/makefiles/params.mk b/makefiles/params.mk index 17faca295..e2f736f10 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -111,7 +111,7 @@ params_get_gateway: ## Get the gateway module params poktrolld query gateway params --node $(POCKET_NODE) .PHONY: params_update_gateway_all -params_update_gateway_all: ## Update the session module params +params_update_gateway_all: ## Update the gateway module params poktrolld tx authz exec ./tools/scripts/params/gateway_all.json $(PARAM_FLAGS) .PHONY: params_update_gateway_min_stake @@ -135,6 +135,19 @@ params_update_application_max_delegated_gateways: ## Update the application modu params_update_application_min_stake: ## Update the application module min_stake param poktrolld tx authz exec ./tools/scripts/params/application_min_stake.json $(PARAM_FLAGS) +### Supplier Module Params ### +.PHONY: params_get_supplier +params_get_supplier: ## Get the supplier module params + poktrolld query supplier params --node $(POCKET_NODE) + +.PHONY: params_update_supplier_all +params_update_supplier_all: ## Update the supplier module params + poktrolld tx authz exec ./tools/scripts/params/supplier_all.json $(PARAM_FLAGS) + +.PHONY: params_update_supplier_min_stake +params_update_supplier_min_stake: ## Update the supplier module min_stake param + poktrolld tx authz exec ./tools/scripts/params/supplier_min_stake.json $(PARAM_FLAGS) + .PHONY: params_query_all params_query_all: check_jq ## Query the params from all available modules @for module in $(MODULES); do \ diff --git a/proto/poktroll/supplier/params.proto b/proto/poktroll/supplier/params.proto index ea532e61c..d4e8c77ec 100644 --- a/proto/poktroll/supplier/params.proto +++ b/proto/poktroll/supplier/params.proto @@ -6,9 +6,14 @@ option (gogoproto.stable_marshaler_all) = true; import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/supplier/Params"; option (gogoproto.equal) = true; + + // min_stake is the minimum amount of uPOKT that a supplier must stake to be + // included in network sessions and remain staked. + cosmos.base.v1beta1.Coin min_stake = 1 [(gogoproto.jsontag) = "min_stake", (gogoproto.moretags) = "yaml:\"min_stake\""]; } diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 740a7693d..1c1a9ac4f 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -183,7 +183,12 @@ var ( QueryParamsRequest: suppliertypes.QueryParamsRequest{}, QueryParamsResponse: suppliertypes.QueryParamsResponse{}, }, - ValidParams: suppliertypes.Params{}, + ValidParams: suppliertypes.Params{ + MinStake: &ValidActorMinStake, + }, + ParamTypes: map[ParamType]any{ + ParamTypeCoin: suppliertypes.MsgUpdateParam_AsCoin{}, + }, DefaultParams: suppliertypes.DefaultParams(), NewParamClientFn: suppliertypes.NewQueryClient, } diff --git a/tools/scripts/params/supplier_all.json b/tools/scripts/params/supplier_all.json new file mode 100644 index 000000000..cded3172f --- /dev/null +++ b/tools/scripts/params/supplier_all.json @@ -0,0 +1,16 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.supplier.MsgUpdateParams", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "params": { + "min_stake": { + "amount": "1000000", + "denom": "upokt" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tools/scripts/params/supplier_min_stake.json b/tools/scripts/params/supplier_min_stake.json new file mode 100644 index 000000000..fa96d860c --- /dev/null +++ b/tools/scripts/params/supplier_min_stake.json @@ -0,0 +1,15 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.supplier.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "min_stake", + "as_coin": { + "amount": "1000000", + "denom": "upokt" + } + } + ] + } +} diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index d3478cab7..f750b99ff 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -5,6 +5,8 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/telemetry" "github.com/pokt-network/poktroll/x/shared" @@ -25,15 +27,18 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie // ValidateBasic also validates that the msg signer is the owner or operator of the supplier if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) - return nil, err + logger.Info(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Check if the services the supplier is staking for exist for _, serviceConfig := range msg.Services { if _, serviceFound := k.serviceKeeper.GetService(ctx, serviceConfig.ServiceId); !serviceFound { - logger.Error(fmt.Sprintf("service %q does not exist", serviceConfig.ServiceId)) - return nil, types.ErrSupplierServiceNotFound.Wrapf("service %q does not exist", serviceConfig.ServiceId) + logger.Info(fmt.Sprintf("service %q does not exist", serviceConfig.ServiceId)) + return nil, status.Error( + codes.InvalidArgument, + types.ErrSupplierServiceNotFound.Wrapf("service %q does not exist", serviceConfig.ServiceId).Error(), + ) } } @@ -52,40 +57,42 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie // Ensure the signer is either the owner or the operator of the supplier. if !msg.IsSigner(supplier.OwnerAddress) && !msg.IsSigner(supplier.OperatorAddress) { - return nil, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( - "signer address %s does not match owner address %s or supplier operator address %s", - msg.Signer, - msg.OwnerAddress, - msg.OperatorAddress, + return nil, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( + "signer address %s does not match owner address %s or supplier operator address %s", + msg.Signer, msg.OwnerAddress, msg.OperatorAddress, + ).Error(), ) } // Ensure that only the owner can change the OwnerAddress. // (i.e. fail if owner address changed and the owner is not the msg signer) if !supplier.HasOwner(msg.OwnerAddress) && !msg.IsSigner(supplier.OwnerAddress) { - logger.Error("only the supplier owner is allowed to update the owner address") - - return nil, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( + err = sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( "signer %q is not allowed to update the owner address %q", - msg.Signer, - supplier.OwnerAddress, + msg.Signer, supplier.OwnerAddress, ) + logger.Info(fmt.Sprintf("ERROR: %s", err)) + + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Ensure that the operator addresses cannot be changed. This is because changing // it mid-session invalidates the current session. if !supplier.HasOperator(msg.OperatorAddress) { - logger.Error("updating the supplier's operator address forbidden") - - return nil, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrap( + err = sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrap( "updating the operator address is forbidden, unstake then re-stake with the updated operator address", ) + logger.Info(fmt.Sprintf("ERROR: %s", err)) + + return nil, status.Error(codes.InvalidArgument, err.Error()) } currSupplierStake := *supplier.Stake if err = k.updateSupplier(ctx, &supplier, msg); err != nil { - logger.Error(fmt.Sprintf("could not update supplier for address %q due to error %v", msg.OperatorAddress, err)) - return nil, err + logger.Info(fmt.Sprintf("ERROR: could not update supplier for address %q due to error %v", msg.OperatorAddress, err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } coinsToEscrow, err = (*msg.Stake).SafeSub(currSupplierStake) if err != nil { @@ -99,22 +106,23 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie // Must always stake or upstake (> 0 delta) if coinsToEscrow.IsZero() { - logger.Warn(fmt.Sprintf("Signer %q must escrow more than 0 additional coins", msg.Signer)) - return nil, types.ErrSupplierInvalidStake.Wrapf("Signer %q must escrow more than 0 additional coins", msg.Signer) + err = types.ErrSupplierInvalidStake.Wrapf("Signer %q must escrow more than 0 additional coins", msg.Signer) + logger.Info(fmt.Sprintf("WARN: %s", err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Retrieve the account address of the message signer msgSignerAddress, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { - logger.Error(fmt.Sprintf("could not parse address %q", msg.Signer)) - return nil, err + logger.Info(fmt.Sprintf("ERROR: could not parse address %q", msg.Signer)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Send the coins from the message signer account to the staked supplier pool err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, msgSignerAddress, types.ModuleName, []sdk.Coin{coinsToEscrow}) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %q to %q module account due to %v", coinsToEscrow, msgSignerAddress, types.ModuleName, err)) - return nil, err + logger.Info(fmt.Sprintf("ERROR: could not send %v coins from %q to %q module account due to %v", coinsToEscrow, msgSignerAddress, types.ModuleName, err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } logger.Info(fmt.Sprintf("Successfully escrowed %v coins from %q to %q module account", coinsToEscrow, msgSignerAddress, types.ModuleName)) diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index 5c35f3625..a4c1b5815 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -157,7 +157,9 @@ func TestMsgServer_StakeSupplier_FailWithNonExistingService(t *testing.T) { // Stake the supplier & verify that it fails because the service does not exist. _, err := srv.StakeSupplier(ctx, stakeMsg) - require.ErrorIs(t, err, types.ErrSupplierServiceNotFound) + require.ErrorContains(t, err, types.ErrSupplierServiceNotFound.Wrapf( + "service %q does not exist", "newService", + ).Error()) } func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { @@ -248,7 +250,10 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { stakeMsgUpdateOwner.OwnerAddress = newOwnerAddress setStakeMsgSigner(stakeMsgUpdateOwner, operatorAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateOwner) - require.ErrorIs(t, err, sharedtypes.ErrSharedUnauthorizedSupplierUpdate) + require.ErrorContains(t, err, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( + "signer %q is not allowed to update the owner address %q", + operatorAddr, ownerAddr, + ).Error()) // Update the supplier's owner address using the owner as a signer and verify that it succeeds. setStakeMsgSigner(stakeMsgUpdateOwner, ownerAddr) diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go index 35efa6581..47e96f528 100644 --- a/x/supplier/keeper/msg_server_update_param.go +++ b/x/supplier/keeper/msg_server_update_param.go @@ -2,6 +2,10 @@ package keeper import ( "context" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -9,29 +13,53 @@ import ( // UpdateParam updates a single parameter in the proof module and returns // all active parameters. func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdateParam) (*suppliertypes.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, suppliertypes.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + suppliertypes.ErrSupplierInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } - // TODO_UPNEXT(@bryanchriswhite, #612): uncomment & add a min_stake case. - - //params := k.GetParams(ctx) + params := k.GetParams(ctx) switch msg.Name { + case suppliertypes.ParamMinStake: + logger = logger.With("min_stake", msg.GetAsCoin()) + params.MinStake = msg.GetAsCoin() default: - return nil, suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) + } + + // Perform a global validation on all params, which includes the updated param. + // This is needed to ensure that the updated param is valid in the context of all other params. + if err := params.Validate(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + if err := k.SetParams(ctx, params); err != nil { + err = fmt.Errorf("unable to set params: %v", err) + logger.Error(err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } - //if err := k.SetParams(ctx, params); err != nil { - // return nil, err - //} - // - //updatedParams := k.GetParams(ctx) - //return &suppliertypes.MsgUpdateParamResponse{ - // Params: &updatedParams, - //}, nil + updatedParams := k.GetParams(ctx) + + return &suppliertypes.MsgUpdateParamResponse{ + Params: &updatedParams, + }, nil } diff --git a/x/supplier/keeper/msg_server_update_param_test.go b/x/supplier/keeper/msg_server_update_param_test.go new file mode 100644 index 000000000..39795eb82 --- /dev/null +++ b/x/supplier/keeper/msg_server_update_param_test.go @@ -0,0 +1,41 @@ +package keeper_test + +import ( + "testing" + + cosmostypes "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app/volatile" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { + expectedMinStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 420) + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := suppliertypes.DefaultParams() + require.NoError(t, k.SetParams(ctx, defaultParams)) + + // Ensure the default values are different from the new values we want to set + require.NotEqual(t, expectedMinStake, defaultParams.MinStake) + + // Update the min relay difficulty bits + updateParamMsg := &suppliertypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: suppliertypes.ParamMinStake, + AsType: &suppliertypes.MsgUpdateParam_AsCoin{AsCoin: &expectedMinStake}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.MinStake, res.Params.MinStake) + require.Equal(t, expectedMinStake.Amount, res.Params.MinStake.Amount) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(suppliertypes.KeyMinStake)) +} diff --git a/x/supplier/keeper/msg_update_params_test.go b/x/supplier/keeper/msg_update_params_test.go index 9efd6db7d..5a0019a64 100644 --- a/x/supplier/keeper/msg_update_params_test.go +++ b/x/supplier/keeper/msg_update_params_test.go @@ -5,24 +5,24 @@ import ( "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/x/supplier/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) - params := types.DefaultParams() + params := suppliertypes.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) // default params tests := []struct { desc string - params *types.MsgUpdateParams + params *suppliertypes.MsgUpdateParams shouldError bool expectedErrMsg string }{ { desc: "invalid: authority address invalid", - params: &types.MsgUpdateParams{ + params: &suppliertypes.MsgUpdateParams{ Authority: "invalid", Params: params, }, @@ -30,16 +30,26 @@ func TestMsgUpdateParams(t *testing.T) { expectedErrMsg: "invalid authority", }, { - desc: "send empty params", - params: &types.MsgUpdateParams{ + desc: "invalid: send empty params", + params: &suppliertypes.MsgUpdateParams{ Authority: k.GetAuthority(), - Params: types.Params{}, + Params: suppliertypes.Params{}, + }, + shouldError: true, + }, + { + desc: "valid: send minimal params", + params: &suppliertypes.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: suppliertypes.Params{ + MinStake: &suppliertypes.DefaultMinStake, + }, }, shouldError: false, }, { desc: "valid: send default params", - params: &types.MsgUpdateParams{ + params: &suppliertypes.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, diff --git a/x/supplier/keeper/params_test.go b/x/supplier/keeper/params_test.go index a2e5fefc5..3d74b7813 100644 --- a/x/supplier/keeper/params_test.go +++ b/x/supplier/keeper/params_test.go @@ -3,16 +3,60 @@ package keeper_test import ( "testing" + "cosmossdk.io/math" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestGetParams(t *testing.T) { supplierModuleKeepers, ctx := keepertest.SupplierKeeper(t) - params := types.DefaultParams() + params := suppliertypes.DefaultParams() require.NoError(t, supplierModuleKeepers.SetParams(ctx, params)) require.EqualValues(t, params, supplierModuleKeepers.Keeper.GetParams(ctx)) } + +func TestParams_ValidateMinStake(t *testing.T) { + tests := []struct { + desc string + minStake any + expectedErr error + }{ + { + desc: "invalid type", + minStake: "420", + expectedErr: suppliertypes.ErrSupplierParamInvalid.Wrapf("invalid parameter type: string"), + }, + { + desc: "MinStake less than zero", + minStake: &cosmostypes.Coin{ + Denom: volatile.DenomuPOKT, + Amount: math.NewInt(-1), + }, + expectedErr: suppliertypes.ErrSupplierParamInvalid.Wrapf( + "min_stake amount must be greater than 0: got -1%s", + volatile.DenomuPOKT, + ), + }, + { + desc: "valid MinStake", + minStake: &suppliertypes.DefaultMinStake, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := suppliertypes.ValidateMinStake(test.minStake) + if test.expectedErr != nil { + require.Error(t, err) + require.Contains(t, err.Error(), test.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index 0e4301e3e..2b960fbb1 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/types/genesis_test.go @@ -66,6 +66,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "valid genesis state", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -87,6 +88,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - zero supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -107,6 +109,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - negative supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -127,6 +130,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - wrong stake denom", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -147,6 +151,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - missing denom", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -167,6 +172,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to duplicated supplier operator address", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -187,6 +193,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to nil supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -207,6 +214,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to missing supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -227,6 +235,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - missing services list", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -247,6 +256,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - empty services list", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -267,6 +277,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - invalid URL", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -304,6 +315,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - invalid RPC Type", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go index 5819e1ed2..0e6a1cc03 100644 --- a/x/supplier/types/message_update_param.go +++ b/x/supplier/types/message_update_param.go @@ -27,6 +27,10 @@ func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdatePara } } +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures: +// 1. The parameter name is supported. +// 2. The parameter type matches the expected type for a given parameter name. +// 3. The parameter value is valid (according to its respective validation function). func (msg *MsgUpdateParam) ValidateBasic() error { _, err := cosmostypes.AccAddressFromBech32(msg.Authority) if err != nil { @@ -40,10 +44,24 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name MUST be supported by this module. switch msg.Name { - // TODO_UPNEXT(@bryanchriswhite, #612): replace with min_stake param name and call validation function. - case "": - return nil + case ParamMinStake: + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateMinStake(msg.GetAsCoin()) default: return ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) } } + +// paramTypeIsCoin checks if the parameter type is a Coin, returning an error if not. +func (msg *MsgUpdateParam) paramTypeIsCoin() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsCoin); !ok { + return ErrSupplierParamInvalid.Wrapf( + "invalid type for param %q expected %T, got %T", + msg.Name, &MsgUpdateParam_AsCoin{}, + msg.AsType, + ) + } + return nil +} diff --git a/x/supplier/types/message_update_param_test.go b/x/supplier/types/message_update_param_test.go index 96136ded1..b259020b7 100644 --- a/x/supplier/types/message_update_param_test.go +++ b/x/supplier/types/message_update_param_test.go @@ -28,17 +28,15 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: "non_existent", - // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. - AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, }, err: ErrSupplierParamInvalid, }, { name: "valid: correct address, param name, and type", msg: MsgUpdateParam{ Authority: sample.AccAddress(), - Name: "", - // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. - AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + Name: ParamMinStake, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, }, }, } diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go index 95b0cf8a2..48a90f97d 100644 --- a/x/supplier/types/params.go +++ b/x/supplier/types/params.go @@ -1,8 +1,20 @@ package types -import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +import ( + cosmostypes "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -var _ paramtypes.ParamSet = (*Params)(nil) + "github.com/pokt-network/poktroll/app/volatile" +) + +var ( + _ paramtypes.ParamSet = (*Params)(nil) + + KeyMinStake = []byte("MinStake") + ParamMinStake = "min_stake" + // TODO_MAINNET: Determine the default value. + DefaultMinStake = cosmostypes.NewInt64Coin("upokt", 1000000) // 1 POKT +) // ParamKeyTable the param key table for launch module func ParamKeyTable() paramtypes.KeyTable { @@ -10,21 +22,58 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams() Params { - return Params{} +func NewParams(minStake *cosmostypes.Coin) Params { + return Params{ + MinStake: minStake, + } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() + return NewParams(&DefaultMinStake) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair( + KeyMinStake, + &p.MinStake, + ValidateMinStake, + ), + } } // Validate validates the set of params func (p Params) Validate() error { + if err := ValidateMinStake(p.MinStake); err != nil { + return err + } + + return nil +} + +// ValidateMinStake validates the MinStake param. +func ValidateMinStake(minStakeAny any) error { + minStakeCoin, ok := minStakeAny.(*cosmostypes.Coin) + if !ok { + return ErrSupplierParamInvalid.Wrapf("invalid parameter type: %T", minStakeAny) + } + + if minStakeCoin == nil { + return ErrSupplierParamInvalid.Wrapf("missing min_stake") + } + + if minStakeCoin.Denom != volatile.DenomuPOKT { + return ErrSupplierParamInvalid.Wrapf( + "invalid min_stake denom %q; expected %q", + minStakeCoin.Denom, volatile.DenomuPOKT, + ) + } + + if minStakeCoin.IsZero() || minStakeCoin.IsNegative() { + return ErrSupplierParamInvalid.Wrapf("min_stake amount must be greater than 0: got %s", minStakeCoin) + } + return nil } diff --git a/x/supplier/types/params.pb.go b/x/supplier/types/params.pb.go index 4400a9ef5..8a79db314 100644 --- a/x/supplier/types/params.pb.go +++ b/x/supplier/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + 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" @@ -26,6 +27,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // min_stake is the minimum amount of uPOKT that a supplier must stake to be + // included in network sessions and remain staked. + MinStake *types.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake" yaml:"min_stake"` } func (m *Params) Reset() { *m = Params{} } @@ -57,6 +61,13 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetMinStake() *types.Coin { + if m != nil { + return m.MinStake + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "poktroll.supplier.Params") } @@ -64,19 +75,25 @@ func init() { func init() { proto.RegisterFile("poktroll/supplier/params.proto", fileDescriptor_60f7a8031a8c22d5) } var fileDescriptor_60f7a8031a8c22d5 = []byte{ - // 181 bytes of a gzipped FileDescriptorProto + // 273 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x2e, 0x2d, 0x28, 0xc8, 0xc9, 0x4c, 0x2d, 0xd2, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x84, 0xc9, 0xeb, 0xc1, 0xe4, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x95, 0x94, 0x48, 0x7a, - 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x74, 0xb9, 0xd8, 0x02, 0xc0, 0x66, - 0x59, 0x29, 0xbf, 0x58, 0x20, 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x14, 0xdc, 0xba, 0x0a, 0x84, - 0x85, 0x10, 0x45, 0x4e, 0xfe, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, - 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, - 0xb1, 0x1c, 0x43, 0x94, 0x61, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, - 0xc8, 0x10, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x6c, 0x26, 0x96, 0x54, 0x16, - 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x9d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x2d, 0x7e, 0xc4, - 0x71, 0xe4, 0x00, 0x00, 0x00, + 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0xe5, 0x92, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, + 0xf5, 0x93, 0x12, 0x8b, 0x53, 0xf5, 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x93, 0xf3, + 0x33, 0xf3, 0x20, 0xf2, 0x4a, 0x1d, 0x8c, 0x5c, 0x6c, 0x01, 0x60, 0xcb, 0x84, 0x22, 0xb9, 0x38, + 0x73, 0x33, 0xf3, 0xe2, 0x8b, 0x4b, 0x12, 0xb3, 0x53, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, + 0x24, 0xf5, 0x20, 0xda, 0xf5, 0x40, 0xda, 0xf5, 0xa0, 0xda, 0xf5, 0x9c, 0xf3, 0x33, 0xf3, 0x9c, + 0x14, 0x5f, 0xdd, 0x93, 0x47, 0xa8, 0xff, 0x74, 0x4f, 0x5e, 0xa0, 0x32, 0x31, 0x37, 0xc7, 0x4a, + 0x09, 0x2e, 0xa4, 0x14, 0xc4, 0x91, 0x9b, 0x99, 0x17, 0x0c, 0x62, 0x5a, 0x29, 0xbf, 0x58, 0x20, + 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x14, 0xdc, 0xab, 0x15, 0x08, 0xcf, 0x42, 0xec, 0x77, 0xf2, + 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, + 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x0c, + 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x86, 0xe8, 0xe6, 0xa5, + 0x96, 0x94, 0xe7, 0x17, 0x65, 0xeb, 0x63, 0x33, 0xb1, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, + 0xec, 0x45, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x4d, 0x0e, 0x37, 0x60, 0x01, 0x00, + 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -98,6 +115,9 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } + if !this.MinStake.Equal(that1.MinStake) { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -120,6 +140,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinStake != nil { + { + size, err := m.MinStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -140,6 +172,10 @@ func (m *Params) Size() (n int) { } var l int _ = l + if m.MinStake != nil { + l = m.MinStake.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -178,6 +214,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinStake == nil { + m.MinStake = &types.Coin{} + } + if err := m.MinStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From e42f3e379235896bbf987ce1e4c2940cba3269ef Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 14:00:56 +0200 Subject: [PATCH 07/13] [Supplier] Enforce minimum stake when staking (#857) ## Summary 1. Adds minimum stake validation to the supplier stake message handler (i.e. total stake must be >= minimum stake). 2. Updates error returns in the same handler to ensure all error paths return appropriate gRPC status errors. ## Dependencies - #809 - #843 - #844 - #845 - #847 - #848 - #849 - #850 ## Dependents - #852 - #861 - #851 ## Issue - #612 ## Type of change Select one or more from the following: - [x] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- .../keeper/msg_server_stake_supplier.go | 16 ++- .../keeper/msg_server_stake_supplier_test.go | 118 ++++++++++++++---- .../msg_server_unstake_supplier_test.go | 28 ++--- 3 files changed, 120 insertions(+), 42 deletions(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index f750b99ff..3ed4add08 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -96,7 +96,8 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie } coinsToEscrow, err = (*msg.Stake).SafeSub(currSupplierStake) if err != nil { - return nil, err + logger.Info(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.Internal, err.Error()) } logger.Info(fmt.Sprintf("Supplier is going to escrow an additional %+v coins", coinsToEscrow)) @@ -104,13 +105,24 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie supplier.UnstakeSessionEndHeight = sharedtypes.SupplierNotUnstaking } - // Must always stake or upstake (> 0 delta) + // MUST ALWAYS stake or upstake (> 0 delta) if coinsToEscrow.IsZero() { err = types.ErrSupplierInvalidStake.Wrapf("Signer %q must escrow more than 0 additional coins", msg.Signer) logger.Info(fmt.Sprintf("WARN: %s", err)) return nil, status.Error(codes.InvalidArgument, err.Error()) } + // MUST ALWAYS have at least minimum stake. + minStake := k.GetParams(ctx).MinStake + if msg.Stake.Amount.LT(minStake.Amount) { + err = types.ErrSupplierInvalidStake.Wrapf( + "supplier with owner %q must stake at least %s", + msg.GetOwnerAddress(), minStake, + ) + logger.Info(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + // Retrieve the account address of the message signer msgSignerAddress, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index a4c1b5815..5682425fe 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -4,15 +4,17 @@ import ( "testing" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { @@ -28,7 +30,7 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isSupplierFound) // Prepare the stakeMsg - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier _, err := srv.StakeSupplier(ctx, stakeMsg) @@ -38,14 +40,14 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { foundSupplier, isSupplierFound := supplierModuleKeepers.GetSupplier(ctx, operatorAddr) require.True(t, isSupplierFound) require.Equal(t, operatorAddr, foundSupplier.OperatorAddress) - require.Equal(t, int64(100), foundSupplier.Stake.Amount.Int64()) + require.Equal(t, int64(1000000), foundSupplier.Stake.Amount.Int64()) require.Len(t, foundSupplier.Services, 1) require.Equal(t, "svcId", foundSupplier.Services[0].ServiceId) require.Len(t, foundSupplier.Services[0].Endpoints, 1) require.Equal(t, "http://localhost:8080", foundSupplier.Services[0].Endpoints[0].Url) // Prepare an updated supplier with a higher stake and a different URL for the service - updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 200, "svcId2") + updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 2000000, "svcId2") updateMsg.Services[0].Endpoints[0].Url = "http://localhost:8082" // Update the staked supplier @@ -54,7 +56,7 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { foundSupplier, isSupplierFound = supplierModuleKeepers.GetSupplier(ctx, operatorAddr) require.True(t, isSupplierFound) - require.Equal(t, int64(200), foundSupplier.Stake.Amount.Int64()) + require.Equal(t, int64(2000000), foundSupplier.Stake.Amount.Int64()) require.Len(t, foundSupplier.Services, 1) require.Equal(t, "svcId2", foundSupplier.Services[0].ServiceId) require.Len(t, foundSupplier.Services[0].Endpoints, 1) @@ -70,7 +72,7 @@ func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) operatorAddr := sample.AccAddress() // Prepare the supplier stake message - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier _, err := srv.StakeSupplier(ctx, stakeMsg) @@ -120,7 +122,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { operatorAddr := sample.AccAddress() // Prepare the supplier stake message - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier & verify that the supplier exists _, err := srv.StakeSupplier(ctx, stakeMsg) @@ -140,7 +142,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { // Verify that the supplier stake is unchanged supplierFound, isSupplierFound := supplierModuleKeepers.GetSupplier(ctx, operatorAddr) require.True(t, isSupplierFound) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) + require.Equal(t, int64(1000000), supplierFound.Stake.Amount.Int64()) require.Len(t, supplierFound.Services, 1) } @@ -153,11 +155,12 @@ func TestMsgServer_StakeSupplier_FailWithNonExistingService(t *testing.T) { operatorAddr := sample.AccAddress() // Prepare the supplier stake message with a non-existing service ID - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "newService") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "newService") // Stake the supplier & verify that it fails because the service does not exist. _, err := srv.StakeSupplier(ctx, stakeMsg) - require.ErrorContains(t, err, types.ErrSupplierServiceNotFound.Wrapf( + require.Equal(t, codes.InvalidArgument, status.Code(err)) + require.ErrorContains(t, err, suppliertypes.ErrSupplierServiceNotFound.Wrapf( "service %q does not exist", "newService", ).Error()) } @@ -171,7 +174,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { operatorAddr := sample.AccAddress() // Stake using the operator address as the signer and verify that it succeeds. - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") setStakeMsgSigner(stakeMsg, operatorAddr) _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) @@ -181,7 +184,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { require.Equal(t, ownerAddr, supplier.OwnerAddress) // Update the supplier using the operator address as the signer and verify that it succeeds. - stakeMsgUpdateUrl := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 200, "svcId") + stakeMsgUpdateUrl := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 2000000, "svcId") operatorUpdatedServiceUrl := "http://localhost:8081" stakeMsgUpdateUrl.Services[0].Endpoints[0].Url = operatorUpdatedServiceUrl setStakeMsgSigner(stakeMsgUpdateUrl, operatorAddr) @@ -196,7 +199,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // Update the supplier URL by using the owner address as the singer and verify that it succeeds. ownerUpdaterServiceUrl := "http://localhost:8082" stakeMsgUpdateUrl.Services[0].Endpoints[0].Url = ownerUpdaterServiceUrl - stakeMsgUpdateUrl.Stake.Amount = math.NewInt(300) + stakeMsgUpdateUrl.Stake.Amount = math.NewInt(3000000) setStakeMsgSigner(stakeMsgUpdateUrl, ownerAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateUrl) require.NoError(t, err) @@ -209,7 +212,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // Try updating the supplier's operator address using the old operator as a signer // will create a new supplier. - stakeMsgUpdateOperator := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 300, "svcId") + stakeMsgUpdateOperator := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 3000000, "svcId") newOperatorAddress := sample.AccAddress() stakeMsgUpdateOperator.OperatorAddress = newOperatorAddress setStakeMsgSigner(stakeMsgUpdateOperator, operatorAddr) @@ -229,7 +232,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // will create a new supplier. newOperatorAddress = sample.AccAddress() stakeMsgUpdateOperator.OperatorAddress = newOperatorAddress - stakeMsgUpdateOperator.Stake.Amount = math.NewInt(400) + stakeMsgUpdateOperator.Stake.Amount = math.NewInt(4000000) setStakeMsgSigner(stakeMsgUpdateOperator, ownerAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateOperator) require.NoError(t, err) @@ -246,10 +249,11 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // Try updating the supplier's owner address using the operator as a signer // and verify that it fails. newOwnerAddress := sample.AccAddress() - stakeMsgUpdateOwner := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 500, "svcId") + stakeMsgUpdateOwner := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 5000000, "svcId") stakeMsgUpdateOwner.OwnerAddress = newOwnerAddress setStakeMsgSigner(stakeMsgUpdateOwner, operatorAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateOwner) + require.Equal(t, codes.InvalidArgument, status.Code(err)) require.ErrorContains(t, err, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( "signer %q is not allowed to update the owner address %q", operatorAddr, ownerAddr, @@ -275,13 +279,13 @@ func TestMsgServer_StakeSupplier_ActiveSupplier(t *testing.T) { operatorAddr := sample.AccAddress() // Prepare the supplier - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier & verify that the supplier exists. _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) - sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) currentHeight := sdkCtx.BlockHeight() sessionEndHeight := supplierModuleKeepers.SharedKeeper.GetSessionEndHeight(ctx, currentHeight) @@ -304,7 +308,7 @@ func TestMsgServer_StakeSupplier_ActiveSupplier(t *testing.T) { ctx = keepertest.SetBlockHeight(ctx, sessionEndHeight+1) // Prepare the supplier stake message with a different service - updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 200, "svcId", "svcId2") + updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 2000000, "svcId", "svcId2") updateMsg.Signer = operatorAddr // Update the staked supplier @@ -339,7 +343,7 @@ func stakeSupplierForServicesMsg( ownerAddr, operatorAddr string, amount int64, serviceIds ...string, -) *types.MsgStakeSupplier { +) *suppliertypes.MsgStakeSupplier { services := make([]*sharedtypes.SupplierServiceConfig, 0, len(serviceIds)) for _, serviceId := range serviceIds { services = append(services, &sharedtypes.SupplierServiceConfig{ @@ -348,7 +352,7 @@ func stakeSupplierForServicesMsg( { Url: "http://localhost:8080", RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), + Configs: nil, }, }, RevShare: []*sharedtypes.ServiceRevenueShare{ @@ -360,20 +364,82 @@ func stakeSupplierForServicesMsg( }) } - return &types.MsgStakeSupplier{ + return &suppliertypes.MsgStakeSupplier{ Signer: ownerAddr, OwnerAddress: ownerAddr, OperatorAddress: operatorAddr, - Stake: &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(amount)}, + Stake: &cosmostypes.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(amount)}, Services: services, } } // setStakeMsgSigner sets the signer of the given MsgStakeSupplier to the given address func setStakeMsgSigner( - msg *types.MsgStakeSupplier, + msg *suppliertypes.MsgStakeSupplier, signer string, -) *types.MsgStakeSupplier { +) *suppliertypes.MsgStakeSupplier { msg.Signer = signer return msg } + +func TestMsgServer_StakeSupplier_FailBelowMinStake(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(*k.Keeper) + + addr := sample.AccAddress() + supplierStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) + minStake := supplierStake.AddAmount(math.NewInt(1)) + expectedErr := suppliertypes.ErrSupplierInvalidStake.Wrapf("supplier with owner %q must stake at least %s", addr, minStake) + + // Set the minimum stake to be greater than the supplier stake. + params := k.Keeper.GetParams(ctx) + params.MinStake = &minStake + err := k.SetParams(ctx, params) + require.NoError(t, err) + + // Prepare the supplier stake message. + stakeMsg := stakeSupplierForServicesMsg(addr, addr, 100, "svcId") + + // Attempt to stake the supplier & verify that the supplier does NOT exist. + _, err = srv.StakeSupplier(ctx, stakeMsg) + require.ErrorContains(t, err, expectedErr.Error()) + _, isSupplierFound := k.GetSupplier(ctx, addr) + require.False(t, isSupplierFound) +} + +func TestMsgServer_StakeSupplier_UpStakeFromBelowMinStake(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(*k.Keeper) + + addr := sample.AccAddress() + supplierParams := k.Keeper.GetParams(ctx) + minStake := supplierParams.GetMinStake() + belowMinStake := minStake.AddAmount(math.NewInt(-1)) + aboveMinStake := minStake.AddAmount(math.NewInt(1)) + + stakeMsg := stakeSupplierForServicesMsg(addr, addr, aboveMinStake.Amount.Int64(), "svcId") + + // Stake (via keeper methods) a supplier with stake below min. stake. + initialSupplier := sharedtypes.Supplier{ + OwnerAddress: addr, + OperatorAddress: addr, + Stake: &belowMinStake, + Services: stakeMsg.GetServices(), + ServicesActivationHeightsMap: map[string]uint64{ + "svcId": 0, + }, + } + + k.SetSupplier(ctx, initialSupplier) + + // Attempt to upstake the supplier with stake above min. stake. + _, err := srv.StakeSupplier(ctx, stakeMsg) + require.NoError(t, err) + + // Assert supplier is staked for above min. stake. + expectedSupplier := initialSupplier + expectedSupplier.Stake = &aboveMinStake + supplier, isSupplierFound := k.GetSupplier(ctx, addr) + require.True(t, isSupplierFound) + require.EqualValues(t, expectedSupplier, supplier) +} diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go index 91d49ed7f..262d1caa9 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier_test.go +++ b/x/supplier/keeper/msg_server_unstake_supplier_test.go @@ -12,7 +12,7 @@ import ( "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { @@ -28,7 +28,7 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { _, isSupplierFound := supplierModuleKeepers.GetSupplier(ctx, unstakingSupplierOperatorAddr) require.False(t, isSupplierFound) - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(unstakingSupplierOperatorAddr, initialStake) // Stake the supplier @@ -54,7 +54,7 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { require.True(t, isSupplierFound) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: unstakingSupplierOperatorAddr, OperatorAddress: unstakingSupplierOperatorAddr, } @@ -95,7 +95,7 @@ func TestMsgServer_UnstakeSupplier_CancelUnbondingIfRestaked(t *testing.T) { supplierOperatorAddr := sample.AccAddress() // Stake the supplier - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(supplierOperatorAddr, initialStake) _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) @@ -106,7 +106,7 @@ func TestMsgServer_UnstakeSupplier_CancelUnbondingIfRestaked(t *testing.T) { require.False(t, foundSupplier.IsUnbonding()) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } @@ -154,13 +154,13 @@ func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { require.False(t, isSupplierFound) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } _, err := srv.UnstakeSupplier(ctx, unstakeMsg) require.Error(t, err) - require.ErrorIs(t, err, types.ErrSupplierNotFound) + require.ErrorIs(t, err, suppliertypes.ErrSupplierNotFound) _, isSupplierFound = supplierModuleKeepers.GetSupplier(ctx, supplierOperatorAddr) require.False(t, isSupplierFound) @@ -174,13 +174,13 @@ func TestMsgServer_UnstakeSupplier_FailIfCurrentlyUnstaking(t *testing.T) { supplierOperatorAddr := sample.AccAddress() // Stake the supplier - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(supplierOperatorAddr, initialStake) _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } @@ -191,7 +191,7 @@ func TestMsgServer_UnstakeSupplier_FailIfCurrentlyUnstaking(t *testing.T) { ctx = keepertest.SetBlockHeight(ctx, int64(sdkCtx.BlockHeight()+1)) _, err = srv.UnstakeSupplier(ctx, unstakeMsg) - require.ErrorIs(t, err, types.ErrSupplierIsUnstaking) + require.ErrorIs(t, err, suppliertypes.ErrSupplierIsUnstaking) } func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) { @@ -203,14 +203,14 @@ func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) { supplierOperatorAddr := sample.AccAddress() // Stake the supplier - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(ownerAddr, initialStake) stakeMsg.OperatorAddress = supplierOperatorAddr _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } @@ -238,9 +238,9 @@ func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) { require.Equal(t, initialStake, supplierModuleKeepers.SupplierUnstakedFundsMap[ownerAddr]) } -func createStakeMsg(supplierOwnerAddr string, stakeAmount int64) *types.MsgStakeSupplier { +func createStakeMsg(supplierOwnerAddr string, stakeAmount int64) *suppliertypes.MsgStakeSupplier { initialStake := sdk.NewCoin("upokt", math.NewInt(stakeAmount)) - return &types.MsgStakeSupplier{ + return &suppliertypes.MsgStakeSupplier{ Signer: supplierOwnerAddr, OwnerAddress: supplierOwnerAddr, OperatorAddress: supplierOwnerAddr, From da56f048233b29243efa25fdffd92ed1de7de60f Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Mon, 14 Oct 2024 15:06:57 +0200 Subject: [PATCH 08/13] [Tokenomics] Implement difficulty proportional rewards (#880) **This is a repost of PR #840 which did not get merged into main** ## Summary This PR incorporated the mining difficulty into the claim reward calculation. * Encapsulates the claimed tokens into a `claim.GetClaimeduPOKT(params, difficulty)` * Implements a test to assert that the difficulty based rewards are proportional to the off-chain relays served. * Removes unused `min_relay_difficulty_bits` gov. param. It is based on the preparation work of PR #836. ## Issue - #781 - #758 ## Type of change Select one or more from the following: - [x] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [x] **Unit Tests**: `make go_develop_and_test` - [x] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [x] I have left TODOs throughout the codebase, if applicable --- api/poktroll/proof/event.pulsar.go | 393 +++++++++--------- .../service/relay_mining_difficulty.pulsar.go | 1 + api/poktroll/tokenomics/event.pulsar.go | 296 +++++++------ .../develop/developer_guide/adding_params.md | 14 +- makefiles/params.mk | 4 - pkg/client/interface.go | 2 +- pkg/client/query/servicequerier.go | 18 +- pkg/relayer/miner/gen/gen_fixtures.go | 1 - pkg/relayer/miner/miner.go | 6 +- pkg/relayer/miner/miner_test.go | 4 +- pkg/relayer/session/claim.go | 10 +- pkg/relayer/session/proof.go | 12 +- pkg/relayer/session/session_test.go | 4 + proto/poktroll/proof/event.proto | 8 +- .../service/relay_mining_difficulty.proto | 1 + proto/poktroll/tokenomics/event.proto | 8 +- .../service/relay_mining_difficulty_test.go | 32 ++ .../relay_mining_integration_test.go | 286 ++++++++----- testutil/keeper/tokenomics.go | 19 + .../testqueryclients/servicequerier.go | 2 +- testutil/testrelayer/relays.go | 4 +- tools/scripts/params/proof_all.json | 1 - .../proof_min_relay_difficulty_bits.json | 12 - x/proof/keeper/msg_server_submit_proof.go | 22 +- x/proof/types/claim.go | 81 ++++ x/proof/types/errors.go | 1 + x/proof/types/event.pb.go | 148 +++---- .../keeper/update_relay_mining_difficulty.go | 64 ++- x/service/types/relay_mining_difficulty.pb.go | 1 + .../keeper_settle_pending_claims_test.go | 121 ++++-- x/tokenomics/keeper/settle_pending_claims.go | 64 ++- x/tokenomics/keeper/token_logic_modules.go | 32 +- .../keeper/token_logic_modules_test.go | 8 +- x/tokenomics/tokenomics.go | 28 -- x/tokenomics/types/event.pb.go | 144 +++---- 35 files changed, 1068 insertions(+), 784 deletions(-) delete mode 100644 tools/scripts/params/proof_min_relay_difficulty_bits.json delete mode 100644 x/tokenomics/tokenomics.go diff --git a/api/poktroll/proof/event.pulsar.go b/api/poktroll/proof/event.pulsar.go index be2eeaf14..2954b58b7 100644 --- a/api/poktroll/proof/event.pulsar.go +++ b/api/poktroll/proof/event.pulsar.go @@ -20,7 +20,7 @@ var ( fd_EventClaimCreated_num_relays protoreflect.FieldDescriptor fd_EventClaimCreated_num_claimed_compute_units protoreflect.FieldDescriptor fd_EventClaimCreated_num_estimated_compute_units protoreflect.FieldDescriptor - fd_EventClaimCreated_claimed_amount_upokt protoreflect.FieldDescriptor + fd_EventClaimCreated_claimed_upokt protoreflect.FieldDescriptor ) func init() { @@ -30,7 +30,7 @@ func init() { fd_EventClaimCreated_num_relays = md_EventClaimCreated.Fields().ByName("num_relays") fd_EventClaimCreated_num_claimed_compute_units = md_EventClaimCreated.Fields().ByName("num_claimed_compute_units") fd_EventClaimCreated_num_estimated_compute_units = md_EventClaimCreated.Fields().ByName("num_estimated_compute_units") - fd_EventClaimCreated_claimed_amount_upokt = md_EventClaimCreated.Fields().ByName("claimed_amount_upokt") + fd_EventClaimCreated_claimed_upokt = md_EventClaimCreated.Fields().ByName("claimed_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimCreated)(nil) @@ -122,9 +122,9 @@ func (x *fastReflection_EventClaimCreated) Range(f func(protoreflect.FieldDescri return } } - if x.ClaimedAmountUpokt != nil { - value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) - if !f(fd_EventClaimCreated_claimed_amount_upokt, value) { + if x.ClaimedUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) + if !f(fd_EventClaimCreated_claimed_upokt, value) { return } } @@ -151,8 +151,8 @@ func (x *fastReflection_EventClaimCreated) Has(fd protoreflect.FieldDescriptor) return x.NumClaimedComputeUnits != uint64(0) case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": return x.NumEstimatedComputeUnits != uint64(0) - case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": - return x.ClaimedAmountUpokt != nil + case "poktroll.proof.EventClaimCreated.claimed_upokt": + return x.ClaimedUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -177,8 +177,8 @@ func (x *fastReflection_EventClaimCreated) Clear(fd protoreflect.FieldDescriptor x.NumClaimedComputeUnits = uint64(0) case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": x.NumEstimatedComputeUnits = uint64(0) - case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": - x.ClaimedAmountUpokt = nil + case "poktroll.proof.EventClaimCreated.claimed_upokt": + x.ClaimedUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -207,8 +207,8 @@ func (x *fastReflection_EventClaimCreated) Get(descriptor protoreflect.FieldDesc case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": - value := x.ClaimedAmountUpokt + case "poktroll.proof.EventClaimCreated.claimed_upokt": + value := x.ClaimedUpokt return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { @@ -238,8 +238,8 @@ func (x *fastReflection_EventClaimCreated) Set(fd protoreflect.FieldDescriptor, x.NumClaimedComputeUnits = value.Uint() case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": x.NumEstimatedComputeUnits = value.Uint() - case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": - x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.proof.EventClaimCreated.claimed_upokt": + x.ClaimedUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimCreated")) @@ -265,11 +265,11 @@ func (x *fastReflection_EventClaimCreated) Mutable(fd protoreflect.FieldDescript x.Claim = new(Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) - case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = new(v1beta1.Coin) + case "poktroll.proof.EventClaimCreated.claimed_upokt": + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = new(v1beta1.Coin) } - return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + return protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) case "poktroll.proof.EventClaimCreated.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventClaimCreated is not mutable")) case "poktroll.proof.EventClaimCreated.num_claimed_compute_units": @@ -298,7 +298,7 @@ func (x *fastReflection_EventClaimCreated) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.proof.EventClaimCreated.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventClaimCreated.claimed_amount_upokt": + case "poktroll.proof.EventClaimCreated.claimed_upokt": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: @@ -383,8 +383,8 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { if x.NumEstimatedComputeUnits != 0 { n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) } - if x.ClaimedAmountUpokt != nil { - l = options.Size(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + l = options.Size(x.ClaimedUpokt) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -416,8 +416,8 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ClaimedAmountUpokt != nil { - encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + encoded, err := options.Marshal(x.ClaimedUpokt) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -603,7 +603,7 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { } case 6: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -630,10 +630,10 @@ func (x *fastReflection_EventClaimCreated) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = &v1beta1.Coin{} + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = &v1beta1.Coin{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedUpokt); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -678,7 +678,7 @@ var ( fd_EventClaimUpdated_num_relays protoreflect.FieldDescriptor fd_EventClaimUpdated_num_claimed_compute_units protoreflect.FieldDescriptor fd_EventClaimUpdated_num_estimated_compute_units protoreflect.FieldDescriptor - fd_EventClaimUpdated_claimed_amount_upokt protoreflect.FieldDescriptor + fd_EventClaimUpdated_claimed_upokt protoreflect.FieldDescriptor ) func init() { @@ -688,7 +688,7 @@ func init() { fd_EventClaimUpdated_num_relays = md_EventClaimUpdated.Fields().ByName("num_relays") fd_EventClaimUpdated_num_claimed_compute_units = md_EventClaimUpdated.Fields().ByName("num_claimed_compute_units") fd_EventClaimUpdated_num_estimated_compute_units = md_EventClaimUpdated.Fields().ByName("num_estimated_compute_units") - fd_EventClaimUpdated_claimed_amount_upokt = md_EventClaimUpdated.Fields().ByName("claimed_amount_upokt") + fd_EventClaimUpdated_claimed_upokt = md_EventClaimUpdated.Fields().ByName("claimed_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimUpdated)(nil) @@ -780,9 +780,9 @@ func (x *fastReflection_EventClaimUpdated) Range(f func(protoreflect.FieldDescri return } } - if x.ClaimedAmountUpokt != nil { - value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) - if !f(fd_EventClaimUpdated_claimed_amount_upokt, value) { + if x.ClaimedUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) + if !f(fd_EventClaimUpdated_claimed_upokt, value) { return } } @@ -809,8 +809,8 @@ func (x *fastReflection_EventClaimUpdated) Has(fd protoreflect.FieldDescriptor) return x.NumClaimedComputeUnits != uint64(0) case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": return x.NumEstimatedComputeUnits != uint64(0) - case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": - return x.ClaimedAmountUpokt != nil + case "poktroll.proof.EventClaimUpdated.claimed_upokt": + return x.ClaimedUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -835,8 +835,8 @@ func (x *fastReflection_EventClaimUpdated) Clear(fd protoreflect.FieldDescriptor x.NumClaimedComputeUnits = uint64(0) case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": x.NumEstimatedComputeUnits = uint64(0) - case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": - x.ClaimedAmountUpokt = nil + case "poktroll.proof.EventClaimUpdated.claimed_upokt": + x.ClaimedUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -865,8 +865,8 @@ func (x *fastReflection_EventClaimUpdated) Get(descriptor protoreflect.FieldDesc case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": - value := x.ClaimedAmountUpokt + case "poktroll.proof.EventClaimUpdated.claimed_upokt": + value := x.ClaimedUpokt return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { @@ -896,8 +896,8 @@ func (x *fastReflection_EventClaimUpdated) Set(fd protoreflect.FieldDescriptor, x.NumClaimedComputeUnits = value.Uint() case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": x.NumEstimatedComputeUnits = value.Uint() - case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": - x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.proof.EventClaimUpdated.claimed_upokt": + x.ClaimedUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventClaimUpdated")) @@ -923,11 +923,11 @@ func (x *fastReflection_EventClaimUpdated) Mutable(fd protoreflect.FieldDescript x.Claim = new(Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) - case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = new(v1beta1.Coin) + case "poktroll.proof.EventClaimUpdated.claimed_upokt": + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = new(v1beta1.Coin) } - return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + return protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) case "poktroll.proof.EventClaimUpdated.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventClaimUpdated is not mutable")) case "poktroll.proof.EventClaimUpdated.num_claimed_compute_units": @@ -956,7 +956,7 @@ func (x *fastReflection_EventClaimUpdated) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.proof.EventClaimUpdated.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventClaimUpdated.claimed_amount_upokt": + case "poktroll.proof.EventClaimUpdated.claimed_upokt": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: @@ -1041,8 +1041,8 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { if x.NumEstimatedComputeUnits != 0 { n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) } - if x.ClaimedAmountUpokt != nil { - l = options.Size(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + l = options.Size(x.ClaimedUpokt) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -1074,8 +1074,8 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ClaimedAmountUpokt != nil { - encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + encoded, err := options.Marshal(x.ClaimedUpokt) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1261,7 +1261,7 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { } case 6: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1288,10 +1288,10 @@ func (x *fastReflection_EventClaimUpdated) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = &v1beta1.Coin{} + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = &v1beta1.Coin{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedUpokt); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -1337,7 +1337,7 @@ var ( fd_EventProofSubmitted_num_relays protoreflect.FieldDescriptor fd_EventProofSubmitted_num_claimed_compute_units protoreflect.FieldDescriptor fd_EventProofSubmitted_num_estimated_compute_units protoreflect.FieldDescriptor - fd_EventProofSubmitted_claimed_amount_upokt protoreflect.FieldDescriptor + fd_EventProofSubmitted_claimed_upokt protoreflect.FieldDescriptor ) func init() { @@ -1348,7 +1348,7 @@ func init() { fd_EventProofSubmitted_num_relays = md_EventProofSubmitted.Fields().ByName("num_relays") fd_EventProofSubmitted_num_claimed_compute_units = md_EventProofSubmitted.Fields().ByName("num_claimed_compute_units") fd_EventProofSubmitted_num_estimated_compute_units = md_EventProofSubmitted.Fields().ByName("num_estimated_compute_units") - fd_EventProofSubmitted_claimed_amount_upokt = md_EventProofSubmitted.Fields().ByName("claimed_amount_upokt") + fd_EventProofSubmitted_claimed_upokt = md_EventProofSubmitted.Fields().ByName("claimed_upokt") } var _ protoreflect.Message = (*fastReflection_EventProofSubmitted)(nil) @@ -1446,9 +1446,9 @@ func (x *fastReflection_EventProofSubmitted) Range(f func(protoreflect.FieldDesc return } } - if x.ClaimedAmountUpokt != nil { - value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) - if !f(fd_EventProofSubmitted_claimed_amount_upokt, value) { + if x.ClaimedUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) + if !f(fd_EventProofSubmitted_claimed_upokt, value) { return } } @@ -1477,8 +1477,8 @@ func (x *fastReflection_EventProofSubmitted) Has(fd protoreflect.FieldDescriptor return x.NumClaimedComputeUnits != uint64(0) case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": return x.NumEstimatedComputeUnits != uint64(0) - case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": - return x.ClaimedAmountUpokt != nil + case "poktroll.proof.EventProofSubmitted.claimed_upokt": + return x.ClaimedUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1505,8 +1505,8 @@ func (x *fastReflection_EventProofSubmitted) Clear(fd protoreflect.FieldDescript x.NumClaimedComputeUnits = uint64(0) case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": x.NumEstimatedComputeUnits = uint64(0) - case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": - x.ClaimedAmountUpokt = nil + case "poktroll.proof.EventProofSubmitted.claimed_upokt": + x.ClaimedUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1538,8 +1538,8 @@ func (x *fastReflection_EventProofSubmitted) Get(descriptor protoreflect.FieldDe case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": - value := x.ClaimedAmountUpokt + case "poktroll.proof.EventProofSubmitted.claimed_upokt": + value := x.ClaimedUpokt return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { @@ -1571,8 +1571,8 @@ func (x *fastReflection_EventProofSubmitted) Set(fd protoreflect.FieldDescriptor x.NumClaimedComputeUnits = value.Uint() case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": x.NumEstimatedComputeUnits = value.Uint() - case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": - x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.proof.EventProofSubmitted.claimed_upokt": + x.ClaimedUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofSubmitted")) @@ -1603,11 +1603,11 @@ func (x *fastReflection_EventProofSubmitted) Mutable(fd protoreflect.FieldDescri x.Proof = new(Proof) } return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) - case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = new(v1beta1.Coin) + case "poktroll.proof.EventProofSubmitted.claimed_upokt": + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = new(v1beta1.Coin) } - return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + return protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) case "poktroll.proof.EventProofSubmitted.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventProofSubmitted is not mutable")) case "poktroll.proof.EventProofSubmitted.num_claimed_compute_units": @@ -1639,7 +1639,7 @@ func (x *fastReflection_EventProofSubmitted) NewField(fd protoreflect.FieldDescr return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.proof.EventProofSubmitted.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventProofSubmitted.claimed_amount_upokt": + case "poktroll.proof.EventProofSubmitted.claimed_upokt": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: @@ -1728,8 +1728,8 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods if x.NumEstimatedComputeUnits != 0 { n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) } - if x.ClaimedAmountUpokt != nil { - l = options.Size(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + l = options.Size(x.ClaimedUpokt) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -1761,8 +1761,8 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ClaimedAmountUpokt != nil { - encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + encoded, err := options.Marshal(x.ClaimedUpokt) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1998,7 +1998,7 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods } case 6: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2025,10 +2025,10 @@ func (x *fastReflection_EventProofSubmitted) ProtoMethods() *protoiface.Methods if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = &v1beta1.Coin{} + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = &v1beta1.Coin{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedUpokt); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -2074,7 +2074,7 @@ var ( fd_EventProofUpdated_num_relays protoreflect.FieldDescriptor fd_EventProofUpdated_num_claimed_compute_units protoreflect.FieldDescriptor fd_EventProofUpdated_num_estimated_compute_units protoreflect.FieldDescriptor - fd_EventProofUpdated_claimed_amount_upokt protoreflect.FieldDescriptor + fd_EventProofUpdated_claimed_upokt protoreflect.FieldDescriptor ) func init() { @@ -2085,7 +2085,7 @@ func init() { fd_EventProofUpdated_num_relays = md_EventProofUpdated.Fields().ByName("num_relays") fd_EventProofUpdated_num_claimed_compute_units = md_EventProofUpdated.Fields().ByName("num_claimed_compute_units") fd_EventProofUpdated_num_estimated_compute_units = md_EventProofUpdated.Fields().ByName("num_estimated_compute_units") - fd_EventProofUpdated_claimed_amount_upokt = md_EventProofUpdated.Fields().ByName("claimed_amount_upokt") + fd_EventProofUpdated_claimed_upokt = md_EventProofUpdated.Fields().ByName("claimed_upokt") } var _ protoreflect.Message = (*fastReflection_EventProofUpdated)(nil) @@ -2183,9 +2183,9 @@ func (x *fastReflection_EventProofUpdated) Range(f func(protoreflect.FieldDescri return } } - if x.ClaimedAmountUpokt != nil { - value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) - if !f(fd_EventProofUpdated_claimed_amount_upokt, value) { + if x.ClaimedUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) + if !f(fd_EventProofUpdated_claimed_upokt, value) { return } } @@ -2214,8 +2214,8 @@ func (x *fastReflection_EventProofUpdated) Has(fd protoreflect.FieldDescriptor) return x.NumClaimedComputeUnits != uint64(0) case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": return x.NumEstimatedComputeUnits != uint64(0) - case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": - return x.ClaimedAmountUpokt != nil + case "poktroll.proof.EventProofUpdated.claimed_upokt": + return x.ClaimedUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -2242,8 +2242,8 @@ func (x *fastReflection_EventProofUpdated) Clear(fd protoreflect.FieldDescriptor x.NumClaimedComputeUnits = uint64(0) case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": x.NumEstimatedComputeUnits = uint64(0) - case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": - x.ClaimedAmountUpokt = nil + case "poktroll.proof.EventProofUpdated.claimed_upokt": + x.ClaimedUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -2275,8 +2275,8 @@ func (x *fastReflection_EventProofUpdated) Get(descriptor protoreflect.FieldDesc case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) - case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": - value := x.ClaimedAmountUpokt + case "poktroll.proof.EventProofUpdated.claimed_upokt": + value := x.ClaimedUpokt return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { @@ -2308,8 +2308,8 @@ func (x *fastReflection_EventProofUpdated) Set(fd protoreflect.FieldDescriptor, x.NumClaimedComputeUnits = value.Uint() case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": x.NumEstimatedComputeUnits = value.Uint() - case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": - x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.proof.EventProofUpdated.claimed_upokt": + x.ClaimedUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.EventProofUpdated")) @@ -2340,11 +2340,11 @@ func (x *fastReflection_EventProofUpdated) Mutable(fd protoreflect.FieldDescript x.Proof = new(Proof) } return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) - case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = new(v1beta1.Coin) + case "poktroll.proof.EventProofUpdated.claimed_upokt": + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = new(v1beta1.Coin) } - return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + return protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) case "poktroll.proof.EventProofUpdated.num_relays": panic(fmt.Errorf("field num_relays of message poktroll.proof.EventProofUpdated is not mutable")) case "poktroll.proof.EventProofUpdated.num_claimed_compute_units": @@ -2376,7 +2376,7 @@ func (x *fastReflection_EventProofUpdated) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.proof.EventProofUpdated.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.proof.EventProofUpdated.claimed_amount_upokt": + case "poktroll.proof.EventProofUpdated.claimed_upokt": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: @@ -2465,8 +2465,8 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { if x.NumEstimatedComputeUnits != 0 { n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) } - if x.ClaimedAmountUpokt != nil { - l = options.Size(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + l = options.Size(x.ClaimedUpokt) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -2498,8 +2498,8 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ClaimedAmountUpokt != nil { - encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + encoded, err := options.Marshal(x.ClaimedUpokt) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2735,7 +2735,7 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { } case 6: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2762,10 +2762,10 @@ func (x *fastReflection_EventProofUpdated) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = &v1beta1.Coin{} + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = &v1beta1.Coin{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedUpokt); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -2826,7 +2826,7 @@ type EventClaimCreated struct { NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` - ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` + ClaimedUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt,omitempty"` } func (x *EventClaimCreated) Reset() { @@ -2877,9 +2877,9 @@ func (x *EventClaimCreated) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (x *EventClaimCreated) GetClaimedAmountUpokt() *v1beta1.Coin { +func (x *EventClaimCreated) GetClaimedUpokt() *v1beta1.Coin { if x != nil { - return x.ClaimedAmountUpokt + return x.ClaimedUpokt } return nil } @@ -2894,7 +2894,7 @@ type EventClaimUpdated struct { NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` - ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` + ClaimedUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt,omitempty"` } func (x *EventClaimUpdated) Reset() { @@ -2945,9 +2945,9 @@ func (x *EventClaimUpdated) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (x *EventClaimUpdated) GetClaimedAmountUpokt() *v1beta1.Coin { +func (x *EventClaimUpdated) GetClaimedUpokt() *v1beta1.Coin { if x != nil { - return x.ClaimedAmountUpokt + return x.ClaimedUpokt } return nil } @@ -2962,7 +2962,7 @@ type EventProofSubmitted struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` - ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` + ClaimedUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt,omitempty"` } func (x *EventProofSubmitted) Reset() { @@ -3020,9 +3020,9 @@ func (x *EventProofSubmitted) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (x *EventProofSubmitted) GetClaimedAmountUpokt() *v1beta1.Coin { +func (x *EventProofSubmitted) GetClaimedUpokt() *v1beta1.Coin { if x != nil { - return x.ClaimedAmountUpokt + return x.ClaimedUpokt } return nil } @@ -3038,7 +3038,7 @@ type EventProofUpdated struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays,omitempty"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units,omitempty"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` - ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` + ClaimedUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt,omitempty"` } func (x *EventProofUpdated) Reset() { @@ -3096,9 +3096,9 @@ func (x *EventProofUpdated) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (x *EventProofUpdated) GetClaimedAmountUpokt() *v1beta1.Coin { +func (x *EventProofUpdated) GetClaimedUpokt() *v1beta1.Coin { if x != nil { - return x.ClaimedAmountUpokt + return x.ClaimedUpokt } return nil } @@ -3113,7 +3113,7 @@ var file_poktroll_proof_event_proto_rawDesc = []byte{ 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, + 0x6f, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, @@ -3133,19 +3133,46 @@ var file_poktroll_proof_event_proto_rawDesc = []byte{ 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, - 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, - 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, - 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, - 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0x9b, 0x03, 0x0a, - 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x51, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, + 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x11, 0xea, 0xde, 0x1f, 0x0d, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x65, 0x64, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0x87, 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, + 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, + 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, + 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, + 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, + 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, + 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, + 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, + 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, + 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, + 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, + 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, + 0x51, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, + 0x6e, 0x42, 0x11, 0xea, 0xde, 0x1f, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, + 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x55, 0x70, 0x6f, + 0x6b, 0x74, 0x22, 0xc1, 0x03, 0x0a, 0x13, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, - 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, + 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, + 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, @@ -3159,72 +3186,40 @@ var file_poktroll_proof_event_proto_rawDesc = []byte{ 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, - 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, - 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0xd5, 0x03, 0x0a, 0x13, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, - 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, - 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, - 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, - 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, - 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, - 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, - 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, - 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, - 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, - 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, - 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, - 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, - 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, - 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, - 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, - 0x6b, 0x74, 0x22, 0xd3, 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, - 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, - 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, - 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x70, 0x72, 0x6f, 0x6f, - 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, - 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, - 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, - 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, - 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, - 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, - 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, - 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, - 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, - 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, - 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, - 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, - 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, - 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, - 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x42, 0x9e, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, + 0x69, 0x74, 0x73, 0x12, 0x51, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, + 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x11, 0xea, 0xde, 0x1f, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, + 0x65, 0x64, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, + 0x64, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0xbf, 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, + 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, + 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, + 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x2d, 0x0a, 0x0a, + 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, + 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, + 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, + 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, + 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, + 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, + 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, + 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, + 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, + 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, + 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x51, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, + 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x11, 0xea, 0xde, 0x1f, 0x0d, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x65, 0x64, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x42, 0x9e, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, @@ -3262,15 +3257,15 @@ var file_poktroll_proof_event_proto_goTypes = []interface{}{ } var file_poktroll_proof_event_proto_depIdxs = []int32{ 4, // 0: poktroll.proof.EventClaimCreated.claim:type_name -> poktroll.proof.Claim - 5, // 1: poktroll.proof.EventClaimCreated.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 1: poktroll.proof.EventClaimCreated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin 4, // 2: poktroll.proof.EventClaimUpdated.claim:type_name -> poktroll.proof.Claim - 5, // 3: poktroll.proof.EventClaimUpdated.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 3: poktroll.proof.EventClaimUpdated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin 4, // 4: poktroll.proof.EventProofSubmitted.claim:type_name -> poktroll.proof.Claim 6, // 5: poktroll.proof.EventProofSubmitted.proof:type_name -> poktroll.proof.Proof - 5, // 6: poktroll.proof.EventProofSubmitted.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 6: poktroll.proof.EventProofSubmitted.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin 4, // 7: poktroll.proof.EventProofUpdated.claim:type_name -> poktroll.proof.Claim 6, // 8: poktroll.proof.EventProofUpdated.proof:type_name -> poktroll.proof.Proof - 5, // 9: poktroll.proof.EventProofUpdated.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 5, // 9: poktroll.proof.EventProofUpdated.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin 10, // [10:10] is the sub-list for method output_type 10, // [10:10] is the sub-list for method input_type 10, // [10:10] is the sub-list for extension type_name diff --git a/api/poktroll/service/relay_mining_difficulty.pulsar.go b/api/poktroll/service/relay_mining_difficulty.pulsar.go index ba6a6bea4..10e3920a7 100644 --- a/api/poktroll/service/relay_mining_difficulty.pulsar.go +++ b/api/poktroll/service/relay_mining_difficulty.pulsar.go @@ -610,6 +610,7 @@ const ( // RelayMiningDifficulty is a message used to store the on-chain Relay Mining // difficulty associated with a specific service ID. +// TODO_TECHDEBT: Embed this message in the Service message. type RelayMiningDifficulty struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/poktroll/tokenomics/event.pulsar.go b/api/poktroll/tokenomics/event.pulsar.go index f69665680..507b21ed9 100644 --- a/api/poktroll/tokenomics/event.pulsar.go +++ b/api/poktroll/tokenomics/event.pulsar.go @@ -22,7 +22,7 @@ var ( fd_EventClaimExpired_num_relays protoreflect.FieldDescriptor fd_EventClaimExpired_num_claimed_compute_units protoreflect.FieldDescriptor fd_EventClaimExpired_num_estimated_compute_units protoreflect.FieldDescriptor - fd_EventClaimExpired_claimed_amount_upokt protoreflect.FieldDescriptor + fd_EventClaimExpired_claimed_upokt protoreflect.FieldDescriptor ) func init() { @@ -33,7 +33,7 @@ func init() { fd_EventClaimExpired_num_relays = md_EventClaimExpired.Fields().ByName("num_relays") fd_EventClaimExpired_num_claimed_compute_units = md_EventClaimExpired.Fields().ByName("num_claimed_compute_units") fd_EventClaimExpired_num_estimated_compute_units = md_EventClaimExpired.Fields().ByName("num_estimated_compute_units") - fd_EventClaimExpired_claimed_amount_upokt = md_EventClaimExpired.Fields().ByName("claimed_amount_upokt") + fd_EventClaimExpired_claimed_upokt = md_EventClaimExpired.Fields().ByName("claimed_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimExpired)(nil) @@ -131,9 +131,9 @@ func (x *fastReflection_EventClaimExpired) Range(f func(protoreflect.FieldDescri return } } - if x.ClaimedAmountUpokt != nil { - value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) - if !f(fd_EventClaimExpired_claimed_amount_upokt, value) { + if x.ClaimedUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) + if !f(fd_EventClaimExpired_claimed_upokt, value) { return } } @@ -162,8 +162,8 @@ func (x *fastReflection_EventClaimExpired) Has(fd protoreflect.FieldDescriptor) return x.NumClaimedComputeUnits != uint64(0) case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": return x.NumEstimatedComputeUnits != uint64(0) - case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": - return x.ClaimedAmountUpokt != nil + case "poktroll.tokenomics.EventClaimExpired.claimed_upokt": + return x.ClaimedUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -190,8 +190,8 @@ func (x *fastReflection_EventClaimExpired) Clear(fd protoreflect.FieldDescriptor x.NumClaimedComputeUnits = uint64(0) case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": x.NumEstimatedComputeUnits = uint64(0) - case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": - x.ClaimedAmountUpokt = nil + case "poktroll.tokenomics.EventClaimExpired.claimed_upokt": + x.ClaimedUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -223,8 +223,8 @@ func (x *fastReflection_EventClaimExpired) Get(descriptor protoreflect.FieldDesc case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) - case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": - value := x.ClaimedAmountUpokt + case "poktroll.tokenomics.EventClaimExpired.claimed_upokt": + value := x.ClaimedUpokt return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { @@ -256,8 +256,8 @@ func (x *fastReflection_EventClaimExpired) Set(fd protoreflect.FieldDescriptor, x.NumClaimedComputeUnits = value.Uint() case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": x.NumEstimatedComputeUnits = value.Uint() - case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": - x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.tokenomics.EventClaimExpired.claimed_upokt": + x.ClaimedUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimExpired")) @@ -283,11 +283,11 @@ func (x *fastReflection_EventClaimExpired) Mutable(fd protoreflect.FieldDescript x.Claim = new(proof.Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) - case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = new(v1beta1.Coin) + case "poktroll.tokenomics.EventClaimExpired.claimed_upokt": + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = new(v1beta1.Coin) } - return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + return protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) case "poktroll.tokenomics.EventClaimExpired.expiration_reason": panic(fmt.Errorf("field expiration_reason of message poktroll.tokenomics.EventClaimExpired is not mutable")) case "poktroll.tokenomics.EventClaimExpired.num_relays": @@ -320,7 +320,7 @@ func (x *fastReflection_EventClaimExpired) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.tokenomics.EventClaimExpired.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt": + case "poktroll.tokenomics.EventClaimExpired.claimed_upokt": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: @@ -408,8 +408,8 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { if x.NumEstimatedComputeUnits != 0 { n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) } - if x.ClaimedAmountUpokt != nil { - l = options.Size(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + l = options.Size(x.ClaimedUpokt) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -441,8 +441,8 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ClaimedAmountUpokt != nil { - encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + encoded, err := options.Marshal(x.ClaimedUpokt) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -652,7 +652,7 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { } case 6: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -679,10 +679,10 @@ func (x *fastReflection_EventClaimExpired) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = &v1beta1.Coin{} + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = &v1beta1.Coin{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedUpokt); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -728,7 +728,7 @@ var ( fd_EventClaimSettled_num_relays protoreflect.FieldDescriptor fd_EventClaimSettled_num_claimed_compute_units protoreflect.FieldDescriptor fd_EventClaimSettled_num_estimated_compute_units protoreflect.FieldDescriptor - fd_EventClaimSettled_claimed_amount_upokt protoreflect.FieldDescriptor + fd_EventClaimSettled_claimed_upokt protoreflect.FieldDescriptor ) func init() { @@ -739,7 +739,7 @@ func init() { fd_EventClaimSettled_num_relays = md_EventClaimSettled.Fields().ByName("num_relays") fd_EventClaimSettled_num_claimed_compute_units = md_EventClaimSettled.Fields().ByName("num_claimed_compute_units") fd_EventClaimSettled_num_estimated_compute_units = md_EventClaimSettled.Fields().ByName("num_estimated_compute_units") - fd_EventClaimSettled_claimed_amount_upokt = md_EventClaimSettled.Fields().ByName("claimed_amount_upokt") + fd_EventClaimSettled_claimed_upokt = md_EventClaimSettled.Fields().ByName("claimed_upokt") } var _ protoreflect.Message = (*fastReflection_EventClaimSettled)(nil) @@ -837,9 +837,9 @@ func (x *fastReflection_EventClaimSettled) Range(f func(protoreflect.FieldDescri return } } - if x.ClaimedAmountUpokt != nil { - value := protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) - if !f(fd_EventClaimSettled_claimed_amount_upokt, value) { + if x.ClaimedUpokt != nil { + value := protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) + if !f(fd_EventClaimSettled_claimed_upokt, value) { return } } @@ -868,8 +868,8 @@ func (x *fastReflection_EventClaimSettled) Has(fd protoreflect.FieldDescriptor) return x.NumClaimedComputeUnits != uint64(0) case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": return x.NumEstimatedComputeUnits != uint64(0) - case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": - return x.ClaimedAmountUpokt != nil + case "poktroll.tokenomics.EventClaimSettled.claimed_upokt": + return x.ClaimedUpokt != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -896,8 +896,8 @@ func (x *fastReflection_EventClaimSettled) Clear(fd protoreflect.FieldDescriptor x.NumClaimedComputeUnits = uint64(0) case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": x.NumEstimatedComputeUnits = uint64(0) - case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": - x.ClaimedAmountUpokt = nil + case "poktroll.tokenomics.EventClaimSettled.claimed_upokt": + x.ClaimedUpokt = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -929,8 +929,8 @@ func (x *fastReflection_EventClaimSettled) Get(descriptor protoreflect.FieldDesc case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": value := x.NumEstimatedComputeUnits return protoreflect.ValueOfUint64(value) - case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": - value := x.ClaimedAmountUpokt + case "poktroll.tokenomics.EventClaimSettled.claimed_upokt": + value := x.ClaimedUpokt return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { @@ -962,8 +962,8 @@ func (x *fastReflection_EventClaimSettled) Set(fd protoreflect.FieldDescriptor, x.NumClaimedComputeUnits = value.Uint() case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": x.NumEstimatedComputeUnits = value.Uint() - case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": - x.ClaimedAmountUpokt = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.tokenomics.EventClaimSettled.claimed_upokt": + x.ClaimedUpokt = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.EventClaimSettled")) @@ -989,11 +989,11 @@ func (x *fastReflection_EventClaimSettled) Mutable(fd protoreflect.FieldDescript x.Claim = new(proof.Claim) } return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) - case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = new(v1beta1.Coin) + case "poktroll.tokenomics.EventClaimSettled.claimed_upokt": + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = new(v1beta1.Coin) } - return protoreflect.ValueOfMessage(x.ClaimedAmountUpokt.ProtoReflect()) + return protoreflect.ValueOfMessage(x.ClaimedUpokt.ProtoReflect()) case "poktroll.tokenomics.EventClaimSettled.proof_requirement": panic(fmt.Errorf("field proof_requirement of message poktroll.tokenomics.EventClaimSettled is not mutable")) case "poktroll.tokenomics.EventClaimSettled.num_relays": @@ -1026,7 +1026,7 @@ func (x *fastReflection_EventClaimSettled) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.tokenomics.EventClaimSettled.num_estimated_compute_units": return protoreflect.ValueOfUint64(uint64(0)) - case "poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt": + case "poktroll.tokenomics.EventClaimSettled.claimed_upokt": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: @@ -1114,8 +1114,8 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { if x.NumEstimatedComputeUnits != 0 { n += 1 + runtime.Sov(uint64(x.NumEstimatedComputeUnits)) } - if x.ClaimedAmountUpokt != nil { - l = options.Size(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + l = options.Size(x.ClaimedUpokt) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -1147,8 +1147,8 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.ClaimedAmountUpokt != nil { - encoded, err := options.Marshal(x.ClaimedAmountUpokt) + if x.ClaimedUpokt != nil { + encoded, err := options.Marshal(x.ClaimedUpokt) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1358,7 +1358,7 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { } case 6: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1385,10 +1385,10 @@ func (x *fastReflection_EventClaimSettled) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.ClaimedAmountUpokt == nil { - x.ClaimedAmountUpokt = &v1beta1.Coin{} + if x.ClaimedUpokt == nil { + x.ClaimedUpokt = &v1beta1.Coin{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedAmountUpokt); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimedUpokt); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -2697,9 +2697,9 @@ type EventClaimExpired struct { // Number of estimated compute units claimed as a function of the number of claimed // compute units and the relay difficulty multiplier for the particular service. NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` - // The amount of uPOKT claimed to be rewarded for the work done as a function of + // The uPOKT coin claimed to be rewarded for the work done as a function of // the number of estimated compute units and the compute uints to token multiplier. - ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` + ClaimedUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt,omitempty"` } func (x *EventClaimExpired) Reset() { @@ -2757,9 +2757,9 @@ func (x *EventClaimExpired) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (x *EventClaimExpired) GetClaimedAmountUpokt() *v1beta1.Coin { +func (x *EventClaimExpired) GetClaimedUpokt() *v1beta1.Coin { if x != nil { - return x.ClaimedAmountUpokt + return x.ClaimedUpokt } return nil } @@ -2782,9 +2782,9 @@ type EventClaimSettled struct { // Number of estimated compute units claimed as a function of the number of claimed // compute units and the relay difficulty multiplier for the particular service. NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units,omitempty"` - // The amount of uPOKT claimed to be rewarded for the work done as a function of + // The uPOKT coin claimed to be rewarded for the work done as a function of // the number of estimated compute units and the compute uints to token multiplier. - ClaimedAmountUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt,omitempty"` + ClaimedUpokt *v1beta1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt,omitempty"` } func (x *EventClaimSettled) Reset() { @@ -2842,9 +2842,9 @@ func (x *EventClaimSettled) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (x *EventClaimSettled) GetClaimedAmountUpokt() *v1beta1.Coin { +func (x *EventClaimSettled) GetClaimedUpokt() *v1beta1.Coin { if x != nil { - return x.ClaimedAmountUpokt + return x.ClaimedUpokt } return nil } @@ -2985,7 +2985,7 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8b, 0x04, 0x0a, 0x11, 0x45, 0x76, 0x65, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, @@ -3012,92 +3012,90 @@ var file_poktroll_tokenomics_event_proto_rawDesc = []byte{ 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, - 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, - 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0x87, 0x04, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, - 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, - 0x69, 0x6d, 0x42, 0x09, 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, - 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x6a, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x70, 0x72, 0x6f, - 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x10, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x2d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, - 0x6c, 0x61, 0x79, 0x73, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, - 0x58, 0x0a, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, - 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x04, 0x42, 0x1d, 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, - 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, - 0x73, 0x52, 0x16, 0x6e, 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, - 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, - 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, - 0xea, 0xde, 0x1f, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, - 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, - 0x18, 0x6e, 0x75, 0x6d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x63, 0x6c, 0x61, - 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, - 0x69, 0x6e, 0x42, 0x18, 0xea, 0xde, 0x1f, 0x14, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x12, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6f, 0x6b, 0x74, - 0x22, 0x81, 0x02, 0x0a, 0x1c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x64, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x34, 0x0a, 0x16, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, - 0x64, 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x62, - 0x75, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x42, 0x75, - 0x72, 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, - 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0d, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x42, 0x75, 0x72, 0x6e, 0x22, 0xbe, 0x01, 0x0a, 0x14, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x64, 0x12, 0x34, 0x0a, - 0x16, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x10, 0x6e, 0x75, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x43, 0x6c, 0x61, 0x69, 0x6d, - 0x73, 0x12, 0x42, 0x0a, 0x0f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x41, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, - 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x21, - 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, - 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, - 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x49, 0x4e, - 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 0x42, 0xbc, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x17, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, - 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, - 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x51, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, + 0x6e, 0x42, 0x11, 0xea, 0xde, 0x1f, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, + 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x55, 0x70, 0x6f, + 0x6b, 0x74, 0x22, 0xf3, 0x03, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x09, + 0xea, 0xde, 0x1f, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, + 0x12, 0x6a, 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, + 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, + 0x73, 0x6f, 0x6e, 0x42, 0x15, 0xea, 0xde, 0x1f, 0x11, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2d, 0x0a, 0x0a, + 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x0e, 0xea, 0xde, 0x1f, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, + 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x58, 0x0a, 0x19, 0x6e, + 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, + 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1d, + 0xea, 0xde, 0x1f, 0x19, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, + 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x16, 0x6e, + 0x75, 0x6d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x1b, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, + 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, + 0x6e, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1f, 0xea, 0xde, 0x1f, 0x1b, + 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, + 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x18, 0x6e, 0x75, 0x6d, + 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, + 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x51, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, + 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x11, 0xea, 0xde, 0x1f, 0x0d, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x6f, 0x6b, 0x74, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x65, 0x64, 0x55, 0x70, 0x6f, 0x6b, 0x74, 0x22, 0x81, 0x02, 0x0a, 0x1c, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x41, 0x64, 0x64, 0x72, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, + 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0c, 0x65, 0x78, + 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x66, + 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x62, 0x75, 0x72, 0x6e, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0d, 0x65, + 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x42, 0x75, 0x72, 0x6e, 0x22, 0xbe, 0x01, 0x0a, + 0x14, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x6c, + 0x61, 0x73, 0x68, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x6e, + 0x75, 0x6d, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x6e, 0x75, 0x6d, 0x45, 0x78, 0x70, 0x69, + 0x72, 0x65, 0x64, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0f, 0x73, 0x6c, 0x61, + 0x73, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x0e, 0x73, + 0x6c, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x60, 0x0a, + 0x15, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x1d, 0x45, 0x58, 0x50, 0x49, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, + 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, + 0x4f, 0x46, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, + 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 0x42, + 0xbc, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, + 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, + 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3127,10 +3125,10 @@ var file_poktroll_tokenomics_event_proto_goTypes = []interface{}{ var file_poktroll_tokenomics_event_proto_depIdxs = []int32{ 5, // 0: poktroll.tokenomics.EventClaimExpired.claim:type_name -> poktroll.proof.Claim 0, // 1: poktroll.tokenomics.EventClaimExpired.expiration_reason:type_name -> poktroll.tokenomics.ClaimExpirationReason - 6, // 2: poktroll.tokenomics.EventClaimExpired.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 6, // 2: poktroll.tokenomics.EventClaimExpired.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin 5, // 3: poktroll.tokenomics.EventClaimSettled.claim:type_name -> poktroll.proof.Claim 7, // 4: poktroll.tokenomics.EventClaimSettled.proof_requirement:type_name -> poktroll.proof.ProofRequirementReason - 6, // 5: poktroll.tokenomics.EventClaimSettled.claimed_amount_upokt:type_name -> cosmos.base.v1beta1.Coin + 6, // 5: poktroll.tokenomics.EventClaimSettled.claimed_upokt:type_name -> cosmos.base.v1beta1.Coin 6, // 6: poktroll.tokenomics.EventApplicationOverserviced.expected_burn:type_name -> cosmos.base.v1beta1.Coin 6, // 7: poktroll.tokenomics.EventApplicationOverserviced.effective_burn:type_name -> cosmos.base.v1beta1.Coin 6, // 8: poktroll.tokenomics.EventSupplierSlashed.slashing_amount:type_name -> cosmos.base.v1beta1.Coin diff --git a/docusaurus/docs/develop/developer_guide/adding_params.md b/docusaurus/docs/develop/developer_guide/adding_params.md index 37ff71d1f..0843a6d81 100644 --- a/docusaurus/docs/develop/developer_guide/adding_params.md +++ b/docusaurus/docs/develop/developer_guide/adding_params.md @@ -148,9 +148,19 @@ with the default value for the new parameter. "@type": "/poktroll.proof.MsgUpdateParams", "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "params": { - "min_relay_difficulty_bits": "0", "proof_request_probability": "0.25", - "proof_requirement_threshold": "20", + "proof_requirement_threshold": { + "denom": "upokt", + "amount": "20000000" + }, + "proof_missing_penalty": { + "amount": "320000000", + "denom": "upokt" + }, + "proof_submission_fee": { + "amount": "1000000", + "denom": "upokt" + }, "new_parameter_name": "100" // Add this line } } diff --git a/makefiles/params.mk b/makefiles/params.mk index e2f736f10..3e577ab52 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -40,10 +40,6 @@ params_get_proof: ## Get the proof module params params_update_proof_all: ## Update the proof module params poktrolld tx authz exec ./tools/scripts/params/proof_all.json $(PARAM_FLAGS) -.PHONY: params_update_proof_min_relay_difficulty_bits -params_update_proof_min_relay_difficulty_bits: ## Update the proof module min_relay_difficulty_bits param - poktrolld tx authz exec ./tools/scripts/params/proof_min_relay_difficulty_bits.json $(PARAM_FLAGS) - .PHONY: params_update_proof_proof_request_probability params_update_proof_proof_request_probability: ## Update the proof module proof_request_probability param poktrolld tx authz exec ./tools/scripts/params/proof_proof_request_probability.json $(PARAM_FLAGS) diff --git a/pkg/client/interface.go b/pkg/client/interface.go index fd294b8e8..ad963cbbe 100644 --- a/pkg/client/interface.go +++ b/pkg/client/interface.go @@ -356,7 +356,7 @@ type ProofQueryClient interface { type ServiceQueryClient interface { // GetService queries the chain for the details of the service provided GetService(ctx context.Context, serviceId string) (sharedtypes.Service, error) - GetServiceRelayDifficultyTargetHash(ctx context.Context, serviceId string) (servicetypes.RelayMiningDifficulty, error) + GetServiceRelayDifficulty(ctx context.Context, serviceId string) (servicetypes.RelayMiningDifficulty, error) } // BankQueryClient defines an interface that enables the querying of the diff --git a/pkg/client/query/servicequerier.go b/pkg/client/query/servicequerier.go index af0ec64e9..6b0dba20b 100644 --- a/pkg/client/query/servicequerier.go +++ b/pkg/client/query/servicequerier.go @@ -5,8 +5,11 @@ import ( "cosmossdk.io/depinject" "github.com/cosmos/gogoproto/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/crypto/protocol" servicetypes "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -61,9 +64,9 @@ func (servq *serviceQuerier) GetService( return res.Service, nil } -// GetServiceRelayDifficultyTargetHash queries the onchain data for +// GetServiceRelayDifficulty queries the onchain data for // the relay mining difficulty associated with the given service. -func (servq *serviceQuerier) GetServiceRelayDifficultyTargetHash( +func (servq *serviceQuerier) GetServiceRelayDifficulty( ctx context.Context, serviceId string, ) (servicetypes.RelayMiningDifficulty, error) { @@ -72,8 +75,19 @@ func (servq *serviceQuerier) GetServiceRelayDifficultyTargetHash( } res, err := servq.serviceQuerier.RelayMiningDifficulty(ctx, req) + if status.Code(err) == codes.NotFound { + newServiceDifficulty := servicetypes.RelayMiningDifficulty{ + ServiceId: serviceId, + BlockHeight: 0, + NumRelaysEma: 0, + TargetHash: protocol.BaseRelayDifficultyHashBz, + } + + return newServiceDifficulty, nil + } if err != nil { return servicetypes.RelayMiningDifficulty{}, err } + return res.RelayMiningDifficulty, nil } diff --git a/pkg/relayer/miner/gen/gen_fixtures.go b/pkg/relayer/miner/gen/gen_fixtures.go index 01c91392b..857049f5a 100644 --- a/pkg/relayer/miner/gen/gen_fixtures.go +++ b/pkg/relayer/miner/gen/gen_fixtures.go @@ -40,7 +40,6 @@ const ( defaultSvcID = "svc1" ) -// TODO_FOLLOWUP(@olshansk, #690): Do a global anycase grep for "DifficultyBits" and update/remove things appropriately. var ( // flagDifficultyThresholdHashStr is the difficulty threshold hash, as a hex string, that a // randomized, serialized relay must be greater than to be included in the diff --git a/pkg/relayer/miner/miner.go b/pkg/relayer/miner/miner.go index 8205ae5f7..b6ed55e0e 100644 --- a/pkg/relayer/miner/miner.go +++ b/pkg/relayer/miner/miner.go @@ -128,11 +128,9 @@ func (mnr *miner) getServiceRelayDifficultyTargetHash(ctx context.Context, req * return nil, fmt.Errorf("invalid session header: %w", err) } - serviceRelayDifficulty, err := mnr.serviceQueryClient.GetServiceRelayDifficultyTargetHash(ctx, sessionHeader.ServiceId) + serviceRelayDifficulty, err := mnr.serviceQueryClient.GetServiceRelayDifficulty(ctx, sessionHeader.ServiceId) if err != nil { - // TODO_IMPROVE: log the error and a message saying the default relay difficulty target hash - // is being used. - return protocol.BaseRelayDifficultyHashBz, nil + return nil, err } return serviceRelayDifficulty.GetTargetHash(), nil diff --git a/pkg/relayer/miner/miner_test.go b/pkg/relayer/miner/miner_test.go index fc0df6b6c..7afbf69d2 100644 --- a/pkg/relayer/miner/miner_test.go +++ b/pkg/relayer/miner/miner_test.go @@ -46,12 +46,10 @@ func TestMiner_MinedRelays(t *testing.T) { expectedMinedRelays = unmarshalHexMinedRelays(t, marshaledMinableRelaysHex) ) - proofQueryClientMock := testqueryclients.NewTestProofQueryClient(t) - testqueryclients.SetServiceRelayDifficultyTargetHash(t, testSvcId, testRelayMiningTargetHash) serviceQueryClientMock := testqueryclients.NewTestServiceQueryClient(t) - deps := depinject.Supply(proofQueryClientMock, serviceQueryClientMock) + deps := depinject.Supply(serviceQueryClientMock) mnr, err := miner.NewMiner(deps) require.NoError(t, err) diff --git a/pkg/relayer/session/claim.go b/pkg/relayer/session/claim.go index ef758c28d..7bf05924b 100644 --- a/pkg/relayer/session/claim.go +++ b/pkg/relayer/session/claim.go @@ -315,10 +315,12 @@ func (rs *relayerSessionsManager) payableProofsSessionTrees( ).Warn().Msg("supplier operator cannot afford to submit proof for claim, skipping") } - logger.Warn().Msgf( - "Supplier operator %q can only afford %d out of %d claims", - supplierOpeartorAddress, len(claimableSessionTrees), len(sessionTrees), - ) + if len(claimableSessionTrees) < len(sessionTrees) { + logger.Warn().Msgf( + "Supplier operator %q can only afford %d out of %d claims", + supplierOpeartorAddress, len(claimableSessionTrees), len(sessionTrees), + ) + } return claimableSessionTrees, nil } diff --git a/pkg/relayer/session/proof.go b/pkg/relayer/session/proof.go index 5bb965f34..05f6b4cbe 100644 --- a/pkg/relayer/session/proof.go +++ b/pkg/relayer/session/proof.go @@ -15,7 +15,6 @@ import ( "github.com/pokt-network/poktroll/x/proof/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" "github.com/pokt-network/poktroll/x/shared" - tokenomics "github.com/pokt-network/poktroll/x/tokenomics" ) // submitProofs maps over the given claimedSessions observable. @@ -277,24 +276,25 @@ func (rs *relayerSessionsManager) isProofRequired( // Create the claim object and use its methods to determine if a proof is required. claim := claimFromSessionTree(sessionTree) - // Get the number of compute units accumulated through the given session. - numClaimComputeUnits, err := claim.GetNumClaimedComputeUnits() + proofParams, err := rs.proofQueryClient.GetParams(ctx) if err != nil { return false, err } - proofParams, err := rs.proofQueryClient.GetParams(ctx) + sharedParams, err := rs.sharedQueryClient.GetParams(ctx) if err != nil { return false, err } - sharedParams, err := rs.sharedQueryClient.GetParams(ctx) + // Retrieving the relay mining difficulty for the service at hand + serviceId := claim.GetSessionHeader().GetServiceId() + relayMiningDifficulty, err := rs.serviceQueryClient.GetServiceRelayDifficulty(ctx, serviceId) if err != nil { return false, err } // The amount of uPOKT being claimed. - claimedAmount, err := tokenomics.NumComputeUnitsToCoin(*sharedParams, numClaimComputeUnits) + claimedAmount, err := claim.GetClaimeduPOKT(*sharedParams, relayMiningDifficulty) if err != nil { return false, err } diff --git a/pkg/relayer/session/session_test.go b/pkg/relayer/session/session_test.go index 5fccd391b..31e094a42 100644 --- a/pkg/relayer/session/session_test.go +++ b/pkg/relayer/session/session_test.go @@ -60,6 +60,8 @@ func requireProofCountEqualsExpectedValueFromProofParams(t *testing.T, proofPara Id: "svc", ComputeUnitsPerRelay: 2, } + + testqueryclients.SetServiceRelayDifficultyTargetHash(t, service.Id, protocol.BaseRelayDifficultyHashBz) // Add the service to the existing services. testqueryclients.AddToExistingServices(t, service) @@ -157,12 +159,14 @@ func TestRelayerSessionsManager_InsufficientBalanceForProofSubmission(t *testing ComputeUnitsPerRelay: 1, } testqueryclients.AddToExistingServices(t, lowCUPRService) + testqueryclients.SetServiceRelayDifficultyTargetHash(t, lowCUPRService.Id, protocol.BaseRelayDifficultyHashBz) highCUPRService := sharedtypes.Service{ Id: "highCUPRService", ComputeUnitsPerRelay: 2, } testqueryclients.AddToExistingServices(t, highCUPRService) + testqueryclients.SetServiceRelayDifficultyTargetHash(t, highCUPRService.Id, protocol.BaseRelayDifficultyHashBz) lowCUPRServiceActiveSession := &sessiontypes.Session{ Header: &sessiontypes.SessionHeader{ diff --git a/proto/poktroll/proof/event.proto b/proto/poktroll/proof/event.proto index 303e684a9..b4e99aad9 100644 --- a/proto/poktroll/proof/event.proto +++ b/proto/poktroll/proof/event.proto @@ -13,7 +13,7 @@ message EventClaimCreated { uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; - cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; + cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"]; } // TODO_TEST: Add coverage for claim updates. @@ -22,7 +22,7 @@ message EventClaimUpdated { uint64 num_relays = 2 [(gogoproto.jsontag) = "num_relays"]; uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; - cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; + cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"]; } message EventProofSubmitted { @@ -31,7 +31,7 @@ message EventProofSubmitted { uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; - cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; + cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"]; } // TODO_TEST: Add coverage for proof updates. @@ -41,5 +41,5 @@ message EventProofUpdated { uint64 num_relays = 3 [(gogoproto.jsontag) = "num_relays"]; uint64 num_claimed_compute_units = 4 [(gogoproto.jsontag) = "num_claimed_compute_units"]; uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; - cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; + cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"]; } diff --git a/proto/poktroll/service/relay_mining_difficulty.proto b/proto/poktroll/service/relay_mining_difficulty.proto index b994c5db5..aaade441a 100644 --- a/proto/poktroll/service/relay_mining_difficulty.proto +++ b/proto/poktroll/service/relay_mining_difficulty.proto @@ -8,6 +8,7 @@ import "gogoproto/gogo.proto"; // RelayMiningDifficulty is a message used to store the on-chain Relay Mining // difficulty associated with a specific service ID. +// TODO_TECHDEBT: Embed this message in the Service message. message RelayMiningDifficulty { // The service ID the relay mining difficulty is associated with. string service_id = 1; diff --git a/proto/poktroll/tokenomics/event.proto b/proto/poktroll/tokenomics/event.proto index 18dc68ea2..fb807d121 100644 --- a/proto/poktroll/tokenomics/event.proto +++ b/proto/poktroll/tokenomics/event.proto @@ -29,9 +29,9 @@ message EventClaimExpired { // Number of estimated compute units claimed as a function of the number of claimed // compute units and the relay difficulty multiplier for the particular service. uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; - // The amount of uPOKT claimed to be rewarded for the work done as a function of + // The uPOKT coin claimed to be rewarded for the work done as a function of // the number of estimated compute units and the compute uints to token multiplier. - cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; + cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"]; } // EventClaimSettled is an event emitted whenever a claim is settled. @@ -48,9 +48,9 @@ message EventClaimSettled { // Number of estimated compute units claimed as a function of the number of claimed // compute units and the relay difficulty multiplier for the particular service. uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"]; - // The amount of uPOKT claimed to be rewarded for the work done as a function of + // The uPOKT coin claimed to be rewarded for the work done as a function of // the number of estimated compute units and the compute uints to token multiplier. - cosmos.base.v1beta1.Coin claimed_amount_upokt = 6 [(gogoproto.jsontag) = "claimed_amount_upokt"]; + cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"]; } // EventApplicationOverserviced is emitted when an application has less stake than diff --git a/tests/integration/service/relay_mining_difficulty_test.go b/tests/integration/service/relay_mining_difficulty_test.go index f3048fed4..7b34bd71e 100644 --- a/tests/integration/service/relay_mining_difficulty_test.go +++ b/tests/integration/service/relay_mining_difficulty_test.go @@ -2,12 +2,15 @@ package integration_test import ( "context" + "math" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/smt" "github.com/pokt-network/smt/kvstore/pebble" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/pkg/crypto/protocol" testutilevents "github.com/pokt-network/poktroll/testutil/events" @@ -38,6 +41,20 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) // Get the current session and shared params session := getSession(t, integrationApp) sharedParams := getSharedParams(t, integrationApp) + proofParams := getProofParams(t, integrationApp) + + // Update the proof parameters to never require a proof, since this test is not + // submitting any proofs. + maxProofRequirementThreshold := sdk.NewInt64Coin(volatile.DenomuPOKT, math.MaxInt64) + proofParams.ProofRequirementThreshold = &maxProofRequirementThreshold + proofParams.ProofRequestProbability = 0 + + msgProofParams := prooftypes.MsgUpdateParams{ + Authority: integrationApp.GetAuthority(), + Params: proofParams, + } + _, err := integrationApp.RunMsg(t, &msgProofParams) + require.NoError(t, err) // Prepare the trie with several mined relays expectedNumRelays := uint64(100) @@ -138,6 +155,21 @@ func getSharedParams(t *testing.T, integrationApp *testutil.App) sharedtypes.Par return sharedQueryRes.Params } +// getProofParams returns the proof parameters for the current block height. +func getProofParams(t *testing.T, integrationApp *testutil.App) prooftypes.Params { + t.Helper() + + sdkCtx := integrationApp.GetSdkCtx() + + proofQueryClient := prooftypes.NewQueryClient(integrationApp.QueryHelper()) + proofParamsReq := prooftypes.QueryParamsRequest{} + + proofQueryRes, err := proofQueryClient.Params(sdkCtx, &proofParamsReq) + require.NoError(t, err) + + return proofQueryRes.Params +} + // getSession returns the current session for the default application and service. func getSession(t *testing.T, integrationApp *testutil.App) *sessiontypes.Session { t.Helper() diff --git a/tests/integration/tokenomics/relay_mining_integration_test.go b/tests/integration/tokenomics/relay_mining_integration_test.go index 3b296b298..2beeb2196 100644 --- a/tests/integration/tokenomics/relay_mining_integration_test.go +++ b/tests/integration/tokenomics/relay_mining_integration_test.go @@ -1,143 +1,215 @@ package integration_test import ( - "context" + "math" + "math/big" "testing" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/smt" "github.com/pokt-network/smt/kvstore/pebble" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/pkg/crypto/protocol" - "github.com/pokt-network/poktroll/testutil/integration" - "github.com/pokt-network/poktroll/testutil/integration/suites" + testutils "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/testutil/testrelayer" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -var ( -// TODO_BETA(#826): Uncomment these -// Test params. -// computeUnitsToTokensMultiplier = uint64(1) // keeping the math simple -// proofRequirementThreshold = sdk.NewInt64Coin(volatile.DenomuPOKT, 1e18) +const ( + initialNumRelays = uint64(1e3) + // DEV_NOTE: Max numRelays is set so that the test doesn't timeout. + maxNumRelays = uint64(1024e3) ) -type RelayMiningIntegrationTestSuite struct { - suites.ParamsSuite -} +func TestComputeNewDifficultyHash_RewardsReflectWorkCompleted(t *testing.T) { + // Update the target number of relays to a value that suits the test. + // A too high number would make the difficulty stay at BaseRelayDifficultyHash + initialTargetRelays := servicekeeper.TargetNumRelays + servicekeeper.TargetNumRelays = 1000 + t.Cleanup(func() { + // Reset the target number of relays to its initial value. + servicekeeper.TargetNumRelays = initialTargetRelays + }) + + // Prepare the test service. + service := sharedtypes.Service{ + Id: "svc1", + Name: "svcName1", + ComputeUnitsPerRelay: 1, + OwnerAddress: sample.AccAddress(), + } -func (s *RelayMiningIntegrationTestSuite) SetupTest() { - // Construct a fresh integration app for each test. - s.NewApp(s.T()) - s.SetupTestAuthzAccounts(s.T()) - s.SetupTestAuthzGrants(s.T()) -} + // Prepare the test application. + appAddress := sample.AccAddress() + appStake := apptypes.DefaultMinStake.Add(apptypes.DefaultMinStake) + application := apptypes.Application{ + Address: appAddress, + Stake: &appStake, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + {ServiceId: service.Id}, + }, + } + + // Prepare the test supplier. + supplierAddress := sample.AccAddress() + // TODO(#850): Update supplier stake to be min stake + supplierStake := sdk.NewInt64Coin(volatile.DenomuPOKT, 1000) + supplier := sharedtypes.Supplier{ + OperatorAddress: supplierAddress, + OwnerAddress: supplierAddress, + Stake: &supplierStake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + ServiceId: service.Id, + RevShare: []*sharedtypes.ServiceRevenueShare{ + { + Address: supplierAddress, + RevSharePercentage: 100, + }, + }, + }, + }, + } + + keepers, ctx := testutils.NewTokenomicsModuleKeepers(t, nil, + testutils.WithService(service), + testutils.WithApplication(application), + testutils.WithSupplier(supplier), + ) + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx = sdkCtx.WithBlockHeight(1) + + // Set the CUTTM to 1 to simplify the math + sharedParams := keepers.SharedKeeper.GetParams(sdkCtx) + sharedParams.ComputeUnitsToTokensMultiplier = uint64(1) + err := keepers.SharedKeeper.SetParams(sdkCtx, sharedParams) + require.NoError(t, err) + + // Set the global proof params so we never need a proof (for simplicity of this test) + err = keepers.ProofKeeper.SetParams(sdkCtx, prooftypes.Params{ + ProofRequestProbability: 0, // we never need a proof randomly + ProofRequirementThreshold: &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: sdkmath.NewInt(math.MaxInt64)}, // a VERY high threshold + }) + require.NoError(t, err) + + // Update the relay mining difficulty so there's always a difficulty to retrieve + // for the test service. + _, err = keepers.ServiceKeeper.UpdateRelayMiningDifficulty(sdkCtx, map[string]uint64{service.Id: 1}) + require.NoError(t, err) + + // Set the previous relays and rewards to be used to calculate the increase ratio. + previousNumRelays := uint64(0) + previousRewardsAmount := sdkmath.NewInt(0) + + // Set the initial difficulty multiplier to later check that it has increased. + difficultyMultiplier := big.NewRat(1, 1) + + // Monotonically increase the number of relays from a very small number + // to a very large number. + for numRelays := initialNumRelays; numRelays <= maxNumRelays; numRelays *= 2 { + getSessionReq := sessiontypes.QueryGetSessionRequest{ + ApplicationAddress: appAddress, + ServiceId: service.Id, + BlockHeight: sdkCtx.BlockHeight(), + } + sessionRes, err := keepers.SessionKeeper.GetSession(sdkCtx, &getSessionReq) + require.NoError(t, err) + + session := sessionRes.Session -func (s *RelayMiningIntegrationTestSuite) TestComputeNewDifficultyHash_RewardsReflectWorkCompleted() { - // Set the shared module param compute_units_to_tokens_multiplier. - // TODO_BETA(#826): wait for integration app & suites refactor to be merged. - // _, err := s.RunUpdateParam(s.T(), - // sharedtypes.ModuleName, - // sharedtypes.ParamComputeUnitsToTokensMultiplier, - // computeUnitsToTokensMultiplier, - // ) - // require.NoError(s.T(), err) - - // Set the proof params so we never need a proof (for simplicity of this test) - // TODO_BETA(#826): wait for integration app & suites refactor to be merged. - // _, err = s.RunUpdateParam(s.T(), - // prooftypes.ModuleName, - // prooftypes.ParamProofRequestProbability, - // float32(0), - // ) - // require.NoError(s.T(), err) - - // Set the proof requirement threshold to be VERY high. - // TODO_BETA(#826): wait for integration app & suites refactor to be merged. - // _, err = s.RunUpdateParam(s.T(), - // prooftypes.ModuleName, - // prooftypes.ParamProofRequirementThreshold, - // &proofRequirementThreshold, - // ) - // require.NoError(s.T(), err) - - // TODO(@red-0ne, #781): Implement this test after the business logic is done. - - /* // Determine the height at which the claim will expire. - sharedParams := sharedtypes.DefaultParams() - claimWindowSizeBlocks := int64(sharedParams.GetClaimWindowOpenOffsetBlocks() + sharedParams.GetClaimWindowCloseOffsetBlocks()) - proofWindowSizeBlocks := int64(sharedParams.GetProofWindowOpenOffsetBlocks() + sharedParams.GetProofWindowCloseOffsetBlocks()) + sessionEndToProofWindowCloseBlocks := sharedtypes.GetSessionEndToProofWindowCloseBlocks(&sharedParams) + sessionEndHeight := session.GetHeader().GetSessionEndBlockHeight() + claimExpirationHeight := sessionEndHeight + int64(sessionEndToProofWindowCloseBlocks) + 1 - app := integrationApp.DefaultApplication - supplier := integrationApp.DefaultSupplier - service := integrationApp.DefaultService + sdkCtx = sdkCtx.WithBlockHeight(claimExpirationHeight) - // Monotonically increase the number of relays from a very small number - // to a very large number - for numRelays := uint64(1e3); numRelays <= 1e16; numRelays *= 10 { - session := getSession(t, integrationApp) + // Get the relay mining difficulty that will be used when settling the pending claims. + relayMiningDifficulty, ok := keepers.ServiceKeeper.GetRelayMiningDifficulty(sdkCtx, service.Id) + require.True(t, ok) - sessionEndHeight := session.GetHeader().GetSessionEndBlockHeight() - claimExpirationHeight := int64(sessionEndHeight + claimWindowSizeBlocks + proofWindowSizeBlocks + 1) + // Prepare a claim with the given number of relays. + claim := prepareRealClaim(t, numRelays, supplierAddress, session, &service, &relayMiningDifficulty) - ctxAtHeight := sdkCtx.WithBlockHeight(claimExpirationHeight) + // Get the claim's expected reward. + claimedRewards, err := claim.GetClaimeduPOKT(sharedParams, relayMiningDifficulty) + require.NoError(t, err) - relayMiningDifficulty, ok := keepers.TokenomicsKeeper.GetRelayMiningDifficulty(ctxAtHeight, service.Id) - require.True(t, ok) + // Get the number of claimed mined relays. + claimNumRelays, err := claim.GetNumRelays() + require.NoError(t, err) - // Prepare a claim with the given number of relays and store it - claim := prepareRealClaim(t, ctxAtHeight, integrationApp, numRelays, app, supplier, session, service, &relayMiningDifficulty) - keepers.ProofKeeper.UpsertClaim(ctxAtHeight, *claim) + // Store the claim before settling it. + keepers.ProofKeeper.UpsertClaim(sdkCtx, *claim) - // Calling SettlePendingClaims calls ProcessTokenLogicModules behind the scenes - settledResult, expiredResult, err := keepers.TokenomicsKeeper.SettlePendingClaims(ctxAtHeight) - require.NoError(t, err) - require.Equal(t, 1, int(settledResult.NumClaims)) - require.Equal(t, 0, int(expiredResult.NumClaims)) + // Calling SettlePendingClaims calls ProcessTokenLogicModules behind the scenes + settledResult, expiredResult, err := keepers.Keeper.SettlePendingClaims(sdkCtx) + require.NoError(t, err) + require.Equal(t, 1, int(settledResult.NumClaims)) + require.Equal(t, 0, int(expiredResult.NumClaims)) - // Update the relay mining difficulty - _, err = keepers.TokenomicsKeeper.UpdateRelayMiningDifficulty(ctxAtHeight, map[string]uint64{service.Id: numRelays}) - require.NoError(t, err) + // Update the relay mining difficulty + _, err = keepers.Keeper.UpdateRelayMiningDifficulty(sdkCtx, map[string]uint64{service.Id: claimNumRelays}) + require.NoError(t, err) - // Compute the expected reward - expectedReward := numRelays * serviceComputeUnitsPerRelay * computeUnitsToTokensMultiplier - fmt.Println("Expected reward:", expectedReward) + // Get the updated relay mining difficulty + updatedRelayMiningDifficulty, ok := keepers.ServiceKeeper.GetRelayMiningDifficulty(sdkCtx, service.Id) + require.True(t, ok) - // Compute the new difficulty hash - newDifficultyHash := protocol.ComputeNewDifficultyHash(ctx, numRelays) + // Compute the new difficulty hash based on the updated relay mining difficulty. + newDifficultyHash := protocol.ComputeNewDifficultyTargetHash( + protocol.BaseRelayDifficultyHashBz, + servicekeeper.TargetNumRelays, + updatedRelayMiningDifficulty.NumRelaysEma, + ) + + // Check that the updated difficulty hash is correct. + require.Equal(t, newDifficultyHash, updatedRelayMiningDifficulty.TargetHash) - // // Check that the new difficulty hash is correct - require.Equal(t, expectedReward, newDifficultyHash.Reward) + // Check that the new relays EMA has increased. + require.Greater(t, + updatedRelayMiningDifficulty.NumRelaysEma, + relayMiningDifficulty.NumRelaysEma, + ) - // Update the relay mining difficulty and - // - Check that EMA is changing - // - Check that the difficulty is changing + prevDifficultyMultiplier := protocol.GetRelayDifficultyMultiplier(relayMiningDifficulty.TargetHash) + newDifficultyMultiplier := protocol.GetRelayDifficultyMultiplier(updatedRelayMiningDifficulty.TargetHash) + // Check that the new difficulty has increased when it's no longer the base difficulty. + if newDifficultyMultiplier.Cmp(big.NewRat(1, 1)) == 1 { + require.True(t, newDifficultyMultiplier.Cmp(prevDifficultyMultiplier) == 1) + } - // Maintain a map of {num_relays -> num_rewards} - // Then compute, for everything we have in the map (double list) - // - Ratio of curr_relays to prev_relays - // - Ratio of curr_rewards to prev_rewards - // - Ensure the above are the same + // Make sure that the rewards reflect the work completed and that it increases + // proportionally to the number of relays mined. + if previousNumRelays > 0 { + numRelaysRatio := float64(numRelays) / float64(previousNumRelays) + rewardsRatio, _ := new(big.Rat).SetFrac(claimedRewards.Amount.BigInt(), previousRewardsAmount.BigInt()).Float64() + require.InDelta(t, numRelaysRatio, rewardsRatio, 0.1) } - */ + + previousNumRelays = numRelays + previousRewardsAmount = claimedRewards.Amount + difficultyMultiplier = newDifficultyMultiplier + } + + require.Equal(t, difficultyMultiplier.Cmp(big.NewRat(1, 1)), 1) } // prepareRealClaim prepares a claim by creating a real SMST with the given number // of mined relays that adhere to the actual on-chain difficulty of the test service. -// -//nolint:unused // Will be used once the test above is implemented. func prepareRealClaim( - t *testing.T, ctx context.Context, - integrationApp *integration.App, + t *testing.T, numRelays uint64, - app *apptypes.Application, - supplier *sharedtypes.Supplier, + supplierAddress string, session *sessiontypes.Session, service *sharedtypes.Service, relayMiningDifficulty *servicetypes.RelayMiningDifficulty, @@ -153,30 +225,20 @@ func prepareRealClaim( // Insert the mined relays into the SMST for i := uint64(0); i < numRelays; i++ { - // Mine a real relay - minedRelay := testrelayer.NewSignedMinedRelay(t, ctx, - session, - app.Address, - supplier.OperatorAddress, - integrationApp.DefaultSupplierKeyringKeyringUid, - integrationApp.GetKeyRing(), - integrationApp.GetRingClient(), - ) + // DEV_NOTE: Unsigned relays are mined instead of signed relays to avoid calling + // the application querier and signature logic which make the test very slow + // given the large number of iterations involved. + minedRelay := testrelayer.NewUnsignedMinedRelay(t, session, supplierAddress) // Ensure that the relay is applicable to the relay mining difficulty if protocol.IsRelayVolumeApplicable(minedRelay.Hash, relayMiningDifficulty.TargetHash) { err = trie.Update(minedRelay.Hash, minedRelay.Bytes, service.ComputeUnitsPerRelay) require.NoError(t, err) } } - // Return the applicable claim return &prooftypes.Claim{ - SupplierOperatorAddress: integrationApp.DefaultSupplier.GetOperatorAddress(), + SupplierOperatorAddress: supplierAddress, SessionHeader: session.GetHeader(), RootHash: trie.Root(), } } - -func TestRelayMiningIntegrationSuite(t *testing.T) { - suite.Run(t, new(RelayMiningIntegrationTestSuite)) -} diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index d6a50ed25..f9df12788 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -470,6 +470,7 @@ func NewTokenomicsModuleKeepers( return keepers, ctx } +// WithService is an option to set the service in the tokenomics module keepers. func WithService(service sharedtypes.Service) TokenomicsModuleKeepersOpt { return func(ctx context.Context, keepers *TokenomicsModuleKeepers) context.Context { keepers.SetService(ctx, service) @@ -477,6 +478,24 @@ func WithService(service sharedtypes.Service) TokenomicsModuleKeepersOpt { } } +// WithApplication is an option to set the application in the tokenomics module keepers. +func WithApplication(applicaion apptypes.Application) TokenomicsModuleKeepersOpt { + return func(ctx context.Context, keepers *TokenomicsModuleKeepers) context.Context { + keepers.SetApplication(ctx, applicaion) + return ctx + } +} + +// WithSupplier is an option to set the supplier in the tokenomics module keepers. +func WithSupplier(supplier sharedtypes.Supplier) TokenomicsModuleKeepersOpt { + return func(ctx context.Context, keepers *TokenomicsModuleKeepers) context.Context { + keepers.SetSupplier(ctx, supplier) + return ctx + } +} + +// WithProposerAddr is an option to set the proposer address in the context used +// by the tokenomics module keepers. func WithProposerAddr(addr string) TokenomicsModuleKeepersOpt { return func(ctx context.Context, keepers *TokenomicsModuleKeepers) context.Context { valAddr, err := cosmostypes.ValAddressFromBech32(addr) diff --git a/testutil/testclient/testqueryclients/servicequerier.go b/testutil/testclient/testqueryclients/servicequerier.go index d68c2ea3c..58f88c2f8 100644 --- a/testutil/testclient/testqueryclients/servicequerier.go +++ b/testutil/testclient/testqueryclients/servicequerier.go @@ -50,7 +50,7 @@ func NewTestServiceQueryClient( }). AnyTimes() - serviceQuerier.EXPECT().GetServiceRelayDifficultyTargetHash(gomock.Any(), gomock.Any()). + serviceQuerier.EXPECT().GetServiceRelayDifficulty(gomock.Any(), gomock.Any()). DoAndReturn(func( _ context.Context, serviceId string, diff --git a/testutil/testrelayer/relays.go b/testutil/testrelayer/relays.go index 01223f7a5..3b1ac2f91 100644 --- a/testutil/testrelayer/relays.go +++ b/testutil/testrelayer/relays.go @@ -45,13 +45,13 @@ func NewUnsignedMinedRelay( SessionHeader: session.Header, SupplierOperatorAddress: supplierOperatorAddress, }, - Payload: []byte("request_payload"), + Payload: randomPayload(), }, Res: &servicetypes.RelayResponse{ Meta: servicetypes.RelayResponseMetadata{ SessionHeader: session.Header, }, - Payload: []byte("response_payload"), + Payload: randomPayload(), }, } diff --git a/tools/scripts/params/proof_all.json b/tools/scripts/params/proof_all.json index 182ce6316..73e080cd9 100644 --- a/tools/scripts/params/proof_all.json +++ b/tools/scripts/params/proof_all.json @@ -5,7 +5,6 @@ "@type": "/poktroll.proof.MsgUpdateParams", "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "params": { - "min_relay_difficulty_bits": "0", "proof_request_probability": "0.25", "proof_requirement_threshold": { "denom": "upokt", diff --git a/tools/scripts/params/proof_min_relay_difficulty_bits.json b/tools/scripts/params/proof_min_relay_difficulty_bits.json deleted file mode 100644 index 72c14a1d5..000000000 --- a/tools/scripts/params/proof_min_relay_difficulty_bits.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/poktroll.proof.MsgUpdateParam", - "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", - "name": "min_relay_difficulty_bits", - "as_int64": "0" - } - ] - } -} diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index b7f90fa36..4101cbfed 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -15,9 +15,9 @@ import ( "github.com/pokt-network/poktroll/telemetry" "github.com/pokt-network/poktroll/x/proof/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/tokenomics" ) // SubmitProof is the server handler to submit and store a proof on-chain. @@ -120,11 +120,12 @@ func (k msgServer) SubmitProof( if err != nil { return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } + // DEV_NOTE: It is assumed that numClaimComputeUnits = numRelays * serviceComputeUnitsPerRelay + // has been checked during the claim creation process. numClaimComputeUnits, err = claim.GetNumClaimedComputeUnits() if err != nil { return nil, status.Error(codes.Internal, types.ErrProofInvalidClaimRootHash.Wrap(err.Error()).Error()) } - // DEV_NOTE: It is assumed that numComputeUnits = numRelays * serviceComputeUnitsPerRelay // Check if a prior proof already exists. _, isExistingProof = k.GetProof(ctx, proof.SessionHeader.SessionId, proof.SupplierOperatorAddress) @@ -223,22 +224,19 @@ func (k Keeper) ProofRequirementForClaim(ctx context.Context, claim *types.Claim telemetry.ProofRequirementCounter(requirementReason, err) }() - // NB: Assumption that claim is non-nil and has a valid root sum because it - // is retrieved from the store and validated, on-chain, at time of creation. - // TODO(@red-0ne, #781): Ensure we're using the scaled/estimated compute units here. - var numClaimComputeUnits uint64 - numClaimComputeUnits, err = claim.GetNumClaimedComputeUnits() - if err != nil { - return requirementReason, err - } - proofParams := k.GetParams(ctx) sharedParams := k.sharedKeeper.GetParams(ctx) + serviceId := claim.GetSessionHeader().GetServiceId() + relayMiningDifficulty, found := k.serviceKeeper.GetRelayMiningDifficulty(ctx, serviceId) + if !found { + relayMiningDifficulty = servicekeeper.NewDefaultRelayMiningDifficulty(ctx, logger, serviceId, servicekeeper.TargetNumRelays) + } + // Retrieve the number of tokens claimed to compare against the threshold. // Different services have varying compute_unit -> token multipliers, so the // threshold value is done in a common unit denomination. - claimeduPOKT, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits) + claimeduPOKT, err := claim.GetClaimeduPOKT(sharedParams, relayMiningDifficulty) if err != nil { return requirementReason, err } diff --git a/x/proof/types/claim.go b/x/proof/types/claim.go index 37b144d6d..08b3dc406 100644 --- a/x/proof/types/claim.go +++ b/x/proof/types/claim.go @@ -1,10 +1,18 @@ package types import ( + "math/big" + + "cosmossdk.io/math" "github.com/cometbft/cometbft/crypto" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/smt" + "github.com/pokt-network/poktroll/app/volatile" + "github.com/pokt-network/poktroll/pkg/crypto/protocol" poktrand "github.com/pokt-network/poktroll/pkg/crypto/rand" + servicetypes "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) // GetNumClaimedComputeUnits returns the number of compute units for a given claim @@ -19,6 +27,79 @@ func (claim *Claim) GetNumRelays() (numRelays uint64, err error) { return smt.MerkleSumRoot(claim.GetRootHash()).Count() } +// GetNumEstimatedComputeUnits returns the claim's estimated number of compute units. +func (claim *Claim) GetNumEstimatedComputeUnits( + relayMiningDifficulty servicetypes.RelayMiningDifficulty, +) (numEstimatedComputeUnits uint64, err error) { + numEstimatedComputeUnitsRat, err := claim.getNumEstimatedComputeUnitsRat(relayMiningDifficulty) + if err != nil { + return 0, err + } + + numerator := numEstimatedComputeUnitsRat.Num() + denominator := numEstimatedComputeUnitsRat.Denom() + + return new(big.Int).Div(numerator, denominator).Uint64(), nil +} + +// GetClaimeduPOKT returns the claim's reward based on the relay mining difficulty +// and global network parameters. +func (claim *Claim) GetClaimeduPOKT( + sharedParams sharedtypes.Params, + relayMiningDifficulty servicetypes.RelayMiningDifficulty, +) (sdk.Coin, error) { + // Get the estimated number of compute units as a ratio to calculate the reward + // to avoid precision loss. + numEstimatedComputeUnitsRat, err := claim.getNumEstimatedComputeUnitsRat(relayMiningDifficulty) + if err != nil { + return sdk.Coin{}, err + } + + computeUnitsToTokenMultiplierRat := new(big.Rat).SetUint64(sharedParams.GetComputeUnitsToTokensMultiplier()) + + // CUTTM is a GLOBAL network wide parameter. + upoktAmountRat := new(big.Rat).Mul(numEstimatedComputeUnitsRat, computeUnitsToTokenMultiplierRat) + + // Perform the division as late as possible to minimize precision loss. + upoktAmount := new(big.Int).Div(upoktAmountRat.Num(), upoktAmountRat.Denom()) + if upoktAmount.Sign() < 0 { + return sdk.Coin{}, ErrProofInvalidClaimedAmount.Wrapf( + "num estimated compute units (%s) * CUTTM (%d) resulted in a negative amount: %s", + numEstimatedComputeUnitsRat.RatString(), + sharedParams.GetComputeUnitsToTokensMultiplier(), + upoktAmountRat, + ) + } + + return sdk.NewCoin(volatile.DenomuPOKT, math.NewIntFromBigInt(upoktAmount)), nil +} + +// getNumEstimatedComputeUnitsRat returns the estimated claim's number of compute units +// as a ratio. +func (claim *Claim) getNumEstimatedComputeUnitsRat( + relayMiningDifficulty servicetypes.RelayMiningDifficulty, +) (numEstimatedComputeUnits *big.Rat, err error) { + // Ensure the claim's service ID matches the relay mining difficulty service ID. + if claim.GetSessionHeader().GetServiceId() != relayMiningDifficulty.GetServiceId() { + return nil, ErrProofInvalidRelayDifficulty.Wrapf( + "claim service ID (%s) does not match the service relay mining difficulty service ID (%s)", + claim.GetSessionHeader().GetServiceId(), + relayMiningDifficulty.GetServiceId(), + ) + } + + numComputeUnits, err := claim.GetNumClaimedComputeUnits() + if err != nil { + return nil, err + } + + numComputeUnitsRat := new(big.Rat).SetUint64(numComputeUnits) + difficultyMultiplier := protocol.GetRelayDifficultyMultiplier(relayMiningDifficulty.GetTargetHash()) + numEstimatedComputeUnitsRat := new(big.Rat).Mul(difficultyMultiplier, numComputeUnitsRat) + + return numEstimatedComputeUnitsRat, nil +} + // GetHash returns the SHA-256 hash of the serialized claim. func (claim *Claim) GetHash() ([]byte, error) { claimBz, err := claim.Marshal() diff --git a/x/proof/types/errors.go b/x/proof/types/errors.go index d388b06c9..9a97711b7 100644 --- a/x/proof/types/errors.go +++ b/x/proof/types/errors.go @@ -39,4 +39,5 @@ var ( ErrProofFailedToDeductFee = sdkerrors.Register(ModuleName, 1128, "failed to deduct proof submission fee") ErrProofNotRequired = sdkerrors.Register(ModuleName, 1129, "proof not required") ErrProofInvalidRelayDifficulty = sdkerrors.Register(ModuleName, 1130, "invalid relay difficulty") + ErrProofInvalidClaimedAmount = sdkerrors.Register(ModuleName, 1131, "invalid claimed amount") ) diff --git a/x/proof/types/event.pb.go b/x/proof/types/event.pb.go index 6660aa44e..8e467c0c5 100644 --- a/x/proof/types/event.pb.go +++ b/x/proof/types/event.pb.go @@ -29,7 +29,7 @@ type EventClaimCreated struct { NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` - ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` + ClaimedUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt"` } func (m *EventClaimCreated) Reset() { *m = EventClaimCreated{} } @@ -89,9 +89,9 @@ func (m *EventClaimCreated) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (m *EventClaimCreated) GetClaimedAmountUpokt() *types.Coin { +func (m *EventClaimCreated) GetClaimedUpokt() *types.Coin { if m != nil { - return m.ClaimedAmountUpokt + return m.ClaimedUpokt } return nil } @@ -102,7 +102,7 @@ type EventClaimUpdated struct { NumRelays uint64 `protobuf:"varint,2,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` - ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` + ClaimedUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt"` } func (m *EventClaimUpdated) Reset() { *m = EventClaimUpdated{} } @@ -162,9 +162,9 @@ func (m *EventClaimUpdated) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (m *EventClaimUpdated) GetClaimedAmountUpokt() *types.Coin { +func (m *EventClaimUpdated) GetClaimedUpokt() *types.Coin { if m != nil { - return m.ClaimedAmountUpokt + return m.ClaimedUpokt } return nil } @@ -175,7 +175,7 @@ type EventProofSubmitted struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` - ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` + ClaimedUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt"` } func (m *EventProofSubmitted) Reset() { *m = EventProofSubmitted{} } @@ -242,9 +242,9 @@ func (m *EventProofSubmitted) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (m *EventProofSubmitted) GetClaimedAmountUpokt() *types.Coin { +func (m *EventProofSubmitted) GetClaimedUpokt() *types.Coin { if m != nil { - return m.ClaimedAmountUpokt + return m.ClaimedUpokt } return nil } @@ -256,7 +256,7 @@ type EventProofUpdated struct { NumRelays uint64 `protobuf:"varint,3,opt,name=num_relays,json=numRelays,proto3" json:"num_relays"` NumClaimedComputeUnits uint64 `protobuf:"varint,4,opt,name=num_claimed_compute_units,json=numClaimedComputeUnits,proto3" json:"num_claimed_compute_units"` NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` - ClaimedAmountUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` + ClaimedUpokt *types.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt"` } func (m *EventProofUpdated) Reset() { *m = EventProofUpdated{} } @@ -323,9 +323,9 @@ func (m *EventProofUpdated) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (m *EventProofUpdated) GetClaimedAmountUpokt() *types.Coin { +func (m *EventProofUpdated) GetClaimedUpokt() *types.Coin { if m != nil { - return m.ClaimedAmountUpokt + return m.ClaimedUpokt } return nil } @@ -340,36 +340,36 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/event.proto", fileDescriptor_dd4c19e04487fbec) } var fileDescriptor_dd4c19e04487fbec = []byte{ - // 456 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x95, 0x41, 0x6b, 0xdb, 0x30, - 0x14, 0xc7, 0xe3, 0xa5, 0x29, 0x54, 0x83, 0xc2, 0xbc, 0x6e, 0xb8, 0x19, 0x93, 0xcb, 0x4e, 0xbd, - 0x54, 0xa2, 0x1b, 0xf4, 0xbe, 0x98, 0xde, 0x76, 0x18, 0x1e, 0x81, 0xb1, 0xc3, 0x82, 0xed, 0x68, - 0x99, 0x69, 0xa4, 0x67, 0x6c, 0xa9, 0x5b, 0xbf, 0xc5, 0xee, 0xfb, 0x42, 0x3b, 0x16, 0xc6, 0xa0, - 0x27, 0x33, 0x92, 0x9b, 0x3f, 0xc5, 0xd0, 0x53, 0x3c, 0x5a, 0xd3, 0xed, 0x92, 0x4b, 0x0e, 0x39, - 0x49, 0xfe, 0xff, 0xff, 0x4f, 0x92, 0xdf, 0x0f, 0x21, 0x32, 0x2c, 0xe0, 0x42, 0x97, 0x30, 0x9f, - 0xf3, 0xa2, 0x04, 0xf8, 0xc4, 0xc5, 0xa5, 0x50, 0x9a, 0x15, 0x25, 0x68, 0xf0, 0xf7, 0x5b, 0x8f, - 0xa1, 0x37, 0xa4, 0x19, 0x54, 0x12, 0x2a, 0x9e, 0x26, 0x95, 0xe0, 0x97, 0xa7, 0xa9, 0xd0, 0xc9, - 0x29, 0xcf, 0x20, 0x57, 0x2e, 0x3f, 0x3c, 0x98, 0xc1, 0x0c, 0x70, 0xca, 0xed, 0x6c, 0xa5, 0x76, - 0x77, 0xd0, 0x57, 0x85, 0xa8, 0x9c, 0xf7, 0xe2, 0x7b, 0x9f, 0x3c, 0x3a, 0xb7, 0x3b, 0x46, 0xf3, - 0x24, 0x97, 0x51, 0x29, 0x12, 0x2d, 0xa6, 0xfe, 0x19, 0x19, 0x64, 0xf6, 0x3b, 0xf0, 0x8e, 0xbc, - 0xe3, 0x87, 0x2f, 0x9f, 0xb0, 0xbb, 0xe7, 0x60, 0x18, 0x1e, 0xed, 0x35, 0x75, 0xe8, 0x72, 0xb1, - 0x1b, 0xfc, 0x13, 0x42, 0x94, 0x91, 0x93, 0x52, 0xcc, 0x93, 0xab, 0x2a, 0x78, 0x70, 0xe4, 0x1d, - 0xef, 0x8c, 0xf6, 0x9b, 0x3a, 0xbc, 0xa5, 0xc6, 0x7b, 0xca, 0xc8, 0x18, 0xa7, 0xfe, 0x7b, 0x72, - 0x68, 0x0d, 0xac, 0x15, 0xd3, 0x49, 0x06, 0xb2, 0x30, 0x5a, 0x4c, 0x8c, 0xca, 0x75, 0x15, 0xec, - 0x60, 0xf5, 0xf3, 0xa6, 0x0e, 0xff, 0x1d, 0x8a, 0x9f, 0x2a, 0x23, 0x23, 0xe7, 0x44, 0xce, 0x18, - 0x5b, 0xdd, 0xff, 0x48, 0x9e, 0xd9, 0x22, 0x51, 0xe9, 0x5c, 0xda, 0x3f, 0xea, 0xac, 0x3d, 0xc0, - 0xb5, 0xc3, 0xa6, 0x0e, 0xff, 0x17, 0x8b, 0x03, 0x65, 0xe4, 0x79, 0xeb, 0xdd, 0x59, 0x5f, 0x90, - 0x83, 0xf6, 0x40, 0x89, 0x04, 0xa3, 0xf4, 0xc4, 0xd8, 0x16, 0x05, 0xbb, 0xd8, 0xaf, 0x43, 0xe6, - 0x38, 0x31, 0xcb, 0x89, 0xad, 0x38, 0xb1, 0x08, 0x72, 0x35, 0x0a, 0x9a, 0x3a, 0xbc, 0xb7, 0x34, - 0xf6, 0x57, 0xea, 0x6b, 0x14, 0xc7, 0x56, 0xeb, 0xd0, 0x19, 0x17, 0xd3, 0x2d, 0x9d, 0x0d, 0xa2, - 0xf3, 0xab, 0x4f, 0x1e, 0x23, 0x9d, 0xb7, 0xb6, 0xed, 0xef, 0x4c, 0x2a, 0x73, 0xbd, 0x0e, 0x9f, - 0x33, 0x32, 0xc0, 0x00, 0xa2, 0xb9, 0xa7, 0x0e, 0xb7, 0x71, 0x75, 0x28, 0xc4, 0x6e, 0xe8, 0x70, - 0xed, 0x6f, 0xb9, 0xae, 0xc9, 0xf5, 0x67, 0x7b, 0xeb, 0xb0, 0xe1, 0xeb, 0xde, 0xba, 0x2d, 0xd5, - 0x8d, 0xa0, 0x3a, 0x7a, 0xf3, 0x63, 0x41, 0xbd, 0xeb, 0x05, 0xf5, 0x6e, 0x16, 0xd4, 0xfb, 0xbd, - 0xa0, 0xde, 0xb7, 0x25, 0xed, 0x5d, 0x2f, 0x69, 0xef, 0x66, 0x49, 0x7b, 0x1f, 0xd8, 0x2c, 0xd7, - 0x9f, 0x4d, 0xca, 0x32, 0x90, 0xdc, 0xc6, 0x4f, 0x94, 0xd0, 0x5f, 0xa0, 0xbc, 0xe0, 0x7f, 0xdf, - 0xce, 0xaf, 0xb7, 0x5f, 0xcf, 0x74, 0x17, 0x9f, 0xcf, 0x57, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, - 0x9b, 0x4e, 0x00, 0x80, 0xbe, 0x07, 0x00, 0x00, + // 451 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x95, 0x3f, 0x8f, 0xd3, 0x30, + 0x18, 0xc6, 0x1b, 0x7a, 0x3d, 0xe9, 0x0c, 0x9c, 0x74, 0xe1, 0x8f, 0x72, 0x45, 0x38, 0x27, 0xa6, + 0x5b, 0xce, 0x56, 0x41, 0xea, 0x07, 0x48, 0xd4, 0x8d, 0x01, 0x82, 0x2a, 0x21, 0x06, 0xaa, 0x24, + 0x35, 0x25, 0x6a, 0x6c, 0x47, 0x89, 0x5d, 0xe8, 0x27, 0x60, 0xe5, 0x1b, 0x21, 0x36, 0xc6, 0x8e, + 0x9d, 0x22, 0x94, 0x6e, 0xf9, 0x14, 0xc8, 0x76, 0x83, 0xda, 0x08, 0x90, 0x50, 0x25, 0x58, 0x3a, + 0xc5, 0x7e, 0x9f, 0xe7, 0xb1, 0x9d, 0xf7, 0x27, 0xcb, 0xa0, 0x9f, 0xf1, 0xb9, 0xc8, 0x79, 0x9a, + 0xe2, 0x2c, 0xe7, 0xfc, 0x1d, 0x26, 0x0b, 0xc2, 0x04, 0xca, 0x72, 0x2e, 0xb8, 0x7d, 0xde, 0x68, + 0x48, 0x6b, 0x7d, 0x18, 0xf3, 0x82, 0xf2, 0x02, 0x47, 0x61, 0x41, 0xf0, 0x62, 0x10, 0x11, 0x11, + 0x0e, 0x70, 0xcc, 0x13, 0x66, 0xfc, 0xfd, 0xfb, 0x33, 0x3e, 0xe3, 0x7a, 0x88, 0xd5, 0x68, 0x5b, + 0x6d, 0xef, 0x20, 0x96, 0x19, 0x29, 0x8c, 0xf6, 0xe4, 0x53, 0x17, 0x5c, 0x8c, 0xd4, 0x8e, 0x7e, + 0x1a, 0x26, 0xd4, 0xcf, 0x49, 0x28, 0xc8, 0xd4, 0x1e, 0x82, 0x5e, 0xac, 0xe6, 0x8e, 0x75, 0x65, + 0x5d, 0xdf, 0x7e, 0xfa, 0x00, 0xed, 0x9f, 0x03, 0x69, 0xb3, 0x77, 0x56, 0x97, 0xae, 0xf1, 0x05, + 0xe6, 0x63, 0xdf, 0x00, 0xc0, 0x24, 0x9d, 0xe4, 0x24, 0x0d, 0x97, 0x85, 0x73, 0xeb, 0xca, 0xba, + 0x3e, 0xf1, 0xce, 0xeb, 0xd2, 0xdd, 0xa9, 0x06, 0x67, 0x4c, 0xd2, 0x40, 0x0f, 0xed, 0xd7, 0xe0, + 0x52, 0x09, 0x3a, 0x4b, 0xa6, 0x93, 0x98, 0xd3, 0x4c, 0x0a, 0x32, 0x91, 0x2c, 0x11, 0x85, 0x73, + 0xa2, 0xd3, 0x8f, 0xeb, 0xd2, 0xfd, 0xbd, 0x29, 0x78, 0xc8, 0x24, 0xf5, 0x8d, 0xe2, 0x1b, 0x61, + 0xac, 0xea, 0xf6, 0x5b, 0xf0, 0x48, 0x85, 0x48, 0x21, 0x12, 0xaa, 0xfe, 0xa8, 0xb5, 0x76, 0x4f, + 0xaf, 0xed, 0xd6, 0xa5, 0xfb, 0x27, 0x5b, 0xe0, 0x30, 0x49, 0x47, 0x8d, 0xb6, 0xb7, 0xfe, 0x4b, + 0x70, 0xb7, 0x39, 0x90, 0x54, 0xbd, 0x71, 0x4e, 0x75, 0xa3, 0x2e, 0x91, 0x01, 0x84, 0x14, 0x20, + 0xb4, 0x05, 0x84, 0x7c, 0x9e, 0x30, 0xef, 0xa2, 0x2e, 0xdd, 0xfd, 0x4c, 0x70, 0x67, 0x3b, 0x1d, + 0xab, 0x59, 0x8b, 0xc4, 0x38, 0x9b, 0x1e, 0x49, 0xfc, 0x27, 0x12, 0x5f, 0xbb, 0xe0, 0x9e, 0x26, + 0xf1, 0x42, 0xb5, 0xf8, 0x95, 0x8c, 0x68, 0x22, 0x0e, 0x61, 0x31, 0x04, 0x3d, 0x6d, 0xd0, 0x18, + 0x7e, 0x91, 0xd3, 0xdb, 0x98, 0x9c, 0x2e, 0x04, 0xe6, 0xd3, 0x62, 0xd8, 0x3d, 0x32, 0xfc, 0x0b, + 0x86, 0x5f, 0x9a, 0xdb, 0xa4, 0x9b, 0x7b, 0xe8, 0x6d, 0x3a, 0x12, 0xfc, 0xe7, 0x04, 0xbd, 0xe7, + 0xdf, 0x2a, 0x68, 0xad, 0x2a, 0x68, 0xad, 0x2b, 0x68, 0x7d, 0xaf, 0xa0, 0xf5, 0x79, 0x03, 0x3b, + 0xab, 0x0d, 0xec, 0xac, 0x37, 0xb0, 0xf3, 0x06, 0xcd, 0x12, 0xf1, 0x5e, 0x46, 0x28, 0xe6, 0x14, + 0x2b, 0xfb, 0x0d, 0x23, 0xe2, 0x03, 0xcf, 0xe7, 0xf8, 0xe7, 0x5b, 0xf7, 0x71, 0xf7, 0xb5, 0x8b, + 0x4e, 0xf5, 0x73, 0xf7, 0xec, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x12, 0xa3, 0x30, 0x6e, + 0x07, 0x00, 0x00, } func (m *EventClaimCreated) Marshal() (dAtA []byte, err error) { @@ -392,9 +392,9 @@ func (m *EventClaimCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ClaimedAmountUpokt != nil { + if m.ClaimedUpokt != nil { { - size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ClaimedUpokt.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -454,9 +454,9 @@ func (m *EventClaimUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ClaimedAmountUpokt != nil { + if m.ClaimedUpokt != nil { { - size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ClaimedUpokt.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -516,9 +516,9 @@ func (m *EventProofSubmitted) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ClaimedAmountUpokt != nil { + if m.ClaimedUpokt != nil { { - size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ClaimedUpokt.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -590,9 +590,9 @@ func (m *EventProofUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ClaimedAmountUpokt != nil { + if m.ClaimedUpokt != nil { { - size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ClaimedUpokt.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -674,8 +674,8 @@ func (m *EventClaimCreated) Size() (n int) { if m.NumEstimatedComputeUnits != 0 { n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) } - if m.ClaimedAmountUpokt != nil { - l = m.ClaimedAmountUpokt.Size() + if m.ClaimedUpokt != nil { + l = m.ClaimedUpokt.Size() n += 1 + l + sovEvent(uint64(l)) } return n @@ -700,8 +700,8 @@ func (m *EventClaimUpdated) Size() (n int) { if m.NumEstimatedComputeUnits != 0 { n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) } - if m.ClaimedAmountUpokt != nil { - l = m.ClaimedAmountUpokt.Size() + if m.ClaimedUpokt != nil { + l = m.ClaimedUpokt.Size() n += 1 + l + sovEvent(uint64(l)) } return n @@ -730,8 +730,8 @@ func (m *EventProofSubmitted) Size() (n int) { if m.NumEstimatedComputeUnits != 0 { n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) } - if m.ClaimedAmountUpokt != nil { - l = m.ClaimedAmountUpokt.Size() + if m.ClaimedUpokt != nil { + l = m.ClaimedUpokt.Size() n += 1 + l + sovEvent(uint64(l)) } return n @@ -760,8 +760,8 @@ func (m *EventProofUpdated) Size() (n int) { if m.NumEstimatedComputeUnits != 0 { n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) } - if m.ClaimedAmountUpokt != nil { - l = m.ClaimedAmountUpokt.Size() + if m.ClaimedUpokt != nil { + l = m.ClaimedUpokt.Size() n += 1 + l + sovEvent(uint64(l)) } return n @@ -897,7 +897,7 @@ func (m *EventClaimCreated) Unmarshal(dAtA []byte) error { } case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -924,10 +924,10 @@ func (m *EventClaimCreated) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClaimedAmountUpokt == nil { - m.ClaimedAmountUpokt = &types.Coin{} + if m.ClaimedUpokt == nil { + m.ClaimedUpokt = &types.Coin{} } - if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ClaimedUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1076,7 +1076,7 @@ func (m *EventClaimUpdated) Unmarshal(dAtA []byte) error { } case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1103,10 +1103,10 @@ func (m *EventClaimUpdated) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClaimedAmountUpokt == nil { - m.ClaimedAmountUpokt = &types.Coin{} + if m.ClaimedUpokt == nil { + m.ClaimedUpokt = &types.Coin{} } - if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ClaimedUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1291,7 +1291,7 @@ func (m *EventProofSubmitted) Unmarshal(dAtA []byte) error { } case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1318,10 +1318,10 @@ func (m *EventProofSubmitted) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClaimedAmountUpokt == nil { - m.ClaimedAmountUpokt = &types.Coin{} + if m.ClaimedUpokt == nil { + m.ClaimedUpokt = &types.Coin{} } - if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ClaimedUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1506,7 +1506,7 @@ func (m *EventProofUpdated) Unmarshal(dAtA []byte) error { } case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1533,10 +1533,10 @@ func (m *EventProofUpdated) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClaimedAmountUpokt == nil { - m.ClaimedAmountUpokt = &types.Coin{} + if m.ClaimedUpokt == nil { + m.ClaimedUpokt = &types.Coin{} } - if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ClaimedUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/service/keeper/update_relay_mining_difficulty.go b/x/service/keeper/update_relay_mining_difficulty.go index f4aaf2a4e..0a3ac6fc8 100644 --- a/x/service/keeper/update_relay_mining_difficulty.go +++ b/x/service/keeper/update_relay_mining_difficulty.go @@ -6,6 +6,7 @@ import ( "encoding/hex" "fmt" "math/big" + "sort" "cosmossdk.io/log" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,27 +15,29 @@ import ( "github.com/pokt-network/poktroll/x/service/types" ) -// TargetNumRelays is the target number of relays we want the network to mine for -// a specific service across all applications & suppliers per session. -// This number determines the total number of leafs to be created across in -// the off-chain SMTs, across all suppliers, for each service. -// It indirectly drives the off-chain resource requirements of the network -// in additional to playing a critical role in Relay Mining. -// TODO_MAINNET(#542): Make this a governance parameter and figure out the correct value. -const TargetNumRelays = uint64(10e4) - -// Exponential moving average (ema) smoothing factor, commonly known as alpha. -// Usually, alpha = 2 / (N+1), where N is the number of periods. -// Large alpha -> more weight on recent data; less smoothing and fast response. -// Small alpha -> more weight on past data; more smoothing and slow response. -// -// TODO_MAINNET: Use a language agnostic float implementation or arithmetic library -// to ensure deterministic results across different language implementations of the -// protocol. -// -// TODO_MAINNET(@olshansk, @rawthil): Play around with the value N for EMA to -// capture what the memory should be. -var emaSmoothingFactor = new(big.Float).SetFloat64(0.1) +var ( + // TargetNumRelays is the target number of relays we want the network to mine for + // a specific service across all applications & suppliers per session. + // This number determines the total number of leafs to be created across in + // the off-chain SMTs, across all suppliers, for each service. + // It indirectly drives the off-chain resource requirements of the network + // in additional to playing a critical role in Relay Mining. + // TODO_MAINNET(#542): Make this a governance parameter and figure out the correct value. + TargetNumRelays = uint64(10e4) + + // Exponential moving average (ema) smoothing factor, commonly known as alpha. + // Usually, alpha = 2 / (N+1), where N is the number of periods. + // Large alpha -> more weight on recent data; less smoothing and fast response. + // Small alpha -> more weight on past data; more smoothing and slow response. + // + // TODO_MAINNET: Use a language agnostic float implementation or arithmetic library + // to ensure deterministic results across different language implementations of the + // protocol. + // + // TODO_MAINNET(@olshansk, @rawthil): Play around with the value N for EMA to + // capture what the memory should be. + emaSmoothingFactor = new(big.Float).SetFloat64(0.1) +) // UpdateRelayMiningDifficulty updates the on-chain relay mining difficulty // based on the amount of on-chain relays for each service, given a map of serviceId->numRelays. @@ -46,7 +49,13 @@ func (k Keeper) UpdateRelayMiningDifficulty( sdkCtx := sdk.UnwrapSDKContext(ctx) difficultyPerServiceMap = make(map[string]types.RelayMiningDifficulty, len(relaysPerServiceMap)) - for serviceId, numRelays := range relaysPerServiceMap { + + // Iterate over the relaysPerServiceMap deterministically by sorting the keys. + // This ensures that the order of the keys is consistent across different nodes. + // See comment: https://github.com/pokt-network/poktroll/pull/840#discussion_r1796663285 + sortedRelayPerServiceMapKeys := getSortedMapKeys(relaysPerServiceMap) + for _, serviceId := range sortedRelayPerServiceMapKeys { + numRelays := relaysPerServiceMap[serviceId] prevDifficulty, found := k.GetRelayMiningDifficulty(ctx, serviceId) if !found { prevDifficulty = NewDefaultRelayMiningDifficulty(ctx, logger, serviceId, numRelays) @@ -163,3 +172,14 @@ func NewDefaultRelayMiningDifficulty( } } + +// getSortedMapKeys returns the keys of a map lexicographically sorted. +func getSortedMapKeys(m map[string]uint64) []string { + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + + sort.Strings(keys) + return keys +} diff --git a/x/service/types/relay_mining_difficulty.pb.go b/x/service/types/relay_mining_difficulty.pb.go index bb0b0d17b..751c4b433 100644 --- a/x/service/types/relay_mining_difficulty.pb.go +++ b/x/service/types/relay_mining_difficulty.pb.go @@ -25,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // RelayMiningDifficulty is a message used to store the on-chain Relay Mining // difficulty associated with a specific service ID. +// TODO_TECHDEBT: Embed this message in the Service message. type RelayMiningDifficulty struct { // The service ID the relay mining difficulty is associated with. ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` diff --git a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go index f2870c114..87a90d2ad 100644 --- a/x/tokenomics/keeper/keeper_settle_pending_claims_test.go +++ b/x/tokenomics/keeper/keeper_settle_pending_claims_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "context" + "math/big" "testing" "cosmossdk.io/depinject" @@ -26,10 +27,11 @@ import ( "github.com/pokt-network/poktroll/testutil/testtree" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" + servicetypes "github.com/pokt-network/poktroll/x/service/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/tokenomics" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) @@ -51,7 +53,11 @@ type TestSuite struct { claim prooftypes.Claim proof prooftypes.Proof - numRelays uint64 + numRelays uint64 + numClaimedComputeUnits uint64 + numEstimatedComputeUnits uint64 + claimedUpokt sdk.Coin + relayMiningDifficulty servicetypes.RelayMiningDifficulty } // SetupTest creates the following and stores them in the suite: @@ -157,11 +163,22 @@ func (s *TestSuite) SetupTest() { ringClient, ) + // Calculate the number of claimed compute units. + s.numClaimedComputeUnits = s.numRelays * service.ComputeUnitsPerRelay + + s.relayMiningDifficulty = servicekeeper.NewDefaultRelayMiningDifficulty(sdkCtx, s.keepers.Logger(), testServiceId, servicekeeper.TargetNumRelays) + + // Calculate the number of estimated compute units. + s.numEstimatedComputeUnits = getEstimatedComputeUnits(s.numClaimedComputeUnits, s.relayMiningDifficulty) + + // Calculate the claimed amount in uPOKT. + sharedParams := s.keepers.SharedKeeper.GetParams(sdkCtx) + s.claimedUpokt = getClaimedUpokt(sharedParams, s.numEstimatedComputeUnits, s.relayMiningDifficulty) + blockHeaderHash := make([]byte, 0) expectedMerkleProofPath := protocol.GetPathForProof(blockHeaderHash, sessionHeader.SessionId) // Advance the block height to the earliest claim commit height. - sharedParams := s.keepers.SharedKeeper.GetParams(sdkCtx) claimMsgHeight := shared.GetEarliestSupplierClaimCommitHeight( &sharedParams, sessionHeader.GetSessionEndBlockHeight(), @@ -240,13 +257,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequiredAndNotProv ctx := s.ctx sharedParams := s.keepers.SharedKeeper.GetParams(ctx) - // Retrieve the number of compute units in the claim - numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() + proofRequirementThreshold, err := s.claim.GetClaimeduPOKT(sharedParams, s.relayMiningDifficulty) require.NoError(t, err) // -1 to push threshold below s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits-1) - require.NoError(t, err) + proofRequirementThreshold = proofRequirementThreshold.Sub(uPOKTCoin(1)) // Set the proof missing penalty to half the supplier's stake so it is not // unstaked when being slashed. @@ -302,8 +317,9 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequiredAndNotProv expectedClaimExpiredEvent := expectedClaimExpiredEvents[0] require.Equal(t, tokenomicstypes.ClaimExpirationReason_PROOF_MISSING, expectedClaimExpiredEvent.GetExpirationReason()) require.Equal(t, s.numRelays, expectedClaimExpiredEvent.GetNumRelays()) - // TODO(@red-0ne, #781): Ensure other claim expiration event fields are validated once added - // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt + require.Equal(t, s.numClaimedComputeUnits, expectedClaimExpiredEvent.GetNumClaimedComputeUnits()) + require.Equal(t, s.numEstimatedComputeUnits, expectedClaimExpiredEvent.GetNumEstimatedComputeUnits()) + require.Equal(t, s.claimedUpokt, *expectedClaimExpiredEvent.GetClaimedUpokt()) // Confirm that a slashing event was emitted expectedSlashingEvents := testutilevents.FilterEvents[*tokenomicstypes.EventSupplierSlashed](t, events, "poktroll.tokenomics.EventSupplierSlashed") @@ -322,13 +338,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimSettled_ProofRequiredAndProvide ctx := s.ctx sharedParams := s.keepers.SharedKeeper.GetParams(ctx) - // Retrieve the number of compute units in the claim - numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() + proofRequirementThreshold, err := s.claim.GetClaimeduPOKT(sharedParams, s.relayMiningDifficulty) require.NoError(t, err) // -1 to push threshold below s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits-1) - require.NoError(t, err) + proofRequirementThreshold = proofRequirementThreshold.Sub(uPOKTCoin(1)) // Set the proof parameters such that s.claim requires a proof because: // - proof_request_probability is 0% @@ -369,7 +383,9 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimSettled_ProofRequiredAndProvide expectedEvent := expectedEvents[0] require.Equal(t, prooftypes.ProofRequirementReason_THRESHOLD, expectedEvent.GetProofRequirement()) require.Equal(t, s.numRelays, expectedEvent.GetNumRelays()) - // TODO(@red-0ne, #781): Ensure other claim expiration event fields are validated once added + require.Equal(t, s.numClaimedComputeUnits, expectedEvent.GetNumClaimedComputeUnits()) + require.Equal(t, s.numEstimatedComputeUnits, expectedEvent.GetNumEstimatedComputeUnits()) + require.Equal(t, s.claimedUpokt, *expectedEvent.GetClaimedUpokt()) } func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequired_InvalidOneProvided() { @@ -434,7 +450,9 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_ProofRequired_InvalidOn expectedClaimExpiredEvent := expectedClaimExpiredEvents[0] require.Equal(t, tokenomicstypes.ClaimExpirationReason_PROOF_INVALID, expectedClaimExpiredEvent.GetExpirationReason()) require.Equal(t, s.numRelays, expectedClaimExpiredEvent.GetNumRelays()) - // TODO(@red-0ne, #781): Ensure other claim expiration event fields are validated once added + require.Equal(t, s.numClaimedComputeUnits, expectedClaimExpiredEvent.GetNumClaimedComputeUnits()) + require.Equal(t, s.numEstimatedComputeUnits, expectedClaimExpiredEvent.GetNumEstimatedComputeUnits()) + require.Equal(t, s.claimedUpokt, *expectedClaimExpiredEvent.GetClaimedUpokt()) // Confirm that a slashing event was emitted expectedSlashingEvents := testutilevents.FilterEvents[*tokenomicstypes.EventSupplierSlashed](t, events, "poktroll.tokenomics.EventSupplierSlashed") @@ -453,13 +471,11 @@ func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_Vi ctx := s.ctx sharedParams := s.keepers.SharedKeeper.GetParams(ctx) - // Retrieve the number of compute units in the claim - numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() + proofRequirementThreshold, err := s.claim.GetClaimeduPOKT(sharedParams, s.relayMiningDifficulty) require.NoError(t, err) - // +1 so its not required via probability - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits+1) - require.NoError(t, err) + // +1 so it's not required via probability + proofRequirementThreshold = proofRequirementThreshold.Add(uPOKTCoin(1)) // Set the proof parameters such that s.claim requires a proof because: // - proof_request_probability is 100% @@ -500,8 +516,9 @@ func (s *TestSuite) TestClaimSettlement_ClaimSettled_ProofRequiredAndProvided_Vi expectedEvent := expectedEvents[0] require.Equal(t, prooftypes.ProofRequirementReason_PROBABILISTIC, expectedEvent.GetProofRequirement()) require.Equal(t, s.numRelays, expectedEvent.GetNumRelays()) - // TODO(@red-0ne, #781): Ensure other claim expiration event fields are validated once added - // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt + require.Equal(t, s.numClaimedComputeUnits, expectedEvent.GetNumClaimedComputeUnits()) + require.Equal(t, s.numEstimatedComputeUnits, expectedEvent.GetNumEstimatedComputeUnits()) + require.Equal(t, s.claimedUpokt, *expectedEvent.GetClaimedUpokt()) } func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { @@ -510,13 +527,11 @@ func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { ctx := s.ctx sharedParams := s.keepers.SharedKeeper.GetParams(ctx) - // Retrieve the number of compute units in the claim - numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() + proofRequirementThreshold, err := s.claim.GetClaimeduPOKT(sharedParams, s.relayMiningDifficulty) require.NoError(t, err) // +1 to push threshold above s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits+1) - require.NoError(t, err) + proofRequirementThreshold = proofRequirementThreshold.Add(uPOKTCoin(1)) // Set the proof parameters such that s.claim DOES NOT require a proof because: // - proof_request_probability is 0% AND @@ -556,7 +571,9 @@ func (s *TestSuite) TestSettlePendingClaims_Settles_WhenAProofIsNotRequired() { expectedEvent := expectedEvents[0] require.Equal(t, prooftypes.ProofRequirementReason_NOT_REQUIRED.String(), expectedEvent.GetProofRequirement().String()) require.Equal(t, s.numRelays, expectedEvent.GetNumRelays()) - // TODO(@red-0ne, #781): Ensure other claim expiration event fields are validated once added + require.Equal(t, s.numClaimedComputeUnits, expectedEvent.GetNumClaimedComputeUnits()) + require.Equal(t, s.numEstimatedComputeUnits, expectedEvent.GetNumEstimatedComputeUnits()) + require.Equal(t, s.claimedUpokt, *expectedEvent.GetClaimedUpokt()) } func (s *TestSuite) TestSettlePendingClaims_DoesNotSettle_BeforeProofWindowCloses() { @@ -582,13 +599,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimPendingAfterSettlement() { sdkCtx := cosmostypes.UnwrapSDKContext(ctx) sharedParams := s.keepers.SharedKeeper.GetParams(ctx) - // Retrieve the number of compute units in the claim - numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() + proofRequirementThreshold, err := s.claim.GetClaimeduPOKT(sharedParams, s.relayMiningDifficulty) require.NoError(t, err) // +1 to push threshold above s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits+1) - require.NoError(t, err) + proofRequirementThreshold = proofRequirementThreshold.Add(uPOKTCoin(1)) // Set the proof parameters such that s.claim DOES NOT require a proof // because the proof_request_probability is 0% and the proof_request_threshold @@ -670,13 +685,11 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_SupplierUnstaked() { ctx := s.ctx sharedParams := s.keepers.SharedKeeper.GetParams(ctx) - // Retrieve the number of compute units in the claim - numClaimComputeUnits, err := s.claim.GetNumClaimedComputeUnits() + proofRequirementThreshold, err := s.claim.GetClaimeduPOKT(sharedParams, s.relayMiningDifficulty) require.NoError(t, err) // -1 to push threshold below s.claim's compute units - proofRequirementThreshold, err := tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits-1) - require.NoError(t, err) + proofRequirementThreshold = proofRequirementThreshold.Sub(uPOKTCoin(1)) // Set the proof parameters such that s.claim requires a proof because: // - proof_request_probability is 0% @@ -723,3 +736,41 @@ func (s *TestSuite) TestSettlePendingClaims_ClaimExpired_SupplierUnstaked() { require.Equal(t, uint64(1), expectedSlashingEvent.GetNumExpiredClaims()) require.Equal(t, proofParams.ProofMissingPenalty, expectedSlashingEvent.GetSlashingAmount()) } + +// getEstimatedComputeUnits returns the estimated number of compute units given +// the number of claimed compute units and the relay mining difficulty. +func getEstimatedComputeUnits( + numClaimedComputeUnits uint64, + relayMiningDifficulty servicetypes.RelayMiningDifficulty, +) uint64 { + difficultyMultiplierRat := protocol.GetRelayDifficultyMultiplier(relayMiningDifficulty.GetTargetHash()) + numClaimedComputeUnitsRat := new(big.Rat).SetUint64(numClaimedComputeUnits) + numEstimatedComputeUnitsRat := new(big.Rat).Mul(difficultyMultiplierRat, numClaimedComputeUnitsRat) + + return new(big.Int).Div(numEstimatedComputeUnitsRat.Num(), numEstimatedComputeUnitsRat.Denom()).Uint64() +} + +// getClaimedUpokt returns the claimed amount in uPOKT. +func getClaimedUpokt( + sharedParams sharedtypes.Params, + numClaimedComputeUnits uint64, + relayMiningDifficulty servicetypes.RelayMiningDifficulty, +) sdk.Coin { + // Calculate the number of estimated compute units ratio instead of directly using + // the integer value to avoid precision loss. + difficultyMultiplierRat := protocol.GetRelayDifficultyMultiplier(relayMiningDifficulty.GetTargetHash()) + numClaimedComputeUnitsRat := new(big.Rat).SetUint64(numClaimedComputeUnits) + numEstimatedComputeUnitsRat := new(big.Rat).Mul(difficultyMultiplierRat, numClaimedComputeUnitsRat) + + computeUnitsToTokenMultiplierRat := new(big.Rat).SetUint64(sharedParams.GetComputeUnitsToTokensMultiplier()) + + claimedUpoktRat := new(big.Rat).Mul(numEstimatedComputeUnitsRat, computeUnitsToTokenMultiplierRat) + claimedUpoktInt := new(big.Int).Div(claimedUpoktRat.Num(), claimedUpoktRat.Denom()) + + return sdk.NewCoin(volatile.DenomuPOKT, math.NewIntFromBigInt(claimedUpoktInt)) +} + +// uPOKTCoin returns a uPOKT coin with the given amount. +func uPOKTCoin(amount int64) sdk.Coin { + return sdk.NewCoin(volatile.DenomuPOKT, math.NewInt(amount)) +} diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index 04d8b1fc5..3045a304f 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -11,6 +11,7 @@ import ( "github.com/pokt-network/poktroll/app/volatile" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" + servicekeeper "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" @@ -61,21 +62,41 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( // NB: Not every (Req, Res) pair in the session is inserted into the tree due // to the relay mining difficulty. This is the count of non-empty leaves that - // matched the necessary difficulty and is therefore an estimation of the total - // number of relays serviced and work done. + // matched the necessary difficulty. numClaimRelays, err = claim.GetNumRelays() if err != nil { return settledResult, expiredResult, err } - // DEV_NOTE: We are assuming that (numClaimComputeUnits := numComputeUnits * service.ComputeUnitsPerRelay) + // DEV_NOTE: We are assuming that (numClaimComputeUnits := numClaimRelays * service.ComputeUnitsPerRelay) // because this code path is only reached if that has already been validated. numClaimComputeUnits, err = claim.GetNumClaimedComputeUnits() if err != nil { return settledResult, expiredResult, err } - // TODO(@red-0ne, #781): Convert numClaimedComputeUnits to numEstimatedComputeUnits to reflect reward/payment based on real usage. + // Get the relay mining difficulty for the service that this claim is for. + serviceId := claim.GetSessionHeader().GetServiceId() + relayMiningDifficulty, found := k.serviceKeeper.GetRelayMiningDifficulty(ctx, serviceId) + if !found { + relayMiningDifficulty = servicekeeper.NewDefaultRelayMiningDifficulty(ctx, logger, serviceId, servicekeeper.TargetNumRelays) + } + // numEstimatedComputeUnits is the probabilistic estimation of the off-chain + // work done by the relay miner in this session. It is derived from the claimed + // work and the relay mining difficulty. + numEstimatedComputeUnits, err := claim.GetNumEstimatedComputeUnits(relayMiningDifficulty) + if err != nil { + return settledResult, expiredResult, err + } + + sharedParams := k.sharedKeeper.GetParams(ctx) + // claimeduPOKT is the amount of uPOKT that the supplier would receive if the + // claim is settled. It is derived from the claimed number of relays, the current + // service mining difficulty and the global network parameters. + claimeduPOKT, err := claim.GetClaimeduPOKT(sharedParams, relayMiningDifficulty) + if err != nil { + return settledResult, expiredResult, err + } proof, isProofFound := k.proofKeeper.GetProof(ctx, sessionId, claim.SupplierOperatorAddress) // Using the probabilistic proofs approach, determine if this expiring @@ -90,6 +111,8 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( "supplier_operator_address", claim.SupplierOperatorAddress, "num_claim_compute_units", numClaimComputeUnits, "num_relays_in_session_tree", numClaimRelays, + "num_estimated_compute_units", numEstimatedComputeUnits, + "claimed_upokt", claimeduPOKT, "proof_requirement", proofRequirement, ) @@ -115,11 +138,12 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( // Proof was required but is invalid or not found. // Emit an event that a claim has expired and being removed without being settled. claimExpiredEvent := tokenomicstypes.EventClaimExpired{ - Claim: &claim, - ExpirationReason: expirationReason, - NumRelays: numClaimRelays, - NumClaimedComputeUnits: numClaimComputeUnits, - // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt + Claim: &claim, + ExpirationReason: expirationReason, + NumRelays: numClaimRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + NumEstimatedComputeUnits: numEstimatedComputeUnits, + ClaimedUpokt: &claimeduPOKT, } if err = ctx.EventManager().EmitTypedEvent(&claimExpiredEvent); err != nil { return settledResult, expiredResult, err @@ -162,11 +186,12 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( } claimSettledEvent := tokenomicstypes.EventClaimSettled{ - Claim: &claim, - NumRelays: numClaimRelays, - NumClaimedComputeUnits: numClaimComputeUnits, - // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt - ProofRequirement: proofRequirement, + Claim: &claim, + NumRelays: numClaimRelays, + NumClaimedComputeUnits: numClaimComputeUnits, + NumEstimatedComputeUnits: numEstimatedComputeUnits, + ClaimedUpokt: &claimeduPOKT, + ProofRequirement: proofRequirement, } if err = ctx.EventManager().EmitTypedEvent(&claimSettledEvent); err != nil { @@ -174,11 +199,12 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( } if err = ctx.EventManager().EmitTypedEvent(&prooftypes.EventProofUpdated{ - Claim: &claim, - Proof: nil, - NumRelays: 0, - NumClaimedComputeUnits: 0, - // TODO_FOLLOWUP: Add NumEstimatedComputeUnits and ClaimedAmountUpokt + Claim: &claim, + Proof: nil, + NumRelays: 0, + NumClaimedComputeUnits: 0, + NumEstimatedComputeUnits: numEstimatedComputeUnits, + ClaimedUpokt: &claimeduPOKT, }); err != nil { return settledResult, expiredResult, err } diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index fac928341..da686f4bf 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -22,7 +22,6 @@ import ( sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/pokt-network/poktroll/x/tokenomics" tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) @@ -146,7 +145,10 @@ func (k Keeper) ProcessTokenLogicModules( if claimSettlementCoin.Amount.BigInt() == nil { return 0 } - return float32(claimSettlementCoin.Amount.Int64()) + + // Avoid out of range errors by converting to float64 first + claimSettlementFloat64, _ := claimSettlementCoin.Amount.BigInt().Float64() + return float32(claimSettlementFloat64) }, func() bool { return isSuccessful }, ) @@ -235,12 +237,28 @@ func (k Keeper) ProcessTokenLogicModules( return tokenomicstypes.ErrTokenomicsServiceNotFound.Wrapf("service with ID %q not found", sessionHeader.ServiceId) } + // Ensure the number of compute units claimed is equal to the number of relays * CUPR + expectedClaimComputeUnits := numRelays * service.ComputeUnitsPerRelay + if numClaimComputeUnits != expectedClaimComputeUnits { + return tokenomicstypes.ErrTokenomicsRootHashInvalid.Wrapf( + "mismatch: claim compute units (%d) != number of relays (%d) * service compute units per relay (%d)", + numClaimComputeUnits, + numRelays, + service.ComputeUnitsPerRelay, + ) + } + + // Retrieving the relay mining difficulty for service. + relayMiningDifficulty, found := k.serviceKeeper.GetRelayMiningDifficulty(ctx, service.Id) + if !found { + relayMiningDifficulty = servicekeeper.NewDefaultRelayMiningDifficulty(ctx, logger, service.Id, servicekeeper.TargetNumRelays) + } sharedParams := k.sharedKeeper.GetParams(ctx) // Determine the total number of tokens being claimed (i.e. for the work completed) // by the supplier for the amount of work they did to service the application // in the session. - claimSettlementCoin, err = tokenomics.NumComputeUnitsToCoin(sharedParams, numClaimComputeUnits) + claimSettlementCoin, err = claim.GetClaimeduPOKT(sharedParams, relayMiningDifficulty) if err != nil { return err } @@ -265,16 +283,10 @@ func (k Keeper) ProcessTokenLogicModules( logger = logger.With("actual_settlement_upokt", actualSettlementCoin) logger.Info(fmt.Sprintf("About to start processing TLMs for (%d) compute units, equal to (%s) claimed", numClaimComputeUnits, actualSettlementCoin)) - // Retrieving the relay mining difficulty for the service at hand - relayMiningDifficulty, found := k.serviceKeeper.GetRelayMiningDifficulty(ctx, service.Id) - if !found { - relayMiningDifficulty = servicekeeper.NewDefaultRelayMiningDifficulty(ctx, logger, service.Id, servicekeeper.TargetNumRelays) - } - // Execute all the token logic modules processors for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { logger.Info(fmt.Sprintf("Starting TLM processing: %q", tlm)) - if err = tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { + if err := tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { return tokenomicstypes.ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm, err) } logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index 812090ae7..913179e8d 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -509,7 +509,13 @@ func TestProcessTokenLogicModules_InvalidRoot(t *testing.T) { { desc: "correct size but invalid value", root: func() []byte { - return bytes.Repeat([]byte("a"), protocol.TrieRootSize) + // A root with all 'a's is a valid value since each of the hash, sum and size + // will be []byte{0x61, 0x61, ...} with their respective sizes. + // The current test suite sets the CUPR to 1, making sum == count * CUPR + // valid. So, we can change the last byte to 'b' to make it invalid. + root := bytes.Repeat([]byte("a"), protocol.TrieRootSize) + root = append(root[:len(root)-1], 'b') + return root }(), errExpected: true, }, diff --git a/x/tokenomics/tokenomics.go b/x/tokenomics/tokenomics.go deleted file mode 100644 index 4811023a2..000000000 --- a/x/tokenomics/tokenomics.go +++ /dev/null @@ -1,28 +0,0 @@ -package tokenomics - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/app/volatile" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// NumComputeUnitsToCoin converts compute units to uPOKT to mint based on global -// network parameters. -func NumComputeUnitsToCoin(params sharedtypes.Params, numClaimComputeUnits uint64) (sdk.Coin, error) { - // CUTTM is a GLOBAL network wide parameter. - // TODO(@red-0ne, #781): Convert numClaimComputeUnits to numEstimatedComputeUnits to reflect reward/payment based on real usage. - upoktAmount := math.NewInt(int64(numClaimComputeUnits * params.GetComputeUnitsToTokensMultiplier())) - if upoktAmount.IsNegative() { - return sdk.Coin{}, tokenomicstypes.ErrTokenomicsCalculation.Wrapf( - "num compute units to coin (%d) * CUTTM (%d) resulted in a negative amount: %d", - numClaimComputeUnits, - params.GetComputeUnitsToTokensMultiplier(), - upoktAmount, - ) - } - - return sdk.NewCoin(volatile.DenomuPOKT, upoktAmount), nil -} diff --git a/x/tokenomics/types/event.pb.go b/x/tokenomics/types/event.pb.go index 24a5b1e9d..6f4278908 100644 --- a/x/tokenomics/types/event.pb.go +++ b/x/tokenomics/types/event.pb.go @@ -68,9 +68,9 @@ type EventClaimExpired struct { // Number of estimated compute units claimed as a function of the number of claimed // compute units and the relay difficulty multiplier for the particular service. NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` - // The amount of uPOKT claimed to be rewarded for the work done as a function of + // The uPOKT coin claimed to be rewarded for the work done as a function of // the number of estimated compute units and the compute uints to token multiplier. - ClaimedAmountUpokt *types1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` + ClaimedUpokt *types1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt"` } func (m *EventClaimExpired) Reset() { *m = EventClaimExpired{} } @@ -137,9 +137,9 @@ func (m *EventClaimExpired) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (m *EventClaimExpired) GetClaimedAmountUpokt() *types1.Coin { +func (m *EventClaimExpired) GetClaimedUpokt() *types1.Coin { if m != nil { - return m.ClaimedAmountUpokt + return m.ClaimedUpokt } return nil } @@ -158,9 +158,9 @@ type EventClaimSettled struct { // Number of estimated compute units claimed as a function of the number of claimed // compute units and the relay difficulty multiplier for the particular service. NumEstimatedComputeUnits uint64 `protobuf:"varint,5,opt,name=num_estimated_compute_units,json=numEstimatedComputeUnits,proto3" json:"num_estimated_compute_units"` - // The amount of uPOKT claimed to be rewarded for the work done as a function of + // The uPOKT coin claimed to be rewarded for the work done as a function of // the number of estimated compute units and the compute uints to token multiplier. - ClaimedAmountUpokt *types1.Coin `protobuf:"bytes,6,opt,name=claimed_amount_upokt,json=claimedAmountUpokt,proto3" json:"claimed_amount_upokt"` + ClaimedUpokt *types1.Coin `protobuf:"bytes,6,opt,name=claimed_upokt,json=claimedUpokt,proto3" json:"claimed_upokt"` } func (m *EventClaimSettled) Reset() { *m = EventClaimSettled{} } @@ -227,9 +227,9 @@ func (m *EventClaimSettled) GetNumEstimatedComputeUnits() uint64 { return 0 } -func (m *EventClaimSettled) GetClaimedAmountUpokt() *types1.Coin { +func (m *EventClaimSettled) GetClaimedUpokt() *types1.Coin { if m != nil { - return m.ClaimedAmountUpokt + return m.ClaimedUpokt } return nil } @@ -380,54 +380,54 @@ func init() { func init() { proto.RegisterFile("poktroll/tokenomics/event.proto", fileDescriptor_a78874bbf91a58c7) } var fileDescriptor_a78874bbf91a58c7 = []byte{ - // 744 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xcd, 0x53, 0xdb, 0x46, - 0x14, 0xb7, 0x5c, 0xc3, 0x0c, 0xdb, 0x62, 0x6c, 0xd5, 0x30, 0x86, 0x16, 0x89, 0x72, 0xe8, 0x50, - 0xa6, 0x48, 0x03, 0x74, 0x7a, 0xec, 0xd4, 0x36, 0xa6, 0xa3, 0x99, 0xc6, 0x76, 0xd6, 0x21, 0xc3, - 0xe4, 0x10, 0x45, 0x96, 0x1e, 0x46, 0xc1, 0xda, 0x55, 0x56, 0x2b, 0x07, 0x8e, 0x39, 0xe5, 0x90, - 0x4b, 0xfe, 0xa2, 0x9c, 0x73, 0xe4, 0xc8, 0xc9, 0x93, 0x31, 0x37, 0xff, 0x15, 0x99, 0x5d, 0xf9, - 0x8b, 0x8f, 0x98, 0x43, 0x72, 0xcc, 0xc5, 0x96, 0xdf, 0xef, 0x63, 0x77, 0xdf, 0xfb, 0x59, 0x8b, - 0xf4, 0x90, 0x9e, 0x71, 0x46, 0x3b, 0x1d, 0x93, 0xd3, 0x33, 0x20, 0x34, 0xf0, 0xdd, 0xc8, 0x84, - 0x2e, 0x10, 0x6e, 0x84, 0x8c, 0x72, 0xaa, 0xfe, 0x3c, 0x22, 0x18, 0x13, 0xc2, 0x9a, 0xe6, 0xd2, - 0x28, 0xa0, 0x91, 0xd9, 0x72, 0x22, 0x30, 0xbb, 0xbb, 0x2d, 0xe0, 0xce, 0xae, 0xe9, 0x52, 0x9f, - 0x24, 0xa2, 0xb5, 0x42, 0x9b, 0xb6, 0xa9, 0x7c, 0x34, 0xc5, 0xd3, 0xb0, 0xba, 0x36, 0x5e, 0x2b, - 0x64, 0x94, 0x9e, 0x98, 0xfc, 0x22, 0x84, 0x28, 0xc1, 0x36, 0xdf, 0x65, 0x50, 0xbe, 0x2a, 0x96, - 0xad, 0x74, 0x1c, 0x3f, 0xa8, 0x9e, 0x87, 0x3e, 0x03, 0x4f, 0xfd, 0x1b, 0xcd, 0xb9, 0xe2, 0x77, - 0x51, 0xd9, 0x50, 0xb6, 0x7e, 0xdc, 0x5b, 0x36, 0xc6, 0x9b, 0x91, 0x0e, 0x86, 0x24, 0x97, 0x17, - 0x06, 0x3d, 0x3d, 0xe1, 0xe1, 0xe4, 0x4b, 0x25, 0x28, 0x0f, 0xc2, 0xc2, 0xe1, 0x3e, 0x25, 0x36, - 0x03, 0x27, 0xa2, 0xa4, 0x98, 0xde, 0x50, 0xb6, 0xb2, 0x7b, 0xdb, 0xc6, 0x3d, 0x07, 0x32, 0x26, - 0xab, 0x4a, 0x09, 0x96, 0x8a, 0xf2, 0xf2, 0xa0, 0xa7, 0xdf, 0x35, 0xc2, 0x39, 0xb8, 0x45, 0x54, - 0x77, 0x10, 0x22, 0x71, 0x60, 0x33, 0xe8, 0x38, 0x17, 0x51, 0xf1, 0x87, 0x0d, 0x65, 0x2b, 0x53, - 0xce, 0x0e, 0x7a, 0xfa, 0x54, 0x15, 0x2f, 0x90, 0x38, 0xc0, 0xf2, 0x51, 0x3d, 0x46, 0xab, 0x02, - 0x90, 0x7b, 0x05, 0xcf, 0x76, 0x69, 0x10, 0xc6, 0x1c, 0xec, 0x98, 0xf8, 0x3c, 0x2a, 0x66, 0xa4, - 0x7a, 0x7d, 0xd0, 0xd3, 0xbf, 0x4c, 0xc2, 0x2b, 0x24, 0x0e, 0x2a, 0x09, 0x52, 0x49, 0x80, 0x23, - 0x51, 0x57, 0x9f, 0xa3, 0x5f, 0x84, 0x08, 0x22, 0xee, 0x07, 0x0e, 0xbf, 0xe3, 0x3d, 0x27, 0xbd, - 0xf5, 0x41, 0x4f, 0x9f, 0x45, 0xc3, 0x45, 0x12, 0x07, 0xd5, 0x11, 0x76, 0xc3, 0x1f, 0x50, 0x61, - 0xb4, 0x21, 0x27, 0xa0, 0x31, 0xe1, 0x76, 0x2c, 0xda, 0x59, 0x9c, 0x97, 0xf3, 0x59, 0x35, 0x92, - 0x5c, 0x18, 0x22, 0x17, 0xc6, 0x30, 0x17, 0x46, 0x85, 0xfa, 0xa4, 0x5c, 0x1c, 0xf4, 0xf4, 0x7b, - 0xa5, 0x58, 0x1d, 0x56, 0x4b, 0xb2, 0x78, 0x24, 0x6a, 0x9b, 0x6f, 0x6f, 0xa4, 0xa1, 0x09, 0x9c, - 0x77, 0xbe, 0x22, 0x0d, 0x2f, 0x51, 0x5e, 0x12, 0x6c, 0x06, 0xaf, 0x62, 0x9f, 0x41, 0x00, 0x84, - 0x0f, 0xd3, 0xf0, 0xfb, 0x6d, 0x8f, 0x86, 0xf8, 0xc4, 0x13, 0xde, 0x74, 0x12, 0xee, 0x98, 0xe0, - 0x5c, 0x78, 0x8b, 0xfe, 0x3d, 0x09, 0xdf, 0x38, 0x09, 0x6f, 0xd2, 0xe8, 0x57, 0x99, 0x84, 0x52, - 0x18, 0x76, 0x7c, 0x57, 0xfe, 0xe9, 0xea, 0x5d, 0x60, 0x11, 0xb0, 0xae, 0xef, 0x82, 0xa7, 0xfe, - 0x81, 0x72, 0xce, 0x04, 0xb2, 0x1d, 0xcf, 0x63, 0x32, 0x1f, 0x0b, 0x78, 0x69, 0xaa, 0x5e, 0xf2, - 0x3c, 0xa6, 0xfe, 0x85, 0x56, 0xa2, 0x58, 0xd4, 0x80, 0xd9, 0x34, 0x04, 0xe6, 0x70, 0xca, 0x12, - 0x41, 0x5a, 0x0a, 0x0a, 0x23, 0xb4, 0x3e, 0x04, 0xa5, 0xea, 0x1f, 0xb4, 0x08, 0xe7, 0x21, 0xb8, - 0xa2, 0x39, 0xad, 0x98, 0x11, 0x39, 0xd4, 0x59, 0x27, 0xc4, 0x3f, 0x8d, 0xf8, 0xe5, 0x98, 0x11, - 0xf5, 0x5f, 0x94, 0x85, 0x93, 0x13, 0x70, 0xb9, 0xdf, 0x85, 0xc4, 0x20, 0xf3, 0x90, 0xc1, 0xe2, - 0x58, 0x20, 0x1c, 0x36, 0x3f, 0x28, 0xa8, 0x20, 0x7b, 0xd0, 0x1c, 0xee, 0xaf, 0xd9, 0x71, 0xa2, - 0x53, 0xf0, 0x66, 0x1c, 0x48, 0x99, 0x71, 0xa0, 0x3f, 0x91, 0x2a, 0x47, 0x9e, 0xbc, 0x63, 0x93, - 0x58, 0x45, 0xb2, 0x05, 0x19, 0x9c, 0x13, 0xf3, 0x4e, 0x00, 0x19, 0xaa, 0x48, 0x2d, 0xa3, 0xa5, - 0x48, 0x2c, 0xe7, 0x93, 0xf6, 0x70, 0x5a, 0x0f, 0x37, 0x20, 0x3b, 0x52, 0x24, 0x93, 0xdc, 0x7e, - 0x81, 0x96, 0xef, 0x7d, 0xc1, 0xaa, 0xbf, 0xa1, 0xf5, 0xea, 0x71, 0xc3, 0xc2, 0xa5, 0x27, 0x56, - 0xbd, 0x66, 0xe3, 0x6a, 0xa9, 0x59, 0xaf, 0xd9, 0x47, 0xb5, 0x66, 0xa3, 0x5a, 0xb1, 0x0e, 0xad, - 0xea, 0x41, 0x2e, 0xa5, 0xe6, 0xd1, 0x62, 0x03, 0xd7, 0xeb, 0x87, 0xf6, 0x23, 0xab, 0xd9, 0xb4, - 0x6a, 0xff, 0xe5, 0x94, 0x49, 0xc9, 0xaa, 0x3d, 0x2d, 0xfd, 0x6f, 0x1d, 0xe4, 0xd2, 0xe5, 0xc7, - 0x1f, 0xfb, 0x9a, 0x72, 0xd9, 0xd7, 0x94, 0xab, 0xbe, 0xa6, 0x7c, 0xea, 0x6b, 0xca, 0xfb, 0x6b, - 0x2d, 0x75, 0x79, 0xad, 0xa5, 0xae, 0xae, 0xb5, 0xd4, 0xb3, 0xfd, 0xb6, 0xcf, 0x4f, 0xe3, 0x96, - 0xe1, 0xd2, 0xc0, 0x14, 0xa9, 0xda, 0x21, 0xc0, 0x5f, 0x53, 0x76, 0x66, 0x8e, 0x2f, 0xa4, 0xf3, - 0xe9, 0xeb, 0x4f, 0xde, 0x4b, 0xad, 0x79, 0x79, 0x31, 0xed, 0x7f, 0x0e, 0x00, 0x00, 0xff, 0xff, - 0x3e, 0x16, 0x9d, 0x3a, 0x22, 0x07, 0x00, 0x00, + // 739 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0x4d, 0x53, 0xdb, 0x3a, + 0x14, 0x8d, 0x43, 0x60, 0x06, 0x3d, 0x12, 0x12, 0x3f, 0x60, 0x02, 0xef, 0x61, 0xf3, 0x58, 0xbc, + 0xa1, 0x4c, 0xb1, 0x07, 0xe8, 0x74, 0xd9, 0x69, 0x12, 0x42, 0xc7, 0x33, 0x6d, 0x12, 0x94, 0xd2, + 0x61, 0xba, 0xa8, 0xeb, 0xd8, 0x22, 0xb8, 0xc4, 0x92, 0x2b, 0xc9, 0x29, 0x2c, 0xfb, 0x0f, 0xfa, + 0x8b, 0xba, 0xee, 0x92, 0x25, 0xab, 0x4c, 0x27, 0xec, 0xb2, 0xed, 0xa2, 0xdb, 0x8e, 0xe4, 0x7c, + 0xf1, 0xd1, 0xb0, 0x60, 0xdb, 0x4d, 0x22, 0xdd, 0x7b, 0xce, 0x91, 0x74, 0xcf, 0xb5, 0x04, 0xf4, + 0x90, 0x9c, 0x72, 0x4a, 0x5a, 0x2d, 0x93, 0x93, 0x53, 0x84, 0x49, 0xe0, 0xbb, 0xcc, 0x44, 0x6d, + 0x84, 0xb9, 0x11, 0x52, 0xc2, 0x89, 0xfa, 0xf7, 0x00, 0x60, 0x8c, 0x00, 0x2b, 0x9a, 0x4b, 0x58, + 0x40, 0x98, 0xd9, 0x70, 0x18, 0x32, 0xdb, 0xdb, 0x0d, 0xc4, 0x9d, 0x6d, 0xd3, 0x25, 0x3e, 0x8e, + 0x49, 0x2b, 0x0b, 0x4d, 0xd2, 0x24, 0x72, 0x68, 0x8a, 0x51, 0x3f, 0xba, 0x32, 0x5c, 0x2b, 0xa4, + 0x84, 0x1c, 0x9b, 0xfc, 0x3c, 0x44, 0x2c, 0xce, 0xad, 0xff, 0x9c, 0x02, 0xb9, 0xb2, 0x58, 0xb6, + 0xd4, 0x72, 0xfc, 0xa0, 0x7c, 0x16, 0xfa, 0x14, 0x79, 0xea, 0x53, 0x30, 0xed, 0x8a, 0x79, 0x5e, + 0x59, 0x53, 0x36, 0xfe, 0xda, 0x59, 0x34, 0x86, 0x9b, 0x91, 0x0a, 0x86, 0x04, 0x17, 0x67, 0x7b, + 0x1d, 0x3d, 0xc6, 0xc1, 0xf8, 0x4f, 0xc5, 0x20, 0x87, 0x84, 0x84, 0xc3, 0x7d, 0x82, 0x6d, 0x8a, + 0x1c, 0x46, 0x70, 0x3e, 0xb9, 0xa6, 0x6c, 0x64, 0x76, 0x36, 0x8d, 0x3b, 0x0e, 0x64, 0x8c, 0x56, + 0x95, 0x14, 0x28, 0x19, 0xc5, 0xc5, 0x5e, 0x47, 0xbf, 0x2d, 0x04, 0xb3, 0xe8, 0x06, 0x50, 0xdd, + 0x02, 0x00, 0x47, 0x81, 0x4d, 0x51, 0xcb, 0x39, 0x67, 0xf9, 0xa9, 0x35, 0x65, 0x23, 0x55, 0xcc, + 0xf4, 0x3a, 0xfa, 0x58, 0x14, 0xce, 0xe2, 0x28, 0x80, 0x72, 0xa8, 0x1e, 0x81, 0x65, 0x91, 0x90, + 0x7b, 0x45, 0x9e, 0xed, 0x92, 0x20, 0x8c, 0x38, 0xb2, 0x23, 0xec, 0x73, 0x96, 0x4f, 0x49, 0xf6, + 0x6a, 0xaf, 0xa3, 0xff, 0x1e, 0x04, 0x97, 0x70, 0x14, 0x94, 0xe2, 0x4c, 0x29, 0x4e, 0x1c, 0x8a, + 0xb8, 0xfa, 0x0e, 0xfc, 0x23, 0x48, 0x88, 0x71, 0x3f, 0x70, 0xf8, 0x2d, 0xed, 0x69, 0xa9, 0xad, + 0xf7, 0x3a, 0xfa, 0x24, 0x18, 0xcc, 0xe3, 0x28, 0x28, 0x0f, 0x72, 0xd7, 0xf4, 0x0f, 0x40, 0x7a, + 0xb0, 0xa1, 0x48, 0xd4, 0x31, 0x3f, 0x23, 0x8d, 0x59, 0x36, 0xe2, 0x86, 0x30, 0x44, 0x43, 0x18, + 0xfd, 0x86, 0x30, 0x4a, 0xc4, 0xc7, 0xc5, 0x5c, 0xaf, 0xa3, 0x5f, 0xe7, 0xc0, 0xb9, 0xfe, 0xf4, + 0x50, 0xcc, 0xd6, 0x7f, 0x5c, 0x73, 0xbe, 0x8e, 0x38, 0x6f, 0x3d, 0xc0, 0xf9, 0x0f, 0x20, 0x27, + 0x01, 0x36, 0x45, 0x1f, 0x23, 0x9f, 0xa2, 0x00, 0x61, 0xde, 0x77, 0xfe, 0xff, 0x9b, 0x1a, 0x35, + 0xf1, 0x0b, 0x47, 0xb8, 0x71, 0xd7, 0x6f, 0x89, 0xc0, 0x6c, 0x78, 0x03, 0xfe, 0xc7, 0xf5, 0x07, + 0xb8, 0xfe, 0x39, 0x09, 0xfe, 0x95, 0xae, 0x17, 0xc2, 0xb0, 0xe5, 0xbb, 0xf2, 0x63, 0xaa, 0xb6, + 0x11, 0x65, 0x88, 0xb6, 0x7d, 0x17, 0x79, 0xea, 0x23, 0x90, 0x75, 0x46, 0x29, 0xdb, 0xf1, 0x3c, + 0x2a, 0x7b, 0x61, 0x16, 0xce, 0x8f, 0xc5, 0x0b, 0x9e, 0x47, 0xd5, 0x27, 0x60, 0x89, 0x45, 0x22, + 0x86, 0xa8, 0x4d, 0x42, 0x44, 0x1d, 0x4e, 0x68, 0x4c, 0x48, 0x4a, 0xc2, 0xc2, 0x20, 0x5b, 0xed, + 0x27, 0x25, 0xeb, 0x19, 0x48, 0xa3, 0xb3, 0x10, 0xb9, 0xa2, 0x10, 0x8d, 0x88, 0x62, 0x69, 0xe0, + 0xa4, 0x43, 0xc1, 0xb9, 0x01, 0xbe, 0x18, 0x51, 0xac, 0x3e, 0x07, 0x19, 0x74, 0x7c, 0x8c, 0x5c, + 0xee, 0xb7, 0x51, 0x2c, 0x90, 0xba, 0x4f, 0x20, 0x3d, 0x24, 0x08, 0x85, 0xf5, 0xaf, 0x0a, 0x58, + 0x90, 0x35, 0xa8, 0xf7, 0xf7, 0x57, 0x6f, 0x39, 0xec, 0x04, 0x79, 0x13, 0x0e, 0xa4, 0x4c, 0x38, + 0xd0, 0x63, 0xa0, 0x4a, 0x7b, 0xe3, 0xbb, 0x33, 0x6e, 0x21, 0x26, 0x4b, 0x90, 0x82, 0x59, 0xe1, + 0x6d, 0x9c, 0x90, 0x0d, 0xc4, 0xd4, 0x22, 0x98, 0x67, 0x62, 0x39, 0x1f, 0x37, 0x6d, 0x27, 0x20, + 0x11, 0xe6, 0xf7, 0x17, 0x20, 0x33, 0x60, 0x14, 0x24, 0x61, 0xf3, 0x3d, 0x58, 0xbc, 0xf3, 0xe2, + 0x54, 0xff, 0x03, 0xab, 0xe5, 0xa3, 0x9a, 0x05, 0x0b, 0xaf, 0xad, 0x6a, 0xc5, 0x86, 0xe5, 0x42, + 0xbd, 0x5a, 0xb1, 0x0f, 0x2b, 0xf5, 0x5a, 0xb9, 0x64, 0xed, 0x5b, 0xe5, 0xbd, 0x6c, 0x42, 0xcd, + 0x81, 0x74, 0x0d, 0x56, 0xab, 0xfb, 0xf6, 0x2b, 0xab, 0x5e, 0xb7, 0x2a, 0x2f, 0xb2, 0xca, 0x28, + 0x64, 0x55, 0xde, 0x14, 0x5e, 0x5a, 0x7b, 0xd9, 0x64, 0xf1, 0xe0, 0x5b, 0x57, 0x53, 0x2e, 0xba, + 0x9a, 0x72, 0xd9, 0xd5, 0x94, 0xef, 0x5d, 0x4d, 0xf9, 0x72, 0xa5, 0x25, 0x2e, 0xae, 0xb4, 0xc4, + 0xe5, 0x95, 0x96, 0x78, 0xbb, 0xdb, 0xf4, 0xf9, 0x49, 0xd4, 0x30, 0x5c, 0x12, 0x98, 0xa2, 0xab, + 0xb6, 0x30, 0xe2, 0x9f, 0x08, 0x3d, 0x35, 0x87, 0x0f, 0xcd, 0xd9, 0xf8, 0xb3, 0x26, 0xdf, 0x9b, + 0xc6, 0x8c, 0x7c, 0x70, 0x76, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x71, 0x30, 0x08, 0xfa, + 0x06, 0x00, 0x00, } func (m *EventClaimExpired) Marshal() (dAtA []byte, err error) { @@ -450,9 +450,9 @@ func (m *EventClaimExpired) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ClaimedAmountUpokt != nil { + if m.ClaimedUpokt != nil { { - size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ClaimedUpokt.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -517,9 +517,9 @@ func (m *EventClaimSettled) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ClaimedAmountUpokt != nil { + if m.ClaimedUpokt != nil { { - size, err := m.ClaimedAmountUpokt.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ClaimedUpokt.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -705,8 +705,8 @@ func (m *EventClaimExpired) Size() (n int) { if m.NumEstimatedComputeUnits != 0 { n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) } - if m.ClaimedAmountUpokt != nil { - l = m.ClaimedAmountUpokt.Size() + if m.ClaimedUpokt != nil { + l = m.ClaimedUpokt.Size() n += 1 + l + sovEvent(uint64(l)) } return n @@ -734,8 +734,8 @@ func (m *EventClaimSettled) Size() (n int) { if m.NumEstimatedComputeUnits != 0 { n += 1 + sovEvent(uint64(m.NumEstimatedComputeUnits)) } - if m.ClaimedAmountUpokt != nil { - l = m.ClaimedAmountUpokt.Size() + if m.ClaimedUpokt != nil { + l = m.ClaimedUpokt.Size() n += 1 + l + sovEvent(uint64(l)) } return n @@ -935,7 +935,7 @@ func (m *EventClaimExpired) Unmarshal(dAtA []byte) error { } case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -962,10 +962,10 @@ func (m *EventClaimExpired) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClaimedAmountUpokt == nil { - m.ClaimedAmountUpokt = &types1.Coin{} + if m.ClaimedUpokt == nil { + m.ClaimedUpokt = &types1.Coin{} } - if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ClaimedUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1133,7 +1133,7 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { } case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClaimedAmountUpokt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClaimedUpokt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1160,10 +1160,10 @@ func (m *EventClaimSettled) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ClaimedAmountUpokt == nil { - m.ClaimedAmountUpokt = &types1.Coin{} + if m.ClaimedUpokt == nil { + m.ClaimedUpokt = &types1.Coin{} } - if err := m.ClaimedAmountUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ClaimedUpokt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 9f5451d34675b78e3e0f8a26e6a204753d975ad7 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Mon, 14 Oct 2024 09:41:25 -0400 Subject: [PATCH 09/13] [Docs] Fix example of how to set rev share precentage (#877) The existing docs for setting `rev_share_percentage` resulted in this error: `"cannot unmarshal !!seq into map[string]float32"` --- .../docs/operate/configs/supplier_staking_config.md | 3 ++- localnet/poktrolld/config/supplier1_stake_config.yaml | 8 ++++---- .../poktrolld/config/supplier_stake_config_example.yaml | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docusaurus/docs/operate/configs/supplier_staking_config.md b/docusaurus/docs/operate/configs/supplier_staking_config.md index 534aa9324..7e2283f3e 100644 --- a/docusaurus/docs/operate/configs/supplier_staking_config.md +++ b/docusaurus/docs/operate/configs/supplier_staking_config.md @@ -232,7 +232,8 @@ _`Optional`_, _`Non-empty`_ ```yaml default_rev_share_percent: - : + : + : ``` `default_rev_share_percent` is an optional map that defines the default the revenue diff --git a/localnet/poktrolld/config/supplier1_stake_config.yaml b/localnet/poktrolld/config/supplier1_stake_config.yaml index 228e6ade2..e3d475939 100644 --- a/localnet/poktrolld/config/supplier1_stake_config.yaml +++ b/localnet/poktrolld/config/supplier1_stake_config.yaml @@ -2,8 +2,8 @@ owner_address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 operator_address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 stake_amount: 1000069upokt default_rev_share_percent: - - pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80.5 - - pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 19.5 + pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80.5 + pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 19.5 services: - service_id: anvil endpoints: @@ -11,8 +11,8 @@ services: rpc_type: JSON_RPC - service_id: ollama rev_share_percent: - - pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 50 - - pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 50 + pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 50 + pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 50 endpoints: - publicly_exposed_url: http://relayminer1:8545 rpc_type: REST diff --git a/localnet/poktrolld/config/supplier_stake_config_example.yaml b/localnet/poktrolld/config/supplier_stake_config_example.yaml index 51eb04fdc..ce14f4a08 100644 --- a/localnet/poktrolld/config/supplier_stake_config_example.yaml +++ b/localnet/poktrolld/config/supplier_stake_config_example.yaml @@ -30,8 +30,8 @@ stake_amount: 1000069upokt # or include at least one item. default_rev_share_percent: # The sum of all shares MUST equal 100%. Staking will fail otherwise. - - pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80.5 - - pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 19.5 + pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 80.5 + pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 19.5 services: # The endpoint URL for the Anvil service is provided via the RelayMiner. # The RelayMiner acts as a proxy, forwarding requests to the actual Anvil data node behind it. @@ -45,8 +45,8 @@ services: # service, default_rev_share_percent is used. # The sum of all shares MUST equal 100%. Staking will fail otherwise. rev_share_percent: - - pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 50 - - pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 50 + pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4: 50 + pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw: 50 endpoints: - publicly_exposed_url: http://relayminer1:8545 rpc_type: REST From 2ac298afbe810807fc407ebf8cf6e64973eeae2c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 17:57:43 +0200 Subject: [PATCH 10/13] [Shared] Refresh shared module params logic (#852) ## Summary The "adding_params.md" doc has (or will have) changed substantially (see #839) since the shared module's param logic was last updated. This PR aligns the shared module's param logic with the snippets in the updated docs. Specifically, this refresh includes: - Moving validation logic from `msgServer#UpdateParam()` to `MsgUpdateParam#ValidateBasic()`. - Replacing magic strings of param names with their standard variable counterparts (i.e. `sharedtypes.Param...`). - Improving some local variable names. - Replacing usages of `interface{}` with `any`. ## Dependencies - #809 - #843 - #844 - #845 - #847 - #848 - #849 - #850 - #857 ## Dependents - #851 - #861 ## Issue - #612 ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [x] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [ ] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- x/shared/keeper/msg_server_update_param.go | 108 +++++++----------- .../keeper/msg_server_update_param_test.go | 52 ++++++--- x/shared/types/message_update_param.go | 62 +++++++--- x/shared/types/message_update_param_test.go | 11 +- x/shared/types/params.go | 42 +++---- 5 files changed, 155 insertions(+), 120 deletions(-) diff --git a/x/shared/keeper/msg_server_update_param.go b/x/shared/keeper/msg_server_update_param.go index 6263d296d..099876660 100644 --- a/x/shared/keeper/msg_server_update_param.go +++ b/x/shared/keeper/msg_server_update_param.go @@ -2,105 +2,85 @@ package keeper import ( "context" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/shared/types" ) func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, types.ErrSharedInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + types.ErrSharedInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) switch msg.Name { case types.ParamNumBlocksPerSession: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.NumBlocksPerSession = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.NumBlocksPerSession = uint64(msg.GetAsInt64()) case types.ParamGracePeriodEndOffsetBlocks: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.GracePeriodEndOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.GracePeriodEndOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamClaimWindowOpenOffsetBlocks: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ClaimWindowOpenOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ClaimWindowOpenOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamClaimWindowCloseOffsetBlocks: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ClaimWindowCloseOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ClaimWindowCloseOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamProofWindowOpenOffsetBlocks: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofWindowOpenOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ProofWindowOpenOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamProofWindowCloseOffsetBlocks: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofWindowCloseOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ProofWindowCloseOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamSupplierUnbondingPeriodSessions: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.SupplierUnbondingPeriodSessions = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.SupplierUnbondingPeriodSessions = uint64(msg.GetAsInt64()) case types.ParamApplicationUnbondingPeriodSessions: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ApplicationUnbondingPeriodSessions = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ApplicationUnbondingPeriodSessions = uint64(msg.GetAsInt64()) case types.ParamComputeUnitsToTokensMultiplier: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) - if !ok { - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - computeUnitsToTokensMultiplier := uint64(value.AsInt64) - - if err := types.ValidateComputeUnitsToTokensMultiplier(computeUnitsToTokensMultiplier); err != nil { - return nil, err - } - - params.ComputeUnitsToTokensMultiplier = computeUnitsToTokensMultiplier + logger = logger.With("param_value", msg.GetAsInt64()) + params.ComputeUnitsToTokensMultiplier = uint64(msg.GetAsInt64()) default: - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + types.ErrSharedParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) } // Perform a global validation on all params, which includes the updated param. // This is needed to ensure that the updated param is valid in the context of all other params. if err := params.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + err = fmt.Errorf("unable to set params: %w", err) + logger.Error(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.Internal, err.Error()) } updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ Params: &updatedParams, }, nil diff --git a/x/shared/keeper/msg_server_update_param_test.go b/x/shared/keeper/msg_server_update_param_test.go index da4a2ca03..3a84810f4 100644 --- a/x/shared/keeper/msg_server_update_param_test.go +++ b/x/shared/keeper/msg_server_update_param_test.go @@ -6,6 +6,8 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/shared/keeper" "github.com/pokt-network/poktroll/x/shared/types" @@ -50,7 +52,7 @@ func TestMsgUpdateParam_UpdateNumBlocksPerSession(t *testing.T) { require.Equal(t, uint64(expectedNumBlocksPerSession), res.Params.NumBlocksPerSession) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "NumBlocksPerSession") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyNumBlocksPerSession)) } func TestMsgUpdateParam_UpdateClaimWindowOpenOffsetBlocks(t *testing.T) { @@ -95,7 +97,7 @@ func TestMsgUpdateParam_UpdateClaimWindowOpenOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedClaimWindowOpenOffestBlocks), res.Params.ClaimWindowOpenOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ClaimWindowOpenOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyClaimWindowOpenOffsetBlocks)) } func TestMsgUpdateParam_UpdateClaimWindowCloseOffsetBlocks(t *testing.T) { @@ -140,7 +142,7 @@ func TestMsgUpdateParam_UpdateClaimWindowCloseOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedClaimWindowCloseOffestBlocks), res.Params.ClaimWindowCloseOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ClaimWindowCloseOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyClaimWindowCloseOffsetBlocks)) } func TestMsgUpdateParam_UpdateProofWindowOpenOffsetBlocks(t *testing.T) { @@ -185,7 +187,7 @@ func TestMsgUpdateParam_UpdateProofWindowOpenOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedProofWindowOpenOffestBlocks), res.Params.ProofWindowOpenOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ProofWindowOpenOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyProofWindowOpenOffsetBlocks)) } func TestMsgUpdateParam_UpdateProofWindowCloseOffsetBlocks(t *testing.T) { @@ -230,7 +232,7 @@ func TestMsgUpdateParam_UpdateProofWindowCloseOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedProofWindowCloseOffestBlocks), res.Params.ProofWindowCloseOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ProofWindowCloseOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyProofWindowCloseOffsetBlocks)) } func TestMsgUpdateParam_UpdateGracePeriodEndOffsetBlocks(t *testing.T) { @@ -263,11 +265,11 @@ func TestMsgUpdateParam_UpdateGracePeriodEndOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedGracePeriodEndOffestBlocks), res.Params.GetGracePeriodEndOffsetBlocks()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "GracePeriodEndOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyGracePeriodEndOffsetBlocks)) } func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { - var expectedSupplierUnbondingPerid int64 = 5 + var expectedSupplierUnbondingPeriod int64 = 5 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -276,21 +278,21 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { require.NoError(t, k.SetParams(ctx, testSharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedSupplierUnbondingPerid), testSharedParams.GetSupplierUnbondingPeriodSessions()) + require.NotEqual(t, uint64(expectedSupplierUnbondingPeriod), testSharedParams.GetSupplierUnbondingPeriodSessions()) // Update the supplier unbonding period param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamSupplierUnbondingPeriodSessions, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedSupplierUnbondingPerid}, + AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedSupplierUnbondingPeriod}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedSupplierUnbondingPerid), res.Params.GetSupplierUnbondingPeriodSessions()) + require.Equal(t, uint64(expectedSupplierUnbondingPeriod), res.Params.GetSupplierUnbondingPeriodSessions()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "SupplierUnbondingPeriodSessions") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeySupplierUnbondingPeriodSessions)) // Ensure that a supplier unbonding period that is less than the cumulative // proof window close blocks is not allowed. @@ -300,7 +302,13 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 1}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) - require.ErrorIs(t, err, sharedtypes.ErrSharedParamInvalid) + require.EqualError(t, err, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedParamInvalid.Wrapf( + "SupplierUnbondingPeriodSessions (%v session) (%v blocks) must be greater than the cumulative ProofWindowCloseOffsetBlocks (%v)", + 1, 4, 10, + ).Error(), + ).Error()) } func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { @@ -327,7 +335,7 @@ func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { require.Equal(t, uint64(expectedApplicationUnbondingPerid), res.Params.GetApplicationUnbondingPeriodSessions()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "ApplicationUnbondingPeriodSessions") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyApplicationUnbondingPeriodSessions)) // Ensure that a application unbonding period that is less than the cumulative // proof window close blocks is not allowed. @@ -337,7 +345,13 @@ func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 1}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) - require.ErrorIs(t, err, sharedtypes.ErrSharedParamInvalid) + require.EqualError(t, err, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedParamInvalid.Wrapf( + "ApplicationUnbondingPeriodSessions (%v session) (%v blocks) must be greater than the cumulative ProofWindowCloseOffsetBlocks (%v)", + 1, 4, 10, + ).Error(), + ).Error()) } func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { @@ -364,7 +378,7 @@ func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { require.Equal(t, uint64(expectedComputeUnitsToTokenMultiplier), res.Params.GetComputeUnitsToTokensMultiplier()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "ComputeUnitsToTokensMultiplier") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyComputeUnitsToTokensMultiplier)) // Ensure that compute units to token multiplier that is less than 1 is not allowed. updateParamMsg = &sharedtypes.MsgUpdateParam{ @@ -373,7 +387,12 @@ func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 0}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) - require.ErrorIs(t, err, sharedtypes.ErrSharedParamInvalid) + require.EqualError(t, err, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedParamInvalid.Wrapf( + "invalid ComputeUnitsToTokensMultiplier: (%d)", 0, + ).Error(), + ).Error()) } // getMinActorUnbondingPeriodSessions returns the actors unbonding period @@ -386,6 +405,5 @@ func getMinActorUnbondingPeriodSessions( ) uint64 { deltaBlocks := newParamBlocksValue - oldParamBlocksValue newProofWindowCloseBlocks := types.GetSessionEndToProofWindowCloseBlocks(params) + deltaBlocks - return (newProofWindowCloseBlocks / params.NumBlocksPerSession) + 1 } diff --git a/x/shared/types/message_update_param.go b/x/shared/types/message_update_param.go index f609b0fd8..d258fc7fa 100644 --- a/x/shared/types/message_update_param.go +++ b/x/shared/types/message_update_param.go @@ -31,9 +31,10 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara }, nil } -// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures -// the parameter name is supported and the parameter type matches the expected type for -// a given parameter name. +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures: +// 1. The parameter name is supported. +// 2. The parameter type matches the expected type for a given parameter name. +// 3. The parameter value is valid (according to its respective validation function). func (msg *MsgUpdateParam) ValidateBasic() error { // Validate the address if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { @@ -48,16 +49,51 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. - case ParamNumBlocksPerSession, - ParamGracePeriodEndOffsetBlocks, - ParamClaimWindowOpenOffsetBlocks, - ParamClaimWindowCloseOffsetBlocks, - ParamProofWindowOpenOffsetBlocks, - ParamProofWindowCloseOffsetBlocks, - ParamSupplierUnbondingPeriodSessions, - ParamApplicationUnbondingPeriodSessions, - ParamComputeUnitsToTokensMultiplier: - return msg.paramTypeIsInt64() + case ParamNumBlocksPerSession: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateNumBlocksPerSession(uint64(msg.GetAsInt64())) + case ParamGracePeriodEndOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateGracePeriodEndOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamClaimWindowOpenOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateClaimWindowOpenOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamClaimWindowCloseOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateClaimWindowCloseOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamProofWindowOpenOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateProofWindowOpenOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamProofWindowCloseOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateProofWindowCloseOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamSupplierUnbondingPeriodSessions: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateSupplierUnbondingPeriodSessions(uint64(msg.GetAsInt64())) + case ParamApplicationUnbondingPeriodSessions: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateApplicationUnbondingPeriodSessions(uint64(msg.GetAsInt64())) + case ParamComputeUnitsToTokensMultiplier: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateComputeUnitsToTokensMultiplier(uint64(msg.GetAsInt64())) default: return ErrSharedParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/shared/types/message_update_param_test.go b/x/shared/types/message_update_param_test.go index 65f4931b3..1da38b6e0 100644 --- a/x/shared/types/message_update_param_test.go +++ b/x/shared/types/message_update_param_test.go @@ -52,13 +52,14 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { Name: ParamComputeUnitsToTokensMultiplier, AsType: &MsgUpdateParam_AsInt64{AsInt64: 0}, }, + expectedErr: ErrSharedParamInvalid, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorContains(t, err, tt.expectedErr.Error()) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/shared/types/params.go b/x/shared/types/params.go index 17bc7b964..27887310c 100644 --- a/x/shared/types/params.go +++ b/x/shared/types/params.go @@ -176,8 +176,8 @@ func (params *Params) ValidateBasic() error { // ValidateNumBlocksPerSession validates the NumBlocksPerSession param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateNumBlocksPerSession(v interface{}) error { - numBlocksPerSession, err := validateIsUint64(v) +func ValidateNumBlocksPerSession(numBlocksPerSessionAny any) error { + numBlocksPerSession, err := validateIsUint64(numBlocksPerSessionAny) if err != nil { return err } @@ -191,44 +191,44 @@ func ValidateNumBlocksPerSession(v interface{}) error { // ValidateClaimWindowOpenOffsetBlocks validates the ClaimWindowOpenOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateClaimWindowOpenOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateClaimWindowOpenOffsetBlocks(claimWindowOpenOffsetBlocksAny any) error { + _, err := validateIsUint64(claimWindowOpenOffsetBlocksAny) return err } // ValidateClaimWindowCloseOffsetBlocks validates the ClaimWindowCloseOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateClaimWindowCloseOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateClaimWindowCloseOffsetBlocks(claimWindowCloseOffsetBlocksAny any) error { + _, err := validateIsUint64(claimWindowCloseOffsetBlocksAny) return err } // ValidateProofWindowOpenOffsetBlocks validates the ProofWindowOpenOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofWindowOpenOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateProofWindowOpenOffsetBlocks(proofWindowOpenOffsetBlocksAny any) error { + _, err := validateIsUint64(proofWindowOpenOffsetBlocksAny) return err } // ValidateProofWindowCloseOffsetBlocks validates the ProofWindowCloseOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofWindowCloseOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateProofWindowCloseOffsetBlocks(proofWindowCloseOffsetBlocksAny any) error { + _, err := validateIsUint64(proofWindowCloseOffsetBlocksAny) return err } // ValidateGracePeriodEndOffsetBlocks validates the GracePeriodEndOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateGracePeriodEndOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateGracePeriodEndOffsetBlocks(gracePeriodEndOffsetBlocksAny any) error { + _, err := validateIsUint64(gracePeriodEndOffsetBlocksAny) return err } -// ValidateSupplierUnbondingPeriodSession validates the SupplierUnbondingPeriodSessions +// ValidateSupplierUnbondingPeriodSessions validates the SupplierUnbondingPeriodSessions // governance parameter. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateSupplierUnbondingPeriodSessions(v interface{}) error { - supplierUnbondingPeriodSessions, err := validateIsUint64(v) +func ValidateSupplierUnbondingPeriodSessions(supplierUnbondingPeriodSessionsAny any) error { + supplierUnbondingPeriodSessions, err := validateIsUint64(supplierUnbondingPeriodSessionsAny) if err != nil { return err } @@ -240,11 +240,11 @@ func ValidateSupplierUnbondingPeriodSessions(v interface{}) error { return nil } -// ValidateApplicationUnbondingPeriodSession validates the ApplicationUnbondingPeriodSessions +// ValidateApplicationUnbondingPeriodSessions validates the ApplicationUnbondingPeriodSessions // governance parameter. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateApplicationUnbondingPeriodSessions(v interface{}) error { - applicationUnbondingPeriodSessions, err := validateIsUint64(v) +func ValidateApplicationUnbondingPeriodSessions(applicationUnboindingPeriodSessionsAny any) error { + applicationUnbondingPeriodSessions, err := validateIsUint64(applicationUnboindingPeriodSessionsAny) if err != nil { return err } @@ -258,10 +258,10 @@ func ValidateApplicationUnbondingPeriodSessions(v interface{}) error { // ValidateComputeUnitsToTokensMultiplier validates the ComputeUnitsToTokensMultiplier governance parameter. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateComputeUnitsToTokensMultiplier(v interface{}) error { - computeUnitsToTokensMultiplier, ok := v.(uint64) +func ValidateComputeUnitsToTokensMultiplier(computeUnitsToTokensMultiplerAny any) error { + computeUnitsToTokensMultiplier, ok := computeUnitsToTokensMultiplerAny.(uint64) if !ok { - return ErrSharedParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrSharedParamInvalid.Wrapf("invalid parameter type: %T", computeUnitsToTokensMultiplerAny) } if computeUnitsToTokensMultiplier <= 0 { From efbebfad59ac85d8f885fc10fa5426737a638e49 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 22:56:05 +0200 Subject: [PATCH 11/13] [Proof] Refresh proof module params logic (#851) ## Summary The "adding_params.md" doc has (or will have) changed substantially (see #839) since the proof module's param logic was last updated. This PR aligns the proof module's param logic with the snippets in the updated docs. Specifically, this refresh includes: - Moving validation logic from `msgServer#UpdateParam()` to `MsgUpdateParam#ValidateBasic()`. - Replacing magic strings of param names with their standard variable counterparts (i.e. `prooftypes.Param...`). - Improving some local variable names. - Replacing usages of `interface{}` with `any`. - Improving validation for all coin type params to be consistent with application, gateway, and supplier coin type validation. # Dependencies - #809 - #843 - #844 - #845 - #847 - #848 - #849 - #850 - #857 - #852 ## Dependents - #861 ## Issue - #612 ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [x] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [ ] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- x/proof/keeper/msg_server_update_param.go | 63 ++++++++++--------- .../keeper/msg_server_update_param_test.go | 8 +-- x/proof/keeper/msg_update_params_test.go | 5 +- x/proof/keeper/params_test.go | 26 ++++---- x/proof/types/message_update_param.go | 27 +++++--- x/proof/types/params.go | 52 +++++++++------ 6 files changed, 108 insertions(+), 73 deletions(-) diff --git a/x/proof/keeper/msg_server_update_param.go b/x/proof/keeper/msg_server_update_param.go index d98db8206..6e6b3603c 100644 --- a/x/proof/keeper/msg_server_update_param.go +++ b/x/proof/keeper/msg_server_update_param.go @@ -2,6 +2,10 @@ package keeper import ( "context" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/proof/types" ) @@ -12,58 +16,59 @@ func (k msgServer) UpdateParam( ctx context.Context, msg *types.MsgUpdateParam, ) (*types.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, types.ErrProofInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + types.ErrProofInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) switch msg.Name { case types.ParamProofRequestProbability: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsFloat) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofRequestProbability = value.AsFloat + logger = logger.With("param_value", msg.GetAsFloat()) + params.ProofRequestProbability = msg.GetAsFloat() case types.ParamProofRequirementThreshold: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofRequirementThreshold = value.AsCoin + logger = logger.With("param_value", msg.GetAsCoin()) + params.ProofRequirementThreshold = msg.GetAsCoin() case types.ParamProofMissingPenalty: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofMissingPenalty = value.AsCoin + logger = logger.With("param_value", msg.GetAsCoin()) + params.ProofMissingPenalty = msg.GetAsCoin() case types.ParamProofSubmissionFee: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofSubmissionFee = value.AsCoin + logger = logger.With("param_value", msg.GetAsCoin()) + params.ProofSubmissionFee = msg.GetAsCoin() default: - return nil, types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) } if err := params.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + err = fmt.Errorf("unable to set params: %w", err) + logger.Error(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.Internal, err.Error()) } updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ Params: &updatedParams, }, nil diff --git a/x/proof/keeper/msg_server_update_param_test.go b/x/proof/keeper/msg_server_update_param_test.go index ba3a39c31..a53d688ec 100644 --- a/x/proof/keeper/msg_server_update_param_test.go +++ b/x/proof/keeper/msg_server_update_param_test.go @@ -39,7 +39,7 @@ func TestMsgUpdateParam_UpdateProofRequestProbabilityOnly(t *testing.T) { require.Equal(t, expectedProofRequestProbability, res.Params.ProofRequestProbability) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofRequestProbability") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofRequestProbability)) } func TestMsgUpdateParam_UpdateProofRequirementThresholdOnly(t *testing.T) { @@ -66,7 +66,7 @@ func TestMsgUpdateParam_UpdateProofRequirementThresholdOnly(t *testing.T) { require.Equal(t, &expectedProofRequirementThreshold, res.Params.ProofRequirementThreshold) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofRequirementThreshold") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofRequirementThreshold)) } func TestMsgUpdateParam_UpdateProofMissingPenaltyOnly(t *testing.T) { @@ -93,7 +93,7 @@ func TestMsgUpdateParam_UpdateProofMissingPenaltyOnly(t *testing.T) { require.Equal(t, &expectedProofMissingPenalty, res.Params.ProofMissingPenalty) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofMissingPenalty") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofMissingPenalty)) } func TestMsgUpdateParam_UpdateProofSubmissionFeeOnly(t *testing.T) { @@ -120,5 +120,5 @@ func TestMsgUpdateParam_UpdateProofSubmissionFeeOnly(t *testing.T) { require.Equal(t, &expectedProofSubmissionFee, res.Params.ProofSubmissionFee) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofSubmissionFee") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofSubmissionFee)) } diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index 2c6739855..d7509dc93 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -42,8 +42,9 @@ func TestMsgUpdateParams(t *testing.T) { params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{ - ProofMissingPenalty: &types.DefaultProofMissingPenalty, - ProofSubmissionFee: &types.MinProofSubmissionFee, + ProofRequirementThreshold: &types.DefaultProofRequirementThreshold, + ProofMissingPenalty: &types.DefaultProofMissingPenalty, + ProofSubmissionFee: &types.MinProofSubmissionFee, }, }, shouldError: false, diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go index 128ada551..43e197d02 100644 --- a/x/proof/keeper/params_test.go +++ b/x/proof/keeper/params_test.go @@ -106,7 +106,7 @@ func TestParams_ValidateProofMissingPenalty(t *testing.T) { { desc: "invalid denomination", proofMissingPenalty: &invalidDenomCoin, - expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid coin denom: invalid_denom"), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid proof_missing_penalty denom: invalid_denom"), }, { desc: "missing", @@ -124,12 +124,12 @@ func TestParams_ValidateProofMissingPenalty(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := prooftypes.ValidateProofMissingPenalty(tt.proofMissingPenalty) - if tt.expectedErr != nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := prooftypes.ValidateProofMissingPenalty(test.proofMissingPenalty) + if test.expectedErr != nil { require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErr.Error()) + require.EqualError(t, err, test.expectedErr.Error()) } else { require.NoError(t, err) } @@ -155,7 +155,7 @@ func TestParams_ValidateProofSubmissionFee(t *testing.T) { { desc: "invalid denomination", proofSubmissionFee: &invalidDenomCoin, - expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid coin denom: invalid_denom"), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid proof_submission_fee denom: invalid_denom"), }, { desc: "missing", @@ -171,7 +171,7 @@ func TestParams_ValidateProofSubmissionFee(t *testing.T) { desc: "below minimum", proofSubmissionFee: &belowMinProofSubmissionFee, expectedErr: prooftypes.ErrProofParamInvalid.Wrapf( - "ProofSubmissionFee param is below minimum value %s: got %s", + "proof_submission_fee is below minimum value %s: got %s", prooftypes.MinProofSubmissionFee, belowMinProofSubmissionFee, ), @@ -182,12 +182,12 @@ func TestParams_ValidateProofSubmissionFee(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := prooftypes.ValidateProofSubmissionFee(tt.proofSubmissionFee) - if tt.expectedErr != nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := prooftypes.ValidateProofSubmissionFee(test.proofSubmissionFee) + if test.expectedErr != nil { require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErr.Error()) + require.EqualError(t, err, test.expectedErr.Error()) } else { require.NoError(t, err) } diff --git a/x/proof/types/message_update_param.go b/x/proof/types/message_update_param.go index b4ed1960d..ad7142bef 100644 --- a/x/proof/types/message_update_param.go +++ b/x/proof/types/message_update_param.go @@ -33,9 +33,10 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara }, nil } -// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures -// the parameter name is supported and the parameter type matches the expected type for -// a given parameter name. +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures: +// 1. The parameter name is supported. +// 2. The parameter type matches the expected type for a given parameter name. +// 3. The parameter value is valid (according to its respective validation function). func (msg *MsgUpdateParam) ValidateBasic() error { // Validate the address if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { @@ -50,13 +51,25 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { case ParamProofRequestProbability: - return msg.paramTypeIsFloat() + if err := msg.paramTypeIsFloat(); err != nil { + return err + } + return ValidateProofRequestProbability(msg.GetAsFloat()) case ParamProofRequirementThreshold: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateProofRequirementThreshold(msg.GetAsCoin()) case ParamProofMissingPenalty: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateProofMissingPenalty(msg.GetAsCoin()) case ParamProofSubmissionFee: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateProofSubmissionFee(msg.GetAsCoin()) default: return ErrProofParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/proof/types/params.go b/x/proof/types/params.go index 2a46bda77..16d77287f 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -118,10 +118,10 @@ func (params *Params) ValidateBasic() error { // ValidateProofRequestProbability validates the ProofRequestProbability param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofRequestProbability(v interface{}) error { - proofRequestProbability, ok := v.(float32) +func ValidateProofRequestProbability(proofRequestProbabilityAny any) error { + proofRequestProbability, ok := proofRequestProbabilityAny.(float32) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofRequestProbabilityAny) } if proofRequestProbability < 0 || proofRequestProbability > 1 { @@ -133,10 +133,22 @@ func ValidateProofRequestProbability(v interface{}) error { // ValidateProofRequirementThreshold validates the ProofRequirementThreshold param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofRequirementThreshold(v interface{}) error { - _, ok := v.(*cosmostypes.Coin) +func ValidateProofRequirementThreshold(proofRequirementThresholdAny any) error { + proofRequirementThresholdCoin, ok := proofRequirementThresholdAny.(*cosmostypes.Coin) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofRequirementThresholdAny) + } + + if proofRequirementThresholdCoin == nil { + return ErrProofParamInvalid.Wrap("missing proof_requirement_threshold") + } + + if proofRequirementThresholdCoin.Denom != volatile.DenomuPOKT { + return ErrProofParamInvalid.Wrapf("invalid proof_requirement_threshold denom: %s", proofRequirementThresholdCoin.Denom) + } + + if proofRequirementThresholdCoin.IsZero() || proofRequirementThresholdCoin.IsNegative() { + return ErrProofParamInvalid.Wrapf("invalid proof_requirement_threshold amount: %s <= 0", proofRequirementThresholdCoin) } return nil @@ -144,29 +156,33 @@ func ValidateProofRequirementThreshold(v interface{}) error { // ValidateProofMissingPenalty validates the ProofMissingPenalty param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofMissingPenalty(v interface{}) error { - coin, ok := v.(*cosmostypes.Coin) +func ValidateProofMissingPenalty(proofMissingPenaltyAny any) error { + proofMissingPenaltyCoin, ok := proofMissingPenaltyAny.(*cosmostypes.Coin) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofMissingPenaltyAny) } - if coin == nil { + if proofMissingPenaltyCoin == nil { return ErrProofParamInvalid.Wrap("missing proof_missing_penalty") } - if coin.Denom != volatile.DenomuPOKT { - return ErrProofParamInvalid.Wrapf("invalid coin denom: %s", coin.Denom) + if proofMissingPenaltyCoin.Denom != volatile.DenomuPOKT { + return ErrProofParamInvalid.Wrapf("invalid proof_missing_penalty denom: %s", proofMissingPenaltyCoin.Denom) + } + + if proofMissingPenaltyCoin.IsZero() || proofMissingPenaltyCoin.IsNegative() { + return ErrProofParamInvalid.Wrapf("invalid proof_missing_penalty amount: %s <= 0", proofMissingPenaltyCoin) } return nil } -// ValidateProofSubmission validates the ProofSubmissionFee param. +// ValidateProofSubmissionFee validates the ProofSubmissionFee param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofSubmissionFee(v interface{}) error { - submissionFeeCoin, ok := v.(*cosmostypes.Coin) +func ValidateProofSubmissionFee(proofSubmissionFeeAny any) error { + submissionFeeCoin, ok := proofSubmissionFeeAny.(*cosmostypes.Coin) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofSubmissionFeeAny) } if submissionFeeCoin == nil { @@ -174,12 +190,12 @@ func ValidateProofSubmissionFee(v interface{}) error { } if submissionFeeCoin.Denom != volatile.DenomuPOKT { - return ErrProofParamInvalid.Wrapf("invalid coin denom: %s", submissionFeeCoin.Denom) + return ErrProofParamInvalid.Wrapf("invalid proof_submission_fee denom: %s", submissionFeeCoin.Denom) } if submissionFeeCoin.Amount.LT(MinProofSubmissionFee.Amount) { return ErrProofParamInvalid.Wrapf( - "ProofSubmissionFee param is below minimum value %s: got %s", + "proof_submission_fee is below minimum value %s: got %s", MinProofSubmissionFee, submissionFeeCoin, ) From 931ae1599fb3b7fc353c476d74e6f3ba67708973 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 15 Oct 2024 00:03:23 +0200 Subject: [PATCH 12/13] [Service] Refresh service module params logic (#861) ## Summary The "adding_params.md" doc has (or will have) changed substantially (see #839) since the shared module's param logic was last updated. This PR aligns the service module's param logic with the snippets in the updated docs. Specifically, this refresh includes: - Moving validation logic from `msgServer#UpdateParam()` to `MsgUpdateParam#ValidateBasic()`. - Replacing magic strings of param names with their standard variable counterparts (i.e. `prooftypes.Param...`). - Improving some local variable names. - Replacing usages of `interface{}` with `any`. - Improving validation for all coin type params to be consistent with application, gateway, and supplier coin type validation. ## Dependencies - #809 - #843 - #844 - #845 - #847 - #848 - #849 - #850 - #857 - #852 - #851 ## Issue - #612 ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [x] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [ ] I have tested my changes using the available tooling - [ ] I have commented my code - [ ] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- x/service/keeper/msg_server_update_param.go | 46 ++++++++++----- .../keeper/msg_server_update_param_test.go | 2 +- x/service/keeper/msg_update_params_test.go | 4 +- x/service/keeper/params_test.go | 34 ++++++++++- x/service/types/errors.go | 3 - x/service/types/genesis_test.go | 2 +- x/service/types/message_update_param.go | 25 ++++---- x/service/types/message_update_param_test.go | 57 +++++++++++++++++++ x/service/types/params.go | 23 ++++---- 9 files changed, 149 insertions(+), 47 deletions(-) create mode 100644 x/service/types/message_update_param_test.go diff --git a/x/service/keeper/msg_server_update_param.go b/x/service/keeper/msg_server_update_param.go index d2d224dba..ac1ea6a6c 100644 --- a/x/service/keeper/msg_server_update_param.go +++ b/x/service/keeper/msg_server_update_param.go @@ -3,6 +3,9 @@ package keeper import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pokt-network/poktroll/x/service/types" ) @@ -12,38 +15,51 @@ func (k msgServer) UpdateParam( ctx context.Context, msg *types.MsgUpdateParam, ) (*types.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, types.ErrServiceInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + types.ErrServiceInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) switch msg.Name { case types.ParamAddServiceFee: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrServiceParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - addServiceFee := value.AsCoin - - if err := types.ValidateAddServiceFee(addServiceFee); err != nil { - return nil, err - } - - params.AddServiceFee = addServiceFee + logger = logger.With("param_value", msg.GetAsCoin()) + params.AddServiceFee = msg.GetAsCoin() default: - return nil, types.ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + types.ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) + } + + // Perform a global validation on all params, which includes the updated param. + // This is needed to ensure that the updated param is valid in the context of all other params. + if err := params.ValidateBasic(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + logger.Info("ERROR: %s", err) + return nil, status.Error(codes.Internal, err.Error()) } updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ Params: &updatedParams, }, nil diff --git a/x/service/keeper/msg_server_update_param_test.go b/x/service/keeper/msg_server_update_param_test.go index 74c038d20..67c2eb979 100644 --- a/x/service/keeper/msg_server_update_param_test.go +++ b/x/service/keeper/msg_server_update_param_test.go @@ -14,7 +14,7 @@ import ( servicetypes "github.com/pokt-network/poktroll/x/service/types" ) -func TestMsgUpdateParam_UpdateAddServiceFee(t *testing.T) { +func TestMsgUpdateParam_UpdateAddServiceFeeOnly(t *testing.T) { expectedAddServiceFee := &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(1000000001)} // Set the parameters to their default values diff --git a/x/service/keeper/msg_update_params_test.go b/x/service/keeper/msg_update_params_test.go index e2340e064..e473aab7d 100644 --- a/x/service/keeper/msg_update_params_test.go +++ b/x/service/keeper/msg_update_params_test.go @@ -30,13 +30,13 @@ func TestMsgUpdateParams(t *testing.T) { expectedErrMsg: "invalid authority", }, { - desc: "send empty params", + desc: "invalid: send empty params", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, shouldError: true, - expectedErrMsg: "invalid ServiceFee", + expectedErrMsg: "missing add_service_fee", }, { desc: "valid: send default params", diff --git a/x/service/keeper/params_test.go b/x/service/keeper/params_test.go index 2c7100aef..556f1de0f 100644 --- a/x/service/keeper/params_test.go +++ b/x/service/keeper/params_test.go @@ -6,13 +6,43 @@ import ( "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/service/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" ) func TestGetParams(t *testing.T) { k, ctx := keepertest.ServiceKeeper(t) - params := types.DefaultParams() + params := servicetypes.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) } + +func TestParams_ValidateAddServiceFee(t *testing.T) { + tests := []struct { + desc string + addServiceFee any + expectedErr error + }{ + { + desc: "invalid type", + addServiceFee: "100upokt", + expectedErr: servicetypes.ErrServiceParamInvalid, + }, + { + desc: "valid AddServiceFee", + addServiceFee: &servicetypes.MinAddServiceFee, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := servicetypes.ValidateAddServiceFee(test.addServiceFee) + if test.expectedErr != nil { + require.Error(t, err) + require.Contains(t, err.Error(), test.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/service/types/errors.go b/x/service/types/errors.go index b5e6797b8..1cf4d363d 100644 --- a/x/service/types/errors.go +++ b/x/service/types/errors.go @@ -12,14 +12,11 @@ var ( ErrServiceMissingID = sdkerrors.Register(ModuleName, 1103, "missing service ID") ErrServiceMissingName = sdkerrors.Register(ModuleName, 1104, "missing service name") ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 1105, "service already exists") - ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 1106, "invalid ServiceFee") - ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 1107, "account not found") ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 1108, "not enough funds to add service") ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 1109, "failed to deduct fee") ErrServiceInvalidRelayResponse = sdkerrors.Register(ModuleName, 1110, "invalid relay response") ErrServiceInvalidRelayRequest = sdkerrors.Register(ModuleName, 1111, "invalid relay request") ErrServiceInvalidOwnerAddress = sdkerrors.Register(ModuleName, 1113, "invalid owner address") - ErrServiceParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") ErrServiceParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") ErrServiceMissingRelayMiningDifficulty = sdkerrors.Register(ModuleName, 1116, "missing relay mining difficulty") ) diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go index 66017e75d..0e5961a4b 100644 --- a/x/service/types/genesis_test.go +++ b/x/service/types/genesis_test.go @@ -102,7 +102,7 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc2, }, }, - expectedErr: types.ErrServiceInvalidServiceFee, + expectedErr: types.ErrServiceParamInvalid, }, // this line is used by starport scaffolding # types/genesis/testcase } diff --git a/x/service/types/message_update_param.go b/x/service/types/message_update_param.go index 04c7db8f6..7d3ad2c15 100644 --- a/x/service/types/message_update_param.go +++ b/x/service/types/message_update_param.go @@ -1,8 +1,6 @@ package types import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -10,20 +8,20 @@ var _ sdk.Msg = (*MsgUpdateParam)(nil) // NewMsgUpdateParam creates a new MsgUpdateParam instance for a single // governance parameter update. -func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdateParam, error) { - var valueAsType isMsgUpdateParam_AsType +func NewMsgUpdateParam(authority string, name string, asType any) (*MsgUpdateParam, error) { + var asTypeIface isMsgUpdateParam_AsType - switch v := value.(type) { + switch t := asType.(type) { case *sdk.Coin: - valueAsType = &MsgUpdateParam_AsCoin{AsCoin: v} + asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} default: - return nil, fmt.Errorf("unexpected param value type: %T", value) + return nil, ErrServiceParamInvalid.Wrapf("unexpected param value type: %T", asType) } return &MsgUpdateParam{ Authority: authority, Name: name, - AsType: valueAsType, + AsType: asTypeIface, }, nil } @@ -36,17 +34,20 @@ func (msg *MsgUpdateParam) ValidateBasic() error { return ErrServiceInvalidAddress.Wrapf("invalid authority address %s; (%v)", msg.Authority, err) } - // Parameter value cannot be nil. + // Parameter value MUST NOT be nil. if msg.AsType == nil { return ErrServiceParamInvalid.Wrap("missing param AsType") } - // Parameter name must be supported by this module. + // Parameter name MUST be supported by this module. switch msg.Name { case ParamAddServiceFee: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateAddServiceFee(msg.GetAsCoin()) default: - return ErrServiceParamNameInvalid.Wrapf("unsupported param %q", msg.Name) + return ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name) } } diff --git a/x/service/types/message_update_param_test.go b/x/service/types/message_update_param_test.go new file mode 100644 index 000000000..75a45c41a --- /dev/null +++ b/x/service/types/message_update_param_test.go @@ -0,0 +1,57 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUpdateParam_ValidateBasic(t *testing.T) { + tests := []struct { + name string + desc string + msg MsgUpdateParam + expectedErr error + }{ + { + name: "invalid address", + desc: "invalid: authority address invalid", + msg: MsgUpdateParam{ + Authority: "invalid_address", + Name: "", // Doesn't matter for this test + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + expectedErr: sdkerrors.ErrInvalidAddress, + }, { + desc: "invalid: param name incorrect (non-existent)", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: "non_existent", + AsType: &MsgUpdateParam_AsCoin{AsCoin: &MinAddServiceFee}, + }, + expectedErr: ErrServiceParamInvalid, + }, { + name: "valid address", + desc: "valid: correct address, param name, and type", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: ParamAddServiceFee, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &MinAddServiceFee}, + }, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/service/types/params.go b/x/service/types/params.go index 542eda53f..a454d86f1 100644 --- a/x/service/types/params.go +++ b/x/service/types/params.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/math" cosmostypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/pokt-network/poktroll/app/volatile" ) @@ -55,26 +56,26 @@ func (p Params) ValidateBasic() error { } // validateAddServiceFee validates the AddServiceFee param -func ValidateAddServiceFee(v interface{}) error { - addServiceFeeCoin, ok := v.(*cosmostypes.Coin) +func ValidateAddServiceFee(addServiceFeeAny any) error { + addServiceFee, ok := addServiceFeeAny.(*cosmostypes.Coin) if !ok { - return ErrServiceInvalidServiceFee.Wrapf("invalid parameter type: %T", v) + return ErrServiceParamInvalid.Wrapf("invalid parameter type: %T", addServiceFeeAny) } - if addServiceFeeCoin == nil { - return ErrServiceInvalidServiceFee.Wrap("missing proof_submission_fee") + if addServiceFee == nil { + return ErrServiceParamInvalid.Wrap("missing add_service_fee") } - if addServiceFeeCoin.Denom != volatile.DenomuPOKT { - return ErrServiceInvalidServiceFee.Wrapf("invalid coin denom: %s", addServiceFeeCoin.Denom) + if addServiceFee.Denom != volatile.DenomuPOKT { + return ErrServiceParamInvalid.Wrapf("invalid add_service_fee denom: %s", addServiceFee.Denom) } // TODO_MAINNET: Look into better validation - if addServiceFeeCoin.Amount.LT(MinAddServiceFee.Amount) { - return ErrServiceInvalidServiceFee.Wrapf( - "AddServiceFee param is below minimum value %s: got %s", + if addServiceFee.Amount.LT(MinAddServiceFee.Amount) { + return ErrServiceParamInvalid.Wrapf( + "add_service_fee param is below minimum value %s: got %s", MinAddServiceFee, - addServiceFeeCoin, + addServiceFee, ) } From 3497ff4460ca968d3b67c678340a8361da9b5e1b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 15 Oct 2024 08:51:42 +0200 Subject: [PATCH 13/13] [On-Chain] Refactor `uint64` type individual param update logic (#863) ## Summary In the context of individual param updates (`MsgUpdateParam`), `uint64` typed params were previously supported via an `MsgUpdateParam_AsInt64` type for obsolete reasons. This PR aligns all `uint64` type params with the corresopnding `MsgUpdateParam#AsType`s using a new `MsgUpdateParam_AsUint64` type. ## Issue - #859 ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [ ] Bug fix - [x] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [x] **Unit Tests**: `make go_develop_and_test` - [x] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [ ] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --------- Co-authored-by: Redouane Lakrache Co-authored-by: Daniel Olshansky Co-authored-by: red-0ne --- api/poktroll/application/tx.pulsar.go | 224 +++++------ api/poktroll/proof/tx.pulsar.go | 350 +++++------------- api/poktroll/shared/tx.pulsar.go | 152 ++++---- e2e/tests/parse_params_test.go | 22 +- proto/poktroll/application/tx.proto | 4 +- proto/poktroll/proof/tx.proto | 2 - proto/poktroll/shared/tx.proto | 2 +- testutil/integration/suites/param_configs.go | 10 +- testutil/integration/suites/update_params.go | 2 +- .../keeper/msg_server_update_param.go | 15 +- .../keeper/msg_server_update_param_test.go | 2 +- x/application/types/message_update_param.go | 8 +- x/application/types/tx.pb.go | 153 ++++---- x/proof/types/message_update_param.go | 4 - x/proof/types/message_update_param_test.go | 6 +- x/proof/types/tx.pb.go | 228 +++--------- x/shared/keeper/msg_server_update_param.go | 36 +- .../keeper/msg_server_update_param_test.go | 88 ++--- x/shared/types/message_update_param.go | 49 ++- x/shared/types/message_update_param_test.go | 8 +- x/shared/types/tx.pb.go | 100 ++--- x/tokenomics/types/tx.pb.go | 1 + 22 files changed, 573 insertions(+), 893 deletions(-) diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go index 866f5acf4..d0e0c31e7 100644 --- a/api/poktroll/application/tx.pulsar.go +++ b/api/poktroll/application/tx.pulsar.go @@ -5403,7 +5403,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_int64 protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_uint64 protoreflect.FieldDescriptor fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor ) @@ -5412,7 +5412,7 @@ func init() { md_MsgUpdateParam = File_poktroll_application_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_as_int64 = md_MsgUpdateParam.Fields().ByName("as_int64") + fd_MsgUpdateParam_as_uint64 = md_MsgUpdateParam.Fields().ByName("as_uint64") fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") } @@ -5495,10 +5495,10 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto } if x.AsType != nil { switch o := x.AsType.(type) { - case *MsgUpdateParam_AsInt64: - v := o.AsInt64 - value := protoreflect.ValueOfInt64(v) - if !f(fd_MsgUpdateParam_as_int64, value) { + case *MsgUpdateParam_AsUint64: + v := o.AsUint64 + value := protoreflect.ValueOfUint64(v) + if !f(fd_MsgUpdateParam_as_uint64, value) { return } case *MsgUpdateParam_AsCoin: @@ -5528,10 +5528,10 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.application.MsgUpdateParam.name": return x.Name != "" - case "poktroll.application.MsgUpdateParam.as_int64": + case "poktroll.application.MsgUpdateParam.as_uint64": if x.AsType == nil { return false - } else if _, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { + } else if _, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { return true } else { return false @@ -5564,7 +5564,7 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.application.MsgUpdateParam.name": x.Name = "" - case "poktroll.application.MsgUpdateParam.as_int64": + case "poktroll.application.MsgUpdateParam.as_uint64": x.AsType = nil case "poktroll.application.MsgUpdateParam.as_coin": x.AsType = nil @@ -5590,13 +5590,13 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.application.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.application.MsgUpdateParam.as_int64": + case "poktroll.application.MsgUpdateParam.as_uint64": if x.AsType == nil { - return protoreflect.ValueOfInt64(int64(0)) - } else if v, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { - return protoreflect.ValueOfInt64(v.AsInt64) + return protoreflect.ValueOfUint64(uint64(0)) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { + return protoreflect.ValueOfUint64(v.AsUint64) } else { - return protoreflect.ValueOfInt64(int64(0)) + return protoreflect.ValueOfUint64(uint64(0)) } case "poktroll.application.MsgUpdateParam.as_coin": if x.AsType == nil { @@ -5630,9 +5630,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.application.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.application.MsgUpdateParam.as_int64": - cv := value.Int() - x.AsType = &MsgUpdateParam_AsInt64{AsInt64: cv} + case "poktroll.application.MsgUpdateParam.as_uint64": + cv := value.Uint() + x.AsType = &MsgUpdateParam_AsUint64{AsUint64: cv} case "poktroll.application.MsgUpdateParam.as_coin": cv := value.Message().Interface().(*v1beta1.Coin) x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} @@ -5676,8 +5676,8 @@ func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field authority of message poktroll.application.MsgUpdateParam is not mutable")) case "poktroll.application.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.application.MsgUpdateParam is not mutable")) - case "poktroll.application.MsgUpdateParam.as_int64": - panic(fmt.Errorf("field as_int64 of message poktroll.application.MsgUpdateParam is not mutable")) + case "poktroll.application.MsgUpdateParam.as_uint64": + panic(fmt.Errorf("field as_uint64 of message poktroll.application.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5695,8 +5695,8 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.application.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.application.MsgUpdateParam.as_int64": - return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.application.MsgUpdateParam.as_uint64": + return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.application.MsgUpdateParam.as_coin": value := &v1beta1.Coin{} return protoreflect.ValueOfMessage(value.ProtoReflect()) @@ -5718,8 +5718,8 @@ func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescripto return nil } switch x.AsType.(type) { - case *MsgUpdateParam_AsInt64: - return x.Descriptor().Fields().ByName("as_int64") + case *MsgUpdateParam_AsUint64: + return x.Descriptor().Fields().ByName("as_uint64") case *MsgUpdateParam_AsCoin: return x.Descriptor().Fields().ByName("as_coin") } @@ -5788,11 +5788,11 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsInt64: + case *MsgUpdateParam_AsUint64: if x == nil { break } - n += 1 + runtime.Sov(uint64(x.AsInt64)) + n += 1 + runtime.Sov(uint64(x.AsUint64)) case *MsgUpdateParam_AsCoin: if x == nil { break @@ -5830,8 +5830,8 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsInt64: - i = runtime.EncodeVarint(dAtA, i, uint64(x.AsInt64)) + case *MsgUpdateParam_AsUint64: + i = runtime.EncodeVarint(dAtA, i, uint64(x.AsUint64)) i-- dAtA[i] = 0x18 case *MsgUpdateParam_AsCoin: @@ -5977,9 +5977,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) } - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -5989,12 +5989,12 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - x.AsType = &MsgUpdateParam_AsInt64{v} + x.AsType = &MsgUpdateParam_AsUint64{v} case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) @@ -6970,7 +6970,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to AsType: // - // *MsgUpdateParam_AsInt64 + // *MsgUpdateParam_AsUint64 // *MsgUpdateParam_AsCoin AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } @@ -7016,9 +7016,9 @@ func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { return nil } -func (x *MsgUpdateParam) GetAsInt64() int64 { - if x, ok := x.GetAsType().(*MsgUpdateParam_AsInt64); ok { - return x.AsInt64 +func (x *MsgUpdateParam) GetAsUint64() uint64 { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsUint64); ok { + return x.AsUint64 } return 0 } @@ -7034,15 +7034,15 @@ type isMsgUpdateParam_AsType interface { isMsgUpdateParam_AsType() } -type MsgUpdateParam_AsInt64 struct { - AsInt64 int64 `protobuf:"varint,3,opt,name=as_int64,json=asInt64,proto3,oneof"` +type MsgUpdateParam_AsUint64 struct { + AsUint64 uint64 `protobuf:"varint,3,opt,name=as_uint64,json=asUint64,proto3,oneof"` } type MsgUpdateParam_AsCoin struct { AsCoin *v1beta1.Coin `protobuf:"bytes,4,opt,name=as_coin,json=asCoin,proto3,oneof"` } -func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} @@ -7189,88 +7189,90 @@ var file_poktroll_application_tx_proto_rawDesc = []byte{ 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0xc9, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0xe7, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, - 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, - 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, - 0x4e, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, - 0xb0, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, - 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, - 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x61, 0x73, 0x5f, 0x75, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, + 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, + 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, + 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4e, 0x0a, + 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, + 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, - 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, - 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, - 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, - 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, + 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x10, 0x53, + 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, + 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, + 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, + 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, + 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, + 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, + 0x6f, 0x6e, 0x12, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, - 0x2a, 0x01, 0x42, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, + 0x42, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7514,7 +7516,7 @@ func file_poktroll_application_tx_proto_init() { } } file_poktroll_application_tx_proto_msgTypes[12].OneofWrappers = []interface{}{ - (*MsgUpdateParam_AsInt64)(nil), + (*MsgUpdateParam_AsUint64)(nil), (*MsgUpdateParam_AsCoin)(nil), } type x struct{} diff --git a/api/poktroll/proof/tx.pulsar.go b/api/poktroll/proof/tx.pulsar.go index 0b815b1ae..3be72003c 100644 --- a/api/poktroll/proof/tx.pulsar.go +++ b/api/poktroll/proof/tx.pulsar.go @@ -880,8 +880,6 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_string protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_int64 protoreflect.FieldDescriptor fd_MsgUpdateParam_as_bytes protoreflect.FieldDescriptor fd_MsgUpdateParam_as_float protoreflect.FieldDescriptor fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor @@ -892,8 +890,6 @@ func init() { md_MsgUpdateParam = File_poktroll_proof_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_as_string = md_MsgUpdateParam.Fields().ByName("as_string") - fd_MsgUpdateParam_as_int64 = md_MsgUpdateParam.Fields().ByName("as_int64") fd_MsgUpdateParam_as_bytes = md_MsgUpdateParam.Fields().ByName("as_bytes") fd_MsgUpdateParam_as_float = md_MsgUpdateParam.Fields().ByName("as_float") fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") @@ -978,18 +974,6 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto } if x.AsType != nil { switch o := x.AsType.(type) { - case *MsgUpdateParam_AsString: - v := o.AsString - value := protoreflect.ValueOfString(v) - if !f(fd_MsgUpdateParam_as_string, value) { - return - } - case *MsgUpdateParam_AsInt64: - v := o.AsInt64 - value := protoreflect.ValueOfInt64(v) - if !f(fd_MsgUpdateParam_as_int64, value) { - return - } case *MsgUpdateParam_AsBytes: v := o.AsBytes value := protoreflect.ValueOfBytes(v) @@ -1029,22 +1013,6 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.proof.MsgUpdateParam.name": return x.Name != "" - case "poktroll.proof.MsgUpdateParam.as_string": - if x.AsType == nil { - return false - } else if _, ok := x.AsType.(*MsgUpdateParam_AsString); ok { - return true - } else { - return false - } - case "poktroll.proof.MsgUpdateParam.as_int64": - if x.AsType == nil { - return false - } else if _, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { - return true - } else { - return false - } case "poktroll.proof.MsgUpdateParam.as_bytes": if x.AsType == nil { return false @@ -1089,10 +1057,6 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.proof.MsgUpdateParam.name": x.Name = "" - case "poktroll.proof.MsgUpdateParam.as_string": - x.AsType = nil - case "poktroll.proof.MsgUpdateParam.as_int64": - x.AsType = nil case "poktroll.proof.MsgUpdateParam.as_bytes": x.AsType = nil case "poktroll.proof.MsgUpdateParam.as_float": @@ -1121,22 +1085,6 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.proof.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.proof.MsgUpdateParam.as_string": - if x.AsType == nil { - return protoreflect.ValueOfString("") - } else if v, ok := x.AsType.(*MsgUpdateParam_AsString); ok { - return protoreflect.ValueOfString(v.AsString) - } else { - return protoreflect.ValueOfString("") - } - case "poktroll.proof.MsgUpdateParam.as_int64": - if x.AsType == nil { - return protoreflect.ValueOfInt64(int64(0)) - } else if v, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { - return protoreflect.ValueOfInt64(v.AsInt64) - } else { - return protoreflect.ValueOfInt64(int64(0)) - } case "poktroll.proof.MsgUpdateParam.as_bytes": if x.AsType == nil { return protoreflect.ValueOfBytes(nil) @@ -1185,12 +1133,6 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.proof.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.proof.MsgUpdateParam.as_string": - cv := value.Interface().(string) - x.AsType = &MsgUpdateParam_AsString{AsString: cv} - case "poktroll.proof.MsgUpdateParam.as_int64": - cv := value.Int() - x.AsType = &MsgUpdateParam_AsInt64{AsInt64: cv} case "poktroll.proof.MsgUpdateParam.as_bytes": cv := value.Bytes() x.AsType = &MsgUpdateParam_AsBytes{AsBytes: cv} @@ -1240,10 +1182,6 @@ func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field authority of message poktroll.proof.MsgUpdateParam is not mutable")) case "poktroll.proof.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.proof.MsgUpdateParam is not mutable")) - case "poktroll.proof.MsgUpdateParam.as_string": - panic(fmt.Errorf("field as_string of message poktroll.proof.MsgUpdateParam is not mutable")) - case "poktroll.proof.MsgUpdateParam.as_int64": - panic(fmt.Errorf("field as_int64 of message poktroll.proof.MsgUpdateParam is not mutable")) case "poktroll.proof.MsgUpdateParam.as_bytes": panic(fmt.Errorf("field as_bytes of message poktroll.proof.MsgUpdateParam is not mutable")) case "poktroll.proof.MsgUpdateParam.as_float": @@ -1265,10 +1203,6 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.proof.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.proof.MsgUpdateParam.as_string": - return protoreflect.ValueOfString("") - case "poktroll.proof.MsgUpdateParam.as_int64": - return protoreflect.ValueOfInt64(int64(0)) case "poktroll.proof.MsgUpdateParam.as_bytes": return protoreflect.ValueOfBytes(nil) case "poktroll.proof.MsgUpdateParam.as_float": @@ -1294,10 +1228,6 @@ func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescripto return nil } switch x.AsType.(type) { - case *MsgUpdateParam_AsString: - return x.Descriptor().Fields().ByName("as_string") - case *MsgUpdateParam_AsInt64: - return x.Descriptor().Fields().ByName("as_int64") case *MsgUpdateParam_AsBytes: return x.Descriptor().Fields().ByName("as_bytes") case *MsgUpdateParam_AsFloat: @@ -1370,17 +1300,6 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsString: - if x == nil { - break - } - l = len(x.AsString) - n += 1 + l + runtime.Sov(uint64(l)) - case *MsgUpdateParam_AsInt64: - if x == nil { - break - } - n += 1 + runtime.Sov(uint64(x.AsInt64)) case *MsgUpdateParam_AsBytes: if x == nil { break @@ -1429,16 +1348,6 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsString: - i -= len(x.AsString) - copy(dAtA[i:], x.AsString) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsString))) - i-- - dAtA[i] = 0x1a - case *MsgUpdateParam_AsInt64: - i = runtime.EncodeVarint(dAtA, i, uint64(x.AsInt64)) - i-- - dAtA[i] = 0x30 case *MsgUpdateParam_AsBytes: i -= len(x.AsBytes) copy(dAtA[i:], x.AsBytes) @@ -1591,58 +1500,6 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } x.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsString", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.AsType = &MsgUpdateParam_AsString{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 6: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.AsType = &MsgUpdateParam_AsInt64{v} case 7: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsBytes", wireType) @@ -4293,8 +4150,6 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to AsType: // - // *MsgUpdateParam_AsString - // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes // *MsgUpdateParam_AsFloat // *MsgUpdateParam_AsCoin @@ -4342,20 +4197,6 @@ func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { return nil } -func (x *MsgUpdateParam) GetAsString() string { - if x, ok := x.GetAsType().(*MsgUpdateParam_AsString); ok { - return x.AsString - } - return "" -} - -func (x *MsgUpdateParam) GetAsInt64() int64 { - if x, ok := x.GetAsType().(*MsgUpdateParam_AsInt64); ok { - return x.AsInt64 - } - return 0 -} - func (x *MsgUpdateParam) GetAsBytes() []byte { if x, ok := x.GetAsType().(*MsgUpdateParam_AsBytes); ok { return x.AsBytes @@ -4381,14 +4222,6 @@ type isMsgUpdateParam_AsType interface { isMsgUpdateParam_AsType() } -type MsgUpdateParam_AsString struct { - AsString string `protobuf:"bytes,3,opt,name=as_string,json=asString,proto3,oneof"` -} - -type MsgUpdateParam_AsInt64 struct { - AsInt64 int64 `protobuf:"varint,6,opt,name=as_int64,json=asInt64,proto3,oneof"` -} - type MsgUpdateParam_AsBytes struct { AsBytes []byte `protobuf:"bytes,7,opt,name=as_bytes,json=asBytes,proto3,oneof"` } @@ -4401,10 +4234,6 @@ type MsgUpdateParam_AsCoin struct { AsCoin *v1beta1.Coin `protobuf:"bytes,9,opt,name=as_coin,json=asCoin,proto3,oneof"` } -func (*MsgUpdateParam_AsString) isMsgUpdateParam_AsType() {} - -func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} - func (*MsgUpdateParam_AsBytes) isMsgUpdateParam_AsType() {} func (*MsgUpdateParam_AsFloat) isMsgUpdateParam_AsType() {} @@ -4656,105 +4485,100 @@ var file_poktroll_proof_tx_proto_rawDesc = []byte{ 0x2f, 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0xe9, 0x02, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x6e, 0x73, 0x65, 0x22, 0x90, 0x02, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, - 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x29, 0x0a, 0x08, 0x61, - 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, - 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, - 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, - 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, - 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x46, 0x6c, 0x6f, 0x61, - 0x74, 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, - 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, - 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, - 0x48, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xeb, 0x01, 0x0a, 0x0e, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x54, 0x0a, 0x19, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x17, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, - 0x6f, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, - 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x3a, 0x1e, 0x82, 0xe7, 0xb0, 0x2a, 0x19, 0x73, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x45, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, - 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x22, 0xe4, - 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x12, 0x54, 0x0a, 0x19, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x17, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x3a, 0x1e, 0x82, 0xe7, 0xb0, 0x2a, 0x19, 0x73, 0x75, 0x70, 0x70, + 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x29, 0x0a, + 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x02, 0x42, + 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x48, 0x00, 0x52, + 0x07, 0x61, 0x73, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, + 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, + 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, + 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, + 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x48, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x22, 0xeb, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x69, 0x6d, 0x12, 0x54, 0x0a, 0x19, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, + 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x17, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x3a, 0x1e, + 0x82, 0xe7, 0xb0, 0x2a, 0x19, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x45, + 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x05, + 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x22, 0xe4, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, + 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x54, 0x0a, 0x19, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x45, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2b, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, - 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x32, 0xeb, 0x02, 0x0a, - 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, - 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x1e, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, - 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x1a, 0x26, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, - 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, - 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, - 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, - 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1e, 0x2e, 0x70, 0x6f, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x17, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, + 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x3a, 0x1e, 0x82, 0xe7, + 0xb0, 0x2a, 0x19, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x45, 0x0a, 0x16, + 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x05, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x32, 0xeb, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, + 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, + 0x6c, 0x61, 0x69, 0x6d, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, + 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, + 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x26, 0x2e, 0x70, 0x6f, + 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x9b, 0x01, 0xd8, 0xe2, 0x1e, - 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, - 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, + 0x01, 0x42, 0x9b, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, + 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, + 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4914,8 +4738,6 @@ func file_poktroll_proof_tx_proto_init() { } } file_poktroll_proof_tx_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*MsgUpdateParam_AsString)(nil), - (*MsgUpdateParam_AsInt64)(nil), (*MsgUpdateParam_AsBytes)(nil), (*MsgUpdateParam_AsFloat)(nil), (*MsgUpdateParam_AsCoin)(nil), diff --git a/api/poktroll/shared/tx.pulsar.go b/api/poktroll/shared/tx.pulsar.go index 7dba823cd..fe3e70a04 100644 --- a/api/poktroll/shared/tx.pulsar.go +++ b/api/poktroll/shared/tx.pulsar.go @@ -876,7 +876,7 @@ var ( fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor fd_MsgUpdateParam_as_string protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_int64 protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_uint64 protoreflect.FieldDescriptor fd_MsgUpdateParam_as_bytes protoreflect.FieldDescriptor ) @@ -886,7 +886,7 @@ func init() { fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") fd_MsgUpdateParam_as_string = md_MsgUpdateParam.Fields().ByName("as_string") - fd_MsgUpdateParam_as_int64 = md_MsgUpdateParam.Fields().ByName("as_int64") + fd_MsgUpdateParam_as_uint64 = md_MsgUpdateParam.Fields().ByName("as_uint64") fd_MsgUpdateParam_as_bytes = md_MsgUpdateParam.Fields().ByName("as_bytes") } @@ -975,10 +975,10 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto if !f(fd_MsgUpdateParam_as_string, value) { return } - case *MsgUpdateParam_AsInt64: - v := o.AsInt64 - value := protoreflect.ValueOfInt64(v) - if !f(fd_MsgUpdateParam_as_int64, value) { + case *MsgUpdateParam_AsUint64: + v := o.AsUint64 + value := protoreflect.ValueOfUint64(v) + if !f(fd_MsgUpdateParam_as_uint64, value) { return } case *MsgUpdateParam_AsBytes: @@ -1016,10 +1016,10 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo } else { return false } - case "poktroll.shared.MsgUpdateParam.as_int64": + case "poktroll.shared.MsgUpdateParam.as_uint64": if x.AsType == nil { return false - } else if _, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { + } else if _, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { return true } else { return false @@ -1054,7 +1054,7 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Name = "" case "poktroll.shared.MsgUpdateParam.as_string": x.AsType = nil - case "poktroll.shared.MsgUpdateParam.as_int64": + case "poktroll.shared.MsgUpdateParam.as_uint64": x.AsType = nil case "poktroll.shared.MsgUpdateParam.as_bytes": x.AsType = nil @@ -1088,13 +1088,13 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip } else { return protoreflect.ValueOfString("") } - case "poktroll.shared.MsgUpdateParam.as_int64": + case "poktroll.shared.MsgUpdateParam.as_uint64": if x.AsType == nil { - return protoreflect.ValueOfInt64(int64(0)) - } else if v, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { - return protoreflect.ValueOfInt64(v.AsInt64) + return protoreflect.ValueOfUint64(uint64(0)) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { + return protoreflect.ValueOfUint64(v.AsUint64) } else { - return protoreflect.ValueOfInt64(int64(0)) + return protoreflect.ValueOfUint64(uint64(0)) } case "poktroll.shared.MsgUpdateParam.as_bytes": if x.AsType == nil { @@ -1131,9 +1131,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val case "poktroll.shared.MsgUpdateParam.as_string": cv := value.Interface().(string) x.AsType = &MsgUpdateParam_AsString{AsString: cv} - case "poktroll.shared.MsgUpdateParam.as_int64": - cv := value.Int() - x.AsType = &MsgUpdateParam_AsInt64{AsInt64: cv} + case "poktroll.shared.MsgUpdateParam.as_uint64": + cv := value.Uint() + x.AsType = &MsgUpdateParam_AsUint64{AsUint64: cv} case "poktroll.shared.MsgUpdateParam.as_bytes": cv := value.Bytes() x.AsType = &MsgUpdateParam_AsBytes{AsBytes: cv} @@ -1163,8 +1163,8 @@ func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field name of message poktroll.shared.MsgUpdateParam is not mutable")) case "poktroll.shared.MsgUpdateParam.as_string": panic(fmt.Errorf("field as_string of message poktroll.shared.MsgUpdateParam is not mutable")) - case "poktroll.shared.MsgUpdateParam.as_int64": - panic(fmt.Errorf("field as_int64 of message poktroll.shared.MsgUpdateParam is not mutable")) + case "poktroll.shared.MsgUpdateParam.as_uint64": + panic(fmt.Errorf("field as_uint64 of message poktroll.shared.MsgUpdateParam is not mutable")) case "poktroll.shared.MsgUpdateParam.as_bytes": panic(fmt.Errorf("field as_bytes of message poktroll.shared.MsgUpdateParam is not mutable")) default: @@ -1186,8 +1186,8 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.shared.MsgUpdateParam.as_string": return protoreflect.ValueOfString("") - case "poktroll.shared.MsgUpdateParam.as_int64": - return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.shared.MsgUpdateParam.as_uint64": + return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.shared.MsgUpdateParam.as_bytes": return protoreflect.ValueOfBytes(nil) default: @@ -1210,8 +1210,8 @@ func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescripto switch x.AsType.(type) { case *MsgUpdateParam_AsString: return x.Descriptor().Fields().ByName("as_string") - case *MsgUpdateParam_AsInt64: - return x.Descriptor().Fields().ByName("as_int64") + case *MsgUpdateParam_AsUint64: + return x.Descriptor().Fields().ByName("as_uint64") case *MsgUpdateParam_AsBytes: return x.Descriptor().Fields().ByName("as_bytes") } @@ -1286,11 +1286,11 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } l = len(x.AsString) n += 1 + l + runtime.Sov(uint64(l)) - case *MsgUpdateParam_AsInt64: + case *MsgUpdateParam_AsUint64: if x == nil { break } - n += 1 + runtime.Sov(uint64(x.AsInt64)) + n += 1 + runtime.Sov(uint64(x.AsUint64)) case *MsgUpdateParam_AsBytes: if x == nil { break @@ -1334,8 +1334,8 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsString))) i-- dAtA[i] = 0x1a - case *MsgUpdateParam_AsInt64: - i = runtime.EncodeVarint(dAtA, i, uint64(x.AsInt64)) + case *MsgUpdateParam_AsUint64: + i = runtime.EncodeVarint(dAtA, i, uint64(x.AsUint64)) i-- dAtA[i] = 0x30 case *MsgUpdateParam_AsBytes: @@ -1506,9 +1506,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 6: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) } - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1518,12 +1518,12 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - x.AsType = &MsgUpdateParam_AsInt64{v} + x.AsType = &MsgUpdateParam_AsUint64{v} case 7: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsBytes", wireType) @@ -2126,7 +2126,7 @@ type MsgUpdateParam struct { // Types that are assignable to AsType: // // *MsgUpdateParam_AsString - // *MsgUpdateParam_AsInt64 + // *MsgUpdateParam_AsUint64 // *MsgUpdateParam_AsBytes AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } @@ -2179,9 +2179,9 @@ func (x *MsgUpdateParam) GetAsString() string { return "" } -func (x *MsgUpdateParam) GetAsInt64() int64 { - if x, ok := x.GetAsType().(*MsgUpdateParam_AsInt64); ok { - return x.AsInt64 +func (x *MsgUpdateParam) GetAsUint64() uint64 { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsUint64); ok { + return x.AsUint64 } return 0 } @@ -2201,8 +2201,8 @@ type MsgUpdateParam_AsString struct { AsString string `protobuf:"bytes,3,opt,name=as_string,json=asString,proto3,oneof"` } -type MsgUpdateParam_AsInt64 struct { - AsInt64 int64 `protobuf:"varint,6,opt,name=as_int64,json=asInt64,proto3,oneof"` +type MsgUpdateParam_AsUint64 struct { + AsUint64 uint64 `protobuf:"varint,6,opt,name=as_uint64,json=asUint64,proto3,oneof"` } type MsgUpdateParam_AsBytes struct { @@ -2211,7 +2211,7 @@ type MsgUpdateParam_AsBytes struct { func (*MsgUpdateParam_AsString) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} func (*MsgUpdateParam_AsBytes) isMsgUpdateParam_AsType() {} @@ -2279,7 +2279,7 @@ var file_poktroll_shared_tx_proto_rawDesc = []byte{ 0x61, 0x72, 0x65, 0x64, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0xfb, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0xfe, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, @@ -2287,42 +2287,42 @@ var file_poktroll_shared_tx_proto_rawDesc = []byte{ 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x08, - 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, - 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x48, 0x00, 0x52, 0x07, - 0x61, 0x73, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, - 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x42, 0x79, 0x74, - 0x65, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x49, 0x0a, - 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xc1, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x5a, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, - 0x65, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, - 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x0b, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1f, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x27, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa1, 0x01, 0xd8, - 0xe2, 0x1e, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, - 0x68, 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, - 0x02, 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x09, + 0x61, 0x73, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x42, + 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x61, 0x73, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x48, 0x00, + 0x52, 0x08, 0x61, 0x73, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, + 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, 0xde, + 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x22, 0x49, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xc1, 0x01, 0x0a, 0x03, + 0x4d, 0x73, 0x67, 0x12, 0x5a, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x57, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1f, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, + 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, + 0xa1, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, + 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, + 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2417,7 +2417,7 @@ func file_poktroll_shared_tx_proto_init() { } file_poktroll_shared_tx_proto_msgTypes[2].OneofWrappers = []interface{}{ (*MsgUpdateParam_AsString)(nil), - (*MsgUpdateParam_AsInt64)(nil), + (*MsgUpdateParam_AsUint64)(nil), (*MsgUpdateParam_AsBytes)(nil), } type x struct{} diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index ea447957b..f8a213eaa 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -290,22 +290,6 @@ func (s *suite) newTokenomicsMsgUpdateParam(authority string, param paramAny) (m func (s *suite) newProofMsgUpdateParam(authority string, param paramAny) (msg proto.Message) { switch param.typeStr { - case "string": - msg = proto.Message(&prooftypes.MsgUpdateParam{ - Authority: authority, - Name: param.name, - AsType: &prooftypes.MsgUpdateParam_AsString{ - AsString: param.value.(string), - }, - }) - case "int64": - msg = proto.Message(&prooftypes.MsgUpdateParam{ - Authority: authority, - Name: param.name, - AsType: &prooftypes.MsgUpdateParam_AsInt64{ - AsInt64: param.value.(int64), - }, - }) case "bytes": msg = proto.Message(&prooftypes.MsgUpdateParam{ Authority: authority, @@ -347,12 +331,12 @@ func (s *suite) newSharedMsgUpdateParam(authority string, param paramAny) (msg p AsString: param.value.(string), }, }) - case "int64": + case "uint64": msg = proto.Message(&sharedtypes.MsgUpdateParam{ Authority: authority, Name: param.name, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{ - AsInt64: param.value.(int64), + AsType: &sharedtypes.MsgUpdateParam_AsUint64{ + AsUint64: param.value.(uint64), }, }) case "bytes": diff --git a/proto/poktroll/application/tx.proto b/proto/poktroll/application/tx.proto index 229f03808..9fc236bf8 100644 --- a/proto/poktroll/application/tx.proto +++ b/proto/poktroll/application/tx.proto @@ -107,8 +107,8 @@ message MsgUpdateParam { string name = 2; oneof asType { - int64 as_int64 = 3; - cosmos.base.v1beta1.Coin as_coin = 4; + uint64 as_uint64 = 3 [(gogoproto.jsontag) = "as_uint64"]; + cosmos.base.v1beta1.Coin as_coin = 4 [(gogoproto.jsontag) = "as_coin"]; }; } diff --git a/proto/poktroll/proof/tx.proto b/proto/poktroll/proof/tx.proto index 4264f0daa..139e87042 100644 --- a/proto/poktroll/proof/tx.proto +++ b/proto/poktroll/proof/tx.proto @@ -59,8 +59,6 @@ message MsgUpdateParam { // specified in the `Params`` message in `proof/params.proto.` string name = 2; oneof as_type { - string as_string = 3 [(gogoproto.jsontag) = "as_string"]; - int64 as_int64 = 6 [(gogoproto.jsontag) = "as_int64"]; bytes as_bytes = 7 [(gogoproto.jsontag) = "as_bytes"]; float as_float = 8 [(gogoproto.jsontag) = "as_float"]; cosmos.base.v1beta1.Coin as_coin = 9 [(gogoproto.jsontag) = "as_coin"]; diff --git a/proto/poktroll/shared/tx.proto b/proto/poktroll/shared/tx.proto index c4097c461..86f52a7f5 100644 --- a/proto/poktroll/shared/tx.proto +++ b/proto/poktroll/shared/tx.proto @@ -48,7 +48,7 @@ message MsgUpdateParam { string name = 2; oneof as_type { string as_string = 3 [(gogoproto.jsontag) = "as_string"]; - int64 as_int64 = 6 [(gogoproto.jsontag) = "as_int64"]; + uint64 as_uint64 = 6 [(gogoproto.jsontag) = "as_uint64"]; bytes as_bytes = 7 [(gogoproto.jsontag) = "as_bytes"]; } } diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 1c1a9ac4f..3f11ac943 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -81,9 +81,7 @@ var ( QueryParamsResponse: sharedtypes.QueryParamsResponse{}, }, ParamTypes: map[ParamType]any{ - // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. - ParamTypeUint64: sharedtypes.MsgUpdateParam_AsInt64{}, - ParamTypeInt64: sharedtypes.MsgUpdateParam_AsInt64{}, + ParamTypeUint64: sharedtypes.MsgUpdateParam_AsUint64{}, ParamTypeString: sharedtypes.MsgUpdateParam_AsString{}, ParamTypeBytes: sharedtypes.MsgUpdateParam_AsBytes{}, }, @@ -147,8 +145,7 @@ var ( MinStake: &ValidActorMinStake, }, ParamTypes: map[ParamType]any{ - // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. - ParamTypeUint64: apptypes.MsgUpdateParam_AsInt64{}, + ParamTypeUint64: apptypes.MsgUpdateParam_AsUint64{}, ParamTypeCoin: apptypes.MsgUpdateParam_AsCoin{}, }, DefaultParams: apptypes.DefaultParams(), @@ -209,9 +206,6 @@ var ( ProofSubmissionFee: &ValidProofSubmissionFeeCoin, }, ParamTypes: map[ParamType]any{ - ParamTypeUint64: prooftypes.MsgUpdateParam_AsInt64{}, - ParamTypeInt64: prooftypes.MsgUpdateParam_AsInt64{}, - ParamTypeString: prooftypes.MsgUpdateParam_AsString{}, ParamTypeBytes: prooftypes.MsgUpdateParam_AsBytes{}, ParamTypeFloat32: prooftypes.MsgUpdateParam_AsFloat{}, ParamTypeCoin: prooftypes.MsgUpdateParam_AsCoin{}, diff --git a/testutil/integration/suites/update_params.go b/testutil/integration/suites/update_params.go index f7db56aeb..7da33f997 100644 --- a/testutil/integration/suites/update_params.go +++ b/testutil/integration/suites/update_params.go @@ -245,7 +245,7 @@ func (s *ParamsSuite) RunUpdateParamAsSigner( switch paramType { case ParamTypeUint64: // NB: MsgUpdateParam doesn't currently support uint64 param type. - msgAsTypeValue.Elem().FieldByName("AsInt64").SetInt(int64(paramReflectValue.Interface().(uint64))) + msgAsTypeValue.Elem().FieldByName("AsUint64").Set(paramReflectValue) case ParamTypeInt64: msgAsTypeValue.Elem().FieldByName("AsInt64").Set(paramReflectValue) case ParamTypeFloat32: diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go index 1968b774f..a06925e75 100644 --- a/x/application/keeper/msg_server_update_param.go +++ b/x/application/keeper/msg_server_update_param.go @@ -33,10 +33,19 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam params := k.GetParams(ctx) switch msg.Name { - // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. case apptypes.ParamMaxDelegatedGateways: - logger = logger.With("param_value", msg.GetAsInt64()) - params.MaxDelegatedGateways = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + + params.MaxDelegatedGateways = msg.GetAsUint64() + if _, ok := msg.AsType.(*apptypes.MsgUpdateParam_AsUint64); !ok { + return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + maxDelegatedGateways := msg.GetAsUint64() + + if err := apptypes.ValidateMaxDelegatedGateways(maxDelegatedGateways); err != nil { + return nil, apptypes.ErrAppParamInvalid.Wrapf("maxdelegegated_gateways (%d): %v", maxDelegatedGateways, err) + } + params.MaxDelegatedGateways = maxDelegatedGateways case apptypes.ParamMinStake: logger = logger.With("param_value", msg.GetAsCoin()) params.MinStake = msg.GetAsCoin() diff --git a/x/application/keeper/msg_server_update_param_test.go b/x/application/keeper/msg_server_update_param_test.go index 8f8b5ab03..9076569f3 100644 --- a/x/application/keeper/msg_server_update_param_test.go +++ b/x/application/keeper/msg_server_update_param_test.go @@ -28,7 +28,7 @@ func TestMsgUpdateParam_UpdateMaxDelegatedGatewaysOnly(t *testing.T) { updateParamMsg := &apptypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: apptypes.ParamMaxDelegatedGateways, - AsType: &apptypes.MsgUpdateParam_AsInt64{AsInt64: int64(expectedMaxDelegatedGateways)}, + AsType: &apptypes.MsgUpdateParam_AsUint64{AsUint64: expectedMaxDelegatedGateways}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) diff --git a/x/application/types/message_update_param.go b/x/application/types/message_update_param.go index 2f71cdac0..ed66a4ee4 100644 --- a/x/application/types/message_update_param.go +++ b/x/application/types/message_update_param.go @@ -15,7 +15,7 @@ func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdatePara switch t := asType.(type) { case uint64: - asTypeIface = &MsgUpdateParam_AsInt64{AsInt64: int64(t)} + asTypeIface = &MsgUpdateParam_AsUint64{AsUint64: t} case *cosmostypes.Coin: asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} default: @@ -46,7 +46,7 @@ func (msg *MsgUpdateParam) ValidateBasic() error { if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateMaxDelegatedGateways(uint64(msg.GetAsInt64())) + return ValidateMaxDelegatedGateways(msg.GetAsUint64()) case ParamMinStake: if err := msg.paramTypeIsCoin(); err != nil { return err @@ -58,10 +58,10 @@ func (msg *MsgUpdateParam) ValidateBasic() error { } func (msg *MsgUpdateParam) paramTypeIsUint64() error { - if _, ok := msg.AsType.(*MsgUpdateParam_AsInt64); !ok { + if _, ok := msg.AsType.(*MsgUpdateParam_AsUint64); !ok { return ErrAppParamInvalid.Wrapf(""+ "invalid type for param %q; expected %T, got %T", - msg.Name, &MsgUpdateParam_AsInt64{}, msg.AsType, + msg.Name, &MsgUpdateParam_AsUint64{}, msg.AsType, ) } return nil diff --git a/x/application/types/tx.pb.go b/x/application/types/tx.pb.go index 557ef57a4..99df3c002 100644 --- a/x/application/types/tx.pb.go +++ b/x/application/types/tx.pb.go @@ -549,7 +549,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: // - // *MsgUpdateParam_AsInt64 + // *MsgUpdateParam_AsUint64 // *MsgUpdateParam_AsCoin AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } @@ -589,15 +589,15 @@ type isMsgUpdateParam_AsType interface { Size() int } -type MsgUpdateParam_AsInt64 struct { - AsInt64 int64 `protobuf:"varint,3,opt,name=as_int64,json=asInt64,proto3,oneof" json:"as_int64,omitempty"` +type MsgUpdateParam_AsUint64 struct { + AsUint64 uint64 `protobuf:"varint,3,opt,name=as_uint64,json=asUint64,proto3,oneof" json:"as_uint64"` } type MsgUpdateParam_AsCoin struct { - AsCoin *types.Coin `protobuf:"bytes,4,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin,omitempty"` + AsCoin *types.Coin `protobuf:"bytes,4,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` } -func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if m != nil { @@ -620,9 +620,9 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsInt64() int64 { - if x, ok := m.GetAsType().(*MsgUpdateParam_AsInt64); ok { - return x.AsInt64 +func (m *MsgUpdateParam) GetAsUint64() uint64 { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsUint64); ok { + return x.AsUint64 } return 0 } @@ -637,7 +637,7 @@ func (m *MsgUpdateParam) GetAsCoin() *types.Coin { // XXX_OneofWrappers is for the internal use of the proto package. func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*MsgUpdateParam_AsInt64)(nil), + (*MsgUpdateParam_AsUint64)(nil), (*MsgUpdateParam_AsCoin)(nil), } } @@ -702,63 +702,64 @@ func init() { func init() { proto.RegisterFile("poktroll/application/tx.proto", fileDescriptor_bed224e38ab1cc6d) } var fileDescriptor_bed224e38ab1cc6d = []byte{ - // 888 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xbf, 0x6f, 0xdb, 0x46, - 0x14, 0xd6, 0x45, 0x89, 0x6c, 0x3f, 0xa5, 0x4e, 0x42, 0x29, 0x0d, 0xcd, 0x24, 0x8c, 0x42, 0xb4, - 0x85, 0xa2, 0xc6, 0x24, 0xa4, 0x08, 0x06, 0xa2, 0xc5, 0xb0, 0xdc, 0x1f, 0xc9, 0xa0, 0xa2, 0xa0, - 0xdd, 0xa5, 0x8b, 0x70, 0x92, 0x2e, 0x34, 0x61, 0x89, 0x47, 0xf0, 0xce, 0x4a, 0x34, 0xb5, 0xe8, - 0xd8, 0xa9, 0x7f, 0x45, 0x51, 0x74, 0xd2, 0xd0, 0xa5, 0x7f, 0x40, 0x81, 0x74, 0x6a, 0xd0, 0x29, - 0x53, 0x51, 0xc8, 0x83, 0xff, 0x8d, 0x82, 0x3f, 0x45, 0x51, 0x54, 0x45, 0x17, 0x19, 0xba, 0xd8, - 0xe4, 0xdd, 0xf7, 0xde, 0xfb, 0xbe, 0xef, 0x51, 0xef, 0x0e, 0xee, 0xdb, 0xf4, 0x94, 0x3b, 0x74, - 0x38, 0xd4, 0xb0, 0x6d, 0x0f, 0xcd, 0x3e, 0xe6, 0x26, 0xb5, 0x34, 0xfe, 0x4a, 0xb5, 0x1d, 0xca, - 0xa9, 0x50, 0x0e, 0xb7, 0xd5, 0xd8, 0xb6, 0x74, 0x0b, 0x8f, 0x4c, 0x8b, 0x6a, 0xde, 0x5f, 0x1f, - 0x28, 0xed, 0xf4, 0x29, 0x1b, 0x51, 0xd6, 0xf5, 0xde, 0x34, 0xff, 0x25, 0xd8, 0x92, 0xfd, 0x37, - 0xad, 0x87, 0x19, 0xd1, 0xc6, 0xf5, 0x1e, 0xe1, 0xb8, 0xae, 0xf5, 0xa9, 0x69, 0x05, 0xfb, 0x77, - 0x82, 0xfd, 0x11, 0x33, 0xb4, 0x71, 0xdd, 0xfd, 0x17, 0x6c, 0x94, 0x0d, 0x6a, 0x50, 0x3f, 0xa1, - 0xfb, 0x14, 0xac, 0x56, 0xd2, 0x19, 0x4f, 0x6c, 0x12, 0x16, 0x7c, 0x98, 0x8a, 0xb0, 0xb1, 0x83, - 0x47, 0x21, 0x64, 0x2e, 0x9b, 0x9d, 0x60, 0x87, 0x0c, 0x34, 0x46, 0x9c, 0xb1, 0xd9, 0x27, 0xfe, - 0xb6, 0xf2, 0x1b, 0x82, 0x1b, 0x1d, 0x66, 0x7c, 0x65, 0x0f, 0x30, 0x27, 0x5f, 0x7a, 0x81, 0xc2, - 0x1e, 0x6c, 0xe1, 0x33, 0x7e, 0x42, 0x1d, 0x93, 0x4f, 0x44, 0x54, 0x41, 0xd5, 0xad, 0xb6, 0xf8, - 0xe7, 0x2f, 0xbb, 0xe5, 0x40, 0xeb, 0xc1, 0x60, 0xe0, 0x10, 0xc6, 0x8e, 0xb8, 0x63, 0x5a, 0x86, - 0x3e, 0x87, 0x0a, 0xfb, 0x50, 0xf0, 0x4b, 0x8b, 0x57, 0x2a, 0xa8, 0x5a, 0x6c, 0xdc, 0x53, 0xd3, - 0x3c, 0x55, 0xfd, 0x2a, 0xed, 0xad, 0xd7, 0x7f, 0x3d, 0xc8, 0xfd, 0x74, 0x31, 0xad, 0x21, 0x3d, - 0x08, 0x6b, 0x3d, 0xfd, 0xee, 0x62, 0x5a, 0x9b, 0x27, 0xfc, 0xfe, 0x62, 0x5a, 0xfb, 0x28, 0xa2, - 0xff, 0x6a, 0x41, 0x63, 0x82, 0xb3, 0xb2, 0x03, 0x77, 0x12, 0x4b, 0x3a, 0x61, 0x36, 0xb5, 0x18, - 0x51, 0xfe, 0x40, 0x50, 0xea, 0x30, 0xe3, 0x88, 0xe3, 0x53, 0x72, 0x30, 0x4f, 0x21, 0x34, 0x60, - 0x03, 0xfb, 0x52, 0xd6, 0x8a, 0x0c, 0x81, 0x82, 0x06, 0xd7, 0x98, 0x9b, 0x27, 0x50, 0xb8, 0xa3, - 0x06, 0x70, 0xb7, 0xe3, 0x6a, 0xd0, 0x71, 0xf5, 0x90, 0x9a, 0x96, 0xee, 0xe3, 0x84, 0x4f, 0x61, - 0x33, 0x30, 0x9c, 0x89, 0xf9, 0x4a, 0xbe, 0x5a, 0x6c, 0x3c, 0x9a, 0xbb, 0xe2, 0x77, 0x44, 0x8d, - 0x91, 0x3a, 0xf2, 0xb1, 0x87, 0xd4, 0x7a, 0x61, 0x1a, 0x7a, 0x14, 0xda, 0xba, 0xee, 0x3a, 0x13, - 0xb2, 0x50, 0x7a, 0x70, 0x37, 0x45, 0x50, 0x28, 0x58, 0x38, 0x84, 0x62, 0xcc, 0x2a, 0x4f, 0x5c, - 0xb1, 0xf1, 0x30, 0xbd, 0x19, 0xf1, 0xf8, 0x78, 0x94, 0xb2, 0x0f, 0xb7, 0x5d, 0x43, 0x2d, 0x96, - 0xb4, 0x4d, 0x4c, 0xd8, 0x16, 0x99, 0x93, 0x20, 0xf9, 0x00, 0xee, 0xa7, 0x26, 0x88, 0xfa, 0xf2, - 0x23, 0x82, 0x72, 0x87, 0x19, 0x9f, 0x90, 0x21, 0x31, 0x30, 0x27, 0xc7, 0xf4, 0x73, 0xcc, 0xc9, - 0x4b, 0x3c, 0x11, 0x9e, 0x7a, 0xfc, 0xbb, 0x59, 0x9b, 0x03, 0xd8, 0xb6, 0x83, 0x15, 0xe1, 0x00, - 0x6e, 0x18, 0x7e, 0x96, 0x28, 0xfc, 0xca, 0x9a, 0xf0, 0xed, 0x20, 0x20, 0x58, 0x6d, 0xdd, 0x74, - 0x55, 0xc4, 0x09, 0x28, 0x7d, 0xb8, 0x97, 0xc6, 0xf3, 0xdd, 0xfa, 0xfd, 0x33, 0x02, 0xd1, 0xf3, - 0x6b, 0x10, 0xd4, 0xf9, 0xcc, 0xa1, 0xa3, 0xff, 0xab, 0x23, 0x0a, 0x54, 0x56, 0x71, 0x8d, 0xda, - 0xfb, 0x2b, 0x82, 0xf7, 0x3b, 0xcc, 0x38, 0x76, 0xb0, 0xc5, 0x5e, 0x10, 0x27, 0xfe, 0x09, 0xed, - 0xc3, 0x36, 0xa3, 0x67, 0x4e, 0x9f, 0x64, 0x56, 0xf4, 0x9e, 0x8f, 0x0f, 0x45, 0x3d, 0x87, 0xd2, - 0x80, 0x30, 0x6e, 0x5a, 0x5e, 0xbe, 0xcc, 0xc2, 0x84, 0x58, 0x50, 0x28, 0xae, 0xe4, 0x8a, 0x4b, - 0xd0, 0x51, 0x08, 0xc8, 0xe9, 0xd4, 0xdf, 0x6d, 0xcf, 0x7f, 0x47, 0xb0, 0xbd, 0x38, 0xb5, 0xfe, - 0xf3, 0xec, 0x15, 0xe0, 0xaa, 0x85, 0x47, 0xfe, 0x5c, 0xda, 0xd2, 0xbd, 0x67, 0xe1, 0x2e, 0x6c, - 0x62, 0xd6, 0x35, 0x2d, 0xbe, 0xd7, 0x14, 0xf3, 0x15, 0x54, 0xcd, 0x3f, 0xcb, 0xe9, 0x1b, 0x98, - 0x3d, 0x77, 0x17, 0x84, 0x26, 0x6c, 0x60, 0xd6, 0x75, 0x0f, 0x27, 0xf1, 0xea, 0x9a, 0x59, 0xf6, - 0x2c, 0xa7, 0x17, 0x30, 0x73, 0x9f, 0x5a, 0xdb, 0x8b, 0x13, 0xba, 0xbd, 0x09, 0x05, 0xcc, 0x8e, - 0x27, 0x36, 0x51, 0xbe, 0xf0, 0xba, 0x1d, 0x93, 0x12, 0x59, 0xd5, 0x8c, 0x8e, 0x05, 0xb4, 0xfe, - 0x58, 0x08, 0xcf, 0x82, 0xc6, 0xb4, 0x00, 0xf9, 0x0e, 0x33, 0x84, 0x01, 0x5c, 0x5f, 0x38, 0x9c, - 0x3e, 0x4c, 0x8f, 0x4e, 0x0c, 0x7f, 0x69, 0x37, 0x13, 0x2c, 0xe2, 0x68, 0xc3, 0xcd, 0xa5, 0xf3, - 0xe1, 0xd1, 0xca, 0x14, 0x49, 0xa8, 0x54, 0xcf, 0x0c, 0x8d, 0x2a, 0x8e, 0x41, 0x48, 0x19, 0xae, - 0x1f, 0xaf, 0xa6, 0xbd, 0x04, 0x96, 0x9e, 0x5c, 0x02, 0x1c, 0xd5, 0x65, 0x70, 0x6b, 0x79, 0xe2, - 0xd6, 0x56, 0x66, 0x5a, 0xc2, 0x4a, 0x8d, 0xec, 0xd8, 0xa8, 0xe8, 0x37, 0x70, 0x3b, 0x7d, 0xb0, - 0xa9, 0xff, 0x22, 0x21, 0x05, 0x2f, 0xed, 0x5d, 0x0e, 0x1f, 0x11, 0x98, 0x40, 0x29, 0x6d, 0x10, - 0x3d, 0x5e, 0x99, 0x2e, 0x05, 0x2d, 0x35, 0x2f, 0x83, 0x8e, 0x4a, 0x63, 0x28, 0xc6, 0x7f, 0xe0, - 0x1f, 0x64, 0xf9, 0x30, 0xa5, 0xc7, 0x59, 0x50, 0x61, 0x09, 0xe9, 0xda, 0xb7, 0xee, 0x35, 0xaa, - 0xad, 0xbf, 0x9e, 0xc9, 0xe8, 0xcd, 0x4c, 0x46, 0x6f, 0x67, 0x32, 0xfa, 0x7b, 0x26, 0xa3, 0x1f, - 0xce, 0xe5, 0xdc, 0x9b, 0x73, 0x39, 0xf7, 0xf6, 0x5c, 0xce, 0x7d, 0xdd, 0x34, 0x4c, 0x7e, 0x72, - 0xd6, 0x53, 0xfb, 0x74, 0xa4, 0xb9, 0xc9, 0x77, 0x2d, 0xc2, 0x5f, 0x52, 0xe7, 0x54, 0x5b, 0x71, - 0xc3, 0xf2, 0xee, 0x99, 0xbd, 0x82, 0x77, 0x4d, 0x7c, 0xf2, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x3f, 0xdc, 0xac, 0x04, 0x3e, 0x0b, 0x00, 0x00, + // 903 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x3f, 0x6f, 0xdb, 0x56, + 0x10, 0xd7, 0x8b, 0x1d, 0xc5, 0x3a, 0x25, 0x4e, 0x42, 0x3b, 0x0d, 0xcd, 0x26, 0xb4, 0x42, 0xb4, + 0x85, 0xe3, 0xda, 0x24, 0xac, 0x08, 0x06, 0xa2, 0xc5, 0x90, 0xdc, 0x3f, 0xe9, 0xa0, 0xa2, 0xa0, + 0x9d, 0xa5, 0x8b, 0xf0, 0x24, 0xbd, 0xd0, 0x84, 0x25, 0x3e, 0x82, 0xef, 0x49, 0x89, 0xa6, 0x16, + 0x1d, 0x3b, 0xf5, 0x53, 0x14, 0x45, 0x27, 0x0d, 0x5d, 0xfa, 0x01, 0x0a, 0x64, 0x6b, 0xd0, 0x29, + 0x93, 0x51, 0xc8, 0x83, 0x80, 0x7c, 0x8a, 0x82, 0x7f, 0x45, 0x51, 0x54, 0x45, 0x17, 0x19, 0xba, + 0xd8, 0xe4, 0xbb, 0xdf, 0xdd, 0xfd, 0x7e, 0x77, 0xd4, 0xdd, 0x83, 0x87, 0x36, 0x3d, 0xe7, 0x0e, + 0xed, 0x76, 0x35, 0x6c, 0xdb, 0x5d, 0xb3, 0x8d, 0xb9, 0x49, 0x2d, 0x8d, 0xbf, 0x52, 0x6d, 0x87, + 0x72, 0x2a, 0x6c, 0x86, 0x66, 0x35, 0x66, 0x96, 0xee, 0xe2, 0x9e, 0x69, 0x51, 0xcd, 0xfb, 0xeb, + 0x03, 0xa5, 0xad, 0x36, 0x65, 0x3d, 0xca, 0x9a, 0xde, 0x9b, 0xe6, 0xbf, 0x04, 0x26, 0xd9, 0x7f, + 0xd3, 0x5a, 0x98, 0x11, 0x6d, 0x70, 0xd0, 0x22, 0x1c, 0x1f, 0x68, 0x6d, 0x6a, 0x5a, 0x81, 0xfd, + 0x7e, 0x60, 0xef, 0x31, 0x43, 0x1b, 0x1c, 0xb8, 0xff, 0x02, 0xc3, 0xa6, 0x41, 0x0d, 0xea, 0x07, + 0x74, 0x9f, 0x82, 0xd3, 0x52, 0x3a, 0xe3, 0xa1, 0x4d, 0xc2, 0x84, 0x8f, 0x52, 0x11, 0x36, 0x76, + 0x70, 0x2f, 0x84, 0x4c, 0x65, 0xb3, 0x33, 0xec, 0x90, 0x8e, 0xc6, 0x88, 0x33, 0x30, 0xdb, 0xc4, + 0x37, 0x2b, 0x7f, 0x20, 0xb8, 0xdd, 0x60, 0xc6, 0x73, 0xbb, 0x83, 0x39, 0xf9, 0xc6, 0x73, 0x14, + 0x0e, 0xa1, 0x80, 0xfb, 0xfc, 0x8c, 0x3a, 0x26, 0x1f, 0x8a, 0xa8, 0x84, 0x76, 0x0a, 0x75, 0xf1, + 0xaf, 0xdf, 0xf6, 0x37, 0x03, 0xad, 0xb5, 0x4e, 0xc7, 0x21, 0x8c, 0x9d, 0x70, 0xc7, 0xb4, 0x0c, + 0x7d, 0x0a, 0x15, 0x8e, 0x20, 0xef, 0xa7, 0x16, 0xaf, 0x95, 0xd0, 0x4e, 0xb1, 0xfc, 0x40, 0x4d, + 0xab, 0xa9, 0xea, 0x67, 0xa9, 0x17, 0x5e, 0x5f, 0x6c, 0xe7, 0x7e, 0x99, 0x8c, 0x76, 0x91, 0x1e, + 0xb8, 0x55, 0x9f, 0xfe, 0x30, 0x19, 0xed, 0x4e, 0x03, 0xfe, 0x38, 0x19, 0xed, 0x7e, 0x12, 0xd1, + 0x7f, 0x35, 0xa3, 0x31, 0xc1, 0x59, 0xd9, 0x82, 0xfb, 0x89, 0x23, 0x9d, 0x30, 0x9b, 0x5a, 0x8c, + 0x28, 0x7f, 0x22, 0xd8, 0x68, 0x30, 0xe3, 0x84, 0xe3, 0x73, 0x52, 0x9b, 0x86, 0x10, 0xca, 0x70, + 0x03, 0xfb, 0x52, 0x96, 0x8a, 0x0c, 0x81, 0x82, 0x06, 0xd7, 0x99, 0x1b, 0x27, 0x50, 0xb8, 0xa5, + 0x06, 0x70, 0xb7, 0xe3, 0x6a, 0xd0, 0x71, 0xf5, 0x98, 0x9a, 0x96, 0xee, 0xe3, 0x84, 0xcf, 0x61, + 0x2d, 0x28, 0x38, 0x13, 0x57, 0x4a, 0x2b, 0x3b, 0xc5, 0xf2, 0xe3, 0x69, 0x55, 0xfc, 0x8e, 0xa8, + 0x31, 0x52, 0x27, 0x3e, 0xf6, 0x98, 0x5a, 0x2f, 0x4c, 0x43, 0x8f, 0x5c, 0xab, 0x37, 0xdd, 0xca, + 0x84, 0x2c, 0x94, 0x16, 0x7c, 0x98, 0x22, 0x28, 0x14, 0x2c, 0x1c, 0x43, 0x31, 0x56, 0x2a, 0x4f, + 0x5c, 0xb1, 0xfc, 0x28, 0xbd, 0x19, 0x71, 0xff, 0xb8, 0x97, 0x72, 0x04, 0xf7, 0xdc, 0x82, 0x5a, + 0x2c, 0x59, 0x36, 0x31, 0x51, 0xb6, 0xa8, 0x38, 0x09, 0x92, 0xdb, 0xf0, 0x30, 0x35, 0x40, 0xd4, + 0x97, 0x9f, 0x11, 0x6c, 0x36, 0x98, 0xf1, 0x19, 0xe9, 0x12, 0x03, 0x73, 0x72, 0x4a, 0xbf, 0xc4, + 0x9c, 0xbc, 0xc4, 0x43, 0xe1, 0xa9, 0xc7, 0xbf, 0x99, 0xb5, 0x39, 0x80, 0x6d, 0x3b, 0x38, 0x11, + 0x6a, 0x70, 0xdb, 0xf0, 0xa3, 0x44, 0xee, 0xd7, 0x96, 0xb8, 0xaf, 0x07, 0x0e, 0xc1, 0x69, 0xf5, + 0x8e, 0xab, 0x22, 0x4e, 0x40, 0x69, 0xc3, 0x83, 0x34, 0x9e, 0xef, 0xb7, 0xde, 0xbf, 0x22, 0x10, + 0xbd, 0x7a, 0x75, 0x82, 0x3c, 0x5f, 0x38, 0xb4, 0xf7, 0x7f, 0xad, 0x88, 0x02, 0xa5, 0x45, 0x5c, + 0xa3, 0xf6, 0xfe, 0x8e, 0xe0, 0x83, 0x06, 0x33, 0x4e, 0x1d, 0x6c, 0xb1, 0x17, 0xc4, 0x89, 0x7f, + 0x42, 0x47, 0xb0, 0xce, 0x68, 0xdf, 0x69, 0x93, 0xcc, 0x8a, 0x6e, 0xf9, 0xf8, 0x50, 0xd4, 0x57, + 0xb0, 0xd1, 0x21, 0x8c, 0x9b, 0x96, 0x17, 0x2f, 0xb3, 0x30, 0x21, 0xe6, 0x14, 0x8a, 0xdb, 0x70, + 0xc5, 0x25, 0xe8, 0x28, 0x04, 0xe4, 0x74, 0xea, 0xef, 0xb7, 0xe7, 0x13, 0x04, 0xeb, 0xb3, 0x53, + 0xeb, 0x3f, 0xcf, 0x5e, 0x01, 0x56, 0x2d, 0xdc, 0xf3, 0xe7, 0x52, 0x41, 0xf7, 0x9e, 0x85, 0x3d, + 0x28, 0x60, 0xd6, 0xec, 0x9b, 0x16, 0x3f, 0xac, 0x88, 0x2b, 0x25, 0xb4, 0xb3, 0x5a, 0xbf, 0xf5, + 0xee, 0x62, 0x7b, 0x7a, 0xf8, 0x2c, 0xa7, 0xaf, 0x61, 0xf6, 0xdc, 0x7b, 0x16, 0x6a, 0x70, 0x03, + 0xb3, 0xa6, 0xbb, 0xad, 0xc4, 0xd5, 0x25, 0xc3, 0xad, 0x5e, 0x7c, 0x77, 0xb1, 0x1d, 0xa2, 0x9f, + 0xe5, 0xf4, 0x3c, 0x66, 0xee, 0x71, 0x75, 0x7d, 0x76, 0x7e, 0xd7, 0xd7, 0x20, 0x8f, 0xd9, 0xe9, + 0xd0, 0x26, 0xca, 0xd7, 0xde, 0xb7, 0x10, 0x13, 0x1a, 0x15, 0xb2, 0x12, 0x2d, 0x0d, 0xb4, 0x7c, + 0x69, 0x84, 0x9b, 0xa2, 0x3c, 0xca, 0xc3, 0x4a, 0x83, 0x19, 0x42, 0x07, 0x6e, 0xce, 0xac, 0xae, + 0x8f, 0xd3, 0xbd, 0x13, 0xab, 0x41, 0xda, 0xcf, 0x04, 0x8b, 0x38, 0xda, 0x70, 0x67, 0x6e, 0x7b, + 0x3c, 0x5e, 0x18, 0x22, 0x09, 0x95, 0x0e, 0x32, 0x43, 0xa3, 0x8c, 0x03, 0x10, 0x52, 0x46, 0xef, + 0xa7, 0x8b, 0x69, 0xcf, 0x81, 0xa5, 0x27, 0x57, 0x00, 0x47, 0x79, 0x19, 0xdc, 0x9d, 0x9f, 0xc7, + 0xbb, 0x0b, 0x23, 0xcd, 0x61, 0xa5, 0x72, 0x76, 0x6c, 0x94, 0xf4, 0x3b, 0xb8, 0x97, 0x3e, 0xf6, + 0xd4, 0x7f, 0x91, 0x90, 0x82, 0x97, 0x0e, 0xaf, 0x86, 0x8f, 0x08, 0x0c, 0x61, 0x23, 0x6d, 0x4c, + 0xed, 0x2d, 0x0c, 0x97, 0x82, 0x96, 0x2a, 0x57, 0x41, 0x47, 0xa9, 0x31, 0x14, 0xe3, 0x3f, 0xff, + 0x8f, 0xb2, 0x7c, 0x98, 0xd2, 0x5e, 0x16, 0x54, 0x98, 0x42, 0xba, 0xfe, 0xbd, 0x7b, 0xc9, 0xaa, + 0xeb, 0xaf, 0xc7, 0x32, 0x7a, 0x33, 0x96, 0xd1, 0xdb, 0xb1, 0x8c, 0xfe, 0x1e, 0xcb, 0xe8, 0xa7, + 0x4b, 0x39, 0xf7, 0xe6, 0x52, 0xce, 0xbd, 0xbd, 0x94, 0x73, 0xdf, 0x56, 0x0c, 0x93, 0x9f, 0xf5, + 0x5b, 0x6a, 0x9b, 0xf6, 0x34, 0x37, 0xf8, 0xbe, 0x45, 0xf8, 0x4b, 0xea, 0x9c, 0x6b, 0x0b, 0xee, + 0x5f, 0xde, 0x2d, 0xb4, 0x95, 0xf7, 0x2e, 0x91, 0x4f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x1d, + 0x19, 0xb2, 0x0c, 0x5c, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1518,14 +1519,14 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParam_AsInt64) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsUint64) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParam_AsInt64) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsUint64) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - i = encodeVarintTx(dAtA, i, uint64(m.AsInt64)) + i = encodeVarintTx(dAtA, i, uint64(m.AsUint64)) i-- dAtA[i] = 0x18 return len(dAtA) - i, nil @@ -1785,13 +1786,13 @@ func (m *MsgUpdateParam) Size() (n int) { return n } -func (m *MsgUpdateParam_AsInt64) Size() (n int) { +func (m *MsgUpdateParam_AsUint64) Size() (n int) { if m == nil { return 0 } var l int _ = l - n += 1 + sovTx(uint64(m.AsInt64)) + n += 1 + sovTx(uint64(m.AsUint64)) return n } func (m *MsgUpdateParam_AsCoin) Size() (n int) { @@ -3019,9 +3020,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) } - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3031,12 +3032,12 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.AsType = &MsgUpdateParam_AsInt64{v} + m.AsType = &MsgUpdateParam_AsUint64{v} case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) diff --git a/x/proof/types/message_update_param.go b/x/proof/types/message_update_param.go index ad7142bef..67b897699 100644 --- a/x/proof/types/message_update_param.go +++ b/x/proof/types/message_update_param.go @@ -14,10 +14,6 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara var valueAsType isMsgUpdateParam_AsType switch v := value.(type) { - case string: - valueAsType = &MsgUpdateParam_AsString{AsString: v} - case int64: - valueAsType = &MsgUpdateParam_AsInt64{AsInt64: v} case []byte: valueAsType = &MsgUpdateParam_AsBytes{AsBytes: v} case *sdk.Coin: diff --git a/x/proof/types/message_update_param_test.go b/x/proof/types/message_update_param_test.go index 470e95498..ac88a4ffb 100644 --- a/x/proof/types/message_update_param_test.go +++ b/x/proof/types/message_update_param_test.go @@ -20,7 +20,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: "invalid_address", Name: "", // Doesn't matter for this test - AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + AsType: &MsgUpdateParam_AsFloat{AsFloat: 0}, }, expectedErr: ErrProofInvalidAddress, @@ -29,7 +29,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: "non_existent", - AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + AsType: &MsgUpdateParam_AsFloat{AsFloat: 0}, }, expectedErr: ErrProofParamNameInvalid, @@ -38,7 +38,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: ParamProofMissingPenalty, - AsType: &MsgUpdateParam_AsString{AsString: "invalid"}, + AsType: &MsgUpdateParam_AsFloat{AsFloat: 0}, }, expectedErr: ErrProofParamInvalid, }, { diff --git a/x/proof/types/tx.pb.go b/x/proof/types/tx.pb.go index 8d5376a58..61d576174 100644 --- a/x/proof/types/tx.pb.go +++ b/x/proof/types/tx.pb.go @@ -129,8 +129,6 @@ type MsgUpdateParam struct { // specified in the `Params`` message in `proof/params.proto.` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: - // *MsgUpdateParam_AsString - // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes // *MsgUpdateParam_AsFloat // *MsgUpdateParam_AsCoin @@ -172,12 +170,6 @@ type isMsgUpdateParam_AsType interface { Size() int } -type MsgUpdateParam_AsString struct { - AsString string `protobuf:"bytes,3,opt,name=as_string,json=asString,proto3,oneof" json:"as_string"` -} -type MsgUpdateParam_AsInt64 struct { - AsInt64 int64 `protobuf:"varint,6,opt,name=as_int64,json=asInt64,proto3,oneof" json:"as_int64"` -} type MsgUpdateParam_AsBytes struct { AsBytes []byte `protobuf:"bytes,7,opt,name=as_bytes,json=asBytes,proto3,oneof" json:"as_bytes"` } @@ -188,11 +180,9 @@ type MsgUpdateParam_AsCoin struct { AsCoin *types.Coin `protobuf:"bytes,9,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` } -func (*MsgUpdateParam_AsString) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsBytes) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsFloat) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsBytes) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsFloat) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if m != nil { @@ -215,20 +205,6 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsString() string { - if x, ok := m.GetAsType().(*MsgUpdateParam_AsString); ok { - return x.AsString - } - return "" -} - -func (m *MsgUpdateParam) GetAsInt64() int64 { - if x, ok := m.GetAsType().(*MsgUpdateParam_AsInt64); ok { - return x.AsInt64 - } - return 0 -} - func (m *MsgUpdateParam) GetAsBytes() []byte { if x, ok := m.GetAsType().(*MsgUpdateParam_AsBytes); ok { return x.AsBytes @@ -253,8 +229,6 @@ func (m *MsgUpdateParam) GetAsCoin() *types.Coin { // XXX_OneofWrappers is for the internal use of the proto package. func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*MsgUpdateParam_AsString)(nil), - (*MsgUpdateParam_AsInt64)(nil), (*MsgUpdateParam_AsBytes)(nil), (*MsgUpdateParam_AsFloat)(nil), (*MsgUpdateParam_AsCoin)(nil), @@ -511,57 +485,54 @@ func init() { func init() { proto.RegisterFile("poktroll/proof/tx.proto", fileDescriptor_345e95e87511f6a6) } var fileDescriptor_345e95e87511f6a6 = []byte{ - // 792 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x4f, 0xdb, 0x48, - 0x14, 0x8e, 0xc3, 0x12, 0xe2, 0x49, 0xc8, 0x6a, 0x2d, 0x96, 0x38, 0x61, 0xd7, 0x89, 0x72, 0xd8, - 0xcd, 0xb2, 0x8b, 0x2d, 0x60, 0x85, 0xb4, 0xdc, 0x08, 0x5a, 0x94, 0x4a, 0x45, 0x45, 0xa6, 0x48, - 0x55, 0x2f, 0xd6, 0x24, 0x19, 0x12, 0x8b, 0xd8, 0x63, 0xcd, 0x4c, 0x28, 0xdc, 0xaa, 0x1e, 0x7b, - 0xea, 0xcf, 0xe8, 0x91, 0x43, 0x2f, 0xfd, 0x07, 0x1c, 0x51, 0x4f, 0x9c, 0xa2, 0x2a, 0x54, 0x42, - 0x85, 0x3f, 0x51, 0x79, 0x66, 0xe2, 0x38, 0x69, 0x80, 0xaa, 0xa7, 0x5e, 0xe2, 0x99, 0xf7, 0x7d, - 0xf3, 0xe5, 0xbd, 0xef, 0x3d, 0x8f, 0x41, 0x3e, 0xc0, 0x47, 0x8c, 0xe0, 0x6e, 0xd7, 0x0a, 0x08, - 0xc6, 0x87, 0x16, 0x3b, 0x31, 0x03, 0x82, 0x19, 0xd6, 0x72, 0x43, 0xc0, 0xe4, 0x40, 0xf1, 0x17, - 0xe8, 0xb9, 0x3e, 0xb6, 0xf8, 0xaf, 0xa0, 0x14, 0x8d, 0x26, 0xa6, 0x1e, 0xa6, 0x56, 0x03, 0x52, - 0x64, 0x1d, 0xaf, 0x36, 0x10, 0x83, 0xab, 0x56, 0x13, 0xbb, 0xbe, 0xc4, 0xf3, 0x12, 0xf7, 0x68, - 0xdb, 0x3a, 0x5e, 0x0d, 0x1f, 0x12, 0x28, 0x08, 0xc0, 0xe1, 0x3b, 0x4b, 0x6c, 0x24, 0xb4, 0xd0, - 0xc6, 0x6d, 0x2c, 0xe2, 0xe1, 0x4a, 0x46, 0x97, 0x26, 0xb2, 0x0c, 0x20, 0x81, 0xde, 0xf0, 0x48, - 0x71, 0xb2, 0x84, 0xd3, 0x00, 0x0d, 0xb1, 0xdf, 0x22, 0x8c, 0x22, 0x4a, 0x5d, 0xec, 0x8f, 0xa1, - 0xbf, 0x8f, 0xd0, 0x0e, 0x24, 0xa8, 0x65, 0x51, 0x44, 0x8e, 0xdd, 0x26, 0x12, 0x70, 0xe5, 0xbd, - 0x02, 0x7e, 0xde, 0xa5, 0xed, 0x83, 0xa0, 0x05, 0x19, 0xda, 0xe3, 0x7f, 0xa9, 0x6d, 0x00, 0x15, - 0xf6, 0x58, 0x07, 0x13, 0x97, 0x9d, 0xea, 0x4a, 0x59, 0xa9, 0xaa, 0x35, 0xfd, 0xc3, 0xbb, 0x95, - 0x05, 0x59, 0xc4, 0x56, 0xab, 0x45, 0x10, 0xa5, 0xfb, 0x8c, 0xb8, 0x7e, 0xdb, 0x1e, 0x51, 0xb5, - 0xff, 0x40, 0x4a, 0x24, 0xad, 0x27, 0xcb, 0x4a, 0x35, 0xb3, 0xb6, 0x68, 0x8e, 0xfb, 0x6b, 0x0a, - 0xfd, 0x9a, 0x7a, 0xde, 0x2f, 0x25, 0xde, 0x5e, 0x9f, 0x2d, 0x2b, 0xb6, 0x3c, 0xb0, 0xb9, 0xfe, - 0xea, 0xfa, 0x6c, 0x79, 0x24, 0xf5, 0xfa, 0xfa, 0x6c, 0xb9, 0x1c, 0x25, 0x7e, 0x22, 0x8b, 0x9e, - 0xc8, 0xb3, 0x52, 0x00, 0xf9, 0x89, 0x90, 0x8d, 0x68, 0x80, 0x7d, 0x8a, 0x2a, 0x9f, 0x93, 0x20, - 0x37, 0x8e, 0x7d, 0x77, 0x55, 0x1a, 0xf8, 0xc9, 0x87, 0x1e, 0xe2, 0x35, 0xa9, 0x36, 0x5f, 0x6b, - 0xff, 0x00, 0x15, 0x52, 0x87, 0x72, 0xae, 0x3e, 0xc3, 0xb5, 0xe6, 0x6f, 0xfa, 0xa5, 0x51, 0xb0, - 0x9e, 0xb0, 0xd3, 0x50, 0x8a, 0x69, 0x7f, 0x81, 0x34, 0xa4, 0x8e, 0xeb, 0xb3, 0x8d, 0x7f, 0xf5, - 0x54, 0x59, 0xa9, 0xce, 0xd4, 0xb2, 0x37, 0xfd, 0x52, 0x14, 0xab, 0x27, 0xec, 0x39, 0x48, 0x1f, - 0x85, 0x4b, 0x49, 0x6d, 0x9c, 0x32, 0x44, 0xf5, 0xb9, 0xb2, 0x52, 0xcd, 0x46, 0x54, 0x1e, 0x13, - 0xd4, 0x5a, 0xb8, 0x94, 0xd4, 0xc3, 0x2e, 0x86, 0x4c, 0x4f, 0x97, 0x95, 0x6a, 0x32, 0xa2, 0xf2, - 0x98, 0xa0, 0xee, 0x84, 0x4b, 0x6d, 0x0b, 0xcc, 0x41, 0xea, 0x84, 0x53, 0xab, 0xab, 0xbc, 0x33, - 0x05, 0x53, 0x56, 0x1d, 0x8e, 0xb5, 0x29, 0xc7, 0xda, 0xdc, 0xc6, 0xae, 0x5f, 0xcb, 0xdc, 0xf4, - 0x4b, 0x43, 0x76, 0x3d, 0x61, 0xa7, 0x20, 0x0d, 0xc3, 0x9b, 0xb9, 0xf1, 0x06, 0xd5, 0x54, 0x2e, - 0x19, 0x0e, 0x5a, 0xa5, 0x0e, 0x16, 0xc7, 0xad, 0x1e, 0x76, 0x41, 0x33, 0xa3, 0x81, 0x50, 0xee, - 0x1b, 0x88, 0xe1, 0x14, 0x54, 0x6e, 0x15, 0xde, 0xb5, 0x6d, 0x82, 0x20, 0x43, 0xdb, 0x5d, 0xe8, - 0x7a, 0xda, 0x53, 0x50, 0xa0, 0xbd, 0x20, 0xe8, 0xba, 0x88, 0x38, 0x38, 0x40, 0x04, 0x32, 0x4c, - 0x1c, 0x28, 0x7a, 0xf5, 0x60, 0x17, 0xf3, 0xc3, 0xa3, 0x4f, 0xe4, 0x49, 0x09, 0x6b, 0x3b, 0x20, - 0x27, 0xdf, 0x15, 0xa7, 0x83, 0x60, 0x0b, 0x11, 0x39, 0xb1, 0xa5, 0x51, 0x82, 0x12, 0x37, 0xf7, - 0xc5, 0xb3, 0xce, 0x69, 0xf6, 0x3c, 0x8d, 0x6f, 0xb5, 0x25, 0xa0, 0x12, 0x8c, 0x99, 0xd3, 0x81, - 0xb4, 0xc3, 0xe7, 0x20, 0x6b, 0xa7, 0xc3, 0x40, 0x1d, 0xd2, 0xce, 0xa6, 0x11, 0x5a, 0x76, 0x77, - 0xf6, 0x95, 0xff, 0xb9, 0x6f, 0xb1, 0x62, 0x23, 0xdf, 0xfe, 0x06, 0xb3, 0xcd, 0x30, 0x20, 0x6d, - 0xfb, 0x75, 0xd2, 0x36, 0xc1, 0x16, 0x9c, 0xca, 0x27, 0x61, 0xda, 0x7e, 0xaf, 0xe1, 0xb9, 0x6c, - 0x2f, 0xc4, 0x7f, 0x70, 0xd3, 0x16, 0xc0, 0x2c, 0x2f, 0x43, 0x1a, 0x26, 0x36, 0xdf, 0xe8, 0x56, - 0xac, 0xca, 0xb8, 0x5b, 0x42, 0xef, 0x0e, 0xb7, 0x04, 0x5b, 0x70, 0xd6, 0x6e, 0x93, 0x60, 0x66, - 0x97, 0xb6, 0xb5, 0x67, 0x20, 0x3b, 0x76, 0xe7, 0x95, 0x26, 0x4f, 0x4d, 0xdc, 0x2c, 0xc5, 0x3f, - 0x1f, 0x20, 0x44, 0xe9, 0x1c, 0x80, 0x4c, 0x7c, 0x80, 0x8d, 0x29, 0xe7, 0x62, 0x78, 0xf1, 0x8f, - 0xfb, 0xf1, 0xb8, 0x6c, 0xbc, 0xc5, 0xd3, 0x64, 0x63, 0xf8, 0x54, 0xd9, 0x69, 0xe6, 0x1d, 0x80, - 0x4c, 0xfc, 0x92, 0x34, 0xee, 0xaf, 0x72, 0xaa, 0xec, 0x94, 0x37, 0xbf, 0x38, 0xfb, 0x32, 0xbc, - 0xde, 0x6b, 0x8f, 0xcf, 0x07, 0x86, 0x72, 0x31, 0x30, 0x94, 0xcb, 0x81, 0xa1, 0x7c, 0x1c, 0x18, - 0xca, 0x9b, 0x2b, 0x23, 0x71, 0x71, 0x65, 0x24, 0x2e, 0xaf, 0x8c, 0xc4, 0x73, 0xb3, 0xed, 0xb2, - 0x4e, 0xaf, 0x61, 0x36, 0xb1, 0x67, 0x85, 0xb2, 0x2b, 0x3e, 0x62, 0x2f, 0x30, 0x39, 0xb2, 0xbe, - 0xba, 0xf9, 0xf9, 0x07, 0xad, 0x91, 0xe2, 0x9f, 0xac, 0xf5, 0x2f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xea, 0x29, 0x29, 0xa7, 0xd0, 0x07, 0x00, 0x00, + // 747 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x4f, 0xdb, 0x4c, + 0x10, 0x8e, 0xc3, 0xcb, 0x47, 0x36, 0xbc, 0x79, 0xf5, 0x5a, 0x94, 0x7c, 0xd0, 0x3a, 0x51, 0x0e, + 0x6d, 0x4a, 0x85, 0x2d, 0x40, 0xaa, 0x54, 0x6e, 0x04, 0x15, 0xe5, 0x50, 0x54, 0x64, 0x8a, 0x54, + 0xf5, 0x12, 0x6d, 0x92, 0x25, 0xb6, 0x88, 0xbd, 0xd6, 0xee, 0x86, 0xc2, 0xad, 0xea, 0xb1, 0x27, + 0x7e, 0x46, 0x8f, 0x1c, 0x7a, 0xe9, 0x3f, 0xe0, 0x88, 0x7a, 0xe2, 0x84, 0xaa, 0x50, 0x09, 0x09, + 0xfe, 0x44, 0xb5, 0x1f, 0x76, 0x1c, 0x37, 0x40, 0xd5, 0x53, 0x2f, 0xf1, 0xee, 0x3c, 0xcf, 0x4c, + 0x66, 0x9e, 0x19, 0x8f, 0x41, 0x3e, 0xc0, 0xfb, 0x8c, 0xe0, 0x5e, 0xcf, 0x0a, 0x08, 0xc6, 0x7b, + 0x16, 0x3b, 0x34, 0x03, 0x82, 0x19, 0xd6, 0x73, 0x21, 0x60, 0x0a, 0xa0, 0xf4, 0x3f, 0xf4, 0x5c, + 0x1f, 0x5b, 0xe2, 0x57, 0x52, 0x4a, 0x46, 0x1b, 0x53, 0x0f, 0x53, 0xab, 0x05, 0x29, 0xb2, 0x0e, + 0x96, 0x5b, 0x88, 0xc1, 0x65, 0xab, 0x8d, 0x5d, 0x5f, 0xe1, 0x79, 0x85, 0x7b, 0xb4, 0x6b, 0x1d, + 0x2c, 0xf3, 0x87, 0x02, 0x8a, 0x12, 0x68, 0x8a, 0x9b, 0x25, 0x2f, 0x0a, 0x9a, 0xeb, 0xe2, 0x2e, + 0x96, 0x76, 0x7e, 0x52, 0xd6, 0x85, 0x44, 0x96, 0x01, 0x24, 0xd0, 0x0b, 0x5d, 0x4a, 0xc9, 0x12, + 0x8e, 0x02, 0x14, 0x62, 0x0f, 0x23, 0x8c, 0x22, 0x4a, 0x5d, 0xec, 0x8f, 0xa0, 0x8f, 0x86, 0xa8, + 0x03, 0x09, 0xea, 0x58, 0x14, 0x91, 0x03, 0xb7, 0x8d, 0x24, 0x5c, 0xfd, 0xaa, 0x81, 0xff, 0xb6, + 0x68, 0x77, 0x37, 0xe8, 0x40, 0x86, 0xb6, 0xc5, 0x5f, 0xea, 0xcf, 0x41, 0x06, 0xf6, 0x99, 0x83, + 0x89, 0xcb, 0x8e, 0x0a, 0x5a, 0x45, 0xab, 0x65, 0xea, 0x85, 0x6f, 0x5f, 0x96, 0xe6, 0x54, 0x11, + 0xeb, 0x9d, 0x0e, 0x41, 0x94, 0xee, 0x30, 0xe2, 0xfa, 0x5d, 0x7b, 0x48, 0xd5, 0x5f, 0x80, 0x29, + 0x99, 0x74, 0x21, 0x5d, 0xd1, 0x6a, 0xd9, 0x95, 0x79, 0x73, 0x54, 0x5f, 0x53, 0xc6, 0xaf, 0x67, + 0x4e, 0x2f, 0xca, 0xa9, 0xcf, 0x57, 0x27, 0x8b, 0x9a, 0xad, 0x1c, 0xd6, 0x56, 0x3f, 0x5e, 0x9d, + 0x2c, 0x0e, 0x43, 0x7d, 0xba, 0x3a, 0x59, 0xac, 0x44, 0x89, 0x1f, 0xaa, 0xa2, 0x13, 0x79, 0x56, + 0x8b, 0x20, 0x9f, 0x30, 0xd9, 0x88, 0x06, 0xd8, 0xa7, 0xa8, 0x7a, 0x9c, 0x06, 0xb9, 0x51, 0xec, + 0x8f, 0xab, 0xd2, 0xc1, 0x3f, 0x3e, 0xf4, 0x90, 0xa8, 0x29, 0x63, 0x8b, 0xb3, 0xfe, 0x14, 0xcc, + 0x40, 0xda, 0x6c, 0x1d, 0x31, 0x44, 0x0b, 0xd3, 0x15, 0xad, 0x36, 0x5b, 0x9f, 0xbd, 0xbe, 0x28, + 0x47, 0xb6, 0x46, 0xca, 0x9e, 0x86, 0xb4, 0xce, 0x8f, 0x8a, 0xba, 0xd7, 0xc3, 0x90, 0x15, 0x66, + 0x2a, 0x5a, 0x2d, 0x1d, 0x51, 0x85, 0x4d, 0x52, 0x37, 0xf9, 0x51, 0x5f, 0x07, 0xd3, 0x90, 0x36, + 0xf9, 0x70, 0x15, 0x32, 0x42, 0xc0, 0xa2, 0xa9, 0x92, 0xe3, 0xd3, 0x67, 0xaa, 0xe9, 0x33, 0x37, + 0xb0, 0xeb, 0xd7, 0xb3, 0xd7, 0x17, 0xe5, 0x90, 0xdd, 0x48, 0xd9, 0x53, 0x90, 0x72, 0xf3, 0x5a, + 0x6e, 0x54, 0xc7, 0x7a, 0x46, 0x84, 0xe4, 0xf3, 0x50, 0x6d, 0x80, 0xf9, 0x51, 0x45, 0x42, 0xb1, + 0x74, 0x33, 0xea, 0x9b, 0x76, 0x57, 0xdf, 0xc2, 0x66, 0x55, 0x6f, 0x34, 0x21, 0xee, 0x06, 0x41, + 0x90, 0xa1, 0x8d, 0x1e, 0x74, 0x3d, 0xfd, 0x0d, 0x28, 0xd2, 0x7e, 0x10, 0xf4, 0x5c, 0x44, 0x9a, + 0x38, 0x40, 0x04, 0x32, 0x4c, 0x9a, 0x50, 0x4a, 0x7a, 0xaf, 0xd8, 0xf9, 0xd0, 0xf5, 0xb5, 0xf2, + 0x54, 0xb0, 0xbe, 0x09, 0x72, 0x6a, 0xa4, 0x9b, 0x0e, 0x82, 0x1d, 0x44, 0xd4, 0x60, 0x95, 0x87, + 0x09, 0x2a, 0xdc, 0xdc, 0x91, 0xcf, 0x86, 0xa0, 0xd9, 0xff, 0xd2, 0xf8, 0x55, 0x5f, 0x00, 0x19, + 0x82, 0x31, 0x6b, 0x3a, 0x90, 0x3a, 0x85, 0x09, 0xde, 0x2f, 0x7b, 0x86, 0x1b, 0x1a, 0x90, 0x3a, + 0x6b, 0x06, 0x97, 0xec, 0xf6, 0xec, 0xab, 0x2f, 0x85, 0x6e, 0xb1, 0x62, 0x23, 0xdd, 0x9e, 0x81, + 0xc9, 0x36, 0x37, 0x28, 0xd9, 0x1e, 0x24, 0x65, 0x93, 0x6c, 0xc9, 0xa9, 0xfe, 0x90, 0xa2, 0xed, + 0xf4, 0x5b, 0x9e, 0xcb, 0xb6, 0x39, 0xfe, 0x97, 0x8b, 0x36, 0x07, 0x26, 0x45, 0x19, 0x4a, 0x30, + 0x79, 0xf9, 0x4d, 0xb5, 0x62, 0x55, 0xc6, 0xd5, 0x92, 0xf1, 0x6e, 0x51, 0x4b, 0xb2, 0x25, 0x67, + 0xe5, 0x26, 0x0d, 0x26, 0xb6, 0x68, 0x57, 0x7f, 0x0b, 0x66, 0x47, 0x56, 0x53, 0x39, 0xe9, 0x95, + 0x58, 0x00, 0xa5, 0x27, 0xf7, 0x10, 0xa2, 0x74, 0x76, 0x41, 0x36, 0x3e, 0xc0, 0xc6, 0x18, 0xbf, + 0x18, 0x5e, 0x7a, 0x7c, 0x37, 0x1e, 0x0f, 0x1b, 0x6f, 0xf1, 0xb8, 0xb0, 0x31, 0x7c, 0x6c, 0xd8, + 0x71, 0xe2, 0xed, 0x82, 0x6c, 0x7c, 0x97, 0x19, 0x77, 0x57, 0x39, 0x36, 0xec, 0x98, 0x37, 0xbf, + 0x34, 0xf9, 0x81, 0x6f, 0xe1, 0xfa, 0xab, 0xd3, 0x81, 0xa1, 0x9d, 0x0d, 0x0c, 0xed, 0x7c, 0x60, + 0x68, 0xdf, 0x07, 0x86, 0x76, 0x7c, 0x69, 0xa4, 0xce, 0x2e, 0x8d, 0xd4, 0xf9, 0xa5, 0x91, 0x7a, + 0x67, 0x76, 0x5d, 0xe6, 0xf4, 0x5b, 0x66, 0x1b, 0x7b, 0x16, 0x0f, 0xbb, 0xe4, 0x23, 0xf6, 0x1e, + 0x93, 0x7d, 0xeb, 0x97, 0x05, 0x2d, 0xbe, 0x3b, 0xad, 0x29, 0xf1, 0x65, 0x59, 0xfd, 0x19, 0x00, + 0x00, 0xff, 0xff, 0x70, 0xd3, 0xcd, 0x4c, 0x77, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -865,32 +836,6 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParam_AsString) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParam_AsString) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.AsString) - copy(dAtA[i:], m.AsString) - i = encodeVarintTx(dAtA, i, uint64(len(m.AsString))) - i-- - dAtA[i] = 0x1a - return len(dAtA) - i, nil -} -func (m *MsgUpdateParam_AsInt64) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParam_AsInt64) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i = encodeVarintTx(dAtA, i, uint64(m.AsInt64)) - i-- - dAtA[i] = 0x30 - return len(dAtA) - i, nil -} func (m *MsgUpdateParam_AsBytes) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -1199,25 +1144,6 @@ func (m *MsgUpdateParam) Size() (n int) { return n } -func (m *MsgUpdateParam_AsString) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.AsString) - n += 1 + l + sovTx(uint64(l)) - return n -} -func (m *MsgUpdateParam_AsInt64) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovTx(uint64(m.AsInt64)) - return n -} func (m *MsgUpdateParam_AsBytes) Size() (n int) { if m == nil { return 0 @@ -1596,58 +1522,6 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AsString", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AsType = &MsgUpdateParam_AsString{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AsType = &MsgUpdateParam_AsInt64{v} case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AsBytes", wireType) diff --git a/x/shared/keeper/msg_server_update_param.go b/x/shared/keeper/msg_server_update_param.go index 099876660..1802360e3 100644 --- a/x/shared/keeper/msg_server_update_param.go +++ b/x/shared/keeper/msg_server_update_param.go @@ -34,32 +34,32 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) ( switch msg.Name { case types.ParamNumBlocksPerSession: - logger = logger.With("param_value", msg.GetAsInt64()) - params.NumBlocksPerSession = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.NumBlocksPerSession = msg.GetAsUint64() case types.ParamGracePeriodEndOffsetBlocks: - logger = logger.With("param_value", msg.GetAsInt64()) - params.GracePeriodEndOffsetBlocks = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.GracePeriodEndOffsetBlocks = msg.GetAsUint64() case types.ParamClaimWindowOpenOffsetBlocks: - logger = logger.With("param_value", msg.GetAsInt64()) - params.ClaimWindowOpenOffsetBlocks = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.ClaimWindowOpenOffsetBlocks = msg.GetAsUint64() case types.ParamClaimWindowCloseOffsetBlocks: - logger = logger.With("param_value", msg.GetAsInt64()) - params.ClaimWindowCloseOffsetBlocks = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.ClaimWindowCloseOffsetBlocks = msg.GetAsUint64() case types.ParamProofWindowOpenOffsetBlocks: - logger = logger.With("param_value", msg.GetAsInt64()) - params.ProofWindowOpenOffsetBlocks = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.ProofWindowOpenOffsetBlocks = msg.GetAsUint64() case types.ParamProofWindowCloseOffsetBlocks: - logger = logger.With("param_value", msg.GetAsInt64()) - params.ProofWindowCloseOffsetBlocks = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.ProofWindowCloseOffsetBlocks = msg.GetAsUint64() case types.ParamSupplierUnbondingPeriodSessions: - logger = logger.With("param_value", msg.GetAsInt64()) - params.SupplierUnbondingPeriodSessions = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.SupplierUnbondingPeriodSessions = msg.GetAsUint64() case types.ParamApplicationUnbondingPeriodSessions: - logger = logger.With("param_value", msg.GetAsInt64()) - params.ApplicationUnbondingPeriodSessions = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.ApplicationUnbondingPeriodSessions = msg.GetAsUint64() case types.ParamComputeUnitsToTokensMultiplier: - logger = logger.With("param_value", msg.GetAsInt64()) - params.ComputeUnitsToTokensMultiplier = uint64(msg.GetAsInt64()) + logger = logger.With("param_value", msg.GetAsUint64()) + params.ComputeUnitsToTokensMultiplier = msg.GetAsUint64() default: return nil, status.Error( codes.InvalidArgument, diff --git a/x/shared/keeper/msg_server_update_param_test.go b/x/shared/keeper/msg_server_update_param_test.go index 3a84810f4..74869bf3a 100644 --- a/x/shared/keeper/msg_server_update_param_test.go +++ b/x/shared/keeper/msg_server_update_param_test.go @@ -29,7 +29,7 @@ var testSharedParams = sharedtypes.Params{ } func TestMsgUpdateParam_UpdateNumBlocksPerSession(t *testing.T) { - var expectedNumBlocksPerSession int64 = 13 + var expectedNumBlocksPerSession uint64 = 13 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -38,25 +38,25 @@ func TestMsgUpdateParam_UpdateNumBlocksPerSession(t *testing.T) { require.NoError(t, k.SetParams(ctx, testSharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedNumBlocksPerSession), testSharedParams.NumBlocksPerSession) + require.NotEqual(t, expectedNumBlocksPerSession, testSharedParams.NumBlocksPerSession) // Update the number of blocks per session updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamNumBlocksPerSession, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedNumBlocksPerSession}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedNumBlocksPerSession}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedNumBlocksPerSession), res.Params.NumBlocksPerSession) + require.Equal(t, expectedNumBlocksPerSession, res.Params.NumBlocksPerSession) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyNumBlocksPerSession)) } func TestMsgUpdateParam_UpdateClaimWindowOpenOffsetBlocks(t *testing.T) { - var expectedClaimWindowOpenOffestBlocks int64 = 4 + var expectedClaimWindowOpenOffestBlocks uint64 = 4 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -68,7 +68,7 @@ func TestMsgUpdateParam_UpdateClaimWindowOpenOffsetBlocks(t *testing.T) { minUnbodningPeriodSessions := getMinActorUnbondingPeriodSessions( &sharedParams, sharedParams.ClaimWindowOpenOffsetBlocks, - uint64(expectedClaimWindowOpenOffestBlocks), + expectedClaimWindowOpenOffestBlocks, ) // Update the SupplierUnbondingPeriodSessions such that it is greater than the @@ -83,25 +83,25 @@ func TestMsgUpdateParam_UpdateClaimWindowOpenOffsetBlocks(t *testing.T) { require.NoError(t, k.SetParams(ctx, sharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedClaimWindowOpenOffestBlocks), sharedParams.ClaimWindowOpenOffsetBlocks) + require.NotEqual(t, expectedClaimWindowOpenOffestBlocks, sharedParams.ClaimWindowOpenOffsetBlocks) // Update the claim window open offset blocks param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamClaimWindowOpenOffsetBlocks, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedClaimWindowOpenOffestBlocks}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedClaimWindowOpenOffestBlocks}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedClaimWindowOpenOffestBlocks), res.Params.ClaimWindowOpenOffsetBlocks) + require.Equal(t, expectedClaimWindowOpenOffestBlocks, res.Params.ClaimWindowOpenOffsetBlocks) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyClaimWindowOpenOffsetBlocks)) } func TestMsgUpdateParam_UpdateClaimWindowCloseOffsetBlocks(t *testing.T) { - var expectedClaimWindowCloseOffestBlocks int64 = 8 + var expectedClaimWindowCloseOffestBlocks uint64 = 8 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -113,7 +113,7 @@ func TestMsgUpdateParam_UpdateClaimWindowCloseOffsetBlocks(t *testing.T) { minUnbodningPeriodSessions := getMinActorUnbondingPeriodSessions( &sharedParams, sharedParams.ClaimWindowOpenOffsetBlocks, - uint64(expectedClaimWindowCloseOffestBlocks), + expectedClaimWindowCloseOffestBlocks, ) // Update the SupplierUnbondingPeriodSessions such that it is greater than the @@ -128,25 +128,25 @@ func TestMsgUpdateParam_UpdateClaimWindowCloseOffsetBlocks(t *testing.T) { require.NoError(t, k.SetParams(ctx, sharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedClaimWindowCloseOffestBlocks), sharedParams.ClaimWindowCloseOffsetBlocks) + require.NotEqual(t, expectedClaimWindowCloseOffestBlocks, sharedParams.ClaimWindowCloseOffsetBlocks) // Update the claim window close offset blocks param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamClaimWindowCloseOffsetBlocks, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedClaimWindowCloseOffestBlocks}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedClaimWindowCloseOffestBlocks}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedClaimWindowCloseOffestBlocks), res.Params.ClaimWindowCloseOffsetBlocks) + require.Equal(t, expectedClaimWindowCloseOffestBlocks, res.Params.ClaimWindowCloseOffsetBlocks) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyClaimWindowCloseOffsetBlocks)) } func TestMsgUpdateParam_UpdateProofWindowOpenOffsetBlocks(t *testing.T) { - var expectedProofWindowOpenOffestBlocks int64 = 8 + var expectedProofWindowOpenOffestBlocks uint64 = 8 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -158,7 +158,7 @@ func TestMsgUpdateParam_UpdateProofWindowOpenOffsetBlocks(t *testing.T) { minUnbodningPeriodSessions := getMinActorUnbondingPeriodSessions( &sharedParams, sharedParams.ClaimWindowOpenOffsetBlocks, - uint64(expectedProofWindowOpenOffestBlocks), + expectedProofWindowOpenOffestBlocks, ) // Update the SupplierUnbondingPeriodSessions such that it is greater than the @@ -173,25 +173,25 @@ func TestMsgUpdateParam_UpdateProofWindowOpenOffsetBlocks(t *testing.T) { require.NoError(t, k.SetParams(ctx, sharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedProofWindowOpenOffestBlocks), sharedParams.ProofWindowOpenOffsetBlocks) + require.NotEqual(t, expectedProofWindowOpenOffestBlocks, sharedParams.ProofWindowOpenOffsetBlocks) // Update the proof window open offset blocks param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamProofWindowOpenOffsetBlocks, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedProofWindowOpenOffestBlocks}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedProofWindowOpenOffestBlocks}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedProofWindowOpenOffestBlocks), res.Params.ProofWindowOpenOffsetBlocks) + require.Equal(t, expectedProofWindowOpenOffestBlocks, res.Params.ProofWindowOpenOffsetBlocks) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyProofWindowOpenOffsetBlocks)) } func TestMsgUpdateParam_UpdateProofWindowCloseOffsetBlocks(t *testing.T) { - var expectedProofWindowCloseOffestBlocks int64 = 8 + var expectedProofWindowCloseOffestBlocks uint64 = 8 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -203,7 +203,7 @@ func TestMsgUpdateParam_UpdateProofWindowCloseOffsetBlocks(t *testing.T) { minUnbodningPeriodSessions := getMinActorUnbondingPeriodSessions( &sharedParams, sharedParams.ClaimWindowOpenOffsetBlocks, - uint64(expectedProofWindowCloseOffestBlocks), + expectedProofWindowCloseOffestBlocks, ) // Update the SupplierUnbondingPeriodSessions such that it is greater than the @@ -218,25 +218,25 @@ func TestMsgUpdateParam_UpdateProofWindowCloseOffsetBlocks(t *testing.T) { require.NoError(t, k.SetParams(ctx, sharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedProofWindowCloseOffestBlocks), sharedParams.ProofWindowCloseOffsetBlocks) + require.NotEqual(t, expectedProofWindowCloseOffestBlocks, sharedParams.ProofWindowCloseOffsetBlocks) // Update the proof window close offset blocks param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamProofWindowCloseOffsetBlocks, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedProofWindowCloseOffestBlocks}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedProofWindowCloseOffestBlocks}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedProofWindowCloseOffestBlocks), res.Params.ProofWindowCloseOffsetBlocks) + require.Equal(t, expectedProofWindowCloseOffestBlocks, res.Params.ProofWindowCloseOffsetBlocks) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyProofWindowCloseOffsetBlocks)) } func TestMsgUpdateParam_UpdateGracePeriodEndOffsetBlocks(t *testing.T) { - var expectedGracePeriodEndOffestBlocks int64 = 2 + var expectedGracePeriodEndOffestBlocks uint64 = 2 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -245,31 +245,31 @@ func TestMsgUpdateParam_UpdateGracePeriodEndOffsetBlocks(t *testing.T) { // Update the claim window open offset blocks which has to be at least equal to // GracePeriodEndOffsetBlocks to pass UpdateParam validation. - sharedParams.ClaimWindowOpenOffsetBlocks = uint64(expectedGracePeriodEndOffestBlocks) + sharedParams.ClaimWindowOpenOffsetBlocks = expectedGracePeriodEndOffestBlocks // Set the parameters to their default values require.NoError(t, k.SetParams(ctx, sharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedGracePeriodEndOffestBlocks), sharedParams.GetGracePeriodEndOffsetBlocks()) + require.NotEqual(t, expectedGracePeriodEndOffestBlocks, sharedParams.GetGracePeriodEndOffsetBlocks()) // Update the proof window close offset blocks param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamGracePeriodEndOffsetBlocks, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedGracePeriodEndOffestBlocks}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedGracePeriodEndOffestBlocks}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedGracePeriodEndOffestBlocks), res.Params.GetGracePeriodEndOffsetBlocks()) + require.Equal(t, expectedGracePeriodEndOffestBlocks, res.Params.GetGracePeriodEndOffsetBlocks()) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyGracePeriodEndOffsetBlocks)) } func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { - var expectedSupplierUnbondingPeriod int64 = 5 + var expectedSupplierUnbondingPeriod uint64 = 5 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -278,18 +278,18 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { require.NoError(t, k.SetParams(ctx, testSharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedSupplierUnbondingPeriod), testSharedParams.GetSupplierUnbondingPeriodSessions()) + require.NotEqual(t, expectedSupplierUnbondingPeriod, testSharedParams.GetSupplierUnbondingPeriodSessions()) // Update the supplier unbonding period param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamSupplierUnbondingPeriodSessions, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedSupplierUnbondingPeriod}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedSupplierUnbondingPeriod}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedSupplierUnbondingPeriod), res.Params.GetSupplierUnbondingPeriodSessions()) + require.Equal(t, expectedSupplierUnbondingPeriod, res.Params.GetSupplierUnbondingPeriodSessions()) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeySupplierUnbondingPeriodSessions)) @@ -299,7 +299,7 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { updateParamMsg = &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamSupplierUnbondingPeriodSessions, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 1}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: 1}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) require.EqualError(t, err, status.Error( @@ -312,7 +312,7 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { } func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { - var expectedApplicationUnbondingPerid int64 = 5 + var expectedApplicationUnbondingPerid uint64 = 5 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -321,18 +321,18 @@ func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { require.NoError(t, k.SetParams(ctx, testSharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedApplicationUnbondingPerid), testSharedParams.GetApplicationUnbondingPeriodSessions()) + require.NotEqual(t, expectedApplicationUnbondingPerid, testSharedParams.GetApplicationUnbondingPeriodSessions()) // Update the application unbonding period param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamApplicationUnbondingPeriodSessions, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedApplicationUnbondingPerid}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedApplicationUnbondingPerid}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedApplicationUnbondingPerid), res.Params.GetApplicationUnbondingPeriodSessions()) + require.Equal(t, expectedApplicationUnbondingPerid, res.Params.GetApplicationUnbondingPeriodSessions()) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyApplicationUnbondingPeriodSessions)) @@ -342,7 +342,7 @@ func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { updateParamMsg = &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamApplicationUnbondingPeriodSessions, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 1}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: 1}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) require.EqualError(t, err, status.Error( @@ -355,7 +355,7 @@ func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { } func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { - var expectedComputeUnitsToTokenMultiplier int64 = 5 + var expectedComputeUnitsToTokenMultiplier uint64 = 5 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -364,18 +364,18 @@ func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { require.NoError(t, k.SetParams(ctx, testSharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedComputeUnitsToTokenMultiplier), testSharedParams.GetComputeUnitsToTokensMultiplier()) + require.NotEqual(t, expectedComputeUnitsToTokenMultiplier, testSharedParams.GetComputeUnitsToTokensMultiplier()) // Update the compute units to token multiplier param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamComputeUnitsToTokensMultiplier, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedComputeUnitsToTokenMultiplier}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: expectedComputeUnitsToTokenMultiplier}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedComputeUnitsToTokenMultiplier), res.Params.GetComputeUnitsToTokensMultiplier()) + require.Equal(t, expectedComputeUnitsToTokenMultiplier, res.Params.GetComputeUnitsToTokensMultiplier()) // Ensure the other parameters are unchanged testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyComputeUnitsToTokensMultiplier)) @@ -384,7 +384,7 @@ func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { updateParamMsg = &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamComputeUnitsToTokensMultiplier, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 0}, + AsType: &sharedtypes.MsgUpdateParam_AsUint64{AsUint64: 0}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) require.EqualError(t, err, status.Error( diff --git a/x/shared/types/message_update_param.go b/x/shared/types/message_update_param.go index d258fc7fa..828379864 100644 --- a/x/shared/types/message_update_param.go +++ b/x/shared/types/message_update_param.go @@ -16,8 +16,8 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara switch v := value.(type) { case string: valueAsType = &MsgUpdateParam_AsString{AsString: v} - case int64: - valueAsType = &MsgUpdateParam_AsInt64{AsInt64: v} + case uint64: + valueAsType = &MsgUpdateParam_AsUint64{AsUint64: v} case []byte: valueAsType = &MsgUpdateParam_AsBytes{AsBytes: v} default: @@ -48,63 +48,62 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { - // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. case ParamNumBlocksPerSession: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateNumBlocksPerSession(uint64(msg.GetAsInt64())) + return ValidateNumBlocksPerSession(msg.GetAsUint64()) case ParamGracePeriodEndOffsetBlocks: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateGracePeriodEndOffsetBlocks(uint64(msg.GetAsInt64())) + return ValidateGracePeriodEndOffsetBlocks(msg.GetAsUint64()) case ParamClaimWindowOpenOffsetBlocks: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateClaimWindowOpenOffsetBlocks(uint64(msg.GetAsInt64())) + return ValidateClaimWindowOpenOffsetBlocks(msg.GetAsUint64()) case ParamClaimWindowCloseOffsetBlocks: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateClaimWindowCloseOffsetBlocks(uint64(msg.GetAsInt64())) + return ValidateClaimWindowCloseOffsetBlocks(msg.GetAsUint64()) case ParamProofWindowOpenOffsetBlocks: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateProofWindowOpenOffsetBlocks(uint64(msg.GetAsInt64())) + return ValidateProofWindowOpenOffsetBlocks(msg.GetAsUint64()) case ParamProofWindowCloseOffsetBlocks: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateProofWindowCloseOffsetBlocks(uint64(msg.GetAsInt64())) + return ValidateProofWindowCloseOffsetBlocks(msg.GetAsUint64()) case ParamSupplierUnbondingPeriodSessions: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateSupplierUnbondingPeriodSessions(uint64(msg.GetAsInt64())) + return ValidateSupplierUnbondingPeriodSessions(msg.GetAsUint64()) case ParamApplicationUnbondingPeriodSessions: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateApplicationUnbondingPeriodSessions(uint64(msg.GetAsInt64())) + return ValidateApplicationUnbondingPeriodSessions(msg.GetAsUint64()) case ParamComputeUnitsToTokensMultiplier: - if err := msg.paramTypeIsInt64(); err != nil { + if err := msg.paramTypeIsUint64(); err != nil { return err } - return ValidateComputeUnitsToTokensMultiplier(uint64(msg.GetAsInt64())) + return ValidateComputeUnitsToTokensMultiplier(msg.GetAsUint64()) default: return ErrSharedParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } } -// paramTypeIsInt64 checks if the parameter type is int64, returning an error if not. -func (msg *MsgUpdateParam) paramTypeIsInt64() error { - if _, ok := msg.AsType.(*MsgUpdateParam_AsInt64); !ok { +// paramTypeIsUint64 checks if the parameter type is int64, returning an error if not. +func (msg *MsgUpdateParam) paramTypeIsUint64() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsUint64); !ok { return ErrSharedParamInvalid.Wrapf( "invalid type for param %q expected %T, got %T", - msg.Name, &MsgUpdateParam_AsInt64{}, + msg.Name, &MsgUpdateParam_AsUint64{}, msg.AsType, ) } diff --git a/x/shared/types/message_update_param_test.go b/x/shared/types/message_update_param_test.go index 1da38b6e0..ff1fa242e 100644 --- a/x/shared/types/message_update_param_test.go +++ b/x/shared/types/message_update_param_test.go @@ -19,7 +19,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: "invalid_address", Name: "", // Doesn't matter for this test - AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + AsType: &MsgUpdateParam_AsUint64{AsUint64: 1}, }, expectedErr: ErrSharedInvalidAddress, }, { @@ -27,7 +27,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: "WRONG_num_blocks_per_session", - AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + AsType: &MsgUpdateParam_AsUint64{AsUint64: 1}, }, expectedErr: ErrSharedParamNameInvalid, }, { @@ -43,14 +43,14 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: ParamNumBlocksPerSession, - AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + AsType: &MsgUpdateParam_AsUint64{AsUint64: 1}, }, }, { desc: "invalid ComputeUnitsToTokensMultiplier", msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: ParamComputeUnitsToTokensMultiplier, - AsType: &MsgUpdateParam_AsInt64{AsInt64: 0}, + AsType: &MsgUpdateParam_AsUint64{AsUint64: 0}, }, expectedErr: ErrSharedParamInvalid, }, diff --git a/x/shared/types/tx.pb.go b/x/shared/types/tx.pb.go index 553ff6736..43f5398f5 100644 --- a/x/shared/types/tx.pb.go +++ b/x/shared/types/tx.pb.go @@ -123,7 +123,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: // *MsgUpdateParam_AsString - // *MsgUpdateParam_AsInt64 + // *MsgUpdateParam_AsUint64 // *MsgUpdateParam_AsBytes AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } @@ -166,15 +166,15 @@ type isMsgUpdateParam_AsType interface { type MsgUpdateParam_AsString struct { AsString string `protobuf:"bytes,3,opt,name=as_string,json=asString,proto3,oneof" json:"as_string"` } -type MsgUpdateParam_AsInt64 struct { - AsInt64 int64 `protobuf:"varint,6,opt,name=as_int64,json=asInt64,proto3,oneof" json:"as_int64"` +type MsgUpdateParam_AsUint64 struct { + AsUint64 uint64 `protobuf:"varint,6,opt,name=as_uint64,json=asUint64,proto3,oneof" json:"as_uint64"` } type MsgUpdateParam_AsBytes struct { AsBytes []byte `protobuf:"bytes,7,opt,name=as_bytes,json=asBytes,proto3,oneof" json:"as_bytes"` } func (*MsgUpdateParam_AsString) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} func (*MsgUpdateParam_AsBytes) isMsgUpdateParam_AsType() {} func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { @@ -205,9 +205,9 @@ func (m *MsgUpdateParam) GetAsString() string { return "" } -func (m *MsgUpdateParam) GetAsInt64() int64 { - if x, ok := m.GetAsType().(*MsgUpdateParam_AsInt64); ok { - return x.AsInt64 +func (m *MsgUpdateParam) GetAsUint64() uint64 { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsUint64); ok { + return x.AsUint64 } return 0 } @@ -223,7 +223,7 @@ func (m *MsgUpdateParam) GetAsBytes() []byte { func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { return []interface{}{ (*MsgUpdateParam_AsString)(nil), - (*MsgUpdateParam_AsInt64)(nil), + (*MsgUpdateParam_AsUint64)(nil), (*MsgUpdateParam_AsBytes)(nil), } } @@ -280,39 +280,39 @@ func init() { func init() { proto.RegisterFile("poktroll/shared/tx.proto", fileDescriptor_3f2a7564b43f4d89) } var fileDescriptor_3f2a7564b43f4d89 = []byte{ - // 501 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xf6, 0x11, 0x48, 0xea, 0x6b, 0x68, 0x85, 0x55, 0x11, 0xd7, 0x42, 0x8e, 0xc9, 0x82, 0x89, - 0xa8, 0x4f, 0x94, 0xaa, 0x43, 0x36, 0x3c, 0xb5, 0x43, 0x24, 0x64, 0x84, 0x90, 0xba, 0x44, 0x97, - 0xc6, 0x72, 0xac, 0xd6, 0x3e, 0xcb, 0xef, 0x0a, 0xcd, 0x86, 0x18, 0x99, 0xf8, 0x33, 0x18, 0x33, - 0xb0, 0x31, 0xb1, 0x75, 0xac, 0x98, 0x3a, 0x45, 0x28, 0x19, 0x22, 0xf5, 0x5f, 0x60, 0x41, 0x3e, - 0xff, 0x08, 0x71, 0x24, 0x22, 0x75, 0x49, 0xde, 0x7d, 0xdf, 0xf7, 0xbe, 0x7b, 0xef, 0xde, 0x33, - 0x56, 0x23, 0x76, 0xc6, 0x63, 0x76, 0x7e, 0x4e, 0x60, 0x48, 0x63, 0x77, 0x40, 0xf8, 0xa5, 0x15, - 0xc5, 0x8c, 0x33, 0x65, 0x3b, 0x67, 0xac, 0x94, 0xd1, 0x1e, 0xd1, 0xc0, 0x0f, 0x19, 0x11, 0xbf, - 0xa9, 0x46, 0x6b, 0x9c, 0x32, 0x08, 0x18, 0x90, 0x00, 0x3c, 0xf2, 0xe1, 0x65, 0xf2, 0x97, 0x11, - 0xbb, 0x29, 0xd1, 0x13, 0x27, 0x92, 0x1e, 0x32, 0x6a, 0xc7, 0x63, 0x1e, 0x4b, 0xf1, 0x24, 0xca, - 0xd0, 0x27, 0xe5, 0x3a, 0x22, 0x1a, 0xd3, 0x20, 0xcb, 0x69, 0xfd, 0x40, 0x78, 0xbb, 0x0b, 0xde, - 0xbb, 0x68, 0x40, 0xb9, 0xfb, 0x46, 0x30, 0xca, 0x21, 0x96, 0xe9, 0x05, 0x1f, 0xb2, 0xd8, 0xe7, - 0x23, 0x15, 0x19, 0xc8, 0x94, 0x6d, 0xf5, 0xd7, 0xf7, 0xbd, 0x9d, 0xec, 0xb2, 0xd7, 0x83, 0x41, - 0xec, 0x02, 0xbc, 0xe5, 0xb1, 0x1f, 0x7a, 0xce, 0x42, 0xaa, 0x74, 0x70, 0x35, 0xf5, 0x56, 0xef, - 0x19, 0xc8, 0xdc, 0xdc, 0x6f, 0x58, 0xa5, 0x46, 0xad, 0xf4, 0x02, 0x5b, 0xbe, 0x9a, 0x34, 0xa5, - 0x6f, 0xf3, 0x71, 0x1b, 0x39, 0x59, 0x46, 0xe7, 0xe0, 0xf3, 0x7c, 0xdc, 0x5e, 0x78, 0x7d, 0x99, - 0x8f, 0xdb, 0x4f, 0x8b, 0xc2, 0x2f, 0xf3, 0xd2, 0x4b, 0x95, 0xb6, 0x76, 0x71, 0xa3, 0x04, 0x39, - 0x2e, 0x44, 0x2c, 0x04, 0xb7, 0xf5, 0x07, 0xe1, 0xad, 0x65, 0xee, 0xce, 0x7d, 0x29, 0xf8, 0x7e, - 0x48, 0x03, 0x57, 0x74, 0x25, 0x3b, 0x22, 0x56, 0x5e, 0x60, 0x99, 0x42, 0x0f, 0x84, 0x56, 0xad, - 0x08, 0xaf, 0x87, 0xb7, 0x93, 0xe6, 0x02, 0x3c, 0x92, 0x9c, 0x0d, 0x9a, 0x99, 0x29, 0xcf, 0xf1, - 0x06, 0x85, 0x9e, 0x1f, 0xf2, 0xc3, 0x03, 0xb5, 0x6a, 0x20, 0xb3, 0x62, 0xd7, 0x6f, 0x27, 0xcd, - 0x02, 0x3b, 0x92, 0x9c, 0x1a, 0x85, 0xe3, 0x24, 0xcc, 0xa4, 0xfd, 0x11, 0x77, 0x41, 0xad, 0x19, - 0xc8, 0xac, 0x17, 0x52, 0x81, 0xa5, 0x52, 0x3b, 0x09, 0x3b, 0x5b, 0xcb, 0x6f, 0x66, 0xcb, 0xb8, - 0x46, 0xa1, 0xc7, 0x47, 0x91, 0xdb, 0x3a, 0xc6, 0x8f, 0x97, 0x9b, 0xcf, 0xdf, 0x45, 0x21, 0xc5, - 0x90, 0xd0, 0x7f, 0x87, 0x94, 0x4f, 0x66, 0xff, 0x27, 0xc2, 0x95, 0x2e, 0x78, 0xca, 0x09, 0xae, - 0x2f, 0x6d, 0x89, 0xb1, 0x92, 0x58, 0x1a, 0x85, 0x66, 0xae, 0x53, 0x14, 0x45, 0xbd, 0xc7, 0x9b, - 0xff, 0x0e, 0xaa, 0xb9, 0x26, 0x51, 0x7b, 0xb6, 0x46, 0x90, 0x1b, 0x6b, 0x0f, 0x3e, 0x25, 0x5b, - 0x66, 0x77, 0xaf, 0xa6, 0x3a, 0xba, 0x9e, 0xea, 0xe8, 0x66, 0xaa, 0xa3, 0xdf, 0x53, 0x1d, 0x7d, - 0x9d, 0xe9, 0xd2, 0xf5, 0x4c, 0x97, 0x6e, 0x66, 0xba, 0x74, 0x42, 0x3c, 0x9f, 0x0f, 0x2f, 0xfa, - 0xd6, 0x29, 0x0b, 0x48, 0xe2, 0xbb, 0x17, 0xba, 0xfc, 0x23, 0x8b, 0xcf, 0xc8, 0xea, 0x02, 0x26, - 0x8f, 0x0b, 0xfd, 0xaa, 0xf8, 0x76, 0x5e, 0xfd, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x90, 0x6c, 0xe9, - 0x9c, 0xe3, 0x03, 0x00, 0x00, + // 502 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xf6, 0xd1, 0x92, 0xd4, 0xd7, 0xd0, 0x0a, 0xab, 0x22, 0xae, 0x85, 0x1c, 0x93, 0x05, 0x13, + 0x51, 0x9f, 0x28, 0x55, 0x87, 0x6c, 0x78, 0x2a, 0x43, 0x24, 0x64, 0x54, 0x21, 0x75, 0x89, 0x2e, + 0xcd, 0xc9, 0xb1, 0x5a, 0xfb, 0x2c, 0xdf, 0x05, 0x9a, 0x0d, 0x31, 0x32, 0xf1, 0x33, 0x18, 0x33, + 0xb0, 0x31, 0xb1, 0x75, 0xac, 0x98, 0x3a, 0x45, 0x28, 0x19, 0x22, 0xf5, 0x47, 0x20, 0xe4, 0x3b, + 0xdb, 0x21, 0x8e, 0x44, 0x24, 0x96, 0xe4, 0xdd, 0xf7, 0x7d, 0xef, 0xbb, 0xf7, 0xee, 0x3d, 0x43, + 0x3d, 0xa6, 0x17, 0x3c, 0xa1, 0x97, 0x97, 0x88, 0x0d, 0x70, 0x42, 0xfa, 0x88, 0x5f, 0x39, 0x71, + 0x42, 0x39, 0xd5, 0x76, 0x73, 0xc6, 0x91, 0x8c, 0xf1, 0x10, 0x87, 0x41, 0x44, 0x91, 0xf8, 0x95, + 0x1a, 0xa3, 0x7e, 0x4e, 0x59, 0x48, 0x19, 0x0a, 0x99, 0x8f, 0xde, 0xbf, 0x48, 0xff, 0x32, 0x62, + 0x5f, 0x12, 0x5d, 0x71, 0x42, 0xf2, 0x90, 0x51, 0x7b, 0x3e, 0xf5, 0xa9, 0xc4, 0xd3, 0x28, 0x43, + 0x1f, 0x97, 0xeb, 0x88, 0x71, 0x82, 0xc3, 0x2c, 0xa7, 0xf9, 0x1d, 0xc0, 0xdd, 0x0e, 0xf3, 0x4f, + 0xe3, 0x3e, 0xe6, 0xe4, 0x8d, 0x60, 0xb4, 0x63, 0xa8, 0xe2, 0x21, 0x1f, 0xd0, 0x24, 0xe0, 0x23, + 0x1d, 0x58, 0xc0, 0x56, 0x5d, 0xfd, 0xe7, 0xb7, 0x83, 0xbd, 0xec, 0xb2, 0x57, 0xfd, 0x7e, 0x42, + 0x18, 0x7b, 0xcb, 0x93, 0x20, 0xf2, 0xbd, 0x85, 0x54, 0x6b, 0xc3, 0x8a, 0xf4, 0xd6, 0xef, 0x59, + 0xc0, 0xde, 0x3e, 0xac, 0x3b, 0xa5, 0x46, 0x1d, 0x79, 0x81, 0xab, 0x5e, 0x4f, 0x1a, 0xca, 0xd7, + 0xf9, 0xb8, 0x05, 0xbc, 0x2c, 0xa3, 0x7d, 0xf4, 0x69, 0x3e, 0x6e, 0x2d, 0xbc, 0x3e, 0xcf, 0xc7, + 0xad, 0x27, 0x45, 0xe1, 0x57, 0x79, 0xe9, 0xa5, 0x4a, 0x9b, 0xfb, 0xb0, 0x5e, 0x82, 0x3c, 0xc2, + 0x62, 0x1a, 0x31, 0xd2, 0xfc, 0x0d, 0xe0, 0xce, 0x32, 0xf7, 0xdf, 0x7d, 0x69, 0x70, 0x33, 0xc2, + 0x21, 0x11, 0x5d, 0xa9, 0x9e, 0x88, 0xb5, 0xe7, 0x50, 0xc5, 0xac, 0xcb, 0x84, 0x56, 0xdf, 0x10, + 0x5e, 0x0f, 0xee, 0x26, 0x8d, 0x05, 0x78, 0xa2, 0x78, 0x5b, 0x38, 0x33, 0xcb, 0xd4, 0xc3, 0x20, + 0xe2, 0xc7, 0x47, 0x7a, 0xc5, 0x02, 0xf6, 0x66, 0xa1, 0x96, 0xa0, 0x54, 0x9f, 0x8a, 0x58, 0x7b, + 0x06, 0xb7, 0x30, 0xeb, 0xf6, 0x46, 0x9c, 0x30, 0xbd, 0x6a, 0x01, 0xbb, 0xe6, 0xd6, 0xee, 0x26, + 0x8d, 0x02, 0x3b, 0x51, 0xbc, 0x2a, 0x66, 0x6e, 0x1a, 0xb6, 0x77, 0x96, 0x9f, 0xcd, 0x55, 0x61, + 0x15, 0xb3, 0x2e, 0x1f, 0xc5, 0xa4, 0xf9, 0x1a, 0x3e, 0x5a, 0xee, 0x3f, 0x7f, 0x1a, 0x0d, 0x15, + 0x73, 0x02, 0xff, 0x9c, 0x53, 0x3e, 0x9c, 0xc3, 0x1f, 0x00, 0x6e, 0x74, 0x98, 0xaf, 0x9d, 0xc1, + 0xda, 0xd2, 0xa2, 0x58, 0x2b, 0x89, 0xa5, 0x69, 0x18, 0xf6, 0x3a, 0x45, 0x51, 0xd4, 0x3b, 0xb8, + 0xfd, 0xf7, 0xac, 0x1a, 0x6b, 0x12, 0x8d, 0xa7, 0x6b, 0x04, 0xb9, 0xb1, 0x71, 0xff, 0x63, 0xba, + 0x68, 0x6e, 0xe7, 0x7a, 0x6a, 0x82, 0x9b, 0xa9, 0x09, 0x6e, 0xa7, 0x26, 0xf8, 0x35, 0x35, 0xc1, + 0x97, 0x99, 0xa9, 0xdc, 0xcc, 0x4c, 0xe5, 0x76, 0x66, 0x2a, 0x67, 0xc8, 0x0f, 0xf8, 0x60, 0xd8, + 0x73, 0xce, 0x69, 0x88, 0x52, 0xdf, 0x83, 0x88, 0xf0, 0x0f, 0x34, 0xb9, 0x40, 0xab, 0x3b, 0x98, + 0x3e, 0x2e, 0xeb, 0x55, 0xc4, 0xe7, 0xf3, 0xf2, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x11, + 0xde, 0xdb, 0xe6, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -558,14 +558,14 @@ func (m *MsgUpdateParam_AsString) MarshalToSizedBuffer(dAtA []byte) (int, error) dAtA[i] = 0x1a return len(dAtA) - i, nil } -func (m *MsgUpdateParam_AsInt64) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsUint64) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParam_AsInt64) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsUint64) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - i = encodeVarintTx(dAtA, i, uint64(m.AsInt64)) + i = encodeVarintTx(dAtA, i, uint64(m.AsUint64)) i-- dAtA[i] = 0x30 return len(dAtA) - i, nil @@ -686,13 +686,13 @@ func (m *MsgUpdateParam_AsString) Size() (n int) { n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgUpdateParam_AsInt64) Size() (n int) { +func (m *MsgUpdateParam_AsUint64) Size() (n int) { if m == nil { return 0 } var l int _ = l - n += 1 + sovTx(uint64(m.AsInt64)) + n += 1 + sovTx(uint64(m.AsUint64)) return n } func (m *MsgUpdateParam_AsBytes) Size() (n int) { @@ -1018,9 +1018,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) } - var v int64 + var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1030,12 +1030,12 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int64(b&0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.AsType = &MsgUpdateParam_AsInt64{v} + m.AsType = &MsgUpdateParam_AsUint64{v} case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AsBytes", wireType) diff --git a/x/tokenomics/types/tx.pb.go b/x/tokenomics/types/tx.pb.go index 9f18a148c..e4fec264c 100644 --- a/x/tokenomics/types/tx.pb.go +++ b/x/tokenomics/types/tx.pb.go @@ -125,6 +125,7 @@ type MsgUpdateParam struct { // specified in the `Params` message in `proof/params.proto.` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: + // // *MsgUpdateParam_AsString // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsBytes