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

fix(core): properly parse genesis alloc storage #2205

Merged
merged 3 commits into from
Feb 27, 2023

Conversation

Rjected
Copy link
Contributor

@Rjected Rjected commented Feb 27, 2023

Motivation

Previously we were not properly parsing the storage field of GenesisAlloc. The first issue was in using serde(flatten), which is just incorrect because storage is not encoded flattened. The second issue was in the parsing of H256 keys and values. Some of the storage values in hive genesis examples were encoded in less than 64 hex characters, such as the string 0x22. This would not succeed normal H256 parsing, but is consistent with JSON-RPC unformatted encoding.

Solution

  • Introduce from_unformatted_hex_map to properly deserialize the storage map.
  • Modify existing genesis parsing tests to check parsed storage and code values against expected values.
  • Introduce new genesis parsing test from the hive smoke tests, checking full struct equality.

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog
  • Breaking changes

 * Previously we were not properly parsing the storage field of
   GenesisAlloc. The first issue was in using serde(flatten), which is
   just incorrect because storage is not encoded flattened. The second
   issue was in the parsing of H256 keys and values. Some of the storage
   values in hive genesis examples were encoded in less than 64 hex
   characters, such as the string `0x12`. This would not succeed normal
   H256 parsing.
 * Introduce from_unformatted_hex_map to properly deserialize the
   storage map.
 * Modify existing genesis parsing tests to check parsed storage and
   code values against expected values.
 * Introduce new genesis parsing test from the hive smoke tests,
   checking full struct equality.
@gakonst gakonst merged commit 537d0a9 into gakonst:master Feb 27, 2023
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.

2 participants