Skip to content

Commit

Permalink
chore: Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Feb 8, 2024
1 parent fa24c12 commit 29b3826
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,34 @@ To enable `git push` or gain write access to repositories, you'll need an Arweav
git config --global --add protocol.land.keyfile ~/private_folder/jwk_keyfile.json
```

> **Note:** This globally adds the keyfile path for all repositories. If you prefer to use them selectively per repository, omit the `--global` modifier in the `git config` command.
> [!Note]
> This globally adds the keyfile path for all repositories. If you prefer to use them selectively per repository, omit the `--global` modifier in the `git config` command.
## Setup Threshold Cost for Push consent

> [!Note]
> This functionality is compatible with UNIX-based operating systems such as Linux, macOS etc. For Windows users, leveraging the Windows Subsystem for Linux (WSL) is recommended.
To effectively manage push consent based on the cost of pushing changes, you can configure a Threshold Cost. Use the `git config` command to set this threshold value:

```bash
git config --global --add protocol.land.thresholdCost 0.0003
```

This command sets the global threshold cost for push consent to `0.0003 AR`. When the estimated push cost exceeds this threshold, users will be prompted to consent to the fee before proceeding with the push.

> [!Note]
> This threshold is set globally for all repositories. If you wish to apply different thresholds for specific repositories, use the command without the `--global` modifier within the repository's directory.
### Understanding Push Consent Logic

Here's how it decides when to ask for your consent before uploading:

- **No Set Threshold**: Without the threshold set, you'll only be asked for consent if the upload size exceeds the free subsidy size (For example: Turbo bundler used here allows upto 500KB uploads for free).
- **Over the Threshold**: If the upload cost is more than the threshold, consent is requested only if the upload size is larger than what's freely allowed.
- **Under the Threshold**: For costs below the threshold, consent isn't needed, and uploads proceed automatically.

Adjusting the threshold cost allows users and organizations to maintain control over their expenditure on network fees, ensuring transparency and consent for every push operation that incurs a cost above the specified threshold.

## Usage

Expand Down
1 change: 1 addition & 0 deletions src/lib/arweaveHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export async function uploadRepo(
const subsidySize = 500 * 1024; // 500KB;
return await attemptUpload(subsidySize, 'Turbo', turboUpload);
} catch (error) {
log('Turbo failed, trying with Arweave...');
return await attemptUpload(0, 'Arweave', arweaveUpload);
}
}
Expand Down

0 comments on commit 29b3826

Please sign in to comment.