diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index db5563ca3d..2d9cae94c4 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: ["*"] @@ -16,6 +16,16 @@ env: GENESIS_SK: 5ec88891c1098a0fede5b98b07f8abc931d7247b7aa310d21ab430cc957f9f02 jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Display Python version + run: python --version + cargo-udeps: if: "!startsWith(github.event.head_commit.message, 'chore(release):')" name: Unused dependency check @@ -122,7 +132,7 @@ jobs: timeout-minutes: 25 run: cargo test --release --package sn_networking --features="open-metrics, encrypt-records" - name: Run network tests (without encrypt-records) + - name: Run network tests (without encrypt-records) timeout-minutes: 25 run: cargo test --release --package sn_networking --features="open-metrics" @@ -344,6 +354,115 @@ jobs: SN_LOG: "v" timeout-minutes: 2 + - name: Estimate cost to create a vault + if: matrix.os != 'windows-latest' + run: | + echo "test-file" > upload-test.txt + ./target/release/autonomi --log-output-dest=data-dir file upload ./upload-test.txt + ./target/release/autonomi --log-output-dest=data-dir register create sample_new_register 1234 + ./target/release/autonomi --log-output-dest=data-dir vault cost + ./target/release/autonomi --log-output-dest=data-dir file list 2>&1 | tee file_list.txt + ./target/release/autonomi --log-output-dest=data-dir register list 2>&1 | tee register_list.txt + env: + SN_LOG: "v" + timeout-minutes: 2 + + - name: create a vault with existing user data as above + if: matrix.os != 'windows-latest' + run: ./target/release/autonomi --log-output-dest=data-dir vault create + env: + SN_LOG: "v" + timeout-minutes: 2 + + - name: add more files + if: matrix.os != 'windows-latest' + run: | + for i in {1..100}; do + dd if=/dev/urandom of=random_file_$i.bin bs=1M count=1 status=none + ./target/release/autonomi --log-output-dest=data-dir file upload random_file_$i.bin --public + ./target/release/autonomi --log-output-dest=data-dir file upload random_file_$i.bin + ./target/release/autonomi --log-output-dest=data-dir register create $i random_file_$i.bin + done + env: + SN_LOG: "v" + timeout-minutes: 25 + + - name: sync the vault + if: matrix.os != 'windows-latest' + run: ./target/release/autonomi --log-output-dest=data-dir vault sync + env: + SN_LOG: "v" + timeout-minutes: 2 + + - name: vault sync validation + if: matrix.os != 'windows-latest' + run: | + NUM_OF_PUBLIC_FILES="" + NUM_OF_PRIVATE_FILES="" + NUM_OF_REGISTERS="" + NUM_OF_PUBLIC_FILES_IN_VAULT="" + NUM_OF_PRIVATE_FILES_IN_VAULT="" + NUM_OF_REGISTERS_IN_VAULT="" + + ./target/release/autonomi --log-output-dest=data-dir file list 2>&1 > file_list.txt + + # ./target/release/autonomi --log-output-dest=data-dir register list | grep archives > register_list.txt + + NUM_OF_PUBLIC_FILES=`cat file_list.txt | grep "public" | grep -o '[0-9]\+'` + NUM_OF_PRIVATE_FILES=`cat file_list.txt | grep "private" | grep -o '[0-9]\+'` + NUM_OF_REGISTERS=`cat register_list.txt | grep "register" | grep -o '[0-9]\+'` + + ./target/release/autonomi --log-output-dest=data-dir vault load 2>&1 > vault_data.txt + + NUM_OF_PUBLIC_FILES_IN_VAULT=`cat vault_data.txt | grep "public" | grep -o '[0-9]\+'` + NUM_OF_PRIVATE_FILES_IN_VAULT=`cat vault_data.txt| grep "private" | grep -o '[0-9]\+'` + # NUM_OF_REGISTERS_IN_VAULT=`cat vault_data.txt | grep "register" | grep -o '[0-9]\+'` + + echo "Total Num of local public files is $NUM_OF_PUBLIC_FILES and in vault is $NUM_OF_PUBLIC_FILES_IN_VAULT" + echo "Total Num of local private files is $NUM_OF_PRIVATE_FILES and in vault is $NUM_OF_PRIVATE_FILES_IN_VAULT" + # echo "Total Num of local registers is $NUM_OF_REGISTERS and in vault is $NUM_OF_REGISTERS_IN_VAULT" + + rm -rf file_list.txt register_list.txt vault_data.txt + + python3 -c 'import sys; assert sys.argv[1] == sys.argv[2], f"Error: Local public Files: {sys.argv[1]} and vault public files: {sys.argv[2]} are Not Equal"' $NUM_OF_PUBLIC_FILES $NUM_OF_PUBLIC_FILES_IN_VAULT + python3 -c 'import sys; assert sys.argv[1] == sys.argv[2], f"Error: Local private Files: {sys.argv[1]} and vault private files: {sys.argv[2]} are Not Equal"' $NUM_OF_PRIVATE_FILES $NUM_OF_PRIVATE_FILES_IN_VAULT + # python3 -c 'import sys; assert sys.argv[1] == sys.argv[2], f"Error: Local registers: {sys.argv[1]} and vault registers: {sys.argv[2]} are Not Equal"' $NUM_OF_REGISTERS $NUM_OF_REGISTERS_IN_VAULT + echo "vault synced successfully!" + env: + SN_LOG: "v" + timeout-minutes: 15 + + - name: load an existing vault from the network + if: matrix.os != 'windows-latest' + run: ./target/release/autonomi --log-output-dest=data-dir vault load + env: + SN_LOG: "v" + timeout-minutes: 2 + + - name: Time profiling for Different files + if: matrix.os != 'windows-latest' + run: | + # 1 MB + python3 -c "with open('random_1MB.bin', 'wb') as f: f.write(bytearray([0xff] * 1 * 1024 * 1024))" + # 10 MB + python3 -c "with open('random_10MB.bin', 'wb') as f: f.write(bytearray([0xff] * 10 * 1024 * 1024))" + # 100 MB + python3 -c "with open('random_100MB.bin', 'wb') as f: f.write(bytearray([0xff] * 100 * 1024 * 1024))" + # 1 GB + python3 -c "with open('random_1GB.bin', 'wb') as f: f.write(bytearray([0xff] * 1000 * 1024 * 1024))" + + ./target/release/autonomi --log-output-dest=data-dir file list + time ./target/release/autonomi --log-output-dest=data-dir file upload random_1MB.bin + time ./target/release/autonomi --log-output-dest=data-dir file upload random_10MB.bin + time ./target/release/autonomi --log-output-dest=data-dir file upload random_100MB.bin + time ./target/release/autonomi --log-output-dest=data-dir file upload random_1GB.bin + ./target/release/autonomi --log-output-dest=data-dir vault sync + rm -rf random*.bin + rm -rf ${{ matrix.safe_path }}/autonomi + env: + SN_LOG: "v" + timeout-minutes: 15 + - name: Stop the local network and upload logs if: always() uses: maidsafe/sn-local-testnet-action@main @@ -1143,13 +1262,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/.github/workflows/nightly_wan.yml b/.github/workflows/nightly_wan.yml index e5f4a42511..681a45e625 100644 --- a/.github/workflows/nightly_wan.yml +++ b/.github/workflows/nightly_wan.yml @@ -1,8 +1,9 @@ name: Nightly -- Full WAN Network Tests on: - schedule: - - cron: "0 0 * * *" + # To do: this is broken, need to fix and enable later + # schedule: + # - cron: "0 0 * * *" # enable as below for testing purpose. # pull_request: # branches: ["*"] 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 d6bf9f17fb..dc48a94624 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", @@ -1141,7 +1141,7 @@ dependencies = [ [[package]] name = "autonomi-cli" -version = "0.1.4" +version = "0.1.5" dependencies = [ "autonomi", "clap", @@ -2881,7 +2881,7 @@ dependencies = [ [[package]] name = "evm_testnet" -version = "0.1.3" +version = "0.1.4" dependencies = [ "clap", "dirs-next", @@ -2892,7 +2892,7 @@ dependencies = [ [[package]] name = "evmlib" -version = "0.1.3" +version = "0.1.4" dependencies = [ "alloy", "dirs-next", @@ -5774,7 +5774,7 @@ dependencies = [ [[package]] name = "nat-detection" -version = "0.2.10" +version = "0.2.11" dependencies = [ "clap", "clap-verbosity-flag", @@ -5891,7 +5891,7 @@ dependencies = [ [[package]] name = "node-launchpad" -version = "0.4.4" +version = "0.4.5" dependencies = [ "arboard", "atty", @@ -8410,7 +8410,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "sn-node-manager" -version = "0.11.2" +version = "0.11.3" dependencies = [ "assert_cmd", "assert_fs", @@ -8486,7 +8486,7 @@ dependencies = [ [[package]] name = "sn_build_info" -version = "0.1.18" +version = "0.1.19" dependencies = [ "chrono", "tracing", @@ -8528,7 +8528,7 @@ dependencies = [ [[package]] name = "sn_evm" -version = "0.1.3" +version = "0.1.4" dependencies = [ "custom_debug", "evmlib", @@ -8551,7 +8551,7 @@ dependencies = [ [[package]] name = "sn_logging" -version = "0.2.39" +version = "0.2.40" dependencies = [ "chrono", "color-eyre", @@ -8576,7 +8576,7 @@ dependencies = [ [[package]] name = "sn_metrics" -version = "0.1.19" +version = "0.1.20" dependencies = [ "clap", "color-eyre", @@ -8590,7 +8590,7 @@ dependencies = [ [[package]] name = "sn_networking" -version = "0.19.2" +version = "0.19.3" dependencies = [ "aes-gcm-siv", "assert_fs", @@ -8638,7 +8638,7 @@ dependencies = [ [[package]] name = "sn_node" -version = "0.112.3" +version = "0.112.4" dependencies = [ "assert_fs", "async-trait", @@ -8695,7 +8695,7 @@ dependencies = [ [[package]] name = "sn_node_rpc_client" -version = "0.6.34" +version = "0.6.35" dependencies = [ "assert_fs", "async-trait", @@ -8722,7 +8722,7 @@ dependencies = [ [[package]] name = "sn_peers_acquisition" -version = "0.5.6" +version = "0.5.7" dependencies = [ "clap", "lazy_static", @@ -8738,7 +8738,7 @@ dependencies = [ [[package]] name = "sn_protocol" -version = "0.17.14" +version = "0.17.15" dependencies = [ "blsttc", "bytes", @@ -8768,7 +8768,7 @@ dependencies = [ [[package]] name = "sn_registers" -version = "0.4.2" +version = "0.4.3" dependencies = [ "blsttc", "crdts", @@ -8785,7 +8785,7 @@ dependencies = [ [[package]] name = "sn_service_management" -version = "0.4.2" +version = "0.4.3" dependencies = [ "async-trait", "dirs-next", @@ -8811,7 +8811,7 @@ dependencies = [ [[package]] name = "sn_transfers" -version = "0.20.2" +version = "0.20.3" dependencies = [ "assert_fs", "blsttc", @@ -9155,7 +9155,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test_utils" -version = "0.4.10" +version = "0.4.11" dependencies = [ "bytes", "color-eyre", @@ -9310,7 +9310,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/Justfile b/Justfile index 973ebfdca0..54ef4cdd5c 100644 --- a/Justfile +++ b/Justfile @@ -68,16 +68,16 @@ build-release-artifacts arch nightly="false": cargo binstall --no-confirm cross cross build --release --target $arch --bin nat-detection $nightly_feature cross build --release --target $arch --bin node-launchpad $nightly_feature - cross build --release --features=network-contacts --target $arch --bin autonomi $nightly_feature - cross build --release --features=network-contacts --target $arch --bin safenode $nightly_feature + cross build --release --features network-contacts,websockets --target $arch --bin autonomi $nightly_feature + cross build --release --features network-contacts,websockets --target $arch --bin safenode $nightly_feature cross build --release --target $arch --bin safenode-manager $nightly_feature cross build --release --target $arch --bin safenodemand $nightly_feature cross build --release --target $arch --bin safenode_rpc_client $nightly_feature else cargo build --release --target $arch --bin nat-detection $nightly_feature cargo build --release --target $arch --bin node-launchpad $nightly_feature - cargo build --release --features=network-contacts --target $arch --bin autonomi $nightly_feature - cargo build --release --features=network-contacts --target $arch --bin safenode $nightly_feature + cargo build --release --features network-contacts,websockets --target $arch --bin autonomi $nightly_feature + cargo build --release --features network-contacts,websockets --target $arch --bin safenode $nightly_feature cargo build --release --target $arch --bin safenode-manager $nightly_feature cargo build --release --target $arch --bin safenodemand $nightly_feature cargo build --release --target $arch --bin safenode_rpc_client $nightly_feature 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-cli/src/commands/vault.rs b/autonomi-cli/src/commands/vault.rs index e7ce3f95c8..b5446f8962 100644 --- a/autonomi-cli/src/commands/vault.rs +++ b/autonomi-cli/src/commands/vault.rs @@ -40,7 +40,7 @@ pub async fn create(peers: Vec) -> Result<()> { println!("Pushing to network vault..."); let total_cost = client - .put_user_data_to_vault(&vault_sk, &wallet, local_user_data) + .put_user_data_to_vault(&vault_sk, wallet.into(), local_user_data) .await?; if total_cost.is_zero() { @@ -82,7 +82,7 @@ pub async fn sync(peers: Vec, force: bool) -> Result<()> { let private_file_archives_len = local_user_data.private_file_archives.len(); let registers_len = local_user_data.registers.len(); client - .put_user_data_to_vault(&vault_sk, &wallet, local_user_data) + .put_user_data_to_vault(&vault_sk, wallet.into(), local_user_data) .await?; println!("✅ Successfully synced vault"); diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 102810b9e2..fa6fd98c09 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" @@ -14,7 +14,7 @@ crate-type = ["cdylib", "rlib"] [features] default = ["data", "vault"] -full = ["data", "registers", "vault"] +full = ["data", "registers", "vault", "fs"] data = [] vault = ["data", "registers"] fs = ["tokio/fs", "data"] @@ -38,11 +38,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" } @@ -60,8 +60,8 @@ blstrs = "0.7.1" 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" } @@ -71,7 +71,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/autonomi/WASM_docs.md b/autonomi/WASM_docs.md index 6cf080113f..ee62681aba 100644 --- a/autonomi/WASM_docs.md +++ b/autonomi/WASM_docs.md @@ -1,6 +1,6 @@ -# JavaScript Autonomi API Documentation +# Autonomi JS API -Note that this is a first version and will be subject to change. +Note: the JS API is experimental and will be subject to change. The entry point for connecting to the network is {@link Client.connect}. @@ -12,6 +12,8 @@ For addresses (chunk, data, archives, etc) we're using hex-encoded strings conta ## Example +Note: `getEvmNetwork` will use hardcoded EVM network values that should be set during compilation of this library. + ```javascript import init, { Client, Wallet, getEvmNetwork } from 'autonomi'; @@ -28,3 +30,10 @@ console.log("Data stored at:", result); let fetchedData = await client.get(result); console.log("Data retrieved:", fetchedData); ``` + +## Funded wallet from custom local network + +```js +const evmNetwork = getEvmNetworkCustom("http://localhost:4343", "", ""); +const wallet = getFundedWalletWithCustomNetwork(evmNetwork, "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"); +``` diff --git a/autonomi/examples/metamask/index.html b/autonomi/examples/metamask/index.html index 50844bd7f9..128273acbc 100644 --- a/autonomi/examples/metamask/index.html +++ b/autonomi/examples/metamask/index.html @@ -7,12 +7,12 @@