poanetwork / parity-ethereum

Fast, light, robust Ethereum implementation.
https://parity.io
Other
10 stars 12 forks source link

Introduce the `multi` option for the BlockReward contract #144

Closed varasev closed 5 years ago

varasev commented 5 years ago

In order to migrate xDai network to the POSDAO model we need to have the multi option for the BlockReward contract as for the ValidatorSet.

At the moment we only have the blockRewardContractTransition option which has already been used: https://github.com/poanetwork/poa-chain-spec/blob/ef056eeb6412212bb183dd8ce361d80f650fccd7/spec.json#L21

In addition to the blockRewardContractAddress and blockRewardContractTransition I suppose to have an extra blockRewardContractTransitions option in the following format:

    "blockRewardContractTransitions": {
        "1310": "0x867305d19606aadba405ce534e303d0e225f9556",
        "1500": "0x1234567890abcdef1234567890abcdef12345678"
    }
vkomenda commented 5 years ago

Should the code of the block reward contract remain the same for every block reward contract address?

varasev commented 5 years ago

Should the code of the block reward contract remain the same for every block reward contract address?

The code can be completely different, but the ABI will always be the same.

vkomenda commented 5 years ago

OK. I asked because we do have the contract code config option. Maybe instead of several addresses and one contract code we should provide several pairs of address and code?

varasev commented 5 years ago

You mean the blockRewardContractCode option? Unfortunately, the code passed to that option can only be pure (can't work with contract's storage). We just need to have BlockReward address switching like for the ValidatorSet. The ABI interface for a new contract is assumed to be the same (i.e. the contract will still have the reward function but probably with another code).

vkomenda commented 5 years ago

Yes, I meant that option. I'll leave one code for all addresses then.

varasev commented 5 years ago

I'll leave one code for all addresses then.

You mean ABI, not code I guess :)

The code can be different - this is the main meaning of this issue.

vkomenda commented 5 years ago

Well, this is what the config option is called in the code: block_reward_contract_code. I guess it's a misnomer then and should have been called block_reward_contract_abi?

varasev commented 5 years ago

No, we shouldn't touch the blockRewardContractCode option (we won't use that): see the description of the blockRewardContractCode here: https://wiki.parity.io/Pluggable-Consensus.html?q=blockRewardContractCode#aura

vkomenda commented 5 years ago

I had to refactor the contract code option but I kept the old overriding behaviour. So it should work as before.

varasev commented 5 years ago

Yes, OK.

varasev commented 5 years ago

Should the code of the block reward contract remain the same for every block reward contract address?

Sorry, misunderstood you initially. Yes, the blockRewardContractCode option should have the same behavior as before.

varasev commented 5 years ago

Done in https://github.com/poanetwork/parity-ethereum/pull/145.