The Safe Network Core. API message definitions, routing and nodes, client core api.

Overview

safe_network

The Safe Network Core. API message definitions, routing and nodes, client core api.

Documentation

License

This Safe Network repository is licensed under the General Public License (GPL), version 3 (LICENSE http://www.gnu.org/licenses/gpl-3.0.en.html).

Linking exception

safe_network is licensed under GPLv3 with linking exception. This means you can link to and use the library from any program, proprietary or open source; paid or gratis. However, if you modify safe_network, you must distribute the source to your modified version under the terms of the GPLv3.

See the LICENSE file for more details.

Contributing

Want to contribute? Great 🎉

There are many ways to give back to the project, whether it be writing new code, fixing bugs, or just reporting errors. All forms of contributions are encouraged!

For instructions on how to contribute, see our Guide to contributing.

Comments
  • fix(node): increasing timeout for Elder-to-Adult query responses to 70secs

    fix(node): increasing timeout for Elder-to-Adult query responses to 70secs

    • feat(node): allow to change the timeout for Elder-to-Adult query responses by setting SN_ADULT_RESPONSE_TIMEOUT env var
    • chore(client): set 90secs for cmds (SN_CMD_TIMEOUT) and queries (SN_QUERY_TIMEOUT) timeout period in sn-client as default.
    • chore(node): set 70secs for Elder-to-Adult query responses (SN_ADULT_RESPONSE_TIMEOUT) timeout period in sn_node to as default.
    • Setting the same values explicitly for sn_client e2e tests in CI/bors, just to make sure whenever we start adjusting the default vaues we don't change those for CI which have been shown to be adequate in current CI/bors setups so far.
    opened by bochaco 70
  • feat(node): retry sending msg to peer cleaning all cached bad connections

    feat(node): retry sending msg to peer cleaning all cached bad connections

    • When sending a msg to a peer, if it fails with an existing cached connection, it will keep retrying till it either finds another cached connection which it succeeds with, or it cleans them all up from the cache creating a new connection to the peer as last attempt.
    • Also this includes some minor improvements to Comm log msgs.
    • Upgrading qp2p to v0.34.0.
    opened by bochaco 47
  • chore(node): Pass around MyNodeState to avoid holding locks

    chore(node): Pass around MyNodeState to avoid holding locks

    For longer running message handling, we now pass around the inital MyNodeState. This avoids a tonnnn of read locks and therefore hopefully prevents holding up write and reads needlessly.

    opened by joshuef 43
  • chore(client): disabling keep-alive msgs from client to nodes

    chore(client): disabling keep-alive msgs from client to nodes

    • Setting sn_node idle-timeout to 70secs (to match ADULT_RESPONSE_TIMEOUT), which allows the node to keep client connections a bit longer since it may need more time (when under stress) to send back a response before closing them.
    • Setting sn_client default idle_timeout to match query/cmd timeout values.
    opened by bochaco 26
  • Nr 1: Client to elder msg happy path

    Nr 1: Client to elder msg happy path

    • feat(cmds): add cmd-happy-path feature This allows clients to default to a lower impact interaction with elders, only expanding the impact on failures.
    • feat(queries): add query-happy-path feature This allows clients to default to a lower impact interaction with elders (todo: only expanding the impact on failures). Adds combined feat for both cmd and query happy path.
    • chore(ci): add msg-happy-path e2e ci job
    • chore(docs): update sn_client readme

    A follow up PR (#1856, currently in draft) adds happy path in the next step of client data cmd; data replication from elders to adults.

    opened by oetyng 21
  • RFC: Remove Private Scope

    RFC: Remove Private Scope

    Why? The main distinction between private and public data is:

    1. private data can be deleted, public data can not
    2. private data is encrypted separately from self_encryption. public data is not encrypted again (besides self_encryption)

    Regarding 1, we don't have a way to implement deletion reliably, if the data is ever re-uploaded, or one of the adults fails to delete it for some reason (missed a packet), it would remain replicated and held by the network. So right now we don't have a story for how to delete reliably, but we are paying the complexity cost of keeping track of the public/private distinction: (see the large diff)

    Regarding 2. We can expose the option to the client to encrypt some data before updating, we don't need to expose this private/public distinction to the network in order to support this use-case.

    This was more of an exploration to see how much this public/private data distinction is costing us in terms of code complexity.

    opened by davidrusu 19
  • feat(node): perform signature verifications on input DBC SpentProof before signing new spent proof share

    feat(node): perform signature verifications on input DBC SpentProof before signing new spent proof share

    This is a follow up PR (6th PR) to PR https://github.com/maidsafe/safe_network/pull/1274, PR https://github.com/maidsafe/safe_network/pull/1235, PR https://github.com/maidsafe/safe_network/pull/1097, PR https://github.com/maidsafe/safe_network/pull/1105, and PR https://github.com/maidsafe/safe_network/pull/1143.

    • This implements SpentProofs signature verification by nodes before signing for a spent proof share, as well as checking that each SpentProof has been signed by a known section key (by checking the sections chains).
    • The input key for the genesis DBC TX is changed to be the same as the genesis key and owner of the genesis DBC. This makes the genesis spent-proof TX to be signed by the genesis key, and it allows nodes to realise when the genesis DBC is the one being spent when doing the SpentProof public key verification described above.
    • Adapt client_api spentbook test to read genesis DBC from first node in testnet, by default from ~/.safe/node/local-test-network/sn-node-genesis/genesis_dbc, unless a path is provided on TEST_ENV_GENESIS_DBC_PATH env var.
    • We temporarily allow double spents in this sn_client test. Once we have the SpentBook implementation which prevents double spents, we'll need to adapt this sn_client test to verify there is no double spent of the genesis DBC.
    opened by bochaco 18
  • fix(client): set default keep-alive interval to be 1/2 of idle_timeout value set

    fix(client): set default keep-alive interval to be 1/2 of idle_timeout value set

    • By default the sn_client keep_alive msgs interval will now be set to 1/2 the value set for the idle_timeout value.
    • Removing unused ClientBuilder::cmd_ack_wait config value.
    • Decreasing the CI timeout for sn_client, sn_api, and CLI tests, to 7mins.
    • New LogMarker::IncomingConnection logged by sn_node.
    • Minor improvements to some log msgs.

    With PR #1927 we may be able to actually remove keep-alive msgs from client (if testing is successful), but this PR already introduces an improvement by reducing the amount of QUIC msgs sent to the network.

    opened by bochaco 17
  • feat(ci): verify members in network knowledge are the expected

    feat(ci): verify members in network knowledge are the expected

    • Additional checks added to all_nodes_joined.sh script to be able to detect nodes in the network knowledge which are not those that effectively joined the network.
    • Also some minor improvements to sn_client log msgs.

    Example output when there is a mismatch of members and joined nodes:

    Checking nodes log files to verify all nodes have joined. Logs path: ~/.safe/node/local-test-network
    Number of nodes: 15
    All nodes have joined. Nodes IPs:
    127.0.0.1:57739
    127.0.0.1:57751
    127.0.0.1:57745
    127.0.0.1:57740
    127.0.0.1:57747
    127.0.0.1:57748
    127.0.0.1:57749
    127.0.0.1:57754
    127.0.0.1:57744
    127.0.0.1:57741
    127.0.0.1:57742
    127.0.0.1:57743
    127.0.0.1:57752
    127.0.0.1:57750
    127.0.0.1:57753
    
    Checking if nodes in network knowledge match the list of nodes IPs...
    Node 127.0.0.1:57750 is a valid member
    Node 127.0.0.1:57746 in network knowledge was not found in the list of nodes IPs
    Node 127.0.0.1:57753 is a valid member
    Node 127.0.0.1:57741 is a valid member
    Node 127.0.0.1:57743 is a valid member
    Node 127.0.0.1:57752 is a valid member
    Node 127.0.0.1:57739 is a valid member
    Node 127.0.0.1:57748 is a valid member
    Node 127.0.0.1:57751 is a valid member
    Node 127.0.0.1:57747 is a valid member
    Node 127.0.0.1:57744 is a valid member
    Node 127.0.0.1:57749 is a valid member
    Node 127.0.0.1:57740 is a valid member
    Node 127.0.0.1:57745 is a valid member
    Node 127.0.0.1:57742 is a valid member
    
    At least one member in the network knowledge was found invalid
    
    opened by bochaco 16
  • Active Data Republishing

    Active Data Republishing

    Tweaks the liveness tracker to detect nodes that begin to accumulate pending operations. These deviant nodes' data are pre-emptively replicated to avoid data loss and improve fault tolerance in the network.

    opened by Yoga07 14
  • fix: remove dummy SectionTree update

    fix: remove dummy SectionTree update

    Fixes https://github.com/maidsafe/safe_network/issues/1810 Fixes https://github.com/maidsafe/safe_network/issues/1798

    • fix(section_tree): genesis_sap is required to create the SectionTree
      • The fields of the tree are assumed to be in sync. But it is not the case for a newly created tree.
      • This can be fixed by accepting the genesis sap while creating the tree.
    • refactor(network_knowledge): rework constructor
      • Allows us to create a minimal NetworkKnowledge by just providing the genesis SAP. This will be set as our current signed_sap. A new SectionTree is also created with the provided SAP.
      • Optionally, we can provide a SectionTree which will replace our current tree. In this case, the provided SAP is considered to be part of the tree and is set as our current signed_sap
    opened by RolandSherwin 13
  • Remove unused node keypairs

    Remove unused node keypairs

    Removes unused Node Keypairs in sn_interface In fact sn_node has its own:

    pub(crate) struct MyNode {
            ...
            pub(crate) keypair: Arc<Keypair>,
            pub(crate) section_keys_provider: SectionKeysProvider,
            ...
    }
    
    opened by grumbach 2
  • sn_api error -> wallet.rs:290:17 c.f. sn_dbc::PublicKey

    sn_api error -> wallet.rs:290:17 c.f. sn_dbc::PublicKey

    An odd error spawned from a first pass at a flutter-rust bridge.. that is graphical front end for instances of rust api. The cargo build --release works fine.. this is a simple pull from the current main safe_network code.

    It seems that flutter build linux uses cmake; so, perhaps this is providing a different perspective on the code?.. That looks to be the same as https://crates.io/crates/cmake

    I'm not expecting you will reproduce this - there's a bit of work setting it up but hoping those familiar with the code, can make sense of what the error below suggests..

    $ flutter build linux
    
    💪 Building with sound null safety 💪
    
       Compiling sn_api v0.75.3 (/mnt/vault/flutter/safe/native)
    error[E0277]: a value of type `Vec<(std::string::String, std::option::Option<sn_dbc::PublicKey>)>` cannot be built from an iterator over elements of type `&(std::string::String, std::option::Option<sn_dbc::PublicKey>)`
        --> src/safe_network/sn_api/src/app/wallet.rs:290:17
         |
    290  | /                 [(amount.to_string(), owner_public_key)]
    291  | |                     .into_iter()
         | |________________________________^ value of type `Vec<(std::string::String, std::option::Option<sn_dbc::PublicKey>)>` cannot be built from `std::iter::Iterator<Item=&(std::string::String, std::option::Option<sn_dbc::PublicKey>)>`
    292  |                       .collect(),
         |                        ------- required by a bound introduced by this call
         |
         = help: the trait `FromIterator<&(std::string::String, std::option::Option<sn_dbc::PublicKey>)>` is not implemented for `Vec<(std::string::String, std::option::Option<sn_dbc::PublicKey>)>`
         = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
    note: required by a bound in `std::iter::Iterator::collect`
        --> /mnt/vault/dev-tools/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:1832:19
         |
    1832 |     fn collect<B: FromIterator<Self::Item>>(self) -> B
         |                   ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::collect`
    
    For more information about this error, try `rustc --explain E0277`.
    error: could not compile `sn_api` due to previous error
    Building Linux application...                                           
    Build process failed
    

    fyi: The basis of this bridge is described at https://blog.logrocket.com/using-flutter-rust-bridge-cross-platform-development/#creating-flutter-rust-bridge-project and then from a core template from git clone https://github.com/Desdaemon/flutter_rust_bridge_template .. rust in one bit; flutter in another.. and the outputs are notionally apps for all platforms. Worth resolving then for that interest.

    opened by davidpbrown 0
  • fix(client): retry only once when check-replicas test query fails due to diff responses

    fix(client): retry only once when check-replicas test query fails due to diff responses

    • Re-enabling e2e sn_client tests multi-threaded mode.
    • Retrying a test query only once, and only if the failure was due to receiving different responses from the data replicas, which may be due to a temporary out of sync. We've seen this very occasionally in CI with Register queries/entries.
    opened by bochaco 11
  • Make elders also store data

    Make elders also store data

    • Removes the storage level state and updates.
    • Removes the storage distinction between Elders and Adults, which means that Elders and Adults are all considered equal nodes, responsible for storing data in the same way.
    • Adds a joins_allowed_until_split variable + logic, which can now be used by Elders to split based on section storage level, without bookkeeping the levels of other nodes. They do this by assuming that the section general level of used space is similar to their own level.

    Follow up PRs:

    • The JoinsAllowedUntilSplit addition could be split out to its own PR. But it's not a biggie.
    • To ensure as close to uniform distribution of nodes as possible (and handle cases where it is not).
    opened by oetyng 7
Releases(0.16.12-0.15.0-0.77.6-0.72.23-0.75.3-0.68.4)
Owner
MaidSafe
MaidSafe
User-space Wireguard gateway allowing sharing network connection from environment where usual routing rules are inaccessible.

wgslirpy A command line tool (and a Rust library) for accepting incoming connections within a Wireguard link and routing them to external network usin

Vitaly Shukela 4 Aug 21, 2023
Peer-to-peer overlay routing

Rust_Pinecone This is a port of the peer-to-peer overlay routing mechanism Pinecone and aims to be interoperable with it, although it isn't yet becaus

null 3 Aug 2, 2022
Easy protocol definitions in Rust

protocol Documentation Easy protocol definitions in Rust. This crate adds a custom derive that can be added to types, allowing structured data to be s

Dylan McKay 157 Dec 30, 2022
Core library for Lightning Network peer-to-peer nostr platform

Mostro server This document explains how Mostro works. Overview Due to the growing need to be able to operate with Bitcoin without giving up personal

Mostro 16 Jan 4, 2023
A simple message based networking library for the bevy framework

Spicy Networking for Bevy bevy_spicy_networking is a solution to the "How do I connect multiple clients to a single server" problem in your bevy games

Cabbit Studios 67 Jan 1, 2023
pam-send-slack-message is a program that publishes messages on slack when a linux server is accessed through ssh.

pam-send-slack-message pam-send-slack-message is a program that publishes messages on slack when the linux server is accessed through ssh. Installatio

Iuri Diniz 2 Aug 17, 2022
Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions.

Synthetic Network Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions. Dependenc

Daily 58 Dec 15, 2022
🔌 A curseforge proxy server, keeping your API key safe and sound.

?? CFPROXY - The curseforge proxy server Curseforge has locked down their API and now restricts access without authentification. This spells trouble f

null 6 Nov 7, 2022
Acts as an IRC server and a nostr client. Connect with your IRC client using your nostr private key as the password.

nostr-irc Acts as an IRC server and a nostr client. Connect with your IRC client using your nostr private key as the password. Experimental code, use

null 11 Dec 26, 2022
The gRPC library for Rust built on C Core library and futures

gRPC-rs gRPC-rs is a Rust wrapper of gRPC Core. gRPC is a high performance, open source universal RPC framework that puts mobile and HTTP/2 first. Sta

TiKV Project 1.6k Jan 7, 2023
A rust client and structures to interact with the Clever-Cloud API.

Clever-Cloud Software Development Kit - Rust edition This crate provides structures and client to interact with the Clever-Cloud API. Status This crat

Clever Cloud 6 Jun 3, 2022
Safe Rust crate for creating socket servers and clients with ease.

bitsock Safe Rust crate for creating socket servers and clients with ease. Description This crate can be used for Client <--> Server applications of e

Lorenzo Torres 3 Nov 25, 2021
Client library for the Challonge REST API

Client library for the Challonge REST API

Victor Polevoy 2 Jul 5, 2022
A library for writing type-safe Durable Objects in Rust.

do-proxy A library for writing type-safe Durable Objects (DOs) in Rust. With do-proxy you can: Easily write type-safe APIs for Durable Objects. Abstra

Fisher Darling 12 Dec 4, 2022
Network Block Storage server, written in Rust. Supports pluggable and chainable underlying storage

nbd-rs Disclaimer DO NEVER USE THIS FOR PRODUCTION Do not use this for any data that you cannot afford to lose any moment. Expect data loss, corruptio

Rainlab Inc 10 Sep 30, 2022
Astar Network is an interoperable blockchain based the Substrate framework and the hub for dApps within the Polkadot Ecosystem

Astar Network is an interoperable blockchain based the Substrate framework and the hub for dApps within the Polkadot Ecosystem. With Astar Network and

Astar Network (Plasm) 43 Dec 14, 2022
Fast and easy-to-use event-driven network library.

message-io is a fast and easy-to-use event-driven network library. The library handles the OS socket internally and offers a simple event message API

Luis Enrique Muñoz Martín 830 Jan 3, 2023
Network simulation in Rust

netsim - A Rust library for network simulation and testing (currently linux-only). netsim is a crate for simulating networks for the sake of testing n

Andrew Cann 115 Dec 15, 2022
A private network system that uses WireGuard under the hood.

innernet A private network system that uses WireGuard under the hood. See the announcement blog post for a longer-winded explanation. innernet is simi

Tonari, Inc 4.1k Dec 29, 2022