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

Handle cases where a node sent or not sent a part of the message unexpectedly #46

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

fjarri
Copy link
Member

@fjarri fjarri commented Oct 25, 2024

Fixes #23

The gist of the changes is that now even if a node does not send, say, a direct message, it still signs a None value with the corresponding metadata and sends it off in a bundle with the rest of the parts. This way the receiver can assert that the direct part or the echo part should be none, and register a provable error if they aren't.

Of course the node could just not send the corresponding part at all (equivalent to sending any other malformed or mal-signed message), but as #39 suggests, we're mostly protecting against nodes with obsolete software, not actively malicious ones.

Changes:

  • Changed the signatures of Round::make_echo_broadcast(), Round::make_direct_message(), Round::receive_message() removing Options there.
  • Added Round::make_direct_message_with_artifact(); Round::make_direct_message() would be the one most used because most rounds in Synedrion don't actually create an artifact.
  • Artifact::empty() removed, since now we can just return None.

Outstanding questions:

  • We do not need to keep signed empty messages in the transcript, but there is currently no type system assertion for that. Perhaps we don't need one, since the payload being None leads to the same outcome as a deserialization error on a Some payload, so DirectMessage::deserialize() just returns a DirectMessageError in this case as well, same for the echo broadcast.
  • The fallback from make_direct_message_with_artifact() to make_direct_message() is a little tricky in RoundOverride; if the round defines the former, but we override the latter, the override won't be effective. Not sure how to handle that; I really want to keep the artifact-creating method separate since it's not used all that much.
  • Should we also allow returning None for an empty Payload?

@fjarri fjarri force-pushed the missing-message-parts branch from 0933c50 to 27962f7 Compare October 25, 2024 04:02
@fjarri fjarri marked this pull request as ready for review October 25, 2024 04:03
@fjarri fjarri requested a review from dvdplm October 25, 2024 04:03
@coveralls
Copy link

coveralls commented Oct 25, 2024

Pull Request Test Coverage Report for Build 11524276230

Details

  • 118 of 179 (65.92%) changed or added relevant lines in 9 files are covered.
  • 14 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.8%) to 70.528%

Changes Missing Coverage Covered Lines Changed/Added Lines %
manul/src/testing/macros.rs 15 17 88.24%
manul/src/session/session.rs 19 22 86.36%
manul/src/protocol/errors.rs 1 8 12.5%
manul/src/protocol/round.rs 6 13 46.15%
manul/src/session/evidence.rs 6 14 42.86%
manul/src/protocol/message.rs 40 74 54.05%
Files with Coverage Reduction New Missed Lines %
manul/src/session/message.rs 1 98.68%
manul/src/protocol/round.rs 3 60.34%
manul/src/session/session.rs 4 72.59%
manul/src/testing/macros.rs 6 87.18%
Totals Coverage Status
Change from base Build 11514244461: -0.8%
Covered Lines: 1242
Relevant Lines: 1761

💛 - Coveralls

@fjarri fjarri force-pushed the missing-message-parts branch 2 times, most recently from 6473da0 to 0f5bfe9 Compare October 25, 2024 19:15
@fjarri fjarri force-pushed the missing-message-parts branch from 0f5bfe9 to 0c8843b Compare October 25, 2024 19:29
@fjarri fjarri merged commit bf660a4 into entropyxyz:master Oct 28, 2024
8 checks passed
@fjarri fjarri deleted the missing-message-parts branch October 28, 2024 22:14
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.

Handle cases where a remote node sent an unexpected echo message
2 participants