-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
…age() (and initialized()) from get_validation_package reducer
…f the entry is an AgendId entry.
Those were mixed up
Codecov Report
@@ Coverage Diff @@
## develop #727 +/- ##
===========================================
+ Coverage 72.79% 73.31% +0.53%
===========================================
Files 129 138 +9
Lines 4541 4690 +149
===========================================
+ Hits 3305 3438 +133
- Misses 1236 1252 +16
Continue to review full report at Codecov.
|
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.
This all looks fabluous. I put in some comments, but all of them should be followups if you agree. Add them to the tree?
dna_hash: network_state.dna_hash.clone().unwrap(), | ||
agent_id: network_state.agent_id.clone().unwrap(), | ||
address: entry.address().to_string(), | ||
content: serde_json::from_str(&serde_json::to_string(&entry_with_header).unwrap()) |
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.
can't we use JsonString here?
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.
We can and we should. But I didn’t want to change the net crates in this PR and instead just use it. Follow up.
agent_id: network_state.agent_id.clone().unwrap(), | ||
address: link.base().to_string(), | ||
attribute: String::from("link"), | ||
content: serde_json::from_str(&serde_json::to_string(&entry_with_header).unwrap()) |
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.
ditto JsonString
dna_hash: network_state.dna_hash.clone().unwrap(), | ||
agent_id: get_dht_data.from_agent_id.clone(), | ||
address: get_dht_data.address.clone(), | ||
content: serde_json::from_str(&serde_json::to_string(&maybe_entry).unwrap()).unwrap(), |
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.
ditto JsonString
core/src/network/state.rs
Outdated
/// None: process started, but no response yet from the network | ||
/// Some(Err(_)): there was a problem at some point | ||
/// Some(Ok(None)): no problem but also no entry -> it does not exist | ||
/// Some(Ok(Some(entry))): we have it | ||
type GetEntryResult = Option<Result<Option<Entry>, HolochainError>>; |
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.
I like this enum for state!
) { | ||
let maybe_validation_package = match get_entry(&requested_entry_address, &context) { | ||
Ok(entry) => await!(build_validation_package(&entry, &context)).ok(), | ||
Err(_) => None, |
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.
Do we really send a None value back across the network if there was an error? I have the feeling that we at least have to tell the requester that we had some kind of error... followup?
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.
why so much raw serde handling?
fn address(&self) -> Address { | ||
match &self { | ||
Entry::AgentId(agent_id) => agent_id.address(), | ||
_ => Address::encode_from_str(&String::from(self.content()), Hash::SHA2256), |
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.
hmm, this seems like it should always defer to the .address()
method of the inner value?
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.
Are you sure? Wouldn't that mean that the entry type is not included in the hash? In Montreal we agreed that the "content" that gets hashed needs to include the type.
@thedavidmeister raw serde handling because |
@lucksus right... i keep leaving the same feedback for the same thing 😅 carry on then |
Context
Implements this state: https://realtimeboard.com/app/board/o9J_kyiXmFs=/?moveToWidget=3074457346314392714
Implementation steps in this PR
DirectMessage
with variantsRequestValidationPackage
andValidationPackage
Action::GetValidationPackage
with reducer and action creator that lets the network send aDirectMessage::RequestValidationPackage
to the entries sourceworkflows::respond_validation_package_request
that checks if we have the entry in the source chain, builds the validation package and then triggers sending of the response via:Action::SendDirectMessage
that makes the network send any (initial or responding) node2node messageDirectMessage::ValidationPackage
that updates the state so theGetValidationPackageFuture
can resolveAdditional required changes in here
Entry::address()
returns the right address also for agent_id entries which override the hashing of the content and instead have their public key be the address (6f494af and b66068a)ProtocolWrapper::SendResult
andProtocolWrapper::HandleSendResult
were mixed up (right, @neonphog? Or did I get it wrong?) I've swapped them to have handle always mean that the network requests core to handle something. (76fa842 and e812ae7)