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

chore: fix some typos in comment #284

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
platforms: ${{ matrix.os }}/${{ matrix.arch }}
tags: xion:${{ matrix.os }}-${{ matrix.arch }}
build-args: |
COMMIT=${{ github.sha }}
VERSION=${{ github.ref_name }}
XIOND_BINARY=dist/xiond_${{ matrix.os }}_${{ matrix.arch }}/xiond

- name: Build Heighliner Image
Expand All @@ -84,6 +86,8 @@ jobs:
platforms: ${{ matrix.os }}/${{ matrix.arch }}
tags: heighliner:${{ matrix.os }}-${{ matrix.arch }}
build-args: |
COMMIT=${{ github.sha }}
VERSION=${{ github.ref_name }}
XIOND_BINARY=dist/xiond_${{ matrix.os }}_${{ matrix.arch }}/xiond

- name: Save Docker Image
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
PACKAGES_SIMTEST = $(shell go list ./... | grep '/simulation')
VERSION ?= $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT ?= $(shell git log -1 --format='%H')
TAG_VERSION ?= $(shell git rev-parse --short HEAD)
LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BINDIR ?= $(GOPATH)/bin
Expand Down Expand Up @@ -86,7 +85,7 @@ all: install lint test
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/xiond

build: go.sum
build: guard-VERSION guard-COMMIT
ifeq ($(OS),Windows_NT)
$(error wasmd server not supported. Use "make build-windows-client" for client)
exit 1
Expand Down Expand Up @@ -231,6 +230,12 @@ clean:
distclean: clean
rm -rf vendor/

guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi

###############################################################################
### Testing ###
###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion app/params/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ It contains the default weights used for each transaction used on the module's
simulation. These weights define the chance for a transaction to be simulated at
any gived operation.

You can repace the default values for the weights by providing a params.json
You can replace the default values for the weights by providing a params.json
file with the weights defined for each of the transaction operations:

{
Expand Down
8 changes: 7 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"fmt"

ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"

storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

Expand All @@ -23,7 +25,11 @@ func (app *WasmApp) RegisterUpgradeHandlers() {

if upgradeInfo.Name == UpgradeName {
if !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{}
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
ibcwasmtypes.ModuleName,
},
}

app.Logger().Info("setting upgrade store loaders")
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
Expand Down
20 changes: 20 additions & 0 deletions client/docs/static/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -51010,6 +51010,26 @@
},
"description": "QueryParamsResponse is the response type for the Query/Params RPC method."
},
"xion.v1.QueryPlatformMinimumResponse": {
"type": "object",
"properties": {
"minimums": {
"type": "array",
"items": {
"type": "object",
"properties": {
"denom": {
"type": "string"
},
"amount": {
"type": "string"
}
},
"description": "Coin defines a token with a denomination and an amount.\n\nNOTE: The amount field is an Int which implements the custom method\nsignatures required by gogoproto."
}
}
}
},
"xion.v1.QueryPlatformPercentageResponse": {
"type": "object",
"properties": {
Expand Down
20 changes: 20 additions & 0 deletions client/docs/static/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -48372,6 +48372,26 @@
},
"description": "QueryParamsResponse is the response type for the Query/Params RPC method."
},
"xion.v1.QueryPlatformMinimumResponse": {
"type": "object",
"properties": {
"minimums": {
"type": "array",
"items": {
"type": "object",
"properties": {
"denom": {
"type": "string"
},
"amount": {
"type": "string"
}
},
"description": "Coin defines a token with a denomination and an amount.\n\nNOTE: The amount field is an Int which implements the custom method\nsignatures required by gogoproto."
}
}
}
},
"xion.v1.QueryPlatformPercentageResponse": {
"type": "object",
"properties": {
Expand Down
18 changes: 16 additions & 2 deletions integration_tests/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ func TestXionSendPlatformFee(t *testing.T) {
config := types.GetConfig()
config.SetBech32PrefixForAccount("xion", "xionpub")

// query to make sure minimums are empty

minimums, err := ExecQuery(t, ctx, xion.GetNode(), "xion", "platform-minimum")
require.NoError(t, err)
t.Log(minimums)
require.Equal(t, []interface{}{}, minimums["minimums"])

setPlatformMinimumsMsg := xiontypes.MsgSetPlatformMinimum{
Authority: authtypes.NewModuleAddress("gov").String(),
Minimums: types.Coins{types.Coin{Amount: math.NewInt(10), Denom: "uxion"}},
Expand All @@ -78,8 +85,8 @@ func TestXionSendPlatformFee(t *testing.T) {
Messages: []json.RawMessage{msg},
Metadata: "",
Deposit: "100uxion",
Title: "Set platform percentage to 5%",
Summary: "Ups the platform fee to 5% for the integration test",
Title: "Set platform minimum to 100uxion",
Summary: "Ups the platform minimum to 100uxion for the integration test",
}
paramChangeTx, err := xion.SubmitProposal(ctx, xionUser.KeyName(), prop)
require.NoError(t, err)
Expand Down Expand Up @@ -117,6 +124,13 @@ func TestXionSendPlatformFee(t *testing.T) {
return false
}, time.Second*11, time.Second, "failed to reach status PASSED after 11s")

// check that the value has been set

minimums, err = ExecQuery(t, ctx, xion.GetNode(), "xion", "platform-minimum")
require.NoError(t, err)
coins := minimums["minimums"].([]interface{})
require.Equal(t, 1, len(coins))

_, err = xion.GetNode().ExecTx(ctx,
xionUser.KeyName(),
"xion", "send", xionUser.KeyName(),
Expand Down
16 changes: 0 additions & 16 deletions integration_tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import (
"github.com/go-webauthn/webauthn/webauthn"

sdk "github.com/cosmos/cosmos-sdk/types"
paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils"
"github.com/docker/docker/client"
"github.com/icza/dyno"
"github.com/strangelove-ventures/interchaintest/v8"
Expand Down Expand Up @@ -210,21 +209,6 @@ func RawJSONMsgMigrateContract(sender string, codeID string) []byte {
return rawMsg
}

func ParamChangeProposal(t *testing.T, subspace, key, value, title, description, deposit string) paramsutils.ParamChangeProposalJSON {
changes := paramsutils.ParamChangeJSON{
Subspace: subspace,
Key: key,
Value: json.RawMessage(fmt.Sprintf(`"%s"`, value)),
}
proposal := paramsutils.ParamChangeProposalJSON{
Title: title,
Description: description,
Deposit: deposit,
Changes: []paramsutils.ParamChangeJSON{changes},
}
return proposal
}

func BuildXionChain(t *testing.T, gas string, modifyGenesis func(ibc.ChainConfig, []byte) ([]byte, error)) TestData {
ctx := context.Background()

Expand Down
14 changes: 14 additions & 0 deletions proto/xion/v1/query.proto
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
syntax = "proto3";
package xion.v1;

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


option go_package = "github.com/burnt-labs/xion/x/xion/types";

service Query {
rpc WebAuthNVerifyRegister(QueryWebAuthNVerifyRegisterRequest) returns (QueryWebAuthNVerifyRegisterResponse) {}
rpc WebAuthNVerifyAuthenticate(QueryWebAuthNVerifyAuthenticateRequest) returns (QueryWebAuthNVerifyAuthenticateResponse) {}
rpc PlatformPercentage(QueryPlatformPercentageRequest) returns (QueryPlatformPercentageResponse) {}
rpc PlatformMinimum(QueryPlatformMinimumRequest) returns (QueryPlatformMinimumResponse) {}
}

message QueryWebAuthNVerifyRegisterRequest {
Expand Down Expand Up @@ -34,4 +39,13 @@ message QueryPlatformPercentageRequest {}

message QueryPlatformPercentageResponse {
uint64 platform_percentage = 1;
}

message QueryPlatformMinimumRequest {}

message QueryPlatformMinimumResponse {
repeated cosmos.base.v1beta1.Coin minimums = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
2 changes: 1 addition & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scripts

These scripts are copied from the [Cosmos-SDK](https://github.com/cosmos/cosmos-sdk/tree/v0.42.1/scripts) respository
These scripts are copied from the [Cosmos-SDK](https://github.com/cosmos/cosmos-sdk/tree/v0.42.1/scripts) repository
with minor modifications. All credits and big thanks go to the original authors.

Please note that a custom [fork](github.com/regen-network/protobuf) by the Regen network team is used.
Expand Down
2 changes: 1 addition & 1 deletion x/globalfee/ante/antetest/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (s *IntegrationTestSuite) TestGetTxFeeRequired() {
// setup tests with default global fee i.e. "0uxion" and empty local min gas prices
feeDecorator, _ := s.SetupTestGlobalFeeStoreAndMinGasPrice([]sdk.DecCoin{}, globalfeeParamsEmpty, noBondDenom)

// set a subspace that doesn't have the stakingtypes.KeyBondDenom key registred
// set a subspace that doesn't have the stakingtypes.KeyBondDenom key registered
// feeDecorator.StakingSubspace = s.app.GetSubspace(globfeetypes.ModuleName)

// check that an error is returned when staking bond denom is empty
Expand Down
2 changes: 1 addition & 1 deletion x/jwk/client/cli/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func CmdConvertPemToJSON() *cobra.Command {
cmd := &cobra.Command{
Use: "convert-pem [file] [alg | optional]",
Short: "Convery PEM to JSON",
Short: "Convert PEM to JSON",
Args: cobra.RangeArgs(1, 2),
RunE: func(cmd *cobra.Command, args []string) (err error) {
publicKeyBz, err := os.ReadFile(args[0])
Expand Down
2 changes: 1 addition & 1 deletion x/mint/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func TestBeginBlocker(t *testing.T) {
assert.Equalf(t, 1, len(events), "A single event must be emitted. However %d events were emitted", len(events))
event := events[0]
assert.Equalf(t, "xion.mint.v1.MintIncentiveTokens", event.Type, "Expected event to be xion.mint.v1.MintIncentiveTokens but found: %s", event.Type)
assert.Equalf(t, 7, len(event.Attributes), "Expcted 7 attributes but found %d", len(event.Attributes))
assert.Equalf(t, 7, len(event.Attributes), "Expected 7 attributes but found %d", len(event.Attributes))

assert.Equal(t, "annual_provisions", event.Attributes[0].Key)
assert.Equal(t, tc.expected.annualProvisions, sdkmath.LegacyMustNewDecFromStr(stripValue(t, event.Attributes[0].Value)))
Expand Down
3 changes: 2 additions & 1 deletion x/xion/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func GetQueryCmd() *cobra.Command {

cmd.AddCommand(CmdWebAuthNVerifyRegister())
cmd.AddCommand(CmdWebAuthNVerifyAuthenticate())
cmd.AddCommand(CmdPlatformFee())
cmd.AddCommand(CmdPlatformPercentage())
cmd.AddCommand(CmdPlatformMinimum())

// this line is used by starport scaffolding # 1

Expand Down
34 changes: 31 additions & 3 deletions x/xion/client/cli/query_platform_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/burnt-labs/xion/x/xion/types"
)

func CmdPlatformFee() *cobra.Command {
func CmdPlatformPercentage() *cobra.Command {
cmd := &cobra.Command{
Use: "platform-fee",
Short: "Get Platform Fee",
Use: "platform-percentage",
Short: "Get Platform Percentage",
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
Expand All @@ -36,3 +36,31 @@ func CmdPlatformFee() *cobra.Command {

return cmd
}

func CmdPlatformMinimum() *cobra.Command {
cmd := &cobra.Command{
Use: "platform-minimum",
Short: "Get Platform Minimum",
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryPlatformMinimumRequest{}

res, err := queryClient.PlatformMinimum(cmd.Context(), params)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}
20 changes: 20 additions & 0 deletions x/xion/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/go-webauthn/webauthn/protocol"
"github.com/go-webauthn/webauthn/webauthn"

sdktypes "github.com/cosmos/cosmos-sdk/types"

"github.com/burnt-labs/xion/x/xion/types"
)

Expand Down Expand Up @@ -62,3 +64,21 @@ func (k Keeper) WebAuthNVerifyAuthenticate(_ context.Context, request *types.Que

return &types.QueryWebAuthNVerifyAuthenticateResponse{}, nil
}

// PlatformPercentage implements types.QueryServer.
func (k Keeper) PlatformPercentage(ctx context.Context, _ *types.QueryPlatformPercentageRequest) (*types.QueryPlatformPercentageResponse, error) {
sdkCtx := sdktypes.UnwrapSDKContext(ctx)
percentage := k.GetPlatformPercentage(sdkCtx).Uint64()
return &types.QueryPlatformPercentageResponse{PlatformPercentage: percentage}, nil
}

// PlatformMinimum implements types.QueryServer.
func (k Keeper) PlatformMinimum(ctx context.Context, _ *types.QueryPlatformMinimumRequest) (*types.QueryPlatformMinimumResponse, error) {
sdkCtx := sdktypes.UnwrapSDKContext(ctx)
coins, err := k.GetPlatformMinimums(sdkCtx)
if err != nil {
return nil, err
}

return &types.QueryPlatformMinimumResponse{Minimums: coins}, nil
}
8 changes: 0 additions & 8 deletions x/xion/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package keeper

import (
"context"
"encoding/json"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down Expand Up @@ -97,10 +96,3 @@ func (k Keeper) OverwritePlatformMinimum(ctx sdktypes.Context, coins sdktypes.Co
func (k Keeper) GetAuthority() string {
return k.authority
}

// PlatformPercentage implements types.QueryServer.
func (k Keeper) PlatformPercentage(ctx context.Context, _ *types.QueryPlatformPercentageRequest) (*types.QueryPlatformPercentageResponse, error) {
sdkCtx := sdktypes.UnwrapSDKContext(ctx)
percentage := k.GetPlatformPercentage(sdkCtx).Uint64()
return &types.QueryPlatformPercentageResponse{PlatformPercentage: percentage}, nil
}
Loading
Loading