Skip to content

Commit

Permalink
test: fix denom
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Aug 24, 2024
1 parent 0412468 commit f533d72
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 98 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ start-localnet-ci: build
./build/atomoned genesis add-genesis-account val 10000000000000000000000000stake --home ~/.atomoned-liveness --keyring-backend test
./build/atomoned genesis gentx val 1000000000stake --home ~/.atomoned-liveness --chain-id liveness
./build/atomoned genesis collect-gentxs --home ~/.atomoned-liveness
sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0uatom"/' ~/.atomoned-liveness/config/app.toml
sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0uatone"/' ~/.atomoned-liveness/config/app.toml
./build/atomoned start --home ~/.atomoned-liveness --x-crisis-skip-assert-invariants

.PHONY: start-localnet-ci
Expand Down
2 changes: 1 addition & 1 deletion ante/gov_vote_ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

var (
minStakedTokens = sdk.NewDec(1000000) // 1_000_000 uatom (or 1 atom)
minStakedTokens = sdk.NewDec(1000000) // 1_000_000 uatone (or 1 atone)
maxDelegationsChecked = 100 // number of delegation to check for the minStakedTokens
)

Expand Down
16 changes: 8 additions & 8 deletions ante/gov_vote_ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ func TestVoteSpamDecoratorGovV1Beta1(t *testing.T) {
expectPass bool
}{
{
name: "delegate 0 atom",
name: "delegate 0 atone",
bondAmt: sdk.ZeroInt(),
validators: []sdk.ValAddress{valAddr1},
expectPass: false,
},
{
name: "delegate 0.1 atom",
name: "delegate 0.1 atone",
bondAmt: sdk.NewInt(100000),
validators: []sdk.ValAddress{valAddr1},
expectPass: false,
},
{
name: "delegate 1 atom",
name: "delegate 1 atone",
bondAmt: sdk.NewInt(1000000),
validators: []sdk.ValAddress{valAddr1},
expectPass: true,
Expand All @@ -90,7 +90,7 @@ func TestVoteSpamDecoratorGovV1Beta1(t *testing.T) {
expectPass: false,
},
{
name: "delegate 10 atom",
name: "delegate 10 atone",
bondAmt: sdk.NewInt(10000000),
validators: []sdk.ValAddress{valAddr1},
expectPass: true,
Expand Down Expand Up @@ -174,19 +174,19 @@ func TestVoteSpamDecoratorGovV1(t *testing.T) {
expectPass bool
}{
{
name: "delegate 0 atom",
name: "delegate 0 atone",
bondAmt: sdk.ZeroInt(),
validators: []sdk.ValAddress{valAddr1},
expectPass: false,
},
{
name: "delegate 0.1 atom",
name: "delegate 0.1 atone",
bondAmt: sdk.NewInt(100000),
validators: []sdk.ValAddress{valAddr1},
expectPass: false,
},
{
name: "delegate 1 atom",
name: "delegate 1 atone",
bondAmt: sdk.NewInt(1000000),
validators: []sdk.ValAddress{valAddr1},
expectPass: true,
Expand All @@ -204,7 +204,7 @@ func TestVoteSpamDecoratorGovV1(t *testing.T) {
expectPass: false,
},
{
name: "delegate 10 atom",
name: "delegate 10 atone",
bondAmt: sdk.NewInt(10000000),
validators: []sdk.ValAddress{valAddr1},
expectPass: true,
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func setup() (*atomoneapp.AtomOneApp, atomoneapp.GenesisState) {
db := dbm.NewMemDB()
appOptions := make(simtestutil.AppOptionsMap, 0)
appOptions[server.FlagInvCheckPeriod] = 5
appOptions[server.FlagMinGasPrices] = "0uatom"
appOptions[server.FlagMinGasPrices] = "0uatone"

encConfig := atomoneapp.RegisterEncodingConfig()

Expand Down
42 changes: 21 additions & 21 deletions tests/e2e/e2e_bank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ func (s *IntegrationTestSuite) testBankTokenTransfer() {
bob, _ := c.genesisAccounts[2].keyInfo.GetAddress()
charlie, _ := c.genesisAccounts[3].keyInfo.GetAddress()

var beforeAliceUAtomBalance,
beforeBobUAtomBalance,
beforeCharlieUAtomBalance,
afterAliceUAtomBalance,
afterBobUAtomBalance,
afterCharlieUAtomBalance sdk.Coin
var beforeAliceUAtoneBalance,
beforeBobUAtoneBalance,
beforeCharlieUAtoneBalance,
afterAliceUAtoneBalance,
afterBobUAtoneBalance,
afterCharlieUAtoneBalance sdk.Coin

// get balances of sender and recipient accounts
s.Require().Eventually(
func() bool {
beforeAliceUAtomBalance, err = getSpecificBalance(chainEndpoint, alice.String(), uatomDenom)
beforeAliceUAtoneBalance, err = getSpecificBalance(chainEndpoint, alice.String(), uatoneDenom)
s.Require().NoError(err)

beforeBobUAtomBalance, err = getSpecificBalance(chainEndpoint, bob.String(), uatomDenom)
beforeBobUAtoneBalance, err = getSpecificBalance(chainEndpoint, bob.String(), uatoneDenom)
s.Require().NoError(err)

beforeCharlieUAtomBalance, err = getSpecificBalance(chainEndpoint, charlie.String(), uatomDenom)
beforeCharlieUAtoneBalance, err = getSpecificBalance(chainEndpoint, charlie.String(), uatoneDenom)
s.Require().NoError(err)

return beforeAliceUAtomBalance.IsValid() && beforeBobUAtomBalance.IsValid() && beforeCharlieUAtomBalance.IsValid()
return beforeAliceUAtoneBalance.IsValid() && beforeBobUAtoneBalance.IsValid() && beforeCharlieUAtoneBalance.IsValid()
},
10*time.Second,
5*time.Second,
Expand All @@ -52,14 +52,14 @@ func (s *IntegrationTestSuite) testBankTokenTransfer() {
// check that the transfer was successful
s.Require().Eventually(
func() bool {
afterAliceUAtomBalance, err = getSpecificBalance(chainEndpoint, alice.String(), uatomDenom)
afterAliceUAtoneBalance, err = getSpecificBalance(chainEndpoint, alice.String(), uatoneDenom)
s.Require().NoError(err)

afterBobUAtomBalance, err = getSpecificBalance(chainEndpoint, bob.String(), uatomDenom)
afterBobUAtoneBalance, err = getSpecificBalance(chainEndpoint, bob.String(), uatoneDenom)
s.Require().NoError(err)

decremented := beforeAliceUAtomBalance.Sub(tokenAmount).Sub(standardFees).IsEqual(afterAliceUAtomBalance)
incremented := beforeBobUAtomBalance.Add(tokenAmount).IsEqual(afterBobUAtomBalance)
decremented := beforeAliceUAtoneBalance.Sub(tokenAmount).Sub(standardFees).IsEqual(afterAliceUAtoneBalance)
incremented := beforeBobUAtoneBalance.Add(tokenAmount).IsEqual(afterBobUAtoneBalance)

return decremented && incremented
},
Expand All @@ -68,26 +68,26 @@ func (s *IntegrationTestSuite) testBankTokenTransfer() {
)

// save the updated account balances of alice and bob
beforeAliceUAtomBalance, beforeBobUAtomBalance = afterAliceUAtomBalance, afterBobUAtomBalance
beforeAliceUAtoneBalance, beforeBobUAtoneBalance = afterAliceUAtoneBalance, afterBobUAtoneBalance

// alice sends tokens to bob and charlie, at once
s.execBankMultiSend(s.chainA, valIdx, alice.String(), []string{bob.String(), charlie.String()}, tokenAmount.String(), standardFees.String(), false)

s.Require().Eventually(
func() bool {
afterAliceUAtomBalance, err = getSpecificBalance(chainEndpoint, alice.String(), uatomDenom)
afterAliceUAtoneBalance, err = getSpecificBalance(chainEndpoint, alice.String(), uatoneDenom)
s.Require().NoError(err)

afterBobUAtomBalance, err = getSpecificBalance(chainEndpoint, bob.String(), uatomDenom)
afterBobUAtoneBalance, err = getSpecificBalance(chainEndpoint, bob.String(), uatoneDenom)
s.Require().NoError(err)

afterCharlieUAtomBalance, err = getSpecificBalance(chainEndpoint, charlie.String(), uatomDenom)
afterCharlieUAtoneBalance, err = getSpecificBalance(chainEndpoint, charlie.String(), uatoneDenom)
s.Require().NoError(err)

// assert alice's account gets decremented the amount of tokens twice
decremented := beforeAliceUAtomBalance.Sub(tokenAmount).Sub(tokenAmount).Sub(standardFees).IsEqual(afterAliceUAtomBalance)
incremented := beforeBobUAtomBalance.Add(tokenAmount).IsEqual(afterBobUAtomBalance) &&
beforeCharlieUAtomBalance.Add(tokenAmount).IsEqual(afterCharlieUAtomBalance)
decremented := beforeAliceUAtoneBalance.Sub(tokenAmount).Sub(tokenAmount).Sub(standardFees).IsEqual(afterAliceUAtoneBalance)
incremented := beforeBobUAtoneBalance.Add(tokenAmount).IsEqual(afterBobUAtoneBalance) &&
beforeCharlieUAtoneBalance.Add(tokenAmount).IsEqual(afterCharlieUAtoneBalance)

return decremented && incremented
},
Expand Down
18 changes: 9 additions & 9 deletions tests/e2e/e2e_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ func (s *IntegrationTestSuite) testDistribution() {
delegatorAddress, _ := s.chainA.genesisAccounts[2].keyInfo.GetAddress()

newWithdrawalAddress, _ := s.chainA.genesisAccounts[3].keyInfo.GetAddress()
fees := sdk.NewCoin(uatomDenom, sdk.NewInt(1000))
fees := sdk.NewCoin(uatoneDenom, sdk.NewInt(1000))

beforeBalance, err := getSpecificBalance(chainEndpoint, newWithdrawalAddress.String(), uatomDenom)
beforeBalance, err := getSpecificBalance(chainEndpoint, newWithdrawalAddress.String(), uatoneDenom)
s.Require().NoError(err)
if beforeBalance.IsNil() {
beforeBalance = sdk.NewCoin(uatomDenom, sdk.NewInt(0))
beforeBalance = sdk.NewCoin(uatoneDenom, sdk.NewInt(0))
}

s.execSetWithdrawAddress(s.chainA, 0, fees.String(), delegatorAddress.String(), newWithdrawalAddress.String(), atomoneHomePath)
Expand All @@ -43,7 +43,7 @@ func (s *IntegrationTestSuite) testDistribution() {
s.execWithdrawReward(s.chainA, 0, delegatorAddress.String(), valOperAddressA, atomoneHomePath)
s.Require().Eventually(
func() bool {
afterBalance, err := getSpecificBalance(chainEndpoint, newWithdrawalAddress.String(), uatomDenom)
afterBalance, err := getSpecificBalance(chainEndpoint, newWithdrawalAddress.String(), uatoneDenom)
s.Require().NoError(err)

return afterBalance.IsGTE(beforeBalance)
Expand All @@ -64,23 +64,23 @@ func (s *IntegrationTestSuite) fundCommunityPool() {
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
sender, _ := s.chainA.validators[0].keyInfo.GetAddress()

beforeDistUatomBalance, _ := getSpecificBalance(chainAAPIEndpoint, distModuleAddress, tokenAmount.Denom)
if beforeDistUatomBalance.IsNil() {
beforeDistUatoneBalance, _ := getSpecificBalance(chainAAPIEndpoint, distModuleAddress, tokenAmount.Denom)
if beforeDistUatoneBalance.IsNil() {
// Set balance to 0 if previous balance does not exist
beforeDistUatomBalance = sdk.NewInt64Coin(uatomDenom, 0)
beforeDistUatoneBalance = sdk.NewInt64Coin(uatoneDenom, 0)
}

s.execDistributionFundCommunityPool(s.chainA, 0, sender.String(), tokenAmount.String(), standardFees.String())

// there are still tokens being added to the community pool through block production rewards but they should be less than 500 tokens
marginOfErrorForBlockReward := sdk.NewInt64Coin(uatomDenom, 500)
marginOfErrorForBlockReward := sdk.NewInt64Coin(uatoneDenom, 500)

s.Require().Eventually(
func() bool {
afterDistPhotonBalance, err := getSpecificBalance(chainAAPIEndpoint, distModuleAddress, tokenAmount.Denom)
s.Require().NoErrorf(err, "Error getting balance: %s", afterDistPhotonBalance)

return afterDistPhotonBalance.Sub(beforeDistUatomBalance.Add(tokenAmount.Add(standardFees))).IsLT(marginOfErrorForBlockReward)
return afterDistPhotonBalance.Sub(beforeDistUatoneBalance.Add(tokenAmount.Add(standardFees))).IsLT(marginOfErrorForBlockReward)
},
15*time.Second,
5*time.Second,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/e2e_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ func (s *IntegrationTestSuite) getLatestBlockHeight(c *chain, valIdx int) int {
// func (s *IntegrationTestSuite) verifyBalanceChange(endpoint string, expectedAmount sdk.Coin, recipientAddress string) {
// s.Require().Eventually(
// func() bool {
// afterAtomBalance, err := getSpecificBalance(endpoint, recipientAddress, uatomDenom)
// afterAtomBalance, err := getSpecificBalance(endpoint, recipientAddress, uatoneDenom)
// s.Require().NoError(err)

// return afterAtomBalance.IsEqual(expectedAmount)
Expand Down Expand Up @@ -665,7 +665,7 @@ func (s *IntegrationTestSuite) execWithdrawReward(
"withdraw-rewards",
validatorAddress,
fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddress),
fmt.Sprintf("--%s=%s", flags.FlagGasPrices, "300uatom"),
fmt.Sprintf("--%s=%s", flags.FlagGasPrices, "300uatone"),
fmt.Sprintf("--%s=%s", flags.FlagGas, "auto"),
fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.5"),
fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id),
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/e2e_feegrant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (s *IntegrationTestSuite) testFeeGrant() {
withKeyValue(flagAllowedMessages, sdk.MsgTypeURL(&banktypes.MsgSend{})),
)

bobBalance, err := getSpecificBalance(api, bob.String(), uatomDenom)
bobBalance, err := getSpecificBalance(api, bob.String(), uatoneDenom)
s.Require().NoError(err)

// withdrawal all balance + fee + fee granter flag should succeed
Expand All @@ -56,7 +56,7 @@ func (s *IntegrationTestSuite) testFeeGrant() {

// check if the bob balance was subtracted without the fees
expectedBobBalance := bobBalance.Sub(tokenAmount)
bobBalance, err = getSpecificBalance(api, bob.String(), uatomDenom)
bobBalance, err = getSpecificBalance(api, bob.String(), uatoneDenom)
s.Require().NoError(err)
s.Require().Equal(expectedBobBalance, bobBalance)

Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ func (s *IntegrationTestSuite) GovCommunityPoolSpend() {
sender := senderAddress.String()
recipientAddress, _ := s.chainA.validators[1].keyInfo.GetAddress()
recipient := recipientAddress.String()
sendAmount := sdk.NewCoin(uatomDenom, sdk.NewInt(10000000)) // 10uatom
sendAmount := sdk.NewCoin(uatoneDenom, sdk.NewInt(10000000)) // 10uatone
s.writeGovCommunitySpendProposal(s.chainA, sendAmount, recipient)

beforeRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatomDenom)
beforeRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatoneDenom)
s.Require().NoError(err)

// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
Expand All @@ -135,7 +135,7 @@ func (s *IntegrationTestSuite) GovCommunityPoolSpend() {

s.Require().Eventually(
func() bool {
afterRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatomDenom)
afterRecipientBalance, err := getSpecificBalance(chainAAPIEndpoint, recipient, uatoneDenom)
s.Require().NoError(err)

return afterRecipientBalance.Sub(sendAmount).IsEqual(beforeRecipientBalance)
Expand All @@ -147,10 +147,10 @@ func (s *IntegrationTestSuite) GovCommunityPoolSpend() {

func (s *IntegrationTestSuite) submitLegacyGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string, withDeposit bool) {
s.T().Logf("Submitting Gov Proposal: %s", proposalType)
// min deposit of 1000uatom is required in e2e tests, otherwise the gov antehandler causes the proposal to be dropped
// min deposit of 1000uatone is required in e2e tests, otherwise the gov antehandler causes the proposal to be dropped
sflags := submitFlags
if withDeposit {
sflags = append(sflags, "--deposit=1000uatom")
sflags = append(sflags, "--deposit=1000uatone")
}
s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "submit-legacy-proposal", sflags, govtypesv1beta1.StatusDepositPeriod)
s.T().Logf("Depositing Gov Proposal: %s", proposalType)
Expand All @@ -162,7 +162,7 @@ func (s *IntegrationTestSuite) submitLegacyGovProposal(chainAAPIEndpoint, sender
// NOTE: in SDK >= v0.47 the submit-proposal does not have a --deposit flag
// Instead, the depoist is added to the "deposit" field of the proposal JSON (usually stored as a file)
// you can use `atomoned tx gov draft-proposal` to create a proposal file that you can use
// min initial deposit of 100uatom is required in e2e tests, otherwise the proposal would be dropped
// min initial deposit of 100uatone is required in e2e tests, otherwise the proposal would be dropped
func (s *IntegrationTestSuite) submitGovProposal(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string) {
s.T().Logf("Submitting Gov Proposal: %s", proposalType)
sflags := submitFlags
Expand Down
Loading

0 comments on commit f533d72

Please sign in to comment.