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: use log_assert_fail when creating state witness with missing proof #10673

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

pugachAG
Copy link
Contributor

Such situations indicate illegal state/programmatic error that will result in missing chunk. It is still better to avoid panic in such case, so we return Err instead. This PR adds log_assert_fail which was introduced specifically for such cases.

@pugachAG pugachAG force-pushed the use-log-assert-state-witness-producer branch from 2b51d72 to 220f88b Compare February 27, 2024 16:04
@@ -102,7 +103,9 @@ impl Client {
// With stateless validation chunk producer uses recording reads when validating transactions.
// The storage proof must be available here.
transactions_storage_proof.ok_or_else(|| {
Error::Other("Missing storage proof for transactions validation".to_owned())
let message = "Missing storage proof for transactions validation";
log_assert_fail!("{message}");
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we can make log_assert_fail! and log_assert! take arguments similar to tracing error? Can handle in independent PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

take arguments similar to tracing error

this is a bit tricky since assert accepts narrower set or arguments, see Robin's comment: #10659 (comment)

Simonas suggested a proper solution, but it requires PhD in tracing library, feel free to give it a try 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me try to invest some time into it and see if it's relatively easily crackable.

@pugachAG pugachAG added this pull request to the merge queue Feb 27, 2024
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

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

Project coverage is 72.31%. Comparing base (9ee2c58) to head (220f88b).
Report is 1 commits behind head on master.

Files Patch % Lines
...src/stateless_validation/state_witness_producer.rs 0.00% 13 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10673      +/-   ##
==========================================
- Coverage   72.31%   72.31%   -0.01%     
==========================================
  Files         732      732              
  Lines      150356   150408      +52     
  Branches   150356   150408      +52     
==========================================
+ Hits       108736   108773      +37     
+ Misses      36699    36696       -3     
- Partials     4921     4939      +18     
Flag Coverage Δ
backward-compatibility 0.24% <0.00%> (-0.01%) ⬇️
db-migration 0.24% <0.00%> (-0.01%) ⬇️
genesis-check 1.40% <0.00%> (-0.01%) ⬇️
integration-tests 36.89% <0.00%> (-0.03%) ⬇️
linux 71.09% <0.00%> (-0.03%) ⬇️
linux-nightly 71.76% <0.00%> (+0.01%) ⬆️
macos 55.35% <0.00%> (-0.05%) ⬇️
pytests 1.62% <0.00%> (-0.01%) ⬇️
sanity-checks 1.41% <0.00%> (-0.01%) ⬇️
unittests 68.15% <0.00%> (-0.02%) ⬇️
upgradability 0.28% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Merged via the queue into master with commit 7bad46a Feb 27, 2024
26 of 28 checks passed
@pugachAG pugachAG deleted the use-log-assert-state-witness-producer branch February 27, 2024 16:42
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