Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contracts): relay messages #2002

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

feat(contracts): relay messages #2002

wants to merge 1 commit into from

Conversation

0xmad
Copy link
Collaborator

@0xmad 0xmad commented Jan 14, 2025

Description

  • Add relay messages method to Poll contract
  • Use struct for deploy poll args
  • Add relayer addresses to Poll contract

Additional Notes

This is a part of happy offchain path

Related issue(s)

Related to privacy-scaling-explorations/maci-platform#279

Confirmation

Important

We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.

@0xmad 0xmad added the enhancement New feature or request label Jan 14, 2025
@0xmad 0xmad self-assigned this Jan 14, 2025
Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
maci-website ✅ Ready (Inspect) Visit Preview Jan 14, 2025 11:11pm

packages/contracts/contracts/Poll.sol Dismissed Show dismissed Hide dismissed
packages/contracts/contracts/Poll.sol Dismissed Show dismissed Hide dismissed
packages/contracts/contracts/PollFactory.sol Dismissed Show dismissed Hide dismissed
packages/contracts/contracts/PollFactory.sol Dismissed Show dismissed Hide dismissed
- [x] Add relay messages method to Poll contract
- [x] Use struct for deploy poll args
- [x] Add relayer addresses to Poll contract
@0xmad 0xmad force-pushed the feature/relayer-publish branch from abc2739 to 716681f Compare January 14, 2025 23:08
@0xmad 0xmad marked this pull request as ready for review January 14, 2025 23:21
@0xmad 0xmad enabled auto-merge January 14, 2025 23:21
Copy link
Collaborator

@ctrlc03 ctrlc03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, left some comments

/// @notice Allows relayer to publish messages using IPFS.
/// @param _messageHashes The message hashes
/// @param _ipfsHash The IPFS hash of the messages batch
function relayMessagesBatch(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add it to the interface too?

/// @param _messageHashes The message hashes
/// @param _ipfsHash The IPFS hash of the messages batch
function relayMessagesBatch(
uint256[] calldata _messageHashes,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we'd be relaying the full batch hash rather than each message hash, but this would work too, just a little bit more expensive for the relayer, but something to consider

Also if we go like this, it might be worth considering to constrain the number of hashes sent to be <= messageBatchSize, to keep things a bit more clean (only the last batch might be smaller)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use message hashes to keep numMessages sync with offchain messages.
And why do we need to check messageBatchSize? When we update chain hash we have this check when adding new chain hash:

if (numMessages % messageBatchSize == 0) {
  batchHashes.push(newChainHash);
}

I think it's the same logic for publishMessageBatch, there is no check for messageBatchSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants