Skip to content
Closed
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: 2 additions & 0 deletions docs/zh-CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
| [wRTC 教程](../WRTC_ONBOARDING_TUTORIAL.md) | 跨链桥接指南 |
| [贡献指南](../../CONTRIBUTING.md) | 参与开发 |

BoTTube 高级接口运行在 BoTTube 域名上:`https://bottube.ai/api/premium/videos` 和 `https://bottube.ai/api/premium/analytics/<agent>`。

---

## 🔥 Crypto 迷失了方向。我们回到原点。
Expand Down
2 changes: 1 addition & 1 deletion miners/checksums.sha256
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
4afd5aea552cc5b68364b39fa37cdc93d1d406ec295670969e1a9c4164babb15 linux/rustchain_linux_miner.py
c7af612bb2630d5fe6576bb132bdeb7a00ba0be042ec168887ab767a1f16c9f9 linux/rustchain_linux_miner.py
cdfca6e63ecd24f53b30140dd44df42415a3254c68aad95b1fca3c1557e15f7b linux/fingerprint_checks.py
603d9a3b3ebfe1a0ca56a60988db4b5d4a80ab57cb5feb1c0b563a1d4020fcd7 macos/rustchain_mac_miner_v2.4.py
163fafcf751d8fbd41bf936facaeb366c042f467fa34b79f2c4c0a45472ef70f macos/rustchain_mac_miner_v2.5.py
Expand Down
8 changes: 4 additions & 4 deletions node/airdrop_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ def get_claims_by_github(
"SELECT * FROM airdrop_claims WHERE github_username = ?",
(github_username,),
)
rows = cursor.fetchall()
rows = cursor.fetchall() # fetchall-ok: bounded-by-schema
self._close_conn(conn)

return [
Expand Down Expand Up @@ -1190,7 +1190,7 @@ def get_allocation_status(self) -> Dict[str, Dict[str, Any]]:
conn = self._get_conn()
cursor = conn.cursor()
cursor.execute("SELECT * FROM airdrop_allocation")
rows = cursor.fetchall()
rows = cursor.fetchall() # fetchall-ok: bounded-by-schema
self._close_conn(conn)

return {
Expand Down Expand Up @@ -1223,7 +1223,7 @@ def get_stats(self) -> Dict[str, Any]:
)
by_tier = {
row["tier"]: {"count": row["count"], "total_wrtc": row["total"] / 1_000_000}
for row in cursor.fetchall()
for row in cursor.fetchall() # fetchall-ok: bounded-by-schema
}

# Claims by chain
Expand All @@ -1235,7 +1235,7 @@ def get_stats(self) -> Dict[str, Any]:
)
by_chain = {
row["chain"]: {"count": row["count"], "total_wrtc": row["total"] / 1_000_000}
for row in cursor.fetchall()
for row in cursor.fetchall() # fetchall-ok: bounded-by-schema
}

# Bridge locks
Expand Down
14 changes: 7 additions & 7 deletions node/anti_double_mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def detect_duplicate_identities(
"SELECT miner_pk FROM epoch_enroll WHERE epoch = ?",
(epoch,)
)
enrolled = cursor.fetchall()
enrolled = cursor.fetchall() # fetchall-ok: bounded-by-schema

if enrolled:
rows = []
Expand Down Expand Up @@ -207,7 +207,7 @@ def detect_duplicate_identities(
WHERE ts_ok >= ? AND ts_ok <= ?
ORDER BY device_arch, entropy_score DESC
""", (epoch_start_ts, epoch_end_ts))
rows = cursor.fetchall()
rows = cursor.fetchall() # fetchall-ok: bounded-by-schema

# Group miners by machine identity
identity_map: Dict[str, List[Tuple[str, Dict]]] = {} # identity_hash -> [(miner_id, attestation_data)]
Expand Down Expand Up @@ -330,7 +330,7 @@ def select_representative_miner(
ORDER BY entropy_score DESC, ts_ok DESC, miner ASC
""", miner_ids)

rows = cursor.fetchall()
rows = cursor.fetchall() # fetchall-ok: bounded-by-schema

if not rows:
# Fallback: return first miner ID
Expand Down Expand Up @@ -364,7 +364,7 @@ def get_epoch_miner_groups(
"SELECT miner_pk FROM epoch_enroll WHERE epoch = ?",
(epoch,)
)
enrolled = cursor.fetchall()
enrolled = cursor.fetchall() # fetchall-ok: bounded-by-schema

if enrolled:
# Build miner list from epoch_enroll; look up arch + fingerprint history.
Expand Down Expand Up @@ -404,7 +404,7 @@ def get_epoch_miner_groups(
FROM miner_attest_recent
WHERE ts_ok >= ? AND ts_ok <= ?
""", (epoch_start_ts, epoch_end_ts))
rows = cursor.fetchall()
rows = cursor.fetchall() # fetchall-ok: bounded-by-schema

# Group by machine identity
groups: Dict[str, List[str]] = {}
Expand Down Expand Up @@ -436,7 +436,7 @@ def _get_epoch_enrolled_weights(conn: sqlite3.Connection, epoch: int) -> Dict[st
multiplier path.
"""
try:
cols = conn.execute("PRAGMA table_info(epoch_enroll)").fetchall()
cols = conn.execute("PRAGMA table_info(epoch_enroll)").fetchall() # fetchall-ok: pragma-result
except sqlite3.Error:
return {}

Expand All @@ -447,7 +447,7 @@ def _get_epoch_enrolled_weights(conn: sqlite3.Connection, epoch: int) -> Dict[st
rows = conn.execute(
"SELECT miner_pk, weight FROM epoch_enroll WHERE epoch = ?",
(epoch,),
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
except sqlite3.Error:
return {}

Expand Down
2 changes: 1 addition & 1 deletion node/bcos_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def bcos_directory():
query += " ORDER BY created_at DESC LIMIT ? OFFSET ?"
params.extend([limit, offset])

rows = conn.execute(query, params).fetchall()
rows = conn.execute(query, params).fetchall() # fetchall-ok: bounded-by-schema
total = conn.execute(
"SELECT COUNT(*) FROM bcos_attestations"
).fetchone()[0]
Expand Down
6 changes: 3 additions & 3 deletions node/beacon_anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _ensure_payload_hash_version_column(conn: sqlite3.Connection):
"""
columns = {
row[1]
for row in conn.execute("PRAGMA table_info(beacon_envelopes)").fetchall()
for row in conn.execute("PRAGMA table_info(beacon_envelopes)").fetchall() # fetchall-ok: pragma-result
}
if "payload_hash_version" not in columns:
conn.execute(
Expand Down Expand Up @@ -233,7 +233,7 @@ def compute_beacon_digest(db_path=DB_PATH) -> dict:
rows = conn.execute(
"SELECT id, payload_hash, payload_hash_version, created_at FROM beacon_envelopes "
"WHERE anchored = 0 ORDER BY id ASC"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema

if not rows:
return {
Expand Down Expand Up @@ -302,7 +302,7 @@ def get_recent_envelopes(limit=50, offset=0, db_path=DB_PATH) -> list:
"SELECT id, agent_id, kind, nonce, payload_hash, payload_hash_version, anchored, created_at "
"FROM beacon_envelopes ORDER BY created_at DESC LIMIT ? OFFSET ?",
(limit, offset)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
return [dict(r) for r in rows]


Expand Down
12 changes: 6 additions & 6 deletions node/beacon_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def get_agents():
db = get_db()
rows = db.execute(
"SELECT agent_id, pubkey_hex, name, status, created_at, updated_at FROM relay_agents ORDER BY created_at DESC"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema

agents = []
for row in rows:
Expand Down Expand Up @@ -544,13 +544,13 @@ def beacon_atlas():
WHERE status = ?
ORDER BY created_at DESC""",
(status_filter,)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
else:
rows = db.execute(
"""SELECT agent_id, pubkey_hex, name, status, coinbase_address, created_at, updated_at
FROM relay_agents
ORDER BY created_at DESC"""
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema

agents = []
for row in rows:
Expand Down Expand Up @@ -592,7 +592,7 @@ def get_contracts():
db = get_db()
rows = db.execute(
"SELECT * FROM beacon_contracts ORDER BY created_at DESC"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema

contracts = []
for row in rows:
Expand Down Expand Up @@ -821,7 +821,7 @@ def get_bounties():
db = get_db()
rows = db.execute(
"SELECT * FROM beacon_bounties WHERE state = 'open' ORDER BY reward_rtc DESC"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema

bounties = []
for row in rows:
Expand Down Expand Up @@ -1078,7 +1078,7 @@ def get_reputation():
return jsonify({'error': 'Unauthorized'}), 401
try:
db = get_db()
rows = db.execute("SELECT * FROM beacon_reputation ORDER BY score DESC").fetchall()
rows = db.execute("SELECT * FROM beacon_reputation ORDER BY score DESC").fetchall() # fetchall-ok: bounded-by-schema

reputations = []
for row in rows:
Expand Down
4 changes: 2 additions & 2 deletions node/beacon_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def load_all_keys(db_path: str = DB_PATH) -> List[Dict[str, Any]]:
conn.row_factory = sqlite3.Row
rows = conn.execute(
"SELECT * FROM beacon_known_keys ORDER BY first_seen ASC"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
return [dict(r) for r in rows]


Expand Down Expand Up @@ -256,7 +256,7 @@ def expire_old_keys(
rows = conn.execute(
"SELECT agent_id FROM beacon_known_keys WHERE last_seen < ? AND revoked = 0",
(cutoff,),
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
expired_ids = [r[0] for r in rows]
if not dry_run and expired_ids:
placeholders = ",".join("?" for _ in expired_ids)
Expand Down
8 changes: 4 additions & 4 deletions node/beacon_x402.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _run_migrations(db_path):
# Add coinbase_address to relay_agents if missing
cursor = conn.execute("PRAGMA table_info(relay_agents)")
existing_cols = {row[1] if isinstance(row, tuple) else row["name"]
for row in cursor.fetchall()}
for row in cursor.fetchall()} # fetchall-ok: pragma-result

for sql in RELAY_MIGRATION_SQL:
col_name = sql.split("ADD COLUMN ")[1].split()[0]
Expand Down Expand Up @@ -338,7 +338,7 @@ def premium_reputation():
try:
rows = db.execute(
"SELECT * FROM reputation ORDER BY score DESC"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
reputation = [dict(r) for r in rows]
except sqlite3.OperationalError:
reputation = []
Expand Down Expand Up @@ -366,7 +366,7 @@ def premium_contracts_export():
try:
rows = db.execute(
"SELECT * FROM contracts ORDER BY created_at DESC"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
except sqlite3.OperationalError:
rows = []

Expand Down Expand Up @@ -407,7 +407,7 @@ def x402_beacon_payments():
try:
rows = db.execute(
"SELECT * FROM x402_beacon_payments ORDER BY created_at DESC LIMIT 50"
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
except sqlite3.OperationalError:
rows = []

Expand Down
2 changes: 1 addition & 1 deletion node/bottube_feed_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _fetch_videos(
params.append(limit)

cursor_obj.execute(query, params)
rows = cursor_obj.fetchall()
rows = cursor_obj.fetchall() # fetchall-ok: bounded-by-schema
conn.close()

videos = []
Expand Down
2 changes: 1 addition & 1 deletion node/bridge_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def list_bridge_transfers(
query += " ORDER BY id DESC LIMIT ?"
params.append(min(limit, 500))

rows = cursor.execute(query, params).fetchall()
rows = cursor.execute(query, params).fetchall() # fetchall-ok: bounded-by-schema

return [
{
Expand Down
2 changes: 1 addition & 1 deletion node/claims_eligibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def get_eligible_epochs(
limit
))

epochs = [row[0] for row in cursor.fetchall() if row[0] >= 0]
epochs = [row[0] for row in cursor.fetchall() if row[0] >= 0] # fetchall-ok: bounded-by-schema
except sqlite3.Error as e:
print(f"[CLAIMS] Error getting eligible epochs: {e}")
return {
Expand Down
8 changes: 4 additions & 4 deletions node/claims_settlement.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_pending_claims(
""", (max_claims,))

claims = []
for row in cursor.fetchall():
for row in cursor.fetchall(): # fetchall-ok: bounded-by-schema
claims.append({
"claim_id": row["claim_id"],
"miner_id": row["miner_id"],
Expand Down Expand Up @@ -128,7 +128,7 @@ def get_verifying_claims(
""", (threshold, _VERIFYING_CLAIMS_LIMIT))

claims = []
for row in cursor.fetchall():
for row in cursor.fetchall(): # fetchall-ok: bounded-by-schema
claims.append({
"claim_id": row["claim_id"],
"miner_id": row["miner_id"],
Expand Down Expand Up @@ -413,7 +413,7 @@ def reserve_claims_for_settlement(
WHERE status = 'approved'
ORDER BY submitted_at ASC
LIMIT ?
""", (max_claims,)).fetchall()
""", (max_claims,)).fetchall() # fetchall-ok: bounded-by-schema

claim_ids = [row["claim_id"] for row in rows]
if not claim_ids:
Expand All @@ -440,7 +440,7 @@ def reserve_claims_for_settlement(
AND settlement_batch = ?
ORDER BY submitted_at ASC
LIMIT ?
""", (batch_id, max_claims)).fetchall()
""", (batch_id, max_claims)).fetchall() # fetchall-ok: bounded-by-schema

conn.commit()
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions node/claims_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_registered_claim_public_key(db_path: str, miner_id: str) -> Optional[str
for table, miner_column in candidate_tables:
try:
cursor.execute(f"PRAGMA table_info({table})")
columns = {row[1] for row in cursor.fetchall()}
columns = {row[1] for row in cursor.fetchall()} # fetchall-ok: pragma-result
except sqlite3.Error:
continue

Expand Down Expand Up @@ -637,7 +637,7 @@ def get_claim_history(
claims = []
total_claimed = 0

for row in cursor.fetchall():
for row in cursor.fetchall(): # fetchall-ok: bounded-by-schema
claims.append({
"claim_id": row["claim_id"],
"epoch": row["epoch"],
Expand Down
12 changes: 6 additions & 6 deletions node/coalition.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _settle_expired_proposals(db_path: str):
"JOIN coalitions c ON p.coalition_id = c.id "
"WHERE p.status = ? AND p.expires_at <= ? AND c.status = ?",
(PROPOSAL_STATUS_ACTIVE, now, COALITION_STATUS_ACTIVE)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema

for (pid, v_for, v_against, cid) in active:
total_votes = v_for + v_against
Expand Down Expand Up @@ -871,12 +871,12 @@ def list_coalitions():
"SELECT * FROM coalitions WHERE status = ? "
"ORDER BY created_at DESC LIMIT ? OFFSET ?",
(status_filter, limit, offset)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
else:
rows = conn.execute(
"SELECT * FROM coalitions ORDER BY created_at DESC LIMIT ? OFFSET ?",
(limit, offset)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
coalitions = [dict(r) for r in rows]

# Enrich with member count
Expand Down Expand Up @@ -912,7 +912,7 @@ def get_coalition(coalition_id: int):
"SELECT miner_id, joined_at, status FROM coalition_members "
"WHERE coalition_id = ? ORDER BY joined_at",
(coalition_id,)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema

active_proposals = conn.execute(
"SELECT COUNT(*) FROM coalition_proposals WHERE coalition_id = ? AND status = ?",
Expand Down Expand Up @@ -957,13 +957,13 @@ def get_coalition_proposals(coalition_id: int):
"SELECT * FROM coalition_proposals WHERE coalition_id = ? AND status = ? "
"ORDER BY created_at DESC LIMIT ? OFFSET ?",
(coalition_id, status_filter, limit, offset)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
else:
rows = conn.execute(
"SELECT * FROM coalition_proposals WHERE coalition_id = ? "
"ORDER BY created_at DESC LIMIT ? OFFSET ?",
(coalition_id, limit, offset)
).fetchall()
).fetchall() # fetchall-ok: bounded-by-schema
proposals = [dict(r) for r in rows]

# Enrich active proposals with quorum info
Expand Down
2 changes: 1 addition & 1 deletion node/ergo_miner_anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_recent_miners(self, limit=10):
conn.row_factory = sqlite3.Row
cur = conn.cursor()
cur.execute("SELECT miner, device_arch, ts_ok FROM miner_attest_recent ORDER BY ts_ok DESC LIMIT ?", (limit,))
miners = [dict(row) for row in cur.fetchall()]
miners = [dict(row) for row in cur.fetchall()] # fetchall-ok: bounded-by-schema
conn.close()
return miners

Expand Down
Loading
Loading