Comments (6)
I think we should directly fix the addresses, should be doable with some clever search-and-replace.
from ethereumjs-common.
What is with the values, there is also some hex-decimal mix on this. Just have checked, at least this is consistent along a separate chain genesis file (e.g.
mainnet.json
). Would you also say that this is at least correctly working for now? My assumption without following the code paths is that non-prefixed values are regarded as being decimal?
Since no one uses the genesisStates files yet, it's hard to make a judgment about if the values are working correctly. It's really up to the user of the genesisStates to properly handle the mixed types. I think there can be three possible types for account balances:
- Number: This is a simple case where the value is obviously a decimal integer, but it can't be used for large numbers (more than 53 bits)
- String w/
0x
prefix: This is obviously a hex value and should be loaded with BN to hold the number value. This can be used for numbers larger than 53 bits. - String w/o
0x
prefix: This is the confusing case and should be avoided (in my opinion). It's unclear whether this is a raw string value (not possible for account balances), a number encoded in hex but with the0x
prefix missing, or a regular decimal number as a string (not hex-encoded).
Until we switch to TypeScript
, my preference would be to always use a 0x
prefix and hex encode numbers when they are encoded as string, or just use a plain number value (not a string).
from ethereumjs-common.
I think the real solution to this is really to stop this nonsense and be more strict in the utility functions in ethereumjs-util
and just throw on stuff like this on the next breaking release. Then people can handle things like that properly.
We should really put some dedicated thought into that, makes probably sense to do this along the TypeScript
transition (or directly before as a first and separate step).
from ethereumjs-common.
What is with the values, there is also some hex-decimal mix on this. Just have checked, at least this is consistent along a separate chain genesis file (e.g. mainnet.json
). Would you also say that this is at least correctly working for now? My assumption without following the code paths is that non-prefixed values are regarded as being decimal?
from ethereumjs-common.
I think the real solution to this is really to stop this nonsense and be more strict in the utility functions in
ethereumjs-util
and just throw on stuff like this on the next breaking release. Then people can handle things like that properly.We should really put some dedicated thought into that, makes probably sense to do this along the
TypeScript
transition (or directly before as a first and separate step).
Yes, totally agree. Great example of where TypeScript
can really help.
from ethereumjs-common.
Closed by #33.
from ethereumjs-common.
Related Issues (13)
- Remove Gas postfix in chainstart.js
- Add support for private networks HOT 3
- Support for new Goerli testnet HOT 4
- Consistent/unified value format on genesis file accounts
- Remove hybridCasper hardfork draft
- Updated pre-/post reentrency Constantinople support HOT 5
- This library is too restrictive for testing networks HOT 11
- Add Kovan hardfork blocks HOT 2
- forCustomChain is not a function HOT 1
- [Istanbul] EIP-1884: Trie-size-dependent Opcode Repricing > Price Parameters
- [Istanbul] EIP-2200: Rebalance net-metered SSTORE gas cost with consideration of SLOAD gas cost change HOT 1
- TypeError: Common is not a constructor HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ethereumjs-common.