-
Notifications
You must be signed in to change notification settings - Fork 487
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
Improve the BOLD Challenge Cache #2459
Conversation
} | ||
t.Run("pruning non-existent dirs does nothing", func(t *testing.T) { | ||
if err = cache.Prune(ctx, key.MessageHeight); err != nil { | ||
t.Error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it t.Error and not t.Fatal on urpose? (It's probably o.k. either way.. just making sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so that it does not stop other runs
Ready again @tsahee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR improves the BOLD challenge cache with feedback from @tsahee on https://github.com/OffchainLabs/nitro/pull/2391/files. It contains the following improvements:
Init()
method to the cache such thatNew
has no side-effectstemp
dir inside of the base dir on cacheInit()
. All temporary writes when putting to the cache will be made to temp files in this directory. This means when wePut()
, we can just doos.CreateTemp
within that dir. Once the writing completes, we do an atomicos.Rename
of that file from the temp dir to the actual path it needs to live in