Skip to content

fixes e2e #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions cmd/atomoned/cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cmd

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
Bech32PrefixAccAddr = "atone"

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
)

var (
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key.
Bech32PrefixAccPub = Bech32PrefixAccAddr + "pub"

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address.
Bech32PrefixValAddr = Bech32PrefixAccAddr + "valoper"

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key.
Bech32PrefixValPub = Bech32PrefixAccAddr + "valoperpub"

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address.
Bech32PrefixConsAddr = Bech32PrefixAccAddr + "valcons"

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key.
Bech32PrefixConsPub = Bech32PrefixAccAddr + "valconspub"

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
)

func InitSDKConfig() {
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
cfg.Seal()
}
23 changes: 1 addition & 22 deletions cmd/atomoned/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,29 +123,8 @@ func initAppConfig() (string, interface{}) {
return defaultAppTemplate, customAppConfig
}

const (
Bech32PrefixAccAddr = "atone"
)

var (
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key.
Bech32PrefixAccPub = Bech32PrefixAccAddr + "pub"
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address.
Bech32PrefixValAddr = Bech32PrefixAccAddr + "valoper"
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key.
Bech32PrefixValPub = Bech32PrefixAccAddr + "valoperpub"
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address.
Bech32PrefixConsAddr = Bech32PrefixAccAddr + "valcons"
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key.
Bech32PrefixConsPub = Bech32PrefixAccAddr + "valconspub"
)

func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
cfg.Seal()
InitSDKConfig()

ac := appCreator{encodingConfig}

Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/e2e_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
)

func (s *IntegrationTestSuite) testDistribution() {
Expand Down Expand Up @@ -61,6 +63,8 @@ Test Benchmarks:
3. Verification that correct funds have been deposited to distribution module account
*/
func (s *IntegrationTestSuite) fundCommunityPool() {
distModuleAddress := authtypes.NewModuleAddress(distrtypes.ModuleName).String()

chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
sender, _ := s.chainA.validators[0].keyInfo.GetAddress()

Expand Down
15 changes: 9 additions & 6 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (
"testing"
"time"

"github.com/atomone-hub/atomone/cmd/atomoned/cmd"
"github.com/ory/dockertest/v3"

// "github.com/cosmos/cosmos-sdk/crypto/hd"
// "github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/ory/dockertest/v3/docker"
Expand All @@ -34,7 +36,6 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
Expand Down Expand Up @@ -74,11 +75,9 @@ var (
atomoneConfigPath = filepath.Join(atomoneHomePath, "config")
stakingAmount = sdk.NewInt(100000000000)
stakingAmountCoin = sdk.NewCoin(uatoneDenom, stakingAmount)
tokenAmount = sdk.NewCoin(uatoneDenom, sdk.NewInt(3300000000)) // 3,300uatone
standardFees = sdk.NewCoin(uatoneDenom, sdk.NewInt(330000)) // 0.33uatone
depositAmount = sdk.NewCoin(uatoneDenom, sdk.NewInt(330000000)) // 3,300uatone
distModuleAddress = authtypes.NewModuleAddress(distrtypes.ModuleName).String()
govModuleAddress = authtypes.NewModuleAddress(govtypes.ModuleName).String()
tokenAmount = sdk.NewCoin(uatoneDenom, sdk.NewInt(3300000000)) // 3,300uatom
standardFees = sdk.NewCoin(uatoneDenom, sdk.NewInt(330000)) // 0.33uatom
depositAmount = sdk.NewCoin(uatoneDenom, sdk.NewInt(330000000)) // 3,300uatom
proposalCounter = 0
)

Expand All @@ -103,6 +102,8 @@ type AddressResponse struct {
}

func TestIntegrationTestSuite(t *testing.T) {
// Setup bech32 prefix
cmd.InitSDKConfig()
suite.Run(t, new(IntegrationTestSuite))
}

Expand Down Expand Up @@ -581,6 +582,8 @@ func noRestart(config *docker.HostConfig) {
}

func (s *IntegrationTestSuite) writeGovCommunitySpendProposal(c *chain, amount sdk.Coin, recipient string) {
govModuleAddress := authtypes.NewModuleAddress(govtypes.ModuleName).String()

template := `
{
"messages":[
Expand Down
Loading