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

Copy slice when setting block hash list #6734

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

janezpodhostnik
Copy link
Contributor

@janezpodhostnik janezpodhostnik commented Nov 18, 2024

Solves the block hash list issue seen in #6552

The writing to the bucket was done in a way where the original value of the bucket was also changed. Later when we were checking if there are changes, the original bucket and the new bucket were the same so no changes were written.

This requires an HCU

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.24%. Comparing base (edf27b0) to head (755ec67).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6734   +/-   ##
=======================================
  Coverage   41.23%   41.24%           
=======================================
  Files        2054     2054           
  Lines      182364   182368    +4     
=======================================
+ Hits        75204    75219   +15     
+ Misses     100859   100852    -7     
+ Partials     6301     6297    -4     
Flag Coverage Δ
unittests 41.24% <100.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.


🚨 Try these New Features:

@janezpodhostnik janezpodhostnik marked this pull request as ready for review November 18, 2024 19:50
Comment on lines 151 to 156
cpy := make([]byte, len(bucket))
copy(cpy, bucket)

if err != nil {
return err
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cpy := make([]byte, len(bucket))
copy(cpy, bucket)
if err != nil {
return err
}
if err != nil {
return err
}
cpy := make([]byte, len(bucket))
copy(cpy, bucket)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point, we can perform the bucket copy, after we know there's no error.

@zhangchiqing
Copy link
Member

Do we have a test case that would fail without the fix and pass after the fix?

@janezpodhostnik
Copy link
Contributor Author

@zhangchiqing Added a test in 291d0ca

fvm/fvm_test.go Outdated Show resolved Hide resolved
@janezpodhostnik janezpodhostnik added this pull request to the merge queue Nov 19, 2024
Merged via the queue into master with commit 8844d8e Nov 19, 2024
55 checks passed
@janezpodhostnik janezpodhostnik deleted the janez/copy-when-setting-bhl branch November 19, 2024 19:05
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.

5 participants