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

genesis: Makes account balances format consistent across networks #73

Merged

Conversation

evertonfraga
Copy link
Contributor

@evertonfraga evertonfraga commented Nov 8, 2019

This PR converts all balances from decimal to hex. Ordering shouldn't matter and the diff got rather impossible to review manually — but the tests cover that.

I put this gist up for whoever wants to audit the process of data gathering and transformation. It was fun learning to use jq to manipulate json content 😄

To test:

  1. run npm run dist
  2. link/import this branch to ethereumjs-vm/node_modules/ethereumjs-common
  3. from ethereumjs-vm dir, run npm run build:dist && tape './tests/api/state/stateManager.js'

This test ensures genesis block hash matches state root for each chain (example).

Related: ethereumjs/ethereumjs-monorepo#589

Closes #35.

@evertonfraga evertonfraga self-assigned this Nov 8, 2019
@evertonfraga evertonfraga changed the title Makes genesis value formats consistent across networks genesis: Makes account balances format consistent across networks Nov 8, 2019
@evertonfraga
Copy link
Contributor Author

mind note: I should add conformance tests to ensure new files adhere to hex.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

This looks good, thanks very much Everton!

@@ -3,5 +3,5 @@
"0x0000000000000000000000000000000000000002": "0x1",
"0x0000000000000000000000000000000000000003": "0x1",
"0x0000000000000000000000000000000000000004": "0x1",
"0x00521965e7bd230323c423d96c657db5b79d099f": "1606938044258990275541962092341162602522202993782792835301376"
"0x00521965e7bd230323c423d96c657db5b79d099f": "0x100000000000000000000000000000000000000000000000000"
}
Copy link
Member

Choose a reason for hiding this comment

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

Ok.

Copy link
Member

Choose a reason for hiding this comment

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

mainnet file comment (no way to attach found due to file size):

Consistency checks, addition/deletion number stays the same, random value tests (full text searches), genesis block hash test execution from Everton.

Looks good.

"0x00000000000000000000000000000000000000fd": "0x0",
"0x00000000000000000000000000000000000000fe": "0x0",
"0x00000000000000000000000000000000000000ff": "0x0",
"0x874b54a8bd152966d63f706bae1ffeb0411921e5": "0xc9f2c9cd04674edea40000000"
}
Copy link
Member

Choose a reason for hiding this comment

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

Ok, number of "1" -> "0x1" balances stayed the same, single more funded account moved to bottom.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistent/unified value format on genesis file accounts
2 participants