Skip to content
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

Move Common Test Boilerplate out of Morpheus VM #1664

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

samliok
Copy link
Contributor

@samliok samliok commented Oct 15, 2024

Started writing e2e tests for the updated vmwithcontracts and noticed a bunch of common boilerplate code that should be separated out. I think this will also help make things clear for the larger e2e test refactor

PR also removes the tests package from vmwithcontracts since its the same as morpheus vm

Comment on lines 35 to 60
var (
_ workload.TxWorkloadFactory = (*workloadFactory)(nil)
_ workload.TxWorkloadIterator = (*simpleTxWorkload)(nil)
ed25519HexKeys = []string{
"323b1d8f4eed5f0da9da93071b034f2dce9d2d22692c172f3cb252a64ddfafd01b057de320297c29ad0c1f589ea216869cf1938d88c9fbd70d6748323dbf2fa7", //nolint:lll
"8a7be2e0c9a2d09ac2861c34326d6fe5a461d920ba9c2b345ae28e603d517df148735063f8d5d8ba79ea4668358943e5c80bc09e9b2b9a15b5b15db6c1862e88", //nolint:lll
}
ed25519PrivKeys = make([]ed25519.PrivateKey, len(ed25519HexKeys))
ed25519Addrs = make([]codec.Address, len(ed25519HexKeys))
ed25519AuthFactories = make([]*auth.ED25519Factory, len(ed25519HexKeys))
)

func init() {
for i, keyHex := range ed25519HexKeys {
privBytes, err := codec.LoadHex(keyHex, ed25519.PrivateKeyLen)
if err != nil {
panic(err)
}
priv := ed25519.PrivateKey(privBytes)
ed25519PrivKeys[i] = priv
ed25519AuthFactories[i] = auth.NewED25519Factory(priv)
addr := auth.NewED25519Address(priv.PublicKey())
ed25519Addrs[i] = addr
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this and the genesis configuration is an improvement imo. VM developers are probably going to be fine with these defaults, and if not we can expose a way for them to customize.

Still some more work to be done cleaning up the workloadfactory or removing it all together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant