Skip to content

bochaco/temp_safe_network

 
 

Safe Network

The Safe Network is a fully autonomous data and communications network. For a general introduction and more information about its features and the problems it intends to solve, please see The Safe Network Primer.

The network is implemented in Rust. This repository is a workspace consisting of 5 crates:

  • sn_node: implements the Safe Network Node binary.
  • sn_client: provides the low-level interface to connect to a network.
  • sn_api: an interface to expose network features for client applications.
  • sn_cli: a command line interface for using the network.
  • sn_cmd_test_utilities: internal, unpublished crate that provides tools for integration testing.

Currently, the network can be used via the 4 published crates. To see how, a good place to start is the README for the CLI. You can run your own local network or perhaps participate in a remote network.

Testing

Some of the tests require a live network to test against.

Running a local testnet

You should first ensure that your local machine does not have any artefacts from prior runs. Eg on unix: killall sn_node ||true && rm -r ~/.safe/node/local-test-network || true will remove any running sn_node instances and remove any prior run's data stored.

You can then run a local testnet using the testnet bin:

NODE_COUNT=15 RUST_LOG=sn_node=trace cargo run --release --bin testnet

NODE_COUNT defaults to 33 nodes and will give you a split section. 15 nodes as above will give only one section. How many nodes you want to run will depend on your hardware. 15 nodes can be considered the minimum for a viable section.

Running tests

Once you have your network running you can simply run cargo test --release. This will run all tests in sn.

Note: if you're running in the root directory, either cd sn_node before running tests or include -p sn_node in the cargo command to target only sn_node. Otherwise you'll be running tests from all crates, including sn_api and sn_cli. Eg: cargo test --release -p sn_node

In general it can be useful to scope your test running, eg cargo test --release client will run only the client tests. Or perhaps you want to ignore proptests as they can be quite long: cargo test --release client --skip proptest

Development Tools

Statemaps

Note: Statemaps are automatically generated for CI integration tests

Statemaps can be useful to get a wider view of what's going on in a network.

Steps to generate:

  1. Install statemap
cargo install --git https://github.com/TritonDataCenter/statemap.git
  1. Start a testnet, make sure to have the statemap feature enabled.

  2. Run ./resources/scripts/statemap-preprocess.sh to extract statemap states from the node logs.

  3. After the script completes, it will output a statemap command, execute the command to generate the statemap SVG.

  4. Open the SVG in a browser

Releases

Safe is being developed iteratively and has frequent releases. You can use these to experiment with new features when they become available. It's also possible to participate in community 'testnets' hosted by members of The Safe Network Forum.

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 information on how to contribute, see our guide to contributing.

About

No description, website, or topics provided.

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
BSD-3-Clause
LICENSE-BSD
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 96.0%
  • Shell 2.6%
  • Makefile 0.9%
  • Just 0.2%
  • Python 0.2%
  • PowerShell 0.1%