Skip to content

Commit

Permalink
fix(poll.sol,maci.sol): protect messageAq by nothing up my sleeve hash
Browse files Browse the repository at this point in the history
add nothing up my sleeve number into the leaf zero in message queue
  • Loading branch information
chaosma committed Sep 13, 2022
1 parent ee0c8a6 commit 04f21b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 0 additions & 5 deletions contracts/contracts/MACI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ contract MACI is IMACI, DomainObjs, Params, SnarkCommon, Ownable {
uint8 internal constant STATE_TREE_ARITY = 5;
uint8 internal constant MESSAGE_TREE_ARITY = 5;

// The Keccack256 hash of 'Maci'
uint256 internal constant NOTHING_UP_MY_SLEEVE =
uint256(
8370432830353022751713833565135785980866757267633941821328460903436894336785
);

//// The hash of a blank state leaf
uint256 internal constant BLANK_STATE_LEAF_HASH =
Expand Down
8 changes: 8 additions & 0 deletions contracts/contracts/Poll.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ contract PollFactory is
Hasher,
PollDeploymentParams
{

// The Keccack256 hash of 'Maci'
uint256 internal constant NOTHING_UP_MY_SLEEVE =
uint256(
8370432830353022751713833565135785980866757267633941821328460903436894336785
);

MessageAqFactory public messageAqFactory;

function setMessageAqFactory(MessageAqFactory _messageAqFactory)
Expand Down Expand Up @@ -91,6 +98,7 @@ contract PollFactory is
AccQueue messageAq = messageAqFactory.deploy(
_treeDepths.messageTreeSubDepth
);
messageAq.enqueue(NOTHING_UP_MY_SLEEVE);

ExtContracts memory extContracts;

Expand Down

0 comments on commit 04f21b3

Please sign in to comment.