Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Migration Review - DO NOT MERGE] Application module #381

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
966 changes: 966 additions & 0 deletions api/poktroll/application/application.pulsar.go

Large diffs are not rendered by default.

657 changes: 657 additions & 0 deletions api/poktroll/application/event.pulsar.go

Large diffs are not rendered by default.

754 changes: 754 additions & 0 deletions api/poktroll/application/genesis.pulsar.go

Large diffs are not rendered by default.

580 changes: 580 additions & 0 deletions api/poktroll/application/module/module.pulsar.go

Large diffs are not rendered by default.

564 changes: 564 additions & 0 deletions api/poktroll/application/params.pulsar.go

Large diffs are not rendered by default.

3,144 changes: 3,144 additions & 0 deletions api/poktroll/application/query.pulsar.go

Large diffs are not rendered by default.

5,014 changes: 5,014 additions & 0 deletions api/poktroll/application/tx.pulsar.go

Large diffs are not rendered by default.

3,105 changes: 3,105 additions & 0 deletions api/poktroll/shared/service.pulsar.go

Large diffs are not rendered by default.

1,283 changes: 299 additions & 984 deletions app/app.go

Large diffs are not rendered by default.

337 changes: 337 additions & 0 deletions app/app_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,337 @@
package app

import (
"time"

runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1"
authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1"
bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1"
circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1"
consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1"
crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1"
distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1"
evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1"
feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1"
genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1"
govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1"
groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1"
mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1"
paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1"
slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1"
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1"
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/core/appconfig"
_ "cosmossdk.io/x/circuit" // import for side-effects
circuittypes "cosmossdk.io/x/circuit/types"
_ "cosmossdk.io/x/evidence" // import for side-effects
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/feegrant"
_ "cosmossdk.io/x/feegrant/module" // import for side-effects
_ "cosmossdk.io/x/upgrade" // import for side-effects
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/runtime"
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/cosmos/cosmos-sdk/x/authz"
_ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
_ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/group"
_ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
_ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
_ "github.com/cosmos/ibc-go/modules/capability" // import for side-effects
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
_ "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" // import for side-effects
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
_ "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" // import for side-effects
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
applicationmodulev1 "github.com/pokt-network/poktroll/api/poktroll/application/module"
gatewaymodulev1 "github.com/pokt-network/poktroll/api/poktroll/gateway/module"
servicemodulev1 "github.com/pokt-network/poktroll/api/poktroll/service/module"
_ "github.com/pokt-network/poktroll/x/application/module" // import for side-effects
applicationmoduletypes "github.com/pokt-network/poktroll/x/application/types"
_ "github.com/pokt-network/poktroll/x/gateway/module" // import for side-effects
gatewaymoduletypes "github.com/pokt-network/poktroll/x/gateway/types"
_ "github.com/pokt-network/poktroll/x/service/module" // import for side-effects
servicemoduletypes "github.com/pokt-network/poktroll/x/service/types"
"google.golang.org/protobuf/types/known/durationpb"
// this line is used by starport scaffolding # stargate/app/moduleImport
)

var (
// NOTE: The genutils module must occur after staking so that pools are
// properly initialized with tokens from genesis accounts.
// NOTE: The genutils module must also occur after auth so that it can access the params from auth.
// NOTE: Capability module must occur first so that it can initialize any capabilities
// so that other modules that want to create or claim capabilities afterwards in InitChain
// can do so safely.
genesisModuleOrder = []string{
// cosmos-sdk/ibc modules
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
govtypes.ModuleName,
minttypes.ModuleName,
crisistypes.ModuleName,
ibcexported.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
feegrant.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
circuittypes.ModuleName,
group.ModuleName,
consensusparamtypes.ModuleName,
circuittypes.ModuleName,
// chain modules
servicemoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
applicationmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
}

// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.
// NOTE: staking module is required if HistoricalEntries param > 0
// NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC)
beginBlockers = []string{
// cosmos sdk modules
minttypes.ModuleName,
distrtypes.ModuleName,
slashingtypes.ModuleName,
evidencetypes.ModuleName,
stakingtypes.ModuleName,
authz.ModuleName,
genutiltypes.ModuleName,
// ibc modules
capabilitytypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
// chain modules
servicemoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
applicationmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
}

endBlockers = []string{
// cosmos sdk modules
crisistypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
feegrant.ModuleName,
group.ModuleName,
genutiltypes.ModuleName,
// ibc modules
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
capabilitytypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
// chain modules
servicemoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
applicationmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
}

preBlockers = []string{
upgradetypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/preBlockers
}

// module account permissions
moduleAccPerms = []*authmodulev1.ModuleAccountPermission{
{Account: authtypes.FeeCollectorName},
{Account: distrtypes.ModuleName},
{Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}},
{Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
{Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
{Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}},
{Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
{Account: ibcfeetypes.ModuleName},
{Account: icatypes.ModuleName},
{Account: servicemoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}},
{Account: gatewaymoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}},
{Account: applicationmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}},
// this line is used by starport scaffolding # stargate/app/maccPerms
}

// blocked account addresses
blockAccAddrs = []string{
authtypes.FeeCollectorName,
distrtypes.ModuleName,
minttypes.ModuleName,
stakingtypes.BondedPoolName,
stakingtypes.NotBondedPoolName,
// We allow the following module accounts to receive funds:
// govtypes.ModuleName
}

// appConfig application configuration (used by depinject)
appConfig = appconfig.Compose(&appv1alpha1.Config{
Modules: []*appv1alpha1.ModuleConfig{
{
Name: runtime.ModuleName,
Config: appconfig.WrapAny(&runtimev1alpha1.Module{
AppName: Name,
PreBlockers: preBlockers,
BeginBlockers: beginBlockers,
EndBlockers: endBlockers,
InitGenesis: genesisModuleOrder,
OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{
{
ModuleName: authtypes.ModuleName,
KvStoreKey: "acc",
},
},
// When ExportGenesis is not specified, the export genesis module order
// is equal to the init genesis order
// ExportGenesis: genesisModuleOrder,
// Uncomment if you want to set a custom migration order here.
// OrderMigrations: nil,
}),
},
{
Name: authtypes.ModuleName,
Config: appconfig.WrapAny(&authmodulev1.Module{
Bech32Prefix: AccountAddressPrefix,
ModuleAccountPermissions: moduleAccPerms,
// By default modules authority is the governance module. This is configurable with the following:
// Authority: "group", // A custom module authority can be set using a module name
// Authority: "cosmos1cwwv22j5ca08ggdv9c2uky355k908694z577tv", // or a specific address
}),
},
{
Name: vestingtypes.ModuleName,
Config: appconfig.WrapAny(&vestingmodulev1.Module{}),
},
{
Name: banktypes.ModuleName,
Config: appconfig.WrapAny(&bankmodulev1.Module{
BlockedModuleAccountsOverride: blockAccAddrs,
}),
},
{
Name: stakingtypes.ModuleName,
Config: appconfig.WrapAny(&stakingmodulev1.Module{
// NOTE: specifying a prefix is only necessary when using bech32 addresses
// If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default
Bech32PrefixValidator: AccountAddressPrefix + "valoper",
Bech32PrefixConsensus: AccountAddressPrefix + "valcons",
}),
},
{
Name: slashingtypes.ModuleName,
Config: appconfig.WrapAny(&slashingmodulev1.Module{}),
},
{
Name: paramstypes.ModuleName,
Config: appconfig.WrapAny(&paramsmodulev1.Module{}),
},
{
Name: "tx",
Config: appconfig.WrapAny(&txconfigv1.Config{}),
},
{
Name: genutiltypes.ModuleName,
Config: appconfig.WrapAny(&genutilmodulev1.Module{}),
},
{
Name: authz.ModuleName,
Config: appconfig.WrapAny(&authzmodulev1.Module{}),
},
{
Name: upgradetypes.ModuleName,
Config: appconfig.WrapAny(&upgrademodulev1.Module{}),
},
{
Name: distrtypes.ModuleName,
Config: appconfig.WrapAny(&distrmodulev1.Module{}),
},
{
Name: evidencetypes.ModuleName,
Config: appconfig.WrapAny(&evidencemodulev1.Module{}),
},
{
Name: minttypes.ModuleName,
Config: appconfig.WrapAny(&mintmodulev1.Module{}),
},
{
Name: group.ModuleName,
Config: appconfig.WrapAny(&groupmodulev1.Module{
MaxExecutionPeriod: durationpb.New(time.Second * 1209600),
MaxMetadataLen: 255,
}),
},
{
Name: feegrant.ModuleName,
Config: appconfig.WrapAny(&feegrantmodulev1.Module{}),
},
{
Name: govtypes.ModuleName,
Config: appconfig.WrapAny(&govmodulev1.Module{}),
},
{
Name: crisistypes.ModuleName,
Config: appconfig.WrapAny(&crisismodulev1.Module{}),
},
{
Name: consensustypes.ModuleName,
Config: appconfig.WrapAny(&consensusmodulev1.Module{}),
},
{
Name: circuittypes.ModuleName,
Config: appconfig.WrapAny(&circuitmodulev1.Module{}),
},
{
Name: servicemoduletypes.ModuleName,
Config: appconfig.WrapAny(&servicemodulev1.Module{}),
},
{
Name: gatewaymoduletypes.ModuleName,
Config: appconfig.WrapAny(&gatewaymodulev1.Module{}),
},
{
Name: applicationmoduletypes.ModuleName,
Config: appconfig.WrapAny(&applicationmodulev1.Module{}),
},
// this line is used by starport scaffolding # stargate/app/moduleConfig
},
})
)
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ genesis:
maxDelegatedGateways: 7
applicationList:
- address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4
delegatee_gateway_addresses: []
service_configs:
delegateeGatewayAddresses: []
serviceConfigs:
- service:
id: anvil
name: ""
Expand Down
14 changes: 0 additions & 14 deletions proto/pocket/application/params.proto

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
syntax = "proto3";
package pocket.application;
package poktroll.application;

option go_package = "github.com/pokt-network/poktroll/x/application/types";

import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";

import "pocket/shared/service.proto";
import "poktroll/shared/service.proto";

// Application defines the type used to store an on-chain definition and state for an application
message Application {
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding
cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked
repeated shared.ApplicationServiceConfig service_configs = 3; // The list of services this appliccation is configured to request service for
repeated string delegatee_gateway_addresses = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.nullable) = false]; // The Bech32 encoded addresses for all delegatee Gateways, in a non-nullable slice
repeated poktroll.shared.ApplicationServiceConfig serviceConfigs = 3; // The list of services this appliccation is configured to request service for
red-0ne marked this conversation as resolved.
Show resolved Hide resolved
repeated string delegateeGatewayAddresses = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.nullable) = false]; // The Bech32 encoded addresses for all delegatee Gateways, in a non-nullable slice
}
Loading
Loading