Skip to content

Add postune analytics tool - #115

Open
drnick23 wants to merge 1 commit into
mainfrom
postune-tool
Open

Add postune analytics tool#115
drnick23 wants to merge 1 commit into
mainfrom
postune-tool

Conversation

@drnick23

Copy link
Copy Markdown
Contributor

Standalone in-browser analytics tool for tuning PoS plot parameters (strength, match bits, scan filter) and evaluating attacker effectiveness across the collected-xs, collected-Lxs, challenge component bit-dropping, proof-fragment bit-dropping, strength match-bits, and pure/reconstruction rental attacks.

Lives entirely under src/tools/postune/ as static HTML + JS, with proof_fragments.md documenting the math behind the bit-dropping calculations.

Standalone in-browser analytics tool for tuning PoS plot parameters
(strength, match bits, scan filter) and evaluating attacker
effectiveness across the collected-xs, collected-Lxs, challenge
component bit-dropping, proof-fragment bit-dropping, strength
match-bits, and pure/reconstruction rental attacks.

Lives entirely under src/tools/postune/ as static HTML + JS, with
proof_fragments.md documenting the math behind the bit-dropping
calculations.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a standalone in-browser “postune” analytics tool under src/tools/postune/ to explore PoS plot parameter tuning and estimate attacker effectiveness across several modeled attacks, with accompanying math notes for proof-fragment bit dropping.

Changes:

  • Added index.html UI to vary plot ID filter bits, scan range bits, and netspace, and display computed attack results.
  • Added postune.js containing the modeling/estimation logic for plotting/validation time and multiple attack variants.
  • Added proof_fragments.md documenting the derivation for expected set/validation checks under proof-fragment bit dropping.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
src/tools/postune/index.html Static UI that wires sliders/inputs to recompute and render attack comparisons.
src/tools/postune/postune.js Core computational model for costs/timings and attacker “effectiveness” estimates.
src/tools/postune/proof_fragments.md Mathematical derivation + table for proof-fragment candidate checking/validation expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +78 to +80
var t1_match_bits = t1_match_bits_base;
var t2_match_bits = 2 + plot_strength_bits - 2;
var t3_match_bits = 2 + plot_strength_bits - 2;
Comment on lines +107 to +117
var attacker_gpu_w_per_tb_on_saved_bytes = equipment_params.gpu_w / (attacker_saved_TB);
var attacker_gpu_cost_per_tb_on_saved_bytes = equipment_params.gpu_cost / (attacker_saved_TB);
var attacker_w_per_tb_ratio_to_honest_w_per_tb = attacker_gpu_w_per_tb_on_saved_bytes / equipment_params.storage_w_per_tb;
var attacker_cost_per_tb_relative_to_honest_cost_per_tb = attacker_gpu_cost_per_tb_on_saved_bytes / equipment_params.storage_cost_per_tb;
var attacker_effectiveness = 1 / (attacker_w_per_tb_ratio_to_honest_w_per_tb * attacker_cost_per_tb_relative_to_honest_cost_per_tb);
if (attacker_bits_per_entry >= honest_bits_per_entry) {
attacker_effectiveness = 0;
}
if (challenge_time_ms > 9375) {
attacker_effectiveness = 0;
}
Comment on lines +671 to +676
const e = Math.E;
var c = 2 - 1/e;
var q = (1 - 1/e)*(1 - 1/e);
const n_pf_candidates = Math.pow(2, bits_dropped);
var expected_2_to_the_14_x_groups_per_pf = ((n_pf_candidates-1)*((n_pf_candidates)*c+4)/(2*(n_pf_candidates)));
var total_expected_2_to_the_14_x_groups = proof_fragments_in_chain * expected_2_to_the_14_x_groups_per_pf;
Comment on lines +1 to +6
# Expected Number of Set Checks to Recover All 60 Valid Proof Fragments

We start with 60 valid proof fragments (each originally 56 bits). We apply a bit drop of N bits where N ∈ {1,…,16}.

## Candidates per proof
Dropping N bits produces M = 2^N candidate fragments per original proof. Exactly one of the M candidates is the true valid fragment; the other M−1 are invalid. There are 60 independent buckets (one per original proof), each with M candidates. We process each bucket independently and stop as soon as the valid candidate is known (if M−1 candidates have been rejected, the last is valid by elimination).
Comment on lines +62 to +65
| N | Candidates per proof ( \(2^N\) ) | Expected sets per proof | Expected sets total (60 proofs) | Expected validations per proof | Expected validations total (60 proofs) |
|---|----------------------------------:|------------------------:|--------------------------------:|-------------------------------:|---------------------------------------:|
| 1 | 2 | 2 | 109 | 1 | 60 |
| 2 | 4 | 4 | 237 | 1 | 81 |
// Compute plotting and validation time for each strength (2..13)
const timesByStrength = [];
for (var strength = 2; strength <= 10; strength++) {
var sp = get_plot_params(plotParams.plot_id_base_filter, strength);
timeMetrics['plot s' + t.strength] = t.plot;
timeMetrics['validate s' + t.strength] = t.validate;
timeMetrics['TB/day s' + t.strength] = t.tbpd;
}
Comment on lines +681 to +691
// Initialize display and attach handlers
updateBaseDisplay();
updateScanDisplay();
bitsInput.addEventListener('input', () => {
updateBaseDisplay();
buildResultsAndTable();
});
// rebuild when scan-range changes
scanInput.addEventListener('input', () => {
updateScanDisplay();
buildResultsAndTable();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants