perf(audit_registry): optimize anchor payload storage and gas#3
Open
devnWisdom wants to merge 339 commits into
Open
perf(audit_registry): optimize anchor payload storage and gas#3devnWisdom wants to merge 339 commits into
devnWisdom wants to merge 339 commits into
Conversation
…t, and governance contract tests
…elJoe#282\n\nCloses AnnabelJoe#310\nCloses AnnabelJoe#292\nCloses AnnabelJoe#305\nCloses AnnabelJoe#282
AnnabelJoe#282\n\nCloses AnnabelJoe#310\nCloses AnnabelJoe#292\nCloses AnnabelJoe#305\nCloses AnnabelJoe#282
…-smoke-governance-tests Add contract docs, backup recovery guide, smoke test, and governance tests
- Hardware requirements (Ed25519 key storage, HSM/TPM recommendations) - API integration steps (key gen, hash, sign, submit) - Reference scripts documented - Certification checklist for new meter models - Contact information for integration support Closes AnnabelJoe#320
…belJoe#306) - npm: weekly on Monday, patch/minor grouped, major flagged for review - Cargo: weekly on Monday, patch/minor grouped, major flagged for review - GitHub Actions: monthly, major flagged for review - Auto-merge for patch-level updates already wired via dependabot-auto-merge.yml Closes AnnabelJoe#306
- web: 1 GB memory / 1.0 CPU (256 MB / 0.25 CPU reserved) - supabase-db: 512 MB memory / 0.5 CPU (128 MB / 0.1 CPU reserved) - redis: 128 MB memory / 0.25 CPU (32 MB / 0.05 CPU reserved) - README updated with minimum host requirements table Closes AnnabelJoe#304
- docs/runbooks/contract-deployment.md: testnet/mainnet deploy, verify, rollback - docs/runbooks/meter-key-rotation.md: scheduled and emergency key rotation - docs/runbooks/failed-mint-investigation.md: diagnose and retry failed mints - docs/runbooks/incident-response.md: triage, containment, resolution, postmortem - docs/runbooks/README.md: index of all runbooks Closes AnnabelJoe#315
- Enable test task caching in turbo.json (was cache: false) - Add TURBO_TOKEN/TURBO_TEAM env vars to all CI steps (test, contracts fmt/clippy/test) - Remote cache signature verification already enabled
…ons (AnnabelJoe#330) - energy_token: mint, transfer, burn, retire event tests - audit_registry: anchor event test (topics + data fields verified) - community_governance: propose, vote, finalize, execute event tests - Each test verifies event topic and data payload fields
…nnabelJoe#285) - Document mainnet deployment steps (build, deploy script, initialize, verify) - Add key management guidance (admin HSM, deployer rotation, minter rotation) - Add environment separation table (testnet vs mainnet vars) - Add deployment checklist with sign-off table - deploy-mainnet.sh already exists and is idempotent; referenced in docs
…le (AnnabelJoe#318) - Add legend explaining [REQUIRED] vs [OPTIONAL] markers - Split NEXT_PUBLIC_ENERGY_TOKEN_ID/AUDIT_REGISTRY_ID/COMMUNITY_GOVERNANCE_ID into separate entries with individual descriptions - Add [OPTIONAL] marker and description to LOGTAIL_SOURCE_TOKEN - Add [OPTIONAL] marker and fallback behaviour note to CORS_ALLOWED_ORIGINS - Group variables by service: Supabase, Stellar/Soroban, Redis, Logging, CORS
…ation feat: log aggregation and retention
## [1.9.0](AnnabelJoe/solarproof@v1.8.2...v1.9.0) (2026-05-29) ### Features * configure log aggregation and retention ([AnnabelJoe#299](AnnabelJoe#299)) ([3ee0154](AnnabelJoe@3ee0154))
- Implement bucketed storage to reduce ledger entries - Move idempotency nonces to temporary storage - Remove redundant reading_hash from storage values - Update and expand test suite Closes AnnabelJoe#281
- Added guidance for quorum, thresholds, and durations - Included configurations for small, medium, and large DAOs - Linked guide from community_governance contract docs Closes AnnabelJoe#279
- Implement bucketed storage to reduce ledger entries - Move idempotency nonces to temporary storage - Remove redundant reading_hash from storage values - Update and expand test suite - Include regression test test_issue_281_bucket_collision Closes AnnabelJoe#281
…tion Add pagination and filtering to certificates
## [1.10.0](AnnabelJoe/solarproof@v1.9.0...v1.10.0) (2026-05-30) ### Features * add pagination and filtering to certificates [AnnabelJoe#258](AnnabelJoe#258) ([4d2bde0](AnnabelJoe@4d2bde0))
…boundaries Implement error boundary components
…nt-user-context Add persistent user context for cooperative pages (AnnabelJoe#543)
…ce-tests Add governance tally and edge-case tests (AnnabelJoe#551)
…admin-mobile Improve admin page mobile layout and action affordances (AnnabelJoe#541)
…k-backlog Add user story backlog for public verification kiosk mode (AnnabelJoe#611)
…ery-hooks Consolidate React Query logic into shared hooks
…th-role Audit require_auth and admin role assignment
…erator readings and certificates access
…supabase-rls-tests issue AnnabelJoe#546: strengthen Supabase RLS tests for readings and certificate access
…ods to audit_registry and docs
…tl-management issue AnnabelJoe#549: add on-chain Soroban storage TTL extension methods
…lJoe#552) The persistent entry value for each anchor previously stored a full AuditAnchor struct { reading_hash: BytesN<32>, anchored_at_ledger: u32 } (36 bytes). Because reading_hash is already encoded in the storage key (DataKey::Anchor(hash)), it was pure duplication. Change: store only the u32 ledger sequence as the entry value. verify() reconstructs the AuditAnchor on read at no extra I/O cost. Result: 36 B → 4 B per persistent entry value — 88% reduction. This directly lowers the Soroban write_bytes fee for every anchor() call. All existing tests remain green; no public API changes. Closes AnnabelJoe#552
🔍 Vercel Preview DeploymentURL: Learn More: https://err.sh/vercel/missing-token-value
|
…oe#559) Adds overflow_tests module with 16 tests covering every i128 arithmetic path in energy_token: Overflow paths: - mint() overflows recipient balance (balance + amount > i128::MAX) - mint() overflows total_minted counter - transfer() overflows recipient balance - transfer_from() overflows recipient balance Underflow / insufficient-funds paths: - burn() amount > balance - burn() on zero balance - burn_from() amount > balance - burn_from() amount > allowance - transfer() amount > sender balance Positive-only / non-negative guards: - mint(0), mint(-1) rejected - burn(0) rejected - transfer(0) rejected - approve(-1) rejected Closes AnnabelJoe#559
…-tests-559 test(energy_token): add overflow/underflow test coverage for token arithmetic
❌ pnpm audit |
| * violations are found. Baseline violations (if any) are documented below. | ||
| */ | ||
|
|
||
| import { test, expect } from '@playwright/test' |
| * Tests for useWallet hook using the mock Freighter wallet. | ||
| * Runs headlessly in CI — no browser extension required. | ||
| */ | ||
| import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest' |
| accountType = 'cooperative', | ||
| meterCount = 0, | ||
| }: { existing?: unknown; accountType?: string; meterCount?: number } = {}) { | ||
| const maybeSingle = vi.fn().mockResolvedValue({ data: existing }) |
| @@ -98,23 +103,31 @@ | |||
| const searchParams = useSearchParams() | |||
| const [query, setQuery] = useState(searchParams.get('id') ?? '') | |||
| const [result, setResult] = useState<ChainOfCustody | null>(null) | |||
| const [error, setError] = useState<string | null>(null) | |||
| const [pageError, setPageError] = useState<Error | null>(null) | |||
| </div> | ||
| ) | ||
|
|
||
| function ThrowError({ error }: { error: Error }) { |
| const inMock = vi.fn().mockReturnValue({ error: null }) | ||
| deleteMock.mockReturnValue({ in: inMock }) | ||
|
|
||
| function makeInsertMock(row: Record<string, unknown>) { |
Comment on lines
+2
to
+8
| import { | ||
| Contract, | ||
| Keypair, | ||
| Networks, | ||
| TransactionBuilder, | ||
| BASE_FEE, | ||
| } from '@stellar/stellar-sdk' |
✅ cargo audit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces the persistent ledger entry size for each
anchor()call from 36 bytes → 4 bytes (88% reduction) by eliminating a redundant field from the stored value.Problem
anchor()previously stored a fullAuditAnchorstruct as the persistent entry value:The
reading_hashfield is identical to the key (DataKey::Anchor(reading_hash)), so it was pure duplication.Change
Store only the
u32ledger sequence as the entry value (4 bytes).verify()reconstructs the fullAuditAnchorfrom key + stored ledger seq at read time — no extra I/O.Gas impact
At scale (e.g. 10 000 anchors/day) this materially reduces XLM operating costs.
Compatibility
verify()still returnsOption<AuditAnchor>Closes AnnabelJoe#552