Skip to content

Commit

Permalink
unused deps removed
Browse files Browse the repository at this point in the history
  • Loading branch information
krrish-sehgal committed Jan 28, 2025
1 parent dac9a28 commit 5ad0b31
Show file tree
Hide file tree
Showing 111 changed files with 3,760 additions and 1,738 deletions.
59 changes: 59 additions & 0 deletions BACON/BLT BTC Runes documentation .md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Documentation for etching runes for BACON

**2 Jan, 2025\.**
**11AM IST.**

Right now, we have two servers with alphaVPS as the provider.

One node runs a testnet, where we plan to etch the BTC runes initially for POC purposes.

And another one is syncing up with the mainnet, where we plan to etch the BACON token.

**The current state while writing:**
1\. Testnet server has a corrupted chain index (started reindexing today), due to random killing of the bitcoind process, we might have to raise a ticket with alphaVPS for this, since its probable they do this because of I/O limits.

2\. The mainnet is syncing slow and steady and is upto \~46.5% as of writing.

**Current Workflow**

1. On the testnet node, one tmux session is used to run the node and other is used to run the ord server.
2. Once both of these sync up, we will probably create another tmux session to create wallet and etch runes.
3. On the mainnet node, we just have a single tmux session as of writing where the bitcoind process is syncing the node with the mainnet.

**Some useful references:**
[https://ordtutorial.vercel.app/ordtestnet](https://ordtutorial.vercel.app/ordtestnet)

**Current bitcoind config on testnet.**
server=1
testnet=1
txindex=1
rpcuser=apoorva
blockfilterindex=1
rpcpassword=y^2DhUnxrhFr7qAj2yjhvykFz
rpcallowip=127.0.0.1
[test]
rpcport=8332
rpcbind=127.0.0.1

**Current bitcoind config on the mainnet:**
server=1
txindex=1
rpcuser=apoorva
blockfilterindex=1
rpcpassword=y^2DhUnxrhFr7qAj2yjhvykFz
rpcallowip=127.0.0.1
rpcport=8332
blockfilterindex=1

Side note: We might want to add rpcbind here after the node syncs completely.

**Command to start the bitcoind process on the testnet, note that we use the bitcoind snap package on both our servers.**
bitcoin-core.daemon \-datadir=/home/apoorva/test-btc-data \-dbcache=256 \-rpcworkqueue=1000

**Command to start the ordinal server to index blocks after syncing the node completely, we will create a wallet and etch runes once this completes.**
sudo ./ord \--bitcoin-rpc-user apoorva \--bitcoin-rpc-pass y^2DhUnxrhFr7qAj2yjhvykFz \--rpc-url http://127.0.0.1:8332 \--data-dir /home/apoorva/ord-data \--bitcoin-data-dir /home/apoorva/test-btc-data \--index-runes \--testnet \--verbose server

**Some additional observations:**

1. I found that ^C takes a lot of time to stop the bitcoind process,so another way to kill it instantly is finding the PID of the bitcoind process and killing it, saves a lot of time, but use with caution, since it might corrupt the indexing and syncing.

8 changes: 2 additions & 6 deletions blt/middleware/ip_restrict.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ def increment_block_count(self, ip=None, network=None, user_agent=None):
if ip:
blocked_entry = Blocked.objects.select_for_update().filter(address=ip).first()
elif network:
blocked_entry = (
Blocked.objects.select_for_update().filter(ip_network=network).first()
)
blocked_entry = Blocked.objects.select_for_update().filter(ip_network=network).first()
elif user_agent:
# Correct lookup: find if any user_agent_string is a substring of the user_agent
blocked_entry = (
Expand All @@ -111,9 +109,7 @@ def increment_block_count(self, ip=None, network=None, user_agent=None):
blocked_entry.save(update_fields=["count"])

def __call__(self, request):
ip = request.META.get("HTTP_X_FORWARDED_FOR", "").split(",")[0].strip() or request.META.get(
"REMOTE_ADDR", ""
)
ip = request.META.get("HTTP_X_FORWARDED_FOR", "").split(",")[0].strip() or request.META.get("REMOTE_ADDR", "")
agent = request.META.get("HTTP_USER_AGENT", "").strip()

blocked_ips = self.blocked_ips()
Expand Down
5 changes: 2 additions & 3 deletions blt/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@
if not GOOGLE_CREDENTIALS:
raise Exception("GOOGLE_CREDENTIALS environment variable is not set.")

GS_CREDENTIALS = service_account.Credentials.from_service_account_info(
json.loads(GOOGLE_CREDENTIALS)
)
GS_CREDENTIALS = service_account.Credentials.from_service_account_info(json.loads(GOOGLE_CREDENTIALS))

STORAGES = {
"default": {
Expand Down Expand Up @@ -313,6 +311,7 @@
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "optional"
ACCOUNT_FORMS = {"signup": "website.forms.SignupFormWithCaptcha"}

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

Expand Down
15 changes: 8 additions & 7 deletions blt/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@
UserIssueViewSet,
UserProfileViewSet,
)
from website.views.blog import (
PostCreateView,
PostDeleteView,
PostDetailView,
PostListView,
PostUpdateView,
)
from website.views.blog import PostCreateView, PostDeleteView, PostDetailView, PostListView, PostUpdateView
from website.views.company import (
AddDomainView,
AddHuntView,
Expand Down Expand Up @@ -188,6 +182,8 @@
)
from website.views.slack_handlers import slack_commands, slack_events
from website.views.teams import (
TeamChallenges,
TeamLeaderboard,
TeamOverview,
add_member,
create_team,
Expand All @@ -203,6 +199,7 @@
GlobalLeaderboardView,
InviteCreate,
SpecificMonthLeaderboardView,
UserChallengeListView,
UserDeleteView,
UserProfileDetailsView,
UserProfileDetailView,
Expand Down Expand Up @@ -858,8 +855,12 @@
name="similarity_scan",
),
path("projects/create/", create_project, name="create_project"),
path("teams/challenges/", TeamChallenges.as_view(), name="team_challenges"),
path("teams/leaderboard/", TeamLeaderboard.as_view(), name="team_leaderboard"),
path("challenges/", UserChallengeListView.as_view(), name="user_challenges"),
path("project/<slug:slug>/", ProjectsDetailView.as_view(), name="projects_detail"),
path("slack/events", slack_events, name="slack_events"),
path("owasp/", TemplateView.as_view(template_name="owasp.html"), name="owasp"),
]

if settings.DEBUG:
Expand Down
4 changes: 1 addition & 3 deletions comments/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class Migration(migrations.Migration):
fields=[
(
"id",
models.AutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID"),
),
("author", models.CharField(max_length=200)),
("author_url", models.CharField(max_length=200)),
Expand Down
4 changes: 1 addition & 3 deletions comments/migrations/0002_comment_parentid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="comment",
name="parentId",
field=models.ForeignKey(
null=True, on_delete=django.db.models.deletion.CASCADE, to="comments.Comment"
),
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to="comments.Comment"),
),
]
4 changes: 1 addition & 3 deletions comments/migrations/0005_auto_20170727_1309.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="comment",
name="parent",
field=models.ForeignKey(
null=True, on_delete=django.db.models.deletion.CASCADE, to="comments.Comment"
),
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to="comments.Comment"),
),
]
12 changes: 3 additions & 9 deletions comments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ def reply_comment(request, pk):
issue = Issue.objects.get(pk=request.GET["issue_pk"])
reply_text = request.GET.get("text_comment")
reply_text = escape(reply_text)
comment = Comment(
author=author, author_url=author_url, issue=issue, text=reply_text, parent=parent_obj
)
comment = Comment(author=author, author_url=author_url, issue=issue, text=reply_text, parent=parent_obj)
comment.save()
all_comment = Comment.objects.filter(issue=issue)
return render(
Expand All @@ -145,15 +143,11 @@ def autocomplete(request):
q_string = request.GET.get("search", "")
q_string = escape(q_string)
if len(q_string) == 0:
return HttpResponse(
request.GET["callback"] + "(" + json.dumps([]) + ");", content_type="application/json"
)
return HttpResponse(request.GET["callback"] + "(" + json.dumps([]) + ");", content_type="application/json")
q_list = q_string.split(" ")
q_s = q_list[len(q_list) - 1]
if len(q_s) == 0 or q_s[0] != "@":
return HttpResponse(
request.GET["callback"] + "(" + json.dumps([]) + ");", content_type="application/json"
)
return HttpResponse(request.GET["callback"] + "(" + json.dumps([]) + ");", content_type="application/json")

q_s = q_s[1:]
search_qs = User.objects.filter(username__startswith=q_s)
Expand Down
Loading

0 comments on commit 5ad0b31

Please sign in to comment.