-
Notifications
You must be signed in to change notification settings - Fork 838
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
add: integration tests network suite #1728
Conversation
// bondedAmt is the amount of tokens that each validator will have initially bonded | ||
bondedAmt = sdktypes.TokensFromConsensusPower(1, types.PowerReduction) | ||
// PrefundedAccountInitialBalance is the amount of tokens that each prefunded account has at genesis | ||
PrefundedAccountInitialBalance = sdktypes.NewInt(int64(math.Pow10(18) * 4)) |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @facs95. Left some nits and typos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @facs95!!
Left some nit comments
} | ||
|
||
var gasLimit uint64 | ||
if txArgs.Gas == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should we add a flag to use the simulated gas?
Cause could be the case that we actually want to use a Gas = 0 in a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think carrying a separate flag would be more annoying than just put 1 everywhere we want to basically use no gas - or do you see a test case where it's necessary to specifically put 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - I wanted to avoid passing flags all around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'd remove the Cosmos logic (DoCosmosTx
, CosmosTxArgs
) since we will deprecate that logic in favor of the EVM Extensions.
Please also add the License comment on each file
Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
So we are not going to test modules through cosmos txs anymore? - Are we blocking all cosmos txs on the ante handler? @fedekunze. It might be sometime until we accomplish such migration, are you ok with maintaining this as we refractor the tests and then when that migration does happen we can remove the unnecessary helpers? Will add the licenses 👍 |
Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @facs95! absolutely love to see this.
I notice that there are no tests for these test utilities yet, I think it definitely would make sense to check if they are all working as expected.
// GetBaseFee returns the base fee from the feemarket module. | ||
func (gqh *IntegrationHandler) GetBaseFee() (*feemarkettypes.QueryBaseFeeResponse, error) { | ||
feeMarketClient := gqh.network.GetFeeMarketClient() | ||
return feeMarketClient.BaseFee(context.Background(), &feemarkettypes.QueryBaseFeeRequest{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we using an empty context here, and not gph.network.GetContext()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query simulates a user that is making a query from an external agent that has no access to the context.. the network conext is requested internally from the GetFeeMarketClient to simulate that grpc client
Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
@@ -93,6 +96,7 @@ func createEvmosApp(chainID string) *app.Evmos { | |||
) | |||
} | |||
|
|||
// createStakingValidator creates a staking validator from the given tm validator and bonded | |||
func createStakingValidator(val *tmtypes.Validator, amtOfBondedTokens sdkmath.Int) (stakingtypes.Validator, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func createStakingValidator(val *tmtypes.Validator, amtOfBondedTokens sdkmath.Int) (stakingtypes.Validator, error) { | |
func createStakingValidator(val *tmtypes.Validator, bondedAmt sdkmath.Int) (stakingtypes.Validator, error) { |
I would suggest to update this input name to be consistent with the function createStakingValidators
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @facs95 !
Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great work @facs95!! 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some more small nits - this is great, super excited to get it merged! 🚀
Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
https://github.com/Mergifyio backport release/v15.0.x |
✅ Backports have been created
|
* integration interface * grpc and factory packages * fix linter issues * Update testutil/integration/factory/factory.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * Update testutil/integration/factory/factory.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * Update testutil/integration/grpc/evm.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * Update testutil/integration/grpc/revenue.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * remove unnecesary comment * refractor based on comments * fix lint * Update testutil/integration/factory/factory.go Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com> * fix comment * add licenses * add changelog * Update CHANGELOG.md Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/helpers.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/grpc/grpc.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * review comments * add error wrappers * refractor executeCosmosTx function * keyring package * Update testutil/integration/network/setup.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * rename NextBlock * fix typos * unified slice allocation thorugh setup * add doc comments * add chainID checker * Update testutil/integration/network/abci.go Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com> * fix float arithmetic * fix licenses * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * rename var createStakingValidator --------- Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com> Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Co-authored-by: Tom <54514587+GAtom22@users.noreply.github.com> (cherry picked from commit 66eaddb) # Conflicts: # CHANGELOG.md
* add: integration tests network suite (#1728) * integration interface * grpc and factory packages * fix linter issues * Update testutil/integration/factory/factory.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * Update testutil/integration/factory/factory.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * Update testutil/integration/grpc/evm.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * Update testutil/integration/grpc/revenue.go Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> * remove unnecesary comment * refractor based on comments * fix lint * Update testutil/integration/factory/factory.go Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com> * fix comment * add licenses * add changelog * Update CHANGELOG.md Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/helpers.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/grpc/grpc.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * review comments * add error wrappers * refractor executeCosmosTx function * keyring package * Update testutil/integration/network/setup.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * rename NextBlock * fix typos * unified slice allocation thorugh setup * add doc comments * add chainID checker * Update testutil/integration/network/abci.go Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com> * fix float arithmetic * fix licenses * Update testutil/integration/factory/factory.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * Update testutil/integration/keyring/keyring.go Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> * rename var createStakingValidator --------- Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com> Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com> Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Co-authored-by: Tom <54514587+GAtom22@users.noreply.github.com> (cherry picked from commit 66eaddb) # Conflicts: # CHANGELOG.md * CHANGELOG * fix CHANGELOG --------- Co-authored-by: Freddy Caceres <facs95@gmail.com> Co-authored-by: Vlad <vladislav.varadinov@gmail.com>
Description
This PR aims to propose a new global integration tests network and helpers to be used across the whole repository. The idea behind is this is to improve the quality of our current integration tests by first having a centralized code within our testing suites for:
Based on a bunch issues that we have experienced with misleading tests, this new design aims to force developers to simulate a more realistic scenario when building integration tests. The PR is trying to achieve this by:
It will have to be expended as we start refractoring tests, what is included in the TxFactory and Grpc package specially is just an example of what I have identified will be needed for the first integration tests to be refractor.
This is just a first pass and a personal proposal, I expect this PR to be criticized and for it to be an active conversation so that when the PR gets merged we would have reached consensus on how we want integration tests to be built moving forward.