Use alnt as native token
Some checks failed
Integration Tests / test-integration (pull_request) Failing after 1m8s
E2E Tests / test-e2e (pull_request) Failing after 1m25s
Unit Tests / test-unit (pull_request) Successful in 1m8s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 5m32s
SDK Tests / sdk_tests_authority_auctions (pull_request) Successful in 11m8s
SDK Tests / sdk_tests (pull_request) Failing after 14m57s

This commit is contained in:
Prathamesh Musale 2025-05-13 15:29:10 +05:30
parent 0615e653f1
commit c0b51ec978
7 changed files with 35 additions and 34 deletions

View File

@ -25,10 +25,10 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins,
feeCoins := feeTx.GetFee() feeCoins := feeTx.GetFee()
gas := feeTx.GetGas() gas := feeTx.GetGas()
// Only allow alps | lps as a fee token // Only allow alnt as a fee token
for _, coin := range feeCoins { for _, coin := range feeCoins {
if coin.Denom != params.BaseCoinUnit && coin.Denom != params.CoinUnit { if coin.Denom != params.CoinUnit {
return nil, 0, errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid fee denom %s, only %s or %s are accepted", coin.Denom, params.BaseCoinUnit, params.CoinUnit) return nil, 0, errorsmod.Wrapf(sdkerrors.ErrInvalidCoins, "invalid fee denom %s, only %s is accepted", coin.Denom, params.CoinUnit)
} }
} }

View File

@ -10,12 +10,15 @@ import (
) )
const ( const (
CoinUnit = "lps" // Registered token
BaseCoinUnit = "alps" LpsCoinUnit = "lps"
LpsExponent = 18 LpsBaseCoinUnit = "alps"
LpsExponent = 18
LstakeCoinUnit = "lstake" // Native token, only denominated in alnt
DefaultBondDenom = LstakeCoinUnit // Used for staking, fees and laconic module ops
CoinUnit = "alnt"
DefaultBondDenom = CoinUnit
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address. // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address.
Bech32PrefixAccAddr = "laconic" Bech32PrefixAccAddr = "laconic"
@ -40,11 +43,11 @@ func init() {
} }
func RegisterDenoms() { func RegisterDenoms() {
err := sdk.RegisterDenom(CoinUnit, math.LegacyOneDec()) err := sdk.RegisterDenom(LpsCoinUnit, math.LegacyOneDec())
if err != nil { if err != nil {
panic(err) panic(err)
} }
err = sdk.RegisterDenom(BaseCoinUnit, math.LegacyNewDecWithPrec(1, LpsExponent)) err = sdk.RegisterDenom(LpsBaseCoinUnit, math.LegacyNewDecWithPrec(1, LpsExponent))
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -100,7 +100,7 @@ func NewRootCmd() *cobra.Command {
// overwrite the minimum gas price from the app configuration // overwrite the minimum gas price from the app configuration
srvCfg := serverconfig.DefaultConfig() srvCfg := serverconfig.DefaultConfig()
srvCfg.MinGasPrices = fmt.Sprintf("0%s", params.BaseCoinUnit) srvCfg.MinGasPrices = fmt.Sprintf("0%s", params.CoinUnit)
// overwrite the block timeout // overwrite the block timeout
cmtCfg := cmtcfg.DefaultConfig() cmtCfg := cmtcfg.DefaultConfig()

View File

@ -6,10 +6,11 @@ KEY="alice"
CHAINID=${CHAINID:-"laconic_9000-1"} CHAINID=${CHAINID:-"laconic_9000-1"}
MONIKER=${MONIKER:-"localtestnet"} MONIKER=${MONIKER:-"localtestnet"}
KEYRING=${KEYRING:-"test"} KEYRING=${KEYRING:-"test"}
DENOM=${DENOM:-"alps"} ALPS_DENOM=${ALPS_DENOM:-"alps"}
BALANCE=${BALANCE:-"1000000000000000000000000000000"} # 10^32 alps | 10^12 lps ALPS_BALANCE=${ALPS_BALANCE:-"1000000000000000000000000000000"} # 10^32 alps | 10^12 lps
STAKING_DENOM=${STAKING_DENOM:-"lstake"} DENOM=${DENOM:-"alnt"}
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"} # 10^15 lstake BALANCE=${BALANCE:-"1000000000000000000000000000000"} # 10^32 alnt
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"} # 10^15 alnt
MIN_GAS_PRICE=${MIN_GAS_PRICE:-"0.001"} MIN_GAS_PRICE=${MIN_GAS_PRICE:-"0.001"}
LOGLEVEL=${LOGLEVEL:-"info"} LOGLEVEL=${LOGLEVEL:-"info"}
@ -98,10 +99,7 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data" ]; then
# Set gas limit in genesis # Set gas limit in genesis
update_genesis '.consensus["params"]["block"]["max_gas"]="10000000"' update_genesis '.consensus["params"]["block"]["max_gas"]="10000000"'
# Disable bank transfers for the staking token (lstake) update_genesis ".app_state[\"staking\"][\"params\"][\"bond_denom\"]=\"$DENOM\""
update_genesis ".app_state[\"bank\"][\"send_enabled\"] += [{\"denom\": \"$STAKING_DENOM\", \"enabled\": false}]"
update_genesis ".app_state[\"staking\"][\"params\"][\"bond_denom\"]=\"$STAKING_DENOM\""
# disable produce empty block # disable produce empty block
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
@ -125,10 +123,10 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data" ]; then
fi fi
# Allocate genesis accounts (cosmos formatted addresses) # Allocate genesis accounts (cosmos formatted addresses)
laconicd genesis add-genesis-account $KEY $BALANCE$DENOM,$STAKING_AMOUNT$STAKING_DENOM --keyring-backend $KEYRING laconicd genesis add-genesis-account $KEY $ALPS_BALANCE$ALPS_DENOM,$BALANCE$DENOM --keyring-backend $KEYRING
# Sign genesis transaction # Sign genesis transaction
laconicd genesis gentx $KEY $STAKING_AMOUNT$STAKING_DENOM --keyring-backend $KEYRING --chain-id $CHAINID laconicd genesis gentx $KEY $STAKING_AMOUNT$DENOM --keyring-backend $KEYRING --chain-id $CHAINID
# Collect genesis tx # Collect genesis tx
laconicd genesis collect-gentxs laconicd genesis collect-gentxs

View File

@ -10,7 +10,7 @@ import (
) )
// DefaultMaxBondAmountTokens are the default parameter values. // DefaultMaxBondAmountTokens are the default parameter values.
var DefaultMaxBondAmountTokens = sdkmath.NewInt(1000000000000) // 10^12 alps var DefaultMaxBondAmountTokens = sdkmath.NewInt(1000000000000) // 10^12
func NewParams(maxBondAmount sdk.Coin) Params { func NewParams(maxBondAmount sdk.Coin) Params {
return Params{MaxBondAmount: maxBondAmount} return Params{MaxBondAmount: maxBondAmount}
@ -18,7 +18,7 @@ func NewParams(maxBondAmount sdk.Coin) Params {
// DefaultParams returns default module parameters // DefaultParams returns default module parameters
func DefaultParams() Params { func DefaultParams() Params {
return NewParams(sdk.NewCoin(params.BaseCoinUnit, DefaultMaxBondAmountTokens)) return NewParams(sdk.NewCoin(params.CoinUnit, DefaultMaxBondAmountTokens))
} }
// Validate checks that the parameters have valid values // Validate checks that the parameters have valid values

View File

@ -296,7 +296,7 @@ func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRo
moduleParams.AuthorityAuctionCommitFee, moduleParams.AuthorityAuctionCommitFee,
moduleParams.AuthorityAuctionRevealFee, moduleParams.AuthorityAuctionRevealFee,
moduleParams.AuthorityAuctionMinimumBid, moduleParams.AuthorityAuctionMinimumBid,
sdk.NewCoin(params.BaseCoinUnit, math.NewInt(0)), sdk.NewCoin(params.CoinUnit, math.NewInt(0)),
0, 0,
ownerAddress, ownerAddress,
) )

View File

@ -13,21 +13,21 @@ import (
// Default parameter values. // Default parameter values.
var ( var (
// DefaultRecordRent is the default record rent for 1 time period (see expiry time). // DefaultRecordRent is the default record rent for 1 time period (see expiry time).
DefaultRecordRent = sdkmath.NewInt(1000000) // 10^6 alps DefaultRecordRent = sdkmath.NewInt(1000000) // 10^6
// DefaultRecordExpiryTime is the default record expiry time (1 year). // DefaultRecordExpiryTime is the default record expiry time (1 year).
DefaultRecordExpiryTime = time.Hour * 24 * 365 DefaultRecordExpiryTime = time.Hour * 24 * 365
DefaultAuthorityRent = sdkmath.NewInt(1000000) // 10^6 alps DefaultAuthorityRent = sdkmath.NewInt(1000000) // 10^6
DefaultAuthorityExpiryTime = time.Hour * 24 * 365 DefaultAuthorityExpiryTime = time.Hour * 24 * 365
DefaultAuthorityGracePeriod = time.Hour * 24 * 2 DefaultAuthorityGracePeriod = time.Hour * 24 * 2
DefaultAuthorityAuctionEnabled = false DefaultAuthorityAuctionEnabled = false
DefaultCommitsDuration = time.Hour * 24 DefaultCommitsDuration = time.Hour * 24
DefaultRevealsDuration = time.Hour * 24 DefaultRevealsDuration = time.Hour * 24
DefaultCommitFee = sdkmath.NewInt(1000000) // 10^6 alps DefaultCommitFee = sdkmath.NewInt(1000000) // 10^6
DefaultRevealFee = sdkmath.NewInt(1000000) // 10^6 alps DefaultRevealFee = sdkmath.NewInt(1000000) // 10^6
DefaultMinimumBid = sdkmath.NewInt(5000000) // 5 * 10^6 alps DefaultMinimumBid = sdkmath.NewInt(5000000) // 5 * 10^6
) )
// NewParams creates a new Params instance // NewParams creates a new Params instance
@ -62,13 +62,13 @@ func NewParams(
// DefaultParams returns a default set of parameters. // DefaultParams returns a default set of parameters.
func DefaultParams() Params { func DefaultParams() Params {
return NewParams( return NewParams(
sdk.NewCoin(params.BaseCoinUnit, DefaultRecordRent), DefaultRecordExpiryTime, sdk.NewCoin(params.CoinUnit, DefaultRecordRent), DefaultRecordExpiryTime,
sdk.NewCoin(params.BaseCoinUnit, DefaultAuthorityRent), sdk.NewCoin(params.CoinUnit, DefaultAuthorityRent),
DefaultAuthorityExpiryTime, DefaultAuthorityGracePeriod, DefaultAuthorityAuctionEnabled, DefaultCommitsDuration, DefaultAuthorityExpiryTime, DefaultAuthorityGracePeriod, DefaultAuthorityAuctionEnabled, DefaultCommitsDuration,
DefaultRevealsDuration, DefaultRevealsDuration,
sdk.NewCoin(params.BaseCoinUnit, DefaultCommitFee), sdk.NewCoin(params.CoinUnit, DefaultCommitFee),
sdk.NewCoin(params.BaseCoinUnit, DefaultRevealFee), sdk.NewCoin(params.CoinUnit, DefaultRevealFee),
sdk.NewCoin(params.BaseCoinUnit, DefaultMinimumBid), sdk.NewCoin(params.CoinUnit, DefaultMinimumBid),
) )
} }