Skip to content

Commit

Permalink
change default bond denom to uluna
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun committed Sep 3, 2019
1 parent 4bab8f7 commit 7dffed5
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 35 deletions.
2 changes: 1 addition & 1 deletion cli_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This boilerplate above:
- Ensures the tests run in parallel. Because the tests are calling out to `os/exec` for many operations these tests can take a long time to run.
- Creates `.terrad` and `.terracli` folders in a new temp folder.
- Uses `terracli` to create 2 accounts for use in testing: `foo` and `bar`
- Creates a genesis file with coins (`1000footoken,1000feetoken,150stake`) controlled by the `foo` key
- Creates a genesis file with coins (`1000footoken,1000feetoken,150uluna`) controlled by the `foo` key
- Generates an initial bonding transaction (`gentx`) to make the `foo` key a validator at genesis
- Starts `terrad` and stops it once the test exits
- Cleans up test state on a successful run
Expand Down
4 changes: 2 additions & 2 deletions cli_test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func TestTerraCLICreateValidator(t *testing.T) {
require.NotZero(t, validatorDelegations[0].Shares)

// unbond a single share
unbondAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromConsensusPower(1))
unbondAmt := sdk.NewCoin(core.MicroLunaDenom, sdk.TokensFromConsensusPower(1))
success = f.TxStakingUnbond(keyBar, unbondAmt.String(), barVal, "-y")
require.True(t, success)
tests.WaitForNextNBlocksTM(1, f.Port)
Expand All @@ -441,7 +441,7 @@ func TestTerraCLIQueryRewards(t *testing.T) {
genesisState := f.GenesisState()
var distrData distr.GenesisState
cdc.UnmarshalJSON(genesisState[distr.ModuleName], &distrData)
distrData.FeePool.CommunityPool = sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdk.NewDec(1))}
distrData.FeePool.CommunityPool = sdk.DecCoins{sdk.NewDecCoinFromDec(core.MicroLunaDenom, sdk.NewDec(1))}
distrDataBz, err := cdc.MarshalJSON(distrData)
require.NoError(t, err)
genesisState[distr.ModuleName] = distrDataBz
Expand Down
4 changes: 2 additions & 2 deletions cli_test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
)

const (
denom = "stake"
denom = "uluna"
keyFoo = "foo"
keyBar = "bar"
fooDenom = "footoken"
Expand Down Expand Up @@ -225,7 +225,7 @@ func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, fl

// GenTx is terrad gentx
func (f *Fixtures) GenTx(name string, flags ...string) {
cmd := fmt.Sprintf("%s gentx --name=%s --home=%s --home-client=%s", f.TerradBinary, name, f.TerradHome, f.TerracliHome)
cmd := fmt.Sprintf("%s gentx --name=%s --home=%s --home-client=%s --amount 100000000uluna", f.TerradBinary, name, f.TerradHome, f.TerracliHome)
executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass)
}

Expand Down
20 changes: 10 additions & 10 deletions client/lcd/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2101,17 +2101,17 @@ definitions:
Address:
type: string
description: bech32 encoded address
example: cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27
example: terra1wg2mlrxdmnnkkykgqg4znky86nyrtc45q336yv
ValidatorAddress:
type: string
description: bech32 encoded address
example: cosmosvaloper16xyempempp92x9hyzz9wrgf94r6j9h5f2w4n2l
example: terravaloper1wg2mlrxdmnnkkykgqg4znky86nyrtc45q7a85l
Coin:
type: object
properties:
denom:
type: string
example: stake
example: uluna
amount:
type: string
example: "50"
Expand All @@ -2120,7 +2120,7 @@ definitions:
properties:
denom:
type: string
example: stake
example: uluna
amount:
type: string
example: "50.000"
Expand Down Expand Up @@ -2253,7 +2253,7 @@ definitions:
properties:
chain_id:
type: string
example: cosmoshub-2
example: columbus-3
height:
type: number
example: 1
Expand Down Expand Up @@ -2377,14 +2377,14 @@ definitions:
properties:
from:
type: string
example: "cosmos1g9ahr6xhht5rmqven628nklxluzyv8z9jqjcmc"
example: "terra1wg2mlrxdmnnkkykgqg4znky86nyrtc45q336yv"
description: Sender address or Keybase name to generate a transaction
memo:
type: string
example: "Sent via Cosmos Voyager 🚀"
example: "Sent via Terra Station 🚀"
chain_id:
type: string
example: "Cosmos-Hub"
example: "columbus-3"
account_number:
type: string
example: "0"
Expand Down Expand Up @@ -2412,7 +2412,7 @@ definitions:
$ref: "#/definitions/ValidatorAddress"
pub_key:
type: string
example: cosmosvalconspub1zcjduepq0vu2zgkgk49efa0nqwzndanq5m4c7pa3u4apz4g2r9gspqg6g9cs3k9cuf
example: terravalconspub1zcjduepq7mft6gfls57a0a42d7uhx656cckhfvtrlmw744jv4q0mvlv0dypskehfk8
voting_power:
type: string
example: "1000"
Expand Down Expand Up @@ -2491,7 +2491,7 @@ definitions:
$ref: "#/definitions/ValidatorAddress"
consensus_pubkey:
type: string
example: cosmosvalconspub1zcjduepq0vu2zgkgk49efa0nqwzndanq5m4c7pa3u4apz4g2r9gspqg6g9cs3k9cuf
example: terravalconspub1zcjduepq7mft6gfls57a0a42d7uhx656cckhfvtrlmw744jv4q0mvlv0dypskehfk8
jailed:
type: boolean
status:
Expand Down
9 changes: 5 additions & 4 deletions cmd/terrad/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/staking"

core "github.com/terra-project/core/types"
"github.com/terra-project/core/x/genaccounts"
tgenutil "github.com/terra-project/core/x/genutil"
)
Expand Down Expand Up @@ -93,8 +94,8 @@ Example:
cmd.Flags().String(
client.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(
server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom),
"Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)")
server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", core.MicroLunaDenom),
"Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001uluna)")
return cmd
}

Expand Down Expand Up @@ -201,15 +202,15 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec,
Address: addr,
Coins: sdk.Coins{
sdk.NewCoin(fmt.Sprintf("%stoken", nodeDirName), accTokens),
sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens),
sdk.NewCoin(core.MicroLunaDenom, accStakingTokens),
},
})

valTokens := sdk.TokensFromConsensusPower(100)
msg := staking.NewMsgCreateValidator(
sdk.ValAddress(addr),
valPubKeys[i],
sdk.NewCoin(sdk.DefaultBondDenom, valTokens),
sdk.NewCoin(core.MicroLunaDenom, valTokens),
staking.NewDescription(nodeDirName, "", "", ""),
staking.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
sdk.OneInt(),
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/terracli.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ terracli keys show p1p2p3 --show-multisig
The first step to create a multisig transaction is to initiate it on behalf of the multisig address created above:

```bash
terracli tx send terra1570v2fq3twt0f0x02vhxpuzc9jc4yl30q2qned 10stake \
terracli tx send terra1570v2fq3twt0f0x02vhxpuzc9jc4yl30q2qned uluna \
--from=<multisig_address> \
--generate-only > unsignedTx.json
```
Expand Down
10 changes: 5 additions & 5 deletions x/auth/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ func TestEnsureSufficientMempoolFees(t *testing.T) {
ctx := input.ctx.WithMinGasPrices(
sdk.DecCoins{
sdk.NewDecCoinFromDec("photino", sdk.NewDecWithPrec(50000000000000, sdk.Precision)), // 0.0001photino
sdk.NewDecCoinFromDec("stake", sdk.NewDecWithPrec(10000000000000, sdk.Precision)), // 0.000001stake
sdk.NewDecCoinFromDec("uluna", sdk.NewDecWithPrec(10000000000000, sdk.Precision)), // 0.000001uluna
},
)

Expand All @@ -749,15 +749,15 @@ func TestEnsureSufficientMempoolFees(t *testing.T) {
expectedOK bool
}{
{NewStdFee(200000, sdk.NewCoins(sdk.NewInt64Coin("photino", 5))), false},
{NewStdFee(200000, sdk.NewCoins(sdk.NewInt64Coin("stake", 1))), false},
{NewStdFee(200000, sdk.NewCoins(sdk.NewInt64Coin("stake", 2))), true},
{NewStdFee(200000, sdk.NewCoins(sdk.NewInt64Coin("uluna", 1))), false},
{NewStdFee(200000, sdk.NewCoins(sdk.NewInt64Coin("uluna", 2))), true},
{NewStdFee(200000, sdk.NewCoins(sdk.NewInt64Coin("photino", 10))), true},
{
NewStdFee(
200000,
sdk.NewCoins(
sdk.NewInt64Coin("photino", 10),
sdk.NewInt64Coin("stake", 2),
sdk.NewInt64Coin("uluna", 2),
),
),
true,
Expand All @@ -768,7 +768,7 @@ func TestEnsureSufficientMempoolFees(t *testing.T) {
sdk.NewCoins(
sdk.NewInt64Coin(core.MicroSDRDenom, 5),
sdk.NewInt64Coin("photino", 10),
sdk.NewInt64Coin("stake", 2),
sdk.NewInt64Coin("uluna", 2),
),
),
true,
Expand Down
8 changes: 7 additions & 1 deletion x/crisis/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

core "github.com/terra-project/core/types"
)

var (
Expand All @@ -37,7 +39,11 @@ func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {

// default genesis state
func (AppModuleBasic) DefaultGenesis() json.RawMessage {
return CosmosAppModuleBasic{}.DefaultGenesis()
// customize to set default genesis state constant fee denom to luna
defaultGenesisState := DefaultGenesisState()
defaultGenesisState.ConstantFee.Denom = core.MicroLunaDenom

return ModuleCdc.MustMarshalJSON(defaultGenesisState)
}

// module validate genesis
Expand Down
11 changes: 6 additions & 5 deletions x/genaccounts/genesis_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

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

core "github.com/terra-project/core/types"
"github.com/terra-project/core/x/auth"
"github.com/terra-project/core/x/supply"
)
Expand Down Expand Up @@ -39,8 +40,8 @@ func TestGenesisAccountValidate(t *testing.T) {
},
{
"invalid vesting amount",
NewGenesisAccountRaw(addr, sdk.NewCoins(sdk.NewInt64Coin("stake", 50)),
sdk.NewCoins(sdk.NewInt64Coin("stake", 100)), 0, 0, []auth.VestingSchedule{}, "", ""),
NewGenesisAccountRaw(addr, sdk.NewCoins(sdk.NewInt64Coin("uluna", 50)),
sdk.NewCoins(sdk.NewInt64Coin("uluna", 100)), 0, 0, []auth.VestingSchedule{}, "", ""),
errors.New("vesting amount cannot be greater than total amount"),
},
{
Expand All @@ -53,8 +54,8 @@ func TestGenesisAccountValidate(t *testing.T) {
},
{
"invalid vesting times",
NewGenesisAccountRaw(addr, sdk.NewCoins(sdk.NewInt64Coin("stake", 50)),
sdk.NewCoins(sdk.NewInt64Coin("stake", 50)), 1654668078, 1554668078, []auth.VestingSchedule{}, "", ""),
NewGenesisAccountRaw(addr, sdk.NewCoins(sdk.NewInt64Coin("uluna", 50)),
sdk.NewCoins(sdk.NewInt64Coin("uluna", 50)), 1654668078, 1554668078, []auth.VestingSchedule{}, "", ""),
errors.New("vesting start-time cannot be before end-time"),
},
{
Expand All @@ -77,7 +78,7 @@ func TestToAccount(t *testing.T) {

// base account
authAcc := auth.NewBaseAccountWithAddress(addr)
authAcc.SetCoins(sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 150)))
authAcc.SetCoins(sdk.NewCoins(sdk.NewInt64Coin(core.MicroLunaDenom, 150)))
genAcc := NewGenesisAccount(&authAcc)
acc := genAcc.ToAccount()
require.IsType(t, &auth.BaseAccount{}, acc)
Expand Down
8 changes: 5 additions & 3 deletions x/genaccounts/genesis_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"

core "github.com/terra-project/core/types"
"github.com/terra-project/core/x/auth"
)

Expand Down Expand Up @@ -51,7 +53,7 @@ var (
// require duplicate accounts fails validation
func TestValidateGenesisDuplicateAccounts(t *testing.T) {
acc1 := auth.NewBaseAccountWithAddress(sdk.AccAddress(addr1))
acc1.Coins = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 150))
acc1.Coins = sdk.NewCoins(sdk.NewInt64Coin(core.MicroLunaDenom, 150))

genAccs := make([]GenesisAccount, 2)
genAccs[0] = NewGenesisAccount(&acc1)
Expand All @@ -65,9 +67,9 @@ func TestValidateGenesisDuplicateAccounts(t *testing.T) {
// require invalid vesting account fails validation (invalid end time)
func TestValidateGenesisInvalidAccounts(t *testing.T) {
acc1 := auth.NewBaseAccountWithAddress(sdk.AccAddress(addr1))
acc1.Coins = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 150))
acc1.Coins = sdk.NewCoins(sdk.NewInt64Coin(core.MicroLunaDenom, 150))
acc2 := auth.NewBaseAccountWithAddress(sdk.AccAddress(addr2))
acc2.Coins = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 150))
acc2.Coins = sdk.NewCoins(sdk.NewInt64Coin(core.MicroLunaDenom, 150))

genAccs := make([]GenesisAccount, 2)
genAccs[0] = NewGenesisAccount(&acc1)
Expand Down
7 changes: 6 additions & 1 deletion x/staking/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

core "github.com/terra-project/core/types"
"github.com/terra-project/core/x/staking/internal/types"
)

Expand All @@ -43,7 +44,11 @@ func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {

// default genesis state
func (AppModuleBasic) DefaultGenesis() json.RawMessage {
return CosmosAppModuleBasic{}.DefaultGenesis()
// customize to set default genesis state bond denom to luna
defaultGenesisState := DefaultGenesisState()
defaultGenesisState.Params.BondDenom = core.MicroLunaDenom

return ModuleCdc.MustMarshalJSON(defaultGenesisState)
}

// module validate genesis
Expand Down

0 comments on commit 7dffed5

Please sign in to comment.