-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
Replace occurences of no arg can_publish with trait version which also requires a context. Log unexpected states of the context, such as missing entry type definitions.
This reverts commit 80d529d.
d4a2c3e
to
c73d9c7
Compare
mmm seems like something we want |
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.
The big fix needed is the location of the can_publish check needs to be when a get request is received.
app_spec/zomes/blog/code/src/memo.rs
Outdated
}, | ||
EntryValidationData::Delete{old_entry:old_memo,old_entry_header:_,validation_data:_} => | ||
{ | ||
(old_memo.content!="SYS") |
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 looks weird to me. Why is this here? The system type validation should be internal to holochain, and not happen at the app level I think.
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.
It's there cause it's copied from the other zome code of blog
zome I believe. So if we question it here we should question it there
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.
See commit 8d04d68.
CHANGELOG.md
Outdated
@@ -50,7 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
- `add_agent()` admin function now creates keystore file instead of just recording file in config [#1182](https://github.com/holochain/holochain-rust/pull/1182) | |||
- One-time-signing now takes a vector of payloads, and returns a vector of signatures. [#1193](https://github.com/holochain/holochain-rust/pull/1193) | |||
- Pins nixpkgs to Holo-Host channel in shell and CI [#1162](https://github.com/holochain/holochain-rust/pull/1162) | |||
- Uses autodump configuration for pickledb which dumps per change [#1231](https://github.com/holochain/holochain-rust/pull/1231) |
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 is the pickledb stuff showing up here?
@@ -10,9 +10,12 @@ use std::{ | |||
fmt::{Debug, Error, Formatter}, | |||
path::Path, | |||
sync::{Arc, RwLock}, | |||
time::Duration, |
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'm not sure why pickle stuff is at all affected by this PR, looks like files got committed by mistake?
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.
Not sure, either- possibly an awry rebase- will ensure it's clean.
core/src/entry/mod.rs
Outdated
.expect("DNA must be present to test if entry is publishable."); | ||
|
||
let entry_type_name = self.to_string(); | ||
context.log(format!("got entry type name of {}", entry_type_name)); |
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.
It looks like this logging should probably be removed and was for debugging? or needs a "debug/" prefix
)) | ||
)); | ||
|
||
match entry_result.clone() { |
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 is happening in the wrong place. What's going on here is that if you got the value across the network, you simply aren't returning it to the caller. But that means that you actually got a value that should never have been released to you. This check needs to happen by the receiver of the get request. i.e. in handle_fetch_entry
and handle_fetch_entry_result
so that it never leaves the source machine.
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.
See commit 8dd9f9e.
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.
@zippy you mentioned handle_fetch_entry
and handle_fetch_entry_result
- are both required to check can_publish
? I only added it for handle_fetch_entry
and it worked with my tests at least. Please confirm desired behavior for handle_fetch_entry_result
.
doc/holochain_101/src/faq.md
Outdated
@@ -65,7 +65,7 @@ DHTs enable key/value pair storage and retrieval across many machines. The only | |||
|
|||
In fact, since many DHTs are used for illegal file sharing (Napster, Bittorrent, Sharezaa, etc.), they are designed to protect anonymity of uploaders so they won't get in trouble. File sharing DHTs frequently serve virus infected files, planted by uploaders trying to infect digital pirates. There's no accountability for actions or reliable way to ensure bad data doesn't spread. |
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 file also shouldn't show up as changed in this PR right?
…nt-publish-private-entries
Co-Authored-By: struktured <[email protected]>
Co-Authored-By: struktured <[email protected]>
Co-Authored-By: struktured <[email protected]>
…olochain-rust into dont-publish-private-entries
It should be removed- it's not really testing any useful functionality
here- I will remove it.
…On Fri, Apr 12, 2019 at 5:36 PM Connor Turland ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app_spec/zomes/blog/code/src/memo.rs
<#1233 (comment)>
:
> + validation: |validation_data: hdk::EntryValidationData<Memo>| {
+ match validation_data
+ {
+ EntryValidationData::Create{entry:memo,validation_data:_} =>
+ {
+ (memo.content.len() < 280)
+ .ok_or_else(|| String::from("Content too long"))
+ },
+ EntryValidationData::Modify{new_entry:new_memo,old_entry:old_memo,old_entry_header:_,validation_data:_} =>
+ {
+ (new_memo.content != old_memo.content)
+ .ok_or_else(|| String::from("Trying to modify with same data"))
+ },
+ EntryValidationData::Delete{old_entry:old_memo,old_entry_header:_,validation_data:_} =>
+ {
+ (old_memo.content!="SYS")
It's there cause it's copied from the other zome code of blog zome I
believe. So if we question it here we should question it there
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1233 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE01opSEHpy44uTCuC7PvhjKmS9u3RgDks5vgPxRgaJpZM4cjOTQ>
.
|
…nt-publish-private-entries
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.
Woot woot! Looks great. Nice work.
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.
👏 👏 👏
Please check one of the following, relating to the CHANGELOG, which should be updated if relevant
- summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)
This introduces a fix so that entries defined as being private are not published to the DHT. Currently entry types do not examine there own definitions to ascertain their sharing attribute- this work enhances the publishable logic accordingly.
As this is my first project with the holochain core team, it is requested that reviewers are particularly thorough and stringent before accepting the PR.
Extend EntryType with CanPublish trait
can_publish
function from existing entry type definition in thecore_types
crate.CanPublish
trait incore
crate which requires aContext
to properly determine whether the entry type is sharable.EntryType
implement newCanPublish
trait by extending the entry type functionality in thecore
crate (even though theEntryType
itself is still definedcore_types
). Most of this commented out code by @lucksus can be probably reused for this purpose.Rust tests
core
which creates a just complicated enoughContext
to verify private entries are not published to the DHT. (consider using / extended the existing holochain test library crate).App-spec tests
functions
memo
to theblog
zome which represents private notes and reminders users only write to their local chain. Add public zome functionshash_memo
,create_memo
, andmy_memos
.