Skip to content

Commit e5be73a

Browse files
committed
last minute cleanup
1 parent e9164ae commit e5be73a

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

scripts/test_node.sh

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Run this script to quickly install, setup, and run the current chain without docker.
33
#
44
# Example:
5-
# POA_ADMIN_ADDRESS=manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct CHAIN_ID="local-1" HOME_DIR="~/.manifest" TIMEOUT_COMMIT="2500ms" CLEAN=true sh scripts/test_node.sh
5+
# POA_ADMIN_ADDRESS=manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct CHAIN_ID="local-1" HOME_DIR="~/.manifest" TIMEOUT_COMMIT="500ms" CLEAN=true sh scripts/test_node.sh
66
# CHAIN_ID="local-2" HOME_DIR="~/.manifest2" CLEAN=true RPC=36657 REST=2317 PROFF=6061 P2P=36656 GRPC=8090 GRPC_WEB=8091 ROSETTA=8081 TIMEOUT_COMMIT="500ms" sh scripts/test_node.sh
77
#
88
# To use unoptomized wasm files up to ~5mb, add: MAX_WASM_SIZE=5000000
@@ -66,18 +66,13 @@ from_scratch () {
6666
# mint
6767
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="umfx"' # not used
6868
update_test_genesis '.app_state["mint"]["params"]["blocks_per_year"]="6311520"'
69-
# update_test_genesis '.app_state["mint"]["minter"]["inflation"]="0.000000000000000000"' # does not matter
70-
# update_test_genesis '.app_state["mint"]["params"]["inflation_rate_change"]="1.000000000000000000"'
71-
# update_test_genesis '.app_state["mint"]["params"]["inflation_min"]="0.000000000000000000"'
72-
# update_test_genesis '.app_state["mint"]["params"]["inflation_max"]="1.000000000000000000"'
73-
# crisis
74-
# update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom": "umfx","amount": "1000"}'
7569

7670
# Custom Modules
7771

7872
# TokenFactory
7973
update_test_genesis '.app_state["tokenfactory"]["params"]["denom_creation_fee"]=[]'
8074
update_test_genesis '.app_state["tokenfactory"]["params"]["denom_creation_gas_consume"]=2000000'
75+
8176
# manifest
8277
update_test_genesis '.app_state["manifest"]["params"]["inflation"]["mint_denom"]="umfx"'
8378
update_test_genesis '.app_state["manifest"]["params"]["inflation"]["yearly_amount"]="500000000000"' # in micro format (1MFX = 10**6)
@@ -132,4 +127,4 @@ sed -i 's/address = ":8080"/address = "0.0.0.0:'$ROSETTA'"/g' $HOME_DIR/config/a
132127
sed -i 's/timeout_commit = "5s"/timeout_commit = "'$TIMEOUT_COMMIT'"/g' $HOME_DIR/config/config.toml
133128

134129
# Start the node
135-
BINARY start --pruning=nothing --minimum-gas-prices=0umfx --rpc.laddr="tcp://0.0.0.0:$RPC" --log_level=debug
130+
BINARY start --pruning=nothing --minimum-gas-prices=0umfx --rpc.laddr="tcp://0.0.0.0:$RPC"

x/manifest/client/cli/tx.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ func MsgUpdateParams() *cobra.Command {
4545
if err != nil {
4646
return err
4747
}
48-
senderAddress := cliCtx.GetFromAddress()
48+
49+
sender := cliCtx.GetFromAddress()
4950

5051
sh, err := fromStrToStakeholders(args[0])
5152
if err != nil {
@@ -63,7 +64,7 @@ func MsgUpdateParams() *cobra.Command {
6364
}
6465

6566
msg := &types.MsgUpdateParams{
66-
Authority: senderAddress.String(),
67+
Authority: sender.String(),
6768
Params: types.NewParams(sh, isInflationEnabled, coin.Amount.Uint64(), coin.Denom),
6869
}
6970

@@ -90,15 +91,16 @@ func MsgDeployStakeholderPayout() *cobra.Command {
9091
if err != nil {
9192
return err
9293
}
93-
senderAddress := cliCtx.GetFromAddress()
94+
95+
authority := cliCtx.GetFromAddress()
9496

9597
coin, err := sdk.ParseCoinNormalized(args[0])
9698
if err != nil {
9799
return err
98100
}
99101

100102
msg := &types.MsgPayoutStakeholders{
101-
Authority: senderAddress.String(),
103+
Authority: authority.String(),
102104
Payout: coin,
103105
}
104106

x/manifest/keeper/keeper.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ func (k Keeper) CalculateShareHolderTokenPayout(ctx context.Context, c sdk.Coin)
114114

115115
// iter each stakeholder, get their percent of the total 100%, and then split up their amount of coin cost
116116
for _, s := range sh {
117+
s := s
117118
pct := sdkmath.NewInt(int64(s.Percentage)).ToLegacyDec().QuoInt64(types.MaxPercentShare)
118119
coinAmt := pct.MulInt(c.Amount).RoundInt()
119120

@@ -128,6 +129,10 @@ func (k Keeper) CalculateShareHolderTokenPayout(ctx context.Context, c sdk.Coin)
128129
return pairs
129130
}
130131

132+
// PayoutStakeholders mints coins and sends them to the stakeholders.
133+
// This is called from the endblocker, so panics should never happen.
134+
// If it does, something is very wrong w/ the SDK. Any logic specific to auto minting
135+
// should be kept out of this to properly handle and return nil instead.
131136
func (k Keeper) PayoutStakeholders(ctx context.Context, c sdk.Coin) error {
132137
pairs := k.CalculateShareHolderTokenPayout(ctx, c)
133138

@@ -166,9 +171,12 @@ func (k Keeper) BlockRewardsProvision(ctx context.Context, denom string) sdk.Coi
166171
amtPerYear := params.Inflation.YearlyAmount
167172
blocksPerYear := mkParams.BlocksPerYear
168173

169-
div := amtPerYear / blocksPerYear
174+
if blocksPerYear < 10 {
175+
k.logger.Error("x/mint blocks per year param is too low", "blocks", blocksPerYear)
176+
return sdk.NewCoin(denom, sdkmath.ZeroInt())
177+
}
170178

171-
k.logger.Debug("amtPerYear", "amt", amtPerYear, "blocksPerYear", blocksPerYear, "div", div)
179+
div := amtPerYear / blocksPerYear
172180

173181
// return the amount of coins to be minted per block
174182
return sdk.NewCoin(denom, sdkmath.NewIntFromUint64(div))

x/manifest/module.go

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux
103103
}
104104

105105
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
106+
//
107+
//nolint:stylecheck
106108
func (a AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
107109
return &autocliv1.ModuleOptions{
108110
Query: &autocliv1.ServiceCommandDescriptor{

0 commit comments

Comments
 (0)