-
Notifications
You must be signed in to change notification settings - Fork 37
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
Conversation
- 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`. |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. |
@harbu pls take another look - I think its more clear/accurate now. |
@harbu - poke :) |
Summary
Docs for Pub/sub on behalf of an ERC-1271