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(provider): implement blacklist #295

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/akash-provider/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type: application
# Versions are expected to follow Semantic Versioning (https://semver.org/)

# Major version bit highlights the mainnet release (e.g. mainnet4 = 4.x.x, mainnet5 = 5.x.x, ...)
version: 11.1.0
version: 11.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
15 changes: 14 additions & 1 deletion charts/akash-provider/scripts/price_script_generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# WARNING: the runtime of this script should NOT exceed 5 seconds! (Perhaps can be amended via AKASH_BID_PRICE_SCRIPT_PROCESS_TIMEOUT env variable)
# Requirements:
# curl jq bc mawk ca-certificates
# Version: April-03-2024
# Version: Nov-02-2024
set -o pipefail

# Example:
Expand All @@ -28,6 +28,19 @@ if ! [[ -z $WHITELIST_URL ]]; then
fi
fi

# Do not bid if the tenant address is in the list passed with BLACKLIST_URL environment variable
if ! [[ -z $BLACKLIST_URL ]]; then
BLACKLIST=/tmp/price-script.blacklist
if ! test $(find $BLACKLIST -mmin -10 2>/dev/null); then
curl -o $BLACKLIST -s --connect-timeout 3 --max-time 3 -- $BLACKLIST_URL
fi

if grep -qw "$AKASH_OWNER" $BLACKLIST; then
echo -n "$AKASH_OWNER is blacklisted" >&2
exit 1
fi
fi

function get_akt_price {
# cache AKT price for 60 minutes to reduce the API pressure as well as to slightly accelerate the bidding (+5s)
CACHE_FILE=/tmp/aktprice.cache
Expand Down
4 changes: 4 additions & 0 deletions charts/akash-provider/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ spec:
- name: WHITELIST_URL
value: "{{ .Values.whitelist_url }}"
{{- end }}
{{ if .Values.blacklist_url }}
- name: BLACKLIST_URL
value: "{{ .Values.blacklist_url }}"
{{- end }}
{{ if .Values.debug_bid_script }}
- name: DEBUG_BID_SCRIPT
value: "{{ .Values.debug_bid_script }}"
Expand Down
Loading