forked from cerc-io/laconicd
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca7e7ea4bc |
@@ -34,7 +34,6 @@ import (
|
||||
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||
|
||||
_ "cosmossdk.io/api/cosmos/tx/config/v1" // import for side-effects
|
||||
@@ -49,7 +48,6 @@ import (
|
||||
_ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects
|
||||
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
|
||||
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
|
||||
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects
|
||||
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
|
||||
)
|
||||
|
||||
@@ -78,7 +76,6 @@ type LaconicApp struct {
|
||||
AccountKeeper authkeeper.AccountKeeper
|
||||
BankKeeper bankkeeper.Keeper
|
||||
StakingKeeper *stakingkeeper.Keeper
|
||||
SlashingKeeper slashingkeeper.Keeper
|
||||
DistrKeeper distrkeeper.Keeper
|
||||
CrisisKeeper *crisiskeeper.Keeper
|
||||
ConsensusParamsKeeper consensuskeeper.Keeper
|
||||
@@ -145,7 +142,6 @@ func NewLaconicApp(
|
||||
&app.AccountKeeper,
|
||||
&app.BankKeeper,
|
||||
&app.StakingKeeper,
|
||||
&app.SlashingKeeper,
|
||||
&app.DistrKeeper,
|
||||
&app.CrisisKeeper,
|
||||
&app.ConsensusParamsKeeper,
|
||||
|
||||
+2
-5
@@ -6,11 +6,11 @@ modules:
|
||||
# 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
|
||||
begin_blockers: [distribution, slashing, staking]
|
||||
begin_blockers: [distribution, staking]
|
||||
end_blockers: [crisis, staking, auction, registry]
|
||||
# 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.
|
||||
init_genesis: [auth, bank, distribution, staking, slashing, crisis, genutil, auction, bond, registry, onboarding]
|
||||
init_genesis: [auth, bank, distribution, staking, crisis, genutil, auction, bond, registry, onboarding]
|
||||
override_store_keys:
|
||||
- module_name: auth
|
||||
kv_store_key: acc
|
||||
@@ -39,9 +39,6 @@ modules:
|
||||
- name: staking
|
||||
config:
|
||||
"@type": cosmos.staking.module.v1.Module
|
||||
- name: slashing
|
||||
config:
|
||||
"@type": cosmos.slashing.module.v1.Module
|
||||
- name: distribution
|
||||
config:
|
||||
"@type": cosmos.distribution.module.v1.Module
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
@@ -222,16 +221,4 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
/* Handle slashing state. */
|
||||
|
||||
// reset start height on signing infos
|
||||
app.SlashingKeeper.IterateValidatorSigningInfos(
|
||||
ctx,
|
||||
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
|
||||
info.StartHeight = 0
|
||||
app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
|
||||
return false
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ require (
|
||||
github.com/agnivade/levenshtein v1.1.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.10.0 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
|
||||
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
|
||||
|
||||
@@ -246,8 +246,6 @@ type Query {
|
||||
|
||||
# Whether to query all records, not just named ones (false by default).
|
||||
all: Boolean
|
||||
limit: Int
|
||||
offset: Int
|
||||
): [Record]
|
||||
|
||||
#
|
||||
|
||||
+4
-22
@@ -185,7 +185,7 @@ type ComplexityRoot struct {
|
||||
LookupNames func(childComplexity int, names []string) int
|
||||
QueryBonds func(childComplexity int, attributes []*KeyValueInput) int
|
||||
QueryBondsByOwner func(childComplexity int, ownerAddresses []string) int
|
||||
QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool, limit *int, offset *int) int
|
||||
QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool) int
|
||||
ResolveNames func(childComplexity int, names []string) int
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ type QueryResolver interface {
|
||||
QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error)
|
||||
QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error)
|
||||
GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error)
|
||||
QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool, limit *int, offset *int) ([]*Record, error)
|
||||
QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error)
|
||||
GetAuthorities(ctx context.Context, owner *string) ([]*Authority, error)
|
||||
LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error)
|
||||
LookupNames(ctx context.Context, names []string) ([]*NameRecord, error)
|
||||
@@ -873,7 +873,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
return 0, false
|
||||
}
|
||||
|
||||
return e.complexity.Query.QueryRecords(childComplexity, args["attributes"].([]*KeyValueInput), args["all"].(*bool), args["limit"].(*int), args["offset"].(*int)), true
|
||||
return e.complexity.Query.QueryRecords(childComplexity, args["attributes"].([]*KeyValueInput), args["all"].(*bool)), true
|
||||
|
||||
case "Query.resolveNames":
|
||||
if e.complexity.Query.ResolveNames == nil {
|
||||
@@ -1330,24 +1330,6 @@ func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, r
|
||||
}
|
||||
}
|
||||
args["all"] = arg1
|
||||
var arg2 *int
|
||||
if tmp, ok := rawArgs["limit"]; ok {
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit"))
|
||||
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
args["limit"] = arg2
|
||||
var arg3 *int
|
||||
if tmp, ok := rawArgs["offset"]; ok {
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset"))
|
||||
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
args["offset"] = arg3
|
||||
return args, nil
|
||||
}
|
||||
|
||||
@@ -4784,7 +4766,7 @@ func (ec *executionContext) _Query_queryRecords(ctx context.Context, field graph
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().QueryRecords(rctx, fc.Args["attributes"].([]*KeyValueInput), fc.Args["all"].(*bool), fc.Args["limit"].(*int), fc.Args["offset"].(*int))
|
||||
return ec.resolvers.Query().QueryRecords(rctx, fc.Args["attributes"].([]*KeyValueInput), fc.Args["all"].(*bool))
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
|
||||
+3
-9
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/query"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
|
||||
@@ -137,20 +136,14 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
|
||||
return gqlResponse, nil
|
||||
}
|
||||
|
||||
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool, limit *int, offset *int) ([]*Record, error) {
|
||||
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) {
|
||||
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
|
||||
|
||||
pagination := &query.PageRequest{
|
||||
Limit: uint64(*limit),
|
||||
Offset: uint64(*offset),
|
||||
}
|
||||
|
||||
res, err := nsQueryClient.Records(
|
||||
context.Background(),
|
||||
®istrytypes.QueryRecordsRequest{
|
||||
Attributes: toRPCAttributes(attributes),
|
||||
All: (all != nil && *all),
|
||||
Pagination: pagination,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -420,7 +413,8 @@ func (q queryResolver) GetParticipantByAddress(ctx context.Context, address stri
|
||||
|
||||
func (q queryResolver) GetParticipantByNitroAddress(ctx context.Context, nitroAddress string) (*Participant, error) {
|
||||
onboardingQueryClient := onboardingTypes.NewQueryClient(q.ctx)
|
||||
participantResp, err := onboardingQueryClient.GetParticipantByNitroAddress(ctx, &onboardingTypes.QueryGetParticipantByNitroAddressRequest{NitroAddress: nitroAddress})
|
||||
participantResp, err := onboardingQueryClient.GetParticipantByNitroAddress(
|
||||
ctx, &onboardingTypes.QueryGetParticipantByNitroAddressRequest{NitroAddress: nitroAddress})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+10
-32
@@ -1,12 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
KEY="alice"
|
||||
CHAINID=${CHAINID:-"laconic_9000-1"}
|
||||
MONIKER=${MONIKER:-"localtestnet"}
|
||||
KEYRING=${KEYRING:-"test"}
|
||||
DENOM=${DENOM:-"alnt"}
|
||||
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"}
|
||||
LOGLEVEL=${LOGLEVEL:-"info"}
|
||||
CHAINID="laconic_9000-1"
|
||||
MONIKER="localtestnet"
|
||||
KEYRING="test"
|
||||
LOGLEVEL="${LOGLEVEL:-info}"
|
||||
|
||||
input_genesis_file=${GENESIS_FILE}
|
||||
|
||||
@@ -31,9 +29,9 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
||||
laconicd keys add $KEY --keyring-backend $KEYRING
|
||||
|
||||
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
||||
laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM
|
||||
laconicd init $MONIKER --chain-id $CHAINID --default-denom alnt
|
||||
|
||||
if [[ -f ${input_genesis_file} ]]; then
|
||||
if [ -f ${input_genesis_file} ]; then
|
||||
# Use provided genesis config
|
||||
cp $input_genesis_file $HOME/.laconicd/config/genesis.json
|
||||
fi
|
||||
@@ -67,26 +65,6 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
||||
update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true'
|
||||
fi
|
||||
|
||||
if [[ "$AUTHORITY_AUCTION_ENABLED" == "true" ]]; then
|
||||
echo "Enabling authority auctions."
|
||||
update_genesis '.app_state["registry"]["params"]["authority_auction_enabled"]=true'
|
||||
fi
|
||||
|
||||
if [[ -n $AUTHORITY_AUCTION_COMMITS_DURATION ]]; then
|
||||
echo "Setting authority_auction_commits_duration to $AUTHORITY_AUCTION_COMMITS_DURATION seconds."
|
||||
update_genesis ".app_state[\"registry\"][\"params\"][\"authority_auction_commits_duration\"]=\"${AUTHORITY_AUCTION_COMMITS_DURATION}s\""
|
||||
fi
|
||||
|
||||
if [[ -n $AUTHORITY_AUCTION_REVEALS_DURATION ]]; then
|
||||
echo "Setting authority_auction_reveals_duration to $AUTHORITY_AUCTION_REVEALS_DURATION seconds."
|
||||
update_genesis ".app_state[\"registry\"][\"params\"][\"authority_auction_reveals_duration\"]=\"${AUTHORITY_AUCTION_REVEALS_DURATION}s\""
|
||||
fi
|
||||
|
||||
if [[ -n $AUTHORITY_GRACE_PERIOD ]]; then
|
||||
echo "Setting authority_grace_period to $AUTHORITY_GRACE_PERIOD seconds."
|
||||
update_genesis ".app_state[\"registry\"][\"params\"][\"authority_grace_period\"]=\"${AUTHORITY_GRACE_PERIOD}s\""
|
||||
fi
|
||||
|
||||
# increase block time (?)
|
||||
update_genesis '.consensus["params"]["block"]["time_iota_ms"]="1000"'
|
||||
|
||||
@@ -116,11 +94,11 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
||||
|
||||
# Allocate genesis accounts (cosmos formatted addresses)
|
||||
# 10^30 alnt | 10^12 lnt
|
||||
laconicd genesis add-genesis-account $KEY 1000000000000000000000000000000$DENOM --keyring-backend $KEYRING
|
||||
laconicd genesis add-genesis-account $KEY 1000000000000000000000000000000alnt --keyring-backend $KEYRING
|
||||
|
||||
# Sign genesis transaction
|
||||
# 10^15 alnt
|
||||
laconicd genesis gentx $KEY $STAKING_AMOUNT$DENOM --keyring-backend $KEYRING --chain-id $CHAINID
|
||||
# 10^24 alnt | 10^6 lnt
|
||||
laconicd genesis gentx $KEY 1000000000000000000000000alnt --keyring-backend $KEYRING --chain-id $CHAINID
|
||||
|
||||
# Collect genesis tx
|
||||
laconicd genesis collect-gentxs
|
||||
@@ -135,7 +113,7 @@ fi
|
||||
laconicd start \
|
||||
--pruning=nothing \
|
||||
--log_level $LOGLEVEL \
|
||||
--minimum-gas-prices=1$DENOM \
|
||||
--minimum-gas-prices=1alnt \
|
||||
--api.enable \
|
||||
--rpc.laddr="tcp://0.0.0.0:26657" \
|
||||
--gql-server --gql-playground
|
||||
|
||||
Reference in New Issue
Block a user