Skip to content

Persist account state snapshot and switch account-value reporting to aggregate usage totals#9

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/save-account-values-json
Closed

Persist account state snapshot and switch account-value reporting to aggregate usage totals#9
Copilot wants to merge 4 commits intomainfrom
copilot/save-account-values-json

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 24, 2026

show-account-values.py now supports a true two-pass flow for test runs: first pass persists per-account balance/nonce state, and subsequent pass reports only aggregate activity across accounts. Output is reduced to the required high-signal metrics: account count, total gas-used proxy, and total transactions done.

  • Snapshot-backed two-pass accounting

    • Added JSON snapshot persistence for per-account:
      • balance_wei
      • nonce
    • Introduced --snapshot-file (default: account-values-snapshot.json) to control snapshot location.
    • Existing workflow usage (before/after test) now naturally uses the saved baseline from the first invocation.
  • Aggregate-only reporting

    • Removed per-address balance/nonce table output.
    • Script now prints only:
      • Accounts: <n>
      • Total gas used (wei): <sum(previous_balance - current_balance)>
      • Total transactions done: <sum(current_nonce - previous_nonce)>
  • Delta calculation behavior

    • Deltas are computed only for addresses present in the prior snapshot.
    • First run establishes baseline and writes snapshot; later runs compute cross-run deltas.
  • Focused regression coverage

    • Added a unit test for:
      • first-run snapshot creation + zero deltas
      • second-run aggregate delta computation from stored snapshot
# output shape after change
print(f"Accounts: {len(current_values)}")
print(f"Total gas used (wei): {total_gas_used_wei}")
print(f"Total transactions done: {total_transactions_done}")

# snapshot write for next pass
with open(args.snapshot_file, "w") as f:
    json.dump(current_values, f, indent=2)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 24, 2026 14:42
Co-authored-by: scx1332 <27012161+scx1332@users.noreply.github.com>
Co-authored-by: scx1332 <27012161+scx1332@users.noreply.github.com>
Co-authored-by: scx1332 <27012161+scx1332@users.noreply.github.com>
Copilot AI changed the title [WIP] Save account values and nonces to JSON file Persist account state snapshot and switch account-value reporting to aggregate usage totals Feb 24, 2026
Copilot AI requested a review from scx1332 February 24, 2026 14:45
@scx1332 scx1332 closed this Feb 26, 2026
@scx1332 scx1332 deleted the copilot/save-account-values-json branch February 26, 2026 18:29
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