Routing - Build and Play With maidsafe/routing library (Rust version)

I too received the “thread main panicked” error when I tried running this with a simple put request. I am running Ubuntu 14.04 LTS.

first try with ubuntu 15.04

mranderson@neo:~/safe/routing$ cargo test --release
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading accumulator v0.0.1
 Downloading message_filter v0.1.1
 Downloading crust v0.0.8
 Downloading lru_time_cache v0.1.7
   Compiling libsodium-sys v0.0.5
   Compiling strsim v0.3.0
   Compiling byteorder v0.3.10
   Compiling regex-syntax v0.1.1
   Compiling gcc v0.3.5
   Compiling rustc-serialize v0.3.14
   Compiling libc v0.1.8
   Compiling term v0.2.7
   Compiling rand v0.3.8
   Compiling time v0.1.25
   Compiling sodiumoxide v0.0.4
   Compiling regex v0.1.33
   Compiling lru_time_cache v0.1.7
   Compiling message_filter v0.1.1
   Compiling accumulator v0.0.1
   Compiling cbor v0.3.6
   Compiling docopt v0.6.64
   Compiling crust v0.0.8
   Compiling routing v0.1.60 (file:///home/mranderson/safe/routing)
examples/routing.rs:135:21: 135:30 warning: unused variable: `responses`, #[warn(unused_variables)] on by default
examples/routing.rs:135     fn merge(&self, responses: Vec<Box<Sendable>>) -> Option<Box<Sendable>> { None }
                                            ^~~~~~~~~
examples/routing.rs:200:30: 200:37 warning: unused variable: `type_id`, #[warn(unused_variables)] on by default
examples/routing.rs:200     fn handle_get(&mut self, type_id: u64, name: NameType, our_authority: Authority,
                                                     ^~~~~~~
examples/routing.rs:200:60: 200:73 warning: unused variable: `our_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:200     fn handle_get(&mut self, type_id: u64, name: NameType, our_authority: Authority,
                                                                                   ^~~~~~~~~~~~~
examples/routing.rs:201:19: 201:33 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:201                   from_authority: Authority, from_address: NameType)
                                          ^~~~~~~~~~~~~~
examples/routing.rs:211:56: 211:70 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:211     fn handle_put(&mut self, our_authority: Authority, from_authority: Authority,
                                                                               ^~~~~~~~~~~~~~
examples/routing.rs:212:41: 212:53 warning: unused variable: `dest_address`, #[warn(unused_variables)] on by default
examples/routing.rs:212                 from_address: NameType, dest_address: types::DestinationAddress,
                                                                ^~~~~~~~~~~~
examples/routing.rs:238:31: 238:44 warning: unused variable: `our_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:238     fn handle_post(&mut self, our_authority: Authority, from_authority: Authority,
                                                      ^~~~~~~~~~~~~
examples/routing.rs:238:57: 238:71 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:238     fn handle_post(&mut self, our_authority: Authority, from_authority: Authority,
                                                                                ^~~~~~~~~~~~~~
examples/routing.rs:239:20: 239:32 warning: unused variable: `from_address`, #[warn(unused_variables)] on by default
examples/routing.rs:239                    from_address: NameType, name : NameType, data: Vec<u8>) -> Result<MessageAction, InterfaceError> {
                                           ^~~~~~~~~~~~
examples/routing.rs:239:44: 239:48 warning: unused variable: `name`, #[warn(unused_variables)] on by default
examples/routing.rs:239                    from_address: NameType, name : NameType, data: Vec<u8>) -> Result<MessageAction, InterfaceError> {
                                                                   ^~~~
examples/routing.rs:239:61: 239:65 warning: unused variable: `data`, #[warn(unused_variables)] on by default
examples/routing.rs:239                    from_address: NameType, name : NameType, data: Vec<u8>) -> Result<MessageAction, InterfaceError> {
                                                                                    ^~~~
examples/routing.rs:253:39: 253:53 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:253     fn handle_put_response(&mut self, from_authority: Authority, from_address: NameType,
                                                              ^~~~~~~~~~~~~~
examples/routing.rs:261:40: 261:54 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:261     fn handle_post_response(&mut self, from_authority: Authority, from_address: NameType,
                                                               ^~~~~~~~~~~~~~
examples/routing.rs:261:67: 261:79 warning: unused variable: `from_address`, #[warn(unused_variables)] on by default
examples/routing.rs:261     fn handle_post_response(&mut self, from_authority: Authority, from_address: NameType,
                                                                                          ^~~~~~~~~~~~
examples/routing.rs:262:29: 262:37 warning: unused variable: `response`, #[warn(unused_variables)] on by default
examples/routing.rs:262                             response: Result<Vec<u8>, ResponseError>) {
                                                    ^~~~~~~~
examples/routing.rs:265:32: 265:43 warning: unused variable: `close_group`, #[warn(unused_variables)] on by default
examples/routing.rs:265     fn handle_churn(&mut self, close_group: Vec<NameType>)
                                                       ^~~~~~~~~~~
examples/routing.rs:269:36: 269:43 warning: unused variable: `type_id`, #[warn(unused_variables)] on by default
examples/routing.rs:269     fn handle_cache_get(&mut self, type_id: u64, name : NameType, from_authority: Authority,
                                                           ^~~~~~~
examples/routing.rs:269:67: 269:81 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:269     fn handle_cache_get(&mut self, type_id: u64, name : NameType, from_authority: Authority,
                                                                                          ^~~~~~~~~~~~~~
examples/routing.rs:270:25: 270:37 warning: unused variable: `from_address`, #[warn(unused_variables)] on by default
examples/routing.rs:270                         from_address: NameType) -> Result<MessageAction, InterfaceError> {
                                                ^~~~~~~~~~~~
examples/routing.rs:279:36: 279:50 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:279     fn handle_cache_put(&mut self, from_authority: Authority, from_address: NameType,
                                                           ^~~~~~~~~~~~~~
examples/routing.rs:279:63: 279:75 warning: unused variable: `from_address`, #[warn(unused_variables)] on by default
examples/routing.rs:279     fn handle_cache_put(&mut self, from_authority: Authority, from_address: NameType,
                                                                                      ^~~~~~~~~~~~
examples/routing.rs:294:23: 294:30 warning: unused variable: `type_id`, #[warn(unused_variables)] on by default
examples/routing.rs:294                       type_id: u64,
                                              ^~~~~~~
examples/routing.rs:295:23: 295:27 warning: unused variable: `name`, #[warn(unused_variables)] on by default
examples/routing.rs:295                       name: NameType,
                                              ^~~~
examples/routing.rs:296:23: 296:36 warning: unused variable: `our_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:296                       our_authority: Authority,
                                              ^~~~~~~~~~~~~
examples/routing.rs:297:23: 297:37 warning: unused variable: `from_authority`, #[warn(unused_variables)] on by default
examples/routing.rs:297                       from_authority: Authority,
                                              ^~~~~~~~~~~~~~
examples/routing.rs:298:23: 298:35 warning: unused variable: `from_address`, #[warn(unused_variables)] on by default
examples/routing.rs:298                       from_address: NameType) -> Result<MessageAction, InterfaceError> {
                                              ^~~~~~~~~~~~
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/mranderson/safe/routing/target/release/examples/routing.o" "-o" "/home/mranderson/safe/routing/target/release/examples/routing" "-Wl,--whole-archive" "-l" "morestack" "-Wl,--no-whole-archive" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "/home/mranderson/safe/routing/target/release/librouting.rlib" "/home/mranderson/safe/routing/target/release/deps/libcrust-d6821763c1cced95.rlib" "/home/mranderson/safe/routing/target/release/deps/libcbor-a029b1d21f636c96.rlib" "/home/mranderson/safe/routing/target/release/deps/libsodiumoxide-a4232303ae15c797.rlib" "/home/mranderson/safe/routing/target/release/deps/libdocopt-40f44425b0f8ac23.rlib" "/home/mranderson/safe/routing/target/release/deps/librustc_serialize-9ef26f158d5284e0.rlib" "/home/mranderson/safe/routing/target/release/deps/libregex-bee3bd02b59b955b.rlib" "/home/mranderson/safe/routing/target/release/deps/libstrsim-fb046b3f6ce0ea34.rlib" "/home/mranderson/safe/routing/target/release/deps/libmessage_filter-8edeae30bd46a7f4.rlib" "/home/mranderson/safe/routing/target/release/deps/libbyteorder-b315ab53bf71328b.rlib" "/home/mranderson/safe/routing/target/release/deps/librand-b924d9fc5b3eb5b8.rlib" "/home/mranderson/safe/routing/target/release/deps/libregex_syntax-030d2a219106b7e6.rlib" "/home/mranderson/safe/routing/target/release/deps/liblibsodium_sys-a15ae7085732209a.rlib" "/home/mranderson/safe/routing/target/release/deps/libaccumulator-048959da5609f427.rlib" "/home/mranderson/safe/routing/target/release/deps/liblru_time_cache-d1e5903187af717e.rlib" "/home/mranderson/safe/routing/target/release/deps/libtime-e758cbe877e9589d.rlib" "/home/mranderson/safe/routing/target/release/deps/liblibc-2eda841eb12a3090.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-11582ce5.rlib" "-L" "/home/mranderson/safe/routing/target/release" "-L" "/home/mranderson/safe/routing/target/release/deps" "-L" "/home/mranderson/safe/routing/target/release/build/time-e758cbe877e9589d/out" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/mranderson/safe/routing/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/mranderson/safe/routing/lib/x86_64-unknown-linux-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-l" "sodium" "-l" "rt" "-l" "c" "-l" "m" "-l" "dl" "-l" "pthread" "-l" "rt" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: /usr/bin/ld: cannot find -lsodium
collect2: error: ld returned 1 exit status

error: aborting due to previous error
Build failed, waiting for other jobs to finish...
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/mranderson/safe/routing/target/release/routing-3f83c71d6bf52366.o" "-o" "/home/mranderson/safe/routing/target/release/routing-3f83c71d6bf52366" "-Wl,--whole-archive" "-l" "morestack" "-Wl,--no-whole-archive" "-Wl,--gc-sections" "-pie" "-Wl,-O1" "-nodefaultlibs" "/home/mranderson/safe/routing/target/release/deps/libmessage_filter-8edeae30bd46a7f4.rlib" "/home/mranderson/safe/routing/target/release/deps/libaccumulator-048959da5609f427.rlib" "/home/mranderson/safe/routing/target/release/deps/liblru_time_cache-d1e5903187af717e.rlib" "/home/mranderson/safe/routing/target/release/deps/libcrust-d6821763c1cced95.rlib" "/home/mranderson/safe/routing/target/release/deps/libcbor-a029b1d21f636c96.rlib" "/home/mranderson/safe/routing/target/release/deps/librustc_serialize-9ef26f158d5284e0.rlib" "/home/mranderson/safe/routing/target/release/deps/librand-b924d9fc5b3eb5b8.rlib" "/home/mranderson/safe/routing/target/release/deps/libbyteorder-b315ab53bf71328b.rlib" "/home/mranderson/safe/routing/target/release/deps/libtime-e758cbe877e9589d.rlib" "/home/mranderson/safe/routing/target/release/deps/libsodiumoxide-a4232303ae15c797.rlib" "/home/mranderson/safe/routing/target/release/deps/liblibsodium_sys-a15ae7085732209a.rlib" "/home/mranderson/safe/routing/target/release/deps/liblibc-2eda841eb12a3090.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserialize-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblog-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-11582ce5.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-11582ce5.rlib" "-L" "/home/mranderson/safe/routing/target/release" "-L" "/home/mranderson/safe/routing/target/release/deps" "-L" "/home/mranderson/safe/routing/target/release/build/time-e758cbe877e9589d/out" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/mranderson/safe/routing/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/mranderson/safe/routing/lib/x86_64-unknown-linux-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-l" "rt" "-l" "sodium" "-l" "c" "-l" "m" "-l" "dl" "-l" "pthread" "-l" "rt" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: /usr/bin/ld: cannot find -lsodium
collect2: error: ld returned 1 exit status

error: aborting due to previous error
Could not compile `routing`.

I fixed by going to ubuntu software store and installing “libsodium13”
cargo test --release passed!!

mranderson@neo:~/safe/routing/target/release/examples$ ./routing -n
d55fdb..2805be  -- listening on : [Tcp(V4(127.0.1.1:46251))]
bootstrap Tcp(V4(127.0.1.1:56310))
Input command (stop)
 handle_new_connect_event peer_ep : Tcp(V4(127.0.1.1:56310))
d55fdb..2805be received FindGroupResponse
d55fdb..2805be received FindGroupResponse
d55fdb..2805be received FindGroupResponse
d55fdb..2805be received FindGroupResponse
 handle_new_connect_event peer_ep : Tcp(V4(127.0.0.1:41180))
 handle_new_connect_event peer_ep : Tcp(V4(127.0.0.1:41181))
d55fdb..2805be received ConnectResponse
RT (size : 1) added e2982c..d4e187
 handle_new_connect_event peer_ep : Tcp(V4(127.0.0.1:41182))
 handle_new_connect_event peer_ep : Tcp(V4(127.0.0.1:41183))
d55fdb..2805be received ConnectResponse
RT (size : 2) added 715752..b0a5d4
d55fdb..2805be received ConnectResponse
RT (size : 3) added d6d22b..b94b72
 handle_new_connect_event peer_ep : Tcp(V4(127.0.1.1:45746))
RT (size : 3) Marked connected peer_id : 715752..b0a5d4 , peer_ep : Tcp(V4(127.0.1.1:45746))
 handle_new_connect_event peer_ep : Tcp(V4(127.0.1.1:55276))
RT (size : 3) Marked connected peer_id : d6d22b..b94b72 , peer_ep : Tcp(V4(127.0.1.1:55276))
d55fdb..2805be received ConnectResponse
RT (size : 4) added a8e32d..132b74
 handle_new_connect_event peer_ep : Tcp(V4(127.0.1.1:53702))
RT (size : 4) Marked connected peer_id : a8e32d..132b74 , peer_ep : Tcp(V4(127.0.1.1:53702))
4 Likes

I’ve now built the source and ran a small local network (about 10 nodes) with the simple_key_value_store.rs example. I’m running MinGW-w64 on Win7. It seems to work great. Shutting down nodes and then restarting new ones, the data is still there. I tested multiple clients accessing the data, too.

First Node:

ZERO listening on Some(Tcp(V6([2602:306:bdae:9e30:dc01:2112:58b9:8947]:56879))),
 named 7da894..33e6e3
Enter command (stop)>
Started Membrane loop
CRUST::NewConnection on Tcp(V4(192.168.1.64:56913))
CRUST::NewConnection on Tcp(V4(127.0.0.1:56914))
Added endpoint Tcp(V4(192.168.1.64:56913)) to relay map, named 079acb..413fdd
FIRST NODE BOOSTRAPS OFF OF ZERO NODE
CRUST::NewConnection on Tcp(V4(192.168.1.64:56880))
RT (size : 1) added connected node 738aa6..fdf38e on Tcp(V4(192.168.1.64:56880))

Handle CHURN new node 738aa6..fdf38e
RT: 7da894..33e6e3
RT: 738aa6..fdf38e
CRUST::NewConnection on Tcp(V4(192.168.1.64:56950))
Added endpoint Tcp(V4(192.168.1.64:56950)) to relay map, named ceed35..47785e
RELOCATED ceed35..47785e to 7193f6..c1e1ae
CACHED RELOCATED 7193f6..c1e1ae
CRUST::NewConnection on Tcp(V4(192.168.1.64:56918))
Connection Tcp(V4(192.168.1.64:56913)) lost for relayed node 079acb..413fdd
RT (size : 2) added connected node 7193f6..c1e1ae on Tcp(V4(192.168.1.64:56918))

Handle CHURN new node 7193f6..c1e1ae
RT: 7da894..33e6e3
RT: 7193f6..c1e1ae
RT: 738aa6..fdf38e
Connection Tcp(V4(192.168.1.64:56950)) lost for relayed node ceed35..47785e
CRUST::NewConnection on Tcp(V4(192.168.1.64:56990))
CRUST::NewConnection on Tcp(V4(127.0.0.1:56993))
Added endpoint Tcp(V4(192.168.1.64:56990)) to relay map, named 86328b..142bee
ClientManager forwarding data to DataManager around 40d380..34e6cc
testing node handle put request from 86328b..142bee of data TestData(key: any, v
alue: thing can be stored)
MessageAction::Reply on PutResponse.
testing node handle put request from 86328b..142bee of data TestData(key: any, v
alue: thing can be stored)
testing node handle put request from 86328b..142bee of data TestData(key: any, v
alue: thing can be stored)

Client:

Enter command (stop | put <key> <value> | get <key>)>
trying to bootstrapped client
bootstrapped client
Sending connect request
received a ConnectResponse from Tcp(V4(192.168.1.64:56879))
put any thing can be stored
Putting value of "thing can be stored" to network under key "any".
Put sent out with message_id 863328949
Enter command (stop | put <key> <value> | get <key>)>
received a PutDataResponse from Tcp(V4(192.168.1.64:56879))
Testing client received put_response 863328949 with testdata TestData(key: any,
value: thing can be stored)
received a PutDataResponse from Tcp(V4(192.168.1.64:56879))
Testing client received put_response 863328949 with testdata TestData(key: any,
value: thing can be stored)
received a PutDataResponse from Tcp(V4(192.168.1.64:56879))
Testing client received put_response 863328949 with testdata TestData(key: any,
value: thing can be stored)

Thanks for putting up this guide. Can’t wait to help develop this.

6 Likes

Hi,

I got this error:

src/authority.rs:164:36: 164:47 error: unresolved import messages::MessageType. There is no MessageType in messages [E0432]
src/authority.rs:164 use messages::{RoutingMessage, MessageType};
^~~~~~~~~~~
src/authority.rs:164:36: 164:47 help: run rustc --explain E0432 to see a detailed explanation
error: aborting due to previous error
examples/simple_key_value_store.rs:61:31: 61:45 error: unresolved import routing::node_interface::CreatePersonas. Could not find node_interface in routing [E0432]
examples/simple_key_value_store.rs:61 use routing::node_interface::{CreatePersonas, Interface, MethodCall};
^~~~~~~~~~~~~~
examples/simple_key_value_store.rs:61:31: 61:45 help: run rustc --explain E0432 to see a detailed explanation
examples/simple_key_value_store.rs:64:5: 64:32 error: unresolved import routing::sendable::Sendable. Could not find sendable in routing [E0432]
examples/simple_key_value_store.rs:64 use routing::sendable::Sendable;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
examples/simple_key_value_store.rs:64:5: 64:32 help: run rustc --explain E0432 to see a detailed explanation
examples/simple_key_value_store.rs:62:5: 62:43 error: unresolved import routing::routing_client::RoutingClient. Could not find routing_client in routing [E0432]
examples/simple_key_value_store.rs:62 use routing::routing_client::RoutingClient;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
examples/simple_key_value_store.rs:62:5: 62:43 help: run rustc --explain E0432 to see a detailed explanation
examples/simple_key_value_store.rs:61:58: 61:68 error: unresolved import routing::node_interface::MethodCall. Could not find node_interface in routing [E0432]
examples/simple_key_value_store.rs:61 use routing::node_interface::{CreatePersonas, Interface, MethodCall};
^~~~~~~~~~
examples/simple_key_value_store.rs:61:58: 61:68 help: run rustc --explain E0432 to see a detailed explanation
examples/simple_key_value_store.rs:61:47: 61:56 error: unresolved import routing::node_interface::Interface. Could not find node_interface in routing [E0432]
examples/simple_key_value_store.rs:61 use routing::node_interface::{CreatePersonas, Interface, MethodCall};
^~~~~~~~~
examples/simple_key_value_store.rs:61:47: 61:56 help: run rustc --explain E0432 to see a detailed explanation
error: aborting due to 5 previous errors
Could not compile routing.

Any thoughts?

If this is current routing, in last few mins we just pushed a massive breaking change to master. For the next few days it will compile (with nigtly) but not pass tests of run the example. Sorry for this but it had to be done or we would need to slow down and we opted for push through the sprint. Today was a day a lot of things came together and made sense to bite the bullet. We won’t be long, if you want a working routing then the 0.2 branch is stable and works.

5 Likes