Skip to content

Commit

Permalink
Merge pull request #103 from pgev/metablock-round
Browse files Browse the repository at this point in the history
Tracking metablocks' rounds in the Consensus contract.
  • Loading branch information
benjaminbollen authored Dec 19, 2019
2 parents 4dbc544 + 2c1c70b commit 86908bf
Show file tree
Hide file tree
Showing 37 changed files with 731 additions and 535 deletions.
2 changes: 1 addition & 1 deletion contracts/axiom/Axiom.sol
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ contract Axiom is AxiomI, ProxyFactory, ConsensusModule {
}

/**
* @notice Setup a new meta chain. Only technical governance address can
* @notice Setup a new metachain. Only technical governance address can
* call this function.
*/
function newMetaChain()
Expand Down
21 changes: 17 additions & 4 deletions contracts/committee/Committee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ contract Committee is MasterCopyNonUpgradable, ConsensusModule, CommitteeI {

/* Storage */

/** Metachain id of the meta-blockchain */
bytes32 public metachainId;

/** Committee size */
uint256 public committeeSize;

Expand Down Expand Up @@ -232,6 +235,7 @@ contract Committee is MasterCopyNonUpgradable, ConsensusModule, CommitteeI {
/* External functions */

function setup(
bytes32 _metachainId,
ConsensusI _consensus,
uint256 _committeeSize,
bytes32 _dislocation,
Expand All @@ -240,10 +244,15 @@ contract Committee is MasterCopyNonUpgradable, ConsensusModule, CommitteeI {
external
{
require(
committeeSize == 0 && proposal == bytes32(0),
metachainId == bytes32(0),
"Committee is already setup."
);

require(
_metachainId != bytes32(0),
"Metachain id is 0."
);

require(
_committeeSize >= 3,
"Committee size must not be smaller than three."
Expand All @@ -261,6 +270,8 @@ contract Committee is MasterCopyNonUpgradable, ConsensusModule, CommitteeI {

setupConsensus(_consensus);

metachainId = _metachainId;

committeeStatus = CommitteeStatus.Open;

// Initialize the members linked-list as the empty set.
Expand All @@ -272,9 +283,8 @@ contract Committee is MasterCopyNonUpgradable, ConsensusModule, CommitteeI {

proposal = _proposal;

// @qn (pro): In case of 7 quorum should be 4 or 5.
quorum = _committeeSize * COMMITTEE_SUPER_MAJORITY_NUMERATOR /
COMMITTEE_SUPER_MAJORITY_DENOMINATOR;
COMMITTEE_SUPER_MAJORITY_DENOMINATOR;
}

/**
Expand Down Expand Up @@ -572,7 +582,10 @@ contract Committee is MasterCopyNonUpgradable, ConsensusModule, CommitteeI {

if (committeeDecision == bytes32(0)) {
committeeDecision = _position;
consensus.registerCommitteeDecision(committeeDecision);
consensus.registerCommitteeDecision(
metachainId,
committeeDecision
);
}
}

Expand Down
Loading

0 comments on commit 86908bf

Please sign in to comment.