-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: verify multiple partitions in pallets (#658)
- Loading branch information
Showing
25 changed files
with
243 additions
and
301 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "$0: input file required" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$1" ]; then | ||
echo "$0: input file cannot be empty" | ||
exit 1 | ||
fi | ||
|
||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT | ||
|
||
# requires the testnet to be running! | ||
export DISABLE_XT_WAIT_WARNING=1 | ||
|
||
CLIENT="//Alice" | ||
PROVIDER="//Charlie" | ||
|
||
INPUT_FILE="$1" | ||
INPUT_FILE_NAME="$(basename "$INPUT_FILE")" | ||
INPUT_TMP_FILE="/tmp/$INPUT_FILE_NAME.car" | ||
|
||
target/release/mater-cli convert -q --overwrite "$INPUT_FILE" "$INPUT_TMP_FILE" && | ||
INPUT_COMMP="$(target/release/polka-storage-provider-client proofs commp "$INPUT_TMP_FILE")" | ||
PIECE_CID="$(echo "$INPUT_COMMP" | jq -r ".cid")" | ||
PIECE_SIZE="$(echo "$INPUT_COMMP" | jq ".size")" | ||
|
||
|
||
for i in $(seq 194 200); | ||
do | ||
DEAL_JSON=$( | ||
jq -n \ | ||
--arg piece_cid "$PIECE_CID" \ | ||
--argjson start_block "$i" \ | ||
--argjson piece_size "$PIECE_SIZE" \ | ||
'{ | ||
"piece_cid": $piece_cid, | ||
"piece_size": $piece_size, | ||
"client": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", | ||
"provider": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y", | ||
"label": "", | ||
"start_block": $start_block, | ||
"end_block": 250, | ||
"storage_price_per_block": 500, | ||
"provider_collateral": 1250, | ||
"state": "Published" | ||
}' | ||
) | ||
SIGNED_DEAL_JSON="$(RUST_LOG=error target/release/polka-storage-provider-client sign-deal --sr25519-key "$CLIENT" "$DEAL_JSON")" | ||
|
||
DEAL_CID="$(RUST_LOG=error target/release/polka-storage-provider-client propose-deal "$DEAL_JSON")" | ||
echo "-------------------------- Uploading deal $i..." | ||
echo | ||
curl -X PUT -F "upload=@$INPUT_FILE" "http://localhost:8001/upload/$DEAL_CID" | ||
|
||
echo | ||
echo "-------------------------- Publishing deal $i..." | ||
target/release/polka-storage-provider-client publish-deal "$SIGNED_DEAL_JSON" & | ||
# If we try to prove commit 6 in a single row then we're done. | ||
# we need to throttle prove commits. | ||
# Sleeping until polka-storage#655 is done. | ||
sleep 6 | ||
|
||
done | ||
|
||
# wait until user Ctrl+Cs so that the commitment can actually be calculated | ||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT | ||
|
||
# requires the testnet to be running! | ||
export DISABLE_XT_WAIT_WARNING=1 | ||
|
||
CLIENT="//Alice" | ||
PROVIDER="//Charlie" | ||
|
||
# Setup balances | ||
RUST_LOG=debug target/release/storagext-cli --sr25519-key "$CLIENT" market add-balance 250000000000 & | ||
RUST_LOG=debug target/release/storagext-cli --sr25519-key "$PROVIDER" market add-balance 250000000000 & | ||
# We can process a transaction by charlie and alice, but we can't in the same transaction | ||
# register one of them as the storage provider | ||
wait | ||
|
||
# It's a test setup based on the local verifying keys, everyone can run those extrinsics currently. | ||
# Each of the keys is different, because the processes are running in parallel. | ||
# If they were running in parallel on the same account, they'd conflict with each other on the transaction nonce. | ||
RUST_LOG=debug target/release/storagext-cli --sr25519-key "//Charlie" storage-provider register "peer_id" & | ||
RUST_LOG=debug target/release/storagext-cli --sr25519-key "//Alice" proofs set-porep-verifying-key @2KiB.porep.vk.scale & | ||
RUST_LOG=debug target/release/storagext-cli --sr25519-key "//Bob" proofs set-post-verifying-key @2KiB.post.vk.scale & | ||
wait | ||
|
||
RUST_LOG=debug target/release/polka-storage-provider-server --sr25519-key "$PROVIDER" --seal-proof "2KiB" --post-proof "2KiB" --porep-parameters 2KiB.porep.params --post-parameters 2KiB.post.params |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.