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

*: extend PreBlock processing callback #129

Merged
merged 5 commits into from
Sep 4, 2024
Merged

Conversation

AnnaShaleva
Copy link
Member

@AnnaShaleva AnnaShaleva commented Sep 2, 2024

The necessity of this extension is described in https://github.com/bane-labs/go-ethereum/pull/301#discussion_r1726514210. We need at least M correct PreCommits to decrypt Envelopes content, but decryption may be checked only by using the group of PreCommits. Thus, we can't say whether a single PreCommit can/can't decrypt Envelopes content.

@roman-khimov, please, review it carefully, I checked what I could and there seems to be no tricks possible to skip verification, but maybe you'll fined something. May be it'll be easier to review if you take a look at https://github.com/bane-labs/go-ethereum/pull/287/commits/f4e830c751ae6a4ee94adb6db42096133abfa235.

TPKE decryption shares verification is performed in ProcessPreBlock callback
when PreBlock is already constructed and all transactions are available.
If some of the received shares can't decrypt Envelopes' content then
dBFT should wait for more PreCommit payloads from other "honest" CNs.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
It's a must-have condition for PreBlock construction.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
PreCommits can't be verified against PreHeader because PreCommit carries
transactions-sensitive information.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
PreBlock may be created earlier at the PreCommit verification level, and
it's OK. However, it's required at least M PreCommits to _process_
PreBlock.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva AnnaShaleva added this to the v0.3.1 milestone Sep 2, 2024
Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 48.48485% with 17 lines in your changes missing coverage. Please review.

Project coverage is 59.25%. Comparing base (d574d48) to head (a6c5026).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
dbft.go 42.10% 8 Missing and 3 partials ⚠️
check.go 58.33% 4 Missing and 1 partial ⚠️
context.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
- Coverage   59.47%   59.25%   -0.22%     
==========================================
  Files          32       32              
  Lines        1821     1831      +10     
==========================================
+ Hits         1083     1085       +2     
- Misses        659      665       +6     
- Partials       79       81       +2     

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

context.go Outdated Show resolved Hide resolved
dbft.go Show resolved Hide resolved
dbft.go Show resolved Hide resolved
Move hasAllTransactions check from PreBlock constructor to onPreCommit
callback. The rest of CreatePreBlock usages already have this check.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
@AnnaShaleva AnnaShaleva marked this pull request as draft September 3, 2024 12:32
@AnnaShaleva
Copy link
Member Author

I found one more bug.

@AnnaShaleva AnnaShaleva marked this pull request as ready for review September 4, 2024 09:55
@AnnaShaleva
Copy link
Member Author

@roman-khimov, I placed encrypted data decoding to the wrong dBFT callback, so the library itself works correctly, the mistae was on the NeoX side. Ready to be merged.

@roman-khimov roman-khimov merged commit 212d176 into master Sep 4, 2024
10 of 12 checks passed
@roman-khimov roman-khimov deleted the add-precommit-cb branch September 4, 2024 10:11
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.

2 participants