poanetwork / posdao-contracts

Smart contracts for POSDAO (Proof of Stake Decentralized Autonomous Organization consensus), a DPOS consensus implemented in Solidity and running within EVM with swappable BFT consensus
Other
105 stars 49 forks source link

Fix initialization #16

Closed DemiMarie closed 5 years ago

DemiMarie commented 5 years ago

These changes allow the smart contracts to successfully initialize, and for the node to successfully boot.

DemiMarie commented 5 years ago

@vkomenda I thought the EVM guaranteed wrapping, but I could be wrong.

afck commented 5 years ago

There must be another way of dealing with non-existent elements

I think there really isn't: https://solidity.readthedocs.io/en/v0.4.21/types.html#mappings Conceptually, mappings are initialized so that all keys exist and have the default value. So a nonexistent element is indistinguishable from one that has been intentionally set to the default value.

vkomenda commented 5 years ago

@afck, thanks for the link. I concur. @DemiMarie, all I found about the integer overflow spec was an open issue: https://github.com/ethereum/solidity/issues/796 It might be difficult to implement against an evolving spec. So I'd assume implementations can diverge.