-
Notifications
You must be signed in to change notification settings - Fork 38
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
ignore: testing signatures in github #57
Closed
Closed
+2,988
−927
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…into 19/gossip_optim_v2
…into 19/gossip_optim_v2
…nto 19/gossip_optim_v2
…tches. treat array as ring buffer
…assert to help expose issues like this
the problem was that it would deinit the node before returning node data. this almost always worked fine because you would need the allocator to reuse or unmap the memory to actually see a problem, and this was typically not happening before the return statement on the next line of code was executed. but on rare occasion the address would be unmapped, causing a segfault. the solution is to defer the deinit so it happens after the return statement copies the value
All enums are deserialized with the assumption they have a size of 32 bits in bincode. ShredType however is a struct in rust and enum in zig. It is serialized as 8 bits. This causes deserialization errors reading the data from mainnet because it grabs 32 bits and reads a much larger number than any of the enum variants in zig. Add logic to bincode implementation that looks for a declaration called BincodeSize within the enum. If it exists, use that instead of u32. Set it to u8 for ShredType.
# Root cause Multiple contacts with the same pubkey were being passed to the rotate method. This resulted in duplicate items being included in the array, but the hashmap internally prevents there from being duplicates. So the next time rotate is called, it would iterate through the array and attempt to deinit the same hashmap entry twice. # Solution Duplicates are detected and skipped during the insertion loop by checking for their presence in the hashmap. # Alternate Solution This could have also been addressed with a simpler approach: Remove the peers field from ActiveSet. This field does not seem necessary, since the same data is already in the hashmap. Even though it would be simpler code, it is a more significant change in behavior and compatibility. To be safe, I decided not to take this approach.
this is the alternate solution for the double free bug fix.
- remove comment - use HashMap.count for ActiveSet.len - use getOrPut to avoid repeated lookups in ActiveSet.rotate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.