Skip to content

Commit

Permalink
Merge pull request #391 from persistenceOne/f/lsm
Browse files Browse the repository at this point in the history
Adding LSM module (x/lsnative)
  • Loading branch information
Max Kupriianov committed Apr 12, 2023
2 parents f024b9e + aa81bce commit 708478f
Show file tree
Hide file tree
Showing 347 changed files with 92,901 additions and 15 deletions.
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Isrun:
run:
tests: false
skip-files:
- schema/applications/base/application.go
- utilities/cuckoo/filter.go
-
skip-dirs:
- x/lsnative
linters:
disable-all: false
enable:
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ go 1.19

require (
cosmossdk.io/math v1.0.0-beta.3
github.com/armon/go-metrics v0.4.1
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.11
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-go/v6 v6.1.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.14.0
github.com/stretchr/testify v1.8.1
github.com/tendermint/tendermint v0.34.27
Expand All @@ -22,6 +27,7 @@ require (
google.golang.org/grpc v1.52.0
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.3.0
)

require (
Expand All @@ -36,7 +42,6 @@ require (
github.com/99designs/keyring v1.2.1 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.40.45 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
Expand All @@ -51,8 +56,6 @@ require (
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-alpha8 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/iavl v0.19.5 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
Expand Down Expand Up @@ -119,7 +122,6 @@ require (
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
Expand All @@ -132,7 +134,6 @@ require (
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
Expand All @@ -155,7 +156,6 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
Expand Down
5 changes: 3 additions & 2 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

"cosmossdk.io/errors"
"cosmossdk.io/math"
bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -22,7 +23,7 @@ import (
"github.com/cosmos/cosmos-sdk/simapp/helpers"
"github.com/cosmos/cosmos-sdk/testutil/mock"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
Expand Down Expand Up @@ -570,7 +571,7 @@ func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) {
}

if len(pkBytes) != ed25519.PubKeySize {
panic(errors.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size"))
panic(errors.Wrap(sdkerrors.ErrInvalidPubKey, "invalid pubkey size"))
}

return &ed25519.PubKey{Key: pkBytes}
Expand Down
219 changes: 219 additions & 0 deletions tests/fixtures/adr-024-coin-metadata_genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
{
"genesis_time": "2020-07-18T22:22:09.286222793Z",
"chain_id": "123",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "1000"
},
"evidence": {
"max_age_num_blocks": "100000",
"max_age_duration": "172800000000000",
"max_num": 50,
"proof_trial_period": "50000"
},
"validator": {
"pub_key_types": [
"ed25519"
]
}
},
"app_hash": "",
"app_state": {
"bank": {
"params": {
"default_send_enabled": true
},
"balances": [
{
"address": "cosmos106vrzv5xkheqhjm023pxcxlqmcjvuhtfyachz4",
"coins": [
{
"denom": "nametoken",
"amount": "1000"
},
{
"denom": "stake",
"amount": "100000000"
}
]
},
{
"address": "cosmos1xztun2634zplhajda7tmjaxy488qj44n765t58",
"coins": [
{
"denom": "nametoken",
"amount": "1000"
},
{
"denom": "stake",
"amount": "100000000"
}
]
}
],
"supply": [],
"denom_metadata": [
{
"description": "The native staking token of the Cosmos Hub.",
"denom_units": [
{
"denom": "uatom",
"exponent": 0,
"aliases": [
"microatom"
]
},
{
"denom": "matom",
"exponent": 3,
"aliases": [
"milliatom"
]
},
{
"denom": "atom",
"exponent": 6
}
],
"base": "uatom",
"display": "atom"
}
]
},
"genutil": {
"gentxs": []
},
"capability": {
"index": "1",
"owners": []
},
"mint": {
"minter": {
"inflation": "0.130000000000000000",
"annual_provisions": "0.000000000000000000"
},
"params": {
"mint_denom": "stake",
"inflation_rate_change": "0.130000000000000000",
"inflation_max": "0.200000000000000000",
"inflation_min": "0.070000000000000000",
"goal_bonded": "0.670000000000000000",
"blocks_per_year": "6311520"
}
},
"ibc": {
"client_genesis": {
"clients": [],
"clients_consensus": [],
"create_localhost": true
},
"connection_genesis": {
"connections": [],
"client_connection_paths": []
},
"channel_genesis": {
"channels": [],
"acknowledgements": [],
"commitments": [],
"send_sequences": [],
"recv_sequences": [],
"ack_sequences": []
}
},
"upgrade": {},
"evidence": {
"evidence": []
},
"auth": {
"params": {
"max_memo_characters": "256",
"tx_sig_limit": "7",
"tx_size_cost_per_byte": "10",
"sig_verify_cost_ed25519": "590",
"sig_verify_cost_secp256k1": "1000"
},
"accounts": []
},
"gov": {
"starting_proposal_id": "1",
"deposits": null,
"votes": null,
"proposals": null,
"deposit_params": {
"min_deposit": [
{
"denom": "stake",
"amount": "10000000"
}
],
"max_deposit_period": "172800000000000"
},
"voting_params": {
"voting_period": "172800000000000"
},
"tally_params": {
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto": "0.334000000000000000"
}
},
"params": null,
"transfer": {
"port_id": "transfer"
},
"crisis": {
"constant_fee": {
"denom": "stake",
"amount": "1000"
}
},
"distribution": {
"params": {
"community_tax": "0.020000000000000000",
"base_proposer_reward": "0.010000000000000000",
"bonus_proposer_reward": "0.040000000000000000",
"withdraw_addr_enabled": true
},
"fee_pool": {
"community_pool": []
},
"delegator_withdraw_infos": [],
"previous_proposer": "",
"outstanding_rewards": [],
"validator_accumulated_commissions": [],
"validator_historical_rewards": [],
"validator_current_rewards": [],
"delegator_starting_infos": [],
"validator_slash_events": []
},
"slashing": {
"params": {
"signed_blocks_window": "100",
"min_signed_per_window": "0.500000000000000000",
"downtime_jail_duration": "600000000000",
"slash_fraction_double_sign": "0.050000000000000000",
"slash_fraction_downtime": "0.010000000000000000"
},
"signing_infos": {},
"missed_blocks": {}
},
"staking": {
"params": {
"unbonding_time": "1814400000000000",
"max_validators": 100,
"max_entries": 7,
"historical_entries": 100,
"bond_denom": "stake"
},
"last_total_power": "0",
"last_validator_powers": null,
"validators": null,
"delegations": null,
"unbonding_delegations": null,
"redelegations": null,
"exported": false
}
}
}
4 changes: 2 additions & 2 deletions x/epochs/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
// DONTCOVER

import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"cosmossdk.io/errors"
)

// x/epochs module sentinel errors.
var (
ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error")
ErrSample = errors.Register(ModuleName, 1100, "sample error")
)
5 changes: 3 additions & 2 deletions x/halving/keeper/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package keeper
import (
abci "github.com/tendermint/tendermint/abci/types"

"cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand All @@ -22,7 +23,7 @@ func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
return queryParams(ctx, k, legacyQuerierCdc)

default:
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0])
return nil, errors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0])
}
}
}
Expand All @@ -32,7 +33,7 @@ func queryParams(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAmino)

res, err := codec.MarshalJSONIndent(legacyQuerierCdc, params)
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
return nil, errors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
}

return res, nil
Expand Down
3 changes: 2 additions & 1 deletion x/interchainquery/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package interchainquery
import (
"fmt"

"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

Expand All @@ -14,6 +15,6 @@ import (
func NewHandler(k keeper.Keeper) sdk.Handler {
return func(_ sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg)
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
return nil, errors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
}
}
7 changes: 7 additions & 0 deletions x/lsnative/distribution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
order: 0
-->

# Distribution

* [Distribution](spec/README.md) - Fee distribution, and staking token provision distribution.

0 comments on commit 708478f

Please sign in to comment.