diff --git a/Makefile b/Makefile index 885caab..4bfc0ad 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ WASM2 = target/wasm32-unknown-unknown/release/profile.wasm dnas: mkdir -p ./dnas dnas/joining-code-factory.dna: dnas - curl 'https://holo-host.github.io/joining-code-happ/releases/downloads/0_2_1/joining-code-factory.0_2_1.dna' -o $@ + curl 'https://holo-host.github.io/joining-code-happ/releases/downloads/0_2_2/joining-code-factory.0_2_2.dna' -o $@ DNAs: dnas/joining-code-factory.dna @@ -121,4 +121,4 @@ clean: tests/node_modules \ .cargo \ target \ - $(DNA) + dnas diff --git a/config.nix b/config.nix index 09593a4..c6e0100 100644 --- a/config.nix +++ b/config.nix @@ -1,6 +1,6 @@ { # git ls-remote https://github.com/holochain/holonix staging - holonixRevision = "52158409f9b76b442e592e8f06632b0e57a6c365"; + holonixRevision = "44542b5c0cdc984454fad96fbec313b7b1c8ca7c"; - holochainVersionId = "v0_0_127"; + holochainVersionId = "v0_0_131"; } diff --git a/tests/src/common.ts b/tests/src/common.ts index 8c55ed7..6e4e56e 100644 --- a/tests/src/common.ts +++ b/tests/src/common.ts @@ -52,7 +52,9 @@ export const awaitIntegration = async (cell) => { const dump = await cell.stateDump() console.log("integration dump was:", dump) const idump = dump[0].integration_dump - if (idump.validation_limbo == 0 && idump.integration_limbo == 0) { + if (idump.validation_limbo == 0 + // && idump.integration_limbo == 0 + ) { break } console.log("waiting 5 seconds for integration") diff --git a/tests/src/index.ts b/tests/src/index.ts index 79c0dd2..6e27151 100644 --- a/tests/src/index.ts +++ b/tests/src/index.ts @@ -1,32 +1,32 @@ import { Orchestrator } from "@holochain/tryorama"; let orchestrator = new Orchestrator(); -// require('./basic-chatting')(orchestrator) -// orchestrator.run() +require('./basic-chatting')(orchestrator) +orchestrator.run() -// orchestrator = new Orchestrator() -// require('./transient-nodes')(orchestrator) -// orchestrator.run() +orchestrator = new Orchestrator() +require('./transient-nodes')(orchestrator) +orchestrator.run() -// orchestrator = new Orchestrator() -// require('./chat-signals')(orchestrator) -// orchestrator.run() +orchestrator = new Orchestrator() +require('./chat-signals')(orchestrator) +orchestrator.run() -// orchestrator = new Orchestrator() -// require('./chat-stats')(orchestrator) -// orchestrator.run() +orchestrator = new Orchestrator() +require('./chat-stats')(orchestrator) +orchestrator.run() -// orchestrator = new Orchestrator() -// require('./profile')(orchestrator) -// orchestrator.run() +orchestrator = new Orchestrator() +require('./profile')(orchestrator) +orchestrator.run() -// orchestrator = new Orchestrator() -// require('./membrane-proof')(orchestrator) -// orchestrator.run() +orchestrator = new Orchestrator() +require('./membrane-proof')(orchestrator) +orchestrator.run() -// orchestrator = new Orchestrator() -// require('./unique-registration-code')(orchestrator) -// orchestrator.run() +orchestrator = new Orchestrator() +require('./unique-registration-code')(orchestrator) +orchestrator.run() orchestrator = new Orchestrator(); require("./batching")(orchestrator); diff --git a/version-manager.json b/version-manager.json index f10ce5b..34ac192 100644 --- a/version-manager.json +++ b/version-manager.json @@ -1,8 +1,8 @@ { - "hdk": "0.0.123", - "hc_utils": "0.0.123", - "holo_hash": "0.0.20", - "holochain": "0.0.127", - "holochain_rev": "v0_0_127", - "holonix_rev": "52158409f9b76b442e592e8f06632b0e57a6c365" + "hdk": "0.0.126", + "hc_utils": "0.0.126", + "holo_hash": "0.0.21", + "holochain": "0.0.131", + "holochain_rev": "v0_0_131", + "holonix_rev": "44542b5c0cdc984454fad96fbec313b7b1c8ca7c" } \ No newline at end of file diff --git a/zomes/chat/Cargo.toml b/zomes/chat/Cargo.toml index 2a6d584..01fe3d4 100644 --- a/zomes/chat/Cargo.toml +++ b/zomes/chat/Cargo.toml @@ -11,18 +11,18 @@ crate-type = ["cdylib", "rlib"] [dependencies] chrono = {version = "0.4.19", features = ['alloc', 'std']} derive_more = "0.99" -hdk = "=0.0.123" +hdk = "=0.0.126" serde = "1.0" thiserror = "1.0" -hc_utils = "=0.0.123" -holo_hash = { version = "=0.0.20", features = ["encoding"] } +hc_utils = "=0.0.126" +holo_hash = { version = "=0.0.21", features = ["encoding"] } uuid = "0.8.2" -hc_joining_code = {git = "https://github.com/holochain/hc-zome-lib", branch = "v0.0.123", package = "hc_joining_code"} +hc_joining_code = {git = "https://github.com/holochain/hc-zome-lib", branch = "v0.0.126", package = "hc_joining_code"} getrandom = { version = "0.2", features = ["js"] } is_sorted = "0.1.1" [dev-dependencies] -holochain = "=0.0.127" +holochain = "=0.0.131" futures = "0.3.1" nanoid = "0.4.0" observability = "0.1.2" @@ -33,4 +33,4 @@ matches = {version = "0.1.8", optional = false } holochain_test_wasm_common = { version = "0.0.26", optional = false } unwrap_to = { version = "0.1.0", optional = false } arbitrary = { version = "1.0", features = ["derive"] } -proptest = "1.0.0" \ No newline at end of file +proptest = "1.0.0" diff --git a/zomes/chat/src/entries/channel/handlers.rs b/zomes/chat/src/entries/channel/handlers.rs index d01bfb0..4f2d15a 100644 --- a/zomes/chat/src/entries/channel/handlers.rs +++ b/zomes/chat/src/entries/channel/handlers.rs @@ -33,7 +33,12 @@ pub(crate) fn create_channel(channel_input: ChannelInput) -> ChatResult ChatResult<()> { let agent = agent_info()?.agent_latest_pubkey; let agent_tag = agent_to_tag(&agent); if !is_active_chatter(path.clone())? { - create_link(path.path_entry_hash()?, agent.into(), agent_tag.clone())?; + create_link( + path.path_entry_hash()?, + agent.into(), + HdkLinkType::Paths, + agent_tag.clone(), + )?; } Ok(()) } diff --git a/zomes/chat/tests/basic_chatting.rs b/zomes/chat/tests/basic_chatting.rs index 0b39c81..d189418 100644 --- a/zomes/chat/tests/basic_chatting.rs +++ b/zomes/chat/tests/basic_chatting.rs @@ -1,161 +1,161 @@ -// use chat::channel::*; -// use chat::message::*; -// use chat::*; -// use hc_joining_code::Props; -// use holochain::conductor::api::error::{ConductorApiError, ConductorApiResult}; -// use holochain::sweettest::*; - -// #[cfg(test)] -// #[tokio::test(flavor = "multi_thread")] -// async fn chat_away() { -// // Use prebuilt DNA bundle. -// // You must build the DNA bundle as a separate step before running the test. -// let dna_path = std::env::current_dir() -// .unwrap() -// .join("../../elemental-chat.dna"); - -// // Convert to DnaFile and apply property overrides -// let dna = SweetDnaFile::from_bundle_with_overrides( -// &dna_path, -// None, -// // Note that we can use our own native `Props` type -// Some(Props { -// skip_proof: true, -// holo_agent_override: None, -// development_stage: None, -// t_and_c: None, -// t_and_c_agreement: None, -// }), -// ) -// .await -// .unwrap(); - -// // Set up conductor -// let mut conductor = SweetConductor::from_standard_config().await; - -// let agents = SweetAgents::get(conductor.keystore(), 2).await; - -// // Install apps with single DNA -// let apps = conductor -// .setup_app_for_agents("elemental-chat", &agents, &[dna]) -// .await -// .unwrap(); -// let ((alice_cell,), (bobbo_cell,)) = apps.into_tuples(); -// let alice_chat = &alice_cell.zome("chat"); -// let bobbo_chat = &bobbo_cell.zome("chat"); - -// // Setup complete. - -// let channel: ChannelData = conductor -// .call( -// alice_chat, -// "create_channel", -// ChannelInput { -// name: "Test Ch".into(), -// entry: Channel { -// category: "General".into(), -// uuid: uuid::Uuid::new_v4().to_string(), -// }, -// }, -// ) -// .await; - -// let long_msg = MessageInput { -// last_seen: LastSeen::First, -// channel: channel.entry.clone(), -// entry: Message { -// uuid: "long msg".into(), -// content: std::iter::repeat('x').take(1025).collect(), -// }, -// }; - -// let error: ConductorApiResult = conductor -// .call_fallible(alice_chat, "create_message", long_msg.clone()) -// .await; - -// assert!(matches!(error, Err(ConductorApiError::CellError(_)))); - -// let mut msg0 = long_msg; -// msg0.entry.uuid = "msg0".into(); -// msg0.entry.content = "Hello from alice :)".into(); - -// let res0: MessageData = conductor -// .call(alice_chat, "create_message", msg0.clone()) -// .await; - -// assert_eq!(msg0.entry, res0.entry); - -// let mut msg1 = msg0.clone(); -// msg1.last_seen = LastSeen::Message(res0.entry_hash.clone()); -// msg1.entry.uuid = "msg1".into(); -// msg1.entry.content = "Is anybody out there?".into(); - -// let res1: MessageData = conductor -// .call(alice_chat, "create_message", msg1.clone()) -// .await; - -// assert_eq!(msg1.entry, res1.entry); - -// // let current_time = Utc::now(); -// let lmpi = ListMessagesInput { -// channel: channel.entry.clone(), -// earliest_seen: None, -// target_message_count: 1, -// }; - -// let alice_msgs: ListMessages = conductor -// .call(alice_chat, "list_messages", lmpi.clone()) -// .await; -// println!(">{:?}", alice_msgs); -// // TODO: add consistency awaiting to sweettest -// tokio::time::sleep(tokio::time::Duration::from_millis(4000)).await; - -// let bobbo_msgs: ListMessages = conductor -// .call(bobbo_chat, "list_messages", lmpi.clone()) -// .await; - -// // Alice got all messages so far. -// assert_eq!( -// alice_msgs.messages.as_slice(), -// &[res0.clone(), res1.clone()] -// ); -// // Bobbo got the same messages as Alice. -// assert_eq!(alice_msgs, bobbo_msgs); - -// let mut msg2 = msg1.clone(); -// msg2.last_seen = LastSeen::Message(res1.entry_hash.clone()); -// msg2.entry.uuid = "msg2".into(); -// msg2.entry.content = "I'm here".into(); - -// let mut msg3 = msg1.clone(); -// msg3.last_seen = LastSeen::Message(res1.entry_hash.clone()); -// msg3.entry.uuid = "msg3".into(); -// msg3.entry.content = "Anybody?".into(); - -// let res2: MessageData = conductor -// .call(alice_chat, "create_message", msg2.clone()) -// .await; -// let res3: MessageData = conductor -// .call(bobbo_chat, "create_message", msg3.clone()) -// .await; - -// // TODO: add consistency awaiting to sweettest -// tokio::time::sleep(tokio::time::Duration::from_millis(4000)).await; - -// let alice_msgs: ListMessages = conductor -// .call(alice_chat, "list_messages", lmpi.clone()) -// .await; - -// let bobbo_msgs: ListMessages = conductor -// .call(bobbo_chat, "list_messages", lmpi.clone()) -// .await; - -// // Alice got all messages so far. -// assert_eq!( -// alice_msgs.messages.as_slice(), -// &[res0.clone(), res1.clone(), res2.clone(), res3.clone()] -// ); -// // Bobbo got the same messages as Alice. -// println!("{:?}", alice_msgs); -// assert_eq!(alice_msgs, bobbo_msgs); -// } +use chat::channel::*; +use chat::message::*; +use chat::*; +use hc_joining_code::Props; +use holochain::conductor::api::error::{ConductorApiError, ConductorApiResult}; +use holochain::sweettest::*; + +#[cfg(test)] +#[tokio::test(flavor = "multi_thread")] +async fn chat_away() { + // Use prebuilt DNA bundle. + // You must build the DNA bundle as a separate step before running the test. + let dna_path = std::env::current_dir() + .unwrap() + .join("../../elemental-chat.dna"); + + // Convert to DnaFile and apply property overrides + let dna = SweetDnaFile::from_bundle_with_overrides( + &dna_path, + None, + // Note that we can use our own native `Props` type + Some(Props { + skip_proof: true, + holo_agent_override: None, + development_stage: None, + t_and_c: None, + t_and_c_agreement: None, + }), + ) + .await + .unwrap(); + + // Set up conductor + let mut conductor = SweetConductor::from_standard_config().await; + + let agents = SweetAgents::get(conductor.keystore(), 2).await; + + // Install apps with single DNA + let apps = conductor + .setup_app_for_agents("elemental-chat", &agents, &[dna]) + .await + .unwrap(); + let ((alice_cell,), (bobbo_cell,)) = apps.into_tuples(); + let alice_chat = &alice_cell.zome("chat"); + let bobbo_chat = &bobbo_cell.zome("chat"); + + // Setup complete. + + let channel: ChannelData = conductor + .call( + alice_chat, + "create_channel", + ChannelInput { + name: "Test Ch".into(), + entry: Channel { + category: "General".into(), + uuid: uuid::Uuid::new_v4().to_string(), + }, + }, + ) + .await; + + let long_msg = MessageInput { + last_seen: LastSeen::First, + channel: channel.entry.clone(), + entry: Message { + uuid: "long msg".into(), + content: std::iter::repeat('x').take(1025).collect(), + }, + }; + + let error: ConductorApiResult = conductor + .call_fallible(alice_chat, "create_message", long_msg.clone()) + .await; + + assert!(matches!(error, Err(ConductorApiError::CellError(_)))); + + let mut msg0 = long_msg; + msg0.entry.uuid = "msg0".into(); + msg0.entry.content = "Hello from alice :)".into(); + + let res0: MessageData = conductor + .call(alice_chat, "create_message", msg0.clone()) + .await; + + assert_eq!(msg0.entry, res0.entry); + + let mut msg1 = msg0.clone(); + msg1.last_seen = LastSeen::Message(res0.entry_hash.clone()); + msg1.entry.uuid = "msg1".into(); + msg1.entry.content = "Is anybody out there?".into(); + + let res1: MessageData = conductor + .call(alice_chat, "create_message", msg1.clone()) + .await; + + assert_eq!(msg1.entry, res1.entry); + + // let current_time = Utc::now(); + let lmpi = ListMessagesInput { + channel: channel.entry.clone(), + earliest_seen: None, + target_message_count: 1, + }; + + let alice_msgs: ListMessages = conductor + .call(alice_chat, "list_messages", lmpi.clone()) + .await; + println!(">{:?}", alice_msgs); + // TODO: add consistency awaiting to sweettest + tokio::time::sleep(tokio::time::Duration::from_millis(4000)).await; + + let bobbo_msgs: ListMessages = conductor + .call(bobbo_chat, "list_messages", lmpi.clone()) + .await; + + // Alice got all messages so far. + assert_eq!( + alice_msgs.messages.as_slice(), + &[res0.clone(), res1.clone()] + ); + // Bobbo got the same messages as Alice. + assert_eq!(alice_msgs, bobbo_msgs); + + let mut msg2 = msg1.clone(); + msg2.last_seen = LastSeen::Message(res1.entry_hash.clone()); + msg2.entry.uuid = "msg2".into(); + msg2.entry.content = "I'm here".into(); + + let mut msg3 = msg1.clone(); + msg3.last_seen = LastSeen::Message(res1.entry_hash.clone()); + msg3.entry.uuid = "msg3".into(); + msg3.entry.content = "Anybody?".into(); + + let res2: MessageData = conductor + .call(alice_chat, "create_message", msg2.clone()) + .await; + let res3: MessageData = conductor + .call(bobbo_chat, "create_message", msg3.clone()) + .await; + + // TODO: add consistency awaiting to sweettest + tokio::time::sleep(tokio::time::Duration::from_millis(4000)).await; + + let alice_msgs: ListMessages = conductor + .call(alice_chat, "list_messages", lmpi.clone()) + .await; + + let bobbo_msgs: ListMessages = conductor + .call(bobbo_chat, "list_messages", lmpi.clone()) + .await; + + // Alice got all messages so far. + assert_eq!( + alice_msgs.messages.as_slice(), + &[res0.clone(), res1.clone(), res2.clone(), res3.clone()] + ); + // Bobbo got the same messages as Alice. + println!("{:?}", alice_msgs); + assert_eq!(alice_msgs, bobbo_msgs); +} diff --git a/zomes/membrane_manager/Cargo.toml b/zomes/membrane_manager/Cargo.toml index f2827d4..c3da1f2 100644 --- a/zomes/membrane_manager/Cargo.toml +++ b/zomes/membrane_manager/Cargo.toml @@ -9,6 +9,6 @@ name = "membrane_manager" crate-type = [ "cdylib", "rlib" ] [dependencies] -membrane_manager_lib = {git = "https://github.com/holochain/hc-zome-lib", branch = "v0.0.123", package = "membrane_manager_lib"} -hdk = "=0.0.123" -hc_utils = "=0.0.123" +hdk = "=0.0.126" +hc_utils = "=0.0.126" +membrane_manager_lib = {git = "https://github.com/holochain/hc-zome-lib", branch = "v0.0.126", package = "membrane_manager_lib"} diff --git a/zomes/profile/Cargo.toml b/zomes/profile/Cargo.toml index b2b5a44..13c4070 100644 --- a/zomes/profile/Cargo.toml +++ b/zomes/profile/Cargo.toml @@ -10,6 +10,6 @@ crate-type = [ "cdylib", "rlib" ] doctest = false [dependencies] -hdk = "=0.0.123" -hc_utils = "=0.0.123" -profile = {git = "https://github.com/holochain/hc-zome-lib", branch = "v0.0.123", package = "profile"} +hdk = "=0.0.126" +hc_utils = "=0.0.126" +profile = {git = "https://github.com/holochain/hc-zome-lib", branch = "v0.0.126", package = "profile"}