diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 964c28d01d..f4a702cd8d 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -5,7 +5,7 @@ on: # on main, we want to know that all commits are passing at a glance, any deviation should help bisecting errors # the merge run checks should show on master and enable this clear test/passing history merge_group: - branches: [main, evm-dev] + branches: [main, alpha*, beta*, rc*] pull_request: branches: ["*"] @@ -1356,13 +1356,33 @@ jobs: shell: bash if: always() + - name: Confirming connection errors + shell: bash + timeout-minutes: 1 + env: + NODE_DATA_PATH: /home/runner/.local/share/safe/node + run: | + incoming_connection_errors=$(rg "IncomingConnectionError" $NODE_DATA_PATH -c --stats | \ + rg "(\d+) matches" | rg "\d+" -o) || { echo "Failed to find IncomingConnectionError error"; exit 0; } + if [ -z "$incoming_connection_errors" ]; then + echo "Doesn't find any IncomingConnectionError error !" + else + echo "Found $incoming_connection_errors IncomingConnectionError errors." + fi + if ! rg "UnexpectedEof" $NODE_DATA_PATH -c --stats; then + echo "Doesn't find any UnexpectedEof error !" + else + echo "Found errors." + exit 1 + fi + - name: Stop the local network and upload logs if: always() uses: maidsafe/sn-local-testnet-action@main with: action: stop platform: ubuntu-latest - log_file_prefix: safe_test_logs_large_file_upload + log_file_prefix: safe_test_logs_large_file_upload_no_ws build: true # replication_bench_with_heavy_upload: diff --git a/.github/workflows/merge_websocket.yml b/.github/workflows/merge_websocket.yml new file mode 100644 index 0000000000..8bde05cbdf --- /dev/null +++ b/.github/workflows/merge_websocket.yml @@ -0,0 +1,162 @@ +name: Check before merge (websockets) + +on: + # tests must run for a PR to be valid and pass merge queue muster + # on main, we want to know that all commits are passing at a glance, any deviation should help bisecting errors + # the merge run checks should show on master and enable this clear test/passing history + merge_group: + branches: [main, alpha*, beta*, rc*] + pull_request: + branches: ["*"] + +env: + CARGO_INCREMENTAL: 0 # bookkeeping for incremental builds has overhead, not useful in CI. + WINSW_URL: https://github.com/winsw/winsw/releases/download/v3.0.0-alpha.11/WinSW-x64.exe + GENESIS_PK: 9377ab39708a59d02d09bfd3c9bc7548faab9e0c2a2700b9ac7d5c14f0842f0b4bb0df411b6abd3f1a92b9aa1ebf5c3d + GENESIS_SK: 5ec88891c1098a0fede5b98b07f8abc931d7247b7aa310d21ab430cc957f9f02 + +jobs: + large_file_upload_test_with_ws: + if: "!startsWith(github.event.head_commit.message, 'chore(release):')" + name: Large file upload (websockets) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + + - name: install ripgrep + shell: bash + run: sudo apt-get install -y ripgrep + + - name: Check the available space + run: | + df + echo "Home dir:" + du -sh /home/runner/ + echo "Home subdirs:" + du -sh /home/runner/*/ + echo "PWD:" + du -sh . + echo "PWD subdirs:" + du -sh */ + + - name: Download material (135MB) + shell: bash + run: | + mkdir test_data_1 + cd test_data_1 + wget https://sn-node.s3.eu-west-2.amazonaws.com/joshuef/Qi930/safe-qiWithListeners-x86_64.tar.gz + wget https://sn-node.s3.eu-west-2.amazonaws.com/joshuef/Qi930/safenode-qiWithListeners-x86_64.tar.gz + ls -l + cd .. + tar -cvzf test_data_1.tar.gz test_data_1 + ls -l + + - name: Build binaries + run: cargo build --release --features local,websockets --bin safenode --bin autonomi + timeout-minutes: 30 + + - name: Start a local network + uses: maidsafe/sn-local-testnet-action@main + with: + action: start + enable-evm-testnet: true + node-path: target/release/safenode + platform: ubuntu-latest + build: true + sn-log: "" + + - name: Check if SAFE_PEERS and EVM_NETWORK are set + shell: bash + run: | + if [[ -z "$SAFE_PEERS" ]]; then + echo "The SAFE_PEERS variable has not been set" + exit 1 + elif [[ -z "$EVM_NETWORK" ]]; then + echo "The EVM_NETWORK variable has not been set" + exit 1 + else + echo "SAFE_PEERS has been set to $SAFE_PEERS" + echo "EVM_NETWORK has been set to $EVM_NETWORK" + fi + + - name: Check the available space post download + run: | + df + echo "Home dir:" + du -sh /home/runner/ + echo "Home subdirs:" + du -sh /home/runner/*/ + echo "PWD:" + du -sh . + echo "PWD subdirs:" + du -sh */ + + - name: export default secret key + run: echo "SECRET_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" >> $GITHUB_ENV + shell: bash + + - name: File upload + run: ./target/release/autonomi --log-output-dest=data-dir file upload "./test_data_1.tar.gz" > ./upload_output 2>&1 + env: + SN_LOG: "v" + timeout-minutes: 5 + + - name: showing the upload terminal output + run: cat upload_output + shell: bash + if: always() + + - name: parse address + run: | + UPLOAD_ADDRESS=$(rg "At address: ([0-9a-f]*)" -o -r '$1' ./upload_output) + echo "UPLOAD_ADDRESS=$UPLOAD_ADDRESS" >> $GITHUB_ENV + shell: bash + + - name: File Download + run: ./target/release/autonomi --log-output-dest=data-dir file download ${{ env.UPLOAD_ADDRESS }} ./downloaded_resources > ./download_output 2>&1 + env: + SN_LOG: "v" + timeout-minutes: 5 + + - name: showing the download terminal output + run: | + cat download_output + ls -l + cd downloaded_resources + ls -l + shell: bash + if: always() + + - name: Confirming connection errors + shell: bash + timeout-minutes: 1 + env: + NODE_DATA_PATH: /home/runner/.local/share/safe/node + run: | + incoming_connection_errors=$(rg "IncomingConnectionError" $NODE_DATA_PATH -c --stats | \ + rg "(\d+) matches" | rg "\d+" -o) || { echo "Failed to find IncomingConnectionError error"; exit 0; } + if [ -z "$incoming_connection_errors" ]; then + echo "Doesn't find any IncomingConnectionError error !" + else + echo "Found $incoming_connection_errors IncomingConnectionError errors." + fi + unexpected_eof_errors=$(rg "UnexpectedEof" $NODE_DATA_PATH -c --stats | \ + rg "(\d+) matches" | rg "\d+" -o) || { echo "Failed to find UnexpectedEof error"; exit 0; } + if [ -z "$unexpected_eof_errors" ]; then + echo "Doesn't find any UnexpectedEof error !" + else + echo "Found $unexpected_eof_errors UnexpectedEof errors." + fi + + - name: Stop the local network and upload logs + if: always() + uses: maidsafe/sn-local-testnet-action@main + with: + action: stop + platform: ubuntu-latest + log_file_prefix: safe_test_logs_large_file_upload_with_ws + build: true diff --git a/CHANGELOG.md b/CHANGELOG.md index dc66778ae8..d2a5f8b0af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *When editing this file, please respect a line length of 100.* +## 2024-11-12 + +### Network + +#### Added + +- Enable the `websockets` connection feature, for compatibility with the webapp. + +#### Fixed + +- Reduce incorrect logging of connection errors. +- Fixed verification for crdt operations. +- Pick chunk-proof verification (for storage confirmation) candidates more equally. + +### Launchpad + +#### Added + +- Display an error when Launchpad is not whitelisted on Windows devices. +- Ctrl+V can paste rewards address on pop up section. + +#### Changed + +- Help section copy changed after beta phase. +- Update ratatui and throbbber library versions. + +#### Fixed + +- We display starting status when not running nodes + +### Client + +#### Added + +- Support pre-paid put operations. +- Add the necessary WASM bindings for the webapp to be able to upload private data to a vault + and fetch it again. + +#### Changed + +- Chunks are now downloaded in parallel. +- Rename some WASM methods to be more conventional for web. + ## 2024-11-07 ### Launchpad @@ -77,7 +120,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 2024-10-28 -## Autonomi API/CLI +### Autonomi API/CLI #### Added diff --git a/Cargo.lock b/Cargo.lock index 3b35167d97..40ae0a8133 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1094,7 +1094,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "autonomi" -version = "0.2.3" +version = "0.2.4" dependencies = [ "alloy", "bip39", @@ -1142,7 +1142,7 @@ dependencies = [ [[package]] name = "autonomi-cli" -version = "0.1.4" +version = "0.1.5" dependencies = [ "autonomi", "clap", @@ -2868,7 +2868,7 @@ dependencies = [ [[package]] name = "evm_testnet" -version = "0.1.3" +version = "0.1.4" dependencies = [ "clap", "dirs-next", @@ -2879,7 +2879,7 @@ dependencies = [ [[package]] name = "evmlib" -version = "0.1.3" +version = "0.1.4" dependencies = [ "alloy", "dirs-next", @@ -5785,7 +5785,7 @@ dependencies = [ [[package]] name = "nat-detection" -version = "0.2.10" +version = "0.2.11" dependencies = [ "clap", "clap-verbosity-flag", @@ -5902,7 +5902,7 @@ dependencies = [ [[package]] name = "node-launchpad" -version = "0.4.4" +version = "0.4.5" dependencies = [ "arboard", "atty", @@ -8484,7 +8484,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "sn-node-manager" -version = "0.11.2" +version = "0.11.3" dependencies = [ "assert_cmd", "assert_fs", @@ -8560,7 +8560,7 @@ dependencies = [ [[package]] name = "sn_build_info" -version = "0.1.18" +version = "0.1.19" dependencies = [ "chrono", "tracing", @@ -8602,7 +8602,7 @@ dependencies = [ [[package]] name = "sn_evm" -version = "0.1.3" +version = "0.1.4" dependencies = [ "custom_debug", "evmlib", @@ -8625,7 +8625,7 @@ dependencies = [ [[package]] name = "sn_logging" -version = "0.2.39" +version = "0.2.40" dependencies = [ "chrono", "color-eyre", @@ -8650,7 +8650,7 @@ dependencies = [ [[package]] name = "sn_metrics" -version = "0.1.19" +version = "0.1.20" dependencies = [ "clap", "color-eyre", @@ -8664,7 +8664,7 @@ dependencies = [ [[package]] name = "sn_networking" -version = "0.19.2" +version = "0.19.3" dependencies = [ "aes-gcm-siv", "assert_fs", @@ -8712,7 +8712,7 @@ dependencies = [ [[package]] name = "sn_node" -version = "0.112.3" +version = "0.112.4" dependencies = [ "assert_fs", "async-trait", @@ -8770,7 +8770,7 @@ dependencies = [ [[package]] name = "sn_node_rpc_client" -version = "0.6.34" +version = "0.6.35" dependencies = [ "assert_fs", "async-trait", @@ -8797,7 +8797,7 @@ dependencies = [ [[package]] name = "sn_peers_acquisition" -version = "0.5.6" +version = "0.5.7" dependencies = [ "clap", "lazy_static", @@ -8813,7 +8813,7 @@ dependencies = [ [[package]] name = "sn_protocol" -version = "0.17.14" +version = "0.17.15" dependencies = [ "blsttc", "bytes", @@ -8844,7 +8844,7 @@ dependencies = [ [[package]] name = "sn_registers" -version = "0.4.2" +version = "0.4.3" dependencies = [ "blsttc", "crdts", @@ -8861,7 +8861,7 @@ dependencies = [ [[package]] name = "sn_service_management" -version = "0.4.2" +version = "0.4.3" dependencies = [ "async-trait", "dirs-next", @@ -8887,7 +8887,7 @@ dependencies = [ [[package]] name = "sn_transfers" -version = "0.20.2" +version = "0.20.3" dependencies = [ "assert_fs", "blsttc", @@ -9237,7 +9237,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test_utils" -version = "0.4.10" +version = "0.4.11" dependencies = [ "bytes", "color-eyre", @@ -9392,7 +9392,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "token_supplies" -version = "0.1.57" +version = "0.1.58" dependencies = [ "dirs-next", "reqwest 0.11.27", diff --git a/autonomi-cli/Cargo.toml b/autonomi-cli/Cargo.toml index 83d1ffd99b..daa29b4a60 100644 --- a/autonomi-cli/Cargo.toml +++ b/autonomi-cli/Cargo.toml @@ -3,7 +3,7 @@ authors = ["MaidSafe Developers "] name = "autonomi-cli" description = "Autonomi CLI" license = "GPL-3.0" -version = "0.1.4" +version = "0.1.5" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -24,7 +24,7 @@ name = "files" harness = false [dependencies] -autonomi = { path = "../autonomi", version = "0.2.3", features = [ +autonomi = { path = "../autonomi", version = "0.2.4", features = [ "data", "fs", "vault", @@ -50,9 +50,9 @@ tokio = { version = "1.32.0", features = [ "fs", ] } tracing = { version = "~0.1.26" } -sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.6" } -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_logging = { path = "../sn_logging", version = "0.2.39" } +sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_logging = { path = "../sn_logging", version = "0.2.40" } walkdir = "2.5.0" serde_json = "1.0.132" serde = "1.0.210" @@ -60,7 +60,7 @@ hex = "0.4.3" ring = "0.17.8" [dev-dependencies] -autonomi = { path = "../autonomi", version = "0.2.3", features = [ +autonomi = { path = "../autonomi", version = "0.2.4", features = [ "data", "fs", ] } diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 3ac4f23e66..64e8a620b4 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -3,7 +3,7 @@ authors = ["MaidSafe Developers "] description = "Autonomi client API" name = "autonomi" license = "GPL-3.0" -version = "0.2.3" +version = "0.2.4" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -40,11 +40,11 @@ rand = "0.8.5" rmp-serde = "1.1.1" self_encryption = "~0.30.0" serde = { version = "1.0.133", features = ["derive", "rc"] } -sn_networking = { path = "../sn_networking", version = "0.19.2" } -sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.6" } -sn_protocol = { version = "0.17.14", path = "../sn_protocol" } -sn_registers = { path = "../sn_registers", version = "0.4.2" } -sn_evm = { path = "../sn_evm", version = "0.1.3" } +sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } +sn_protocol = { version = "0.17.15", path = "../sn_protocol" } +sn_registers = { path = "../sn_registers", version = "0.4.3" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } thiserror = "1.0.23" tokio = { version = "1.35.0", features = ["sync"] } tracing = { version = "~0.1.26" } @@ -63,8 +63,8 @@ pyo3 = { version = "0.20", optional = true, features = ["extension-module", "abi alloy = { version = "0.5.3", default-features = false, features = ["std", "reqwest-rustls-tls", "provider-anvil-node", "sol-types", "json", "signers", "contract", "signer-local", "network"] } eyre = "0.6.5" sha2 = "0.10.6" -sn_logging = { path = "../sn_logging", version = "0.2.39" } -sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.6" } +sn_logging = { path = "../sn_logging", version = "0.2.40" } +sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } # Do not specify the version field. Release process expects even the local dev deps to be published. # Removing the version field is a workaround. test_utils = { path = "../test_utils" } @@ -74,7 +74,7 @@ wasm-bindgen-test = "0.3.43" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.7" -evmlib = { path = "../evmlib", version = "0.1.3", features = ["wasm-bindgen"] } +evmlib = { path = "../evmlib", version = "0.1.4", features = ["wasm-bindgen"] } # See https://github.com/sebcrozet/instant/blob/7bd13f51f5c930239fddc0476a837870fb239ed7/README.md#using-instant-for-a-wasm-platform-where-performancenow-is-not-available instant = { version = "0.1", features = ["wasm-bindgen", "inaccurate"] } js-sys = "0.3.70" diff --git a/evm_testnet/Cargo.toml b/evm_testnet/Cargo.toml index fb93f3d35e..1295edf2dc 100644 --- a/evm_testnet/Cargo.toml +++ b/evm_testnet/Cargo.toml @@ -6,13 +6,13 @@ homepage = "https://maidsafe.net" license = "GPL-3.0" name = "evm_testnet" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.3" +version = "0.1.4" [dependencies] clap = { version = "4.5", features = ["derive"] } dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.3" } -sn_evm = { path = "../sn_evm", version = "0.1.3" } +evmlib = { path = "../evmlib", version = "0.1.4" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } tokio = { version = "1.40", features = ["rt-multi-thread", "signal"] } [lints] diff --git a/evmlib/Cargo.toml b/evmlib/Cargo.toml index a062cfe621..cb567e24e3 100644 --- a/evmlib/Cargo.toml +++ b/evmlib/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://maidsafe.net" license = "GPL-3.0" name = "evmlib" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.3" +version = "0.1.4" [features] wasm-bindgen = ["alloy/wasm-bindgen"] diff --git a/nat-detection/Cargo.toml b/nat-detection/Cargo.toml index e24ea7cc11..bec7a41943 100644 --- a/nat-detection/Cargo.toml +++ b/nat-detection/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "nat-detection" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.2.10" +version = "0.2.11" [[bin]] name = "nat-detection" @@ -31,9 +31,9 @@ libp2p = { version = "0.54.1", features = [ "macros", "upnp", ] } -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_networking = { path = "../sn_networking", version = "0.19.2" } -sn_protocol = { path = "../sn_protocol", version = "0.17.14" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_protocol = { path = "../sn_protocol", version = "0.17.15" } tokio = { version = "1.32.0", features = ["full"] } tracing = { version = "~0.1.26" } tracing-log = "0.2.0" diff --git a/node-launchpad/Cargo.toml b/node-launchpad/Cargo.toml index cc18203ccc..6389fe4349 100644 --- a/node-launchpad/Cargo.toml +++ b/node-launchpad/Cargo.toml @@ -2,7 +2,7 @@ authors = ["MaidSafe Developers "] description = "Node Launchpad" name = "node-launchpad" -version = "0.4.4" +version = "0.4.5" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" @@ -51,13 +51,13 @@ reqwest = { version = "0.12.2", default-features = false, features = [ serde = { version = "1.0.188", features = ["derive"] } serde_json = "1.0.107" signal-hook = "0.3.17" -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_evm = { path = "../sn_evm", version = "0.1.3" } -sn-node-manager = { version = "0.11.2", path = "../sn_node_manager" } -sn_peers_acquisition = { version = "0.5.6", path = "../sn_peers_acquisition" } -sn_protocol = { path = "../sn_protocol", version = "0.17.14" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } +sn-node-manager = { version = "0.11.3", path = "../sn_node_manager" } +sn_peers_acquisition = { version = "0.5.7", path = "../sn_peers_acquisition" } +sn_protocol = { path = "../sn_protocol", version = "0.17.15" } sn-releases = "~0.2.6" -sn_service_management = { version = "0.4.2", path = "../sn_service_management" } +sn_service_management = { version = "0.4.3", path = "../sn_service_management" } strip-ansi-escapes = "0.2.0" strum = { version = "0.26.1", features = ["derive"] } sysinfo = "0.30.12" diff --git a/release-cycle-info b/release-cycle-info index b75976efb5..3d68391e5c 100644 --- a/release-cycle-info +++ b/release-cycle-info @@ -13,6 +13,6 @@ # Both of these numbers are used in the packaged version number, which is a collective version # number for all the released binaries. release-year: 2024 -release-month: 10 -release-cycle: 4 -release-cycle-counter: 6 +release-month: 11 +release-cycle: 1 +release-cycle-counter: 4 diff --git a/sn_build_info/Cargo.toml b/sn_build_info/Cargo.toml index ec284f3455..7543bff9e5 100644 --- a/sn_build_info/Cargo.toml +++ b/sn_build_info/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_build_info" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.18" +version = "0.1.19" build = "build.rs" include = ["Cargo.toml", "src/**/*", "build.rs"] diff --git a/sn_build_info/src/release_info.rs b/sn_build_info/src/release_info.rs index 1f67bd7304..efccc77282 100644 --- a/sn_build_info/src/release_info.rs +++ b/sn_build_info/src/release_info.rs @@ -1,4 +1,4 @@ pub const RELEASE_YEAR: &str = "2024"; -pub const RELEASE_MONTH: &str = "10"; -pub const RELEASE_CYCLE: &str = "4"; -pub const RELEASE_CYCLE_COUNTER: &str = "6"; +pub const RELEASE_MONTH: &str = "11"; +pub const RELEASE_CYCLE: &str = "1"; +pub const RELEASE_CYCLE_COUNTER: &str = "4"; diff --git a/sn_evm/Cargo.toml b/sn_evm/Cargo.toml index c2ad676e70..7394cc62de 100644 --- a/sn_evm/Cargo.toml +++ b/sn_evm/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_evm" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.3" +version = "0.1.4" [features] test-utils = [] @@ -17,7 +17,7 @@ external-signer = ["evmlib/external-signer"] [dependencies] custom_debug = "~0.6.1" -evmlib = { path = "../evmlib", version = "0.1.3" } +evmlib = { path = "../evmlib", version = "0.1.4" } hex = "~0.4.3" lazy_static = "~1.4.0" libp2p = { version = "0.53", features = ["identify", "kad"] } diff --git a/sn_logging/Cargo.toml b/sn_logging/Cargo.toml index 497102c7e7..68c639b129 100644 --- a/sn_logging/Cargo.toml +++ b/sn_logging/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_logging" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.2.39" +version = "0.2.40" [dependencies] chrono = "~0.4.19" diff --git a/sn_metrics/Cargo.toml b/sn_metrics/Cargo.toml index 5533129d28..b9dcffa42b 100644 --- a/sn_metrics/Cargo.toml +++ b/sn_metrics/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_metrics" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.19" +version = "0.1.20" [[bin]] path = "src/main.rs" diff --git a/sn_networking/Cargo.toml b/sn_networking/Cargo.toml index e9d53af4dd..1aa74058c6 100644 --- a/sn_networking/Cargo.toml +++ b/sn_networking/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_networking" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.19.2" +version = "0.19.3" [features] default = [] @@ -55,11 +55,11 @@ rayon = "1.8.0" rmp-serde = "1.1.1" self_encryption = "~0.30.0" serde = { version = "1.0.133", features = ["derive", "rc"] } -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_protocol = { path = "../sn_protocol", version = "0.17.14" } -sn_transfers = { path = "../sn_transfers", version = "0.20.2" } -sn_registers = { path = "../sn_registers", version = "0.4.2" } -sn_evm = { path = "../sn_evm", version = "0.1.3" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_protocol = { path = "../sn_protocol", version = "0.17.15" } +sn_transfers = { path = "../sn_transfers", version = "0.20.3" } +sn_registers = { path = "../sn_registers", version = "0.4.3" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } sysinfo = { version = "0.30.8", default-features = false, optional = true } thiserror = "1.0.23" tiny-keccak = { version = "~2.0.2", features = ["sha3"] } diff --git a/sn_networking/src/driver.rs b/sn_networking/src/driver.rs index 694a850640..43a5525ccf 100644 --- a/sn_networking/src/driver.rs +++ b/sn_networking/src/driver.rs @@ -32,7 +32,6 @@ use futures::future::Either; use futures::StreamExt; #[cfg(feature = "local")] use libp2p::mdns; -use libp2p::Transport as _; use libp2p::{core::muxing::StreamMuxerBox, relay}; use libp2p::{ identity::Keypair, @@ -45,6 +44,7 @@ use libp2p::{ }, Multiaddr, PeerId, }; +use libp2p::{swarm::SwarmEvent, Transport as _}; #[cfg(feature = "open-metrics")] use prometheus_client::metrics::info::Info; use sn_evm::PaymentQuote; @@ -64,7 +64,7 @@ use std::{ fmt::Debug, fs, io::{Read, Write}, - net::SocketAddr, + net::{IpAddr, SocketAddr}, num::NonZeroUsize, path::PathBuf, }; @@ -721,6 +721,7 @@ impl NetworkBuilder { network_discovery: NetworkDiscovery::new(&peer_id), bootstrap_peers: Default::default(), live_connected_peers: Default::default(), + latest_established_connection_ids: Default::default(), handling_statistics: Default::default(), handled_times: 0, hard_disk_write_error: 0, @@ -819,6 +820,9 @@ pub struct SwarmDriver { // Peers that having live connection to. Any peer got contacted during kad network query // will have live connection established. And they may not appear in the RT. pub(crate) live_connected_peers: BTreeMap, + /// The list of recently established connections ids. + /// This is used to prevent log spamming. + pub(crate) latest_established_connection_ids: HashMap, // Record the handling time of the recent 10 for each handling kind. handling_statistics: BTreeMap>, handled_times: usize, @@ -846,6 +850,8 @@ impl SwarmDriver { let mut set_farthest_record_interval = interval(CLOSET_RECORD_CHECK_INTERVAL); let mut relay_manager_reservation_interval = interval(RELAY_MANAGER_RESERVATION_INTERVAL); + // temporarily skip processing IncomingConnectionError swarm event to avoid log spamming + let mut previous_incoming_connection_error_event = None; loop { tokio::select! { // polls futures in order they appear here (as opposed to random) @@ -878,6 +884,22 @@ impl SwarmDriver { }, // next take and react to external swarm events swarm_event = self.swarm.select_next_some() => { + // Refer to the handle_swarm_events::IncomingConnectionError for more info on why we skip + // processing the event for one round. + if let Some(previous_event) = previous_incoming_connection_error_event.take() { + if let Err(err) = self.handle_swarm_events(swarm_event) { + warn!("Error while handling swarm event: {err}"); + } + if let Err(err) = self.handle_swarm_events(previous_event) { + warn!("Error while handling swarm event: {err}"); + } + continue; + } + if matches!(swarm_event, SwarmEvent::IncomingConnectionError {..}) { + previous_incoming_connection_error_event = Some(swarm_event); + continue; + } + // logging for handling events happens inside handle_swarm_events // otherwise we're rewriting match statements etc around this anwyay if let Err(err) = self.handle_swarm_events(swarm_event) { diff --git a/sn_networking/src/event/swarm.rs b/sn_networking/src/event/swarm.rs index f0fd69254e..bffdfa425d 100644 --- a/sn_networking/src/event/swarm.rs +++ b/sn_networking/src/event/swarm.rs @@ -7,8 +7,8 @@ // permissions and limitations relating to use of the SAFE Network Software. use crate::{ - event::NodeEvent, multiaddr_is_global, multiaddr_strip_p2p, relay_manager::is_a_relayed_peer, - target_arch::Instant, NetworkEvent, Result, SwarmDriver, + event::NodeEvent, multiaddr_get_ip, multiaddr_is_global, multiaddr_strip_p2p, + relay_manager::is_a_relayed_peer, target_arch::Instant, NetworkEvent, Result, SwarmDriver, }; #[cfg(feature = "local")] use libp2p::mdns; @@ -19,7 +19,7 @@ use libp2p::{ multiaddr::Protocol, swarm::{ dial_opts::{DialOpts, PeerCondition}, - DialError, SwarmEvent, + ConnectionId, DialError, SwarmEvent, }, Multiaddr, PeerId, TransportError, }; @@ -364,6 +364,10 @@ impl SwarmDriver { connection_id, (peer_id, Instant::now() + Duration::from_secs(60)), ); + self.insert_latest_established_connection_ids( + connection_id, + endpoint.get_remote_address(), + ); self.record_connection_metrics(); if endpoint.is_dialer() { @@ -509,7 +513,22 @@ impl SwarmDriver { error, } => { event_string = "Incoming ConnErr"; - error!("IncomingConnectionError from local_addr:?{local_addr:?}, send_back_addr {send_back_addr:?} on {connection_id:?} with error {error:?}"); + // Only log as ERROR if the the connection is not adjacent to an already established connection id from + // the same IP address. + // + // If a peer contains multiple transports/listen addrs, we might try to open multiple connections, + // and if the first one passes, we would get error on the rest. We don't want to log these. + // + // Also sometimes we get the ConnectionEstablished event immediately after this event. + // So during tokio::select! of the events, we skip processing IncomingConnectionError for one round, + // giving time for ConnectionEstablished to be hopefully processed. + // And since we don't do anything critical with this event, the order and time of processing is + // not critical. + if self.should_we_log_incoming_connection_error(connection_id, &send_back_addr) { + error!("IncomingConnectionError from local_addr:?{local_addr:?}, send_back_addr {send_back_addr:?} on {connection_id:?} with error {error:?}"); + } else { + debug!("IncomingConnectionError from local_addr:?{local_addr:?}, send_back_addr {send_back_addr:?} on {connection_id:?} with error {error:?}"); + } let _ = self.live_connected_peers.remove(&connection_id); self.record_connection_metrics(); } @@ -659,6 +678,62 @@ impl SwarmDriver { .set(self.swarm.connected_peers().count() as i64); } } + + /// Insert the latest established connection id into the list. + fn insert_latest_established_connection_ids(&mut self, id: ConnectionId, addr: &Multiaddr) { + let Ok(id) = format!("{id}").parse::() else { + return; + }; + let Some(ip_addr) = multiaddr_get_ip(addr) else { + return; + }; + + let _ = self + .latest_established_connection_ids + .insert(id, (ip_addr, Instant::now())); + + while self.latest_established_connection_ids.len() >= 50 { + // remove the oldest entry + let Some(oldest_key) = self + .latest_established_connection_ids + .iter() + .min_by_key(|(_, (_, time))| *time) + .map(|(id, _)| *id) + else { + break; + }; + + self.latest_established_connection_ids.remove(&oldest_key); + } + } + + // Do not log IncomingConnectionError if the ConnectionId is adjacent to an already established connection. + fn should_we_log_incoming_connection_error(&self, id: ConnectionId, addr: &Multiaddr) -> bool { + let Ok(id) = format!("{id}").parse::() else { + return true; + }; + let Some(ip_addr) = multiaddr_get_ip(addr) else { + return true; + }; + + // This should prevent most of the cases where we get an IncomingConnectionError for a peer with multiple + // transports/listen addrs. + if let Some((established_ip_addr, _)) = + self.latest_established_connection_ids.get(&(id - 1)) + { + if established_ip_addr == &ip_addr { + return false; + } + } else if let Some((established_ip_addr, _)) = + self.latest_established_connection_ids.get(&(id + 1)) + { + if established_ip_addr == &ip_addr { + return false; + } + } + + true + } } /// Helper function to print formatted connection role info. diff --git a/sn_node/Cargo.toml b/sn_node/Cargo.toml index 9474738594..ca2e7cfad0 100644 --- a/sn_node/Cargo.toml +++ b/sn_node/Cargo.toml @@ -2,7 +2,7 @@ authors = ["MaidSafe Developers "] description = "Safe Node" name = "sn_node" -version = "0.112.3" +version = "0.112.4" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" @@ -53,15 +53,15 @@ rmp-serde = "1.1.1" rayon = "1.8.0" self_encryption = "~0.30.0" serde = { version = "1.0.133", features = ["derive", "rc"] } -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.6" } -sn_logging = { path = "../sn_logging", version = "0.2.39" } -sn_networking = { path = "../sn_networking", version = "0.19.2" } -sn_protocol = { path = "../sn_protocol", version = "0.17.14" } -sn_registers = { path = "../sn_registers", version = "0.4.2" } -sn_transfers = { path = "../sn_transfers", version = "0.20.2" } -sn_service_management = { path = "../sn_service_management", version = "0.4.2" } -sn_evm = { path = "../sn_evm", version = "0.1.3" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } +sn_logging = { path = "../sn_logging", version = "0.2.40" } +sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_protocol = { path = "../sn_protocol", version = "0.17.15" } +sn_registers = { path = "../sn_registers", version = "0.4.3" } +sn_transfers = { path = "../sn_transfers", version = "0.20.3" } +sn_service_management = { path = "../sn_service_management", version = "0.4.3" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } sysinfo = { version = "0.30.8", default-features = false } thiserror = "1.0.23" tokio = { version = "1.32.0", features = [ @@ -85,16 +85,16 @@ color-eyre = "0.6.2" pyo3 = { version = "0.20", features = ["extension-module"], optional = true } [dev-dependencies] -evmlib = { path = "../evmlib", version = "0.1.3" } -autonomi = { path = "../autonomi", version = "0.2.3", features = ["registers"] } +evmlib = { path = "../evmlib", version = "0.1.4" } +autonomi = { path = "../autonomi", version = "0.2.4", features = ["registers"] } reqwest = { version = "0.12.2", default-features = false, features = [ "rustls-tls-manual-roots", ] } serde_json = "1.0" -sn_protocol = { path = "../sn_protocol", version = "0.17.14", features = [ +sn_protocol = { path = "../sn_protocol", version = "0.17.15", features = [ "rpc", ] } -sn_transfers = { path = "../sn_transfers", version = "0.20.2", features = [ +sn_transfers = { path = "../sn_transfers", version = "0.20.3", features = [ "test-utils", ] } tempfile = "3.6.0" diff --git a/sn_node_manager/Cargo.toml b/sn_node_manager/Cargo.toml index c729b59edc..c315a25ad1 100644 --- a/sn_node_manager/Cargo.toml +++ b/sn_node_manager/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "sn-node-manager" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.11.2" +version = "0.11.3" [[bin]] name = "safenode-manager" @@ -46,14 +46,14 @@ semver = "1.0.20" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" service-manager = "0.7.0" -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_logging = { path = "../sn_logging", version = "0.2.39" } -sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.6" } -sn_protocol = { path = "../sn_protocol", version = "0.17.14" } -sn_service_management = { path = "../sn_service_management", version = "0.4.2" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_logging = { path = "../sn_logging", version = "0.2.40" } +sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } +sn_protocol = { path = "../sn_protocol", version = "0.17.15" } +sn_service_management = { path = "../sn_service_management", version = "0.4.3" } sn-releases = "0.2.6" -sn_evm = { path = "../sn_evm", version = "0.1.3" } -sn_transfers = { path = "../sn_transfers", version = "0.20.2" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } +sn_transfers = { path = "../sn_transfers", version = "0.20.3" } sysinfo = "0.30.12" thiserror = "1.0.23" tokio = { version = "1.26", features = ["full"] } diff --git a/sn_node_rpc_client/Cargo.toml b/sn_node_rpc_client/Cargo.toml index 126852342c..6759155bf1 100644 --- a/sn_node_rpc_client/Cargo.toml +++ b/sn_node_rpc_client/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_node_rpc_client" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.6.34" +version = "0.6.35" [[bin]] name = "safenode_rpc_client" @@ -26,13 +26,13 @@ color-eyre = "0.6.2" hex = "~0.4.3" libp2p = { version = "0.54.1", features = ["kad"]} libp2p-identity = { version="0.2.7", features = ["rand"] } -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_logging = { path = "../sn_logging", version = "0.2.39" } -sn_node = { path = "../sn_node", version = "0.112.3" } -sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.6" } -sn_protocol = { path = "../sn_protocol", version = "0.17.14", features=["rpc"] } -sn_service_management = { path = "../sn_service_management", version = "0.4.2" } -sn_transfers = { path = "../sn_transfers", version = "0.20.2" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_logging = { path = "../sn_logging", version = "0.2.40" } +sn_node = { path = "../sn_node", version = "0.112.4" } +sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } +sn_protocol = { path = "../sn_protocol", version = "0.17.15", features=["rpc"] } +sn_service_management = { path = "../sn_service_management", version = "0.4.3" } +sn_transfers = { path = "../sn_transfers", version = "0.20.3" } thiserror = "1.0.23" # # watch out updating this, protoc compiler needs to be installed on all build systems # # arm builds + musl are very problematic diff --git a/sn_peers_acquisition/Cargo.toml b/sn_peers_acquisition/Cargo.toml index 9171db793a..871b4a8e8f 100644 --- a/sn_peers_acquisition/Cargo.toml +++ b/sn_peers_acquisition/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_peers_acquisition" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.5.6" +version = "0.5.7" [features] local = [] @@ -21,7 +21,7 @@ lazy_static = "~1.4.0" libp2p = { version = "0.54.1", features = [] } rand = "0.8.5" reqwest = { version="0.12.2", default-features=false, features = ["rustls-tls"] } -sn_protocol = { path = "../sn_protocol", version = "0.17.14", optional = true} +sn_protocol = { path = "../sn_protocol", version = "0.17.15", optional = true} thiserror = "1.0.23" tokio = { version = "1.32.0", default-features = false } tracing = { version = "~0.1.26" } diff --git a/sn_protocol/Cargo.toml b/sn_protocol/Cargo.toml index 73aa9ba68e..d388e2aa9d 100644 --- a/sn_protocol/Cargo.toml +++ b/sn_protocol/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "sn_protocol" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.17.14" +version = "0.17.15" [features] default = [] @@ -28,10 +28,10 @@ rmp-serde = "1.1.1" serde = { version = "1.0.133", features = [ "derive", "rc" ]} serde_json = "1.0" sha2 = "0.10.7" -sn_build_info = { path = "../sn_build_info", version = "0.1.18" } -sn_transfers = { path = "../sn_transfers", version = "0.20.2" } -sn_registers = { path = "../sn_registers", version = "0.4.2" } -sn_evm = { path = "../sn_evm", version = "0.1.3" } +sn_build_info = { path = "../sn_build_info", version = "0.1.19" } +sn_transfers = { path = "../sn_transfers", version = "0.20.3" } +sn_registers = { path = "../sn_registers", version = "0.4.3" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } thiserror = "1.0.23" tiny-keccak = { version = "~2.0.2", features = [ "sha3" ] } tracing = { version = "~0.1.26" } diff --git a/sn_registers/Cargo.toml b/sn_registers/Cargo.toml index 35e9135c3c..7e048f2216 100644 --- a/sn_registers/Cargo.toml +++ b/sn_registers/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_registers" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.4.2" +version = "0.4.3" [features] test-utils = [] diff --git a/sn_service_management/Cargo.toml b/sn_service_management/Cargo.toml index 27be8a6715..29c803ef13 100644 --- a/sn_service_management/Cargo.toml +++ b/sn_service_management/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "sn_service_management" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.4.2" +version = "0.4.3" [dependencies] async-trait = "0.1" @@ -19,11 +19,11 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" semver = "1.0.20" service-manager = "0.7.0" -sn_logging = { path = "../sn_logging", version = "0.2.39" } -sn_protocol = { path = "../sn_protocol", version = "0.17.14", features = [ +sn_logging = { path = "../sn_logging", version = "0.2.40" } +sn_protocol = { path = "../sn_protocol", version = "0.17.15", features = [ "rpc", ] } -sn_evm = { path = "../sn_evm", version = "0.1.3" } +sn_evm = { path = "../sn_evm", version = "0.1.4" } sysinfo = "0.30.12" thiserror = "1.0.23" tokio = { version = "1.32.0", features = ["time"] } diff --git a/sn_transfers/Cargo.toml b/sn_transfers/Cargo.toml index 0418a54671..a095d90c1b 100644 --- a/sn_transfers/Cargo.toml +++ b/sn_transfers/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_transfers" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.20.2" +version = "0.20.3" [features] reward-forward = [] diff --git a/test_utils/Cargo.toml b/test_utils/Cargo.toml index d3e1f9117b..521977d6bc 100644 --- a/test_utils/Cargo.toml +++ b/test_utils/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "test_utils" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.4.10" +version = "0.4.11" [features] local = ["sn_peers_acquisition/local"] @@ -16,9 +16,9 @@ local = ["sn_peers_acquisition/local"] bytes = { version = "1.0.1", features = ["serde"] } color-eyre = "~0.6.2" dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.3" } +evmlib = { path = "../evmlib", version = "0.1.4" } libp2p = { version = "0.54.1", features = ["identify", "kad"] } rand = "0.8.5" serde = { version = "1.0.133", features = ["derive"] } serde_json = "1.0" -sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.6" } +sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } diff --git a/token_supplies/Cargo.toml b/token_supplies/Cargo.toml index 14ad221eea..976529fb2e 100644 --- a/token_supplies/Cargo.toml +++ b/token_supplies/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "token_supplies" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.57" +version = "0.1.58" [dependencies]