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

fix: panic on export zero-height because variable-length addresses #1015

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

dongsam
Copy link
Contributor

@dongsam dongsam commented Oct 7, 2021

Closes: #1014

Description

Panic occurs when gaia export --for-zero-height

addr := sdk.ValAddress(iter.Key()[1:])

because of current prepForZeroHeightGenesis function using addr := sdk.ValAddress(iter.Key()[1:]) to casting variable-length addresses,
It should be addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) to cover addresses of length > 20 bytes ADR-028

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 Oct 7, 2021

Codecov Report

Merging #1015 (88a8016) into main (913c020) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main    #1015   +/-   ##
=======================================
  Coverage   10.44%   10.44%           
=======================================
  Files          11       11           
  Lines        1082     1082           
=======================================
  Hits          113      113           
  Misses        964      964           
  Partials        5        5           

@okwme okwme marked this pull request as ready for review October 7, 2021 20:10
@okwme
Copy link
Contributor

okwme commented Oct 13, 2021

going to merge this as golangci-lint works locally

@okwme okwme merged commit f2183e1 into cosmos:main Oct 13, 2021
okwme added a commit that referenced this pull request Nov 4, 2021
* go version to 1.17

* Update go.mod

* dependency: bump ibc-go from v1.2.0 to v1.2.1

* cherry-pick: d76c62d, adding router module

* fix: add router module to upgrade handler

* fix: testnet cli command update genesis supply

* refactor!: drop support for command 'gaiad migrate'

* Update go.mod

* dependency: bump ibc-go from v1.2.0 to v1.2.1

* cherry-pick: d76c62d, adding router module

* fix: add router module to upgrade handler

* fix: testnet cli command update genesis supply

* refactor!: drop support for command 'gaiad migrate'

* fix: lint

* chore: bump sdk, run lint

* fix: panic on export zero-height because validator addr length parsing (#1015)

* update packet-forward-middleware

* chore: bump sdk

* build: bump liquidity from v1.4.0 to 1.4.1

* go mod tidy

* fix: golangci-lint version

* packet-forward-middleware version bump: v1.0.0

Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com>
Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
Co-authored-by: dongsam <dongsamb@gmail.com>
iloveanyujin added a commit to iloveanyujin/bcna that referenced this pull request Sep 6, 2022
If this is not implement, executing export with --for-zero-height will encounter error: "panic: expected validator, not found"

Credit: cosmos/gaia#1015
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.

Panic on export --for-zero-height
3 participants