Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix: simulations don't generate EVM transactions #996

Merged
merged 65 commits into from
Apr 19, 2022

Conversation

adu-web3
Copy link
Contributor

Closes: #658

Description

Now the evm module doesn't generate random evm txs for the application simulation.

Generally speaking, we should implement the method WeightedOperations for x/evm module by generating random EthereumTx messages so that we can apply random evm txs to the module when we call the SimulateFromSeed. When implementing WeightedOperations, we can retrieve previous random EthAccount from auth module's AccoutKeeper.

By default, auth module will only generate genesis base accounts and vesting accounts in simulation. But we can pass in custom RandomGenesisAccounts when initializing the application's SimulationManager so that we can generate genesis EthAccount and other account types for simulation.

app.sm = module.NewSimulationManager(
		// auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts),
		auth.NewAppModule(appCodec, app.AccountKeeper, RandomGenesisAccounts),
...

For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Mar 16, 2022

Codecov Report

Merging #996 (27879c4) into main (7e35906) will decrease coverage by 0.16%.
The diff coverage is 36.08%.

❗ Current head 27879c4 differs from pull request most recent head 29cc44b. Consider uploading reports for the commit 29cc44b to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #996      +/-   ##
==========================================
- Coverage   60.93%   60.77%   -0.17%     
==========================================
  Files          80       80              
  Lines        6594     6666      +72     
==========================================
+ Hits         4018     4051      +33     
- Misses       2365     2404      +39     
  Partials      211      211              
Impacted Files Coverage Δ
x/evm/module.go 53.73% <33.33%> (-0.96%) ⬇️
app/utils.go 34.83% <34.83%> (ø)
app/app.go 85.52% <100.00%> (+0.03%) ⬆️

@lgtm-com
Copy link

lgtm-com bot commented Mar 20, 2022

This pull request introduces 1 alert when merging 0d2afd0 into edf4569 - view on LGTM.com

new alerts:

  • 1 for Self assignment

@adu-web3 adu-web3 marked this pull request as ready for review March 30, 2022 06:51
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

First pass

app/app.go Outdated Show resolved Hide resolved
app/test_helpers.go Outdated Show resolved Hide resolved
app/test_helpers.go Outdated Show resolved Hide resolved
app/test_helpers.go Outdated Show resolved Hide resolved
app/test_helpers.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
adu-web3 and others added 5 commits March 30, 2022 16:18
Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Federico Kunze Küllmer <[email protected]>
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

@Muggle-Du can you fix the linter and build errors?

@adu-web3
Copy link
Contributor Author

@Muggle-Du can you fix the linter and build errors?

Sure, fixed

Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. Added more comments. Currently missing:

  • Features changelog entry
  • tests for the new Random... functions
  • tests for the simulation package functions, specially decoder
  • update Github actions to run the simulation
  • define RandomizedParams in x/evm/module.go
  • update godoc comments

x/evm/module.go Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/operations.go Outdated Show resolved Hide resolved
x/evm/simulation/genesis.go Outdated Show resolved Hide resolved
x/evm/simulation/genesis.go Outdated Show resolved Hide resolved
x/evm/simulation/genesis.go Outdated Show resolved Hide resolved
app/utils.go Outdated Show resolved Hide resolved
app/utils.go Outdated Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

simulations don't generate EVM transactions
3 participants