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

Fix notary request handling #2715

Merged
merged 3 commits into from
Jan 18, 2024
Merged

Conversation

roman-khimov
Copy link
Member

No description provided.

@roman-khimov roman-khimov added the bug Something isn't working label Jan 11, 2024
@roman-khimov roman-khimov added this to the v0.40.0 milestone Jan 11, 2024
@roman-khimov roman-khimov force-pushed the fix-notary-request-handling branch 2 times, most recently from 6f1f116 to 3ad7460 Compare January 11, 2024 19:05
Copy link

codecov bot commented Jan 11, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (09a3589) 28.78% compared to head (38a5bb1) 28.81%.

Files Patch % Lines
pkg/morph/client/notary.go 0.00% 6 Missing ⚠️
pkg/innerring/innerring.go 0.00% 2 Missing ⚠️
pkg/morph/event/listener.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2715      +/-   ##
==========================================
+ Coverage   28.78%   28.81%   +0.02%     
==========================================
  Files         415      415              
  Lines       32378    32386       +8     
==========================================
+ Hits         9321     9332      +11     
+ Misses      22223    22220       -3     
  Partials      834      834              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/morph/event/notary_preparator.go Outdated Show resolved Hide resolved
pkg/morph/event/notary_preparator.go Outdated Show resolved Hide resolved
Copy link
Member

@carpawell carpawell left a comment

Choose a reason for hiding this comment

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

Otherwise, I am OK.

pkg/morph/event/listener.go Outdated Show resolved Hide resolved
It's not compliant with the WSClient documentation and can lead to the
following scenario:
 * SN sends a container creation request
 * IR node with integrated CN receives it, adds to pool and announces to
   neighbors in a regular Neo P2P way
 * IR logic then receives a notification and executes Prepare
 * it adds a signature and changes the shared notary request
 * a neighbor then requests this notary requests and receives a broken one
   (signature mismatch)
 * so it may end up not receiving this original request at all and thus not
   replying to it ever
 * with enough of such nodes you can't create a container

Signed-off-by: Roman Khimov <roman@nspcc.ru>
Signed-off-by: Roman Khimov <roman@nspcc.ru>
In some cases we may not receive the original (sent by SN) request or receive
it with a huge delay, so we shouldn't be relying on this magic. Instead, we
can prevent recursion by checking the FB signer and then main tx cache is
sufficient to not try handling the transaction again. Even if we do that, it's
not a huge problem, the fallback will be the same and a single main tx will be
constructed anyway.

Notice that while we could be checking for main/fallbacks in the notary pool,
they can legitimatelly be evicted from it as well, so it's not a 100% proof
of handling status, therefore we're not doing it, relying on tx hash cache and
fallback stability.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
@roman-khimov roman-khimov merged commit cbd4d84 into master Jan 18, 2024
9 of 10 checks passed
@roman-khimov roman-khimov deleted the fix-notary-request-handling branch January 18, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants