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

chore(upgrade): improve v14 migration tests and utilities #1834

Merged
merged 10 commits into from
Oct 10, 2023

Conversation

MalteHerrmann
Copy link
Contributor

Description

This PR extends the migration unit tests for the v14 upgrade by replicating the mainnet state as close as possible. Even though the v14.0.0 upgrade has already been concluded, these tests will help prepare the v14.1.0 release and have led to improvements in the migration functions.


Closes ENG-2132 and ENG-2128

@MalteHerrmann MalteHerrmann requested a review from a team as a code owner October 10, 2023 11:30
@linear
Copy link

linear bot commented Oct 10, 2023

ENG-2132 Cover mainnet state in migration unit tests

Context

One major problem (and now learning) was that the unit tests for the migration function did not fully replicate the mainnet state for the affected accounts. The big takeaway here is, that whenever something is targeting mainnet data, the unit tests should precisely model the way this data is stored on-chain and then do testing from there.

Expected

Improve the unit tests by replicating the state of the affected accounts at upgrade height.

ENG-2128 Improve Migration functions to not return on first error

When encountering an error during the migration of multisigs in the v14 release, the corresponding functions immediately return an error and abort the rest of the operations.

Expected

This should not return immediately but rather collect the errors and then return a joint error message afterwards.

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #1834 (e92adf2) into release/v14.0.x (8396d95) will decrease coverage by 0.02%.
The diff coverage is 45.45%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           release/v14.0.x    #1834      +/-   ##
===================================================
- Coverage            70.50%   70.49%   -0.02%     
===================================================
  Files                  313      313              
  Lines                23282    23302      +20     
===================================================
+ Hits                 16415    16426      +11     
- Misses                6044     6052       +8     
- Partials               823      824       +1     
Files Coverage Δ
app/upgrades/v14/migrations.go 56.32% <45.45%> (-0.40%) ⬇️

Copy link
Contributor

@GAtom22 GAtom22 left a comment

Choose a reason for hiding this comment

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

LGTM! Great work @MalteHerrmann!!

Please address the lint issues and conflicts

Copy link
Contributor

@0xstepit 0xstepit left a comment

Choose a reason for hiding this comment

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

LGTM also, great job @MalteHerrmann !

@MalteHerrmann MalteHerrmann merged commit 695d91a into release/v14.0.x Oct 10, 2023
22 of 23 checks passed
@MalteHerrmann MalteHerrmann deleted the malte/improve-migration-tests branch October 10, 2023 16:21
@MalteHerrmann
Copy link
Contributor Author

@Mergifyio backport release/v14.2.x

@mergify
Copy link
Contributor

mergify bot commented Oct 10, 2023

backport release/v14.2.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Oct 10, 2023
* commit WIP for migration tests

* commit WIP for creating zero token delegations

* finish mainnet state replication for tests

* add safety checks to migrations logic for bond denom and zero unbonding amount

* remove unnecessary pre-migration delegations entry

* fix amount of by using NewCoins to create coins structs

* log errors instead of aborting migration runs

* adjust changelog

* address linters

(cherry picked from commit 695d91a)
MalteHerrmann added a commit that referenced this pull request Oct 11, 2023
…1834) (#1837)

chore(upgrade): improve v14 migration tests and utilities (#1834)

* commit WIP for migration tests

* commit WIP for creating zero token delegations

* finish mainnet state replication for tests

* add safety checks to migrations logic for bond denom and zero unbonding amount

* remove unnecessary pre-migration delegations entry

* fix amount of by using NewCoins to create coins structs

* log errors instead of aborting migration runs

* adjust changelog

* address linters

(cherry picked from commit 695d91a)

Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
@MalteHerrmann
Copy link
Contributor Author

@Mergifyio backport main

@mergify
Copy link
Contributor

mergify bot commented Oct 12, 2023

backport main

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Oct 12, 2023
* commit WIP for migration tests

* commit WIP for creating zero token delegations

* finish mainnet state replication for tests

* add safety checks to migrations logic for bond denom and zero unbonding amount

* remove unnecessary pre-migration delegations entry

* fix amount of by using NewCoins to create coins structs

* log errors instead of aborting migration runs

* adjust changelog

* address linters

(cherry picked from commit 695d91a)

# Conflicts:
#	CHANGELOG.md
#	app/upgrades/v14/migrations.go
#	app/upgrades/v14/migrations_test.go
MalteHerrmann added a commit that referenced this pull request Oct 12, 2023
…1834) (#1855)

* chore(upgrade): improve v14 migration tests and utilities (#1834)

* commit WIP for migration tests

* commit WIP for creating zero token delegations

* finish mainnet state replication for tests

* add safety checks to migrations logic for bond denom and zero unbonding amount

* remove unnecessary pre-migration delegations entry

* fix amount of by using NewCoins to create coins structs

* log errors instead of aborting migration runs

* adjust changelog

* address linters

(cherry picked from commit 695d91a)

# Conflicts:
#	CHANGELOG.md
#	app/upgrades/v14/migrations.go
#	app/upgrades/v14/migrations_test.go

* fix merge conflicts

---------

Co-authored-by: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com>
Co-authored-by: MalteHerrmann <malte@evmos.org>
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.

None yet

3 participants