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

Added a nominal sum to every initial validator account #24

Closed vkomenda closed 5 years ago

vkomenda commented 5 years ago

This allows to run a Truffle migration where Truffle charges migration fees to the validator account. I added funds to every validator account because tests can be run from the perspective of any of those.

If this solution is too simplistic, the initial balances could be passed as arguments to make_spec.js, either from the environment or from a json config file.

varasev commented 5 years ago

Could you show me any code which uses truffle migration for any of our tests? So that I could understand what you're talking about.

vkomenda commented 5 years ago

@varasev, the code that uses the balance is in the PR that I referenced above: https://github.com/poanetwork/pos-test-setup/pull/10

afck commented 5 years ago

I'm not sure I fully understand this; let's just make sure we don't add code to the contracts that is meant for tests only and would break (also in the economical sense) a production network.

varasev commented 5 years ago

@vkomenda Yes, I saw that, thanks. But I still don't understand the aim of this. Do you want to run truffle unit tests of the contracts that way?

If so, you could just add the next command into the package.json in the pos-test-setup repo:

cd pos-contracts && npm i && npm run test && cd ..
vkomenda commented 5 years ago

Any modifications of the chain spec related to integration tests will be done outside this repo.

DemiMarie commented 5 years ago

@vkomenda @varasev @afck would it be possible to make the initial validator balance configurable when generating the chain spec? Also, my understanding is that we will be moving the tests from https://github.com/poanetwork/pos-test-setup to here, for maintainability reasons.

afck commented 5 years ago

I think the decision was to keep the repositories separate. Making the initial balance configurable sounds like a good idea to me. :+1:

varasev commented 5 years ago

We agreed that the repos should be separate and the balances can be changed in the generated spec.json by the scripts working in pos-test-setup if necessary. make_spec.js will also be used for production mode where the balances must be zero.