-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix mailserver spec #64
Conversation
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.
Looks clear enough to me to implement. Did mostly some language suggestions (feel free to improve).
However, symmetric key item + the issue of the single versus list of envelopes are still open questions to me.
`Limit`: 4-byte wide unsigned integer limiting the number of returned envelopes | ||
`Cursor`: 32-byte wide array of a cursor returned from the previous request (optional) | ||
|
||
The envelope MUST be signed with a symmetric key agreed between the requester and Mailserver. |
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.
How is this symmetric key agreed up on?
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.
Just realized that this does not need to be part of the spec and can be arranged out of band (layer higher, etc.)
However, should we then not leave the option open to use either a symmetric or asymmetric key? Such as with the regular posting of messages?
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.
Yes, I should make it more generic. It just must be encrypted somehow because each envelope requires that.
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.
Seems like a feature enhancement request to spec to me, I suggest we note that it has to be agreed out of band in implementer notes in waku spec
For Status app it is hardcoded, iirc.
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.
It is hardcoded, correct. I will keep it as it is then for now.
status-whisper-mailserver-spec.md
Outdated
|
||
### Receiving historic messages | ||
|
||
Historic messages MUST be sent to a peer with a packet with a P2P Message code (`0x7f`) followed by a single Whisper envelope OR an array of Whisper envelopes. A peer receiving historic message MUST handle both cases. |
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 is a bit problematic.
- I believe it goes against the waku/0 or Whisper/6 spec as there the P2P message code is defined with a single envelope as parameter.
- In our nim implementation (DSL) it is not supported to do such thing (1 envelope or list of envelopes) .
So I would prefer to have waku/0 altered with either always a list of envelopes (can be 1). Or to add a message packet for multiple envelopes.
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.
I believe it goes against the waku/0 or Whisper/6 spec as there the P2P message code is defined with a single envelope as parameter.
Correct but in the case when a mailserver returns a lot of messages, sending them one by one adds huge overhead. That's why we batched them.
In our nim implementation (DSL) it is not supported to do such thing (1 envelope or list of envelopes) .
So I would prefer to have waku/0 altered with either always a list of envelopes (can be 1). Or to add a message packet for multiple envelopes.
I would opt for multiple envelopes then. If one wants to send just one, they can do that as one-item array. The problem is that it makes Waku incompatible with Whisper... Can we solve this in the bridge?
Co-Authored-By: kdeme <kim.demey@gmail.com>
Co-Authored-By: Dean Eigenmann <dean.eigenmann@icloud.com>
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.
Much better than before, right level of abstraction now!
Some questions of clarifications on interface
status-whisper-mailserver-spec.md
Outdated
|
||
Historic messages MUST be sent to a peer with as packet with a P2P Message code (`0x7f`) followed by a single Whisper envelope OR an array of Whisper envelopes. A peer receiving historic message MUST handle both cases. | ||
|
||
In order to accept a P2P Message packet, a node MUST trust a selected Mailserver. |
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.
Can we be more specific about what we mean by "trust"? I suppose this means making certain envelope invariants / checks optional?
E.g. here is roughly the logic in nim-eth as far as I can tell https://github.com/status-im/nim-eth/blob/master/eth/p2p/rlpx_protocols/whisper_protocol.nim#L223-L225
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.
Good point. Generally, a trusted peer in Whisper terminology means it's allowed to send p2p messages.
status-whisper-mailserver-spec.md
Outdated
`Upper`: 4-byte wide unsigned integer (UNIX time in seconds; newest requested envelope's creation time) | ||
`Bloom`: 64-byte wide array of Whisper topics encoded in a bloom filter to filter envelopes | ||
`Limit`: 4-byte wide unsigned integer limiting the number of returned envelopes | ||
`Cursor`: 32-byte wide array of a cursor returned from the previous request (optional) |
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.
How is this returned exactly?
What does it correspond to? I suppose an address of some kind that can be used for that specific mailserver to skip previously fetched messages? Does it send messages 'before' this cursor or after? How does it impact Lower and Upper, i.e. does it cap it to be higher than Lower and lower than Higher according to some logic?
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.
It's up to the implementation. Also, it's not possible to query one mailserver and use the obtained cursor to query another one -- I will make it clear. It is so because each mailserver can obtain messages in different order or even may miss some. So it's Whisper property not this spec.
All other questions are up to the implementation due to what I wrote above.
`Limit`: 4-byte wide unsigned integer limiting the number of returned envelopes | ||
`Cursor`: 32-byte wide array of a cursor returned from the previous request (optional) | ||
|
||
The envelope MUST be signed with a symmetric key agreed between the requester and Mailserver. |
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.
Seems like a feature enhancement request to spec to me, I suggest we note that it has to be agreed out of band in implementer notes in waku spec
For Status app it is hardcoded, iirc.
status-whisper-mailserver-spec.md
Outdated
|
||
### Receiving historic messages | ||
|
||
Historic messages MUST be sent to a peer with as packet with a P2P Message code (`0x7f`) followed by a single Whisper envelope OR an array of Whisper envelopes. A peer receiving historic message MUST handle both cases. |
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.
The single or array seems a bit suboptimal to me, ideally this should be just array and then it can even be empty, just like Messages packet.
Seems like an oversight in initial EIP627, perhaps this interface is something we can fix for later versions of waku.
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.
Yes, agree. That's why I suggested either changing this packet like you say -> array which can be empty. Or adding a new packet id, which does this, to the waku spec.
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.
I replied with the same suggestions. Just note that it will be incompatible with EIP-627.
By the way, are any of the additional packet ids (still) used for mailserver functionality?
|
@kdeme
|
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.
LGTM
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.
OK for me now, however I think once we move to a Waku version of this spec we should readdress this:
It is incompatible with the original Whisper spec (EIP-627) because it allows only a single envelope, however, an array of envelopes is much more performant. In order to stay compatible with EIP-627, a peer receiving historic message MUST handle both cases.
No need to mention that much then anymore about compatibility with EIP-627.
It can be done in the section which explains the differences between Whisper and Waku somewhere?
@kdeme If we have a section about differences, we can reference it here. But I think we must mention what is incompatible for clarify in the relevant sections. I agree that explanation can be in a different place.
Waku is speced in a different repo. Here we just want to describe the current state of the protocol. |
@adambabik Yeah, for the current state of the protocol I'm perfectly fine with it. As we base ourselves on EIP-627 in those specs / implementations. Just a reminder for later. |
Closes #55