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
refacot(network): simplify the get_record handling code. #1054
Merged
RolandSherwin
merged 8 commits into
maidsafe:main
from
RolandSherwin:spend_validation_fix_2
Dec 6, 2023
Merged
refacot(network): simplify the get_record handling code. #1054
RolandSherwin
merged 8 commits into
maidsafe:main
from
RolandSherwin:spend_validation_fix_2
Dec 6, 2023
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
Reviewpad Report
|
RolandSherwin
force-pushed
the
spend_validation_fix_2
branch
5 times, most recently
from
December 6, 2023 09:46
5137f35
to
1a7944e
Compare
joshuef
approved these changes
Dec 6, 2023
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.
Okay, seems a ncie simplification. Lets ensure we need Quorum::All
for chunks vs n::2
or ::One
for validation there.
RolandSherwin
force-pushed
the
spend_validation_fix_2
branch
from
December 6, 2023 11:27
a8079a8
to
e105881
Compare
RolandSherwin
force-pushed
the
spend_validation_fix_2
branch
from
December 6, 2023 11:47
4dbdfe9
to
f926529
Compare
- the code exited early if the record is a chunk and the quorum is set to One. - But the behaviour happens if we just set the quorum to One. No need to perform a custom check there.
RolandSherwin
force-pushed
the
spend_validation_fix_2
branch
from
December 6, 2023 13:11
f926529
to
096565a
Compare
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.
Description
get_record
re attempt code by moving thetarget check
inside the kad event handling loopGetRecordCfg
inside the SwarmDriver.RecordHeader::RecordKind
is found to be a chunk AND ifQuorum::One
.Qourum::One
in the main code.Summary generated by Reviewpad on 06 Dec 23 08:01 UTC
This pull request includes the following changes:
In the
bootstrap.rs
file, a typo in the comment on line 24 has been corrected, changing "minumn" to "minimum".Changes related to handling errors and inconsistencies in retrieving and storing records from the network have been made. This includes an additional variant called
ReturnedRecordDoesNotMatch
in theGetRecordError
enum, which now takes aRecord
parameter. TheReturnedRecordDoesNotMatch
variant has also been removed from theError
enum. Additionally, theReturnedRecordDoesNotMatch
variant in theGetRecordError
enum now includes a more detailed error message.In the
sn_networking
crate'slib.rs
file, the following changes have been made:get_record_handler
has been added.Quorum
andRecordKey
imports from thelibp2p::kad
module have been removed.RecordHeader
andRecordKind
imports from thesn_protocol
module have been removed.impl Network
block has been updated with changes related to the handling of record retrieval attempts.In the code diff, there are various changes including import statement modifications, code reorganization, removal of unused type definition, and the addition of a new struct named
GetRecordCfg
. TheDebug
trait has also been implemented for theGetRecordCfg
struct.The file diff includes changes to the
SwarmCmd
enum and its implementation. The import statement forREPLICATE_RANGE
has been removed. TheGetNetworkRecord
variant of theSwarmCmd
enum now includes acfg
field of typeGetRecordCfg
instead ofquorum
andexpected_holders
fields. TheDebug
implementation for theSwarmCmd
enum has been updated accordingly. Theimpl Debug for SwarmCmd
block has been updated to use the{holder:?}
syntax for formatting theholder
field in theAddKeysToReplicationFetcher
variant and thetopic_id
field in theGossipsubPublish
variant. TheGetNetworkRecord
match arm in theimpl SwarmDriver
block has been modified to use theget_cfg
field instead of thequorum
andexpected_holders
fields.Please review the specific changes in the diff for more details.