Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adjust security params for 1GiB sectors #782

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from
60 changes: 13 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ storagext = { path = "storagext/lib" }
bellpepper-core = "0.2"
bellperson = "0.26"
blstrs = "0.7"
filecoin-hashers = { version = "13.1.0", default-features = false }
filecoin-proofs = { version = "18.1.0", default-features = false }
fr32 = "11.1.0"
filecoin-hashers = { path = "../rust-fil-proofs/filecoin-hashers", default-features = false }
filecoin-proofs = { path = "../rust-fil-proofs/filecoin-proofs", default-features = false }
fr32 = { path = "../rust-fil-proofs/fr32" }
generic-array = "1.1.0"
storage-proofs-core = { version = "18.1.0", default-features = false }
storage-proofs-porep = { version = "18.1.0", default-features = false }
storage-proofs-post = { version = "18.1.0", default-features = false }
storage-proofs-core = { path = "../rust-fil-proofs/storage-proofs-core", default-features = false }
storage-proofs-porep = { path = "../rust-fil-proofs/storage-proofs-porep", default-features = false }
storage-proofs-post = { path = "../rust-fil-proofs/storage-proofs-post", default-features = false }

# Substrate
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412" }
Expand Down
44 changes: 44 additions & 0 deletions benches/generate_porep_proof.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Default number of sectors is 1 if not specified
NUM_SECTORS=${1:-1}
START_SECTOR=1
END_SECTOR=$NUM_SECTORS

SEAL_RANDOMNESS_HEIGHT=20
PRE_COMMIT_BLOCK_NUMBER=30

# Fixed parameters
PROVIDER="//Charlie"
CAR_FILE="../examples/big_file_184k.car"
COMMP="baga6ea4seaqhx2sxpfc2f3k2o75m3acskihug7me3g4coyw6adjqnd6ioszfqay"
PARAMS_PATH="../1GiB.porep.params"

echo "Processing $NUM_SECTORS sector(s) starting from $START_SECTOR"

# Loop through sector IDs
for ((SECTOR_ID=START_SECTOR; SECTOR_ID<=END_SECTOR; SECTOR_ID++))
do
echo "Processing Sector ID: $SECTOR_ID"

# Clear cache before run
CACHE_FOLDER="/eiger/tmp/sector-$SECTOR_ID-cache"
rm -r "$CACHE_FOLDER" 2>/dev/null # Suppress error if folder doesn't exist
mkdir "$CACHE_FOLDER"

# Run the proof generation
polka-storage-provider-client proofs porep \
--sr25519-key "$PROVIDER" \
--proof-parameters-path "$PARAMS_PATH" \
--cache-directory "$CACHE_FOLDER" \
--sector-id "$SECTOR_ID" \
--seal-randomness-height "$SEAL_RANDOMNESS_HEIGHT" \
--pre-commit-block-number "$PRE_COMMIT_BLOCK_NUMBER" \
"$CAR_FILE" \
"$COMMP"

echo "Finished processing Sector ID: $SECTOR_ID"
echo "----------------------------------------"
done

echo "All $NUM_SECTORS sector(s) processed!"
40 changes: 40 additions & 0 deletions benches/track_memory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Check if a command was provided
if [ -z "$1" ]; then
echo "Usage: $0 <command_to_run>"
exit 1
fi

# Log file
LOGFILE="memory_usage_$(date +%s).txt"
echo "Logging to $LOGFILE"

# Start the process in the background
"$@" & # Runs the provided command
PID=$!
echo "Started process with PID: $PID"

# Header for the log
echo "Timestamp %MEM RSS(kB) VSZ(kB)" > "$LOGFILE"

# Monitor memory usage until the process ends
while ps -p $PID > /dev/null; do
TIMESTAMP=$(date '+%s')
MEMORY=$(ps -p $PID -o %mem,rss,vsz --no-headers)
if [ -n "$MEMORY" ]; then
echo "$TIMESTAMP $MEMORY" >> "$LOGFILE"
fi
sleep 1 # Adjust polling interval as needed (e.g., 0.5 for 500ms)
done

echo "Process $PID has finished."

# Generate a simple report
echo "Memory Usage Report" >> "$LOGFILE"
echo "-----------------" >> "$LOGFILE"
echo "Max %MEM: $(awk 'NR>1{print $2}' "$LOGFILE" | sort -n | tail -1)" >> "$LOGFILE"
echo "Max RSS (kB): $(awk 'NR>1{print $3}' "$LOGFILE" | sort -n | tail -1)" >> "$LOGFILE"
echo "Max VSZ (kB): $(awk 'NR>1{print $4}' "$LOGFILE" | sort -n | tail -1)" >> "$LOGFILE"

echo "Report generated in $LOGFILE"
1 change: 1 addition & 0 deletions docs/src/getting-started/building/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ $ sudo apt install -y libhwloc-dev \
clang \
build-essential \
git \
libssl-dev \
curl
```

Expand Down
6 changes: 3 additions & 3 deletions docs/src/getting-started/local-testnet/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ We support `Linux x86_64 (Ubuntu 24.04.1 LTS/glibc 2.39+)` and `MacOS ARM x64`.
1. Download the binaries:

```bash
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-1/polkadot
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-1/polkadot-prepare-worker
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-1/polkadot-execute-worker
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2412/polkadot
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2412/polkadot-prepare-worker
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2412/polkadot-execute-worker
wget https://github.com/eigerco/polka-storage/releases/download/polka-storage-node-v0.0.0/polka-storage-node-linux-x86 -O polka-storage-node
wget https://github.com/eigerco/polka-storage/releases/download/polka-storage-provider-client-v0.1.0/polka-storage-provider-client-linux-x86 -O polka-storage-provider-client
wget https://github.com/eigerco/polka-storage/releases/download/polka-storage-provider-server-v0.1.0/polka-storage-provider-server-linux-x86 -O polka-storage-provider-server
Expand Down
13 changes: 11 additions & 2 deletions lib/polka-storage-proofs/src/post/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,27 @@ pub fn generate_window_post<S: MerkleTreeTrait + 'static>(
/// * <https://github.com/filecoin-project/rust-filecoin-proofs-api/blob/b44e7cecf2a120aa266b6886628e869ba67252af/src/registry.rs#L644>
fn seal_to_config(seal_proof: RegisteredPoStProof) -> filecoin_proofs::PoStConfig {
match seal_proof {
// https://github.com/filecoin-project/rust-fil-proofs/blob/266acc39a3ebd6f3d28c6ee335d78e2b7cea06bc/filecoin-proofs/src/constants.rs#L104
RegisteredPoStProof::StackedDRGWindow2KiBV1P1
| RegisteredPoStProof::StackedDRGWindow8MiBV1
| RegisteredPoStProof::StackedDRGWindow512MiBV1
| RegisteredPoStProof::StackedDRGWindow1GiBV1 => filecoin_proofs::PoStConfig {
=> filecoin_proofs::PoStConfig {
sector_size: filecoin_proofs::SectorSize(seal_proof.sector_size().bytes()),
challenge_count: filecoin_proofs::WINDOW_POST_CHALLENGE_COUNT,
// https://github.com/filecoin-project/rust-fil-proofs/blob/266acc39a3ebd6f3d28c6ee335d78e2b7cea06bc/filecoin-proofs/src/constants.rs#L104
sector_count: 2,
typ: PoStType::Window,
priority: true,
api_version: storage_proofs_core::api_version::ApiVersion::V1_2_0,
},
RegisteredPoStProof::StackedDRGWindow1GiBV1 => filecoin_proofs::PoStConfig {
sector_size: filecoin_proofs::SectorSize(seal_proof.sector_size().bytes()),
challenge_count: filecoin_proofs::WINDOW_POST_CHALLENGE_COUNT,
// https://github.com/filecoin-project/rust-fil-proofs/blob/266acc39a3ebd6f3d28c6ee335d78e2b7cea06bc/filecoin-proofs/src/constants.rs#L104
sector_count: 2349,
typ: PoStType::Window,
priority: true,
api_version: storage_proofs_core::api_version::ApiVersion::V1_2_0,
},
}
}

Expand Down
22 changes: 0 additions & 22 deletions maat/generate_porep_proof.sh

This file was deleted.

1 change: 1 addition & 0 deletions maat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ pub fn local_testnet_config(temp_dir_path: &std::path::Path) -> NetworkConfig {
.with_node(|node| node.polkadot_node("relay-1"))
.with_node(|node| node.polkadot_node("relay-2"))
})
.with_global_settings(|c| c.with_base_dir("/eiger/tmp/zombienet"))
.with_parachain(|parachain| {
parachain
.with_id(1000)
Expand Down
Loading