Skip to content

Commit

Permalink
feat: generic transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
grumbach committed Nov 29, 2024
1 parent 199dc78 commit 97ec197
Show file tree
Hide file tree
Showing 96 changed files with 468 additions and 13,397 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/benchmark-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,37 +378,3 @@ jobs:
# Enable Job Summary for PRs
summary-always: true

benchmark-cash:
name: Compare sn_transfer benchmarks to main
# right now only ubuntu, running on multiple systems would require many pushes...\
# perhaps this can be done with one consolidation action in the future, pulling down all results and pushing
# once to the branch..
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2
continue-on-error: true

########################
### Setup ###
########################
- run: cargo install cargo-criterion

- name: install ripgrep
run: sudo apt-get -y install ripgrep

########################
### Benchmark ###
########################
- name: Bench `sn_transfers`
shell: bash
# Criterion outputs the actual bench results to stderr "2>&1 tee output.txt" takes stderr,
# passes to tee which displays it in the terminal and writes to output.txt
run: |
cargo criterion --message-format=json 2>&1 -p sn_transfers | tee -a output.txt
cat output.txt
76 changes: 29 additions & 47 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ jobs:
timeout-minutes: 25
run: cargo test --release --package sn_protocol

- name: Run transfers tests
timeout-minutes: 25
run: cargo test --release --package sn_transfers

- name: Run logging tests
timeout-minutes: 25
run: cargo test --release --package sn_logging
Expand Down Expand Up @@ -584,9 +580,9 @@ jobs:
log_file_prefix: safe_test_logs_e2e
platform: ${{ matrix.os }}

# spend_test:
# transaction_test:
# if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
# name: spend tests against network
# name: transaction tests against network
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
Expand All @@ -607,14 +603,6 @@ jobs:
# run: cargo build --release --bin faucet --features="local,gifting"
# timeout-minutes: 30

# - name: Build testing executable
# run: cargo test --release -p sn_node --features=local --test sequential_transfers --test storage_payments --test double_spend --no-run
# env:
# # only set the target dir for windows to bypass the linker issue.
# # happens if we build the node manager via testnet action
# CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
# timeout-minutes: 30

# - name: Start a local network
# uses: maidsafe/sn-local-testnet-action@main
# with:
Expand Down Expand Up @@ -649,24 +637,18 @@ jobs:
# CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
# timeout-minutes: 25

# - name: execute the double spend tests
# run: cargo test --release -p sn_node --features="local" --test double_spend -- --nocapture --test-threads=1
# env:
# CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
# timeout-minutes: 25

# - name: Stop the local network and upload logs
# if: always()
# uses: maidsafe/sn-local-testnet-action@main
# with:
# action: stop
# log_file_prefix: safe_test_logs_spend
# log_file_prefix: safe_test_logs_transaction
# platform: ${{ matrix.os }}

# # runs with increased node count
# spend_simulation:
# transaction_simulation:
# if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
# name: spend simulation
# name: transaction simulation
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
Expand All @@ -688,7 +670,7 @@ jobs:
# timeout-minutes: 30

# - name: Build testing executable
# run: cargo test --release -p sn_node --features=local --test spend_simulation --no-run
# run: cargo test --release -p sn_node --features=local --test transaction_simulation --no-run
# env:
# # only set the target dir for windows to bypass the linker issue.
# # happens if we build the node manager via testnet action
Expand Down Expand Up @@ -716,8 +698,8 @@ jobs:
# echo "SAFE_PEERS has been set to $SAFE_PEERS"
# fi

# - name: execute the spend simulation
# run: cargo test --release -p sn_node --features="local" --test spend_simulation -- --nocapture
# - name: execute the transaction simulation
# run: cargo test --release -p sn_node --features="local" --test transaction_simulation -- --nocapture
# env:
# CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
# timeout-minutes: 25
Expand All @@ -727,7 +709,7 @@ jobs:
# uses: maidsafe/sn-local-testnet-action@main
# with:
# action: stop
# log_file_prefix: safe_test_logs_spend_simulation
# log_file_prefix: safe_test_logs_transaction_simulation
# platform: ${{ matrix.os }}

# token_distribution_test:
Expand Down Expand Up @@ -1502,18 +1484,18 @@ jobs:
# SN_LOG: "all"
# timeout-minutes: 5

# - name: Ensure no leftover cash_notes and payment files
# - name: Ensure no leftover transactions and payment files
# run: |
# expected_cash_notes_files="1"
# expected_transactions_files="1"
# expected_payment_files="0"
# pwd
# ls $CLIENT_DATA_PATH/ -l
# ls $CLIENT_DATA_PATH/wallet -l
# ls $CLIENT_DATA_PATH/wallet/cash_notes -l
# cash_note_files=$(ls $CLIENT_DATA_PATH/wallet/cash_notes | wc -l)
# echo "Find $cash_note_files cash_note files"
# if [ $expected_cash_notes_files -lt $cash_note_files ]; then
# echo "Got too many cash_note files leftover: $cash_note_files"
# ls $CLIENT_DATA_PATH/wallet/transactions -l
# transaction_files=$(ls $CLIENT_DATA_PATH/wallet/transactions | wc -l)
# echo "Find $transaction_files transaction files"
# if [ $expected_transactions_files -lt $transaction_files ]; then
# echo "Got too many transaction files leftover: $transaction_files"
# exit 1
# fi
# ls $CLIENT_DATA_PATH/wallet/payments -l
Expand All @@ -1536,17 +1518,17 @@ jobs:
# SN_LOG: "all"
# timeout-minutes: 10

# - name: Ensure no leftover cash_notes and payment files
# - name: Ensure no leftover transactions and payment files
# run: |
# expected_cash_notes_files="1"
# expected_transactions_files="1"
# expected_payment_files="0"
# pwd
# ls $CLIENT_DATA_PATH/ -l
# ls $CLIENT_DATA_PATH/wallet -l
# ls $CLIENT_DATA_PATH/wallet/cash_notes -l
# cash_note_files=$(find $CLIENT_DATA_PATH/wallet/cash_notes -type f | wc -l)
# if (( $(echo "$cash_note_files > $expected_cash_notes_files" | bc -l) )); then
# echo "Got too many cash_note files leftover: $cash_note_files when we expected $expected_cash_notes_files"
# ls $CLIENT_DATA_PATH/wallet/transactions -l
# transaction_files=$(find $CLIENT_DATA_PATH/wallet/transactions -type f | wc -l)
# if (( $(echo "$transaction_files > $expected_transactions_files" | bc -l) )); then
# echo "Got too many transaction files leftover: $transaction_files when we expected $expected_transactions_files"
# exit 1
# fi
# ls $CLIENT_DATA_PATH/wallet/payments -l
Expand Down Expand Up @@ -1589,18 +1571,18 @@ jobs:
# SN_LOG: "all"
# timeout-minutes: 10

# - name: Ensure no leftover cash_notes and payment files
# - name: Ensure no leftover transactions and payment files
# run: |
# expected_cash_notes_files="1"
# expected_transactions_files="1"
# expected_payment_files="0"
# pwd
# ls $CLIENT_DATA_PATH/ -l
# ls $CLIENT_DATA_PATH/wallet -l
# ls $CLIENT_DATA_PATH/wallet/cash_notes -l
# cash_note_files=$(ls $CLIENT_DATA_PATH/wallet/cash_notes | wc -l)
# echo "Find $cash_note_files cash_note files"
# if [ $expected_cash_notes_files -lt $cash_note_files ]; then
# echo "Got too many cash_note files leftover: $cash_note_files"
# ls $CLIENT_DATA_PATH/wallet/transactions -l
# transaction_files=$(ls $CLIENT_DATA_PATH/wallet/transactions | wc -l)
# echo "Find $transaction_files transaction files"
# if [ $expected_transactions_files -lt $transaction_files ]; then
# echo "Got too many transaction files leftover: $transaction_files"
# exit 1
# fi
# ls $CLIENT_DATA_PATH/wallet/payments -l
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ jobs:
timeout-minutes: 25
run: cargo test --release --package sn_protocol

- name: Run transfers tests
timeout-minutes: 25
run: cargo test --release --package sn_transfers

- name: Run logging tests
timeout-minutes: 25
run: cargo test --release --package sn_logging
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/nightly_wan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
SLACK_MESSAGE: "Please check the logs for the run at ${{ env.WORKFLOW_URL }}/${{ github.run_id }}"
SLACK_TITLE: "Nightly E2E Test Run Failed"

# spend_test:
# transaction_test:
# name: Spend tests against network
# runs-on: ${{ matrix.os }}
# strategy:
Expand All @@ -162,10 +162,6 @@ jobs:
# - uses: Swatinem/rust-cache@v2
# continue-on-error: true

# - name: Build testing executable
# run: cargo test --release -p sn_node --features=local --test sequential_transfers --test storage_payments --test double_spend --test spend_simulation --no-run
# timeout-minutes: 40

# - name: setup testnet-deploy
# uses: maidsafe/sn-testnet-control-action/init-testnet-deploy@main
# with:
Expand Down Expand Up @@ -208,14 +204,6 @@ jobs:
# SN_LOG: "all"
# timeout-minutes: 45

# - name: execute the double spend tests
# run: cargo test --release -p sn_node --test double_spend -- --nocapture --test-threads=1
# timeout-minutes: 45

# - name: execute the spend simulation tests
# run: cargo test --release -p sn_node --test spend_simulation -- --nocapture --test-threads=1
# timeout-minutes: 45

# - name: Small wait to allow reward receipt
# run: sleep 30
# timeout-minutes: 1
Expand Down
Loading

0 comments on commit 97ec197

Please sign in to comment.