HarryR / panautomata

Cross-chain proofs and atomic transactions
GNU General Public License v3.0
18 stars 2 forks source link

Lithium updates require consensus of nodes, rather than just one #20

Open HarryR opened 6 years ago

HarryR commented 6 years ago

So, having a single Lithium node which condenses the block chain into the merkle tree is insecure because if the single node gets compromised then any leaf can be added into the tree and all security or dependability is... gone.

One solution to this is to use a validator set, where N of M signatures are required to upload a new merkle root. This avoids the 'nominated leader' problem, where any one person can fake the root if they're nominated leader, e.g. with Paxos.

It works as such, each validator:

It's possible that this could be written as a Tendermint ABCI application, but the whole history isn't necessary, and that may over-complicate things? But it would be interesting to see how it works for Cosmos integration.

The validator set contract would be something like:

contract ValidatorSet {
    function GetAddress(uint idx) returns (address);
    function Exists(address) returns (bool);
    function GetCount() returns (uint);
    function GetThreshold() returns (uint);
    function Validate(uint8[] v, uint256[] r, uint256[] s, bytes32 message) returns (bool);
}

Iterate through using GetAddress for GetCount returns the address of each validator.

Providing Validate runs ecrecover for the message parameter, if any signatures aren't by a validator, it returns false. If the number of signatures is below the required threshold, it returns false.

Problems:

HarryR commented 6 years ago

The POA network has implemented something similar, however it's specific to tokens and transfer of value rather than general purpose automata. Either way, they have a validator set contract which has gone through a full audit which is worth reviewing.

See:

@rstormsf is the person behind some of bridge contract, thought it might be worth mentioning them here.

What I intend to do next is address all of the points in the bridge & relay contract audits, to ensure that all points are mitigated or avoided.