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

Adds a restrictions ID check into handshake protocols #3306

Merged
merged 4 commits into from
Jun 11, 2024

Conversation

vicsn
Copy link
Contributor

@vicsn vicsn commented Jun 8, 2024

Motivation

This PR introduces a restrictions ID check into the handshake protocols.

When two nodes are handshaking on the Router or Gateway level, it is expected that they transmit in their ChallengeResponse messages a copy of their current restrictions ID to their peer, who subsequently checks and enforces that the restrictions ID matches what they expect from their node.

As such, going forward, the following node types are responsible to adhere to the same restrictions list:

  • NodeType::Validator
  • NodeType::Client

Of note, as provers do not validate transitions or transactions, they do not carry ledger state and thus are not subject to the restrictions list. Note that it is critical for clients to also perform the same validation as the validators because the validator rely upon core clients to assist with validation and propagation of transactions to the validators' memory pools.

This design is defined by the foundation to require all handshake connections to enforce the current restrictions ID to be correct and matching at the time of connection; however, it doesn't require consensus to enforce a matching restrictions ID at the time of use.

This PR builds on top of AleoNet/snarkVM#2487 in snarkVM, which introduces the concept of the restrictions list for programs, functions, and arguments.

Related PRs

Reviewed here: ProvableHQ#14
CI passed

howardwu and others added 4 commits June 6, 2024 15:28
Comment on lines +48 to +49
let restrictions_id = Field::zero(); // Provers may bypass restrictions, since they do not validate transactions.
self.router.handshake(peer_addr, stream, conn_side, genesis_header, restrictions_id).await?;
Copy link

Choose a reason for hiding this comment

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

I feel like the handshake method should take an option, then no? Why send extra data if it's unnecessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree it would have been cleaner, if the PR was not merged yet or we were not in a crunch, I would have pushed the change. Thx for the suggestion

Comment on lines +60 to +63
fn latest_restrictions_id(&self) -> Field<N> {
Field::zero()
}

Copy link

Choose a reason for hiding this comment

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

TBH I feel like it should be considered here as well. Rather than return useless unused data this should be an Option and prover's should return None

@zosorock zosorock merged commit 2891dae into AleoNet:mainnet-staging Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants