Skip to content

Commit

Permalink
Merge pull request #682 from KiraCore/release/v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
asmodat authored Jul 15, 2024
2 parents 47ad6d6 + 0e49acd commit 4598c3d
Show file tree
Hide file tree
Showing 124 changed files with 5,989 additions and 8,555 deletions.
6 changes: 3 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Features:

- Signature verification codebase for metamask token send and EIP712 transactions
- Transaction type text updates to use camelcase
- Upgrade genesis script modification to migrate from v0.3.17 to v0.3.45
- Tokens module refactoring (#664)
- Layer2 improvement (#668)
- Fix storeKeys for layer2 and recovery modules
4 changes: 2 additions & 2 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,11 @@ func (svd ValidateFeeRangeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
feeCoins := feeTx.GetFee()
tokensBlackWhite := svd.tk.GetTokenBlackWhites(ctx)
for _, feeCoin := range feeCoins {
rate := svd.tk.GetTokenRate(ctx, feeCoin.Denom)
rate := svd.tk.GetTokenInfo(ctx, feeCoin.Denom)
if !properties.EnableForeignFeePayments && feeCoin.Denom != defaultDenom {
return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("foreign fee payments is disabled by governance"))
}
if rate == nil || !rate.FeePayments {
if rate == nil || !rate.FeeEnabled {
return ctx, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("currency you are trying to use was not whitelisted as fee payment"))
}
if tokensBlackWhite.IsFrozen(feeCoin.Denom, defaultDenom, properties.EnableTokenBlacklist, properties.EnableTokenWhitelist) {
Expand Down
19 changes: 12 additions & 7 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"

"cosmossdk.io/math"
customante "github.com/KiraCore/sekai/app/ante"
"github.com/KiraCore/sekai/types"
govtypes "github.com/KiraCore/sekai/x/gov/types"
Expand Down Expand Up @@ -555,15 +556,19 @@ func (suite *AnteTestSuite) TestPoorNetworkManagementDecorator() {
"invalid transaction type on poor network",
func() ([]sdk.Msg, []cryptotypes.PrivKey, []uint64, []uint64, sdk.Coins) {
msgs := []sdk.Msg{
tokenstypes.NewMsgUpsertTokenRate(
tokenstypes.NewMsgUpsertTokenInfo(
accounts[4].acc.GetAddress(),
"adr20",
"foo",
sdk.NewDec(1),
true,
sdk.ZeroDec(),
sdk.ZeroInt(),
false,
false,
sdk.NewDec(1), true,
sdk.ZeroInt(), sdk.ZeroInt(),
sdk.ZeroDec(), sdk.ZeroInt(),
false, false,
"FOO",
"Foo",
"",
6,
"", "", "", 0, math.ZeroInt(), "", false, "", "",
),
}
return msgs, privs[0:1], accNums[0:1], []uint64{1}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 100))
Expand Down
22 changes: 15 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func NewInitApp(
evidencetypes.StoreKey,
custodytypes.StoreKey,
collectivestypes.ModuleName,
layer2types.ModuleName,
layer2types.StoreKey,
consensusparamtypes.StoreKey,
)
tKeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -311,11 +311,12 @@ func NewInitApp(
)

app.Layer2Keeper = layer2keeper.NewKeeper(
keys[collectivestypes.StoreKey], appCodec,
keys[layer2types.StoreKey], appCodec,
app.BankKeeper,
app.CustomStakingKeeper,
app.CustomGovKeeper,
app.SpendingKeeper,
app.TokensKeeper,
)

app.UpgradeKeeper = upgradekeeper.NewKeeper(keys[upgradetypes.StoreKey], appCodec, app.CustomStakingKeeper)
Expand All @@ -337,7 +338,7 @@ func NewInitApp(

app.RecoveryKeeper = recoverykeeper.NewKeeper(
appCodec,
keys[slashingtypes.StoreKey],
keys[recoverytypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
&customStakingKeeper,
Expand All @@ -346,15 +347,23 @@ func NewInitApp(
app.CollectivesKeeper,
app.SpendingKeeper,
app.CustodyKeeper,
app.TokensKeeper,
)

app.DistrKeeper = distributorkeeper.NewKeeper(
keys[distributortypes.ModuleName], appCodec,
app.AccountKeeper, app.BankKeeper,
app.CustomStakingKeeper, app.CustomGovKeeper,
app.MultiStakingKeeper, app.RecoveryKeeper)
app.MultiStakingKeeper, app.RecoveryKeeper, app.TokensKeeper)
app.MultiStakingKeeper.SetDistrKeeper(app.DistrKeeper)
app.UbiKeeper = ubikeeper.NewKeeper(keys[ubitypes.ModuleName], appCodec, app.BankKeeper, app.SpendingKeeper, app.DistrKeeper)
app.UbiKeeper = ubikeeper.NewKeeper(
keys[ubitypes.ModuleName],
appCodec,
app.BankKeeper,
app.SpendingKeeper,
app.DistrKeeper,
app.TokensKeeper,
)

proposalRouter := govtypes.NewProposalRouter(
[]govtypes.ProposalHandler{
Expand All @@ -370,8 +379,7 @@ func NewInitApp(
customgov.NewApplyResetWholeCouncilorRankProposalHandler(app.CustomGovKeeper),
customgov.NewApplyJailCouncilorProposalHandler(app.CustomGovKeeper),
customgov.NewApplySetExecutionFeesProposalHandler(app.CustomGovKeeper),
tokens.NewApplyUpsertTokenAliasProposalHandler(app.TokensKeeper),
tokens.NewApplyUpsertTokenRatesProposalHandler(app.TokensKeeper),
tokens.NewApplyUpsertTokenInfosProposalHandler(app.TokensKeeper),
tokens.NewApplyWhiteBlackChangeProposalHandler(app.TokensKeeper),
customstaking.NewApplyUnjailValidatorProposalHandler(app.CustomStakingKeeper, app.CustomGovKeeper),
customslashing.NewApplyResetWholeValidatorRankProposalHandler(app.CustomSlashingKeeper),
Expand Down
15 changes: 3 additions & 12 deletions proto/kira/gov/permission.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ enum PermValue {
// Proposal to whitelist account permission.
PERMISSION_VOTE_WHITELIST_ACCOUNT_PERMISSION_PROPOSAL = 5 [(gogoproto.enumvalue_customname) = "PermVoteWhitelistAccountPermissionProposal"];

// PERMISSION_UPSERT_TOKEN_ALIAS
PERMISSION_UPSERT_TOKEN_ALIAS = 6 [(gogoproto.enumvalue_customname) = "PermUpsertTokenAlias"];

// PERMISSION_CHANGE_TX_FEE
PERMISSION_CHANGE_TX_FEE = 7 [(gogoproto.enumvalue_customname) = "PermChangeTxFee"];

// PERMISSION_UPSERT_TOKEN_RATE
PERMISSION_UPSERT_TOKEN_RATE = 8 [(gogoproto.enumvalue_customname) = "PermUpsertTokenRate"];
PERMISSION_UPSERT_TOKEN_RATE = 8 [(gogoproto.enumvalue_customname) = "PermUpsertTokenInfo"];

// PERMISSION_UPSERT_ROLE makes possible to add, modify and assign roles.
PERMISSION_UPSERT_ROLE = 9 [(gogoproto.enumvalue_customname) = "PermUpsertRole"];
Expand All @@ -52,23 +49,17 @@ enum PermValue {
// Proposal to set network property.
PERMISSION_VOTE_SET_NETWORK_PROPERTY_PROPOSAL = 13 [(gogoproto.enumvalue_customname) = "PermVoteSetNetworkPropertyProposal"];

// PERMISSION_CREATE_UPSERT_TOKEN_ALIAS_PROPOSAL defines the permission needed to create proposals for upsert token Alias.
PERMISSION_CREATE_UPSERT_TOKEN_ALIAS_PROPOSAL = 14 [(gogoproto.enumvalue_customname) = "PermCreateUpsertTokenAliasProposal"];

// PERMISSION_VOTE_UPSERT_TOKEN_ALIAS_PROPOSAL defines the permission needed to vote proposals for upsert token.
PERMISSION_VOTE_UPSERT_TOKEN_ALIAS_PROPOSAL = 15 [(gogoproto.enumvalue_customname) = "PermVoteUpsertTokenAliasProposal"];

// PERMISSION_CREATE_SET_POOR_NETWORK_MESSAGES defines the permission needed to create proposals for setting poor network messages
PERMISSION_CREATE_SET_POOR_NETWORK_MESSAGES = 16 [(gogoproto.enumvalue_customname) = "PermCreateSetPoorNetworkMessagesProposal"];

// PERMISSION_VOTE_SET_POOR_NETWORK_MESSAGES_PROPOSAL defines the permission needed to vote proposals to set poor network messages
PERMISSION_VOTE_SET_POOR_NETWORK_MESSAGES_PROPOSAL = 17 [(gogoproto.enumvalue_customname) = "PermVoteSetPoorNetworkMessagesProposal"];

// PERMISSION_CREATE_UPSERT_TOKEN_RATE_PROPOSAL defines the permission needed to create proposals for upsert token rate.
PERMISSION_CREATE_UPSERT_TOKEN_RATE_PROPOSAL = 18 [(gogoproto.enumvalue_customname) = "PermCreateUpsertTokenRateProposal"];
PERMISSION_CREATE_UPSERT_TOKEN_RATE_PROPOSAL = 18 [(gogoproto.enumvalue_customname) = "PermCreateUpsertTokenInfoProposal"];

// PERMISSION_VOTE_UPSERT_TOKEN_RATE_PROPOSAL defines the permission needed to vote proposals for upsert token rate.
PERMISSION_VOTE_UPSERT_TOKEN_RATE_PROPOSAL = 19 [(gogoproto.enumvalue_customname) = "PermVoteUpsertTokenRateProposal"];
PERMISSION_VOTE_UPSERT_TOKEN_RATE_PROPOSAL = 19 [(gogoproto.enumvalue_customname) = "PermVoteUpsertTokenInfoProposal"];

// PERMISSION_CREATE_UNJAIL_VALIDATOR_PROPOSAL defines the permission needed to create a proposal to unjail a validator.
PERMISSION_CREATE_UNJAIL_VALIDATOR_PROPOSAL = 20 [(gogoproto.enumvalue_customname) = "PermCreateUnjailValidatorProposal"];
Expand Down
5 changes: 3 additions & 2 deletions proto/kira/layer2/layer2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ message LpPoolConfig {
uint64 drip = 3; // time over which tokens should be distributed (can not be modified)
}

message IssuranceConfig {
message IssuanceConfig {
string deposit = 1; // spending pool id/name or kira address for extra dp deposit
string premint = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
Expand All @@ -68,7 +68,7 @@ message Dapp {
Controllers controllers = 8 [ (gogoproto.nullable) = false ]; // list of dApp owners, who can curate the execution record
repeated BinaryInfo bin = 9 [ (gogoproto.nullable) = false ]; // array of files & their details essential for launching the dApp
LpPoolConfig pool = 10 [ (gogoproto.nullable) = false ]; // lp pool configuration (can not be modified)
IssuranceConfig issurance = 11 [ (gogoproto.nullable) = false ]; // extra dApp (dp) token issuance configuration
IssuanceConfig issuance = 11 [ (gogoproto.nullable) = false ]; // extra dApp (dp) token issuance configuration
uint64 update_time_max = 12; // maximum time the dApp leader has to update his session (can be no more then 86400 - 24h)
uint64 executors_min = 13; // minimum number of validators that will be executing the dApp code (default 1)
uint64 executors_max = 14; // maximum number of validators that will be executing the dApp code (default 21)
Expand All @@ -93,6 +93,7 @@ message Dapp {
string team_reserve = 24; // team multisig
uint64 premint_time = 25; // timestamp for premint
bool post_mint_paid = 26; // flag to show post mint paid or not
bool enable_bond_verifiers = 27; // flag to enable verifiers with bonding
}

message UserDappBond {
Expand Down
36 changes: 0 additions & 36 deletions proto/kira/layer2/mint.proto

This file was deleted.

14 changes: 0 additions & 14 deletions proto/kira/layer2/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/api/annotations.proto";
import "kira/layer2/layer2.proto";
import "kira/layer2/mint.proto";

option go_package = "github.com/KiraCore/sekai/x/layer2/types";

Expand All @@ -26,14 +25,6 @@ service Query {
rpc TransferDapps(QueryTransferDappsRequest) returns (QueryTransferDappsResponse) {
option (google.api.http).get = "/kira/layer2/transfer_dapp";
}
// query list of all token denoms on the network including those created in
// the genesis (ukex, samolean etc..) as well as those in the minting module,
// lp tokens, validator recovery tokens and so on. If the flag with specific
// name is specified provide a detailed information about the token including
// its current circulating supply etc.
rpc GlobalTokens(QueryGlobalTokensRequest) returns (QueryGlobalTokensResponse) {
option (google.api.http).get = "/kira/layer2/global_tokens";
}
}

message QueryExecutionRegistrarRequest {
Expand All @@ -53,8 +44,3 @@ message QueryTransferDappsRequest {}
message QueryTransferDappsResponse {
repeated XAM XAMs = 1 [ (gogoproto.nullable) = false ];
}

message QueryGlobalTokensRequest {}
message QueryGlobalTokensResponse {
repeated TokenInfo tokens = 1 [ (gogoproto.nullable) = false ];
}
12 changes: 6 additions & 6 deletions proto/kira/layer2/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ message MsgMintCreateFtTx {
string description = 6; // 512 chars max, (can be changed by owner or proposal-upsert-alias)
string website = 7; // url 256 chars max, (can be changed by owner or proposal-upsert-alias)
string social = 8; // url 256 chars max, (can be changed by owner or proposal-upsert-alias)
uint64 decimals = 9; // min 0, max 255, (can NOT be changed)
uint32 decimals = 9; // min 0, max 255, (can NOT be changed)
string cap = 10 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
Expand All @@ -247,8 +247,8 @@ message MsgMintCreateFtTx {
(gogoproto.nullable) = false
]; // current circulating supply can NOT be more then CAP
uint64 holders = 12;
string fee = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
string fee_rate = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
]; // cost of minting 10^decimals per X ukex, can only increase (can be changed by owner only)
string owner = 14; // owner address or "" if noone should be able to modify most important properties
Expand All @@ -265,7 +265,7 @@ message MsgMintCreateNftTx {
string description = 6; // 512 chars max, (can be changed by owner or proposal-upsert-alias)
string website = 7; // url 256 chars max, (can be changed by owner or proposal-upsert-alias)
string social = 8; // url 256 chars max, (can be changed by owner or proposal-upsert-alias)
uint64 decimals = 9; // min 0, max 255, (can NOT be changed)
uint32 decimals = 9; // min 0, max 255, (can NOT be changed)
string cap = 10 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
Expand All @@ -275,8 +275,8 @@ message MsgMintCreateNftTx {
(gogoproto.nullable) = false
]; // current circulating supply can NOT be more then CAP
uint64 holders = 12;
string fee = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
string fee_rate = 13 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
]; // cost of minting 10^decimals per X ukex, can only increase (can be changed by owner only)
string owner = 14; // owner address or "" if noone should be able to modify most important properties
Expand Down
28 changes: 0 additions & 28 deletions proto/kira/tokens/alias.proto

This file was deleted.

9 changes: 4 additions & 5 deletions proto/kira/tokens/genesis.proto
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
syntax = "proto3";
package kira.tokens;

import "kira/tokens/alias.proto";
import "kira/tokens/rate.proto";
import "gogoproto/gogo.proto";
import "kira/tokens/token.proto";
import "kira/tokens/freeze.proto";

option go_package = "github.com/KiraCore/sekai/x/tokens/types";

message GenesisState {
repeated kira.tokens.TokenAlias aliases = 1;
repeated kira.tokens.TokenRate rates = 2;
TokensWhiteBlack tokenBlackWhites = 3;
repeated kira.tokens.TokenInfo tokenInfos = 1 [ (gogoproto.nullable) = false ];
TokensWhiteBlack tokenBlackWhites = 2 [ (gogoproto.nullable) = false ];
}
Loading

0 comments on commit 4598c3d

Please sign in to comment.