Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Feb 27, 2024
1 parent 087fd18 commit e056393
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ import (

func GetPoAAdmin() string {
// used only in e2e testing with interchaintest
if address := os.Getenv("OVERRIDE_POA_ADMIN_ADDRESS"); address != "" {
if address := os.Getenv("POA_ADMIN_ADDRESS"); address != "" {
return address
}

Expand Down
16 changes: 8 additions & 8 deletions scripts/test_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Run this script to quickly install, setup, and run the current chain without docker.
#
# Example:
# OVERRIDE_POA_ADMIN_ADDRESS=manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct CHAIN_ID="local-1" HOME_DIR="~/.manifest" TIMEOUT_COMMIT="2500ms" CLEAN=true sh scripts/test_node.sh
# POA_ADMIN_ADDRESS=manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct CHAIN_ID="local-1" HOME_DIR="~/.manifest" TIMEOUT_COMMIT="2500ms" CLEAN=true sh scripts/test_node.sh
# 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
#
# To use unoptomized wasm files up to ~5mb, add: MAX_WASM_SIZE=5000000
Expand Down Expand Up @@ -64,12 +64,12 @@ from_scratch () {
update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="ustake"' # PoA Token
update_test_genesis '.app_state["staking"]["params"]["min_commission_rate"]="0.000000000000000000"'
# mint
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="umfx"'
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="umfx"' # not used
update_test_genesis '.app_state["mint"]["params"]["blocks_per_year"]="6311520"'
update_test_genesis '.app_state["mint"]["minter"]["inflation"]="0.100000000000000000"' # no manual minting if this is >0
update_test_genesis '.app_state["mint"]["params"]["inflation_rate_change"]="1.000000000000000000"'
update_test_genesis '.app_state["mint"]["params"]["inflation_min"]="0.000000000000000000"'
update_test_genesis '.app_state["mint"]["params"]["inflation_max"]="1.000000000000000000"'
# update_test_genesis '.app_state["mint"]["minter"]["inflation"]="0.000000000000000000"' # does not matter
# update_test_genesis '.app_state["mint"]["params"]["inflation_rate_change"]="1.000000000000000000"'
# update_test_genesis '.app_state["mint"]["params"]["inflation_min"]="0.000000000000000000"'
# update_test_genesis '.app_state["mint"]["params"]["inflation_max"]="1.000000000000000000"'
# crisis
# update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom": "umfx","amount": "1000"}'

Expand All @@ -86,7 +86,7 @@ from_scratch () {

# Allocate genesis accounts
BINARY genesis add-genesis-account $KEY 1000000ustake,10000000umfx,1000utest --keyring-backend $KEYRING
BINARY genesis add-genesis-account $KEY2 100000000000000000000000umfx,1000utest --keyring-backend $KEYRING
BINARY genesis add-genesis-account $KEY2 100000umfx,1000utest --keyring-backend $KEYRING

# Set 1 POAToken -> user
GenTxFlags="--commission-rate=0.0 --commission-max-rate=1.0 --commission-max-change-rate=0.1"
Expand Down Expand Up @@ -132,4 +132,4 @@ sed -i 's/address = ":8080"/address = "0.0.0.0:'$ROSETTA'"/g' $HOME_DIR/config/a
sed -i 's/timeout_commit = "5s"/timeout_commit = "'$TIMEOUT_COMMIT'"/g' $HOME_DIR/config/config.toml

# Start the node
BINARY start --pruning=nothing --minimum-gas-prices=0umfx --rpc.laddr="tcp://0.0.0.0:$RPC"
BINARY start --pruning=nothing --minimum-gas-prices=0umfx --rpc.laddr="tcp://0.0.0.0:$RPC" --log_level=debug
5 changes: 5 additions & 0 deletions x/manifest/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ func BeginBlocker(ctx context.Context, k keeper.Keeper, mk mintkeeper.Keeper, bk
return nil
}

if !params.Inflation.AutomaticEnabled {
k.Logger().Debug("Automatic inflation is disabled")
return nil
}

// Calculate the per block inflation rewards to pay out in coins
mintedCoin := k.BlockRewardsProvision(ctx, params.Inflation.MintDenom)
mintedCoins := sdk.NewCoins(mintedCoin)
Expand Down
4 changes: 3 additions & 1 deletion x/manifest/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func MsgUpdateParams() *cobra.Command {
Use: "update-params [address_pairs] [automatic_inflation_enabled] [inflation_per_year]",
Short: "Update the params (must be submitted from the authority)",
Example: `update-params address:1_000_000,address2:99_000_000 true 500000000umfx`,
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down Expand Up @@ -83,6 +83,8 @@ func MsgUpdateParams() *cobra.Command {
func fromStrToStakeholders(s string) ([]*types.StakeHolders, error) {
stakeHolders := make([]*types.StakeHolders, 0)

s = strings.ReplaceAll(s, "_", "")

for _, stakeholder := range strings.Split(s, ",") {
parts := strings.Split(stakeholder, ":")
if len(parts) != 2 {
Expand Down
5 changes: 3 additions & 2 deletions x/manifest/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"context"
"fmt"

"github.com/liftedinit/manifest-ledger/x/manifest/types"

Expand Down Expand Up @@ -52,6 +51,8 @@ func NewKeeper(
mintKeeper: mintKeeper,
bankKeeper: bankKeeper,

authority: authority,

// Stores
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
}
Expand Down Expand Up @@ -167,7 +168,7 @@ func (k Keeper) BlockRewardsProvision(ctx context.Context, denom string) sdk.Coi

div := amtPerYear / blocksPerYear

fmt.Printf("amtPerYear: %d, blocksPerYear: %d. div: %d\n", amtPerYear, blocksPerYear, div)
k.logger.Debug("amtPerYear", "amt", amtPerYear, "blocksPerYear", blocksPerYear, "div", div)

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

0 comments on commit e056393

Please sign in to comment.