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

DREL-226 - Docs for Pub/sub on behalf of an ERC-1271 #2531

Merged
merged 3 commits into from
Jul 4, 2024

Conversation

fonty1
Copy link
Member

@fonty1 fonty1 commented Apr 26, 2024

Copy link

linear bot commented Apr 26, 2024

@fonty1 fonty1 requested a review from harbu April 26, 2024 12:21
- Smart contract signature validation is periodically [cached](#optimizations-and-caching).
:::

Every message (data point) on Streamr must be signed with the private key of the publisher and these messages are validated on every hop inside the network by Streamr nodes. With externally owned accounts (EOAs) the Streamr SDK uses `ecrecover` in this process (to verify the public key of the signed message). If the stream has enabled ERC1271 support, the verification will be done through the assigned smart contract with a call to the function `isValidSignature`.
Copy link
Contributor

Choose a reason for hiding this comment

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

these messages are validated on every hop inside the network by Streamr nodes

Actually they are only validated at the the edges of the network, by subscribers. The propagating nodes don't perform validation (because that would increase propagation latency)

Copy link
Contributor

Choose a reason for hiding this comment

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

If the stream has enabled ERC1271 support, the verification will be done through the assigned smart contract with a call to the function isValidSignature.

Harping back to an earlier point, this happens on a "per publishing session" basis when the erc1271contract parameter has been set. So it is more a question of how the streamrClient.publish method is being called rather than whether an ERC-1271 contract has been given publish permission to the stream.

Beside the typical externally owned account signing and verification, the Streamr protocol also supports smart contract signature verification, i.e. ERC1271 support. This feature allows the use of smart contracts that follow the ERC1271 spec to become signatories on streams in the Streamr Network.

:::info Key points:
- This feature is enabled on a per stream basis.
Copy link
Contributor

Choose a reason for hiding this comment

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

This feature is enabled on a per stream basis.

Just to clarify: a stream can simultaneously have both ERC-1271 contracts as publishers as well as normal publishers. I'm not sure if adding this clarification here would just add to confusion however. But just so we are internally aligned at least.

It's actually activated on a "per publishing session" basis when you pass the erc1271contract parameter to the streamrClient.publish method. Of course a prerequisite is that the ERC-1271 contract address has been given publish permission to the stream.

Copy link
Contributor

Choose a reason for hiding this comment

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

One way to phrase this maybe (or is this confusing?):

  • This feature is enabled on a per stream basis.
  • This feature is activated on a per publishing session basis.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes. Good point - I'll rephrase this section to capture that nuance.

@harbu
Copy link
Contributor

harbu commented May 14, 2024

I recognize my comments are not necessarily clear in written form, if you wanna hop on a call @fonty1 for further explanation feel free to ping me.

@fonty1
Copy link
Member Author

fonty1 commented May 15, 2024

I recognize my comments are not necessarily clear in written form, if you wanna hop on a call @fonty1 for further explanation feel free to ping me.

Lemme have another swing at this first, I think I understand it now.

@fonty1
Copy link
Member Author

fonty1 commented May 15, 2024

@harbu pls take another look - I think its more clear/accurate now.

@fonty1
Copy link
Member Author

fonty1 commented Jun 5, 2024

@harbu - poke :)

@fonty1 fonty1 merged commit be28dcd into main Jul 4, 2024
25 checks passed
@fonty1 fonty1 deleted the DREL-226-eip1271-docs branch July 4, 2024 10:48
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.

None yet

2 participants