diff --git a/contracts/contracts/Poll.sol b/contracts/contracts/Poll.sol index 800d68adf2..d7f163df14 100644 --- a/contracts/contracts/Poll.sol +++ b/contracts/contracts/Poll.sol @@ -163,7 +163,7 @@ contract Poll is Params, Utilities, SnarkCommon, Ownable, EmptyBallotRoots, IPol } /// @inheritdoc IPoll - function publishMessage(Message calldata _message, PubKey calldata _encPubKey) public virtual isWithinVotingDeadline { + function publishMessage(Message memory _message, PubKey calldata _encPubKey) public virtual isWithinVotingDeadline { // we check that we do not exceed the max number of messages if (numMessages == maxValues.maxMessages) revert TooManyMessages(); @@ -177,6 +177,10 @@ contract Poll is Params, Utilities, SnarkCommon, Ownable, EmptyBallotRoots, IPol numMessages++; } + // we enforce that msgType here is 1 so we don't need checks + // at the circuit level + _message.msgType = 1; + uint256 messageLeaf = hashMessageAndEncPubKey(_message, _encPubKey); extContracts.messageAq.enqueue(messageLeaf); diff --git a/contracts/contracts/interfaces/IPoll.sol b/contracts/contracts/interfaces/IPoll.sol index c53e44dd28..4a3b1ac94b 100644 --- a/contracts/contracts/interfaces/IPoll.sol +++ b/contracts/contracts/interfaces/IPoll.sol @@ -25,7 +25,7 @@ interface IPoll { /// @param _encPubKey An epheremal public key which can be combined with the /// coordinator's private key to generate an ECDH shared key with which /// to encrypt the message. - function publishMessage(DomainObjs.Message calldata _message, DomainObjs.PubKey calldata _encPubKey) external; + function publishMessage(DomainObjs.Message memory _message, DomainObjs.PubKey calldata _encPubKey) external; /// @notice The first step of merging the MACI state AccQueue. This allows the /// ProcessMessages circuit to access the latest state tree and ballots via