diff --git a/Dockerfile.py13 b/Dockerfile.py13 new file mode 100644 index 00000000..56afa960 --- /dev/null +++ b/Dockerfile.py13 @@ -0,0 +1,39 @@ +# ---------- builder ---------- +FROM python:3.13-slim-bookworm AS builder +#FROM pypy:3.11-slim-bookworm AS builder +WORKDIR /app + +# OS deps for building Rust/Python extensions (and RocksDB features if needed) +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential pkg-config curl ca-certificates \ + libffi-dev libssl-dev \ + clang cmake \ + zlib1g-dev libbz2-dev liblz4-dev libsnappy-dev libzstd-dev \ + && rm -rf /var/lib/apt/lists/* + +# Speed up pip, prefer wheels where possible +ENV PIP_NO_CACHE_DIR=1 +COPY requirements.txt . +RUN pip install --upgrade pip wheel setuptools && \ + # Try wheels first; fall back to source when necessary (Rust present) + pip wheel -r requirements.txt -w /wheels --prefer-binary + +# ---------- runtime ---------- +#FROM pypy:3.11-slim-bookworm +FROM python:3.13-slim-bookworm +WORKDIR /app + +# Runtime libs only (openssl for some deps; compression libs if rocksdict links dynamically) +RUN apt-get update && apt-get install -y --no-install-recommends \ + libssl3 zlib1g libbz2-1.0 liblz4-1 libsnappy1v5 libzstd1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /wheels /wheels +RUN pip install /wheels/* + +# Your app +COPY ./pyjamaz ./pyjamaz +RUN python -m compileall -b ./pyjamaz && find ./pyjamaz -name "*.py" -delete + +ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=/app +ENTRYPOINT ["python","-m","pyjamaz.cli"] diff --git a/Dockerfile.pypy b/Dockerfile.pypy new file mode 100644 index 00000000..97448a5e --- /dev/null +++ b/Dockerfile.pypy @@ -0,0 +1,41 @@ +# ---------- builder ---------- +FROM pypy:3.11-slim-bookworm AS builder +WORKDIR /app + +# OS deps for building Rust/Python extensions (and RocksDB features if needed) +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential pkg-config curl ca-certificates \ + libffi-dev libssl-dev \ + clang cmake \ + zlib1g-dev libbz2-dev liblz4-dev libsnappy-dev libzstd-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Rust (new enough for maturin/cryptography; minimal profile) +RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal +ENV PATH="/root/.cargo/bin:${PATH}" + +# Speed up pip, prefer wheels where possible +ENV PIP_NO_CACHE_DIR=1 +COPY requirements.txt . +RUN pypy3 -m pip install --upgrade pip wheel setuptools && \ + # Try wheels first; fall back to source when necessary (Rust present) + pypy3 -m pip wheel -r requirements.txt -w /wheels --prefer-binary + +# ---------- runtime ---------- +FROM pypy:3.11-slim-bookworm +WORKDIR /app + +# Runtime libs only (openssl for some deps; compression libs if rocksdict links dynamically) +RUN apt-get update && apt-get install -y --no-install-recommends \ + libssl3 zlib1g libbz2-1.0 liblz4-1 libsnappy1v5 libzstd1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /wheels /wheels +RUN pypy3 -m pip install /wheels/* + +# Your app +COPY ./pyjamaz ./pyjamaz +RUN pypy3 -m compileall -b ./pyjamaz && find ./pyjamaz -name "*.py" -delete + +ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=/app +ENTRYPOINT ["pypy3","-m","pyjamaz.cli"] diff --git a/docs/reports/chapter-14-appendix-h-analysis-2026-11-09.md b/docs/reports/chapter-14-appendix-h-analysis-2026-11-09.md new file mode 100644 index 00000000..452d65fb --- /dev/null +++ b/docs/reports/chapter-14-appendix-h-analysis-2026-11-09.md @@ -0,0 +1,237 @@ +# Chapter 14 and Appendix H: Implementation Analysis + +Date: 2026-11-09 + +Last updated: 2026-11-10 + +Repository: `/Users/arjan/Development/pyjamaz` + +Specification: [Graypaper 0.8.0, June 3, 2026](), Chapter 14 (pages 26–29) and Appendix H (pages 71–73). + +Updated after the local Chapter 14 review fixes. The existing networking prototype is checkpointed, and its protocol review findings remain deferred to the networking work. + +Specification precedence is the [v0.8.0 release](https://github.com/jam-conformance/jam-test-vectors/releases/tag/v0.8.0) at `d3c089c9a1d5352ad353626d7a2db8589f137b2a`, the explicitly selected additional [PR #563](https://github.com/gavofyork/graypaper/pull/563) exception, then GP 0.8.0. Delegated networking follows [JAMNP-S v1 at e0b7d291](https://github.com/zdave-parity/jam-np/blob/e0b7d2910afc0a7406043a4c79828edbcc357c2e/simple.md). + +## Changes on this branch and their motivation + +Branch: `az-segment-recovery-import`. The first branch change below follows `750c1f16`. + +| Commit | Change | Motivation | +|---|---|---| +| `4d6e4725` | Complete Appendix H recovery, proof-page decoding, verified individual-import storage and local refinement imports | Recover using the source report's dimensions and deliver verified segments to real PVM `fetch` selectors 5/6. | +| `0e780285` | Checkpoint pending Chapter 14 submission, authorization, artifact/proof, source-storage, runtime and networking work, together with existing source utilities, documentation and regression fixtures | Preserve the state before the local review fixes. This commit includes pre-existing pending work; it does not imply that every included utility/test was newly implemented for Chapter 14. Generated databases, environments, logs and local artifacts were left untouched. | +| `f19d3118` | Isolate missing/corrupt source records and index successful local reports by export root | Keep healthy sources available and protect shared retained data when metadata is incomplete. Let import eligibility recognize locally computed sources after restart. | +| `fb90f1b2` | Check all import roots before runtime refinement | A valid Merkle proof establishes segment membership, while source provenance must also be known. Recent reports, successful local reports and canonical source records supply that provenance. Unknown roots remain retryable. | +| `5a61dee0` | Correct tagged-import equation comments from C.35 to C.37 | Make the code references match the pinned GP. Encoding behavior is unchanged. | +| `04a9af52` | Bind replayed assurances to the matching report and an existing registration at the assurance slot | Prevent historical replay from attaching an old assurance to a later registration or another report sharing an erasure root. Preserve existing canonical assurance references. | +| `2309d233` | Fall back to the finalized head after restart; bound metadata backfill; normalize corrupt local export caches | Keep retained sources available after startup, avoid full-history rescans per miss/head, repair missing records from retained context, and keep local cache failures retryable. | +| `c64a886f` | Require explicit trusted finality before availability pruning | Existing parent-finalization conventions must not authorize deletion. Confirmations can lag storage finality without rewinding storage; repeated/older confirmations cannot regress trusted availability finality. | + +For review, use `git diff 0e780285..HEAD` for the incremental local fixes and `git diff 750c1f16..HEAD` for the complete branch. `git show ` isolates each change. No networking or CLI files changed after the checkpoint. + +The GP-facing signatures and return values remain unchanged: + +```python +compute_work_report(package, core_index, mappings, erasure_shards) # Xi(p,c,l,v), 14.13 +assemble_bundle(package, mappings) # B(p,l), 14.16 +availability_spec(package_hash, bundle, exports, validator_count) # A(h,b,s,v), 14.18 +``` + +The runtime checks source provenance before `Psi_R`, including for a fully supplied bundle or an individually cached import. A cached segment or complete export set alone does not establish a known source. The 672-epoch retention minimum is not imposed as an additional consensus-validity cutoff on otherwise known, available imports. + +Historical discovery and replay process bounded batches of 64 blocks and yield between background batches. Parent/canonical caches avoid repeating full ancestry walks. Missing historical state remains unavailable; restoring retained context permits targeted repair without inventing the original validator set. + +Storage finalization retains availability data by default. A future trusted-finality integration can explicitly call: + +```python +await app.finalize(header_hash, availability_finality_confirmed=True) +``` + +The confirmation requires valid retained headers on committed active ancestry. An older canonical checkpoint can confirm availability without moving storage finality backwards. Trusted availability-finality knowledge is deliberately conservative after restart: it must be confirmed again before pruning. Until that integration supplies confirmations, audit payloads are retained. The existing 672-epoch minimum, shared-data protection and active-request protection still apply when pruning is authorized. + +Remaining networking review work includes historical/current/builder access rules, CE133 import acquisition, missing-ancestor catch-up, response limits during reading, persistent-link key pinning and checkpoint/genesis configuration. Full guarantee coordination, assurance voting and audit/judgment production also remain outside these local fixes. Existing automatic assurance production is not newly gated by this change. + +## Assessment + +**Appendix H recovery and the local Chapter 14 submission, report, artifact and import path are implemented, including the five local review fixes and conservative retention guard. Networking remains a prototype with deferred review findings. Full guarantee coordination, assurance voting and audit judgments remain Chapters 15–17 work. The selected PR #563 equality and footprint policies are retained.** + +The analysis compared the specification with the relevant code, reran tests and reproduced several boundary cases. + +“Implemented” below means the calculation or behavior exists in executable code. It does not automatically mean the corresponding distributed node workflow is complete. + +## Chapter 14: Equation-by-equation status + +Chapter 14 defines deterministic calculations and data services used by later validator roles. The GP-facing interfaces retain their original arguments and return values; convenience functions compose those calculations. + +| GP reference | Requirement | Current implementation | +|---|---|---| +| **14.1** | Segments contain exactly 4,104 bytes | **Implemented.** Import verification enforces this size; export host calls pad segments to it. | +| **14.2–14.3** | Work-package and work-item structures, including manifests and tagged import references | **Implemented.** Models, codecs and the distinction between segment roots and tagged package hashes exist. Package validation enforces 1–16 items. | +| **14.4** | At most eight dependencies | **Implemented.** Counts unique tagged package references plus context prerequisites, following the equation. | +| **14.5** | Package-wide export, import and extrinsic limits | **Implemented.** Limits are 3,072 exports, 3,072 imports and 128 extrinsics. | +| **14.6–14.8** | Package footprint and import-proof allowance | **Implemented.** Includes authorization/configuration bytes, payloads, imported segments and declared extrinsic lengths. `W_F = 4,488`; the package footprint limit is 13,791,360 bytes. | +| **14.9** | Aggregate refinement and accumulation gas budgets | **Different from the printed equation.** The PDF uses `<`; the implementation permits equality. | +| **14.10** | Convert each work item into its digest | **Implemented.** Copies identifiers, gas allowance, result and manifest counters, and hashes the payload. | +| **14.11** | Authorizer identity and historical authorization-code lookup | **Implemented.** Authorizer hash uses the authorization-code hash and configuration. Code lookup checks historical availability at the lookup-anchor slot. | +| **14.12** | Construct paged proofs for exported segments | **Implemented.** Encoding, decoding, canonical-count checks, padding validation and direct-proof reconstruction exist. | +| **14.13** | Compute `Ξ(p,c,l,v)` | **Implemented.** Authorization precedes bundle validation/acquisition. Runtime and public `Ξ` share the authorized report calculation, with one authorization per unchanged attempt. | +| **14.14** | Package-hash-to-export-root correspondence | **Implemented.** Recent/pending report mappings and canonical source records establish correspondence. Builder mappings are checked against known reports. Local artifacts remain distinct from chain-backed sources. | +| **14.15** | `X`, `L_l`, `S_l` and `J_l` | **Implemented locally.** Known-source checks precede supplied/cached imports; imports are verified before use. Peer requests and recovery exist in the networking prototype, whose review findings remain open. | +| **14.16** | Assemble the auditable bundle `B(p,l)` | **Implemented.** A shared canonical codec covers production RPC, client and fuzzer submission, including import justifications. Truncation, conflicting data, noncanonical encoding and trailing data are rejected. | +| **14.17** | Derive the package availability specification from the computed bundle and exports | **Implemented.** Report construction calls `A` with the package hash, assembled bundle, flattened exports and explicit assurer count. | +| **14.18** | Calculate availability commitments | **Implemented.** `availability_spec` returns only the GP specification; `build_availability_artifacts` shares its calculation and retains encoded rows and proofs for distribution. | +| **14.19** | Zero padding | **Implemented.** Encoding pads to the required alignment; blob recovery verifies discarded padding is zero. | + +The main implementation locations are [package validation, imports and availability calculations](/Users/arjan/Development/pyjamaz/pyjamaz/availability.py:25), [report computation](/Users/arjan/Development/pyjamaz/pyjamaz/refinement.py:25), and [digest construction](/Users/arjan/Development/pyjamaz/pyjamaz/models/common.py:513). + +Some TODO comments in the package models are outdated: the corresponding limits are now enforced by `validate_work_package`. Those comments should not be interpreted as evidence that the limits are absent. + +### Gas-limit compatibility policy + +The gas boundary is a deliberate compatibility policy, rather than an unimplemented check. On page 27, equation 14.9 requires: + +```text +sum(accumulation budgets) < G_A +sum(refinement budgets) < G_R +``` + +The code rejects only values *greater than* the limit, therefore permitting equality. Its comments and documentation explicitly attribute this to PR #563. Acceptance was reproduced with both declared budgets exactly at their limits. See the [validation check](/Users/arjan/Development/pyjamaz/pyjamaz/availability.py:49) and [documented policy](/Users/arjan/Development/pyjamaz/docs/stfs/rho.md:34). + +This is the selected additional exception to the release/GP source policy. No alternative strict-14.9 mode is introduced. + +### Authorization ordering + +Cheap package/core checks precede Is-Authorized, which runs against a detached service-state snapshot. Bundle hashing, import-proof validation and peer recovery follow successful authorization. Staged CE133/146 submissions use a bounded initial QUIC receive window and expand it after authorization. + +The runtime binds that result to the package, requested core, committed head/root and ordered validator keys. It reuses the result through the private authorized-report calculation and restarts when those inputs become stale. Public `Ξ(p,c,l,v)` retains its signature and report-only return value. See [report computation](/Users/arjan/Development/pyjamaz/pyjamaz/refinement.py) and [runtime orchestration](/Users/arjan/Development/pyjamaz/pyjamaz/runtime/pipelines/refine.py). + +### Result and export behavior + +The result and export behavior is implemented carefully. Equation 14.13’s precedence is reflected in the code: + +- Oversized output becomes `digest_oversize`. +- An incorrect export count becomes `bad_exports`. +- Failed items contribute exactly their declared number of zero segments. +- Later items receive export offsets that include those declared positions. +- Successful output sizes accumulate together with the authorization trace. + +This preserves the meaning of subsequent segment indexes even when an earlier item fails. These cases are covered by the migrated export-padding tests. + +### Local imports into the real refine PVM + +Imported segments now reach the real refine PVM. The local path supports: + +- Direct segment-root references and tagged work-package references. +- Direct import proofs or reconstructed proof pages. +- Recovery using the source report’s assurer count. +- Persistent storage of individually verified imports. +- Fallback to complete stored export sets. +- Multiple work items, duplicate imports and manifest ordering. +- `fetch` selector 5 for another item’s imports and selector 6 for the current item’s imports. + +The runtime retries when local data is missing or corrupt. Recovered imports and complete stored exports produce identical bundle and report bytes in integration tests. See [runtime acquisition](/Users/arjan/Development/pyjamaz/pyjamaz/runtime/pipelines/refine.py:125) and [verified import storage](/Users/arjan/Development/pyjamaz/pyjamaz/d3l.py:51). + +### Production bundle RPC ingestion + +The RPC preserves `[core_index, encoded_bundle]` and queues the complete canonical bundle. The client accepts import segments and required justifications; import-free calls remain compatible. The queued core is honored, and execution validates the supplied bundle after authorization. The same codec is used by the fuzzer adapter. See [bundle codec](/Users/arjan/Development/pyjamaz/pyjamaz/bundle.py), [RPC](/Users/arjan/Development/pyjamaz/pyjamaz/rpc/rpc.py) and [client](/Users/arjan/Development/pyjamaz/pyjamaz/rpc/ws_client.py). + +## Appendix H: Mathematical implementation + +Appendix H is implemented through a small Python interface backed by the native erasure library. The absence of separate Python functions for every mathematical definition is not a missing feature: splitting, joining, transposition and field operations are implemented within the encoding/recovery path. + +| GP reference | Definition | Assessment | +|---|---|---| +| **H.1** | Compute `D(v)` | **Implemented.** Selects the largest permitted divisor that allows segments to encode without padding. | +| **H.2** | Split a byte sequence | **Implemented within the native layout and Python slicing operations.** No separate public function is necessary. | +| **H.3** | Join subsequences | **Implemented.** Includes the systematic recovery fast path. | +| **H.4** | Transposition | **Implemented.** Native encoding/recovery operates on the required two-byte columns; availability construction also transposes segment data into validator rows. | +| **H.5** | `Cᵛₖ(d)` chunk encoding | **Implemented as `encode_chunks`.** Validates dimensions and returns `v` chunks of `2k` bytes. | +| **H.6** | `Rᵛₖ(c)` indexed recovery | **Implemented as `recover_chunks`.** Requires exactly `D(v)` indexed chunks, uses ordered concatenation for systematic chunks, otherwise invokes native recovery. | +| **H.7–H.8** | Field polynomial and GF(2¹⁶) construction | **Implemented through the native dependency.** The inspected backend uses `0x1002D`, matching the PDF’s polynomial. | +| **H.9–H.10** | Word representation, Cantor basis and validator-index representation | **Implemented through the native dependency.** All 16 basis values were compared with the PDF and matched. | +| **H.11–H.12** | Interpolation and evaluation of the generator polynomial | **Implemented through the native dependency.** Encoding and recovery are exercised against pinned external vectors. | + +The Python interfaces and equation mappings are in [erasure.py](/Users/arjan/Development/pyjamaz/pyjamaz/erasure.py:8). The native adapter’s per-column encoding and recovery are visible in [the binding implementation](/Users/arjan/Development/py-jam-erasure-bindings/rust/src/lib.rs:100). + +The resulting dimensions also match the parameterized specification: + +| Assurers `v` | Original chunks `D(v)` | Bytes per chunk for one 4,104-byte segment | +|---:|---:|---:| +| 6 | 3 | 1,368 | +| 9 | 4 | 1,026 | +| 1,020 | 228 | 18 | +| 1,023 | 342 | 12 | + +The `1,020` case matters: `D(v)` is constrained by divisibility, so using a simple “one-third plus one” formula everywhere would be incorrect. The current implementation handles this. + +The convenience functions `encode_blob`, `recover_blob` and `recover_segment` correctly sit around the GP-defined transformations. They manage arbitrary blob lengths, select a deterministic threshold from surplus shards, handle empty inputs and check zero padding before trimming. + +### Recovery and authentication + +Erasure recovery does not authenticate data. Authentication occurs when `recover_import` verifies the resulting segment against the committed export root. + +The analysis reproduced a case containing five valid shards and one corrupt systematic shard. The convenience function selected the systematic set, and import verification rejected the result. Selecting the valid parity subset succeeded. H.6 assumes valid input chunks. The peer acquisition layer now follows CE139 with a CE140 retry using individually proven chunks if reconstructed segment/proof verification fails; the mathematical helper remains a deterministic recovery function. + +## Distributed availability implementation + +The availability runtime supplies the data services consumed by Chapters 15–17. + +| Capability | Implementation | Boundary | +|---|---|---| +| **Acquiring imports** | Verified local imports/full exports, CE148 guarantor requests, CE139 ordinary shards, CE140 proven retry | Four requests in flight, five-second timeouts, one peer pass per recovery phase; insufficient data is retryable | +| **Original assuring set** | Source records preserve validator order, core, guarantor identities and registration/assurance block references | Historical metadata is reconstructed in bounded batches only when retained context suffices; unavailable records are isolated and otherwise remain unavailable | +| **Availability artifacts** | Encoded bundle chunks, export/proof-page rows and outer co-paths persist before report readiness | Each successful report attempt encodes one `(package hash,v)` artifact set | +| **Chunk proofs** | Appendix E.2 well-balanced traces, complete-row, audit-chunk and combined segment-chunk verification | Root-first proof order, singleton hashing, exact dimensions and indexes are checked | +| **Chunk distribution** | Accepted guarantees enqueue assigned-shard acquisition through CE137; CE138/147 and CE139/140/148 serve retained data | Readiness is exposed without producing assurance votes | +| **Availability eligibility** | Canonical source lookup follows the selected branch and historical peer identities | Builder-provided mappings do not establish chain-backed metadata; local retention expiry is not a consensus rule | +| **Retention** | Atomic versioned records, audit payloads until confirmed assurance finality, segment rows for at least 672 epochs | Explicit trusted-finality confirmation authorizes pruning; parent-finalization calls retain data. Active requests, incomplete sharing context and shared data remain protected | +| **Transport** | Prototype pinned-v1 framing, identities and selected availability streams | Networking review findings remain deferred; passing loopback tests do not establish complete protocol conformance | +| **Assuring and auditing** | Verified data acquisition/storage/serving and readiness | Full guarantee coordination, assurance voting, audit selection and judgment production remain Chapters 15–17 | + +The implementation is in [availability calculations](/Users/arjan/Development/pyjamaz/pyjamaz/availability.py), [storage](/Users/arjan/Development/pyjamaz/pyjamaz/d3l.py), [runtime data services](/Users/arjan/Development/pyjamaz/pyjamaz/runtime/availability.py) and [transport](/Users/arjan/Development/pyjamaz/pyjamaz/transport/protocol_jamnp_s.py). Retained bundle-chunk hashes and co-paths permit long-lived CE140 proofs after audit payload deletion. + +The PDF also describes preparing distributions for two differently sized validator sets around an epoch change. The calculations can be invoked with different `v` values; automatic dual preparation remains a deferred reward optimization. + +## Verification and confidence + +The final implementation regression run produced: + +- **730 passed, two skipped and 14 expected failures** across recovery, refinement, hostcalls, reports, traces and submission/artifact/storage/lifecycle tests, including unchanged transport regression tests. This extends the earlier 497-pass and 693-pass baselines. +- **Six additional passes with the Graypaper interpreter** for local and peer recovered-import integration through the real PVM. +- **17 transport tests**, included in the 693 passes, cover genuine QUIC exchanges. The six-node integration persists source metadata, corrupts CE139 responses, recovers through CE140 and consumes imports through real PVM `fetch` selectors 5/6, requiring identical bundle/report bytes to complete stored exports. +- Byte-for-byte encoding and systematic/parity/mixed recovery against **12 pinned Tiny and Full erasure vectors**. +- Recovery round trips for **340 validator counts**. +- Proof-page tests around 64-leaf boundaries and at the 3,072-export limit. +- Tests for malformed proofs, noncanonical encoding, nonzero padding, corrupt storage, retries and equivalent reports from recovered versus complete exports. +- Lifecycle tests cover successful/failed commits, historical guarantors and resized assurer sets, missing-source backfill, assurance reconstruction, fork selection, active requests, 672-epoch boundaries and real finalization. +- Local-fix regressions cover finalized-head restart lookup, bounded/yielding history replay, restored historical state, isolated missing records, fabricated roots, retained local provenance, corrupt complete-export retries, matching assurance registrations and delayed trusted finality. The final focused storage/lifecycle check passed 75 tests after the last guard adjustment. + +An additional broader run found seven stale tests in the pre-existing untracked `test/test_fuzzer_refinement_batch.py`: they require an absent `fuzzer traces --results-file` option. That batch-CLI feature is outside this change. Existing reference expectations were not rewritten. + +The [erasure tests](/Users/arjan/Development/pyjamaz/test/test_erasure.py), [import-recovery tests](/Users/arjan/Development/pyjamaz/test/test_import_recovery.py), [peer/PVM tests](/Users/arjan/Development/pyjamaz/test/test_peer_availability.py), [lifecycle tests](/Users/arjan/Development/pyjamaz/test/test_availability_lifecycle.py) and [QUIC tests](/Users/arjan/Development/pyjamaz/test/test_jamnp_transport.py) support these conclusions. + +The 340-count check is round-trip evidence, not 340 independent byte-level reference oracles. Likewise, the availability-root construction test independently assembles the structure but shares the native erasure backend. Additional external golden outputs for complete `B`, `A` and `Ξ` calculations would strengthen the conformance evidence. + +The 14 expected failures are documented conflicts in upstream report vectors: those vectors expect acceptance despite inconsistent export counts. The tests first verify the implementation’s rejection, then mark the original acceptance expectation as a known conflict. They are not 14 new failures caused by recovery. + +## Overview + +| Area | Overall status | +|---|---| +| **Appendix H mathematical transformations** | **Implemented**, with native-backed field arithmetic and substantial test evidence | +| **Chapter 14 package rules and report calculations** | **Implemented**, retaining the selected PR #563 exception and authorization-first ordering | +| **Local recovered imports into refinement** | **Implemented and integration-tested** | +| **Production bundle RPC ingestion** | **Implemented**, including import justifications and requested cores | +| **Distributed shard acquisition, proofs and distribution** | **Proof calculations implemented; networking prototype remains under deferred review** | +| **Historical metadata and local availability lifecycle** | **Implemented locally**, with unavailable context isolated, bounded repair and a conservative trusted-finality guard | +| **Complete honest-assurer and auditor operation** | **Outside this change: Chapters 15–17 coordination, voting and judgments** | + +## Recommendations + +1. Complete the deferred networking review fixes before treating the availability protocol as conformant. Connect a trusted finality source to the conservative pruning guard. +2. Connect the existing data-readiness services to the remaining Chapters 15–17 coordination, assurance and audit workflows. +3. Add independent external golden `B`, `A` and full-report outputs when available. Current root-structure checks share the native erasure backend; the pinned erasure vectors provide an independent oracle for that backend. +4. Keep aioquic pinned to 1.3.0 while its small mutual-TLS/receive-window integration hooks use private interfaces, and rerun the QUIC identity/framing/flow-control suite on upgrades. +5. Evaluate large-package throughput before adding optimizations or simultaneous preparation for differently sized validator sets. Both remain deliberately deferred. + +Existing pre-v1 certificates containing IP SANs must be regenerated; v1 requires the single DNS SAN derived from the Ed25519 key. The CLI certificate initializer now derives that name correctly. Startup also requires the genesis header hash for the v1 ALPN, supplied by persisted genesis data or an explicit transport constructor argument. diff --git a/docs/stfs/psi.md b/docs/stfs/psi.md index 74adfb4e..4017ac38 100644 --- a/docs/stfs/psi.md +++ b/docs/stfs/psi.md @@ -1 +1,9 @@ +Offender evidence is checked against the prior punish-set (GP 0.8.0 equations +10.6--10.7). The culprit and fault lists must each have unique keys (10.9), +but the same validator may appear in both lists in one block. + +The posterior punish-set contains that key once (10.18). The header offenders +marker concatenates culprit keys followed by fault keys, preserving the key's +two occurrences and the order of each list (10.19). + ::: pyjamaz.state.components.Disputes diff --git a/docs/stfs/rho.md b/docs/stfs/rho.md index 5917c672..56debdc1 100644 --- a/docs/stfs/rho.md +++ b/docs/stfs/rho.md @@ -1 +1,106 @@ ::: pyjamaz.state.components.Assurances + +Each guaranteed work report must have +`auth_gas_used <= GAS_INVOKE` (50,000,000). An excess is rejected with +`authorizer_gas_too_high` before the report is installed. The budget applies +independently to each report; exactly the budget is permitted. The encoded +field remains an unsigned 64-bit gas value. +Error code 28 is a PyJAMaz extension to the official reports STF vocabulary; +the fuzzer protocol transmits its name as an error string. + +GP B.1 invokes Is-Authorized with `G_I`, and A.48 ensures consumed gas cannot +exceed the supplied budget. PyJAMaz applies this derived sanity bound during +report admission. Accumulation gas is checked separately under 11.33. + +Refinement-load totals are checked independently for each guaranteed report, +including all digests whose refinement result is an error: + +- Refinement gas used must be at most the profile's `G_R`. +- Imports and exports must each total at most 3,072 (`W_M` and `W_X`). +- Extrinsics must total at most 128 (`T`). +- `4,488 * total_imports + total_extrinsic_size` must be at most 13,791,360 + (`W_I`, named in PR #563). The import footprint `W_F` is computed from + GP-0.8.0-eq:14.7 using the logical segment size, independently of + erasure-shard dimensions. + +Violations return `refine_load_too_high` (PyJAMaz error extension 29). These +are report-admission sanity checks derived from package limits in 14.5-14.9, +the item-to-digest mapping in 14.10, report construction in 14.13, and the +invocation gas bound in B.5/A.48. The footprint is only the report-visible +lower bound of 14.6: payload, configuration and authorization-token lengths +are absent from the report. The refinement-load check does not validate serialized bundle +length or package/digest export-count equality. + +For Chapter 14, the specification order is the changes, fixes and stated +deviations in the [v0.8.0 conformance release](https://github.com/jam-conformance/jam-test-vectors/releases/tag/v0.8.0), +pinned to commit `d3c089c9a1d5352ad353626d7a2db8589f137b2a`; the additional +selected [graypaper PR #563](https://github.com/gavofyork/graypaper/pull/563) +exception for inclusive gas limits and the existing footprint/bundle bounds; +then GP 0.8.0 for the remaining behavior. Networking delegated by the GP follows +[JAMNP-S v1 at e0b7d291](https://github.com/zdave-parity/jam-np/blob/e0b7d2910afc0a7406043a4c79828edbcc357c2e/simple.md). + +PyJAMaz follows [graypaper PR #563](https://github.com/gavofyork/graypaper/pull/563) +for inclusive gas limits. Before authorization or refinement, the report producer +checks that declared budgets across all items total at most `G_R` for refinement +and `G_A` for accumulation. This updates the strict inequalities in +GP-0.8.0-eq:14.9. GP-0.8.0-eq:B.5 / GP-0.8.0-eq:A.48 bound consumption by +those budgets, so reported refinement gas may equal `G_R`. + +Report admission rejects +`package_spec.length > MAXIMUM_SIZE_AUDITABLE_BUNDLE` with +`bundle_length_too_high` (PyJAMaz error extension 30). The conservative +serialized-bundle ceiling is 13,904,950 bytes, inclusive (`W_B` in PR #563), +derived as follows: + +| Component | Maximum bytes | GP reference | +| --- | ---: | --- | +| Input footprint (`W_I`) | 13,791,360 | 14.6-14.8 | +| Authorization service and code hash | 36 | C.31 | +| Context including eight prerequisites | 425 | C.26, 14.4 | +| Token/configuration prefixes and item count | 9 | C.5, C.7, C.31 | +| Sixteen items' fixed fields and blob/vector prefixes | 992 | C.32 | +| 3,072 import references and proof-length prefixes | 107,520 | C.37, 14.15-14.16 | +| 128 extrinsic manifests | 4,608 | C.32 | + +The footprint already allows 4,104 bytes of data and twelve 32-byte proof +hashes per import through `W_F = 4,488`; those bytes are not counted again. +The additional bytes cover metadata omitted from the footprint, including +one prefix per import's proof path. The prefix allowances are conservative +maxima under 14.4-14.8 and C.5. This ceiling includes metadata beyond `W_I`, +as specified by PR #563. It uses package-wide maxima independently of reported +load counters. + +Equation 14.18 records the unpadded serialized bundle length defined by +14.16. Erasure padding, shard sizes, exported segments and their paged proofs +do not increase this field. Applying the input limit as `length <= W_I` is too strict: +a single `W_I`-byte payload with empty token/configuration/manifests satisfies +GP-0.8.0-eq:14.6 yet serializes to `W_I + 268` bytes. A test also covers all +sixteen items, 3,072 imports, 128 extrinsic manifests and eight prerequisites +at the content footprint limit; its encoded bundle length is 13,904,899 bytes. + +These admission checks enforce necessary bounds derived from honest package +and report construction. They do not replace report reproduction and auditing +under 17.16. + +Each report must also satisfy +`package_spec.exports_count == sum(result.refine_load.exports for result in results)`. +Mismatches are rejected with `exports_count_mismatch` (PyJAMaz error extension +31), after the other guarantee checks and before installing any report. The +sum is per report and includes failed results. The refinement-load export cap +in 14.5 applies separately; equality with the digest total is necessary even +when the declared count is within the 3,072-segment limit. + +Equation 14.10 copies each work-item's declared export count into its digest. +Equation 14.13 supplies exactly that many segments, replacing exports on error +with zero segments of the declared count. Equations 14.17-14.18 set the +availability count to the length of their concatenation. The report producer +therefore pads failures to `work_item.export_count`, including underproduction, +overproduction, execution failure and oversized output. This also preserves +later items' segment positions. + +The canonical report vectors contain inconsistent synthetic export metadata: +14 accepted Tiny vectors (21 reports) and 16 Full vectors (23 reports) expect +acceptance despite count mismatches. They remain unchanged. The tests first +assert rejection with `exports_count_mismatch`, then report their original +acceptance expectations as known conflicts (`xfail`). Synthetic boundary tests +use coherent counts and re-sign their modified reports. See `test/fixtures/SOURCE.md`. diff --git a/pyjamaz/app.py b/pyjamaz/app.py index 40119bf6..972e0b2c 100644 --- a/pyjamaz/app.py +++ b/pyjamaz/app.py @@ -669,6 +669,16 @@ async def state_transition(self, block: 'Block', produce=False) -> 'STFOutput': self.state_storage.commit() self.working_state.state_root = self.state_storage.state_root() + availability = getattr(getattr(self, 'runtime', None), 'availability', None) + if availability is not None and not SKIP_VALIDATE_GUARANTEES: + try: + # Chapter 14 routing is published only after the guarantee's block commits. + availability.record_committed(block, validator_pool_output.post_state.validators, + validator_archive_output.post_state.validators, + self.block_context, assurances_after_assurances_output.reported) + except Exception: + # An off-chain storage failure must not turn a committed STF into a rejection. + logging.exception('Availability metadata could not be retained; backfill will retry') signals = tuple(self.app_context.post_commit_signals) self.app_context.post_commit_signals.clear() if self.app_context.pubsub: @@ -1021,14 +1031,56 @@ async def produce_block( return block - async def finalize(self, header_hash: bytes): - if header_hash != self.state_storage.finalized_block_hash: + async def finalize(self, header_hash: bytes, *, availability_finality_confirmed: bool = False): + """Finalize storage; prune availability only after an explicit trusted confirmation. + + The current producer/importer calls finalize on parents as a local convention. + Those calls do not establish the finality required by GP 14.3.1 for deleting + audit data. A future finality integration must supply the confirmation. + """ + already_finalized = False + if availability_finality_confirmed: + if self.state_storage.transaction: + raise ValueError('availability finality requires committed state') + header = self.retrieve_block_header(header_hash) + if header is None or header.hash != header_hash: + raise ValueError('availability finality requires a retained committed header') + # An explicit confirmation must not turn an orphan or pending candidate + # into the canonical availability-retention checkpoint. + cursor = self.state_storage.block_hash or self.state_storage.finalized_block_hash + visited = set() + while cursor is not None and cursor not in visited: + if cursor == self.state_storage.finalized_block_hash: + already_finalized = True + if cursor == header_hash: + break + visited.add(cursor) + header = self.retrieve_block_header(cursor) + if header is not None and header.hash != cursor: + raise ValueError('availability finality requires valid ancestry headers') + cursor = header.parent if header is not None else self.state_storage.parents.get(cursor) + if cursor != header_hash: + raise ValueError('availability finality requires the active branch') + if not already_finalized and not self.state_storage.has_state_at(header_hash): + raise ValueError('availability finality requires a retained committed header') + + # Real confirmation can lag the producer's local finalization convention. + # Its canonical ancestors remain eligible without rewinding storage finality. + if header_hash != self.state_storage.finalized_block_hash and not already_finalized: self.state_storage.finalize(header_hash) await self.store_finalized_head(header_hash) logging.info(f'🔒 Finalized block {format_hash(header_hash)}') else: DEBUG and logging.debug(f'Skipped finalization, {format_hash(header_hash)} already finalized') + if availability_finality_confirmed: + availability = getattr(getattr(self, 'runtime', None), 'availability', None) + if availability is not None and self.d3l_store is not None: + try: + availability.on_finalized(header_hash) + except Exception: + logging.exception('Availability retention update failed') + async def create_state_dump(self) -> StateDump: return StateDump( state_root=self.working_state.state_root, @@ -1083,9 +1135,11 @@ def get_other_guarantors(self): return guarantors # TODO deprecated - def add_work_package(self, work_package: WorkPackage, extrinsics: List[bytes]): + def add_work_package(self, work_package: WorkPackage, extrinsics: List[bytes], *, + core_index: int | None = None, bundle: bytes | None = None): - self.runtime.refine_pipeline.add_work_package(work_package, extrinsics) + self.runtime.refine_pipeline.add_work_package(work_package, extrinsics, + core_index=core_index, bundle=bundle) async def guarantee_work_report(self, work_report: WorkReport, timeslot: int): diff --git a/pyjamaz/availability.py b/pyjamaz/availability.py index a575bb33..b8f6e1b7 100644 --- a/pyjamaz/availability.py +++ b/pyjamaz/availability.py @@ -1,10 +1,12 @@ -"""GP 0.8.0 bundle assembly and availability commitments (section 14).""" +"""GP 0.8.0 import recovery, bundle assembly and availability commitments (section 14).""" from dataclasses import dataclass, field -from jamcodec.types import H256, Vec +from jamcodec.base import JamBytes +from jamcodec.exceptions import RemainingScaleBytesNotEmptyException, ScaleDecodeException +from jamcodec.types import H256, VarInt64, Vec -from pyjamaz.erasure import encode_chunks, erasure_data_shards +from pyjamaz.erasure import encode_chunks, erasure_data_shards, recover_segment from pyjamaz.exceptions import ProcessWorkpackageError from pyjamaz.graypaper_constants import ( EC_SEGMENT_SIZE, GAS_ACCUMULATION, GAS_REFINE, MAXIMUM_DEPENDENCIES_WORK_REPORT, @@ -12,7 +14,7 @@ MAXIMUM_NUMBER_IMPORTS_WORK_PACKAGE, MAXIMUM_SIZE_WORK_PACKAGE, MAXIMUM_WORK_ITEMS, ) from pyjamaz.hashing import blake2b_256_hash -from pyjamaz.merkle import ConstantDepthMerkleTree, WellBalancedMerkleTree +from pyjamaz.merkle import BinaryMerkleTree, ConstantDepthMerkleTree, WellBalancedMerkleTree from pyjamaz.models.common import ImportSegment, WorkItem, WorkPackage, WorkPackageSpec @@ -53,13 +55,13 @@ def validate_work_package(package: WorkPackage) -> None: @dataclass(frozen=True) class WorkPackageHash: - """The tagged H+ import-reference variant from GP 14.3 and C.35.""" + """The tagged H+ import-reference variant from GP 14.3 and C.37.""" value: bytes def import_reference(entry: ImportSegment) -> bytes | WorkPackageHash: - # GP-0.8.0-eq:C.35: the upper index bit distinguishes H+ from a segment root. + # GP-0.8.0-eq:C.37: the upper index bit distinguishes H+ from a segment root. return WorkPackageHash(entry.tree_root) if entry.is_work_package_hash else entry.tree_root @@ -79,6 +81,19 @@ class ImportedSegment: justification: tuple[bytes, ...] +def verify_import(root: bytes, index: int, imported: ImportedSegment) -> None: + """Check one S_l / J_l pair from GP-0.8.0-eq:14.15 against L_l(r).""" + if (not isinstance(root, bytes) or len(root) != 32 + or isinstance(index, bool) or not isinstance(index, int) + or not 0 <= index < MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE): + raise ProcessWorkpackageError("invalid import root or segment index") + if (not isinstance(imported.segment, bytes) or len(imported.segment) != EC_SEGMENT_SIZE + or len(imported.justification) > (MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE - 1).bit_length() + or any(not isinstance(h, bytes) or len(h) != 32 for h in imported.justification) + or not ConstantDepthMerkleTree.verify(imported.segment, index, imported.justification, root)): + raise ProcessWorkpackageError("invalid import segment justification") + + @dataclass class BundleData: """The data lookups assumed by X, S_l and J_l; no storage or network access.""" @@ -125,15 +140,7 @@ def _verified_imports(self, mappings: dict[bytes, bytes], item: WorkItem) -> lis imported = self.imports.get((entry.tree_root, entry.index)) if imported is None: raise ProcessWorkpackageError("import segment is unavailable") - proof = imported.justification - if (len(imported.segment) != EC_SEGMENT_SIZE - or entry.segment_index >= MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE - or len(proof) > (MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE - 1).bit_length() - or not ConstantDepthMerkleTree.verify( - imported.segment, entry.segment_index, proof, - resolve_import_root(mappings, import_reference(entry)), - )): - raise ProcessWorkpackageError("invalid import segment justification") + verify_import(resolve_import_root(mappings, import_reference(entry)), entry.segment_index, imported) imports.append(imported) return imports @@ -147,17 +154,12 @@ def import_justifications(self, mappings: dict[bytes, bytes], item: WorkItem) -> def assemble_bundle(self, package: WorkPackage, mappings: dict[bytes, bytes]) -> bytes: # GP-0.8.0-eq:14.16: B(p,l) = E(p, X#(p_w), S_l#(p_w), J_l#(p_w)). - output = bytearray(package.to_jam_bytes().to_bytes()) - for item in package.items: - for blob in self.extrinsic_data(item): - output.extend(blob) - for item in package.items: - for segment in self.import_segments(mappings, item): - output.extend(segment) - for item in package.items: - for proof in self.import_justifications(mappings, item): - output.extend(Vec(H256).encode(list(proof)).to_bytes()) - return bytes(output) + from pyjamaz.bundle import encode_bundle + + extrinsics = [blob for item in package.items for blob in self.extrinsic_data(item)] + imports = [entry for item in package.items for entry in self._verified_imports(mappings, item)] + return encode_bundle(package, extrinsics, [entry.segment for entry in imports], + [list(entry.justification) for entry in imports]) def zero_pad(alignment: int, data: bytes) -> bytes: @@ -180,9 +182,124 @@ def paged_proof_segments(exports: list[bytes]) -> list[bytes]: return pages -def availability_spec(package_hash: bytes, bundle: bytes, exports: list[bytes], - validator_count: int) -> WorkPackageSpec: - # GP-0.8.0-eq:14.18: A(h,b,s,v) -> (h, |b|, u, v, M(s), |s|). +def decode_paged_proof(proof_segment: bytes, export_count: int, + page_index: int) -> tuple[tuple[bytes, ...], tuple[bytes, ...]]: + """Decode P(s)[page_index] into J_6(s,page_index) and L_6(s,page_index).""" + # GP-0.8.0-eq:14.12: P(s) contains two variable-length hash sequences, padded to WG. + if (isinstance(export_count, bool) or not isinstance(export_count, int) + or not 1 <= export_count <= MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE + or isinstance(page_index, bool) or not isinstance(page_index, int) + or not 0 <= page_index < (export_count + 63) // 64): + raise ProcessWorkpackageError("invalid proof page index or export count") + if not isinstance(proof_segment, bytes) or len(proof_segment) != EC_SEGMENT_SIZE: + raise ProcessWorkpackageError("invalid proof page size") + path_count = max(0, (export_count - 1).bit_length() - 6) + leaf_count = min(64, export_count - page_index * 64) + stream = JamBytes(proof_segment) + sequences = [] + try: + for expected_count in (path_count, leaf_count): + start = stream.offset + count = VarInt64.decode(stream) + if (count != expected_count + or bytes(stream.data[start:stream.offset]) != VarInt64.encode(count).to_bytes()): + raise ProcessWorkpackageError("invalid or noncanonical proof page count") + sequences.append(tuple(bytes(stream.get_next_bytes(32)) for _ in range(count))) + except (RemainingScaleBytesNotEmptyException, ScaleDecodeException) as exc: + raise ProcessWorkpackageError("malformed proof page") from exc + if any(stream.get_remaining_bytes()): + raise ProcessWorkpackageError("proof page has nonzero padding") + return sequences[0], sequences[1] + + +def import_justification(segment: bytes, segment_index: int, proof_segment: bytes, + export_count: int, exports_root: bytes) -> tuple[bytes, ...]: + """Derive J_0(s,segment_index) from one recovered P(s) page.""" + # GP-0.8.0-eq:14.12, E.5-E.7: append the page-local co-path to J_6, root first. + if (isinstance(segment_index, bool) or not isinstance(segment_index, int) + or segment_index < 0): + raise ProcessWorkpackageError("import segment index out of range") + path, leaves = decode_paged_proof(proof_segment, export_count, segment_index // 64) + if segment_index >= export_count: + raise ProcessWorkpackageError("import segment index out of range") + if not isinstance(segment, bytes) or len(segment) != EC_SEGMENT_SIZE: + raise ProcessWorkpackageError("invalid import segment size") + local_index = segment_index % 64 + if leaves[local_index] != blake2b_256_hash(b'leaf' + segment): + raise ProcessWorkpackageError("import segment does not match its proof page") + width = min(64, 1 << (export_count - 1).bit_length()) + nodes = list(leaves) + [bytes(32)] * (width - len(leaves)) + tree = BinaryMerkleTree(nodes) + proof = list(path) + while len(nodes) > 1: + split = len(nodes) // 2 + if local_index < split: + proof.append(tree.node(nodes[split:])) + nodes = nodes[:split] + else: + proof.append(tree.node(nodes[:split])) + nodes = nodes[split:] + local_index -= split + imported = ImportedSegment(segment, tuple(proof)) + verify_import(exports_root, segment_index, imported) + return imported.justification + + +def recover_import(spec: WorkPackageSpec, segment_index: int, shards: dict[int, bytes], *, + justification: tuple[bytes, ...] | None = None, + proof_page_shards: dict[int, bytes] | None = None) -> ImportedSegment: + """Recover and verify one import using a source report's availability specification. + + This composes H.6 and 14.12 to supply the segment/proof pair required by 14.15; + it is a local convenience function, not an additional GP-defined function. + """ + if (isinstance(spec.exports_count, bool) or not isinstance(spec.exports_count, int) + or not 1 <= spec.exports_count <= MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE + or isinstance(segment_index, bool) or not isinstance(segment_index, int) + or not 0 <= segment_index < spec.exports_count): + raise ProcessWorkpackageError("import segment index or export count out of range") + if (justification is None) == (proof_page_shards is None): + raise ProcessWorkpackageError("supply either an import justification or proof page shards") + try: + # GP-0.8.0-eq:H.6: k = WG / (2 D(v)); v is the source report's shard count. + segment = recover_segment(spec.erasure_shards, shards) + if proof_page_shards is not None: + page = recover_segment(spec.erasure_shards, proof_page_shards) + proof = import_justification(segment, segment_index, page, spec.exports_count, spec.exports_root) + else: + proof = tuple(justification) + if len(proof) != (spec.exports_count - 1).bit_length(): + raise ProcessWorkpackageError("invalid import justification depth") + except ValueError as exc: + raise ProcessWorkpackageError(str(exc)) from exc + # GP-0.8.0-eq:14.15: S_l and J_l may contain only data justified against L_l(r). + imported = ImportedSegment(segment, proof) + verify_import(spec.exports_root, segment_index, imported) + return imported + + +@dataclass(frozen=True) +class ValidatorShard: + """One validator row of 14.18 and its E.2 co-path (JAMNP-S CE 137).""" + + shard_index: int + bundle_shard: bytes + segment_shards: tuple[bytes, ...] + justification: tuple[bytes, ...] + + +@dataclass(frozen=True) +class AvailabilityArtifacts: + """The retained data behind A(h,b,s,v), rather than a new GP transform.""" + + spec: WorkPackageSpec + shards: tuple[ValidatorShard, ...] + + +def build_availability_artifacts(package_hash: bytes, bundle: bytes, exports: list[bytes], + validator_count: int) -> AvailabilityArtifacts: + """Build A(h,b,s,v) and retain its encoded chunks and distribution proofs.""" + # GP-0.8.0-eq:14.18: package_hash=h, bundle=b, exports=s, validator_count=v. if not isinstance(package_hash, bytes) or len(package_hash) != 32: raise ValueError("work-package hash must be 32 bytes") if len(exports) > MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE or any(len(s) != EC_SEGMENT_SIZE for s in exports): @@ -201,12 +318,131 @@ def availability_spec(package_hash: bytes, bundle: bytes, exports: list[bytes], for i in range(originals) for segment in segments ) rows = encode_chunks(validator_count, len(transposed) // alignment, transposed) + segment_rows = [] leaves = [] for bundle_shard, row in zip(bundle_shards, rows): - chunks = [row[i:i + segment_shard_size] for i in range(0, len(row), segment_shard_size)] - leaves.append(blake2b_256_hash(bundle_shard) + WellBalancedMerkleTree(chunks).root()) - return WorkPackageSpec( - hash=package_hash, length=len(bundle), erasure_root=WellBalancedMerkleTree(leaves).root(), + chunks = tuple(row[i:i + segment_shard_size] for i in range(0, len(row), segment_shard_size)) + segment_rows.append(chunks) + leaves.append(blake2b_256_hash(bundle_shard) + WellBalancedMerkleTree(list(chunks)).root()) + tree = WellBalancedMerkleTree(leaves) + spec = WorkPackageSpec( + hash=package_hash, length=len(bundle), erasure_root=tree.root(), erasure_shards=validator_count, exports_root=ConstantDepthMerkleTree(exports).root(), exports_count=len(exports), ) + shards = tuple(ValidatorShard(index, bundle_shards[index], segment_rows[index], tuple(tree.trace(index))) + for index in range(validator_count)) + return AvailabilityArtifacts(spec, shards) + + +def availability_spec(package_hash: bytes, bundle: bytes, exports: list[bytes], + validator_count: int) -> WorkPackageSpec: + # GP-0.8.0-eq:14.18: A(h,b,s,v) -> (h, |b|, u, v, M(s), |s|). + # package_hash=h, bundle=b, exports=s, validator_count=v. + return build_availability_artifacts(package_hash, bundle, exports, validator_count).spec + + +def _shard_dimensions(spec: WorkPackageSpec) -> tuple[int, int, int]: + """Return the bundle chunk size, segment chunk size and combined segment count.""" + from pyjamaz.graypaper_constants import MAXIMUM_SIZE_AUDITABLE_BUNDLE + + try: + originals = erasure_data_shards(spec.erasure_shards) + except ValueError as exc: + raise ProcessWorkpackageError(str(exc)) from exc + if (isinstance(spec.length, bool) or not isinstance(spec.length, int) + or not 0 <= spec.length <= MAXIMUM_SIZE_AUDITABLE_BUNDLE + or isinstance(spec.exports_count, bool) or not isinstance(spec.exports_count, int) + or not 0 <= spec.exports_count <= MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE + or not isinstance(spec.erasure_root, bytes) or len(spec.erasure_root) != 32): + raise ProcessWorkpackageError("invalid availability specification") + # GP-0.8.0-eq:14.18: z=2D(v), bundle chunks have 2 ceil(|b|/z) bytes. + bundle_size = 2 * ((spec.length + 2 * originals - 1) // (2 * originals)) + segment_count = spec.exports_count + (spec.exports_count + 63) // 64 + return bundle_size, EC_SEGMENT_SIZE // originals, segment_count + + +def _trace_sizes(index: int, count: int, leaf_size: int) -> tuple[int, ...]: + """E.2 siblings are raw leaves for singleton subtrees, otherwise hashes.""" + if isinstance(index, bool) or not isinstance(index, int) or not 0 <= index < count: + raise ProcessWorkpackageError("shard index out of range") + sizes = [] + while count > 1: + split = (count + 1) // 2 + if index < split: + other_count = count - split + count = split + else: + other_count = split + count -= split + index -= split + sizes.append(leaf_size if other_count == 1 else 32) + return tuple(sizes) + + +def _check_proof_sizes(proof, sizes: tuple[int, ...]) -> None: + if (not isinstance(proof, (list, tuple)) or len(proof) != len(sizes) + or any(not isinstance(value, bytes) or len(value) != size + for value, size in zip(proof, sizes))): + raise ProcessWorkpackageError("invalid shard justification dimensions") + + +def verify_validator_shard(shard: ValidatorShard, spec: WorkPackageSpec) -> None: + """Verify one full validator row against A(h,b,s,v)'s erasure root.""" + # GP-0.8.0-eq:14.18, E.2-E.3; JAMNP-S e0b7d291 CE 137. + bundle_size, segment_size, segment_count = _shard_dimensions(spec) + sizes = _trace_sizes(shard.shard_index, spec.erasure_shards, 64) + if (not isinstance(shard.bundle_shard, bytes) or len(shard.bundle_shard) != bundle_size + or len(shard.segment_shards) != segment_count + or any(not isinstance(value, bytes) or len(value) != segment_size for value in shard.segment_shards)): + raise ProcessWorkpackageError("invalid validator shard dimensions") + _check_proof_sizes(shard.justification, sizes) + leaf = blake2b_256_hash(shard.bundle_shard) + WellBalancedMerkleTree(list(shard.segment_shards)).root() + if not WellBalancedMerkleTree.verify(leaf, shard.shard_index, spec.erasure_shards, + shard.justification, spec.erasure_root): + raise ProcessWorkpackageError("validator shard does not match the erasure root") + + +def audit_shard_justification(shard: ValidatorShard) -> tuple[bytes, ...]: + """JAMNP-S e0b7d291 CE 138: append the segment-row root to CE 137's co-path.""" + return shard.justification + (WellBalancedMerkleTree(list(shard.segment_shards)).root(),) + + +def verify_audit_shard(bundle_shard: bytes, shard_index: int, proof: tuple[bytes, ...], + spec: WorkPackageSpec) -> None: + """Verify a bundle chunk using the CE 138 co-path to the 14.18 erasure root.""" + bundle_size, _, _ = _shard_dimensions(spec) + sizes = _trace_sizes(shard_index, spec.erasure_shards, 64) + (32,) + _check_proof_sizes(proof, sizes) + if not isinstance(bundle_shard, bytes) or len(bundle_shard) != bundle_size: + raise ProcessWorkpackageError("invalid audit shard size") + leaf = blake2b_256_hash(bundle_shard) + proof[-1] + if not WellBalancedMerkleTree.verify(leaf, shard_index, spec.erasure_shards, + proof[:-1], spec.erasure_root): + raise ProcessWorkpackageError("audit shard does not match the erasure root") + + +def segment_shard_justification(shard: ValidatorShard, segment_index: int) -> tuple[bytes, ...]: + """JAMNP-S e0b7d291 CE 140: outer co-path, bundle hash, then segment co-path.""" + path = WellBalancedMerkleTree(list(shard.segment_shards)).trace(segment_index) + return shard.justification + (blake2b_256_hash(shard.bundle_shard),) + tuple(path) + + +def verify_segment_shard(segment_shard: bytes, segment_index: int, shard_index: int, + proof: tuple[bytes, ...], spec: WorkPackageSpec) -> None: + """Verify an export/proof-page chunk against the GP-0.8.0-eq:14.18 erasure root.""" + # JAMNP-S e0b7d291 CE 140: j ++ [H(bundle shard)] ++ T(segment row, segment_index). + _, segment_size, segment_count = _shard_dimensions(spec) + outer_sizes = _trace_sizes(shard_index, spec.erasure_shards, 64) + inner_sizes = _trace_sizes(segment_index, segment_count, segment_size) + _check_proof_sizes(proof, outer_sizes + (32,) + inner_sizes) + if not isinstance(segment_shard, bytes) or len(segment_shard) != segment_size: + raise ProcessWorkpackageError("invalid segment shard size") + outer_depth = len(outer_sizes) + segment_root = WellBalancedMerkleTree([]).root_from_trace( + segment_shard, segment_index, segment_count, proof[outer_depth + 1:], single_item_hashed=True, + ) + leaf = proof[outer_depth] + segment_root + if not WellBalancedMerkleTree.verify(leaf, shard_index, spec.erasure_shards, + proof[:outer_depth], spec.erasure_root): + raise ProcessWorkpackageError("segment shard does not match the erasure root") diff --git a/pyjamaz/bundle.py b/pyjamaz/bundle.py new file mode 100644 index 00000000..b5cf538d --- /dev/null +++ b/pyjamaz/bundle.py @@ -0,0 +1,85 @@ +"""Canonical GP-0.8.0-eq:14.16 bundle encoding for transport adapters. + +These helpers check the representation. Hashes, authorization and Merkle proofs +are checked by the report computation after authorization, not by this codec. +""" + +from dataclasses import dataclass + +from jamcodec.base import JamBytes +from jamcodec.exceptions import RemainingScaleBytesNotEmptyException +from jamcodec.types import H256, VarInt64, Vec + +from pyjamaz.graypaper_constants import ( + EC_SEGMENT_SIZE, MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE, MAXIMUM_SIZE_AUDITABLE_BUNDLE, +) +from pyjamaz.models.common import WorkPackage + + +@dataclass +class BundleParts: + package: WorkPackage + extrinsics: list[bytes] + segments: list[bytes] + justifications: list[list[bytes]] + + +def decode_package(encoded: bytes) -> tuple[WorkPackage, int]: + """Read the package prefix so a receiver can authorize before reading payloads.""" + if not isinstance(encoded, bytes) or len(encoded) > MAXIMUM_SIZE_AUDITABLE_BUNDLE: + raise ValueError("invalid bundle size") + stream = JamBytes(encoded) + try: + package = WorkPackage.from_jam_bytes(stream) + except (ValueError, RemainingScaleBytesNotEmptyException) as exc: + raise ValueError("malformed bundle package") from exc + if package.to_jam_bytes().to_bytes() != encoded[:stream.offset]: + raise ValueError("noncanonical bundle package") + return package, stream.offset + + +def encode_bundle(package: WorkPackage, extrinsics: list[bytes], segments: list[bytes], + justifications: list[list[bytes]]) -> bytes: + # GP-0.8.0-eq:14.16: E(p, X#(p_w), S_l#(p_w), J_l#(p_w)). + # The manifests imply every length except the individual proof-path lengths. + manifests = [entry for item in package.items for entry in item.extrinsic] + import_count = sum(len(item.import_segments) for item in package.items) + if len(extrinsics) != len(manifests): + raise ValueError("extrinsic count does not match manifest") + if len(segments) != import_count or len(justifications) != import_count: + raise ValueError("import or justification count does not match manifest") + if any(not isinstance(blob, bytes) or len(blob) != entry.len + for entry, blob in zip(manifests, extrinsics)): + raise ValueError("extrinsic length does not match manifest") + if any(not isinstance(segment, bytes) or len(segment) != EC_SEGMENT_SIZE for segment in segments): + raise ValueError("invalid imported segment size") + if any(len(proof) > (MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE - 1).bit_length() + or any(not isinstance(h, bytes) or len(h) != 32 for h in proof) for proof in justifications): + raise ValueError("invalid import proof dimensions") + return (package.to_jam_bytes().to_bytes() + b''.join(extrinsics) + b''.join(segments) + + b''.join(Vec(H256).encode(list(proof)).to_bytes() for proof in justifications)) + + +def decode_bundle(encoded: bytes) -> BundleParts: + """Decode B(p,l), rejecting noncanonical prefixes, truncation and trailing bytes.""" + package, offset = decode_package(encoded) + stream = JamBytes(encoded) + stream.offset = offset + try: + extrinsics = [bytes(stream.get_next_bytes(entry.len)) + for item in package.items for entry in item.extrinsic] + import_count = sum(len(item.import_segments) for item in package.items) + segments = [bytes(stream.get_next_bytes(EC_SEGMENT_SIZE)) for _ in range(import_count)] + proofs = [] + for _ in range(import_count): + start = stream.offset + count = VarInt64.decode(stream) + if (count > (MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE - 1).bit_length() + or bytes(stream.data[start:stream.offset]) != VarInt64.encode(count).to_bytes()): + raise ValueError("invalid or noncanonical import proof count") + proofs.append([bytes(stream.get_next_bytes(32)) for _ in range(count)]) + except RemainingScaleBytesNotEmptyException as exc: + raise ValueError("truncated bundle data") from exc + if stream.get_remaining_length(): + raise ValueError("bundle has trailing bytes") + return BundleParts(package, extrinsics, segments, proofs) diff --git a/pyjamaz/cli.py b/pyjamaz/cli.py index d556db2b..745ded50 100644 --- a/pyjamaz/cli.py +++ b/pyjamaz/cli.py @@ -393,7 +393,8 @@ def generate(seed, ip, port): metadata = bytearray(128) enc, zone = ipv6_to_byte_array(ip) if len(enc) == 4: - metadata[0:4] = enc + # JAMNP-S v1 endpoints use the entire IPv6 field, including IPv4-mapped addresses. + metadata[0:16] = bytes(10) + b'\xff\xff' + enc elif len(enc) == 16: metadata[0:16] = enc else: @@ -417,7 +418,7 @@ async def init_certificate(db_path, seed): pk_pem, cert_pem = generate_cert( keys, ips="127.0.0.1", #TODO: hardcoded for now - alternative_name="e3r2oc62zwfj3crnuifuvsxvbtlzetk4o5qyhetkhagsc2fgl2oka", + alternative_name=quic_peer_id(keys.ed25519.public_key), ) pk_file = os.path.join(db_path, "cert.key") pem_file = os.path.join(db_path, "cert.pem") diff --git a/pyjamaz/d3l.py b/pyjamaz/d3l.py index c0b63049..c69d8346 100644 --- a/pyjamaz/d3l.py +++ b/pyjamaz/d3l.py @@ -1,36 +1,393 @@ +from contextlib import contextmanager +from dataclasses import dataclass, field, replace +from typing import Optional + from jamcodec.base import JamBytes -from pyjamaz.availability import DataUnavailable +from jamcodec.mixins import Serializable +from jamcodec.decoding import decode_to_object +from jamcodec.exceptions import InvalidScaleTypeValueException, RemainingScaleBytesNotEmptyException +from jamcodec.types import Bytes, H256, Option, U32, Vec + +from pyjamaz.availability import DataUnavailable, ImportedSegment, verify_import +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, EPOCH_TIMESLOTS, MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import WellBalancedMerkleTree from pyjamaz.models.app import D3LEntry -from pyjamaz.models.common import WorkReport +from pyjamaz.models.common import ValidatorData, WorkReport from pyjamaz.storage import StorageEngine +@dataclass +class AvailabilitySource(Serializable): + """Chain-backed routing and retention metadata; never populated from builder mappings.""" + + report: WorkReport = field(metadata={'codec': WorkReport.to_codec_def()}) + validators: list[ValidatorData] = field(metadata={'codec': Vec(ValidatorData.to_codec_def())}) + guarantors: list[ValidatorData] = field(metadata={'codec': Vec(ValidatorData.to_codec_def())}) + registered_block: bytes = field(metadata={'codec': H256}) + registered_slot: int = field(metadata={'codec': U32}) + assured_block: Optional[bytes] = field(default=None, metadata={'codec': Option(H256)}) + assured_slot: Optional[int] = field(default=None, metadata={'codec': Option(U32)}) + + @property + def spec(self): + return self.report.package_spec + + @property + def identity(self): + return blake2b_256_hash(self.registered_block + self.report.hash()) + + class DataAvailabilityStore: def __init__(self, storage_engine: StorageEngine): self.storage_engine = storage_engine + self._active_roots = {} - def retrieve_segments(self, segment_root: bytes) -> D3LEntry: - data = self.storage_engine.get(segment_root) + def _retrieve(self, key: bytes, message: str) -> bytes: + try: + data = self.storage_engine.get(key) + except FileNotFoundError as exc: + raise DataUnavailable(message) from exc if data is None: - raise DataUnavailable("imported segments are unavailable") - d3l_item = D3LEntry.from_jam_bytes(JamBytes(data)) + raise DataUnavailable(message) + return data + + def retrieve_segments(self, segment_root: bytes) -> D3LEntry: + data = self._retrieve(segment_root, "imported segments are unavailable") + try: + d3l_item = D3LEntry.from_jam_bytes(JamBytes(data)) + if (d3l_item.segment_root != segment_root + or d3l_item.to_jam_bytes().to_bytes() != data): + raise ValueError("noncanonical or mismatched stored exports") + except (ValueError, InvalidScaleTypeValueException, + RemainingScaleBytesNotEmptyException) as exc: + raise DataUnavailable("stored export segments are invalid") from exc return d3l_item def store_segments(self, segments: D3LEntry): self.storage_engine.put(segments.segment_root, segments.to_jam_bytes().to_bytes()) + @staticmethod + def _import_key(root: bytes, index: int) -> bytes: + if (not isinstance(root, bytes) or len(root) != 32 + or isinstance(index, bool) or not isinstance(index, int) + or not 0 <= index < MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE): + raise ProcessWorkpackageError("invalid import root or index") + return b'import-v1:' + root + index.to_bytes(2, 'little') + + def store_import(self, root: bytes, index: int, imported: ImportedSegment) -> None: + """Retain one verified segment and its direct proof, without establishing a package mapping.""" + key = self._import_key(root, index) + verify_import(root, index, imported) + encoded = imported.segment + Vec(H256).encode(list(imported.justification)).to_bytes() + self.storage_engine.put(key, encoded) + + def retrieve_import(self, root: bytes, index: int) -> ImportedSegment: + """Return a verified import; absent or corrupt cache data remains retryable.""" + data = self._retrieve(self._import_key(root, index), "import segment is unavailable") + max_proof_depth = (MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE - 1).bit_length() + try: + if not EC_SEGMENT_SIZE < len(data) <= EC_SEGMENT_SIZE + 1 + 32 * max_proof_depth: + raise ValueError("invalid stored import length") + stream = JamBytes(data) + segment = bytes(stream.get_next_bytes(EC_SEGMENT_SIZE)) + proof = tuple(decode_to_object(Vec(H256), stream)) + imported = ImportedSegment(segment, proof) + if segment + Vec(H256).encode(list(proof)).to_bytes() != data: + raise ValueError("noncanonical stored import") + verify_import(root, index, imported) + except (ValueError, InvalidScaleTypeValueException, + RemainingScaleBytesNotEmptyException, ProcessWorkpackageError) as exc: + raise DataUnavailable("stored import is invalid") from exc + return imported + def segment_root_for_package(self, package_hash: bytes) -> bytes: - root = self.storage_engine.get(b'package-root:' + package_hash) - if root is None: - raise DataUnavailable("segment-root mapping is unavailable") - return root + return self._retrieve(b'package-root:' + package_hash, "segment-root mapping is unavailable") - def store_work_report(self, report: WorkReport, bundle: bytes, exports: list[bytes]) -> None: + def store_work_report(self, report: WorkReport, bundle: bytes, exports: list[bytes], *, artifacts=None) -> None: """Retain the locally computed data and the 14.14 package-to-root correspondence.""" spec = report.package_spec + if artifacts is not None: + from pyjamaz.availability import verify_validator_shard + + if (artifacts.spec != spec or len(artifacts.shards) != spec.erasure_shards + or {shard.shard_index for shard in artifacts.shards} != set(range(spec.erasure_shards))): + raise ProcessWorkpackageError("availability artifacts differ from report") + for shard in artifacts.shards: + verify_validator_shard(shard, spec) + for shard in artifacts.shards: + self.store_validator_shard(spec, shard) self.store_segments(D3LEntry(spec.exports_root, exports)) self.storage_engine.put(b'bundle:' + spec.hash, bundle) self.storage_engine.put(b'package-root:' + spec.hash, spec.exports_root) + self.storage_engine.put(b'local-report-v1:' + spec.erasure_root, report.to_jam_bytes().to_bytes()) + self._add_index(b'local-exports-v1:' + spec.exports_root, spec.erasure_root) + + def _index(self, key: bytes) -> list[bytes]: + try: + raw = self._retrieve(key, 'availability index is unavailable') + except DataUnavailable: + return [] + try: + entries = decode_to_object(Vec(H256), JamBytes(raw)) + if entries != sorted(set(entries)) or Vec(H256).encode(entries).to_bytes() != raw: + raise ValueError('noncanonical availability index') + return entries + except (ValueError, InvalidScaleTypeValueException, RemainingScaleBytesNotEmptyException) as exc: + raise DataUnavailable('stored availability index is invalid') from exc + + def _add_index(self, key: bytes, identity: bytes) -> None: + entries = sorted(set(self._index(key)) | {identity}) + self.storage_engine.put(key, Vec(H256).encode(entries).to_bytes()) + + @staticmethod + def _validate_source(source: AvailabilitySource) -> None: + from pyjamaz.availability import _shard_dimensions + + _shard_dimensions(source.spec) + if len(source.validators) != source.spec.erasure_shards: + raise ProcessWorkpackageError('source validator count differs from report') + if len({v.ed25519 for v in source.validators}) != len(source.validators): + raise ProcessWorkpackageError('duplicate source validator identity') + # Verified guarantee signers may belong to the previous rotation's set. + if len({v.ed25519 for v in source.guarantors}) != len(source.guarantors): + raise ProcessWorkpackageError('duplicate guarantor identity') + if (not isinstance(source.registered_block, bytes) or len(source.registered_block) != 32 + or isinstance(source.registered_slot, bool) or not isinstance(source.registered_slot, int) + or not 0 <= source.registered_slot < 2**32 + or (source.assured_block is None) != (source.assured_slot is None) + or (source.assured_block is not None + and (not isinstance(source.assured_block, bytes) or len(source.assured_block) != 32 + or isinstance(source.assured_slot, bool) or not isinstance(source.assured_slot, int) + or not source.registered_slot <= source.assured_slot < 2**32))): + raise ProcessWorkpackageError('invalid source block references') + + def register_source(self, source: AvailabilitySource) -> None: + # GP-0.8.0-eq:14.14 / sec:14.4: the accepted report fixes the source set and core. + self._validate_source(source) + try: + encoded = source.to_jam_bytes().to_bytes() + except (ValueError, InvalidScaleTypeValueException) as exc: + raise ProcessWorkpackageError('invalid source metadata encoding') from exc + identity = source.identity + self.storage_engine.put(b'source-v1:' + identity, encoded) + for kind, value in ((b'package', source.spec.hash), (b'exports', source.spec.exports_root), + (b'erasure', source.spec.erasure_root)): + self._add_index(b'source-index-v1:' + kind + value, identity) + self._add_index(b'source-list-v1', identity) + + def _source(self, identity: bytes) -> AvailabilitySource: + raw = self._retrieve(b'source-v1:' + identity, 'source metadata is unavailable') + try: + source = AvailabilitySource.from_jam_bytes(JamBytes(raw)) + self._validate_source(source) + if source.identity != identity or source.to_jam_bytes().to_bytes() != raw: + raise ValueError('noncanonical or mismatched source metadata') + return source + except (ValueError, InvalidScaleTypeValueException, RemainingScaleBytesNotEmptyException, + ProcessWorkpackageError) as exc: + raise DataUnavailable('stored source metadata is invalid') from exc + + def sources(self) -> list[AvailabilitySource]: + sources = [] + for identity in self._index(b'source-list-v1'): + try: + sources.append(self._source(identity)) + except DataUnavailable: + # Keep the index entry so retained blocks can repair this record later. + continue + return sources + + def source_for(self, *, package_hash=None, exports_root=None, erasure_root=None, canonical=None): + kind, value = ((b'package', package_hash) if package_hash is not None else + (b'exports', exports_root) if exports_root is not None else (b'erasure', erasure_root)) + if not isinstance(value, bytes) or len(value) != 32: + raise DataUnavailable('invalid source lookup') + candidates = [] + for identity in self._index(b'source-index-v1:' + kind + value): + try: + source = self._source(identity) + except DataUnavailable: + continue + actual = {b'package': source.spec.hash, b'exports': source.spec.exports_root, + b'erasure': source.spec.erasure_root}[kind] + if actual != value: + raise DataUnavailable('stored source index does not match its metadata') + if canonical is None or canonical(source.registered_block): + candidates.append(source) + if not candidates: + raise DataUnavailable('chain-backed source metadata is unavailable') + return max(candidates, key=lambda source: (source.registered_slot, source.identity)) + + def mark_assured(self, report: WorkReport, block_hash: bytes, slot: int, canonical) -> None: + report_hash = report.hash() + candidates = [] + for identity in self._index(b'source-index-v1:erasure' + report.package_spec.erasure_root): + try: + source = self._source(identity) + except DataUnavailable: + continue + if (source.report.hash() == report_hash and source.registered_slot <= slot + and canonical(source.registered_block)): + candidates.append(source) + if not candidates: + raise DataUnavailable('matching source registration is unavailable') + source = max(candidates, key=lambda record: (record.registered_slot, record.identity)) + if source.assured_block is not None and canonical(source.assured_block): + return # Replaying history must preserve an already known canonical assurance. + self.register_source(replace(source, assured_block=block_hash, assured_slot=slot)) + + def specification(self, erasure_root: bytes, canonical=None): + try: + return self.source_for(erasure_root=erasure_root, canonical=canonical).spec + except DataUnavailable: + return self._local_report(erasure_root).package_spec + + def _local_report(self, erasure_root: bytes) -> WorkReport: + from pyjamaz.availability import _shard_dimensions + + raw = self._retrieve(b'local-report-v1:' + erasure_root, 'unknown erasure root') + try: + report = WorkReport.from_jam_bytes(JamBytes(raw)) + _shard_dimensions(report.package_spec) + if report.package_spec.erasure_root != erasure_root or report.to_jam_bytes().to_bytes() != raw: + raise ValueError('noncanonical or mismatched local report') + return report + except (ValueError, InvalidScaleTypeValueException, RemainingScaleBytesNotEmptyException, + ProcessWorkpackageError) as exc: + raise DataUnavailable('stored local report is invalid') from exc + + def local_report_for_exports(self, exports_root: bytes) -> WorkReport: + """Find a locally computed source without claiming chain-backed availability.""" + if not isinstance(exports_root, bytes) or len(exports_root) != 32: + raise DataUnavailable('invalid exports root') + reports = [] + for erasure_root in self._index(b'local-exports-v1:' + exports_root): + try: + report = self._local_report(erasure_root) + except DataUnavailable: + continue + if report.package_spec.exports_root != exports_root: + raise DataUnavailable('stored local exports index does not match its report') + reports.append(report) + if not reports: + raise DataUnavailable('locally computed source metadata is unavailable') + # The same exports may be retained under several bundle/validator specifications. + return max(reports, key=lambda report: report.package_spec.erasure_root) + + def _source_index_complete(self, kind, value, sources) -> bool: + """Missing source context protects only payloads whose indexes reference it.""" + try: + identities = set(self._index(b'source-index-v1:' + kind + value)) + except DataUnavailable: + return False + fields = {b'package': 'hash', b'exports': 'exports_root', b'erasure': 'erasure_root'} + expected = {source.identity for source in sources.values() + if getattr(source.spec, fields[kind]) == value} + return bool(identities) and identities == expected + + @staticmethod + def _shard_key(prefix, spec, index): + if isinstance(index, bool) or not isinstance(index, int) or not 0 <= index < spec.erasure_shards: + raise ProcessWorkpackageError('invalid validator shard index') + return prefix + spec.erasure_root + index.to_bytes(2, 'little') + + def store_validator_shard(self, spec, shard) -> None: + from pyjamaz.availability import verify_validator_shard + + verify_validator_shard(shard, spec) + key = self._shard_key(b'row-v1:', spec, shard.shard_index) + row = (blake2b_256_hash(shard.bundle_shard) + + Vec(Bytes).encode(list(shard.segment_shards)).to_bytes() + + Vec(Bytes).encode(list(shard.justification)).to_bytes()) + self.storage_engine.put(self._shard_key(b'audit-v1:', spec, shard.shard_index), shard.bundle_shard) + self.storage_engine.put(key, row) + # Metadata is published only after both payload records have been written. + self._add_index(b'row-index-v1:' + spec.erasure_root, shard.shard_index.to_bytes(32, 'little')) + + def _row(self, spec, index): + try: + data = self._retrieve(self._shard_key(b'row-v1:', spec, index), 'assigned shard is unavailable') + stream = JamBytes(data) + bundle_hash = bytes(stream.get_next_bytes(32)) + row = tuple(decode_to_object(Vec(Bytes), stream)) + proof = tuple(decode_to_object(Vec(Bytes), stream)) + from pyjamaz.erasure import erasure_data_shards + + count = spec.exports_count + (spec.exports_count + 63) // 64 + if (stream.get_remaining_length() or len(row) != count + or any(len(chunk) != EC_SEGMENT_SIZE // erasure_data_shards(spec.erasure_shards) for chunk in row) + or bundle_hash + Vec(Bytes).encode(list(row)).to_bytes() + + Vec(Bytes).encode(list(proof)).to_bytes() != data + or not WellBalancedMerkleTree.verify(bundle_hash + WellBalancedMerkleTree(list(row)).root(), + index, spec.erasure_shards, proof, spec.erasure_root)): + raise ValueError('invalid assigned shard commitment') + return bundle_hash, row, proof + except (ValueError, InvalidScaleTypeValueException, RemainingScaleBytesNotEmptyException) as exc: + raise DataUnavailable('stored assigned shard is invalid') from exc + + def retrieve_validator_shard(self, spec, index): + from pyjamaz.availability import ValidatorShard, verify_validator_shard + + bundle_hash, row, proof = self._row(spec, index) + bundle = self._retrieve(self._shard_key(b'audit-v1:', spec, index), 'audit shard is unavailable') + shard = ValidatorShard(index, bundle, row, proof) + try: + verify_validator_shard(shard, spec) + except ProcessWorkpackageError as exc: + raise DataUnavailable('stored audit shard is invalid') from exc + return shard + + def retrieve_segment_shard(self, spec, shard_index, segment_index): + # JAMNP-S-e0b7d291:CE140: outer path ++ bundle hash ++ row-local path. + bundle_hash, row, proof = self._row(spec, shard_index) + if isinstance(segment_index, bool) or not isinstance(segment_index, int) or not 0 <= segment_index < len(row): + raise ProcessWorkpackageError('segment shard index out of range') + return row[segment_index], proof + (bundle_hash,) + tuple(WellBalancedMerkleTree(list(row)).trace(segment_index)) + + @contextmanager + def hold(self, erasure_root): + self._active_roots[erasure_root] = self._active_roots.get(erasure_root, 0) + 1 + try: + yield + finally: + self._active_roots[erasure_root] -= 1 + if not self._active_roots[erasure_root]: + del self._active_roots[erasure_root] + + def prune(self, finalized_slot: int, canonical, finalized) -> None: + # GP-0.8.0-sec:14.3.1: audit data until assurance finality; D3L at least 672 epochs. + sources = self.sources() + by_identity = {source.identity: source for source in sources} + for root in {source.spec.erasure_root for source in sources}: + records = [source for source in sources if source.spec.erasure_root == root and canonical(source.registered_block)] + if (not records or root in self._active_roots + or not self._source_index_complete(b'erasure', root, by_identity)): + continue + spec = records[0].spec + audit_expired = all(source.assured_block is not None and finalized(source.assured_block) for source in records) + exports_expired = all(finalized_slot >= source.registered_slot + 672 * EPOCH_TIMESLOTS for source in records) + for encoded_index in self._index(b'row-index-v1:' + root): + index = int.from_bytes(encoded_index, 'little') + if audit_expired: + self.storage_engine.delete(self._shard_key(b'audit-v1:', spec, index)) + # CE 137/138 still need the row's root and co-path until audit finality. + if exports_expired and audit_expired: + self.storage_engine.delete(self._shard_key(b'row-v1:', spec, index)) + for source in records: + shared = [s for s in sources if s.spec.hash == source.spec.hash and canonical(s.registered_block)] + if (audit_expired and self._source_index_complete(b'package', source.spec.hash, by_identity) + and all(s.assured_block is not None and finalized(s.assured_block) + and s.spec.erasure_root not in self._active_roots for s in shared)): + self.storage_engine.delete(b'bundle:' + source.spec.hash) + same_exports = [source for source in sources if source.spec.exports_root == spec.exports_root] + if (exports_expired and self._source_index_complete(b'exports', spec.exports_root, by_identity) + and all(finalized_slot >= source.registered_slot + 672 * EPOCH_TIMESLOTS + and source.spec.erasure_root not in self._active_roots for source in same_exports)): + self.storage_engine.delete(spec.exports_root) + for index in range(spec.exports_count): + self.storage_engine.delete(self._import_key(spec.exports_root, index)) diff --git a/pyjamaz/erasure.py b/pyjamaz/erasure.py index 20e883ad..81e54e9d 100644 --- a/pyjamaz/erasure.py +++ b/pyjamaz/erasure.py @@ -1,6 +1,6 @@ """GP 0.8.0 Appendix H, backed by the JAM GF(2^16) implementation.""" -from jam_erasure import encode_shards +from jam_erasure import encode_shards, recover_shards from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, valid_validator_count @@ -14,6 +14,7 @@ def erasure_data_shards(validator_count: int) -> int: def encode_chunks(validator_count: int, piece_count: int, data: bytes) -> list[bytes]: # GP-0.8.0-eq:H.5: C^v_k(d): B_(2k D(v)) -> [B_(2k)]_v. + # validator_count=v, piece_count=k, data=d. originals = erasure_data_shards(validator_count) if isinstance(piece_count, bool) or not isinstance(piece_count, int) or piece_count < 0: raise ValueError("invalid erasure piece count") @@ -25,3 +26,75 @@ def encode_chunks(validator_count: int, piece_count: int, data: bytes) -> list[b if len(shards) != validator_count or any(len(shard) != 2 * piece_count for shard in shards): raise RuntimeError("erasure backend returned invalid shard dimensions") return shards + + +def _validate_chunks(validator_count: int, chunk_size: int, chunks: dict[int, bytes]) -> None: + if not isinstance(chunks, dict): + raise ValueError("erasure chunks must map validator indexes to bytes") + for index, chunk in chunks.items(): + if (isinstance(index, bool) or not isinstance(index, int) + or not 0 <= index < validator_count): + raise ValueError("invalid erasure chunk index") + if not isinstance(chunk, bytes) or len(chunk) != chunk_size: + raise ValueError("chunk length does not match erasure dimensions") + + +def recover_chunks(validator_count: int, piece_count: int, chunks: dict[int, bytes]) -> bytes: + # GP-0.8.0-eq:H.6: R^v_k(c): {(B_(2k), N_v)}_(D(v)) -> B_(2k D(v)). + # validator_count=v, piece_count=k, chunks=c (validator index -> chunk). + originals = erasure_data_shards(validator_count) + if isinstance(piece_count, bool) or not isinstance(piece_count, int) or piece_count < 0: + raise ValueError("invalid erasure piece count") + _validate_chunks(validator_count, 2 * piece_count, chunks) + if len(chunks) != originals: + raise ValueError("recovery requires exactly D(v) chunks") + if piece_count == 0: + return b'' + # H.6's first case: sort the original chunks by their validator index and join. + if all(index in chunks for index in range(originals)): + return b''.join(chunks[index] for index in range(originals)) + recovered = recover_shards(originals, validator_count - originals, sorted(chunks.items())) + if not isinstance(recovered, bytes) or len(recovered) != 2 * piece_count * originals: + raise RuntimeError("erasure backend returned invalid recovered dimensions") + return recovered + + +def encode_blob(validator_count: int, data: bytes) -> list[bytes]: + """Pad a blob and apply H.5; this convenience function is not a separate GP transform.""" + originals = erasure_data_shards(validator_count) + if not isinstance(data, bytes): + raise ValueError("erasure data must be bytes") + # GP-0.8.0-eq:14.19: P_(2 D(v))(data), followed by H.5. + alignment = 2 * originals + padded = data + bytes(-len(data) % alignment) + return encode_chunks(validator_count, len(padded) // alignment, padded) + + +def recover_blob(validator_count: int, original_length: int, shards: dict[int, bytes]) -> bytes: + """Select a threshold for H.6, check zero padding, then return the original blob. + + This convenience function requires the known unpadded length. Authentication + of the recovered bytes belongs to the availability layer. + """ + originals = erasure_data_shards(validator_count) + if isinstance(original_length, bool) or not isinstance(original_length, int) or original_length < 0: + raise ValueError("invalid original blob length") + piece_count = (original_length + 2 * originals - 1) // (2 * originals) + _validate_chunks(validator_count, 2 * piece_count, shards) + if original_length == 0: + return b'' + if len(shards) < originals: + raise ValueError("insufficient erasure shards") + # Prefer H.6's systematic case; otherwise use the lowest distinct indexes. + indexes = (range(originals) if all(index in shards for index in range(originals)) + else sorted(shards)[:originals]) + padded = recover_chunks(validator_count, piece_count, {index: shards[index] for index in indexes}) + # GP-0.8.0-eq:14.19: only the zero extension of P_(2 D(v)) may be discarded. + if any(padded[original_length:]): + raise ValueError("recovered blob has nonzero padding") + return padded[:original_length] + + +def recover_segment(validator_count: int, shards: dict[int, bytes]) -> bytes: + """Apply H.6 with k = WG / (2 D(v)); segments need no padding (Appendix H.1).""" + return recover_blob(validator_count, EC_SEGMENT_SIZE, shards) diff --git a/pyjamaz/fuzzer/refinement_vectors.py b/pyjamaz/fuzzer/refinement_vectors.py new file mode 100644 index 00000000..c46f12d7 --- /dev/null +++ b/pyjamaz/fuzzer/refinement_vectors.py @@ -0,0 +1,138 @@ +"""Import standalone Ξ JSON vectors into binary v1 refinement fixtures. + +The source corpus supplies service state, not a chain snapshot. Global state +and the initialization header are deterministic synthetic scaffolding. Package +contexts, authorizer inputs and reference reports are never repaired or executed. +""" + +import hashlib +import json +from dataclasses import fields +from pathlib import Path + +from pyjamaz.bundle import decode_bundle + +from pyjamaz.fuzzer.v1.types import RefineBundle, WorkPackageBundle +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.models.app import StateDump, TraceGenesis +from pyjamaz.models.block import Header +from pyjamaz.models.common import WorkPackage, WorkReport +from pyjamaz.models.state import JamState, ServiceAccount, STORAGE_KEY_MAPPING +from pyjamaz.settings import GP_VERSION, TEST_SUITE +from pyjamaz.state.base import state_key_constructor_preimage, state_key_constructor_service_account + + +def _hex(value): + if not isinstance(value, str) or not value.startswith('0x'): + raise ValueError('expected a 0x-prefixed hex string') + return bytes.fromhex(value[2:]) + + +def _bundle(package, raw): + """Decode B(p,l), whose data sequences have manifest-defined lengths.""" + parts = decode_bundle(raw) + if parts.package != package: + raise ValueError('bundle work package differs from JSON or is noncanonical') + # Proof validity and manifest semantics belong to the target, not import. + return WorkPackageBundle(package, parts.extrinsics, parts.segments, parts.justifications) + + +def _convert(data): + package = WorkPackage.from_json(data['work_package']) + expected = WorkReport.from_json(data['expected']['work_report']) + request = RefineBundle(data['core_idx'], dict(expected.segment_root_lookup), + expected.package_spec.erasure_shards, _bundle(package, _hex(data['bundle']))) + + state = JamState.create_genesis_state() + state.timeslot.number = package.context.lookup_anchor_slot + keys_by_type = {cls: key for key, cls in STORAGE_KEY_MAPPING.items()} + keyvals = {keys_by_type[type(component)]: component.to_jam_bytes().to_bytes() + for item in fields(state) + if type(component := getattr(state, item.name)) in keys_by_type} + + def put(key, value): + if len(key) != 31: + raise ValueError('service data keys must be 31 bytes') + if key in keyvals and keyvals[key] != value: + raise ValueError(f'conflicting state entries for {key.hex()}') + keyvals[key] = value + + for service_id, entry in data['services'].items(): + service_id = int(service_id) + if not 0 <= service_id < 2**32: + raise ValueError('service ID must fit in U32') + account = entry['service'] + converted = ServiceAccount( + code_hash=_hex(account['code_hash']), balance=account['balance'], + gas_limit_accumulate=account['min_item_gas'], gas_limit_on_transfer=account['min_memo_gas'], + footprint_storage_bytes=account['bytes'], footprint_storage_items=account['items'], + deposit_offset=account['deposit_offset'], creation_slot=account['creation_slot'], + last_accumulation_slot=account['last_accumulation_slot'], parent_service=account['parent_service'], + storage_items={}, preimages={}, preimage_availability={}, + ) + if len(converted.code_hash) != 32: + raise ValueError('service code hash must be 32 bytes') + put(state_key_constructor_service_account(service_id), converted.to_serialized_bytes()) + for raw in entry['data']: + put(_hex(raw['key']), _hex(raw['value'])) + for preimage in entry['preimage_blobs']: + blob, digest = _hex(preimage['blob']), _hex(preimage['hash']) + if blake2b_256_hash(blob) != digest: + raise ValueError('preimage hash does not match blob') + put(state_key_constructor_preimage(service_id, digest), blob) + + keyvals = sorted(keyvals.items()) + header = Header.default() + header.timeslot = package.context.lookup_anchor_slot + genesis = TraceGenesis(header, StateDump(PatriciaMerkleTrie(keyvals).root(), keyvals)) + # Exercise codec bounds before producing any files. + for value in (genesis, request, expected): + value.to_jam_bytes() + return genesis, request, expected + + +def load_refinement_vector(source: Path): + """Convert a vector without executing it or writing files.""" + return _parse(Path(source).read_bytes()) + + +def _parse(raw): + try: + return _convert(json.loads(raw)) + except Exception as exc: + raise ValueError(f'Invalid refinement JSON vector: {exc}') from exc + + +def import_refinement_vector(source: Path, destination: Path): + """Write a new fixture directory; never overwrite files or adjust the oracle.""" + source, destination = Path(source), Path(destination) + raw = source.read_bytes() + genesis, request, expected = _parse(raw) + if destination.exists(): + raise FileExistsError(f'fixture destination already exists: {destination}') + warnings = [] + package = request.bundle.work_package + if state_key_constructor_preimage(package.auth_code_host, package.auth_code_hash) not in dict(genesis.state.keyvals): + warnings.append(f'authorization preimage missing for service {package.auth_code_host}') + if expected.authorizer_hash != package.authorizer_hash(): + warnings.append('expected authorizer hash differs from H(auth_code_hash || authorizer_config)') + encoded = {name: value.to_jam_bytes().to_bytes() for name, value in ( + ('genesis.bin', genesis), ('refine.bin', request), ('report.bin', expected), + )} + manifest = { + 'source': str(source.resolve()), 'source_sha256': hashlib.sha256(raw).hexdigest(), + 'graypaper_version': GP_VERSION, 'profile': TEST_SUITE, + 'initialization': 'synthetic default global state and header; supplied service state only', + 'package_context_unchanged': True, 'expected_report_unchanged': True, + 'transport_parameters': 'core_idx from input; segment_root_lookup and erasure_shards from expected report', + 'exported_segments': 'preserved in source.json; protocol returns report commitments, not exported bytes', + 'warnings': warnings, + 'sha256': {name: hashlib.sha256(value).hexdigest() for name, value in encoded.items()}, + } + destination.mkdir(parents=True) + for name, value in encoded.items(): + (destination / name).write_bytes(value) + (destination / 'source.json').write_bytes(raw) + (destination / 'manifest.json').write_text(json.dumps(manifest, indent=2) + '\n') + return manifest diff --git a/pyjamaz/fuzzer/v1/target.py b/pyjamaz/fuzzer/v1/target.py index 8e7a8e47..3e2b26c4 100644 --- a/pyjamaz/fuzzer/v1/target.py +++ b/pyjamaz/fuzzer/v1/target.py @@ -151,11 +151,18 @@ async def msg_refine_bundle(self, req: FuzzerMessage) -> FuzzerMessage: bundle = request.bundle def compute(): - data = BundleData.from_parts( + execution = Refinement(services, BundleData()) + execution._validate_arguments( + bundle.work_package, request.core_index, request.segment_root_lookup, request.erasure_shards, + ) + # GP-0.8.0-eq:14.13: authorize before hashing or verifying supplied X/S/J data. + authorization = execution.authorize(bundle.work_package, request.core_index) + execution.data = BundleData.from_parts( bundle.work_package, bundle.extrinsics, bundle.import_segments, bundle.justifications, ) - return Refinement(services, data).compute_work_report( + return execution._compute_authorized_report( bundle.work_package, request.core_index, request.segment_root_lookup, request.erasure_shards, + authorization, ) try: diff --git a/pyjamaz/merkle.py b/pyjamaz/merkle.py index 09e76589..3028e072 100644 --- a/pyjamaz/merkle.py +++ b/pyjamaz/merkle.py @@ -221,8 +221,60 @@ def node(self, nodes: List[bytes]) -> bytes: node_limit = ceil(len(nodes)/2) return self.hash_function(b'node' + self.node(nodes[:node_limit]) + self.node(nodes[node_limit:])) + def trace(self, index: int) -> List[bytes]: + """GP-0.8.0-eq:E.2: T(v,i), with opposite nodes ordered root first.""" + if isinstance(index, bool) or not isinstance(index, int) or not 0 <= index < len(self.data): + raise IndexError("Merkle leaf index out of range") + nodes = self.data + proof = [] + while len(nodes) > 1: + split = (len(nodes) + 1) // 2 + if index < split: + proof.append(self.node(nodes[split:])) + nodes = nodes[:split] + else: + proof.append(self.node(nodes[:split])) + nodes = nodes[split:] + index -= split + return proof + + def root_from_trace(self, value: bytes, index: int, count: int, proof: List[bytes] | Tuple[bytes, ...], + *, single_item_hashed: bool = False) -> Optional[bytes]: + """Reconstitute E.1 from E.2; E.3 additionally hashes a singleton leaf.""" + if (isinstance(index, bool) or not isinstance(index, int) + or isinstance(count, bool) or not isinstance(count, int) + or not 0 <= index < count or not isinstance(value, bytes) + or not isinstance(proof, (list, tuple)) + or any(not isinstance(sibling, bytes) for sibling in proof)): + return None + directions = [] + while count > 1: + split = (count + 1) // 2 + right = index >= split + directions.append(right) + if right: + index -= split + count -= split + else: + count = split + if len(proof) != len(directions): + return None + if not directions: + return self.hash_function(value) if single_item_hashed else value + for right, sibling in reversed(list(zip(directions, proof))): + left, other = (sibling, value) if right else (value, sibling) + value = self.hash_function(b'node' + left + other) + return value + class WellBalancedMerkleTree(BinaryMerkleTree): + @staticmethod + def verify(value: bytes, index: int, count: int, proof: List[bytes] | Tuple[bytes, ...], root: bytes) -> bool: + """Check E.3 inclusion using the exact E.2 path for (index,count).""" + return (isinstance(root, bytes) and len(root) == 32 + and WellBalancedMerkleTree([]).root_from_trace( + value, index, count, proof, single_item_hashed=True) == root) + def root(self) -> bytes: """ GP-0.8.0-eq:E.3 | well-balanced merkle tree root hash diff --git a/pyjamaz/refinement.py b/pyjamaz/refinement.py index 60f12a4c..ca70168b 100644 --- a/pyjamaz/refinement.py +++ b/pyjamaz/refinement.py @@ -1,10 +1,11 @@ """Work-report computation with the GP's explicit (p, c, l, v) arguments.""" -from pyjamaz.availability import BundleData, availability_spec, validate_work_package +from pyjamaz.availability import BundleData, build_availability_artifacts, validate_work_package from pyjamaz.erasure import erasure_data_shards from pyjamaz.exceptions import ProcessWorkpackageError from pyjamaz.graypaper_constants import CORE_COUNT, EC_SEGMENT_SIZE, MAXIMUM_SIZE_ENCODED_WORK_REPORT from pyjamaz.hostcalls.invocation import pvm_invoke_is_authorized, pvm_invoke_refine +from pyjamaz.hostcalls.models import PvmIsAuthorizedOutput from pyjamaz.models.common import WorkDigest, WorkExecResult, WorkPackage, WorkReport from pyjamaz.models.state import ServicesState @@ -21,14 +22,24 @@ def __init__(self, services: ServicesState, data: BundleData): self.data = data self.bundle = b'' self.exported_segments: list[bytes] = [] + self.artifacts = None def compute_work_report(self, package: WorkPackage, core_index: int, mappings: dict[bytes, bytes], erasure_shards: int) -> WorkReport: # GP-0.8.0-eq:14.13: Xi(p,c,l,v) -> WorkReport or bottom (ProcessWorkpackageError). + # package=p, core_index=c, mappings=l, erasure_shards=v. self.bundle = b'' self.exported_segments = [] + self.artifacts = None + self._validate_arguments(package, core_index, mappings, erasure_shards) + authorization = self.authorize(package, core_index) + return self._compute_authorized_report(package, core_index, mappings, erasure_shards, authorization) + + @staticmethod + def _validate_arguments(package, core_index, mappings, erasure_shards) -> None: validate_work_package(package) - if not 0 <= core_index < CORE_COUNT: + if (isinstance(core_index, bool) or not isinstance(core_index, int) + or not 0 <= core_index < CORE_COUNT): raise ProcessWorkpackageError("invalid core index") try: erasure_data_shards(erasure_shards) @@ -41,10 +52,16 @@ def compute_work_report(self, package: WorkPackage, core_index: int, if mappings.keys() != expected_mappings: raise ProcessWorkpackageError("segment-root dictionary has unexpected keys") - # GP-0.8.0-eq:14.15-14.16: obtain verified X, S_l and J_l before invoking PVM code. - bundle = self.data.assemble_bundle(package, mappings) - extrinsics = [self.data.extrinsic_data(item) for item in package.items] - imports = [self.data.import_segments(mappings, item) for item in package.items] + def authorize(self, package: WorkPackage, core_index: int) -> PvmIsAuthorizedOutput: + """Evaluate Psi_I(p,c) against this execution's detached service state.""" + # GP-0.8.0-eq:14.13 / B.1: authorization precedes data acquisition and Psi_R. + validate_work_package(package) + if (isinstance(core_index, bool) or not isinstance(core_index, int) + or not 0 <= core_index < CORE_COUNT): + raise ProcessWorkpackageError("invalid core index") + self.bundle = b'' + self.exported_segments = [] + self.artifacts = None package.set_authorization_code(self.services) authorization = pvm_invoke_is_authorized(package, core_index) trace = authorization.work_exec_result.ok @@ -52,6 +69,20 @@ def compute_work_report(self, package: WorkPackage, core_index: int, raise ProcessWorkpackageError("Unauthorized") if len(trace) > MAXIMUM_SIZE_ENCODED_WORK_REPORT: raise ProcessWorkpackageError("Oversized auth result") + return authorization + + def _compute_authorized_report(self, package: WorkPackage, core_index: int, + mappings: dict[bytes, bytes], erasure_shards: int, + authorization: PvmIsAuthorizedOutput) -> WorkReport: + """Finish Xi using the authorization from the same package/core/state attempt.""" + self._validate_arguments(package, core_index, mappings, erasure_shards) + trace = authorization.work_exec_result.ok + if not isinstance(trace, bytes) or len(trace) > MAXIMUM_SIZE_ENCODED_WORK_REPORT: + raise ProcessWorkpackageError("invalid authorization result") + # GP-0.8.0-eq:14.15-14.16: verify X, S_l and J_l after successful Psi_I. + bundle = self.data.assemble_bundle(package, mappings) + extrinsics = [self.data.extrinsic_data(item) for item in package.items] + imports = [self.data.import_segments(mappings, item) for item in package.items] digests = [] exports = [] @@ -79,7 +110,8 @@ def compute_work_report(self, package: WorkPackage, core_index: int, export_offset += item.export_count # GP-0.8.0-eq:14.17: s = A(H(p), B(p,l), concat(exports), v). - spec = availability_spec(package.hash(), bundle, exports, erasure_shards) + artifacts = build_availability_artifacts(package.hash(), bundle, exports, erasure_shards) + spec = artifacts.spec report = WorkReport( package_spec=spec, context=package.context, core_index=core_index, authorizer_hash=package.authorizer_hash(), auth_output=trace, @@ -87,4 +119,5 @@ def compute_work_report(self, package: WorkPackage, core_index: int, ) self.bundle = bundle self.exported_segments = exports + self.artifacts = artifacts return report diff --git a/pyjamaz/rpc/rpc.py b/pyjamaz/rpc/rpc.py index 9f292162..531ce9d1 100644 --- a/pyjamaz/rpc/rpc.py +++ b/pyjamaz/rpc/rpc.py @@ -3,6 +3,7 @@ import uuid from jamcodec.base import JamBytes +from pyjamaz.bundle import decode_package import pyjamaz.graypaper_constants as gp_const from pyjamaz.app import PyjamazApp @@ -245,33 +246,18 @@ def rpcBeefyRoot(app: PyjamazApp, params): def rpcSubmitWorkPackage(app: PyjamazApp, params): - #TODO: should assign to a specific core ex = [base64_decode(x) for x in params[2]] wp = WorkPackage.from_jam_bytes(JamBytes(base64_decode(params[1]))) DEBUG and logging.debug(f'Received workpackage {format_hash(wp.hash())}') - app.add_work_package(wp, ex) + app.add_work_package(wp, ex, core_index=params[0]) def rpcSubmitWorkPackageBundle(app: PyjamazApp, params): - #TODO: should assign to a specific core - data = JamBytes(base64_decode(params[1])) - extrinsics = [] - - wp = WorkPackage.from_jam_bytes(data) - - for item in wp.items: - for extrinsic_item in item.extrinsic: - extrinsic_data = bytes(data.get_next_bytes(extrinsic_item.len)) - # Check data - if blake2b_256_hash(extrinsic_data) != extrinsic_item.hash: - raise RPCCallException("Invalid extrinsic data") - extrinsics.append(extrinsic_data) - - if data.get_remaining_length() > 0: - logging.warning(f'DATA LEFT IN WORKPACKAGE BUNDLE: {data.get_remaining_length()}') - - # DEBUG and logging.debug(f'Received workpackage bundle {format_hash(wp.hash())}') - app.add_work_package(wp, extrinsics) + # GP-0.8.0-eq:14.16: retain B(p,l), not only its package/extrinsic prefix. + # The worker authorizes p before decoding and verifying the large data sequences. + encoded = base64_decode(params[1]) + wp, _ = decode_package(encoded) + app.add_work_package(wp, [], core_index=params[0], bundle=encoded) def rpcSubmitPreimage(app: PyjamazApp, params): diff --git a/pyjamaz/rpc/ws_client.py b/pyjamaz/rpc/ws_client.py index 0f5cb9f2..1a80f7b1 100644 --- a/pyjamaz/rpc/ws_client.py +++ b/pyjamaz/rpc/ws_client.py @@ -162,10 +162,16 @@ async def submitWorkPackage(self, core_idx: int, workpackage: WorkPackage, extri extrinsics_blob = [base64_encode(extrinsics_item) for extrinsics_item in extrinsics] return await self._send_and_wait("submitWorkPackage", [core_idx, workpackage_blob, extrinsics_blob]) - async def submitWorkPackageBundle(self, core_idx: int, workpackage: WorkPackage, imports: List[bytes], extrinsics: List[bytes]) -> None: - workpackage_blob = base64_encode(workpackage.to_jam_bytes().to_bytes()) - extrinsics_blob = [base64_encode(extrinsics_item) for extrinsics_item in extrinsics] - return await self._send_and_wait("submitWorkPackageBundle", [core_idx, workpackage_blob]) + async def submitWorkPackageBundle(self, core_idx: int, workpackage: WorkPackage, imports: List[bytes], + extrinsics: List[bytes], justifications: List[List[bytes]] | None = None) -> None: + from pyjamaz.bundle import encode_bundle + + if justifications is None: + if imports: + raise ValueError("import justifications are required") + justifications = [] + encoded = encode_bundle(workpackage, extrinsics, imports, justifications) + return await self._send_and_wait("submitWorkPackageBundle", [core_idx, base64_encode(encoded)]) async def submitPreimage(self, service_id: int , preimage_blob: bytes) -> None: preimage_blob = base64_encode(preimage_blob) diff --git a/pyjamaz/runtime/availability.py b/pyjamaz/runtime/availability.py new file mode 100644 index 00000000..dcf0759c --- /dev/null +++ b/pyjamaz/runtime/availability.py @@ -0,0 +1,600 @@ +"""Chapter 14 local/peer data services, composed from GP recovery and verification. + +Wire behavior follows JAMNP-S v1 e0b7d291. These services expose data readiness; +they do not produce guarantees, assurance votes or audit judgments. +""" + +import asyncio +import logging +from collections import deque +from dataclasses import dataclass + +from jamcodec.base import JamBytes +from jamcodec.exceptions import ScaleDecodeException + +from pyjamaz.availability import ( + DataUnavailable, ImportedSegment, audit_shard_justification, import_reference, + recover_import, resolve_import_root, verify_import, verify_segment_shard, +) +from pyjamaz.bundle import decode_bundle, encode_bundle +from pyjamaz.constants import WELL_KNOWN_STORAGE_KEYS +from pyjamaz.d3l import AvailabilitySource +from pyjamaz.erasure import erasure_data_shards +from pyjamaz.exceptions import ProcessWorkpackageError, StateTransitionError +from pyjamaz.graypaper_constants import ( + EC_SEGMENT_SIZE, EPOCH_TIMESLOTS, MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE, ROTATION_PERIOD_CORE, +) +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.context import AppContext, BlockContext +from pyjamaz.models.state import AssurancesState, EntropyState, TimeslotState, ValidatorArchiveState, ValidatorPoolState +from pyjamaz.state.components import Assurances + + +@dataclass +class StagedSubmission: + authorization: object + package: object + mappings: dict[bytes, bytes] + + +class AvailabilityRuntime: + REQUEST_TIMEOUT = 5 + REQUESTS_IN_FLIGHT = 4 + BACKFILL_BATCH_SIZE = 64 + + def __init__(self, app): + self.app = app + self._queue = asyncio.Queue(maxsize=4096) + self._queued = set() + self._canonical_head = None + self._canonical_hashes = set() + self._canonical_cursor = None + self._parents = {} + # Discover ancestors backwards, then replay this queue oldest first. + self._backfill_pending = deque() + self._repair_blocks = {} + self._backfill_wakeup = asyncio.Event() + self._availability_finalized_hash = None + self._availability_finalized_blocks = set() + + @property + def store(self): + if self.app.d3l_store is None: + raise DataUnavailable('availability storage is disabled') + return self.app.d3l_store + + def start(self, task_group): + task_group.start_soon(self._assigned_worker) + task_group.start_soon(self._backfill_worker) + self._backfill_wakeup.set() + + def _head(self): + storage = self.app.state_storage + return getattr(storage, 'block_hash', None) or getattr(storage, 'finalized_block_hash', None) + + def _parent(self, block_hash): + if block_hash not in self._parents: + header = self.app.retrieve_block_header(block_hash) + if header is not None: + self._parents[block_hash] = header.parent + else: + parent = getattr(self.app.state_storage, 'parents', {}).get(block_hash) + # A just-committed header may not yet have reached block storage. + # Do not cache an absent parent: storage can become available later. + if parent is not None: + self._parents[block_hash] = parent + return parent + return self._parents[block_hash] + + def _refresh_canonical_head(self): + head = self._head() + if head == self._canonical_head: + return + cursor, path = head, [] + while cursor is not None and cursor not in self._canonical_hashes and len(path) < self.BACKFILL_BATCH_SIZE: + if cursor in path: + cursor = None + break + path.append(cursor) + cursor = self._parent(cursor) + if cursor in self._canonical_hashes: + old = self._canonical_head + removed = 0 + while old is not None and old != cursor and removed < self.BACKFILL_BATCH_SIZE: + self._canonical_hashes.discard(old) + old = self._parents.get(old) + removed += 1 + if old != cursor: + # Do not walk an arbitrarily long discarded branch in one call. + self._canonical_hashes.clear() + self._canonical_cursor = cursor + self._backfill_pending.clear() + self._backfill_pending.extend(reversed(path)) + else: + # A deep reorganization is discovered in bounded batches just like startup. + self._canonical_hashes.clear() + self._canonical_cursor = cursor + self._backfill_pending.clear() + self._backfill_pending.extend(reversed(path)) + self._canonical_head = head + self._canonical_hashes.update(path) + self._backfill_wakeup.set() + + def _lineage(self, head): + """Use persisted headers; finalized state overlays need not retain ancestry.""" + seen = set() + while head is not None and head not in seen: + seen.add(head) + head = self._parent(head) + return seen + + def canonical(self, block_hash): + self._refresh_canonical_head() + return block_hash in self._canonical_hashes + + def source_for(self, **lookup): + try: + return self.store.source_for(**lookup, canonical=self.canonical) + except DataUnavailable: + self._backfill_sources() + key = next(((kind, value) for kind, value in lookup.items() if value is not None), None) + # Known registration/assurance blocks can repair a removed record at + # the same head without rescanning every retained block. + for block_hash in tuple(self._repair_blocks.get(key, ())): + if self.canonical(block_hash): + self._backfill_block(block_hash) + return self.store.source_for(**lookup, canonical=self.canonical) + + def _backfill_sources(self): + """Discover and replay at most one small batch of retained historical context.""" + self._refresh_canonical_head() + for _ in range(self.BACKFILL_BATCH_SIZE): + cursor = self._canonical_cursor + if cursor is None or cursor in self._canonical_hashes: + self._canonical_cursor = None + break + self._canonical_hashes.add(cursor) + self._backfill_pending.appendleft(cursor) + self._canonical_cursor = self._parent(cursor) + if self._canonical_cursor is not None: + return + for _ in range(self.BACKFILL_BATCH_SIZE): + if not self._backfill_pending: + break + block_hash = self._backfill_pending.popleft() + if self.canonical(block_hash): + try: + self._backfill_block(block_hash) + except OSError: + self._backfill_pending.appendleft(block_hash) + raise + + async def _backfill_worker(self): + while True: + await self._backfill_wakeup.wait() + self._backfill_wakeup.clear() + while True: + try: + self._backfill_sources() + except (OSError, DataUnavailable): + logging.exception('Historical availability backfill will retry later') + break + if self._canonical_cursor is None and not self._backfill_pending: + break + await asyncio.sleep(0) + + def _backfill_block(self, block_hash): + block = self.app.retrieve_block_by_hash(block_hash) + if block is None or not block.extrinsic.guarantees and not block.extrinsic.assurances: + return + # The accepted block identifies the records to retry if its historical + # state is restored later. These hints do not establish source metadata. + for guarantee in block.extrinsic.guarantees: + self._remember_source_block(guarantee.report, block_hash) + try: + state = dict(self.app.state_storage.as_list_at(block.header.hash)) + def read(component, codec): + return codec.from_jam_bytes(JamBytes(state[WELL_KNOWN_STORAGE_KEYS[component]])) + pool = read(8, ValidatorPoolState) + archive = read(9, ValidatorArchiveState) + entropy = read(6, EntropyState) + timeslot = TimeslotState(block.header.timeslot) + context = BlockContext() + context.set_guarantor_assignments(entropy, timeslot, pool) + context.set_prev_guarantor_assignments(entropy, timeslot, pool, archive) + self.record_committed(block, pool.validators, archive.validators, context, + self._reported_from_block(block, pool)) + except (KeyError, ValueError, DataUnavailable, ScaleDecodeException, StateTransitionError): + # Missing historical state must not be replaced with the current validator set. + return + + def _reported_from_block(self, block, pool): + if not block.extrinsic.assurances: + return [] + try: + # Reuse 10.14 and 11.17-18; disappearing assignments may also be + # timeouts, disputes or resize, which must not be mistaken for assurance. + parent_state = dict(self.app.state_storage.as_list_at(block.header.parent)) + prior_pool = ValidatorPoolState.from_jam_bytes(JamBytes(parent_state[WELL_KNOWN_STORAGE_KEYS[8]])) + pending = AssurancesState.from_jam_bytes(JamBytes(parent_state[WELL_KNOWN_STORAGE_KEYS[10]])) + rules = Assurances(BlockContext(), AppContext()) + intermediate = rules.state_transition_after_disputes(block.extrinsic.disputes, pending) + return rules.state_transition_after_assurances( + block.extrinsic.assurances, intermediate.intermediate_state_after_disputes, + block.header, prior_pool, pool, + ).reported + except (KeyError, ValueError, DataUnavailable, ScaleDecodeException, StateTransitionError): + return [] # Missing assurance context retains audit payloads conservatively. + + def record_committed(self, block, validators, archived_validators, context, available_reports): + """Called after commit, while verified guarantee assignment identities are known.""" + if self.app.d3l_store is None: + return + self._parents[block.header.hash] = block.header.parent + self._refresh_canonical_head() + for guarantee in block.extrinsic.guarantees: + self._remember_source_block(guarantee.report, block.header.hash) + current = block.header.timeslot // ROTATION_PERIOD_CORE == guarantee.slot // ROTATION_PERIOD_CORE + assignments = context.guarantor_assignments if current else context.prev_guarantor_assignments + previous_epoch = ((block.header.timeslot - ROTATION_PERIOD_CORE) // EPOCH_TIMESLOTS + != block.header.timeslot // EPOCH_TIMESLOTS) + guarantor_set = archived_validators if not current and previous_epoch else validators + by_key = {v.ed25519: v for v in guarantor_set} + guarantors = [by_key[assignments[s.validator_index].validator_ed25519] + for s in guarantee.signatures] + source = AvailabilitySource(guarantee.report, list(validators), guarantors, + block.header.hash, block.header.timeslot) + try: + source = self.store._source(source.identity) + except DataUnavailable: + pass # The committed context can reconstruct a missing source record. + self.store.register_source(source) + self._enqueue(source) + for report in available_reports: + self._remember_source_block(report, block.header.hash) + try: + self.store.mark_assured(report, block.header.hash, block.header.timeslot, self.canonical) + except DataUnavailable: + pass + + def _remember_source_block(self, report, block_hash): + spec = report.package_spec + for kind, value in (('package_hash', spec.hash), ('exports_root', spec.exports_root), + ('erasure_root', spec.erasure_root)): + blocks = self._repair_blocks.setdefault((kind, value), deque(maxlen=self.BACKFILL_BATCH_SIZE)) + if block_hash not in blocks: + blocks.append(block_hash) + + def _enqueue(self, source): + try: + self.assigned_index(source) + except DataUnavailable: + return + finalized_hash = self._availability_finalized_hash + finalized_header = self.app.retrieve_block_header(finalized_hash) if finalized_hash is not None else None + if (finalized_header is not None + and finalized_header.timeslot >= source.registered_slot + 672 * EPOCH_TIMESLOTS + and self._assurance_finalized(source)): + return # Local retention expiry does not affect report validity or import eligibility. + if source.identity not in self._queued: + try: + self._queue.put_nowait(source) + self._queued.add(source.identity) + except asyncio.QueueFull: + logging.info('Availability acquisition queue is full; retry at the next slot') + + def retry_assigned(self): + self._backfill_sources() + for source in self.store.sources(): + if self.canonical(source.registered_block): + self._enqueue(source) + + async def _assigned_worker(self): + while True: + source = await self._queue.get() + try: + await self.acquire_assigned(source) + except (DataUnavailable, ProcessWorkpackageError): + logging.debug('Assigned availability data is not ready', exc_info=True) + except asyncio.CancelledError: + raise + except Exception: + logging.exception('Assigned availability acquisition failed') + finally: + self._queued.discard(source.identity) + self._queue.task_done() + + def on_finalized(self, block_hash): + # Only the application's explicitly confirmed finality path calls this hook. + # Repeated or delayed confirmations must not move trusted availability finality backwards. + if block_hash not in self._availability_finalized_blocks: + self._availability_finalized_hash = block_hash + self._availability_finalized_blocks = self._lineage(block_hash) + block_hash = self._availability_finalized_hash + header = self.app.retrieve_block_header(block_hash) + if header is not None: + self.store.prune(header.timeslot, self.canonical, self._availability_finalized_blocks.__contains__) + + def assigned_index(self, source): + key = self.app.config.keys.ed25519.public_key + for validator_index, validator in enumerate(source.validators): + if validator.ed25519 == key: + # JAMNP-S-e0b7d291:CE137: i=(c*D(v)+validator_index) mod v. + return (source.report.core_index * erasure_data_shards(source.spec.erasure_shards) + + validator_index) % source.spec.erasure_shards + raise DataUnavailable('this node was not an assurer of the source report') + + def assigned_ready(self, source): + try: + index = self.assigned_index(source) + if self._assurance_finalized(source): + self.store._row(source.spec, index) + else: + self.store.retrieve_validator_shard(source.spec, index) + return True + except DataUnavailable: + return False + + def _assurance_finalized(self, source): + return source.assured_block is not None and source.assured_block in self._availability_finalized_blocks + + async def _request(self, method, *args, **kwargs): + protocol = getattr(self.app, 'protocol', None) + if protocol is None: + raise DataUnavailable('availability transport is not started') + try: + async with asyncio.timeout(self.REQUEST_TIMEOUT): + return await getattr(protocol, method)(*args, **kwargs) + except (TimeoutError, OSError, ConnectionError, ValueError) as exc: + raise DataUnavailable('availability peer request failed') from exc + + async def acquire_assigned(self, source): + if not self.canonical(source.registered_block): + raise DataUnavailable('source is no longer on the active branch') + index = self.assigned_index(source) + if self.assigned_ready(source): + return + with self.store.hold(source.spec.erasure_root): + for peer in source.guarantors: + try: + shard = await self._request('request_validator_shard', peer, source.spec, index) + if shard.shard_index != index: + raise DataUnavailable('peer returned a different assigned shard') + if not self.canonical(source.registered_block): + raise DataUnavailable('source branch changed during acquisition') + self.store.store_validator_shard(source.spec, shard) + return + except (DataUnavailable, ProcessWorkpackageError): + continue + raise DataUnavailable('assigned shard is unavailable') + + async def acquire_package_imports(self, package, mappings): + # GP-0.8.0-eq:14.15: one acquisition per (root,index); BundleData restores manifest order. + needed = {(resolve_import_root(mappings, import_reference(entry)), entry.segment_index) + for item in package.items for entry in item.import_segments} + page_cache = {} + for root, index in sorted(needed): + try: + self._local_import(root, index) + except DataUnavailable: + await self.acquire_import(root, index, page_cache=page_cache) + + def _local_import(self, root, index): + try: + return self.store.retrieve_import(root, index) + except DataUnavailable: + stored = [bytes(segment) for segment in self.store.retrieve_segments(root).segments] + tree = ConstantDepthMerkleTree(stored) + if tree.root() != root: + raise DataUnavailable('stored export segments do not match their root') + if not 0 <= index < len(stored): + raise ProcessWorkpackageError('import segment index out of range') + imported = ImportedSegment(stored[index], tuple(tree.trace(index))) + try: + verify_import(root, index, imported) + except ProcessWorkpackageError as exc: + raise DataUnavailable('stored export segment is invalid') from exc + return imported + + async def acquire_import(self, root, index, *, page_cache=None): + try: + return self._local_import(root, index) + except DataUnavailable: + pass + source = self.source_for(exports_root=root) + spec = source.spec + if not 0 <= index < spec.exports_count: + raise ProcessWorkpackageError('import segment index out of range') + with self.store.hold(spec.erasure_root): + for peer in source.guarantors: + try: + imports = await self._request('request_segments', peer, root, [index]) + if len(imports) != 1: + raise DataUnavailable('incorrect complete-segment response count') + imported = imports[0] + verify_import(root, index, imported) + return self._store_acquired(source, index, imported) + except (DataUnavailable, ProcessWorkpackageError): + continue + # JAMNP-S-e0b7d291:CE139/140: fast reconstruction, then individually proven retry. + for proven in (False, True): + imported = await self._coded_import(source, index, proven, page_cache) + if imported is not None: + return self._store_acquired(source, index, imported) + raise DataUnavailable('not enough source shards to recover the import') + + def _store_acquired(self, source, index, imported): + if not self.canonical(source.registered_block): + raise DataUnavailable('source branch changed during recovery') + self.store.store_import(source.spec.exports_root, index, imported) + return imported + + async def _coded_import(self, source, index, proven, page_cache): + spec = source.spec + threshold = erasure_data_shards(spec.erasure_shards) + page_index = spec.exports_count + index // 64 + page_key = (source.identity, page_index, proven) + pages = dict((page_cache or {}).get(page_key, {})) + chunks = {} + semaphore = asyncio.Semaphore(self.REQUESTS_IN_FLIGHT) + + async def fetch(shard_index): + # Invert the report's assignment; historical endpoints come from its original set. + owner = (shard_index - source.report.core_index * threshold) % spec.erasure_shards + indices = [index] if shard_index in pages else [index, page_index] + try: + async with semaphore: + values = await self._request('request_segment_shards', source.validators[owner], spec, + shard_index, indices, proven=proven) + if len(values) != len(indices): + return None + for segment_index, (chunk, proof) in zip(indices, values): + if proven: + verify_segment_shard(chunk, segment_index, shard_index, proof, spec) + return shard_index, dict(zip(indices, [chunk for chunk, _ in values])) + except (DataUnavailable, ProcessWorkpackageError, ValueError): + return None + + # Only four live tasks. Stop outstanding requests as soon as a threshold is available. + remaining = iter(range(spec.erasure_shards)) + pending = set() + def schedule(): + for _ in range(self.REQUESTS_IN_FLIGHT - len(pending)): + shard_index = next(remaining, None) + if shard_index is not None: + pending.add(asyncio.create_task(fetch(shard_index))) + schedule() + try: + while pending: + done, pending = await asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED) + for task in done: + result = task.result() + if result is not None: + shard_index, values = result + chunks[shard_index] = values[index] + if page_index in values: + pages[shard_index] = values[page_index] + if len(chunks) >= threshold and len(pages) >= threshold: + try: + imported = recover_import(spec, index, chunks, proof_page_shards=pages) + except ProcessWorkpackageError: + if proven: + raise ProcessWorkpackageError('individually proven shards contradict the source commitment') + return None + if page_cache is not None: + page_cache[page_key] = pages + return imported + schedule() + finally: + for task in pending: + task.cancel() + await asyncio.gather(*pending, return_exceptions=True) + return None + + async def authorize_submission(self, peer_key, core_index, package, mappings): + pipeline = self.app.runtime.refine_pipeline + authorization = await pipeline.authorize_submission(core_index, package) + known = pipeline._segment_root_lookup(package, self.app.working_state) + if mappings and mappings != known: + raise ProcessWorkpackageError('submitted mappings conflict with known reports') + return StagedSubmission(authorization, package, known) + + async def complete_submission(self, context, kind, messages): + from pyjamaz.transport.jamnp_messages import decode_import_proofs + + pipeline = self.app.runtime.refine_pipeline + if not pipeline._authorization_current(context.authorization, context.package): + raise DataUnavailable('submission authorization became stale') + package = context.package + # The transport supplies only the remaining payloads, after the authorized prefix. + if kind == 133: + if len(messages) != 1 or any(item.import_segments for item in package.items): + raise ProcessWorkpackageError('CE133 requires an import-free package') + extrinsic_bytes, segment_bytes, proofs = messages[0], b'', [] + elif kind == 146: + if len(messages) != 3: + raise ProcessWorkpackageError('incomplete CE146 submission') + extrinsic_bytes, segment_bytes = messages[:2] + proofs = decode_import_proofs(messages[2], sum(len(item.import_segments) for item in package.items)) + else: + raise ProcessWorkpackageError('unsupported submission stream') + extrinsics, offset = [], 0 + for item in package.items: + for entry in item.extrinsic: + extrinsics.append(extrinsic_bytes[offset:offset + entry.len]) + offset += entry.len + if offset != len(extrinsic_bytes) or len(segment_bytes) % EC_SEGMENT_SIZE: + raise ProcessWorkpackageError('invalid submitted data lengths') + segments = [segment_bytes[start:start + EC_SEGMENT_SIZE] + for start in range(0, len(segment_bytes), EC_SEGMENT_SIZE)] + try: + raw = encode_bundle(package, extrinsics, segments, proofs) + parts = decode_bundle(raw) + from pyjamaz.availability import BundleData + data = BundleData.from_parts(package, parts.extrinsics, parts.segments, parts.justifications) + data.assemble_bundle(package, context.mappings) + except ValueError as exc: + raise ProcessWorkpackageError(str(exc)) from exc + pipeline.add_work_package(package, extrinsics, core_index=context.authorization.core_index, + bundle=raw, authorization_context=context.authorization) + return [] + + def _authorize_read(self, peer_key, spec): + try: + source = self.source_for(erasure_root=spec.erasure_root) + participants = source.validators + source.guarantors + except DataUnavailable: + # Locally generated data is served to its current assurers before report registration. + participants = self.app.working_state.validator_pool.validators + if peer_key not in {v.ed25519 for v in participants}: + raise ProcessWorkpackageError('peer is not a participant in the source report') + + async def handle_request(self, peer_key, kind, messages): + from pyjamaz.transport.jamnp_messages import ( + decode_segment_indices, decode_segment_requests, encode_import_proofs, encode_justification, + ) + + if len(messages) != 1: + raise ProcessWorkpackageError('availability request requires one message') + request = messages[0] + if kind in (137, 138, 147): + if len(request) != (32 if kind == 147 else 34): + raise ProcessWorkpackageError('invalid shard request length') + spec = self.store.specification(request[:32], self.canonical) + self._authorize_read(peer_key, spec) + with self.store.hold(spec.erasure_root): + if kind == 147: + return [self.store._retrieve(b'bundle:' + spec.hash, 'audit bundle is unavailable')] + index = int.from_bytes(request[32:], 'little') + shard = self.store.retrieve_validator_shard(spec, index) + if kind == 137: + return [shard.bundle_shard, b''.join(shard.segment_shards), encode_justification(shard.justification)] + return [shard.bundle_shard, encode_justification(audit_shard_justification(shard))] + if kind in (139, 140): + groups = decode_segment_requests(request) + if sum(len(indices) for _, _, indices in groups) > 2 * MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE: + raise ProcessWorkpackageError('too many requested segment chunks') + chunks, proofs = [], [] + for root, shard_index, indices in groups: + spec = self.store.specification(root, self.canonical) + self._authorize_read(peer_key, spec) + with self.store.hold(root): + for index in indices: + chunk, proof = self.store.retrieve_segment_shard(spec, shard_index, index) + chunks.append(chunk) + if kind == 140: + proofs.append(encode_justification(proof, EC_SEGMENT_SIZE // erasure_data_shards(spec.erasure_shards))) + return [b''.join(chunks)] + proofs + if kind == 148: + groups = decode_segment_indices(request) + if sum(len(indices) for _, indices in groups) > MAXIMUM_NUMBER_EXPORTS_WORK_PACKAGE: + raise ProcessWorkpackageError('too many requested segments') + imports = [] + for root, indices in groups: + source = self.source_for(exports_root=root) + self._authorize_read(peer_key, source.spec) + with self.store.hold(source.spec.erasure_root): + imports.extend(self._local_import(root, index) for index in indices) + return [b''.join(item.segment for item in imports), + encode_import_proofs([item.justification for item in imports])] + raise ProcessWorkpackageError('unsupported availability stream') diff --git a/pyjamaz/runtime/node_runtime.py b/pyjamaz/runtime/node_runtime.py index 2b611113..277c786a 100644 --- a/pyjamaz/runtime/node_runtime.py +++ b/pyjamaz/runtime/node_runtime.py @@ -9,6 +9,7 @@ from pyjamaz.models.common import Guarantee from pyjamaz.runtime.pipelines.refine import RefinePipeline from pyjamaz.runtime.pipelines.accumulate import AccumulatePipeline +from pyjamaz.runtime.availability import AvailabilityRuntime from pyjamaz.settings import DEBUG @@ -18,6 +19,7 @@ def __init__(self, app: PyjamazApp): self._started = False self.refine_pipeline = RefinePipeline(app) self.accumulate_pipeline = AccumulatePipeline(app) + self.availability = AvailabilityRuntime(app) def start(self, task_group: TaskGroup): if self._started: @@ -26,6 +28,7 @@ def start(self, task_group: TaskGroup): self.refine_pipeline.start(task_group) self.accumulate_pipeline.start(task_group) + self.availability.start(task_group) task_group.start_soon(self._timeslot_worker) async def _timeslot_worker(self) -> None: @@ -33,6 +36,11 @@ async def _timeslot_worker(self) -> None: timeslot = self.app.current_timeslot() await self.refine_pipeline.notify_timeslot(timeslot=timeslot) await self.accumulate_pipeline.notify_timeslot(timeslot=timeslot) + if self.app.d3l_store is not None: + try: + self.availability.retry_assigned() + except Exception: + logging.exception('Could not retry availability acquisition') DEBUG and logging.debug(f"⏳️ Timeslot worker: {timeslot}") await anyio.sleep(max(0.01, self.app.get_next_slot_timestamp() - time.time() + 0.01)) diff --git a/pyjamaz/runtime/pipelines/refine.py b/pyjamaz/runtime/pipelines/refine.py index c9a43958..93bfc554 100644 --- a/pyjamaz/runtime/pipelines/refine.py +++ b/pyjamaz/runtime/pipelines/refine.py @@ -2,13 +2,16 @@ import logging from asyncio import TaskGroup from copy import deepcopy +from dataclasses import dataclass from typing import Dict, List import anyio from pyjamaz.app import PyjamazApp from pyjamaz.availability import BundleData, DataUnavailable, import_reference, resolve_import_root, validate_work_package +from pyjamaz.bundle import decode_bundle from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.graypaper_constants import CORE_COUNT from pyjamaz.merkle import ConstantDepthMerkleTree from pyjamaz.refinement import Refinement from pyjamaz.constants import MESSAGE_TYPES @@ -21,6 +24,18 @@ from pyjamaz.utils import format_hash +@dataclass +class AuthorizedSubmission: + """Local Psi_I result bound to the exact inputs used for a Refine attempt.""" + package_hash: bytes + core_index: int + head_hash: bytes + head_root: bytes + validator_keys: tuple[bytes, ...] + services: object + authorization: object + + class RefinePipeline: def __init__(self, app: PyjamazApp, queue_size: int = 4096): @@ -43,16 +58,23 @@ def start(self, task_group: TaskGroup): task_group.start_soon(self._timeslot_worker) task_group.start_soon(self._guarantuee_worker) - def add_work_package(self, work_package: WorkPackage, extrinsics: List[bytes]): + def add_work_package(self, work_package: WorkPackage, extrinsics: List[bytes], *, + core_index: int | None = None, bundle: bytes | None = None, + authorization_context: AuthorizedSubmission | None = None): + if core_index is not None and (isinstance(core_index, bool) or not isinstance(core_index, int) + or not 0 <= core_index < CORE_COUNT): + raise ProcessWorkpackageError("invalid core index") work_package = deepcopy(work_package) self._pending_work_packages[work_package.hash()] = WorkPackageQueueItem( work_package=work_package, status=WorkPackageStatus( Reportable=WorkPackageReportableStatus( remaining_blocks=4 ) - ) + ), core_index=core_index, bundle=bundle, ) + self._pending_work_packages[work_package.hash()].authorization_context = authorization_context + self._work_package_extrinsics.add(work_package, extrinsics) logging.info(f"📥 Added work package to queue: {format_hash(work_package.hash())}") @@ -89,6 +111,8 @@ async def _timeslot_worker(self) -> None: # Find first authorized work package for h, w in self._pending_work_packages.items(): if w.status.enum_value()[0] == 'Reportable': + if w.core_index is not None and w.core_index != self.app.get_core_assigment(): + continue if self.app.working_state.authorizer_pools.is_authorized( w.work_package, self.app.get_core_assigment() ): @@ -101,8 +125,7 @@ async def _timeslot_worker(self) -> None: finally: self._timeslot_queue.task_done() - def _segment_root_lookup(self, package: WorkPackage, state) -> dict[bytes, bytes]: - # GP-0.8.0-eq:14.14: the runtime supplies the known package-to-export-root correspondence. + def _reported_mappings(self, state) -> dict[bytes, bytes]: known = {} for block in state.recent_history.recent_blocks: known.update({report.hash: report.exports_root for report in block.reported}) @@ -110,6 +133,11 @@ def _segment_root_lookup(self, package: WorkPackage, state) -> dict[bytes, bytes if pending.work_report is not None: spec = pending.work_report.package_spec known[spec.hash] = spec.exports_root + return known + + def _segment_root_lookup(self, package: WorkPackage, state) -> dict[bytes, bytes]: + # GP-0.8.0-eq:14.14: the runtime supplies the known package-to-export-root correspondence. + known = self._reported_mappings(state) mappings = {} for item in package.items: for entry in item.import_segments: @@ -117,12 +145,41 @@ def _segment_root_lookup(self, package: WorkPackage, state) -> dict[bytes, bytes if entry.tree_root in known: mappings[entry.tree_root] = known[entry.tree_root] elif self.app.d3l_store is not None: + availability = getattr(getattr(self.app, 'runtime', None), 'availability', None) + if availability is not None: + try: + mappings[entry.tree_root] = availability.source_for(package_hash=entry.tree_root).spec.exports_root + continue + except DataUnavailable: + pass + # Retain authoritative mappings written by successful local report computation. mappings[entry.tree_root] = self.app.d3l_store.segment_root_for_package(entry.tree_root) else: raise DataUnavailable("segment-root mapping is unavailable") return mappings + def _validate_import_sources(self, package: WorkPackage, mappings: dict[bytes, bytes], state) -> None: + # GP-0.8.0-sec:14.4 (after eq:14.17): imported roots must be known before Psi_R. + # This is runtime acquisition policy, outside the pure Xi calculation. The 672-epoch + # retention minimum is not an expiry rule for otherwise known, available imports. + known = set(self._reported_mappings(state).values()) | set(mappings.values()) + roots = {resolve_import_root(mappings, import_reference(entry)) + for item in package.items for entry in item.import_segments} + availability = getattr(getattr(self.app, 'runtime', None), 'availability', None) + for root in roots - known: + if self.app.d3l_store is not None: + try: + self.app.d3l_store.local_report_for_exports(root) + continue + except DataUnavailable: + pass + if availability is not None: + availability.source_for(exports_root=root) + else: + raise DataUnavailable('import source is unknown') + def _bundle_data(self, package: WorkPackage, mappings: dict[bytes, bytes]) -> BundleData: + # GP-0.8.0-eq:14.15-14.16: acquire S_l(w) and J_l(w) in manifest order for B(p,l). extrinsics, segments, proofs = [], [], [] stored_trees = {} for item in package.items: @@ -135,11 +192,19 @@ def _bundle_data(self, package: WorkPackage, mappings: dict[bytes, bytes]) -> Bu root = resolve_import_root(mappings, import_reference(entry)) if self.app.d3l_store is None: raise DataUnavailable("imported segments are unavailable") + try: + imported = self.app.d3l_store.retrieve_import(root, entry.segment_index) + except DataUnavailable: + pass + else: + segments.append(imported.segment) + proofs.append(imported.justification) + continue if root not in stored_trees: stored = self.app.d3l_store.retrieve_segments(root).segments tree = ConstantDepthMerkleTree(stored) if tree.root() != root: - raise ProcessWorkpackageError("stored segments do not match their root") + raise DataUnavailable("stored segments do not match their root") stored_trees[root] = (stored, tree) stored, tree = stored_trees[root] if entry.segment_index >= len(stored): @@ -161,6 +226,7 @@ def _view_is_committed(state, head_hash: bytes) -> bool: def _retry(item: WorkPackageQueueItem) -> None: item.work_report = None item.signatures.clear() + item.authorization_context = None item.status = WorkPackageStatus(Reportable=WorkPackageReportableStatus(remaining_blocks=4)) async def _refine_worker(self) -> None: @@ -185,13 +251,41 @@ async def _refine_worker(self) -> None: finally: self._refine_queue.task_done() + async def authorize_submission(self, core_index: int, package: WorkPackage) -> AuthorizedSubmission: + """Authorize a staged submission before its extrinsics/import messages are received.""" + state = self.app.working_state + if core_index != self.app.get_core_assigment(): + raise ProcessWorkpackageError("work package targets an unassigned core") + head_hash = self.app.retrieve_block_hash(state.timeslot.number) + if head_hash is None or not self._view_is_committed(state, head_hash): + raise DataUnavailable("refinement state is not committed") + keys = self._validator_keys(state) + root = state.state_root + services = state.services.snapshot() + owned_package = deepcopy(package) + execution = Refinement(services, BundleData()) + authorization = await asyncio.to_thread(execution.authorize, owned_package, core_index) + context = AuthorizedSubmission(package.hash(), core_index, head_hash, root, keys, services, authorization) + if not self._authorization_current(context, package): + raise DataUnavailable("refinement state changed during authorization") + return context + + def _authorization_current(self, context: AuthorizedSubmission, package: WorkPackage) -> bool: + state = self.app.working_state + return (context.package_hash == package.hash() + and context.core_index == self.app.get_core_assigment() + and context.head_hash == self.app.retrieve_block_hash(state.timeslot.number) + and context.head_root == state.state_root + and context.validator_keys == self._validator_keys(state) + and self._view_is_committed(state, context.head_hash)) + async def _refine_work_package(self, item: WorkPackageQueueItem) -> None: # Capture every input before dispatch; the worker must not follow a live state view. state = self.app.working_state package = deepcopy(item.work_package) validate_work_package(package) core = self.app.get_core_assigment() - if core is None: + if core is None or (item.core_index is not None and item.core_index != core): self._retry(item) return head_root = state.state_root @@ -201,11 +295,36 @@ async def _refine_work_package(self, item: WorkPackageQueueItem) -> None: self._retry(item) return validator_keys = self._validator_keys(state) + context = item.authorization_context + if context is not None and self._authorization_current(context, package): + execution = Refinement(context.services, BundleData()) + authorization = context.authorization + else: + execution = Refinement(state.services.snapshot(), BundleData()) + authorization = await asyncio.to_thread(execution.authorize, package, core) + # GP-0.8.0-eq:14.13: Psi_I has succeeded before X/S_l/J_l acquisition. mappings = self._segment_root_lookup(package, state) - data = self._bundle_data(package, mappings) - execution = Refinement(state.services.snapshot(), data) + self._validate_import_sources(package, mappings, state) + if item.bundle is not None: + try: + parts = decode_bundle(item.bundle) + if parts.package != package: + raise ValueError("bundle package differs from queued package") + data = BundleData.from_parts(package, parts.extrinsics, parts.segments, parts.justifications) + except ValueError as exc: + raise ProcessWorkpackageError(str(exc)) from exc + else: + try: + data = self._bundle_data(package, mappings) + except DataUnavailable: + availability = getattr(getattr(self.app, 'runtime', None), 'availability', None) + if availability is None: + raise + await availability.acquire_package_imports(package, mappings) + data = self._bundle_data(package, mappings) + execution.data = data report = await anyio.to_thread.run_sync( - execution.compute_work_report, package, core, mappings, len(validator_keys), + execution._compute_authorized_report, package, core, mappings, len(validator_keys), authorization, ) # A changed branch or validator/core assignment needs a fresh guarantee view. @@ -216,7 +335,8 @@ async def _refine_work_package(self, item: WorkPackageQueueItem) -> None: self._retry(item) return if self.app.d3l_store is not None: - self.app.d3l_store.store_work_report(report, execution.bundle, execution.exported_segments) + self.app.d3l_store.store_work_report(report, execution.bundle, execution.exported_segments, + artifacts=execution.artifacts) item.work_report = report item.status = WorkPackageStatus(Reported=WorkPackageReportedStatus( reported_in=BlockDesc(slot=slot, header_hash=head_hash), core=core, report_hash=report.hash(), diff --git a/pyjamaz/runtime/types.py b/pyjamaz/runtime/types.py index e99b3297..200ebc22 100644 --- a/pyjamaz/runtime/types.py +++ b/pyjamaz/runtime/types.py @@ -2,7 +2,7 @@ from dataclasses import dataclass, field from jamcodec.mixins import Serializable -from jamcodec.types import H256 +from jamcodec.types import Bytes, H256, Option, U16 from pyjamaz.models.common import WorkPackage, WorkPackageStatus, WorkReport, Credential, Guarantee @@ -12,6 +12,17 @@ class WorkPackageQueueItem(Serializable): status: WorkPackageStatus = field(metadata={'codec': WorkPackageStatus.to_codec_def()}) work_report: typing.Optional[WorkReport] = field(default=None, metadata={'codec': WorkReport.to_codec_def()}) signatures: list[Credential] = field(default_factory=list, metadata={'codec': Credential.to_codec_def()}) + core_index: typing.Optional[int] = field(default=None, metadata={'codec': Option(U16)}) + bundle: typing.Optional[bytes] = field(default=None, metadata={'codec': Option(Bytes)}) + + @property + def authorization_context(self): + """A local snapshot-bound authorization; never part of a wire message.""" + return getattr(self, '_authorization_context', None) + + @authorization_context.setter + def authorization_context(self, value): + self._authorization_context = value def create_guarantee(self, slot: int) -> Guarantee: return Guarantee( diff --git a/pyjamaz/storage.py b/pyjamaz/storage.py index 11dd88eb..2a5c0211 100644 --- a/pyjamaz/storage.py +++ b/pyjamaz/storage.py @@ -1,4 +1,5 @@ import os +import tempfile from pathlib import Path from typing import Optional @@ -224,15 +225,29 @@ def __init__(self, file_path: str): def put(self, key: bytes, value: bytes): - with open(os.path.join(self.file_path, f'{key.hex()}.bin'), 'wb') as f: - f.write(value) + # Publish complete records atomically, including across a node restart. + destination = Path(self.file_path) / f'{key.hex()}.bin' + with tempfile.NamedTemporaryFile(dir=self.file_path, delete=False) as stream: + temporary = stream.name + try: + stream.write(value) + stream.flush() + os.fsync(stream.fileno()) + except BaseException: + os.unlink(temporary) + raise + try: + os.replace(temporary, destination) + finally: + if os.path.exists(temporary): + os.unlink(temporary) def get(self, key: bytes) -> bytes: with open(os.path.join(self.file_path, f'{key.hex()}.bin'), 'rb') as f: return f.read() def delete(self, key: bytes): - file_path = Path(self.file_path) / key.hex() + file_path = Path(self.file_path) / f'{key.hex()}.bin' if file_path.exists(): file_path.unlink() diff --git a/pyjamaz/transport/cert.py b/pyjamaz/transport/cert.py index d46e490d..99151690 100644 --- a/pyjamaz/transport/cert.py +++ b/pyjamaz/transport/cert.py @@ -1,68 +1,54 @@ +"""JAMNP-S e0b7d291 Ed25519 transport identities.""" + +from datetime import datetime, timedelta, timezone + from cryptography import x509 -from cryptography.x509.oid import ExtendedKeyUsageOID as EKU, NameOID -from cryptography.hazmat.primitives.asymmetric import ed25519 from cryptography.hazmat.primitives import serialization -from ipaddress import ip_address -from datetime import datetime, timedelta - +from cryptography.hazmat.primitives.asymmetric import ed25519 +from cryptography.x509.oid import NameOID, SignatureAlgorithmOID -def generate_cert(keys, ips: str, alternative_name: str): - priv = ed25519.Ed25519PrivateKey.from_private_bytes(keys.ed25519.private_key) +from pyjamaz.utils import quic_peer_id - sans = [x509.IPAddress(ip_address(ip.strip())) - for ip in ips.split(",") if ip.strip()] - sans.append(x509.DNSName(alternative_name)) +def generate_cert(keys, ips: str, alternative_name: str): + # JAMNP-S v1: the only SAN is the DNS name derived from the public key. + # Keep ips in this existing CLI interface; IP SANs are no longer permitted. + private = ed25519.Ed25519PrivateKey.from_private_bytes(keys.ed25519.private_key) + public = private.public_key().public_bytes(serialization.Encoding.Raw, serialization.PublicFormat.Raw) + if alternative_name != quic_peer_id(public): + raise ValueError("certificate name does not match the Ed25519 key") name = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "jamnps-node")]) - - cert = ( - x509.CertificateBuilder() - .subject_name(name).issuer_name(name) - .public_key(priv.public_key()) - .serial_number(x509.random_serial_number()) - .not_valid_before(datetime.utcnow() - timedelta(minutes=5)) - .not_valid_after(datetime.utcnow() + timedelta(days=365)) - # ---- LEAF EXTENSIONS – **none** of them critical ------------------- - # .add_extension( - # x509.BasicConstraints(ca=False, path_length=None), critical=False - # ) - # .add_extension( - # x509.KeyUsage( - # digital_signature=True, - # key_encipherment=False, - # content_commitment=False, - # data_encipherment=False, - # key_agreement=False, - # key_cert_sign=False, - # crl_sign=False, - # encipher_only=False, - # decipher_only=False, - # ), - # critical=False, - # ) - # .add_extension( - # x509.ExtendedKeyUsage([EKU.SERVER_AUTH]), critical=False - # ) - .add_extension( - x509.SubjectAlternativeName(sans), critical=False - ) - .sign(priv, algorithm=None) - ) - - return ( - priv.private_bytes( - serialization.Encoding.PEM, - serialization.PrivateFormat.PKCS8, - serialization.NoEncryption(), - ), - cert.public_bytes(serialization.Encoding.PEM), - ) + now = datetime.now(timezone.utc) + certificate = (x509.CertificateBuilder().subject_name(name).issuer_name(name) + .public_key(private.public_key()).serial_number(x509.random_serial_number()) + .not_valid_before(now - timedelta(minutes=5)).not_valid_after(now + timedelta(days=365)) + .add_extension(x509.SubjectAlternativeName([x509.DNSName(alternative_name)]), critical=False) + .sign(private, algorithm=None)) + return (private.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, + serialization.NoEncryption()), + certificate.public_bytes(serialization.Encoding.PEM)) + + +def validate_peer_certificate(certificate: x509.Certificate, expected_key: bytes | None = None) -> bytes: + """Check the v1 identity; TLS separately verifies possession of the key.""" + if certificate is None or not isinstance(certificate.public_key(), ed25519.Ed25519PublicKey): + raise ValueError("peer did not present an Ed25519 certificate") + if certificate.signature_algorithm_oid != SignatureAlgorithmOID.ED25519: + raise ValueError("peer certificate is not signed with Ed25519") + public = certificate.public_key().public_bytes(serialization.Encoding.Raw, serialization.PublicFormat.Raw) + if expected_key is not None and public != expected_key: + raise ValueError("peer certificate does not match the expected validator") + try: + names = list(certificate.extensions.get_extension_for_class(x509.SubjectAlternativeName).value) + except x509.ExtensionNotFound as exc: + raise ValueError("peer certificate has no subject alternative name") from exc + if len(names) != 1 or not isinstance(names[0], x509.DNSName) or names[0].value != quic_peer_id(public): + raise ValueError("peer certificate has an invalid JAMNP-S subject alternative name") + return public def write_cert(pk_pem, pk_file, cert_pem, cert_file): - - with open(pk_file, 'wb') as f: - f.write(pk_pem) - - with open(cert_file, 'wb') as f: - f.write(cert_pem) + with open(pk_file, "wb") as file: + file.write(pk_pem) + with open(cert_file, "wb") as file: + file.write(cert_pem) diff --git a/pyjamaz/transport/jamnp_messages.py b/pyjamaz/transport/jamnp_messages.py new file mode 100644 index 00000000..5e81b40b --- /dev/null +++ b/pyjamaz/transport/jamnp_messages.py @@ -0,0 +1,142 @@ +"""Small codecs for JAMNP-S v1, pinned to simple.md at e0b7d291. + +Stream framing uses fixed little-endian u32 lengths. Protocol len++ fields use +canonical JAM natural numbers. Proof items retain their wire tags. +""" + +from jamcodec.base import JamBytes +from jamcodec.types import VarInt64 + + +class InvalidJAMNPSMessage(ValueError): + pass + + +def frame(message: bytes) -> bytes: + return len(message).to_bytes(4, "little") + message + + +def read_count(stream: JamBytes, maximum: int) -> int: + start = stream.offset + count = VarInt64.decode(stream) + if count > maximum or bytes(stream.data[start:stream.offset]) != VarInt64.encode(count).to_bytes(): + raise InvalidJAMNPSMessage("invalid or noncanonical count") + return count + + +def encode_justification(proof, segment_shard_size: int | None = None) -> bytes: + if len(proof) > 32: + raise InvalidJAMNPSMessage("too many proof items") + encoded = [] + for item in proof: + if len(item) == 32: + tag = 0 + elif len(item) == 64: + tag = 1 + elif segment_shard_size is not None and len(item) == segment_shard_size: + tag = 2 + else: + raise InvalidJAMNPSMessage("invalid proof item size") + encoded.append(bytes([tag]) + item) + return b"".join(encoded) + + +def decode_justification(data: bytes, segment_shard_size: int | None = None) -> tuple[bytes, ...]: + stream = JamBytes(data) + proof = [] + try: + while stream.get_remaining_length(): + tag = stream.get_next_bytes(1)[0] + size = {0: 32, 1: 64, 2: segment_shard_size}.get(tag) + if size is None or len(proof) == 32: + raise InvalidJAMNPSMessage("invalid proof tag or item count") + proof.append(bytes(stream.get_next_bytes(size))) + except Exception as exc: + raise InvalidJAMNPSMessage("malformed justification") from exc + return tuple(proof) + + +def _encode_indices(indices) -> bytes: + if not indices or any(isinstance(i, bool) or not isinstance(i, int) or not 0 <= i <= 65535 for i in indices): + raise InvalidJAMNPSMessage("invalid segment indices") + return VarInt64.encode(len(indices)).to_bytes() + b"".join(i.to_bytes(2, "little") for i in indices) + + +def encode_segment_request(root: bytes, shard_index: int, indices) -> bytes: + if len(root) != 32 or not 0 <= shard_index <= 65535 or len(indices) > 6144: + raise InvalidJAMNPSMessage("invalid coded segment request") + return root + shard_index.to_bytes(2, "little") + _encode_indices(indices) + + +def encode_segment_indices(root: bytes, indices) -> bytes: + if len(root) != 32 or len(indices) > 3072: + raise InvalidJAMNPSMessage("invalid complete segment request") + return root + _encode_indices(indices) + + +def _decode_requests(data: bytes, with_shard: bool): + stream, result, total = JamBytes(data), [], 0 + maximum = 6144 if with_shard else 3072 + try: + while stream.get_remaining_length(): + root = bytes(stream.get_next_bytes(32)) + shard = int.from_bytes(stream.get_next_bytes(2), "little") if with_shard else None + count = read_count(stream, maximum - total) + if not count: + raise InvalidJAMNPSMessage("empty segment request") + indices = tuple(int.from_bytes(stream.get_next_bytes(2), "little") for _ in range(count)) + result.append((root, shard, indices) if with_shard else (root, indices)) + total += count + if not result: + raise InvalidJAMNPSMessage("empty segment request") + except Exception as exc: + raise InvalidJAMNPSMessage("malformed segment request") from exc + return result + + +def decode_segment_requests(data: bytes): + return _decode_requests(data, True) + + +def decode_segment_indices(data: bytes): + return _decode_requests(data, False) + + +def encode_import_proofs(proofs) -> bytes: + if any(len(proof) > 12 or any(len(value) != 32 for value in proof) for proof in proofs): + raise InvalidJAMNPSMessage("invalid import proofs") + return b"".join(VarInt64.encode(len(proof)).to_bytes() + b"".join(proof) for proof in proofs) + + +def decode_import_proofs(data: bytes, count: int) -> tuple[tuple[bytes, ...], ...]: + stream = JamBytes(data) + try: + proofs = tuple(tuple(bytes(stream.get_next_bytes(32)) for _ in range(read_count(stream, 12))) + for _ in range(count)) + if stream.get_remaining_length(): + raise InvalidJAMNPSMessage("trailing import proof data") + except Exception as exc: + raise InvalidJAMNPSMessage("malformed import proofs") from exc + return proofs + + +def split_segments(data: bytes, count: int, size: int = 4104) -> tuple[bytes, ...]: + if len(data) != count * size: + raise InvalidJAMNPSMessage("incorrect segment payload length") + return tuple(data[i * size:(i + 1) * size] for i in range(count)) + + +def decode_mappings(data: bytes) -> dict[bytes, bytes]: + stream = JamBytes(data) + mappings = {} + try: + for _ in range(read_count(stream, 8)): + package, root = bytes(stream.get_next_bytes(32)), bytes(stream.get_next_bytes(32)) + if package in mappings: + raise InvalidJAMNPSMessage("duplicate package mapping") + mappings[package] = root + if stream.get_remaining_length(): + raise InvalidJAMNPSMessage("trailing package mappings") + except Exception as exc: + raise InvalidJAMNPSMessage("malformed package mappings") from exc + return mappings diff --git a/pyjamaz/transport/protocol_jamnp_s.py b/pyjamaz/transport/protocol_jamnp_s.py index 7cea136b..f9e8c745 100644 --- a/pyjamaz/transport/protocol_jamnp_s.py +++ b/pyjamaz/transport/protocol_jamnp_s.py @@ -1,386 +1,653 @@ +"""JAMNP-S v1 transport, pinned to jam-np/simple.md at e0b7d291. + +The transport authenticates peers and owns framing. AvailabilityRuntime owns +source eligibility, retained data and submission authorization. Each CE stream +has an independent bounded reader; successful requests finish both directions. +""" + +import asyncio +import ipaddress import logging import ssl -from doctest import debug -from enum import Enum - -from typing import Dict, Optional -from typing import Optional, cast +from enum import IntEnum from aioquic.asyncio import QuicConnectionProtocol, serve -from aioquic.quic.configuration import QuicConfiguration -from aioquic.quic.events import QuicEvent, StreamDataReceived, ConnectionTerminated, HandshakeCompleted -from aioquic.quic.logger import QuicFileLogger -from aioquic.tls import SessionTicket - from aioquic.asyncio.client import connect +from aioquic.quic.configuration import QuicConfiguration +from aioquic.quic.events import ( + ConnectionTerminated, HandshakeCompleted, StopSendingReceived, + StreamDataReceived, StreamReset, +) from jamcodec.base import JamBytes -from jamcodec.types import Vec +from jamcodec.types import VarInt64, Vec +from pyjamaz.availability import ( + ImportedSegment, ValidatorShard, verify_audit_shard, verify_import, + verify_segment_shard, verify_validator_shard, +) +from pyjamaz.bundle import decode_bundle, decode_package from pyjamaz.constants import MESSAGE_TYPES -from pyjamaz.models.block import Block +from pyjamaz.erasure import erasure_data_shards +from pyjamaz.models.block import Block, Header +from pyjamaz.transport.cert import validate_peer_certificate +from pyjamaz.transport.jamnp_messages import ( + InvalidJAMNPSMessage, decode_import_proofs, decode_justification, decode_mappings, + encode_import_proofs, encode_segment_indices, encode_segment_request, frame, read_count, split_segments, +) from pyjamaz.transport.pubsub import PubSubSignal from pyjamaz.transport.types import ProtocolType logger = logging.getLogger("pyjamaz.transport") - - -def wrap_protocol(wrapper, protocol): +MAX_STREAM_BYTES = 64 * 1024 * 1024 +MAX_PACKAGE_BYTES = 200 * 1024 +REQUEST_TIMEOUT = 5.0 +REJECTED = 1 +CANCELLED = 2 + + +class StreamBuffer: + """An incremental reader for one stream, including split length prefixes.""" + + def __init__(self, maximum: int = MAX_STREAM_BYTES): + self.buffer = bytearray() + self.maximum = maximum + self.received = 0 + self.finished = False + self.error = None + self.changed = asyncio.Event() + + def feed(self, data: bytes, finished: bool = False): + if self.finished or self.error: + if data: + raise InvalidJAMNPSMessage("data after stream completion") + return + self.received += len(data) + if len(self.buffer) + len(data) > self.maximum: + self.abort(InvalidJAMNPSMessage("stream exceeds byte limit")) + return + self.buffer.extend(data) + self.finished = finished + self.changed.set() + + def abort(self, error: Exception): + self.error = error + self.changed.set() + + async def read_exact(self, count: int, *, allow_end: bool = False) -> bytes | None: + while len(self.buffer) < count: + if self.error: + raise self.error + if self.finished: + if allow_end and not self.buffer: + return None + raise InvalidJAMNPSMessage("truncated stream") + self.changed.clear() + await self.changed.wait() + if self.error: + raise self.error + value = bytes(self.buffer[:count]) + del self.buffer[:count] + return value + + async def read_message(self, maximum: int = MAX_STREAM_BYTES) -> bytes | None: + prefix = await self.read_exact(4, allow_end=True) + if prefix is None: + return None + length = int.from_bytes(prefix, "little") + if length > maximum: + raise InvalidJAMNPSMessage("message exceeds byte limit") + return await self.read_exact(length) + + async def read_all(self, maximum_messages: int = 6145) -> list[bytes]: + messages = [] + while (message := await self.read_message()) is not None: + if len(messages) >= maximum_messages: + raise InvalidJAMNPSMessage("too many stream messages") + messages.append(message) + return messages + + +def wrap_protocol(wrapper, protocol, expected_key=None): def create_protocol(*args, **kwargs): instance = protocol(*args, **kwargs) instance.wrapper = wrapper + instance.expected_key = expected_key return instance - return create_protocol -class InvalidJAMNPSMessage(Exception): - pass - - class JAMNPSProtocol(QuicConnectionProtocol): - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.wrapper = None # Note: should be set in wrap_protocol + self.wrapper = None + self.expected_key = None + self.peer_key = None + self.identity_error = None self.stream_up_0 = None - #TODO: this buffer should be made per stream_id (for now, we always assume stream_up_0) - self._msg_buffer = b"" - self._msg_len = -1 - self._msg_type = -1 - self._msg_offset = -1 - - def _reset_msg(self): - self._msg_buffer = b"" - self._msg_len = -1 - self._msg_type = -1 - self._msg_offset = -1 - - def build_handshake_message(self): - #TODO: implement handshake response according to JAMSNP - """Both sides should begin by sending a handshake message containing all known leaves (descendants of the latest finalized block with no known children).""" - logger.debug(f"Building handshake message for UP-0 stream") - return ( - int(JAMNPS.MSG.UP0_OPEN.value).to_bytes( - length=1, - byteorder='little' - ) + - int(0).to_bytes( - length=4, - byteorder='little' - ) - ) - - -class ServerProtocol(JAMNPSProtocol): - - async def send_block_announcement(self, block_bytes): - if self.stream_up_0 is None: - raise Exception("NO UP 0 block_announcement channel opend yet??") - - """ - TODO: - For now we only send length++, we should send: - Final = Header Hash ++ Slot - Leaf = Header Hash ++ Slot - Handshake = Final ++ len++[Leaf] - Announcement = Header ++ Final - """ - self._quic.send_stream_data( - self.stream_up_0, - (int(JAMNPS.MSG.UP0_BlockAnnouncement.value).to_bytes(length=1, byteorder='little') + - len(block_bytes).to_bytes(length=4, byteorder='little') + - block_bytes) - ) - self.transmit() - logger.debug(f"ServerProtocol Block announcement sent to stream {self.stream_up_0} ({len(block_bytes)})") - - def quic_event_received(self, event: QuicEvent): + self.streams: dict[int, StreamBuffer] = {} + self.tasks: dict[int, asyncio.Task] = {} + self.receive_ready = set() + # Hold the initial small flow-control window until the stream kind is + # known and staged submissions are authorized. aioquic normally grows + # it on receipt, which would let a rejected package upload its body. + write_limits = self._quic._write_stream_limits + def write_stream_limits(*, builder, space, stream): + if stream.stream_id in self.receive_ready: + return write_limits(builder=builder, space=space, stream=stream) + highest_offset = stream.receiver.highest_offset + try: + stream.receiver.highest_offset = 0 + return write_limits(builder=builder, space=space, stream=stream) + finally: + stream.receiver.highest_offset = highest_offset + self._quic._write_stream_limits = write_stream_limits + # aioquic 1.3 has no public mutual-TLS switch. Request the client + # certificate before its TLS context starts; signature possession is + # checked by TLS, and the v1 identity is checked on HandshakeCompleted. + if not self._quic.configuration.is_client: + initialize = self._quic._initialize + def initialize_with_client_certificate(peer_cid): + initialize(peer_cid) + self._quic.tls._request_client_certificate = True + self._quic._initialize = initialize_with_client_certificate + + def quic_event_received(self, event): if isinstance(event, HandshakeCompleted): - # TODO: check client certificate and alpn - # if self._quic.configuration.alpn_protocols[0] != "jamnp-s/0/00000000": - # self._quic.close() - # return - - self.client_id = id(self) - self.wrapper.conn_in[self.client_id] = self # Store reference for broadcasting - - logger.debug(f'ServerProtocol new connected client #{self.client_id}') - - #TODO: remove connections on connection closed/lost etc - + try: + if event.alpn_protocol not in self.wrapper.configuration.alpn_protocols: + raise ValueError("incorrect JAMNP-S version or genesis") + self.peer_key = validate_peer_certificate(self._quic.tls._peer_certificate, self.expected_key) + self.wrapper.conn_in[id(self)] = self + except ValueError as exc: + self.identity_error = exc + self.close(error_code=REJECTED, reason_phrase=str(exc)) + super().quic_event_received(event) elif isinstance(event, StreamDataReceived): - logger.debug(f'Server received data: {event.data}') - - if self.stream_up_0 is None: - self.stream_up_0 = event.stream_id - logger.debug(f'ServerProtocol new UP-0 stream ({self.stream_up_0}) for client #{self.client_id}') - - # if event.stream_id == self.stream_up_0: - # # Process incoming data (either handshake or announcement) - # logger.debug(f'ServerProtocol new UP-0 stream ({self.stream_up_0}) for client #{self.client_id}') - - byte_data = bytes(event.data) - bytes_left = byte_data - - # Note: Parse bytes until stream data is empty: https://github.com/microsoft/msquic/discussions/2037 - while len(bytes_left) > 0: - - #TODO: do this per channel - if not self._msg_buffer: - # Note: first message always contains expected message type & length - # TODO: kunnen msg_type en msg_len ook opgesplitst zijn in 2 messages?? gaan nu uit dat dit atomair is - self._msg_type = int.from_bytes(byte_data[0:1], byteorder='little') - self._msg_offset = 5 - self._msg_len = int.from_bytes(byte_data[1:5], byteorder='little') + self._msg_offset - logger.debug(f'ServerProtocol new message {self._msg_type} ({self._msg_len} bytes)') - - nr_bytes_remaining = self._msg_len-len(self._msg_buffer) - if nr_bytes_remaining > 0: - self._msg_buffer += bytes_left[:nr_bytes_remaining] - bytes_left = bytes_left[nr_bytes_remaining:] - else: - bytes_left = bytes() - - # If we assembled a new message, parse it - if 0 < self._msg_len == len(self._msg_buffer): - - match self._msg_type: - - case JAMNPS.MSG.UP0_OPEN.value: - logger.debug(f'ServerProtocol PARSED UP-0') - self._reset_msg() - - case JAMNPS.MSG.CE128_BlockRequest.value: - logger.debug(f'ServerProtocol RECEIVED NEW BLOCKSREQUEST') - direction = 1#self._msg_buffer[self._msg_offset:self._msg_offset+1] - max_blocks = 1000 #self._msg_buffer[self._msg_offset+1:self._msg_offset+1+4] - block = Block.from_jam_bytes(JamBytes(self._msg_buffer[self._msg_offset:self._msg_len])) - - logger.debug( - f"ServerProtocol Block Requests received {self.stream_up_0} direction: {direction}, max_blocks: {max_blocks}, block: {block.header.timeslot}") - - blocks = [] - #TODO: take direction and max_blocks into account - #TODO: we decode and serialize blocks unnecessary here, improve! - #TODO: check the max blocks and a hardcoded max of X - while block.header.parent != bytes(32): - block = self.wrapper.app.retrieve_block_by_hash(block.header.parent) - if not block: - break - blocks.append(block) - - block_list = Vec(Block.to_codec_def()).new() - - serialized_blocks = block_list.encode([b.to_jam_bytes() for b in blocks]) - - logger.debug( - f"ServerProtocol Block Requests sending {len(blocks)} blocks") - - self._quic.send_stream_data( - self.stream_up_0, - (int(JAMNPS.MSG.CE128_BlockRequest.value).to_bytes(length=1, byteorder='little') + - len(serialized_blocks).to_bytes(length=4, byteorder='little') + - serialized_blocks.to_bytes()) - ) - self.transmit() - self._reset_msg() - - case _: - raise InvalidJAMNPSMessage(f"Invalid JAMNPS message: {self._msg_type}") - + reader = self.streams.get(event.stream_id) + if reader is None: + local_initiator = 0 if self._quic.configuration.is_client else 1 + if event.stream_id & 1 == local_initiator: + return # Late response bytes after a local cancellation. + if len(self.streams) >= 64 or event.stream_id & 2: + self._reject_stream(event.stream_id) + return + reader = self.streams[event.stream_id] = StreamBuffer() + self.tasks[event.stream_id] = asyncio.create_task(self._serve_stream(event.stream_id, reader)) + try: + reader.feed(event.data, event.end_stream) + except InvalidJAMNPSMessage: + self._reject_stream(event.stream_id) + elif isinstance(event, (StreamReset, StopSendingReceived)): + reader = self.streams.get(event.stream_id) + if reader: + reader.abort(ConnectionError("peer reset the JAMNP-S stream")) + task = self.tasks.get(event.stream_id) + if task: + task.cancel() + if isinstance(event, StopSendingReceived): + self._quic.reset_stream(event.stream_id, CANCELLED) + self.transmit() elif isinstance(event, ConnectionTerminated): - # Handle connection termination - if id(self) in self.wrapper.conn_in: - logger.debug(f'Client #{self.client_id} disconnected') - # print(f'Client #{self.client_id} disconnected') - del self.wrapper.conn_in[id(self)] - - -class ClientProtocol(JAMNPSProtocol): - - async def send_blocks_request(self, direction, max_blocks, block_bytes): - #TODO: moet over een nieuwe stream/connectie?? misbruiken voor nu de up0 stream - data = ( - # int(direction).to_bytes(length=1, byteorder='little') + - # int(max_blocks).to_bytes(length=1, byteorder='little') + - block_bytes - ) - self._quic.send_stream_data( - self.stream_up_0, - (int(JAMNPS.MSG.CE128_BlockRequest.value).to_bytes(length=1, byteorder='little') + - len(data).to_bytes(length=4, byteorder='little') + - data) - ) + for reader in self.streams.values(): + reader.abort(ConnectionError("JAMNP-S connection terminated")) + for task in self.tasks.values(): + task.cancel() + if self.wrapper: + self.wrapper.conn_in.pop(id(self), None) + super().quic_event_received(event) + else: + super().quic_event_received(event) + + def _reject_stream(self, stream_id: int): + self._quic.reset_stream(stream_id, REJECTED) + self._quic.stop_stream(stream_id, REJECTED) self.transmit() - logger.debug(f"ClientProtocol Block Requests sent to stream {self.stream_up_0} ({len(data)})") - - def quic_event_received(self, event: QuicEvent) -> None: - logger.debug(f'ClientProtocol received data') - - if isinstance(event, StreamDataReceived): - - #TODO: for now we only support 1 stream (UP-0) - #stream_id = event.stream_id - #stream = self._get_or_create_stream(stream_id) - - byte_data = bytes(event.data) - bytes_left = byte_data + def _send_messages(self, stream_id, messages, *, end_stream=True): + for message in messages: + self._quic.send_stream_data(stream_id, frame(message)) + if end_stream: + self._quic.send_stream_data(stream_id, b"", end_stream=True) + self.transmit() - # Note: Parse bytes until stream data is empty: https://github.com/microsoft/msquic/discussions/2037 - while len(bytes_left) > 0: + def _open_receive_window(self, stream_id): + self.receive_ready.add(stream_id) + self._quic._streams[stream_id].max_stream_data_local = MAX_STREAM_BYTES + self.transmit() - #TODO: do this per channel - if not self._msg_buffer: - # Note: first message always contains expected message type & length - self._msg_type = int.from_bytes(byte_data[0:1], byteorder='little') - self._msg_offset = 5 - self._msg_len = int.from_bytes(byte_data[1:5], byteorder='little') + self._msg_offset - logger.debug(f'ClientProtocol new message {self._msg_type} (received {len(bytes_left)-5} of {self._msg_len} bytes)') + async def request(self, kind: int, messages: list[bytes], timeout=REQUEST_TIMEOUT) -> list[bytes]: + if self.identity_error: + raise ConnectionError(str(self.identity_error)) + if self.peer_key is None: + raise ConnectionError("peer is not authenticated") + stream_id = self._quic.get_next_available_stream_id() + reader = self.streams[stream_id] = StreamBuffer() + self._quic.send_stream_data(stream_id, bytes([kind])) + self._open_receive_window(stream_id) + self._send_messages(stream_id, messages) + try: + async with asyncio.timeout(timeout): + return await reader.read_all() + except (TimeoutError, asyncio.CancelledError): + self._quic.reset_stream(stream_id, CANCELLED) + self._quic.stop_stream(stream_id, CANCELLED) + self.transmit() + raise + finally: + self.streams.pop(stream_id, None) + self.receive_ready.discard(stream_id) + + async def _serve_stream(self, stream_id, reader): + try: + kind = (await reader.read_exact(1))[0] + if self.peer_key is None or self.identity_error: + raise InvalidJAMNPSMessage("unauthenticated peer") + if kind not in (133, 146): + self._open_receive_window(stream_id) + if kind == 0: + if self._quic.configuration.is_client: + raise InvalidJAMNPSMessage("UP0 must be opened by the connection initiator") + await self._receive_up0(stream_id, reader) + return + async with asyncio.timeout(REQUEST_TIMEOUT): + if kind in (133, 146): + responses = await self._submission(stream_id, kind, reader) + else: + limits = {128: 37, 137: 34, 138: 34, 139: 6144 * 38, + 140: 6144 * 38, 147: 32, 148: 3072 * 36} + if kind not in limits: + raise InvalidJAMNPSMessage("unsupported stream kind") + message = await reader.read_message(limits[kind]) + if message is None or await reader.read_message(0) is not None: + raise InvalidJAMNPSMessage("request requires one message") + messages = [message] + if kind == 128: + responses = [self.wrapper.serve_blocks(messages[0])] + elif kind in (137, 138, 139, 140, 147, 148): + responses = await self.wrapper.availability.handle_request(self.peer_key, kind, messages) + else: + raise InvalidJAMNPSMessage("unsupported stream kind") + self._send_messages(stream_id, responses) + except asyncio.CancelledError: + self._reject_stream(stream_id) + raise + except Exception as exc: + logger.debug("Rejecting JAMNP-S stream %s: %s", stream_id, exc) + self._reject_stream(stream_id) + finally: + self.streams.pop(stream_id, None) + self.tasks.pop(stream_id, None) + self.receive_ready.discard(stream_id) + + async def _submission(self, stream_id, kind, reader): + # JAMNP-S CE133/146: authorize the small package before interpreting + # or processing the later, potentially large, payload frames. + first = await reader.read_message(MAX_PACKAGE_BYTES + 2) + if first is None or len(first) < 2: + raise InvalidJAMNPSMessage("missing submission header") + core_index = int.from_bytes(first[:2], "little") + if kind == 133: + mappings, package_data = {}, first[2:] + else: + mappings = decode_mappings(first[2:]) + package_data = await reader.read_message(MAX_PACKAGE_BYTES) + if package_data is None: + raise InvalidJAMNPSMessage("missing work package") + package, consumed = decode_package(package_data) + if consumed != len(package_data): + raise InvalidJAMNPSMessage("trailing package bytes") + context = await self.wrapper.availability.authorize_submission(self.peer_key, core_index, package, mappings) + self._open_receive_window(stream_id) + messages = await reader.read_all(maximum_messages=1 if kind == 133 else 3) + if len(messages) != (1 if kind == 133 else 3): + raise InvalidJAMNPSMessage("incorrect submission message count") + return await self.wrapper.availability.complete_submission(context, kind, messages) - nr_bytes_remaining = self._msg_len-len(self._msg_buffer) - self._msg_buffer += bytes_left[:nr_bytes_remaining] - bytes_left = bytes_left[nr_bytes_remaining:] + def build_handshake_message(self): + return self.wrapper.up0_handshake() - # If we assembled a new message, parse it - if 0 < self._msg_len == len(self._msg_buffer): + async def open_stream_up_0(self): + stream_id = self._quic.get_next_available_stream_id() + reader = self.streams[stream_id] = StreamBuffer() + self.stream_up_0 = stream_id + self._quic.send_stream_data(stream_id, b"\x00") + self._open_receive_window(stream_id) + self._send_messages(stream_id, [self.build_handshake_message()], end_stream=False) + self.tasks[stream_id] = asyncio.create_task(self._receive_up0(stream_id, reader, initiated=True)) + + async def _receive_up0(self, stream_id, reader, initiated=False): + if self.stream_up_0 is not None and stream_id < self.stream_up_0: + raise InvalidJAMNPSMessage("superseded UP0 stream") + previous = self.stream_up_0 + self.stream_up_0 = stream_id + if previous is not None and previous != stream_id: + self._reject_stream(previous) + try: + if not initiated: + self._send_messages(stream_id, [self.build_handshake_message()], end_stream=False) + handshake = await reader.read_message(1024 * 1024) + self.wrapper.validate_up0_handshake(handshake) + while (announcement := await reader.read_message(1024 * 1024)) is not None: + await self.wrapper.receive_announcement(self, announcement) + except asyncio.CancelledError: + raise + except Exception: + self._reject_stream(stream_id) + finally: + self.streams.pop(stream_id, None) + self.tasks.pop(stream_id, None) + if self.stream_up_0 == stream_id: + self.stream_up_0 = None - try: - match self._msg_type: + async def send_block_announcement(self, block_bytes): + if self.stream_up_0 is None: + return + block = Block.from_jam_bytes(JamBytes(block_bytes)) + payload = block.header.to_jam_bytes().to_bytes() + self.wrapper.final_descriptor() + self._send_messages(self.stream_up_0, [payload], end_stream=False) - case JAMNPS.MSG.UP0_BlockAnnouncement.value: - logger.debug(f'ClientProtocol RECEIVED_BLOCK: {self._msg_len}') - self.wrapper.broadcaster.send_stream.send_nowait(PubSubSignal(topic=MESSAGE_TYPES.RECEIVED_BLOCK, data=self._msg_buffer[self._msg_offset:self._msg_len])) - # self.wrapper.broadcaster.send_stream.send_nowait({ - # "message_type": MESSAGE_TYPES.RECEIVED_BLOCK, - # "data": self._msg_buffer[self._msg_offset:self._msg_len] - # }) + async def send_blocks_request(self, direction, max_blocks, block_bytes): + block = Block.from_jam_bytes(JamBytes(block_bytes)) + await self.wrapper.fetch_blocks(self, block.header.hash, direction, max_blocks) - case JAMNPS.MSG.CE128_BlockRequest.value: - logger.debug(f'ClientProtocol RECEIVED REQUESTED BLOCKS: {self._msg_len}') - self.wrapper.broadcaster.send_stream.send_nowait(PubSubSignal(topic=MESSAGE_TYPES.REQUESTED_BLOCKS, - data=self._msg_buffer[self._msg_offset:self._msg_len])) - # self.wrapper.broadcaster.send_stream.send_nowait({ - # "message_type": MESSAGE_TYPES.REQUESTED_BLOCKS, - # "data": self._msg_buffer[self._msg_offset:self._msg_len] - # }) - case _: - raise InvalidJAMNPSMessage(f"Invalid JAMNPS message: {self._msg_type}") - finally: - self._reset_msg() +class ServerProtocol(JAMNPSProtocol): + pass - # TODO: handle gracefully - # elif isinstance(event, ConnectionTerminated): - # # Handle connection termination - async def open_stream_up_0(self): - # Initiate UP 0 stream by sending the - self.stream_up_0 = self._quic.get_next_available_stream_id() - self._quic.send_stream_data( - self.stream_up_0, - self.build_handshake_message(), - ) - logger.debug(f'ClientProtocol Block announcement stream opened') +class ClientProtocol(JAMNPSProtocol): + pass class SessionTicketStore: + def __init__(self): + self.tickets = {} - def __init__(self) -> None: - self.tickets: Dict[bytes, SessionTicket] = {} - - def add(self, ticket: SessionTicket) -> None: + def add(self, ticket): self.tickets[ticket.ticket] = ticket - def pop(self, label: bytes) -> Optional[SessionTicket]: + def pop(self, label): return self.tickets.pop(label, None) class JAMNPS(ProtocolType): - - class MSG(Enum): - UP0_OPEN: int = 66 - UP0_BlockAnnouncement: int = 0 - CE128_BlockRequest: int = 128 - - #TODO: 00000000 -> vervang met de eerste 8 nibbles vd genesis header hash op __init__ - PROTOCOL_NAME = "jamnp-s/0/00000000" - - # (host, port, certificate_file, pk_file, app, 0, "0259fbe9b7dd6f3ce7d7027d87453e886bf39ea902b7bae59af1d3c63b2db4ec") - def __init__(self, host, port, certificate, private_key, app): - self.host = host - self.port = port + class MSG(IntEnum): + UP0_OPEN = 0 + UP0_BlockAnnouncement = 0 + CE128_BlockRequest = 128 + CE133_WorkPackage = 133 + CE137_ValidatorShard = 137 + CE138_AuditShard = 138 + CE139_SegmentShards = 139 + CE140_ProvenSegmentShards = 140 + CE146_WorkPackageBundle = 146 + CE147_Bundle = 147 + CE148_Segments = 148 + + def __init__(self, host, port, certificate, private_key, app, *, genesis_hash=None): + self.host, self.port, self.cert, self.pk, self.app = host, port, certificate, private_key, app self.broadcaster = app.pubsub - self.app = app + genesis_hash = genesis_hash or getattr(app, "genesis_hash", None) or app.retrieve_block_hash(0) + if not isinstance(genesis_hash, bytes) or len(genesis_hash) != 32: + raise ValueError("JAMNP-S requires the chain's genesis header hash") + self.genesis_hash = genesis_hash + self.PROTOCOL_NAME = "jamnp-s/1/" + genesis_hash.hex()[:8] + self.configuration = self._configuration(is_client=False) + self.conn_in, self.conn_out = {}, {} self.session_ticket_store = SessionTicketStore() - self.configuration = QuicConfiguration( - alpn_protocols=[JAMNPS.PROTOCOL_NAME], - is_client=False, - #quic_logger=quic_logger, - #verify_mode=ssl.CERT_REQUIRED - verify_mode=ssl.CERT_NONE, - idle_timeout=300000 - ) - self.cert = certificate - self.pk = private_key - self.configuration.load_cert_chain(certificate, private_key) - self.conn_in = {} # All incomming connections - self.conn_out = {} # All outgoing connections (who we connect to) - + self.server = None + + @property + def availability(self): + return self.app.runtime.availability + + def _configuration(self, *, is_client, builder=False): + protocols = [self.PROTOCOL_NAME + "/builder"] if builder else [self.PROTOCOL_NAME] + if not is_client: + protocols.append(self.PROTOCOL_NAME + "/builder") + configuration = QuicConfiguration(alpn_protocols=protocols, is_client=is_client, + verify_mode=ssl.CERT_NONE, idle_timeout=60, + max_data=MAX_STREAM_BYTES, max_stream_data=MAX_PACKAGE_BYTES + 1024) + configuration.load_cert_chain(self.cert, self.pk) + # Self-signed chains are expected. The v1 Ed25519/SAN identity is checked + # explicitly after TLS, including expected validator-key pinning. + validate_peer_certificate(configuration.certificate) + return configuration async def listen(self): - logger.debug(f'Listening on {self.host}:{self.port}') - await serve( - self.host, - self.port, - configuration=self.configuration, - create_protocol=wrap_protocol(self, ServerProtocol), - session_ticket_fetcher=self.session_ticket_store.pop, - session_ticket_handler=self.session_ticket_store.add, - retry=True, - ) + self.server = await serve(self.host, self.port, configuration=self.configuration, + create_protocol=wrap_protocol(self, ServerProtocol), + session_ticket_fetcher=self.session_ticket_store.pop, + session_ticket_handler=self.session_ticket_store.add, retry=True) + return self.server async def connect(self, host, port): - configuration = QuicConfiguration( - alpn_protocols=[JAMNPS.PROTOCOL_NAME], - is_client=True, - #verify_mode=ssl.CERT_REQUIRED - verify_mode=ssl.CERT_NONE, - idle_timeout=300000 - ) - configuration.load_cert_chain(certfile=self.cert, keyfile=self.pk) - - logger.debug(f"ClientProtocol Connecting to {host}:{port}") try: - async with connect( - host, - port, - configuration=configuration, - # session_ticket_handler=save_session_ticket, - create_protocol=wrap_protocol(self, ClientProtocol), - ) as client: - client = cast(ClientProtocol, client) + async with connect(host, port, configuration=self._configuration(is_client=True), + create_protocol=wrap_protocol(self, ClientProtocol)) as client: + if client.identity_error: + raise ConnectionError(str(client.identity_error)) self.conn_out[(host, port)] = client - await client.open_stream_up_0() - await client.wait_closed() - del self.conn_out[(host, port)] - except ConnectionError: - if (host, port) in self.conn_out: - del self.conn_out[(host, port)] - logger.debug(f"💩 ClientProtocol Cannot connect to {host}:{port}") - + try: + await client.open_stream_up_0() + await client.wait_closed() + finally: + self.conn_out.pop((host, port), None) + except ConnectionError as exc: + logger.debug("Cannot connect to %s:%s: %s", host, port, exc) + + @staticmethod + def peer_endpoint(peer): + raw_address = bytes(peer.metadata[:16]) + address = ipaddress.IPv6Address(raw_address) + host = str(address.ipv4_mapped or address) + # Older local node metadata stored IPv4 in the first four bytes. Read + # those persisted endpoints during migration; new metadata uses v1's + # full 16-byte IPv6 field, including IPv4-mapped addresses. + if raw_address[4:] == bytes(12) and raw_address[:4] != bytes(4): + host = str(ipaddress.IPv4Address(raw_address[:4])) + port = int.from_bytes(peer.metadata[16:18], "little") + if not port or address.is_unspecified: + raise ConnectionError("validator has no JAMNP-S endpoint") + return host, port + + async def request(self, peer, kind: int, messages: list[bytes]) -> list[bytes]: + # Bounded connection establishment and CE exchange, including FIN. + host, port = self.peer_endpoint(peer) + expected_key = bytes(peer.ed25519) + async with asyncio.timeout(REQUEST_TIMEOUT): + for protocol in list(self.conn_in.values()): + if protocol.peer_key == expected_key and not protocol.identity_error: + return await protocol.request(kind, messages) + async with connect(host, port, configuration=self._configuration(is_client=True, builder=kind in (133, 146)), + create_protocol=wrap_protocol(self, ClientProtocol, expected_key)) as protocol: + if protocol.identity_error: + raise ConnectionError(str(protocol.identity_error)) + return await protocol.request(kind, messages) + + async def submit_work_package_bundle(self, peer, core_index: int, bundle: bytes, mappings=None) -> None: + """Submit canonical B(p,l) using staged CE133 or CE146 (a convenience API).""" + if isinstance(core_index, bool) or not isinstance(core_index, int) or not 0 <= core_index <= 65535: + raise InvalidJAMNPSMessage("invalid submission core") + parts = decode_bundle(bundle) + mappings = mappings or {} + package_bytes = parts.package.to_jam_bytes().to_bytes() + extrinsics = b"".join(parts.extrinsics) + if parts.segments or mappings: + if len(mappings) > 8 or any(len(key) != 32 or len(root) != 32 for key, root in mappings.items()): + raise InvalidJAMNPSMessage("invalid submission mappings") + header = (core_index.to_bytes(2, "little") + VarInt64.encode(len(mappings)).to_bytes() + + b"".join(key + mappings[key] for key in sorted(mappings))) + kind, messages = 146, [header, package_bytes, extrinsics, b"".join(parts.segments), + encode_import_proofs(parts.justifications)] + else: + kind, messages = 133, [core_index.to_bytes(2, "little") + package_bytes, extrinsics] + if await self.request(peer, kind, messages): + raise InvalidJAMNPSMessage("submission response must contain only FIN") + + async def request_validator_shard(self, peer, spec, shard_index: int) -> ValidatorShard: + if not 0 <= shard_index < spec.erasure_shards: + raise InvalidJAMNPSMessage("invalid validator shard index") + messages = await self.request(peer, 137, [spec.erasure_root + shard_index.to_bytes(2, "little")]) + if len(messages) != 3: + raise InvalidJAMNPSMessage("incorrect CE137 response message count") + size = 4104 // erasure_data_shards(spec.erasure_shards) + count = spec.exports_count + (spec.exports_count + 63) // 64 + shard = ValidatorShard(shard_index, messages[0], split_segments(messages[1], count, size), + decode_justification(messages[2])) + verify_validator_shard(shard, spec) + return shard + + async def request_audit_shard(self, peer, spec, shard_index: int): + if not 0 <= shard_index < spec.erasure_shards: + raise InvalidJAMNPSMessage("invalid audit shard index") + messages = await self.request(peer, 138, [spec.erasure_root + shard_index.to_bytes(2, "little")]) + if len(messages) != 2: + raise InvalidJAMNPSMessage("incorrect CE138 response message count") + proof = decode_justification(messages[1]) + verify_audit_shard(messages[0], shard_index, proof, spec) + return messages[0], proof + + async def request_segment_shards(self, peer, spec, shard_index: int, segment_indices, *, proven=False): + count = spec.exports_count + (spec.exports_count + 63) // 64 + if not 0 <= shard_index < spec.erasure_shards or any(not 0 <= i < count for i in segment_indices): + raise InvalidJAMNPSMessage("invalid segment or validator index") + messages = await self.request(peer, 140 if proven else 139, + [encode_segment_request(spec.erasure_root, shard_index, segment_indices)]) + expected = 1 + (len(segment_indices) if proven else 0) + if len(messages) != expected: + raise InvalidJAMNPSMessage("incorrect segment-shard response message count") + size = 4104 // erasure_data_shards(spec.erasure_shards) + chunks = split_segments(messages[0], len(segment_indices), size) + result = [] + for offset, (index, chunk) in enumerate(zip(segment_indices, chunks)): + proof = decode_justification(messages[offset + 1], size) if proven else None + if proven: + verify_segment_shard(chunk, index, shard_index, proof, spec) + result.append((chunk, proof)) + return result + + async def request_segments(self, peer, root: bytes, indices) -> list[ImportedSegment]: + messages = await self.request(peer, 148, [encode_segment_indices(root, indices)]) + if len(messages) != 2: + raise InvalidJAMNPSMessage("incorrect complete-segment response message count") + segments = split_segments(messages[0], len(indices)) + proofs = decode_import_proofs(messages[1], len(indices)) + imports = [ImportedSegment(segment, proof) for segment, proof in zip(segments, proofs)] + for index, imported in zip(indices, imports): + verify_import(root, index, imported) + return imports + + async def request_bundle(self, peer, spec) -> bytes: + messages = await self.request(peer, 147, [spec.erasure_root]) + if len(messages) != 1 or len(messages[0]) != spec.length: + raise InvalidJAMNPSMessage("incorrect bundle response length") + # A complete bundle has no individual CE147 co-path. The caller checks + # it against the source specification when recomputing A(h,b,s,v). + return messages[0] + + def final_descriptor(self): + final_hash = self.app.retrieve_finalized_head() or self.genesis_hash + header = self.app.retrieve_block_header(final_hash) + slot = header.timeslot if header is not None else 0 + return final_hash + slot.to_bytes(4, "little") + + def _head(self): + state = getattr(self.app, "working_state", None) + slot = state.timeslot.number if state is not None else 0 + return self.app.retrieve_block_hash(slot) or self.genesis_hash, slot + + def up0_handshake(self): + head_hash, slot = self._head() + # The application currently retains one canonical leaf. This is the + # complete known-leaf set for that storage model. + return self.final_descriptor() + VarInt64.encode(1).to_bytes() + head_hash + slot.to_bytes(4, "little") + + @staticmethod + def validate_up0_handshake(data): + if data is None or len(data) < 37: + raise InvalidJAMNPSMessage("missing UP0 handshake") + stream = JamBytes(data) + try: + stream.get_next_bytes(36) + count = read_count(stream, 16384) + leaves = [bytes(stream.get_next_bytes(36)) for _ in range(count)] + if stream.get_remaining_length() or len(set(leaves)) != len(leaves): + raise InvalidJAMNPSMessage("invalid UP0 leaves") + except Exception as exc: + raise InvalidJAMNPSMessage("malformed UP0 handshake") from exc + + async def receive_announcement(self, protocol, payload): + if len(payload) < 36: + raise InvalidJAMNPSMessage("truncated block announcement") + stream = JamBytes(payload[:-36]) + header = Header.from_jam_bytes(stream) + if stream.get_remaining_length() or header.to_jam_bytes().to_bytes() != payload[:-36]: + raise InvalidJAMNPSMessage("malformed block announcement") + if self.app.retrieve_block_header(header.hash) is None: + await self.fetch_blocks(protocol, header.hash, 1, 1) + + async def fetch_blocks(self, protocol, header_hash, direction, max_blocks): + if direction not in (0, 1) or not 0 < max_blocks <= 4096: + raise InvalidJAMNPSMessage("invalid block request limits") + response = await protocol.request(128, [header_hash + bytes([direction]) + max_blocks.to_bytes(4, "little")]) + if len(response) != 1: + raise InvalidJAMNPSMessage("incorrect block response message count") + stream, blocks = JamBytes(response[0]), [] + while stream.get_remaining_length(): + if len(blocks) >= max_blocks: + raise InvalidJAMNPSMessage("too many returned blocks") + block = Block.from_jam_bytes(stream) + blocks.append(block) + for index, block in enumerate(blocks): + if index == 0 and ((direction == 1 and block.header.hash != header_hash) + or (direction == 0 and block.header.parent != header_hash)): + raise InvalidJAMNPSMessage("block response has incorrect anchor") + if index and ((direction == 1 and blocks[index - 1].header.parent != block.header.hash) + or (direction == 0 and block.header.parent != blocks[index - 1].header.hash)): + raise InvalidJAMNPSMessage("block response is not contiguous") + if blocks: + # Keep the existing app subscriber's Vec(Block) representation. + encoded = Vec(Block.to_codec_def()).encode([block.to_jam_bytes() for block in blocks]).to_bytes() + await self.broadcaster.publish(PubSubSignal(MESSAGE_TYPES.REQUESTED_BLOCKS, encoded)) + return blocks + + def serve_blocks(self, request): + if len(request) != 37: + raise InvalidJAMNPSMessage("invalid block request") + anchor, direction = request[:32], request[32] + limit = int.from_bytes(request[33:], "little") + if direction not in (0, 1) or not 0 < limit <= 4096: + raise InvalidJAMNPSMessage("invalid block request limits") + # Restrict requests to the retained canonical branch. Its ancestors + # remain finalizable under the application's committed-state model. + head_hash, _ = self._head() + block, children, seen = self.app.retrieve_block_by_hash(head_hash), [], set() + while block is not None and block.header.hash != anchor: + if block.header.hash in seen: + raise InvalidJAMNPSMessage("cyclic block ancestry") + seen.add(block.header.hash) + children.append(block) + block = self.app.retrieve_block_by_hash(block.header.parent) + if block is None: + raise InvalidJAMNPSMessage("requested block is outside the finalizable branch") + if direction == 0: + blocks = list(reversed(children))[:limit] + else: + blocks = [] + while block is not None and len(blocks) < limit: + blocks.append(block) + block = self.app.retrieve_block_by_hash(block.header.parent) + return b"".join(block.to_jam_bytes().to_bytes() for block in blocks) async def request_blocks(self, direction, max_blocks, block_bytes): - #TODO: temp hack, should be provided with a specific peer? - conn_key = list(self.conn_out.keys())[0] - conn = self.conn_out[conn_key] - await conn.send_blocks_request(0, 100, block_bytes) - + if not self.conn_out: + raise ConnectionError("no connected block peer") + protocol = next(iter(self.conn_out.values())) + await protocol.send_blocks_request(direction, max_blocks, block_bytes) async def broadcast_block(self, block): - block_bytes = block.to_jam_bytes().to_bytes() - logger.debug(f'ServerProtocol broadcasting block announcement to {len(self.conn_in)} clients') - for client_id, client in self.conn_in.items(): - logger.debug(f"ServerProtocol send block to client {client}") - await client.send_block_announcement(block_bytes) + encoded = block.to_jam_bytes().to_bytes() + for protocol in list(self.conn_in.values()): + await protocol.send_block_announcement(encoded) diff --git a/pyjamaz/transport/types.py b/pyjamaz/transport/types.py index a50d7e2d..6393707b 100644 --- a/pyjamaz/transport/types.py +++ b/pyjamaz/transport/types.py @@ -1,6 +1,7 @@ from typing import Protocol from pyjamaz.models.block import Block +from pyjamaz.models.common import ValidatorData, WorkPackageSpec class ProtocolType(Protocol): @@ -13,4 +14,17 @@ async def request_blocks(self, direction: int, max_blocks: int, block_bytes:byte """ Starts a Blocks Request, to fetch a range of blocks from a given peer """ async def broadcast_block(self, block:Block): - """ Broadcasts a new block to all connected peers """ \ No newline at end of file + """ Broadcasts a new block to all connected peers """ + + async def request(self, peer: ValidatorData, kind: int, messages: list[bytes]) -> list[bytes]: + """Exchange framed messages on an authenticated JAMNP-S CE stream.""" + + async def request_validator_shard(self, peer: ValidatorData, spec: WorkPackageSpec, shard_index: int): + """Retrieve and verify a complete CE137 validator row.""" + + async def request_segment_shards(self, peer: ValidatorData, spec: WorkPackageSpec, + shard_index: int, segment_indices, *, proven=False): + """Retrieve CE139 chunks or individually verified CE140 chunks.""" + + async def request_segments(self, peer: ValidatorData, root: bytes, indices): + """Retrieve complete CE148 segments and verify their import proofs.""" diff --git a/scripts/bootstrap_builder_doom.py b/scripts/bootstrap_builder_doom.py new file mode 100644 index 00000000..7843526d --- /dev/null +++ b/scripts/bootstrap_builder_doom.py @@ -0,0 +1,170 @@ +import asyncio +import json +from pathlib import Path +from typing import List + +from jamcodec.base import JamBytes + +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.models.builder import Instruction, ServiceRegistry +from pyjamaz.models.common import RefinementContext, WorkPackage, WorkItem, WorkItemExtrinsic, Preimage +from pyjamaz.rpc.ws_client import WebsocketClient + +async def get_service_registry(client) -> ServiceRegistry: + best_block = await client.bestBlock() + block_hash = best_block["header_hash"] + services_registry = await client.serviceValue(block_hash, 0, b'\x10service_registry') + + return ServiceRegistry.from_jam_bytes(JamBytes(services_registry)) + + +async def create_empty_workpackage(client: WebsocketClient) -> WorkPackage: + best_block = await client.bestBlock() + block_hash = best_block[0] + block_timeslot = best_block[1] + + state_root = await client.stateRoot(block_hash) + beefy_root = await client.beefyRoot(block_hash) + + context = RefinementContext( + anchor=block_hash, + state_root=state_root, + beefy_root=beefy_root, + lookup_anchor=block_hash, + lookup_anchor_slot=block_timeslot, + prerequisites=[] + ) + + work_package = WorkPackage( + authorization=b'', + auth_code_host=0, + auth_code_hash=bytes.fromhex('f8d86b97d65319a078e5840f1614c296a5254217794dcc910e72ca174e3c2e86'), + authorizer_config=b'', + context=context, + items=[] + ) + + return work_package + +async def create_bootservice_workpackage(client: WebsocketClient, instruction: Instruction, extrinsic: List[bytes]) -> WorkPackage: + work_package = await create_empty_workpackage(client) + work_package.items.append( + WorkItem( + accumulate_gas_limit=10000000, + code_hash=bytes.fromhex('34ce1e5be974e62476f62779abfa24a6236d0b98d8d691ee218adddf5b2176b4'), + export_count=0, + extrinsic=[WorkItemExtrinsic.from_blob(e) for e in extrinsic], + import_segments=[], + payload=instruction.to_jam_bytes().to_bytes(), + refine_gas_limit=1000000000, + service=0 + ) + ) + + return work_package + +async def main(): + + async with WebsocketClient("ws://127.0.0.1:19800") as client: + # Init vars + bootstrap_service_id = 0 + registration = "test123" + # TODO update incompatible 0.6.5 preimage + # new_service_preimage = bytes.fromhex("00483be53243cb07d50beae39059e765a05d7f529868c1923815df49d5f5bbbdeeffffffffffffffff0a000000000000000a000000000000004daf020000000000ffffffffffffffff04000000000000000000000000000000") + # TODO cannot send > 1MB preimages?? + new_service_preimage = Path("./scripts/doom.corevm").read_bytes() + # new_service_preimage = bytes.fromhex(json.loads(Path("./scripts/pvm_blobs.json").read_text())["storage_light"]) + + + preimage = Preimage.extract(new_service_preimage) + + solicit_instruction = Instruction.from_json({'Solicit': {'hash': '0xcbc63dc2acb86bd8967453ef98fd4f2be2f26d7337a0937958211c128a18b442', 'len': 2}}) + + create_instruction = Instruction.from_json( + { + 'CreateService': { + 'code_hash': blake2b_256_hash(new_service_preimage), + 'code_len': len(new_service_preimage), + 'endowment': 100000, + 'memo': '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + 'min_item_gas': 1000000, + 'min_memo_gas': 1000000, + 'registration': registration + } + } + ) + + random_storage_instruction = Instruction.from_json( + {'RandomStorageRefine': { + 'seed': 3081892978, + 'nb_items': 6 + }} + ) + + export_instruction = Instruction.from_json( + {'Export': { + 'data': [b'test'], + }} + ) + + zombify_instruction = Instruction.from_json({'Zombify': {'ejector': 0}}) + + eject_instruction = Instruction.from_json( + {'Eject': {'target': 0, 'code_hash': '0x6c63e601e26279872a93b9b443aa52ad1c26e795647f63c0b7e0abff0d3680da'}} + ) + + extrinsic = [bytes(100), bytes(200), bytes(300)] + + work_package = await create_bootservice_workpackage(client, create_instruction, extrinsic) + + print(f"Creating service '{preimage.program_name}'...") + await client.submitWorkPackage(0, work_package, extrinsic) + + new_service = await client.subscribeServiceValue(bootstrap_service_id, b'created') + async for data in new_service: + print("Waiting for new service ID ...") + if data: + new_service_id = int.from_bytes(data, byteorder='little') + print(f'Service ID = {data[::-1].hex()} ({new_service_id})') + break + + # Provide preimage + await client.submitPreimage(new_service_id, new_service_preimage) + + sub_request = await client.subscribeServiceRequest(new_service_id, blake2b_256_hash(new_service_preimage), len(new_service_preimage)) + async for data in sub_request: + print(f"Waiting for preimage ... {data}") + if len(data) == 1: + break + + # service_registry = await get_service_registry(client) + + work_package = await create_empty_workpackage(client) + work_package.items.append( + WorkItem( + accumulate_gas_limit=10000000, + code_hash=blake2b_256_hash(new_service_preimage), + # code_hash=service_registry.services[0][1].code_hash, + export_count=0, + extrinsic=[], + import_segments=[], + payload=b'Testing 1, 2, 3', + refine_gas_limit=5000000000, + service=new_service_id + # service=service_registry.services[0][1].id + ) + ) + print('Submitting work package for new service...') + await client.submitWorkPackage(0, work_package, extrinsic) + + last_value = await client.subscribeServiceValue(new_service_id, b'last') + print("Waiting for new last value ...") + async for data in last_value: + if data: + print(f'Last value = {data}') + break + + print('Done!') + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/scripts/capture_refinement_trace.py b/scripts/capture_refinement_trace.py new file mode 100644 index 00000000..defafc89 --- /dev/null +++ b/scripts/capture_refinement_trace.py @@ -0,0 +1,405 @@ +#!/usr/bin/env python3 +"""Capture a Tiny bootstrap refinement case from PolkaJam 0.1.29 / GP 0.8.0. + +Run with the PyJAMaz environment; the ordinary ``jamt`` on PATH is not used. +The generated report always comes from PolkaJam, never from PyJAMaz execution. +""" + +import argparse +import asyncio +import base64 +import hashlib +import json +import os +from pathlib import Path +import re +import sys +import tempfile +import time + +os.environ['JAM_FUZZ'] = '1' +os.environ['JAM_FUZZ_SPEC'] = 'tiny' +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) + +import websockets +from jamcodec.base import JamBytes + +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.models.app import StateDump, TraceGenesis +from pyjamaz.models.block import Header +from pyjamaz.models.common import WorkPackage, WorkReport +from pyjamaz.models.state import PendingChanges, ServicesState +from pyjamaz.fuzzer.v1.types import RefineBundle, WorkPackageBundle +from pyjamaz.state.base import state_key_constructor_service_account +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + + +# Bootstrap 0.1.29 decodes Instructions { instructions: Vec, +# salt: [u8; 32] }. Empty bytes (or the vector prefix alone) panic. +BOOTSTRAP_NOOP_PAYLOAD = bytes(33) + + +def b64(data): + return base64.b64encode(data).decode('ascii') + + +def unb64(value): + return base64.b64decode(value, validate=True) + + +def decode(cls, data): + stream = JamBytes(data) + result = cls.from_jam_bytes(stream) + if stream.get_remaining_length() or result.to_jam_bytes().to_bytes() != data: + raise ValueError(f'Noncanonical {cls.__name__} from PolkaJam') + return result + + +def reference_genesis(spec): + """Preserve the reference header and state; compute its posterior root.""" + header = decode(Header, bytes.fromhex(spec['genesis_header'])) + keyvals = [(bytes.fromhex(k), bytes.fromhex(v)) for k, v in spec['genesis_state'].items()] + if any(len(key) != 31 for key, _ in keyvals): + raise ValueError('Reference state keys must be 31 bytes') + genesis = TraceGenesis(header, StateDump(PatriciaMerkleTrie(keyvals).root(), keyvals)) + services = ServicesState(services={}) + services.set_state_storage(StateStorage(InMemoryStorageEngine(dict(keyvals)))) + services.pending_changes = PendingChanges() + return genesis, services + + +class Rpc: + def __init__(self, url, journal): + self.url, self.journal = url, journal + self.counter = 0 + + async def request(self, method, params=None): + self.counter += 1 + request = {'jsonrpc': '2.0', 'id': self.counter, 'method': method, 'params': params or []} + raw = json.dumps(request) + self.journal.append({'client': 'capture', 'direction': 'request', 'raw': raw, 'message': request}) + async with websockets.connect(self.url, open_timeout=3, max_size=20 * 1024 * 1024) as ws: + await ws.send(raw) + while True: + raw = await asyncio.wait_for(ws.recv(), 10) + response = json.loads(raw) + self.journal.append({'client': 'capture', 'direction': 'response', 'raw': raw, 'message': response}) + if response.get('id') == request['id']: + if 'error' in response: + raise RuntimeError(f'{method}: {response["error"]}') + return response.get('result') + + +async def verify_genesis_inputs(rpc, genesis, services, package): + """Prove the two historical code lookups use unchanged reference inputs.""" + block = b64(package.context.lookup_anchor) + checks = [] + required = [(package.auth_code_host, package.auth_code_hash)] + required.extend((item.service, item.code_hash) for item in package.items) + for service_id, code_hash in dict.fromkeys(required): + account_bytes = services.state_storage.get(state_key_constructor_service_account(service_id)) + actual_account = await rpc.request('serviceData', [block, service_id]) + if actual_account is None or unb64(actual_account) != account_bytes: + raise ValueError(f'Service {service_id} differs from genesis at the lookup anchor') + expected_code = services.historical_preimage_lookup( + service_id, package.context.lookup_anchor_slot, code_hash, + ) + actual_code = await rpc.request('servicePreimage', [block, service_id, b64(code_hash)]) + if expected_code is None or actual_code is None or unb64(actual_code) != expected_code: + raise ValueError(f'Service {service_id} historical code differs from genesis') + if blake2b_256_hash(expected_code) != code_hash: + raise ValueError('Reference preimage does not match its code hash') + expected_history = services.retrieve_preimage_availability(service_id, code_hash, len(expected_code)) + actual_history = await rpc.request('serviceRequest', [block, service_id, b64(code_hash), len(expected_code)]) + if actual_history != expected_history: + raise ValueError(f'Service {service_id} preimage history differs from genesis') + checks.append({ + 'service_id': service_id, 'code_hash': code_hash.hex(), 'code_length': len(expected_code), + 'availability_history': actual_history, + 'account_sha256': hashlib.sha256(account_bytes).hexdigest(), + }) + return checks + + +async def command(argv, commands, *, cwd, timeout=30): + commands.append([str(arg) for arg in argv]) + process = await asyncio.create_subprocess_exec( + *map(str, argv), cwd=cwd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT, + ) + try: + output, _ = await asyncio.wait_for(process.communicate(), timeout) + except BaseException: + if process.returncode is None: + process.terminate() + try: + await asyncio.wait_for(process.wait(), 5) + except TimeoutError: + process.kill() + await process.wait() + raise + output = output.decode(errors='replace') + if process.returncode: + raise RuntimeError(f'{Path(argv[0]).name} exited {process.returncode}:\n{output[-6000:]}') + return output + + +async def capture(args, work): + commands, journal, processes, logs = [], [], [], [] + node, jamt = args.binaries / 'polkajam', args.binaries / 'jamt' + versions = {} + for binary in (node, jamt): + version = await command([binary, '--version'], commands, cwd=work) + if version.splitlines() != [f'{binary.name} 0.1.29', 'GP 0.8.0']: + raise ValueError(f'Expected {binary.name} 0.1.29 / GP 0.8.0; got {version.strip()}') + versions[binary.name] = version.strip() + spec_path = work / 'dev-spec.json' + await command([ + node, '--config-path', work / 'config', '--chain', f'dev:{args.base_port}', + 'dump-spec', spec_path, + ], commands, cwd=work) + spec = json.loads(spec_path.read_text()) + genesis, services = reference_genesis(spec) + rpc_url = f'ws://127.0.0.1:{args.rpc_port}' + rpc = Rpc(rpc_url, journal) + proxy = None + try: + startup_deadline = time.monotonic() + args.timeout + # The ordinary gateway uses the reference release's supported builder + # path, avoiding validator-to-validator forwarding of builder traffic. + for index in range(7): + argv = [ + node, '--config-path', work / f'config-{index}', '--chain', spec_path, + 'run', '--data-path', work / f'node-{index}', + '--listen-ip', '127.0.0.1', '--pvm-backend', 'interpreter', '--finality-mode', 'dummy', + ] + if index == 6: + # This release requires peer-id@address. Use its own advertised + # native identity instead of reconstructing its peer-ID codec. + bootnode = None + while time.monotonic() < startup_deadline: + match = re.search(r'This node is (\S+)', (work / 'node-0.log').read_text()) + if match: + bootnode = match.group(1) + break + if processes[0].returncode is not None: + raise RuntimeError('Reference validator 0 exited during startup') + await asyncio.sleep(0.1) + if bootnode is None: + raise TimeoutError('Reference validator did not advertise its bootnode identity') + argv += ['--mode', 'ordinary', '--bootnode', bootnode, + '--rpc', '--rpc-listen-ip', '127.0.0.1', '--rpc-port', str(args.rpc_port)] + else: + argv += ['--dev-validator', str(index), '--no-rpc'] + commands.append([str(arg) for arg in argv]) + log = (work / f'node-{index}.log').open('wb') + logs.append(log) + processes.append(await asyncio.create_subprocess_exec( + *map(str, argv), cwd=work, stdout=log, stderr=asyncio.subprocess.STDOUT, + env={**os.environ, 'RUST_LOG': 'info'}, + )) + deadline = time.monotonic() + args.timeout + while True: + if any(process.returncode is not None for process in processes): + raise RuntimeError('A reference node exited during startup') + try: + parameters = await rpc.request('parameters') + best = await rpc.request('bestBlock') + if best is not None: + break + except (OSError, TimeoutError): + pass + if time.monotonic() >= deadline: + raise TimeoutError('PolkaJam RPC did not become ready') + await asyncio.sleep(0.5) + reference_root = await rpc.request('stateRoot', [b64(genesis.header.hash)]) + if reference_root is None or unb64(reference_root) != genesis.state.state_root: + raise ValueError('Exported genesis does not match PolkaJam stateRoot') + + submissions = [] + + async def record(client): + async with websockets.connect(rpc_url, max_size=20 * 1024 * 1024) as upstream: + async def forward(source, destination, direction): + async for payload in source: + message = json.loads(payload) + journal.append({'client': 'jamt', 'direction': direction, 'raw': payload, 'message': message}) + if direction == 'request' and message.get('method') == 'submitWorkPackage': + submissions.append(message['params']) + await destination.send(payload) + tasks = [asyncio.create_task(forward(client, upstream, 'request')), + asyncio.create_task(forward(upstream, client, 'response'))] + try: + await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED) + finally: + for task in tasks: + task.cancel() + await asyncio.gather(*tasks, return_exceptions=True) + + proxy = await websockets.serve(record, '127.0.0.1', args.proxy_port, max_size=20 * 1024 * 1024) + jamt_output = await command([ + jamt, '--rpc', f'ws://127.0.0.1:{args.proxy_port}', '--trace', '--force-core', '0', + 'item', '0', '0x' + BOOTSTRAP_NOOP_PAYLOAD.hex(), + '--refine-gas', '1000000', '--accumulate-gas', '1000000', + ], commands, cwd=work, timeout=args.timeout) + if len(submissions) != 1: + raise ValueError(f'Expected one work-package submission, got {len(submissions)}') + core, encoded_package, encoded_extrinsics = submissions[0] + package_bytes = unb64(encoded_package) + package = decode(WorkPackage, package_bytes) + if (core != 0 or len(package.items) != 1 or package.items[0].service != 0 + or package.items[0].payload != BOOTSTRAP_NOOP_PAYLOAD or package.items[0].export_count + or package.items[0].import_segments or package.items[0].extrinsic or encoded_extrinsics + or package.items[0].refine_gas_limit != 1_000_000 + or package.items[0].accumulate_gas_limit != 1_000_000): + raise ValueError('Captured package is not the requested bootstrap no-op workload') + checks = await verify_genesis_inputs(rpc, genesis, services, package) + report_hash = None + deadline = time.monotonic() + args.timeout + while time.monotonic() < deadline: + best = await rpc.request('bestBlock') + status = await rpc.request('workPackageStatus', [ + best['header_hash'], b64(package.hash()), b64(package.context.anchor), + ]) + if status: + if 'Failed' in status: + raise ValueError(f'PolkaJam rejected the work package: {status["Failed"]}') + reported = status.get('Reported') or status.get('Ready') + if reported: + report_hash = unb64(reported['report_hash']) + break + await asyncio.sleep(0.5) + if report_hash is None: + raise TimeoutError('PolkaJam did not report the package within the capture timeout') + report_bytes = unb64(await rpc.request('workReport', [b64(report_hash)])) + report = decode(WorkReport, report_bytes) + if (report.hash() != report_hash or report.package_spec.hash != package.hash() + or report.core_index != core or report.package_spec.erasure_shards != 6 + or len(report.results) != 1 or report.results[0].result.ok is None): + raise ValueError('Reference work report did not successfully refine the submitted package') + request = RefineBundle(core, {}, 6, WorkPackageBundle(package, [], [], [])) + args.output.mkdir(parents=True, exist_ok=True) + artifacts = { + 'genesis.bin': genesis.to_jam_bytes().to_bytes(), + 'refine.bin': request.to_jam_bytes().to_bytes(), + 'report.bin': report_bytes, + } + if any((args.output / name).exists() for name in (*artifacts, 'source.json', 'README.md')): + raise FileExistsError('Output fixture already exists; choose a new output directory') + for name, data in artifacts.items(): + (args.output / name).write_bytes(data) + source = { + 'description': 'PolkaJam bootstrap refinement; unchanged genesis historical inputs verified at lookup anchor.', + 'gp_version': '0.8.0', 'profile': 'tiny', 'tools': versions, + 'binary_sha256': {binary.name: hashlib.sha256(binary.read_bytes()).hexdigest() + for binary in (node, jamt)}, + 'commands': commands, 'parameters': parameters, + 'chainspec_sha256': hashlib.sha256(spec_path.read_bytes()).hexdigest(), + 'genesis_header_hash': genesis.header.hash.hex(), 'genesis_state_root': genesis.state.state_root.hex(), + 'package_hash': package.hash().hex(), 'report_hash': report_hash.hex(), + 'lookup_anchor': package.context.lookup_anchor.hex(), 'lookup_anchor_slot': package.context.lookup_anchor_slot, + 'payload': { + 'hex': BOOTSTRAP_NOOP_PAYLOAD.hex(), + 'meaning': 'Empty Bootstrap 0.1.29 instruction vector followed by a zero 32-byte salt.', + 'schema_source': 'https://docs.rs/crate/jam-bootstrap-service-common/0.1.29/source/src/lib.rs', + 'empty_byte_payload': 'Rejected: native Bootstrap 0.1.29 panics while decoding Instructions.', + }, + 'verified_genesis_inputs': checks, 'jamt_output': jamt_output, + 'artifacts': {name: hashlib.sha256(data).hexdigest() for name, data in artifacts.items()}, + 'rpc_capture': journal, + } + (args.output / 'source.json').write_text(json.dumps(source, indent=2) + '\n') + (args.output / 'README.md').write_text(readme(args)) + print(f'Captured package {package.hash().hex()} and report {report_hash.hex()} in {args.output}') + except BaseException: + (work / 'rpc_capture.json').write_text(json.dumps(journal, indent=2) + '\n') + for log in logs: + log.flush() + for index in range(len(logs)): + tail = (work / f'node-{index}.log').read_text(errors='replace')[-1800:] + print(f'Reference node {index} log tail:\n{tail}', file=sys.stderr) + raise + finally: + if proxy is not None: + proxy.close() + await proxy.wait_closed() + for process in processes: + if process.returncode is None: + process.terminate() + for process in processes: + try: + await asyncio.wait_for(process.wait(), 5) + except TimeoutError: + process.kill() + await process.wait() + for log in logs: + log.close() + + +def readme(args): + return f'''# PolkaJam bootstrap refinement trace + +Captured with PolkaJam/jamt 0.1.29, GP 0.8.0, Tiny (six validators). +The package contains one successful service-0 bootstrap item, an empty instruction list, +no imports/exports/extrinsics, and 1,000,000 gas for refinement and accumulation. +The full expected report is PolkaJam's RPC result, preserved without normalization. + +Bootstrap 0.1.29 requires an `Instructions` structure: a vector of instructions +followed by a 32-byte salt. The no-op payload is therefore 33 zero bytes (empty +vector plus deterministic salt). An empty byte payload panics in the reference +service and cannot be used as a successful no-op. The source schema is +https://docs.rs/crate/jam-bootstrap-service-common/0.1.29/source/src/lib.rs. + +`genesis.bin` is the real reference genesis. It is not a live-block snapshot. +The capture verifies the required account, code and preimage-availability inputs +are unchanged at the package's lookup anchor before using this genesis for replay. +`source.json` contains these checks, exact commands and raw RPC requests/responses. + +## Capture again + +From the PyJAMaz checkout, using its Python environment: + +```sh +.venv/bin/python scripts/capture_refinement_trace.py \\ + --binaries {args.binaries} --output /tmp/bootstrap-refinement +``` + +## Replay + +Start the target, then run the second command from another terminal: + +```sh +JAM_FUZZ=1 JAM_FUZZ_SPEC=tiny .venv/bin/python -m pyjamaz.cli fuzzer target --socket-path /tmp/pyjamaz-refine.sock +JAM_FUZZ=1 JAM_FUZZ_SPEC=tiny .venv/bin/python -m pyjamaz.cli fuzzer traces {args.output} --socket-path /tmp/pyjamaz-refine.sock +``` + +Replay checks the entire work report (including gas and commitments) and verifies +that refinement leaves the initialized state unchanged. Genuine disagreements +are reported as failures; the reference report must not be rewritten to match. +''' + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--binaries', type=Path, required=True, help='Directory with matching polkajam and jamt binaries') + parser.add_argument('--output', type=Path, required=True, help='New fixture directory') + parser.add_argument('--base-port', type=int, default=42000) + parser.add_argument('--rpc-port', type=int, default=20890) + parser.add_argument('--proxy-port', type=int, default=20891) + parser.add_argument('--timeout', type=float, default=120) + parser.add_argument('--work-dir', type=Path, help='Keep reference node data/logs here for diagnosis') + args = parser.parse_args() + args.binaries, args.output = args.binaries.resolve(), args.output.resolve() + if args.output.exists() and any(args.output.iterdir()): + parser.error('Output directory must be new or empty; existing fixture files are never overwritten') + if args.work_dir: + args.work_dir.mkdir(parents=True, exist_ok=False) + asyncio.run(capture(args, args.work_dir.resolve())) + else: + with tempfile.TemporaryDirectory(prefix='pyjamaz-refine-', dir='/tmp') as directory: + asyncio.run(capture(args, Path(directory))) + + +if __name__ == '__main__': + main() diff --git a/scripts/diagnose_refinement_vectors.py b/scripts/diagnose_refinement_vectors.py new file mode 100644 index 00000000..2df8726a --- /dev/null +++ b/scripts/diagnose_refinement_vectors.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +"""Run real refine components under explicit corpus assumptions, outside conformance. + +The strict fuzzer remains unchanged. Authorization is a fixed test dependency +(b'auth', 1,000,000 gas), not a successful IsAuthorized invocation. Package +domain checks and import verification are recorded separately. The optional +bare-code adapter operates only during this script's component invocation. +No package, source preimage, proof or expected report is rewritten. +""" + +import argparse +import hashlib +import json +import sys +from contextlib import ExitStack +from pathlib import Path +from unittest.mock import patch + +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) + +from jamcodec.base import JamBytes + +from pyjamaz.availability import BundleData, availability_spec, validate_work_package +from pyjamaz.cli import _report_differences +from pyjamaz.fuzzer.refinement_vectors import load_refinement_vector +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, MAXIMUM_SIZE_ENCODED_WORK_REPORT +from pyjamaz.hostcalls.invocation import pvm_invoke_refine +from pyjamaz.models.common import Preimage, WorkDigest, WorkExecResult, WorkReport +from pyjamaz.models.state import PendingChanges, ServicesState +from pyjamaz.pvm.invocation import PVMInvocation +from pyjamaz.pvm.types import PVMCode, PVMProgram +from pyjamaz.settings import GP_VERSION, PVM_INTERPRETER, TEST_SUITE +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + + +AUTH_OUTPUT = b'auth' +AUTH_GAS = 1_000_000 +# Only the two observed foreign-encoded child programs are adapted. This is +# diagnostic evidence, not a permissive fallback in the production decoder. +SCALE_CHILD_CODES = { + bytes.fromhex('00041832000000ffff01'): bytes.fromhex('00040632000000ffff01'), + bytes.fromhex('0004080a0003'): bytes.fromhex('0004020a0003'), +} + + +def _groups(flat, lengths): + groups, start = [], 0 + for length in lengths: + groups.append(flat[start:start + length]) + start += length + assert start == len(flat) + return groups + + +def diagnose_vector(source: Path, bare_service_code: bool = False, scale_inner_code: bool = False): + source = Path(source) + raw = source.read_bytes() + original = json.loads(raw) + genesis, request, expected = load_refinement_vector(source) + package, wire = request.bundle.work_package, request.bundle + engine = InMemoryStorageEngine(dict(genesis.state.keyvals)) + services = ServicesState(services={}) + services.set_state_storage(StateStorage(engine)) + services.pending_changes = PendingChanges() + + assumptions = [ + 'component diagnostic only; strict fuzzer validation is unchanged', + "fixed external authorization dependency: output=b'auth', gas=1000000; no IsAuthorized execution", + 'invoke items outside the package gas-domain check', + 'supply original import bytes to the component without accepting their proof as valid', + ] + gates = {} + try: + validate_work_package(package) + gates['package_domain'] = None + except Exception as exc: + gates['package_domain'] = str(exc) + data = BundleData.from_parts(package, wire.extrinsics, wire.import_segments, wire.justifications) + try: + for item in package.items: + data.import_segments(request.segment_root_lookup, item) + gates['imports'] = None + except Exception as exc: + gates['imports'] = str(exc) + package.set_authorization_code(services) + gates['authorization_code_available'] = package.authorization_code is not None + + original_extract = Preimage.extract + metadata = [] + bare_blobs = set() + for item in package.items: + blob = services.historical_preimage_lookup(item.service, package.context.lookup_anchor_slot, item.code_hash) + if blob is None: + continue + parsed = original_extract(blob) + raw_program_valid = PVMProgram.from_serialized_bytes(blob, b'', 'diagnostic') is not None + metadata.append({'service': item.service, 'blob_length': len(blob), + 'normal_metadata_length': len(parsed.metadata), + 'bare_program_valid': raw_program_valid}) + if bare_service_code: + if not raw_program_valid: + raise ValueError('bare-service-code assumption requested for an invalid bare program') + bare_blobs.add(bytes(blob)) + + def extract(blob): + if bytes(blob) in bare_blobs: + return Preimage(b'', 0, 'bare service component diagnostic', '', '', [], bytes(blob)) + return original_extract(blob) + + imports = _groups(wire.import_segments, [len(item.import_segments) for item in package.items]) + extrinsics = _groups(wire.extrinsics, [len(item.extrinsic) for item in package.items]) + digests, exports, items = [], [], [] + size, offset = len(AUTH_OUTPUT), 0 + vm_entries = [] + original_invoke = PVMInvocation.pvm_invoke_host_call + original_deblob = PVMCode.from_jam_bytes + inner_adaptations = [] + + def deblob(cls, stream, strict_decoding=True): + raw_child = bytes(stream.data[stream.offset:]) + if raw_child in SCALE_CHILD_CODES: + adapted = SCALE_CHILD_CODES[raw_child] + decoded = original_deblob(JamBytes(adapted), strict_decoding=strict_decoding) + stream.get_next_bytes(len(raw_child)) + inner_adaptations.append({'original': raw_child.hex(), 'diagnostic_header': adapted.hex()}) + return decoded + return original_deblob(stream, strict_decoding=strict_decoding) + + def invoke(instance, *args, **kwargs): + vm_entries.append(True) + return original_invoke(instance, *args, **kwargs) + + with ExitStack() as stack: + stack.enter_context(patch.object(PVMInvocation, 'pvm_invoke_host_call', invoke)) + if bare_service_code: + assumptions.append('interpret supplied preimage bytes directly as a bare standard PVM program') + stack.enter_context(patch.object(Preimage, 'extract', extract)) + if scale_inner_code: + assumptions.append('decode the two observed child-code length headers as SCALE compact; original input bytes unchanged') + stack.enter_context(patch.object(PVMCode, 'from_jam_bytes', classmethod(deblob))) + for index, item in enumerate(package.items): + entered_before = len(vm_entries) + output = pvm_invoke_refine( + core_index=request.core_index, work_item_index=index, work_package=package, + authorizer_output=AUTH_OUTPUT, work_items_import_segments=imports, + export_segment_offset=offset, services_state=services, extrinsics=extrinsics, + ) + # Apply the same GP 14.13 report-result rules as Refinement; the + # native output and VM-entry evidence remain visible separately. + result, item_exports = output.work_exec_result, output.export_segments + if size + len(result.ok or b'') > MAXIMUM_SIZE_ENCODED_WORK_REPORT: + result = WorkExecResult(digest_oversize=True) + elif len(item_exports) != item.export_count: + result = WorkExecResult(bad_exports=True) + if result.ok is None: + item_exports = [bytes(EC_SEGMENT_SIZE)] * item.export_count + else: + size += len(result.ok) + digest = WorkDigest.from_work_item(item, result, output.gas_used) + oracle = expected.results[index] if index < len(expected.results) else None + items.append({ + 'index': index, 'pvm_entered': len(vm_entries) > entered_before, + 'native_result': output.work_exec_result.to_json(), + 'reported_result': result.to_json(), 'gas_used': output.gas_used, + 'expected_gas': oracle.refine_load.gas_used if oracle else None, + 'result_matches': oracle is not None and result.to_jam_bytes().to_bytes() == oracle.result.to_jam_bytes().to_bytes(), + 'gas_matches': oracle is not None and output.gas_used == oracle.refine_load.gas_used, + }) + digests.append(digest) + exports.extend(item_exports) + offset += item.export_count + + # Keep our computed authorizer hash and availability commitments. Never + # copy those fields from the oracle to manufacture a report match. + report = WorkReport( + availability_spec(package.hash(), bytes.fromhex(original['bundle'][2:]), exports, request.erasure_shards), + package.context, request.core_index, package.authorizer_hash(), AUTH_GAS, + AUTH_OUTPUT, request.segment_root_lookup, digests, + ) + expected_exports = [bytes.fromhex(value[2:]) for value in original['expected']['exported_segments']] + return { + 'name': original['name'], 'source': str(source.resolve()), + 'source_sha256': hashlib.sha256(raw).hexdigest(), 'assumptions': assumptions, + 'strict_gates': gates, 'code_packaging': metadata, 'items': items, + 'inner_code_adaptations': inner_adaptations, + 'items_match': len(digests) == len(expected.results) and all( + actual.to_jam_bytes().to_bytes() == oracle.to_jam_bytes().to_bytes() + for actual, oracle in zip(digests, expected.results)), + 'exported_segments_match': exports == expected_exports, + 'exported_segments_count': len(exports), + 'full_report_matches': report.to_jam_bytes().to_bytes() == expected.to_jam_bytes().to_bytes(), + 'report_differences': list(_report_differences(expected.to_json(), report.to_json())), + 'actual_report': report.to_json(), + 'source_unchanged': source.read_bytes() == raw, + 'state_storage_unchanged': dict(services.state_storage.as_list()) == dict(genesis.state.keyvals), + } + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('source', type=Path) + parser.add_argument('output', type=Path, help='New JSON diagnostic report') + parser.add_argument('--bare-service-code', action='store_true') + parser.add_argument('--scale-inner-code', action='store_true', help='Adapt only the two observed SCALE-encoded child-code headers') + args = parser.parse_args() + if args.output.exists(): + parser.error('output must be a new file') + files = sorted(args.source.glob('*.json')) if args.source.is_dir() else [args.source] + if not files: + parser.error('no JSON vectors found') + results = [] + for file in files: + try: + result = diagnose_vector(file, args.bare_service_code, args.scale_inner_code) + print(f"{file.stem}: PVM entries={sum(item['pvm_entered'] for item in result['items'])}, " + f"items_match={result['items_match']}, exports_match={result['exported_segments_match']}, " + f"full_report_matches={result['full_report_matches']}", flush=True) + except Exception as exc: + result = {'name': file.stem, 'error': f'{type(exc).__name__}: {exc}'} + print(f"{file.stem}: {result['error']}", flush=True) + results.append(result) + summary = {'diagnostic_only': True, 'profile': TEST_SUITE, 'backend': PVM_INTERPRETER, + 'graypaper_version': GP_VERSION, 'bare_service_code': args.bare_service_code, + 'scale_inner_code': args.scale_inner_code, + 'total': len(results), 'errors': sum('error' in row for row in results), + 'pvm_entries': sum(sum(item['pvm_entered'] for item in row.get('items', [])) for row in results), + 'cases_with_matching_items': sum(row.get('items_match', False) for row in results), + 'cases_with_matching_exports': sum(row.get('exported_segments_match', False) for row in results), + 'matching_full_reports': sum(row.get('full_report_matches', False) for row in results), + 'results': results} + args.output.parent.mkdir(parents=True, exist_ok=True) + with args.output.open('x') as handle: + json.dump(summary, handle, indent=2) + handle.write('\n') + print(json.dumps({key: value for key, value in summary.items() if key != 'results'}), flush=True) + # Full report mismatches remain visible and keep the command nonzero. + return 0 if summary['matching_full_reports'] == len(results) else 1 + + +if __name__ == '__main__': + raise SystemExit(main()) diff --git a/scripts/setup_fuzzer_runner.sh b/scripts/setup_fuzzer_runner.sh new file mode 100644 index 00000000..b64dec6d --- /dev/null +++ b/scripts/setup_fuzzer_runner.sh @@ -0,0 +1,46 @@ +apt update +sudo apt update +apt upgrade +sudo apt upgrade +python3 -m venv venv + +sudo apt-get update +sudo apt install python3.12-venv unzip + +# Docker +for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done +# Add Docker's official GPG key: +sudo apt-get install ca-certificates curl +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +sudo chmod a+r /etc/apt/keyrings/docker.asc +# Add the repository to Apt sources: +echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin +sudo usermod -aG docker $USER +newgrp docker + +# Clone repos +git clone https://github.com/davxy/jam-test-vectors.git +git clone https://github.com/davxy/jam-conformance.git + +# Setup fuzzer +python3 -m venv venv +. venv/bin/activate +pip install ~/jam-conformance/scripts/targets/pyjamaz/latest/gp-0.7.0/pyjamaz-0.1.5-cp312-none-any.whl + +# Install targets +~/jam-conformance/scripts/target.sh get jamzig + +# Run target +~/jam-conformance/scripts/target.sh run jamzig + +# Run fuzzer +pyjamaz fuzzer traces /home/ubuntu/jam-test-vectors/traces/fallback/ +pyjamaz fuzzer traces /home/ubuntu/jam-test-vectors/traces/safrole/ +pyjamaz fuzzer traces /home/ubuntu/jam-test-vectors/traces/storage_light/ +pyjamaz fuzzer traces /home/ubuntu/jam-test-vectors/traces/preimages_light/ +pyjamaz fuzzer traces /home/ubuntu/jam-test-vectors/traces/storage/ +pyjamaz fuzzer traces /home/ubuntu/jam-test-vectors/traces/preimages/ diff --git a/scripts/store_blocks.py b/scripts/store_blocks.py new file mode 100644 index 00000000..96f6a3ce --- /dev/null +++ b/scripts/store_blocks.py @@ -0,0 +1,65 @@ +import argparse +import asyncio +import logging +import os +import json +from typing import List + +from jamcodec.base import JamBytes +from jamcodec.types import Vec, U32, U16, Array + +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.logger import setup_logging +from pyjamaz.models.builder import Instruction, ServiceRegistry +from pyjamaz.models.common import RefinementContext, WorkPackage, WorkItem, WorkItemExtrinsic, Preimage +from pyjamaz.rpc.ws_client import WebsocketClient +from pyjamaz.utils import base64_decode + +JAM_RPC_SERVER = os.getenv('JAM_RPC_SERVER', "ws://127.0.0.1:19800") + + +async def main(args): + setup_logging(logging.INFO) + + try: + async with WebsocketClient(JAM_RPC_SERVER) as client: + + + best_block = await client.bestBlock() + + # with open(os.path.join(traces_dir, f'{base_filename}.bin'), 'wb') as file: + # file.write(trace.to_jam_bytes().to_bytes()) + + block = client.get_block(best_block.header.number) + + print(best_block.header.timeslot) + + + # best_block_sub = await client.subscribeBestBlock() + # logging.info("Waiting for best block ...") + # async for best_block in best_block_sub: + # + # pass + + + + + + + except ConnectionRefusedError: + logging.error(f'⚠️ Cannot connect to JAM RPC server @ {JAM_RPC_SERVER}') + + +def parse_args(): + parser = argparse.ArgumentParser(description="My asyncio CLI app") + # parser.add_argument("service_id", help="Service ID to monitor e.g. 6e1a1155") + # parser.add_argument( + # "--verbose", + # action="store_true", + # help="Enable verbose output", + # ) + return parser.parse_args() + +if __name__ == "__main__": + args = parse_args() + asyncio.run(main(args)) diff --git a/test/fixtures/SOURCE.md b/test/fixtures/SOURCE.md new file mode 100644 index 00000000..e48082f7 --- /dev/null +++ b/test/fixtures/SOURCE.md @@ -0,0 +1,118 @@ +# Fixture sources + +The upstream fixtures listed below match +[davxy/jam-test-vectors v0.8.0](https://github.com/davxy/jam-test-vectors/releases/tag/v0.8.0), +pinned to commit `d3c089c9a1d5352ad353626d7a2db8589f137b2a`. +They are distributed under upstream's +[CC0 1.0 Universal license](https://github.com/davxy/jam-test-vectors/blob/d3c089c9a1d5352ad353626d7a2db8589f137b2a/LICENSE). + +Paths in the first column are relative to this directory. Imported files are +byte-for-byte copies; STF tests vendor JSON only, while codec tests retain both +JSON and binary representations. + +| Local fixtures | Upstream path | Files | +| --- | --- | ---: | +| `accumulate/tiny/*.json` | `stf/accumulate/tiny/*.json` | 63 | +| `assurances/tiny/*.json` | `stf/assurances/tiny/*.json` | 11 | +| `authorizations/tiny/*.json` | `stf/authorizations/tiny/*.json` | 3 | +| `disputes/tiny/*.json` | `stf/disputes/tiny/*.json` | 29 | +| `blocks-history/*.json` | `stf/history/tiny/*.json` | 4 | +| `preimages/*.json` | `stf/preimages/tiny/*.json` | 8 | +| `reports/tiny/*.json` | `stf/reports/tiny/*.json` | 44 | +| `safrole/tiny/*.json` | `stf/safrole/tiny/*.json` | 21 | +| `statistics/tiny/*.json` | `stf/statistics/tiny/*.json` | 4 | +| `codec/w3f/*.{json,bin}` | `codec/tiny/*.{json,bin}` | 30 | +| `trie.json` | `trie/trie.json` | 1 | +| `shuffle_tests.json` | `shuffle/shuffle_tests.json` | 1 | + +The trie JSON uses 32-byte generated keys. Its upstream `trie/merkle.py` drops +the final byte when encoding leaves; the test applies that same conversion to +31-byte state keys without modifying the fixture. + +Other fixtures, including `codec/jdt`, `pvm`, `hostcalls`, `cli`, `state_trie`, +and `ed25519_vectors.json`, are project-specific or separately sourced. They are +not covered by this release provenance or its license statement. Full-profile +STF and codec corpora, erasure vectors, and block traces are not vendored here. + +## Running the release vectors + +The default Tiny profile uses these vendored fixtures. To select an external +release checkout, set `JAM_TEST_VECTORS` to its root or its `stf` directory. +For Full, run the following from the repository root using the project's active +Python environment: + +```sh +JAM_TEST_VECTORS=/path/to/jam-test-vectors JAM_FUZZ=1 JAM_FUZZ_SPEC=full \ +PVM_INTERPRETER=CPYTHON python -m pytest \ + test/test_accumulate.py test/test_assurances.py test/test_authorizations.py \ + test/test_blocks_history.py test/test_disputes.py test/test_preimages.py \ + test/test_reports.py test/test_safrole.py test/test_statistics.py \ + test/test_codec.py test/test_merkle_trie.py test/test_shuffle.py +``` + +This selects the release-vector harnesses; other unit tests may assume Tiny. +The 18 custom JDT codec tests use Tiny fixtures and are intentionally skipped in +Full. Selecting the external corpus does not imply that all production behavior +passes its vectors. + +The release documents a deviation for `bless_from_non_manager`: it accepts +non-manager `bless` calls where GP 0.8.0 returns `HUH`. The setting +`GP080_NON_MANAGER_BLESS_COMPAT` in `pyjamaz/settings.py` controls this behavior +and is currently enabled. Set it to `False` to enforce the printed GP rule. +Compatibility only applies while `GP_VERSION` is `0.8.0`; memory, gas, and +service-ID checks remain active. Fixture expectations are unchanged. + +The release also adopts GP #533's `grow_heap` behavior: query calls cost only +the base charge, and insufficient gas is drained to zero without changing +registers or memory. `GP080_GROW_HEAP_OOG_COMPAT` in `pyjamaz/settings.py` is +enabled for these vectors. Set it to `False` for the printed GP 0.8.0 B.15-B.16 +rules, which retain gas on failed growth and can produce a different state +root through accumulation gas statistics. + +GP #538 rounds the stack reservation to 64 KiB zones when computing the +`grow_heap` upper bound. `GP080_GROW_HEAP_STACK_COMPAT` is enabled for this rule; +set it to `False` to retain the printed page-rounded bound. This changes the +heap limit without moving the stack's mapped pages. All three compatibility +settings apply only while `GP_VERSION` is `0.8.0`. Disable both `grow_heap` +settings to use its printed GP 0.8.0 rules. + +The remaining release deviations are always enforced: conditional moves count +the destination as a source register for gas pricing, and program blobs reject +more than 2²⁵ code bytes or 2²⁴ jump-table entries before decoding their payloads +(GP #559). These limits apply to both standard programs and nested machines. + +## Report export-count conflicts + +The pinned report STF vectors use synthetic availability export counts that +disagree with their digest export totals. All 14 accepted Tiny vectors (21 +reports) and all 16 accepted Full vectors (23 reports) have this inconsistency. +For example, `report_curr_rotation-1.json` declares three package exports but +17 in its digest. GP 14.10, 14.13 and 14.17-14.18 imply equality, including +zero-segment padding for failed refinements. + +The source vectors are not rewritten. For each affected vector, the test +first verifies `exports_count_mismatch` and unchanged availability state, then +marks the source's acceptance expectation as a known conflict (`xfail`). A +different rejection or unexpected acceptance fails the test before that mark. +Synthetic validation tests align their counts and re-sign modified reports; +dedicated tests exercise inconsistent counts without that alignment. + +## External block traces + +The same pinned release supplies `traces/fuzzy_light`: 200 Tiny inputs plus +`genesis.bin`, not vendored here. Keep genesis and all preceding trace inputs +together so replay can reconstruct the actual header ancestry. For example: + +```sh +JAM_FUZZ=1 JAM_FUZZ_SPEC=tiny PVM_INTERPRETER=CPYTHON \ + python -m pyjamaz.cli traces /path/to/fuzzy_light +``` + +The command uses memory storage, skips historical wall-clock checks, and exits +with an error if a pre-state or post-state root differs. Other validation stays +active, using the configured compatibility settings. Blocks 152–155 are expected +to be rejected with `bad_code_hash` and keep their pre-state roots; all 200 +post-state roots must match. Omit `--prompt` for automated runs. + +Mismatch diagnostics are written beside the inputs. Use a temporary directory +containing copies or symlinks of all `.bin` files to keep the source corpus clean. diff --git a/test/fixtures/erasure/LICENSE b/test/fixtures/erasure/LICENSE new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/test/fixtures/erasure/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/test/fixtures/erasure/SOURCE.md b/test/fixtures/erasure/SOURCE.md new file mode 100644 index 00000000..5e44593c --- /dev/null +++ b/test/fixtures/erasure/SOURCE.md @@ -0,0 +1,12 @@ +# Erasure fixture provenance + +The twelve JSON files under `tiny/` and `full/` are unchanged copies of +`erasure/{tiny,full}/ec-*.json` from +[davxy/jam-test-vectors v0.8.0](https://github.com/davxy/jam-test-vectors/tree/d3c089c9a1d5352ad353626d7a2db8589f137b2a/erasure), +commit `d3c089c9a1d5352ad353626d7a2db8589f137b2a`. + +The upstream CC0 1.0 Universal license is copied to `LICENSE`. +GP 0.8.0 Tiny uses three original shards and three recovery shards; Full +uses 342 original shards and 681 recovery shards. + +These are test inputs only. Production recovery never reads fixtures. diff --git a/test/fixtures/erasure/full/ec-100.json b/test/fixtures/erasure/full/ec-100.json new file mode 100644 index 00000000..e0866053 --- /dev/null +++ b/test/fixtures/erasure/full/ec-100.json @@ -0,0 +1,1028 @@ +{ + "data": "0xdab226157212e5c034111bd3ffa1f73e677a68b8d523a488d3bcd96051770026474b1532d7270e562ccbe4ef1e2a05d7470216fbba74e6a7e6282cc932020769e1ea516bfe3296d2c3acd4391a07694a7180590283f8a6126360da52fad8c62e4418c0c0", + "shards": [ + "0xdab2", + "0x2615", + "0x7212", + "0xe5c0", + "0x3411", + "0x1bd3", + "0xffa1", + "0xf73e", + "0x677a", + "0x68b8", + "0xd523", + "0xa488", + "0xd3bc", + "0xd960", + "0x5177", + "0x0026", + "0x474b", + "0x1532", + "0xd727", + "0x0e56", + "0x2ccb", + "0xe4ef", + "0x1e2a", + "0x05d7", + "0x4702", + "0x16fb", + "0xba74", + "0xe6a7", + "0xe628", + "0x2cc9", + "0x3202", + "0x0769", + "0xe1ea", + "0x516b", + "0xfe32", + "0x96d2", + "0xc3ac", + "0xd439", + "0x1a07", + "0x694a", + "0x7180", + "0x5902", + "0x83f8", + "0xa612", + "0x6360", + "0xda52", + "0xfad8", + "0xc62e", + "0x4418", + "0xc0c0", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x5120", + "0x20b4", + "0xb47f", + "0xc7b0", + "0x6d65", + "0x1fe3", + "0xe170", + "0x4c14", + "0x61c5", + "0xc1bd", + "0x56a7", + "0xd303", + "0xcc04", + "0xb429", + "0x8c9d", + "0xab55", + "0xc1de", + "0x70bc", + "0xf50d", + "0x25b0", + "0x1563", + "0x589d", + "0x72ee", + "0x55d4", + "0xa6af", + "0x638d", + "0x78ec", + "0xa904", + "0xedd2", + "0x92a2", + "0xb210", + "0xb885", + "0x78fd", + "0xa5e9", + "0xd017", + "0x7f28", + "0x401c", + "0xdc43", + "0x31e4", + "0x13c4", + "0x7785", + "0x2a16", + "0x7b78", + "0xe6c7", + "0xff73", + "0xf72a", + "0xcd93", + "0xd6d8", + "0x8f2e", + "0xd232", + "0xa470", + "0xd429", + "0x5c0f", + "0xf60f", + "0x6a53", + "0x6c62", + "0x09fc", + "0x628e", + "0xc296", + "0xe08b", + "0x3ff7", + "0x8631", + "0x0cb9", + "0x3df3", + "0x3f62", + "0x29ef", + "0x5e32", + "0xaadb", + "0x3126", + "0x0037", + "0x5829", + "0xcc2a", + "0xa48e", + "0xce65", + "0x3a06", + "0x57d4", + "0xf7ad", + "0xd200", + "0xb19e", + "0x0b12", + "0x9203", + "0xdf9f", + "0xfb55", + "0xe321", + "0x0093", + "0x7779", + "0x4c60", + "0x065e", + "0xe989", + "0xe664", + "0x5710", + "0xe17c", + "0xeb22", + "0x0f03", + "0xf16c", + "0x449b", + "0x1614", + "0x1fc8", + "0x38e9", + "0x0eab", + "0x92a0", + "0x339e", + "0xa718", + "0x92ad", + "0x250d", + "0xb7a7", + "0xa528", + "0x5403", + "0x0678", + "0x1776", + "0x7b03", + "0xda4e", + "0xcc41", + "0x0f3f", + "0x16ec", + "0x4058", + "0x2378", + "0xbc4d", + "0x224b", + "0x0ab7", + "0x2eaf", + "0x36ee", + "0xf8a3", + "0x66c6", + "0x84e6", + "0x3e09", + "0xaa3e", + "0x6deb", + "0xf199", + "0x1908", + "0x5938", + "0xed71", + "0x191c", + "0xb90b", + "0x9c11", + "0x988d", + "0x7fb9", + "0x4d46", + "0x344c", + "0x876f", + "0x456c", + "0xf6bb", + "0x2a18", + "0x0329", + "0xac1a", + "0xe42a", + "0x947f", + "0xdbee", + "0x92ca", + "0x07c6", + "0x6d9f", + "0x109a", + "0x7e4b", + "0x11bc", + "0xc93a", + "0x63f7", + "0xdf9d", + "0x1b19", + "0xbf42", + "0xf6d3", + "0x78a3", + "0xcfe7", + "0x2a69", + "0xc0e3", + "0x3564", + "0x3ac5", + "0xf8ca", + "0xa395", + "0xb908", + "0x6c16", + "0x451d", + "0xd1c5", + "0x5f02", + "0x13ab", + "0x2e79", + "0x78da", + "0xc354", + "0x8617", + "0x7f4a", + "0x58eb", + "0xb641", + "0x3d6d", + "0xd404", + "0x6dfd", + "0xfea6", + "0xf418", + "0xb7e6", + "0x64b2", + "0x3019", + "0x0007", + "0x2e33", + "0x60db", + "0xb5ec", + "0xe5d9", + "0x55cd", + "0x9adc", + "0x01df", + "0x5c0c", + "0x6086", + "0x0ebc", + "0x0f46", + "0xee22", + "0xc755", + "0x0b64", + "0x49db", + "0x1f15", + "0xc8f3", + "0xf2f7", + "0x9d7f", + "0xf194", + "0x1e54", + "0x334b", + "0xc651", + "0xfe79", + "0x2346", + "0x4623", + "0x6b59", + "0x259b", + "0x2e7b", + "0x2c14", + "0xd68f", + "0x1778", + "0x6790", + "0xd5ff", + "0xb856", + "0x548d", + "0xded6", + "0x7adc", + "0x4c79", + "0x147b", + "0x560a", + "0x2709", + "0xd9cd", + "0x7d69", + "0xf2da", + "0xdffe", + "0x3219", + "0xeb82", + "0x75ac", + "0x4a47", + "0x5a56", + "0x590c", + "0x418a", + "0x8a7e", + "0xca08", + "0x200a", + "0x2a27", + "0x880d", + "0xc53d", + "0x557f", + "0x8928", + "0xd41f", + "0xf9cc", + "0x0a35", + "0x4dfa", + "0x9967", + "0x6be3", + "0xa25d", + "0x06d3", + "0x1c70", + "0x966b", + "0xfc72", + "0xd479", + "0xef74", + "0x34f1", + "0xe076", + "0xe02f", + "0x2752", + "0x9702", + "0xf45b", + "0xbb80", + "0x0190", + "0x18c7", + "0x184b", + "0x941c", + "0x9a3c", + "0x3210", + "0x4108", + "0x4733", + "0x1f53", + "0xfc69", + "0x7c02", + "0xfe9f", + "0xdf92", + "0xe1ad", + "0xd78a", + "0x50e1", + "0xf244", + "0x1890", + "0xb621", + "0xea9b", + "0xef64", + "0xebe3", + "0x9e83", + "0x6362", + "0x7252", + "0xdded", + "0x3e6d", + "0x20c9", + "0xdfb8", + "0xb560", + "0x8d20", + "0x4316", + "0xdadc", + "0xadcc", + "0x5d32", + "0x38fb", + "0x333a", + "0x2d65", + "0x560b", + "0x9204", + "0xa369", + "0x9978", + "0x5008", + "0xf9e8", + "0x32e3", + "0x59d2", + "0xeaa0", + "0xeb5d", + "0x7418", + "0x8654", + "0xab4b", + "0x38f7", + "0x52e7", + "0xe153", + "0x2612", + "0x67ce", + "0x7faa", + "0x2d80", + "0x409a", + "0xa06b", + "0x3211", + "0x4f02", + "0xaf0d", + "0x6020", + "0xf14a", + "0x29f6", + "0x33eb", + "0x5d25", + "0x85dd", + "0x5060", + "0xd8d7", + "0x101c", + "0xd55d", + "0xee13", + "0xefbc", + "0x6906", + "0x1748", + "0xc053", + "0xde48", + "0x81f9", + "0x16d3", + "0xb92c", + "0xd8fc", + "0x918b", + "0xf41c", + "0xa6e3", + "0x7e35", + "0x0410", + "0x2265", + "0xd62b", + "0x12d9", + "0x646b", + "0x73bb", + "0x7f6d", + "0x4057", + "0x846d", + "0x5fd5", + "0x0fc2", + "0x5f64", + "0x9c42", + "0xdc5a", + "0x25fc", + "0xd46b", + "0xee58", + "0xc2e7", + "0x6bd8", + "0x0430", + "0xa03a", + "0xbfb1", + "0x0726", + "0x3569", + "0xe084", + "0xf5b6", + "0xa922", + "0x2277", + "0x29a9", + "0x4bfa", + "0xf9a5", + "0xe877", + "0x7440", + "0x208c", + "0xbbfb", + "0xb476", + "0xedbc", + "0x536e", + "0x2cef", + "0x968c", + "0xaf87", + "0x970f", + "0x9d50", + "0x2984", + "0x750e", + "0xf21c", + "0x268e", + "0x98e8", + "0x0d19", + "0x25c3", + "0xd7db", + "0xdcb0", + "0x72b6", + "0x026a", + "0x5fc2", + "0x6e19", + "0x41cf", + "0x9f01", + "0xc640", + "0x4a21", + "0x232c", + "0x9ffa", + "0xac4d", + "0x7bdd", + "0xc055", + "0x086d", + "0x9693", + "0x3c01", + "0xd975", + "0xa407", + "0xb1fe", + "0x5159", + "0x36fb", + "0xa59f", + "0xc7da", + "0x9cd2", + "0xabf1", + "0x4231", + "0x9fdb", + "0x7c8b", + "0xaa54", + "0xe99d", + "0x19ba", + "0x6726", + "0xd577", + "0xa00c", + "0xfb72", + "0xb177", + "0x72fe", + "0x1bf3", + "0x1b9d", + "0x8823", + "0x8541", + "0xa53c", + "0xffb4", + "0x4263", + "0xeeaa", + "0x27a8", + "0x6acc", + "0x4082", + "0xf4fc", + "0xf61e", + "0x1d8e", + "0x94a4", + "0xe587", + "0x67f1", + "0xb8f7", + "0x2247", + "0x52ea", + "0xe891", + "0xc7e9", + "0x4a76", + "0x2297", + "0xcaf0", + "0x666f", + "0xa9d1", + "0x4df1", + "0x8208", + "0x7229", + "0x789e", + "0x4bd9", + "0x090c", + "0x5aba", + "0x576c", + "0xd331", + "0x1b2b", + "0xcb69", + "0x282d", + "0xd2e3", + "0x5811", + "0xdb6b", + "0x4761", + "0x53e8", + "0xe3c7", + "0x91cf", + "0x061d", + "0x4bbd", + "0x8ac1", + "0x3b4e", + "0x781a", + "0x509b", + "0xc096", + "0x6275", + "0xe810", + "0x38fd", + "0x3f9f", + "0x5015", + "0x4dc7", + "0x83a8", + "0x6680", + "0x3967", + "0x654e", + "0xfbbf", + "0xf8dc", + "0xc4ef", + "0x02fd", + "0xc74f", + "0x6871", + "0x6cb3", + "0x3310", + "0xce5b", + "0x0af6", + "0xb2f6", + "0xbbc0", + "0xf3e7", + "0x94b8", + "0x3b67", + "0x201a", + "0x2e8d", + "0xffeb", + "0x0baf", + "0x1118", + "0xb675", + "0xd670", + "0xad5e", + "0x527a", + "0xbff6", + "0x8b2f", + "0x607b", + "0x660a", + "0xabb8", + "0x861e", + "0x87ec", + "0x164e", + "0xa402", + "0x9e0a", + "0xfa23", + "0x60e1", + "0xd85a", + "0x8da8", + "0x6003", + "0x0da4", + "0x21d9", + "0xeaf2", + "0xa610", + "0xab88", + "0x77c3", + "0x6196", + "0x36cf", + "0x910b", + "0x438c", + "0x2787", + "0x39db", + "0xe87e", + "0xcc9e", + "0xb768", + "0xd8f8", + "0x3f81", + "0xf390", + "0x8760", + "0xed34", + "0x1e8a", + "0x8c82", + "0xe7d3", + "0xe603", + "0x84cb", + "0x729f", + "0x82a5", + "0x0c7e", + "0x311c", + "0xb9a2", + "0x0c90", + "0x3256", + "0xc1d7", + "0x1c82", + "0x5f82", + "0xf2e8", + "0x9f17", + "0x9dde", + "0x9ee3", + "0xbb25", + "0x2723", + "0xdee1", + "0x2df8", + "0xd1ef", + "0xae84", + "0xfefe", + "0xde6c", + "0x5686", + "0xe2cd", + "0xcb89", + "0x8f05", + "0x86d6", + "0x5ddb", + "0xb635", + "0x92ad", + "0x201f", + "0xc561", + "0xcb68", + "0xf2ae", + "0x563c", + "0x5588", + "0x592f", + "0x6abf", + "0x42be", + "0xfef8", + "0x7183", + "0x3842", + "0x1b32", + "0x0f72", + "0x558d", + "0x04ba", + "0x7862", + "0xc937", + "0x9959", + "0x1e13", + "0xbe2e", + "0x9347", + "0xa187", + "0x6cd0", + "0xd563", + "0x4256", + "0xd442", + "0x044c", + "0x2807", + "0x0733", + "0x1534", + "0x8fdf", + "0xd0d9", + "0xc2d9", + "0x7a37", + "0x119d", + "0x2500", + "0x0ae1", + "0x0c10", + "0x5f91", + "0x5d2d", + "0x87b9", + "0xbeb7", + "0xce03", + "0xd81d", + "0x1120", + "0x4b39", + "0x6c0e", + "0x4f68", + "0x79b2", + "0x2fec", + "0xf496", + "0xd7d6", + "0x6fd7", + "0x81c3", + "0xebc7", + "0x23eb", + "0x86fa", + "0xa42e", + "0xdd8d", + "0x5c58", + "0x3a35", + "0x36f4", + "0x5d52", + "0x6581", + "0x9f02", + "0xdcc0", + "0x6672", + "0x36d3", + "0x233f", + "0x58f1", + "0x9ee6", + "0x7ce0", + "0x42ee", + "0x0f2c", + "0x856e", + "0xb34d" + ] +} diff --git a/test/fixtures/erasure/full/ec-10000.json b/test/fixtures/erasure/full/ec-10000.json new file mode 100644 index 00000000..bf1e56a1 --- /dev/null +++ b/test/fixtures/erasure/full/ec-10000.json @@ -0,0 +1,1028 @@ +{ + "data": "0xc6b508fcd3e35748931d904f0fa51e16f4f753c7b6cb913fe538f6ff5cedac1ef2da5ba1d08865d052b2154144824e6267be7cb3d84080e8c346e652faa11cc735b42215e34f0d421f43989aca8a5c3f2ac338bafe77a89cb2550206613a2cd88bcd83d46ddc7a56c98db3026b30f407cc1c7d263723d91aae5c84f5dc65a6901cecb3918dce7c58492f15d568e73447d05a28340703c5c099e443c851122c111c8f07afef4c85e6165c8ada46ed6818e72fe9ab6f9fd804f49a66d7e40e1229ff1bef4fcb0bc3a362faabb6ea2b9cb0ec9086fb18520c46ab199f7f08971fa51a11aa1df22d1c2260c98190f0b5a56b4cc66a00ad93d9f3c6b1af79e6d56f1267ea960d07b1230fca6a590a39b0b4bc169766e4c8eb8911f8a1497555630fe1709663ab41f4ef65f0fc2348dff5e4750aca7020f6cddab2b063f0e32ac38fc7672e6118abf9b69a3f252c0f76b032444178d51051fa1993b8d05099d4b2cf14255341d2da7c0e960a621cad0d7f0f7ca4ecf1e51712b785e960773b2b442a9b6291076aff0f83de71ced9acbab32124e20b46787d77261877bb215b28737cd30e34a4172f95d6ba204f25cf1ad05cf186e5a7c1b4bb29d31394aea5f3f627f2296305c68ef5287b7c8f84c0eafb8f762017b77d45116002551ac32653c2b050d4970f93dca093079dee135f7e1a38f030c9cb3de0f0a3e411874781e76d4c6bf34a86a26d461873991af4ac64bcfb3f65f079b796035236b15e32d5d82b274866002242b7f27cd8061edb42b1319fd0bb9335c80c62476a9e746c0744b0089399120823b46a72d6fae79a9b649912379bd33f866d5d83970409e2d97c1cd6ad2f34e07d317997d654200a0630fc14425727cb00823b538f4a6c3f111ddf315494c1e44b960de233ab98911c766bbfe67aac3f3fc52ea02c1681ccc240733bda486613a59d0de3308243bfef6662e05429b309420b728b3d33a5d1a05dc6390aef86f179299894bef9c8426f4fe0c131c49b0842e0f227a88a48b60456b3bd89df27bbe10da02136079bb22da62ade4bb0c65f25ffc724118d081c866f86620c64f6c9e8812692c5c80de00015a713d367b4243fe2e0af6ac08bf6ad1ba93c5ef4f164eaeb78ee8414d86ee8e528e6fc065b921c72a8ea24f1fff3da1b37dc8e0ca2c3f3618a0e141df436e114ffb49fdc5467843edaaceba06241cf09bc7dc079c36ed35c12e7e341cf2e1fc302d55ae3732a1a3fc61e8c4ffe15d15b0977f418c38016d141f67befab4c2c40ec1328789e19128cd1fa96286b8f084d3afc31a97d1cdb6e7f4d02c8a10295f6564fc24d7e29c5730c0d85745f1720b7f9c15a111425ba9dcdbfb42524bf654cefee3a103c1a7695cb0a7d8a623e923def96437f7cc39abdf1b72d7a2bff0ee84bd4acebe45fa603b25c7868dbcef21d0203186f0b4e8c191e8cf986bea2c6afe12baa12b3fbe503562098851201907d23e5ad1934899763cc3dd94dc0b8a8fcef3e6bb627134ec099497521d2b48a87e234a738a042487ffd1b19c927c8193c88b9b563b9dfda3f354948882915cc653918da8d07b2badfb39ccfef74b32b939270555c4ced7cbcf0e2f9aa31e083091ef6f42c403b2d5b49aab34c048174ab7377051ceb38e7a8da9dc8ebf6b194bf801b62756ddaa1b28d348cf685342abe5e6fb1f55e3bb626c4dbc542113e71193ea22837562f1e6554d5c46b94f5cf0daf3e7e867b66ab82315715614513becd5150021f235e4c8cc826060996d86d1e80e6f3ae372197d9e859e99ef520c637e4068abb9fb3f1307199536f6ab0dd007b0719530d4d511b544bfb0da4a6f16d24cc2f9f030bf75fa1b20c462b9a34343f0fa3a0f80a1713d198fd6600c132d3a6e99bac07e521a5db45c90c361307f0f24603c092021a76ce529f435b80b3540166e0d9d0124b4776256f0bcf297d35886ec645694e9d5df4b6586fb6a481a0704f123dd0da7f72bc8e21b443efc30522f0a514626df96504e588bc2aed12a471efaf787416538f41714bfd83223b6f34d530a49e3442b8580a4eb09ba8afc42db97e2e50ec8105f3716df24505b965c769ba0733c422d3c20c8de28425a885c9a5c63c4f0d9f2d9da5b5b1b8778ae7315493e20e5c7c92e0db947ad51a53a765a2470089bb644433a80fbed9e2353bf960dc9d44c13bd306228fb33d6c2c73e8fd72305cd9462bc26f49aacbf698fc5a888af000498ed64424f6237a2b53871e407be950571be7ebeec9ff516f7d1a7ddb1c4ef0d59dfd09dd55b2dc0df9f29fe9ec3308145a1b36f39d6f3502c09d9fc582832b14d29e1261cfd4e9eb2a8a809422ddd978dc7de57e6250eb57a850d33189a0c2abae47657a211d898a2912fe6aac3bdf551d374fa2f776e55390c2ec79871d678ca653d5b9e4803cfcdb84e4c2ad3da7caa4700e0b7904180f0e18333ff4f09988d7659b332f2a33b9bc5343720440f88bb3b9fce3d0a39c6af613833e5932e6020a6548c5e94c2521d495ec94f3d3aca881bdd080e36820083c3921432e5307ba699840ee729935ecc1ab46d9065e04d18048f0a4de369999075f311a90fedd305eb843c7215c4ff4664c3c8342fe4b465cae1d1109c494e7114762d747e28e28414ba6886afc41d25ed65cfc303f54f17e4080d4992dd022b1666b6a058e28d319c7cf6e83f86ad03c45c13c0599015336aebdee7da1912584eaf94aaaad9a8b62c8861d55ffe274950435cb0f56b5edea2cb391657fdc8550f45dd294325cd2e90f8922357a604f122421e22e29317dba1eca104e0f5c6f051b8196115b474f64e042e2e7c58b9bf9caa4be580f3bd2b1f5755721f533d7acb03cfbabb6f5ae2279e341e0e0d8ec9d3379d28b00343882bd4b0a06c3d0008153b6d8d453eddfa39b5142fee4e35de2226c33da9e78b3ff5f5dbc5c4006f8a361e934cd1b2fe28da414001afba18cdb9a79108b05a776dfeb9fa905104166397718a81737383e601f53d962cf12a0f89c1e58552c137b8d6c0689544dec9637d334758bd8d9a6e5a94e30bcac5c8177c045cc0b1e83701d74bef96bd69e55b8f6c3e70e772383658a28c894a9cdd6c6c6bf3292f1d1fafe354265ab550054d5e83e664127b94516b138ce1643fdcd5264609080e4786e0a0ccda5986667acb0c136ba85741fb848f593b595c2da00d317c8acc9d2e4ef5ea0776a8722eff5b40a05b63ff8940f7834b070f0bfeb8b8f39702583c291758b495a672439e7781c335cf708a3ff49c6eb95f8acf6c156693d3482b1e377d1260ddd6c86139b28ec4568284b928ef68004be767e92105903561073f8749918cd7d9ee2fe8b12f81eca54402037044a52e8d3bd162105d03e82292b7051293a1788c72fbee4bc0e3d9523d32e610697210ed5828cdf783854c823db9763e174ea7cdd4fefd58e868a3ec34335afe75908a45d53177800d7aabe8c8a13e526df2503be7baf4ad61e99bf22d7674f402ad70abe4d238d1f19526bb8e72c0fb08230810eb4a9b90eb3fc0bb6833ef32834060c729db9d30a02f96e50f4f6e1d2f69663ce5731eb87906506a9bdca54dca163be505d80639948cdd711689a763a69ee7aae115a761b224f12e37742dc8cfebb7bdc72e3c6ba12a585d57f3bad5c47be7048480a261aa1d0c82c409ede7976eeddcfba8c044abceec7acfb1110ee84697a12141a11de450da9b8a7e2450d6e58ffd9b37559314321181a41d776c851f2e8f9bb7c5a7532c1c38846c6c55a94a88210f92e276e50d9d63ce998fd8719318c61d73715734313d05a39e3b23618db7e1ad16c47551ce032f69cbf83816a57e142953ef73bb8603d5c7ef5ebcffd08c627418ec87b7bfe6ceb57621b2872a4823bfb639e1aec52654a6ec935f13e97e4b041dd7a89197bf3725de3015c3968dc08703ccfe60a33301082e654873ad996b6801aa37fe2664200690439deb7f029c6032a223ea8ee192f747b9b3308e9c4846b9472f1f9ed6930cc67e67a90f4cd3a1708545ee5ef1f5f86743b2adeacdca624af2b444dc531bf9f267f0fb487580ef73902205e43bc4031099db8bd21516a0fbe0225ca25652e8542119e46deee6e53fa78798e190d5d342492036db811a9cf289b29c22e3bd467b34626412f0d40167fca051d879911fefda672eb890c873dac4eedaa3e9aaffe9ddda81521d30f4d5dd57165e4a8514851cb2c3d20ab0f3115480a4aab9dd29ed6f9d6aec29b99689cdbde81e7bb718b8d13c46d08ebb08db042bb2da8cd586b68309742c30a643aa02aa362181de8f4b0503652220334bc69fdfaa2697e241c993aca0ab7d12aebe5f24c2d4a63e2a9493d746171ff78349bb3eadd25ada38890e16e703b9477be4719b7b4c1a6c094aba8a7ce084991f2aee7a079c861a7e63e051dd51ee2cfe84f474b14db59b946b41a873b6c761477a3b99315acb288a18327585b5d5bbc357b7044aa4409df4cb701e35fb8ce1acdf9fe68036b8fe27cdfb2a02ff6b104de1ad360758280ec4dce3d79d217d3f1a81bbaabe4a12e9feb1a2dbd48362ce1650754c97114757b64cd344fd5df31425f3f9020fe9a22240d6753510b8ba9dd17e8271770a61c4fdea5856c1e1107c93e1bca655ac04c9d95c8b3f2bdcc60f60b094e4b21981b6e5f7813290bc7c7f39ecd21a6902b23d3010716d4f0731af2f1af730e474f74b93baceb152c397d6bd6d46f422a0741c7b4501a2daaff26daeb0079318494f5071d5af40b4a13bc5d37f0a242fbc466838c2c57184f802e2af4bbfacaf11166d71a5612074ff4578257e020ce769e9e28d473978253291acc71f77ae0ca5d6ead6498a3276335e7ad4ec42f9e6604e0b01f43ce2a2831b66df9040079411f5fa8e57fa16a0a3b13f0144b0cc3be91c30a6e5ebfbacb9fd6511ca82791cd456fd5268bccaf9f574a90c72ba75552e1a05e5310c46660e2a91eb192bcd4acecfba5c932437798ef88c3f50f7397944cb2484f16d0f0e7d244ebf8d9f8eef41efca1937e42a4e93005639c3a4347e41cd84f6c3fe843c824e7a38be94b6f78f90672b1b4f5f562ddf8d95a5ab68e4634833a3767f4fd2ababcaa636a5c188c9ee5925fe259a4b209091151e66580a5ba74ad05c989e11c332891de162f03ed18498e512ebbb0b8da813edd5abfd29b3fb6c3d44fc2b112f35d5e8edaf23684d47f6396dd4fb1f0b51ebe09d7065730e8b22153adaf1214c958eb3a311e704fab7f3aa6968e23ecd536e6c2d3a15aeec2e38fd8e833b96eb6df41abd5c17e0077d91e94353160cbb9dd8cde03400a8df0a89b1f9cda0a6d7a60292ad7aaad7e1d281f90ae5255d3630d56d847e6352a4fda85a0157a85ea81234b1d59359065768bc033c833b6621017499f8294d8808f4e969bd57e98870a4254001936a25d7e707eef14db3fbb2852e01434774e7ba7f05ddb170e9585d3a749170bbfc750eacf2b62a9aa0d03591aa824b755b22e3bf4fda4615e15cceab5bc254242e1dfb728887f027f7feb63058393007fc4d3bd0a0da28443fbaebdfe7aff4291807ba884f5bad9b18cd1da52c257254a054e8aef83750ed4588074356759067e5d277063751ce9cbd7dc4f480e2c1497ef42c11bdf61c2a33fa176777145dfd83b2961933067e5818961829ed042c9eec769f4b2e8764c8cc8756d928827c0311a682f98a30f745a50e9f031cbd407f12ec3112f8dd63b893f5b6d51f2f89dff2b0f12f06eeb1eef007879fc128f5c127b6898c9edf38f003f5d3ba3f26762f850e20401b172eebca30137ad5f3c3144b6094729e380fac6a222838dfde4eb6015df2c639092fce9d036a0813d553459285219f305af965c952ac73cb8627a17542ab426c97e3c49be0dfec183be0c2836a556fba06bab6b217aa4235703361c2b8221c7c52f58d46beddb2e6302bd269ee89ff0cf6a04214de7fd8179ff37c6099113fe8487eccd75d0d807693c4fe7519d367e6a6c47f7fcc0ecfe51c6bd3ca2606978d9f3a9da79741fc0f1db5dc6b4e2b6aa6e63d8116fb00f080e1f6b2476c497f902df08865e63b8cde51cbabd3dbc579639d13226d99ad01d4f0f6dc2721be57b4f7659205e1fe89e54171230d11fbe629df943e7e70e39918a8dd01f094a06fb56126e8ed0817a1f317c136424548667af60f8c34d2d3787f56c1f1436fa15ca4b1007637c67864d628dafc357ccb46edda7614a5210bff120a3e8401515f59c47c4fbe41e2c24c4e86f2fa39827f35c835b34e9e36aa373b2cb108bbb79decb4daae350b12198079b64fd341be1f2e2e165aefcb09cc87d0c98a8a7217ac49eadf65dde13def1eed85e7642bf76a9fd3d039915595b7a26622a0d49e9143af803113b48efc9227ea04cec292a8524ebececdae7f9ff0723aedc0b82fb2313067323bb78ecd794346a68742d901759e8c43eb6144bc6e43e8fd660e23f22d1b686f1dae285c02ae0f41e0160cba69c7b7dd4bbb4d4f34d28990ce14f9b0704fbb1d9af0d074d05fd023d2a45167729af6f074cb45f2d8372e319550aaaf00891c4abfbcccd56c6d849bf1fee81cce992e566c7d5ad19d09537ae2eb535045e38294ab82092ca8f320e89dc5ee665c498d9c02544e5cdd3515ac3eb557c7d9cf1b561ec66815d8c5982bb9e60d16f6aa1a462b3f720e1ad98cfe1b235bca2443662035411c79f404fe42e08506291b3c2e0c2c47534dadddf964521ef668eeb1418b5fb435b98792d39fc644c85b5c2c0dcb3482bbcf5f99af4b4408724e31ccd40c7c414088a17e0c695590c52478f6396072bae1bb74ae38e80d4f28538f6d625b22a2e69f27137263cdee49bbaffedf0da3a0eb5ad33328a51a933e2483610c3c3bb2d1e2d65d4a63c12ba09adb327363aaf9260b8c58432d28e45c406be5853e18b80ebdbb94f57f71aefb3ce64ef8cc9b11680f9f4f6a9fa49b68e297810b464f0ab506af84f7d0b4d9ca94b48e204d95f1186a2aa1e4381036de65c57c0044c4dd9bed983a3c1ce92416545cb90ae5991381d2a7c47360757e22ddbc454c481a9b4cc4d7830cfc131c558d9f17d6d0b389973bab0826ed1a1567df9d0042d99f346710b1c7c3186670e86568d261bfdaec340030ab8dda6e8cf05611159c559add233e861bc9e08f836c0a80daf8c14e81d5abfa02a55c55769374926f4ee9f105e3745fb1f991d2b280cdd4925b277895fb177b0ce28895e209c426a5a457d17b6a807e072bcf8933e22e46acd7d96f1e9f29cbd909cbd40379c54f1fbc06970b869ebb30e2b9b8ef4eb9713fe1820a399308949527205e4766e74cd7e00ad49e4cdd75aa3cca5368ba897af8f46044a0ebc7a7369d8e4df3c27d3e63cc55e532d2a27464bcc5fb04905bf3d7a2aa1dcd723f54fadf790613c05876d7baf9ba7da34ab6aa7b39c2bcf29ddb93f9c24dfe914fc345a5c8e022b9e952a758ff52547df8fac861824de896c52c246fe8d2cf5bf7e45f2eeef7991201ed3811ecf4baef068da6db1bcc3e723ec828148e244bc4cf3d680078f5d7a07a27702a98516200bf4e60a8a30d484c1cb127f6d1f9c4663e26a82aa86a3bd31bf4cfbfa78e9d22c6a475b5beba4083c134d8dec39c265487e5efbc8d53908725c2fd975531d3190921ae72a96dd664d8a4cb7ca5130c546b39006a5f496083f8a8d72dd0e81608ff1eac52b18dee6c2879a08d55cbc0af3a4fa84e697696a7db23eedf341ab3a643c0b954118c158b17ca7d43fb4df5200688b09ec1444b3a4e19348d07a11b35459ad5d153d0a8fdabaee47f3e332e27b6c9c3ebb2a2f87c5772af4e74184cd4396b245d5d911402e35cb4e960fccbeefeccf059ff7a49806d5568940d56406ff12f03e7d97073a88aae42920c0c29baebe08717617fd3ac949e3217135f4d647e1267149dd8a99025fbadb09508842c28cec2f8467dffeda95648f598b753673a0f244f2c116be67e02f9e3126f505cdb6e35a9d2ca184ffb71a5e95f77d128d4fb46d084ac6a9a2594f9a1e44853581246fae4f8ef0028edfebeb9697781fbc8eeb76f53c614a6948ca2e6d1ded98c0e75f4b59c0e3219e83a86cef9d37db51f3521eba97013ba638dc01cfdfd55b2bf55926f5bfbfda8e52a0ec40463604eeef2a9d9207acc17733c4d1b6effef37a4016b2ddee3be6dd2062b936194ac705a33d1f45518be6b5a728175e7fe1ef79db3a92e9d5e531719cd345c3a77af57c314325570993d744241163a05814373a471886cac7fa91f2fc09b1fa3b85569e10ffc9be35ad1631630c548ebf71ad33836914211c1334a4d9a99b3d3d48a9a0699d3063da6057944386825db647d1c0bdd88c35fd7424f94aacde081f148b5b1aed335e8a20947c2661a002c401339f7d619ab433481ec87cb84c1230dfd8daa17cb2f7be3d02601a79b7c99ecc9dc5d1f0df6d77f6c8dd4606056fb2e08e119e45d384b9f54a32a39390315bde17851ef274b74fcc3ec6a8ee93438c21701d316b1d4e64c055c2941aabc1db7ce247b83ca6882411251d60ce17d3393cd8038201c38062c3a34ce743e75bb4849c793857cb3d628658aeedc9bcaf478abf27c220e37decf4e6531ee5177df947ae1fb13ab08fc4280474f8cebf92913d98eb160428a952fde0d7e243dfb5e573001b5057c2d85bcaee4315cffe07e119a1159a71a0f403dac6078a37e3dc86e98ecaa900446de71b4e7e3a2e823e5e73d8d90d3171a44b7022667f9d8f66a5ac6fd3518f4ea5d8bd26dfe2480f2bee314cf488de423c3a5e68e4ec7e2e059bde8a306cc504e22efeaa87f9798f3cfceeb01c56ba6f9fa8002635a17f47f368b99b34ecbb828ca21925c4168ce6e2ba05e8c74efbcc48a8527d0a156442b7b9d79caac2ac3a5cf03a08366272a8321ebfb683523fb1334ecc46ab9bc118646c963ec9f1627484b1f4c6a96b5aebaad3adc5582e10cd3423d3f6c9b7d03ed067b8199c42e6178eec97c883657eb613fbcab232124bc6ee440afa9b19c861e2199b0c39bfecc8da6e8ae5e8e0ab3823e45c3af3e5aa337b65232366544e6631827f11de95b487e3f823da08c95968dcf830e556ea3df772cc1c6d6b9aea355dbe62d5c1e249acfd68958f6f10815d876b2391c1ad13f343cac185e91ff1c07d22084c2e38d6694092957d5544503b912ccda7c6c6f3c82b8b2a7becacb411ea491c6d642dc3a2f002e6f39a68acdef257b6a223346dc186a444009d0fcc0a1fba8e7b1100fe14ebeef3511124015781f102c0ee7f61d289d5ddbe07fcb68e1a0b38acd17659e331fe64796aecb2fe6f9bb0ec08656baaab59418c7fc11311ed1c19a51b4ffa16458b04f0392d162a98e1bef0462af8f08ac5ffdb927021dee98cc33536725eb957688165c1d764ae2d8f4c147822182449e480f36206ed1c33b644c684ddf5e98001b0aba9fcc2dc4a27ef0d834cbd503ddc998fca7672ef2c546ccbc97af269145ed0af838616c597d8c272f42bafc8d90b9226fc82b8ce795e6c6e979034c4e4e9cee67b126b2156af522976fd5d27aa8ab770bb8f308ed46e7667505b7396e05cb5354a3cd34a0e24ed05eb27b3983d0277c18569c6925e028d3a16e6366ed62264894efe6f009228833b7d16e564919f690c88692f4bd39d8a61ea056034bcc7d91cbd9c7abc0468f81f03a28a8634e656011280390669966f93dea7a58f2a23cee40e7790161233b5178a33290b25a0cb996d79ac308078228da52b063f0fe8f9a4aaf46db76c6041811e97b1442cc6675111e6f4dad192cccc01a99614be5cb8f5292bfa8fa5cc4f7315c99c10155c61a02d5ca2daf0cd651acf9cc0ab15224912f83bd0e00d2dc7e04a4f1216e582598e32f4a60083eb05924d3ef30b8aeac0c6f427d53ee477c6fe2e696459270844f886fa8b242bad5d5528f8996c831c3975607de9f0ade04a3d4d13625b3c84eca3acc9350ca9a3f3d0017617931d4423b487e918878380fb1c7e3b0112639122e67f1b2f0a815162453285cb32c09baaabc811f97d27a430a8d312e339e23e8f2cb08b147019d5afc86a385489fc894e8df3d9d4a5cfc1b616cea2d8f431022bac9c7bebb11e21c4b5e5392d581f21b9c4767e333a9fe2bdaed14955bf20e55790061769033f21446652d7fd0d4a76ec25c1bb77a90fbafa2564e59af7f5213e24181366c00b3a87273ae66ed925ecce3b7c725633adb572e8f1cadb118d9d17f189d6fbc27d62cf5e5b6aaec4e33b9591719a5af9ec35bc6b3e44185ddccf6fd24702f49e8635397c13d37dfc33fe1b14d4f7499b7adb1e5d5a4082e4450bd6a9467c9841a9f0eb9692ea00d9730f6d91519777947f4eacaf28dbb8459c1921b9384da1f76b370a1b27db24c2eb86a09a387c6b735c51a4c6db984f8d27883a38cd13051de2f48b50ea90d14f61da86c66fc12f426658ac5fe7d0e2c72db83dc8ac3853aef5dc3d3c24f47a65b63649e2dbb02dcd44b0c81e0a664911dacda64698d518ad1ff92b5902f2ee513e65894cb9df6addbd3ea42e3b929469db692f14ba058e9ba3b43b9275a5823d6abdb9b37e5014b44d9a837c678e5ca9a5cd5ada5aa6fdea9937e599d74b717d6e0ebe0b2bacd27ec8d164c2336784119588aba1834d59379d9eb71424ba94a3139eb22ea18a14552b81d284632d8714bb5da7bd64d2bd57f0ff3bb660d6f93cc173ab75309153126df4b65af88da04f720c2448d377f377168cc14d35543f4bb029c9ee95a80d8988eebe8f435b51237e97aa5122518687dd1e0c56c50979c11754dce170da1de9eed30b9dee3082c427b3496b932a0c499d8ef560047c9f668d5ea32aadd01dbbfd87d672609ee88765e582f209645a003a28c0eebe8224fee12c488b280ac046ad106c0c36d19a8a8c63ae5a468bdaf0feb9faa583489b841e25b6329517e60bf7d997448efdafbdfc9319aafa6030b17544051a737a0ce0ec15684d39fa71ef1592862974b05098ebfbccabe71429864bf2068683678a19e8600b0ad29bd8a0fad343280520a50a1ac929015ef544d6c68ff4490fdebf6d895692df8a65dc359006886b254eb5cd11fbfe6825f96068364f6e5c4b84f701160c3d284881444d07d940a83c9cda22181b705f8a6cf880335c27531651274171d95c70470d56c325a219d4925256d5d95a31cdf361abc9ddf2a15bb126191ebee0782e20ce3b9a1c331077619ff2ecece5a43a6d61d4460fa4c4add73c3afbdc3e14efe8936cbb834f2f979122c95d03e3146e9345b3af79edc2d8c38d62441f7a55f1aadc25f1a0eceffd89f2385301538790a003bba4fb7f224a7d5c87f69a3f188f7b1da816e5b01e4a5752488f233668054d83b1e6638bd28fedca6750e0036cd206de57179d60ff7a84e54421ce2985e63f3ad001602b223965f1aa27c3cd8e9d6e8684d72e07e45cc364f6276d2f0eac2b3ec12be3a9db6b0d91ee174e2068f6752af6ba8983028a0f0d547ac06d9b851731da4cd3e29b148bead9963715c88d9074b83ef8ba962104de44daccf8a6c5fd6a930d1349916c8b663c532aca5ca709020d73046db0ab576383096e45e4b16e05e608634614134a838a110246fcf563bbd7563936159a992595aa23f280afd7ac725b1a4d0441b754cee1c9b03587393580fabd9c67b3905383bc1f7c378555f575e5c0294e2f7f973f935aec4222f414e90403be6947c7862041e468c461efd590bb14fd9fc54616b8bd275d1d39ba0a1d273bd02c6c66cf4c517dd5f460ea41bfb3e7fdf4b585f9cdbe6f7168e391e2f6c79d2adcca6838580dacf02bce96689c5c52c8b495981cd5c7cd4ff643cc9fc094028cc5a779aa52d8362eb45723a33dccf6f0a3a840d0f082df2741119c3136ab0e4b47eee0b3c45ed0b7933bba6b04016c514f853976cbb2665558a11590104d6adaed12b146205aeaffa278b7cae59a4537b5eb6ad8881ae2f38c69d13fe6cb00ec3e56f2724cc0a7c09be06bfef0948a42f2b63a002f498008572806fd89079c9b92ef8a71c6aa7dae1968083c63ab7b0b1d2748699fcc13bcf2291812e25a2ce9069cb03f6da1c280d5abe3c9bef1dfe544c68671189e8030d2f3fd1738bd5df1ad6f37174c65d5b7bc2526302e74f42d8c51fb4ab96ab698767ca22e8fc1ee15c94d5b13293dcca7dedb3f3fef25157b713e0a43921794902b738f855ee59ed4f6b99c7c2205939458ace92c78e245f16302367e79c4d7031a5d06c027b96f3aa48f22fbf623377f25d4fc1f7a7475e7802f5da2f65229e7eaff3ba00bd8c293cd2aefea29da6c31b0b6d6840fed674ef85bf6f858f08e22f96dd322e9a2d4d615b999ec9f84fd4c0aa3dbbc232bf7e415ff054be6610ec9c3115a22aac50cf7cb6a41a8a9b16955b66dd76a48576ec12af161535cbc4c7e174b77f68db7dd5d126c3099736b577a9b46afef77c7c78ef9e3bb4df73c42815b55d873d542aa16f14c4af0b8cc5cde789b1f720dd6fb37f3cfb54962a6a595bebac9997462d0d5982042419a9e1d03eccd947ba05e6526d7d39b9b5c918ccbaf6354177df63a4e00fc76343ce9d085590c6762cd1745d8090a0b72c83c857898b23bef4dea764f84255a9a951ed7bf3a994d02a8d1f903b015397ae9f6f2e54487c7671bce183b90ed0852e25dc6bcb09c62e921e1b9a5637b3228c33ea0a42a5298a05bcdfbbcfa02ce5b4ee1ac3747a4795dfcb7c54f6af3661ed03c646555cd9ca51c7a5c37f6bb7b93b707fa8f0e6ecda6e06718fb0a5c8211f69bedd49b1509e898f95e4252c77110b839ea80b4b528b7f1774bceb1c522d469e10a207d899b4a9849aaf1fe573bb4c2af4605b30172c5f71017d377c36bea6a8a4a3acd53c796855d3716df44812a43ee0781f4ef27ceef74e04fcb635cbe82b20e5e0ab49a7db2fe852b6afa6ac3465c1ab9f1bb01a2e1f8d123be46e4fbf5e0f42801d048f04bf1bdacd0b017f98c1f65331974f3d3a53944f9df4cb645cd8c2194b6e8324eb3bc20c058e5035d31c4dcafaaca9f1ec62467ba342616bee58a661aad895f4986fb51e6dae8c2b3890e35f3b9b2d524ea4f7192938c8f447b16a5f75620925574c4365297bd608b7287db5ac404dc6b93d23507a633db81a64f39743dd1faee58c88624a0826d5b6f67899c04cc21b5efe190e21489a9bc0bfc4082d3a652c12df7aa90f1b2fc1215f57b77185ed6e6d81bedad73bf3ac88a3b9109646d28e28d6619955286ef8600c846c384c5e1f627623cd2b0a9709565aa4ac9b7c820d19f523761a2cece15359b136a678469f4b43e3d8e5224a5f953640916818528262f1afd5265b51f3374c9d69c48585cdbc339e4093f5047fa71f3d4d365e28645d44d4741828094b052e28435e1280716019ca4ec12cc7ffce9e816cb087a5f4732a3c89acf3dcbac5e0fef18ab625d6234db920234858a2d57bff298a518b03e268f942eb072ed293eec32fa5d30ce803349e01f16fba07a171c4db33f6e32deab87fdc9efb39d41954bc5b3f3e9cc2db523d02e95eb89fc597f251aab0b06957224eca10e11a516e04a617e745f44332a4c3cd349d92d9ea435267338826288f0dee4f4d3960659b568d6758430f8cdd381c439c89fb40629f61d56d98c09bf50c909792a7678b0195be29efd41f0fa0f68a12e6ced68d3ff9c9b8d34c38450a2795b7636614e1ae36792ee8ce16fb51e1c7211062246a02a03172e071c898d213f21aadc46e0ad22ff7fab823f1cf133c0a8ceba59740a5eb52ee3dfa998b68ede3a5818cae2222e55f3802ac23be0dbd76d904b42563731f9ae1cfe5de0aa7182282b420d5b381354aeeaaf5af6e18caaa7d7ae83e68ddf751589fdfe794c21554a11222cd1004355b347615f09aa0d6d6d257ba4c0ff0042da9bacda38dcc11ba12e8f2a92ad88b3c76d008eb7560370ec0a10c8ed2668004b3e4021737e3ed951d31b7248fb37de731073b8f0dc1ea8003b34ea53a30cdf9348c6a427a27b3f147bfbf0f43cd50824cec72e4974c5bca548017294295606dcd4b05e77fefd16721551c34ee34489872646acd62899da350953b9320953afc8e7dde974e54f929dd95c", + "shards": [ + "0xc6b508fcd3e35748931d904f0fa51e16f4f753c7b6cb913fe538f6ff5ced", + "0xac1ef2da5ba1d08865d052b2154144824e6267be7cb3d84080e8c346e652", + "0xfaa11cc735b42215e34f0d421f43989aca8a5c3f2ac338bafe77a89cb255", + "0x0206613a2cd88bcd83d46ddc7a56c98db3026b30f407cc1c7d263723d91a", + "0xae5c84f5dc65a6901cecb3918dce7c58492f15d568e73447d05a28340703", + "0xc5c099e443c851122c111c8f07afef4c85e6165c8ada46ed6818e72fe9ab", + "0x6f9fd804f49a66d7e40e1229ff1bef4fcb0bc3a362faabb6ea2b9cb0ec90", + "0x86fb18520c46ab199f7f08971fa51a11aa1df22d1c2260c98190f0b5a56b", + "0x4cc66a00ad93d9f3c6b1af79e6d56f1267ea960d07b1230fca6a590a39b0", + "0xb4bc169766e4c8eb8911f8a1497555630fe1709663ab41f4ef65f0fc2348", + "0xdff5e4750aca7020f6cddab2b063f0e32ac38fc7672e6118abf9b69a3f25", + "0x2c0f76b032444178d51051fa1993b8d05099d4b2cf14255341d2da7c0e96", + "0x0a621cad0d7f0f7ca4ecf1e51712b785e960773b2b442a9b6291076aff0f", + "0x83de71ced9acbab32124e20b46787d77261877bb215b28737cd30e34a417", + "0x2f95d6ba204f25cf1ad05cf186e5a7c1b4bb29d31394aea5f3f627f22963", + "0x05c68ef5287b7c8f84c0eafb8f762017b77d45116002551ac32653c2b050", + "0xd4970f93dca093079dee135f7e1a38f030c9cb3de0f0a3e411874781e76d", + "0x4c6bf34a86a26d461873991af4ac64bcfb3f65f079b796035236b15e32d5", + "0xd82b274866002242b7f27cd8061edb42b1319fd0bb9335c80c62476a9e74", + "0x6c0744b0089399120823b46a72d6fae79a9b649912379bd33f866d5d8397", + "0x0409e2d97c1cd6ad2f34e07d317997d654200a0630fc14425727cb00823b", + "0x538f4a6c3f111ddf315494c1e44b960de233ab98911c766bbfe67aac3f3f", + "0xc52ea02c1681ccc240733bda486613a59d0de3308243bfef6662e05429b3", + "0x09420b728b3d33a5d1a05dc6390aef86f179299894bef9c8426f4fe0c131", + "0xc49b0842e0f227a88a48b60456b3bd89df27bbe10da02136079bb22da62a", + "0xde4bb0c65f25ffc724118d081c866f86620c64f6c9e8812692c5c80de000", + "0x15a713d367b4243fe2e0af6ac08bf6ad1ba93c5ef4f164eaeb78ee8414d8", + "0x6ee8e528e6fc065b921c72a8ea24f1fff3da1b37dc8e0ca2c3f3618a0e14", + "0x1df436e114ffb49fdc5467843edaaceba06241cf09bc7dc079c36ed35c12", + "0xe7e341cf2e1fc302d55ae3732a1a3fc61e8c4ffe15d15b0977f418c38016", + "0xd141f67befab4c2c40ec1328789e19128cd1fa96286b8f084d3afc31a97d", + "0x1cdb6e7f4d02c8a10295f6564fc24d7e29c5730c0d85745f1720b7f9c15a", + "0x111425ba9dcdbfb42524bf654cefee3a103c1a7695cb0a7d8a623e923def", + "0x96437f7cc39abdf1b72d7a2bff0ee84bd4acebe45fa603b25c7868dbcef2", + "0x1d0203186f0b4e8c191e8cf986bea2c6afe12baa12b3fbe5035620988512", + "0x01907d23e5ad1934899763cc3dd94dc0b8a8fcef3e6bb627134ec0994975", + "0x21d2b48a87e234a738a042487ffd1b19c927c8193c88b9b563b9dfda3f35", + "0x4948882915cc653918da8d07b2badfb39ccfef74b32b939270555c4ced7c", + "0xbcf0e2f9aa31e083091ef6f42c403b2d5b49aab34c048174ab7377051ceb", + "0x38e7a8da9dc8ebf6b194bf801b62756ddaa1b28d348cf685342abe5e6fb1", + "0xf55e3bb626c4dbc542113e71193ea22837562f1e6554d5c46b94f5cf0daf", + "0x3e7e867b66ab82315715614513becd5150021f235e4c8cc826060996d86d", + "0x1e80e6f3ae372197d9e859e99ef520c637e4068abb9fb3f1307199536f6a", + "0xb0dd007b0719530d4d511b544bfb0da4a6f16d24cc2f9f030bf75fa1b20c", + "0x462b9a34343f0fa3a0f80a1713d198fd6600c132d3a6e99bac07e521a5db", + "0x45c90c361307f0f24603c092021a76ce529f435b80b3540166e0d9d0124b", + "0x4776256f0bcf297d35886ec645694e9d5df4b6586fb6a481a0704f123dd0", + "0xda7f72bc8e21b443efc30522f0a514626df96504e588bc2aed12a471efaf", + "0x787416538f41714bfd83223b6f34d530a49e3442b8580a4eb09ba8afc42d", + "0xb97e2e50ec8105f3716df24505b965c769ba0733c422d3c20c8de28425a8", + "0x85c9a5c63c4f0d9f2d9da5b5b1b8778ae7315493e20e5c7c92e0db947ad5", + "0x1a53a765a2470089bb644433a80fbed9e2353bf960dc9d44c13bd306228f", + "0xb33d6c2c73e8fd72305cd9462bc26f49aacbf698fc5a888af000498ed644", + "0x24f6237a2b53871e407be950571be7ebeec9ff516f7d1a7ddb1c4ef0d59d", + "0xfd09dd55b2dc0df9f29fe9ec3308145a1b36f39d6f3502c09d9fc582832b", + "0x14d29e1261cfd4e9eb2a8a809422ddd978dc7de57e6250eb57a850d33189", + "0xa0c2abae47657a211d898a2912fe6aac3bdf551d374fa2f776e55390c2ec", + "0x79871d678ca653d5b9e4803cfcdb84e4c2ad3da7caa4700e0b7904180f0e", + "0x18333ff4f09988d7659b332f2a33b9bc5343720440f88bb3b9fce3d0a39c", + "0x6af613833e5932e6020a6548c5e94c2521d495ec94f3d3aca881bdd080e3", + "0x6820083c3921432e5307ba699840ee729935ecc1ab46d9065e04d18048f0", + "0xa4de369999075f311a90fedd305eb843c7215c4ff4664c3c8342fe4b465c", + "0xae1d1109c494e7114762d747e28e28414ba6886afc41d25ed65cfc303f54", + "0xf17e4080d4992dd022b1666b6a058e28d319c7cf6e83f86ad03c45c13c05", + "0x99015336aebdee7da1912584eaf94aaaad9a8b62c8861d55ffe274950435", + "0xcb0f56b5edea2cb391657fdc8550f45dd294325cd2e90f8922357a604f12", + "0x2421e22e29317dba1eca104e0f5c6f051b8196115b474f64e042e2e7c58b", + "0x9bf9caa4be580f3bd2b1f5755721f533d7acb03cfbabb6f5ae2279e341e0", + "0xe0d8ec9d3379d28b00343882bd4b0a06c3d0008153b6d8d453eddfa39b51", + "0x42fee4e35de2226c33da9e78b3ff5f5dbc5c4006f8a361e934cd1b2fe28d", + "0xa414001afba18cdb9a79108b05a776dfeb9fa905104166397718a8173738", + "0x3e601f53d962cf12a0f89c1e58552c137b8d6c0689544dec9637d334758b", + "0xd8d9a6e5a94e30bcac5c8177c045cc0b1e83701d74bef96bd69e55b8f6c3", + "0xe70e772383658a28c894a9cdd6c6c6bf3292f1d1fafe354265ab550054d5", + "0xe83e664127b94516b138ce1643fdcd5264609080e4786e0a0ccda5986667", + "0xacb0c136ba85741fb848f593b595c2da00d317c8acc9d2e4ef5ea0776a87", + "0x22eff5b40a05b63ff8940f7834b070f0bfeb8b8f39702583c291758b495a", + "0x672439e7781c335cf708a3ff49c6eb95f8acf6c156693d3482b1e377d126", + "0x0ddd6c86139b28ec4568284b928ef68004be767e92105903561073f87499", + "0x18cd7d9ee2fe8b12f81eca54402037044a52e8d3bd162105d03e82292b70", + "0x51293a1788c72fbee4bc0e3d9523d32e610697210ed5828cdf783854c823", + "0xdb9763e174ea7cdd4fefd58e868a3ec34335afe75908a45d53177800d7aa", + "0xbe8c8a13e526df2503be7baf4ad61e99bf22d7674f402ad70abe4d238d1f", + "0x19526bb8e72c0fb08230810eb4a9b90eb3fc0bb6833ef32834060c729db9", + "0xd30a02f96e50f4f6e1d2f69663ce5731eb87906506a9bdca54dca163be50", + "0x5d80639948cdd711689a763a69ee7aae115a761b224f12e37742dc8cfebb", + "0x7bdc72e3c6ba12a585d57f3bad5c47be7048480a261aa1d0c82c409ede79", + "0x76eeddcfba8c044abceec7acfb1110ee84697a12141a11de450da9b8a7e2", + "0x450d6e58ffd9b37559314321181a41d776c851f2e8f9bb7c5a7532c1c388", + "0x46c6c55a94a88210f92e276e50d9d63ce998fd8719318c61d73715734313", + "0xd05a39e3b23618db7e1ad16c47551ce032f69cbf83816a57e142953ef73b", + "0xb8603d5c7ef5ebcffd08c627418ec87b7bfe6ceb57621b2872a4823bfb63", + "0x9e1aec52654a6ec935f13e97e4b041dd7a89197bf3725de3015c3968dc08", + "0x703ccfe60a33301082e654873ad996b6801aa37fe2664200690439deb7f0", + "0x29c6032a223ea8ee192f747b9b3308e9c4846b9472f1f9ed6930cc67e67a", + "0x90f4cd3a1708545ee5ef1f5f86743b2adeacdca624af2b444dc531bf9f26", + "0x7f0fb487580ef73902205e43bc4031099db8bd21516a0fbe0225ca25652e", + "0x8542119e46deee6e53fa78798e190d5d342492036db811a9cf289b29c22e", + "0x3bd467b34626412f0d40167fca051d879911fefda672eb890c873dac4eed", + "0xaa3e9aaffe9ddda81521d30f4d5dd57165e4a8514851cb2c3d20ab0f3115", + "0x480a4aab9dd29ed6f9d6aec29b99689cdbde81e7bb718b8d13c46d08ebb0", + "0x8db042bb2da8cd586b68309742c30a643aa02aa362181de8f4b050365222", + "0x0334bc69fdfaa2697e241c993aca0ab7d12aebe5f24c2d4a63e2a9493d74", + "0x6171ff78349bb3eadd25ada38890e16e703b9477be4719b7b4c1a6c094ab", + "0xa8a7ce084991f2aee7a079c861a7e63e051dd51ee2cfe84f474b14db59b9", + "0x46b41a873b6c761477a3b99315acb288a18327585b5d5bbc357b7044aa44", + "0x09df4cb701e35fb8ce1acdf9fe68036b8fe27cdfb2a02ff6b104de1ad360", + "0x758280ec4dce3d79d217d3f1a81bbaabe4a12e9feb1a2dbd48362ce16507", + "0x54c97114757b64cd344fd5df31425f3f9020fe9a22240d6753510b8ba9dd", + "0x17e8271770a61c4fdea5856c1e1107c93e1bca655ac04c9d95c8b3f2bdcc", + "0x60f60b094e4b21981b6e5f7813290bc7c7f39ecd21a6902b23d3010716d4", + "0xf0731af2f1af730e474f74b93baceb152c397d6bd6d46f422a0741c7b450", + "0x1a2daaff26daeb0079318494f5071d5af40b4a13bc5d37f0a242fbc46683", + "0x8c2c57184f802e2af4bbfacaf11166d71a5612074ff4578257e020ce769e", + "0x9e28d473978253291acc71f77ae0ca5d6ead6498a3276335e7ad4ec42f9e", + "0x6604e0b01f43ce2a2831b66df9040079411f5fa8e57fa16a0a3b13f0144b", + "0x0cc3be91c30a6e5ebfbacb9fd6511ca82791cd456fd5268bccaf9f574a90", + "0xc72ba75552e1a05e5310c46660e2a91eb192bcd4acecfba5c932437798ef", + "0x88c3f50f7397944cb2484f16d0f0e7d244ebf8d9f8eef41efca1937e42a4", + "0xe93005639c3a4347e41cd84f6c3fe843c824e7a38be94b6f78f90672b1b4", + "0xf5f562ddf8d95a5ab68e4634833a3767f4fd2ababcaa636a5c188c9ee592", + "0x5fe259a4b209091151e66580a5ba74ad05c989e11c332891de162f03ed18", + "0x498e512ebbb0b8da813edd5abfd29b3fb6c3d44fc2b112f35d5e8edaf236", + "0x84d47f6396dd4fb1f0b51ebe09d7065730e8b22153adaf1214c958eb3a31", + "0x1e704fab7f3aa6968e23ecd536e6c2d3a15aeec2e38fd8e833b96eb6df41", + "0xabd5c17e0077d91e94353160cbb9dd8cde03400a8df0a89b1f9cda0a6d7a", + "0x60292ad7aaad7e1d281f90ae5255d3630d56d847e6352a4fda85a0157a85", + "0xea81234b1d59359065768bc033c833b6621017499f8294d8808f4e969bd5", + "0x7e98870a4254001936a25d7e707eef14db3fbb2852e01434774e7ba7f05d", + "0xdb170e9585d3a749170bbfc750eacf2b62a9aa0d03591aa824b755b22e3b", + "0xf4fda4615e15cceab5bc254242e1dfb728887f027f7feb63058393007fc4", + "0xd3bd0a0da28443fbaebdfe7aff4291807ba884f5bad9b18cd1da52c25725", + "0x4a054e8aef83750ed4588074356759067e5d277063751ce9cbd7dc4f480e", + "0x2c1497ef42c11bdf61c2a33fa176777145dfd83b2961933067e581896182", + "0x9ed042c9eec769f4b2e8764c8cc8756d928827c0311a682f98a30f745a50", + "0xe9f031cbd407f12ec3112f8dd63b893f5b6d51f2f89dff2b0f12f06eeb1e", + "0xef007879fc128f5c127b6898c9edf38f003f5d3ba3f26762f850e20401b1", + "0x72eebca30137ad5f3c3144b6094729e380fac6a222838dfde4eb6015df2c", + "0x639092fce9d036a0813d553459285219f305af965c952ac73cb8627a1754", + "0x2ab426c97e3c49be0dfec183be0c2836a556fba06bab6b217aa423570336", + "0x1c2b8221c7c52f58d46beddb2e6302bd269ee89ff0cf6a04214de7fd8179", + "0xff37c6099113fe8487eccd75d0d807693c4fe7519d367e6a6c47f7fcc0ec", + "0xfe51c6bd3ca2606978d9f3a9da79741fc0f1db5dc6b4e2b6aa6e63d8116f", + "0xb00f080e1f6b2476c497f902df08865e63b8cde51cbabd3dbc579639d132", + "0x26d99ad01d4f0f6dc2721be57b4f7659205e1fe89e54171230d11fbe629d", + "0xf943e7e70e39918a8dd01f094a06fb56126e8ed0817a1f317c1364245486", + "0x67af60f8c34d2d3787f56c1f1436fa15ca4b1007637c67864d628dafc357", + "0xccb46edda7614a5210bff120a3e8401515f59c47c4fbe41e2c24c4e86f2f", + "0xa39827f35c835b34e9e36aa373b2cb108bbb79decb4daae350b12198079b", + "0x64fd341be1f2e2e165aefcb09cc87d0c98a8a7217ac49eadf65dde13def1", + "0xeed85e7642bf76a9fd3d039915595b7a26622a0d49e9143af803113b48ef", + "0xc9227ea04cec292a8524ebececdae7f9ff0723aedc0b82fb2313067323bb", + "0x78ecd794346a68742d901759e8c43eb6144bc6e43e8fd660e23f22d1b686", + "0xf1dae285c02ae0f41e0160cba69c7b7dd4bbb4d4f34d28990ce14f9b0704", + "0xfbb1d9af0d074d05fd023d2a45167729af6f074cb45f2d8372e319550aaa", + "0xf00891c4abfbcccd56c6d849bf1fee81cce992e566c7d5ad19d09537ae2e", + "0xb535045e38294ab82092ca8f320e89dc5ee665c498d9c02544e5cdd3515a", + "0xc3eb557c7d9cf1b561ec66815d8c5982bb9e60d16f6aa1a462b3f720e1ad", + "0x98cfe1b235bca2443662035411c79f404fe42e08506291b3c2e0c2c47534", + "0xdadddf964521ef668eeb1418b5fb435b98792d39fc644c85b5c2c0dcb348", + "0x2bbcf5f99af4b4408724e31ccd40c7c414088a17e0c695590c52478f6396", + "0x072bae1bb74ae38e80d4f28538f6d625b22a2e69f27137263cdee49bbaff", + "0xedf0da3a0eb5ad33328a51a933e2483610c3c3bb2d1e2d65d4a63c12ba09", + "0xadb327363aaf9260b8c58432d28e45c406be5853e18b80ebdbb94f57f71a", + "0xefb3ce64ef8cc9b11680f9f4f6a9fa49b68e297810b464f0ab506af84f7d", + "0x0b4d9ca94b48e204d95f1186a2aa1e4381036de65c57c0044c4dd9bed983", + "0xa3c1ce92416545cb90ae5991381d2a7c47360757e22ddbc454c481a9b4cc", + "0x4d7830cfc131c558d9f17d6d0b389973bab0826ed1a1567df9d0042d99f3", + "0x46710b1c7c3186670e86568d261bfdaec340030ab8dda6e8cf05611159c5", + "0x59add233e861bc9e08f836c0a80daf8c14e81d5abfa02a55c55769374926", + "0xf4ee9f105e3745fb1f991d2b280cdd4925b277895fb177b0ce28895e209c", + "0x426a5a457d17b6a807e072bcf8933e22e46acd7d96f1e9f29cbd909cbd40", + "0x379c54f1fbc06970b869ebb30e2b9b8ef4eb9713fe1820a3993089495272", + "0x05e4766e74cd7e00ad49e4cdd75aa3cca5368ba897af8f46044a0ebc7a73", + "0x69d8e4df3c27d3e63cc55e532d2a27464bcc5fb04905bf3d7a2aa1dcd723", + "0xf54fadf790613c05876d7baf9ba7da34ab6aa7b39c2bcf29ddb93f9c24df", + "0xe914fc345a5c8e022b9e952a758ff52547df8fac861824de896c52c246fe", + "0x8d2cf5bf7e45f2eeef7991201ed3811ecf4baef068da6db1bcc3e723ec82", + "0x8148e244bc4cf3d680078f5d7a07a27702a98516200bf4e60a8a30d484c1", + "0xcb127f6d1f9c4663e26a82aa86a3bd31bf4cfbfa78e9d22c6a475b5beba4", + "0x083c134d8dec39c265487e5efbc8d53908725c2fd975531d3190921ae72a", + "0x96dd664d8a4cb7ca5130c546b39006a5f496083f8a8d72dd0e81608ff1ea", + "0xc52b18dee6c2879a08d55cbc0af3a4fa84e697696a7db23eedf341ab3a64", + "0x3c0b954118c158b17ca7d43fb4df5200688b09ec1444b3a4e19348d07a11", + "0xb35459ad5d153d0a8fdabaee47f3e332e27b6c9c3ebb2a2f87c5772af4e7", + "0x4184cd4396b245d5d911402e35cb4e960fccbeefeccf059ff7a49806d556", + "0x8940d56406ff12f03e7d97073a88aae42920c0c29baebe08717617fd3ac9", + "0x49e3217135f4d647e1267149dd8a99025fbadb09508842c28cec2f8467df", + "0xfeda95648f598b753673a0f244f2c116be67e02f9e3126f505cdb6e35a9d", + "0x2ca184ffb71a5e95f77d128d4fb46d084ac6a9a2594f9a1e44853581246f", + "0xae4f8ef0028edfebeb9697781fbc8eeb76f53c614a6948ca2e6d1ded98c0", + "0xe75f4b59c0e3219e83a86cef9d37db51f3521eba97013ba638dc01cfdfd5", + "0x5b2bf55926f5bfbfda8e52a0ec40463604eeef2a9d9207acc17733c4d1b6", + "0xeffef37a4016b2ddee3be6dd2062b936194ac705a33d1f45518be6b5a728", + "0x175e7fe1ef79db3a92e9d5e531719cd345c3a77af57c314325570993d744", + "0x241163a05814373a471886cac7fa91f2fc09b1fa3b85569e10ffc9be35ad", + "0x1631630c548ebf71ad33836914211c1334a4d9a99b3d3d48a9a0699d3063", + "0xda6057944386825db647d1c0bdd88c35fd7424f94aacde081f148b5b1aed", + "0x335e8a20947c2661a002c401339f7d619ab433481ec87cb84c1230dfd8da", + "0xa17cb2f7be3d02601a79b7c99ecc9dc5d1f0df6d77f6c8dd4606056fb2e0", + "0x8e119e45d384b9f54a32a39390315bde17851ef274b74fcc3ec6a8ee9343", + "0x8c21701d316b1d4e64c055c2941aabc1db7ce247b83ca6882411251d60ce", + "0x17d3393cd8038201c38062c3a34ce743e75bb4849c793857cb3d628658ae", + "0xedc9bcaf478abf27c220e37decf4e6531ee5177df947ae1fb13ab08fc428", + "0x0474f8cebf92913d98eb160428a952fde0d7e243dfb5e573001b5057c2d8", + "0x5bcaee4315cffe07e119a1159a71a0f403dac6078a37e3dc86e98ecaa900", + "0x446de71b4e7e3a2e823e5e73d8d90d3171a44b7022667f9d8f66a5ac6fd3", + "0x518f4ea5d8bd26dfe2480f2bee314cf488de423c3a5e68e4ec7e2e059bde", + "0x8a306cc504e22efeaa87f9798f3cfceeb01c56ba6f9fa8002635a17f47f3", + "0x68b99b34ecbb828ca21925c4168ce6e2ba05e8c74efbcc48a8527d0a1564", + "0x42b7b9d79caac2ac3a5cf03a08366272a8321ebfb683523fb1334ecc46ab", + "0x9bc118646c963ec9f1627484b1f4c6a96b5aebaad3adc5582e10cd3423d3", + "0xf6c9b7d03ed067b8199c42e6178eec97c883657eb613fbcab232124bc6ee", + "0x440afa9b19c861e2199b0c39bfecc8da6e8ae5e8e0ab3823e45c3af3e5aa", + "0x337b65232366544e6631827f11de95b487e3f823da08c95968dcf830e556", + "0xea3df772cc1c6d6b9aea355dbe62d5c1e249acfd68958f6f10815d876b23", + "0x91c1ad13f343cac185e91ff1c07d22084c2e38d6694092957d5544503b91", + "0x2ccda7c6c6f3c82b8b2a7becacb411ea491c6d642dc3a2f002e6f39a68ac", + "0xdef257b6a223346dc186a444009d0fcc0a1fba8e7b1100fe14ebeef35111", + "0x24015781f102c0ee7f61d289d5ddbe07fcb68e1a0b38acd17659e331fe64", + "0x796aecb2fe6f9bb0ec08656baaab59418c7fc11311ed1c19a51b4ffa1645", + "0x8b04f0392d162a98e1bef0462af8f08ac5ffdb927021dee98cc33536725e", + "0xb957688165c1d764ae2d8f4c147822182449e480f36206ed1c33b644c684", + "0xddf5e98001b0aba9fcc2dc4a27ef0d834cbd503ddc998fca7672ef2c546c", + "0xcbc97af269145ed0af838616c597d8c272f42bafc8d90b9226fc82b8ce79", + "0x5e6c6e979034c4e4e9cee67b126b2156af522976fd5d27aa8ab770bb8f30", + "0x8ed46e7667505b7396e05cb5354a3cd34a0e24ed05eb27b3983d0277c185", + "0x69c6925e028d3a16e6366ed62264894efe6f009228833b7d16e564919f69", + "0x0c88692f4bd39d8a61ea056034bcc7d91cbd9c7abc0468f81f03a28a8634", + "0xe656011280390669966f93dea7a58f2a23cee40e7790161233b5178a3329", + "0x0b25a0cb996d79ac308078228da52b063f0fe8f9a4aaf46db76c6041811e", + "0x97b1442cc6675111e6f4dad192cccc01a99614be5cb8f5292bfa8fa5cc4f", + "0x7315c99c10155c61a02d5ca2daf0cd651acf9cc0ab15224912f83bd0e00d", + "0x2dc7e04a4f1216e582598e32f4a60083eb05924d3ef30b8aeac0c6f427d5", + "0x3ee477c6fe2e696459270844f886fa8b242bad5d5528f8996c831c397560", + "0x7de9f0ade04a3d4d13625b3c84eca3acc9350ca9a3f3d0017617931d4423", + "0xb487e918878380fb1c7e3b0112639122e67f1b2f0a815162453285cb32c0", + "0x9baaabc811f97d27a430a8d312e339e23e8f2cb08b147019d5afc86a3854", + "0x89fc894e8df3d9d4a5cfc1b616cea2d8f431022bac9c7bebb11e21c4b5e5", + "0x392d581f21b9c4767e333a9fe2bdaed14955bf20e55790061769033f2144", + "0x6652d7fd0d4a76ec25c1bb77a90fbafa2564e59af7f5213e24181366c00b", + "0x3a87273ae66ed925ecce3b7c725633adb572e8f1cadb118d9d17f189d6fb", + "0xc27d62cf5e5b6aaec4e33b9591719a5af9ec35bc6b3e44185ddccf6fd247", + "0x02f49e8635397c13d37dfc33fe1b14d4f7499b7adb1e5d5a4082e4450bd6", + "0xa9467c9841a9f0eb9692ea00d9730f6d91519777947f4eacaf28dbb8459c", + "0x1921b9384da1f76b370a1b27db24c2eb86a09a387c6b735c51a4c6db984f", + "0x8d27883a38cd13051de2f48b50ea90d14f61da86c66fc12f426658ac5fe7", + "0xd0e2c72db83dc8ac3853aef5dc3d3c24f47a65b63649e2dbb02dcd44b0c8", + "0x1e0a664911dacda64698d518ad1ff92b5902f2ee513e65894cb9df6addbd", + "0x3ea42e3b929469db692f14ba058e9ba3b43b9275a5823d6abdb9b37e5014", + "0xb44d9a837c678e5ca9a5cd5ada5aa6fdea9937e599d74b717d6e0ebe0b2b", + "0xacd27ec8d164c2336784119588aba1834d59379d9eb71424ba94a3139eb2", + "0x2ea18a14552b81d284632d8714bb5da7bd64d2bd57f0ff3bb660d6f93cc1", + "0x73ab75309153126df4b65af88da04f720c2448d377f377168cc14d35543f", + "0x4bb029c9ee95a80d8988eebe8f435b51237e97aa5122518687dd1e0c56c5", + "0x0979c11754dce170da1de9eed30b9dee3082c427b3496b932a0c499d8ef5", + "0x60047c9f668d5ea32aadd01dbbfd87d672609ee88765e582f209645a003a", + "0x28c0eebe8224fee12c488b280ac046ad106c0c36d19a8a8c63ae5a468bda", + "0xf0feb9faa583489b841e25b6329517e60bf7d997448efdafbdfc9319aafa", + "0x6030b17544051a737a0ce0ec15684d39fa71ef1592862974b05098ebfbcc", + "0xabe71429864bf2068683678a19e8600b0ad29bd8a0fad343280520a50a1a", + "0xc929015ef544d6c68ff4490fdebf6d895692df8a65dc359006886b254eb5", + "0xcd11fbfe6825f96068364f6e5c4b84f701160c3d284881444d07d940a83c", + "0x9cda22181b705f8a6cf880335c27531651274171d95c70470d56c325a219", + "0xd4925256d5d95a31cdf361abc9ddf2a15bb126191ebee0782e20ce3b9a1c", + "0x331077619ff2ecece5a43a6d61d4460fa4c4add73c3afbdc3e14efe8936c", + "0xbb834f2f979122c95d03e3146e9345b3af79edc2d8c38d62441f7a55f1aa", + "0xdc25f1a0eceffd89f2385301538790a003bba4fb7f224a7d5c87f69a3f18", + "0x8f7b1da816e5b01e4a5752488f233668054d83b1e6638bd28fedca6750e0", + "0x036cd206de57179d60ff7a84e54421ce2985e63f3ad001602b223965f1aa", + "0x27c3cd8e9d6e8684d72e07e45cc364f6276d2f0eac2b3ec12be3a9db6b0d", + "0x91ee174e2068f6752af6ba8983028a0f0d547ac06d9b851731da4cd3e29b", + "0x148bead9963715c88d9074b83ef8ba962104de44daccf8a6c5fd6a930d13", + "0x49916c8b663c532aca5ca709020d73046db0ab576383096e45e4b16e05e6", + "0x08634614134a838a110246fcf563bbd7563936159a992595aa23f280afd7", + "0xac725b1a4d0441b754cee1c9b03587393580fabd9c67b3905383bc1f7c37", + "0x8555f575e5c0294e2f7f973f935aec4222f414e90403be6947c7862041e4", + "0x68c461efd590bb14fd9fc54616b8bd275d1d39ba0a1d273bd02c6c66cf4c", + "0x517dd5f460ea41bfb3e7fdf4b585f9cdbe6f7168e391e2f6c79d2adcca68", + "0x38580dacf02bce96689c5c52c8b495981cd5c7cd4ff643cc9fc094028cc5", + "0xa779aa52d8362eb45723a33dccf6f0a3a840d0f082df2741119c3136ab0e", + "0x4b47eee0b3c45ed0b7933bba6b04016c514f853976cbb2665558a1159010", + "0x4d6adaed12b146205aeaffa278b7cae59a4537b5eb6ad8881ae2f38c69d1", + "0x3fe6cb00ec3e56f2724cc0a7c09be06bfef0948a42f2b63a002f49800857", + "0x2806fd89079c9b92ef8a71c6aa7dae1968083c63ab7b0b1d2748699fcc13", + "0xbcf2291812e25a2ce9069cb03f6da1c280d5abe3c9bef1dfe544c6867118", + "0x9e8030d2f3fd1738bd5df1ad6f37174c65d5b7bc2526302e74f42d8c51fb", + "0x4ab96ab698767ca22e8fc1ee15c94d5b13293dcca7dedb3f3fef25157b71", + "0x3e0a43921794902b738f855ee59ed4f6b99c7c2205939458ace92c78e245", + "0xf16302367e79c4d7031a5d06c027b96f3aa48f22fbf623377f25d4fc1f7a", + "0x7475e7802f5da2f65229e7eaff3ba00bd8c293cd2aefea29da6c31b0b6d6", + "0x840fed674ef85bf6f858f08e22f96dd322e9a2d4d615b999ec9f84fd4c0a", + "0xa3dbbc232bf7e415ff054be6610ec9c3115a22aac50cf7cb6a41a8a9b169", + "0x55b66dd76a48576ec12af161535cbc4c7e174b77f68db7dd5d126c309973", + "0x6b577a9b46afef77c7c78ef9e3bb4df73c42815b55d873d542aa16f14c4a", + "0xf0b8cc5cde789b1f720dd6fb37f3cfb54962a6a595bebac9997462d0d598", + "0x2042419a9e1d03eccd947ba05e6526d7d39b9b5c918ccbaf6354177df63a", + "0x4e00fc76343ce9d085590c6762cd1745d8090a0b72c83c857898b23bef4d", + "0xea764f84255a9a951ed7bf3a994d02a8d1f903b015397ae9f6f2e54487c7", + "0x671bce183b90ed0852e25dc6bcb09c62e921e1b9a5637b3228c33ea0a42a", + "0x5298a05bcdfbbcfa02ce5b4ee1ac3747a4795dfcb7c54f6af3661ed03c64", + "0x6555cd9ca51c7a5c37f6bb7b93b707fa8f0e6ecda6e06718fb0a5c8211f6", + "0x9bedd49b1509e898f95e4252c77110b839ea80b4b528b7f1774bceb1c522", + "0xd469e10a207d899b4a9849aaf1fe573bb4c2af4605b30172c5f71017d377", + "0xc36bea6a8a4a3acd53c796855d3716df44812a43ee0781f4ef27ceef74e0", + "0x4fcb635cbe82b20e5e0ab49a7db2fe852b6afa6ac3465c1ab9f1bb01a2e1", + "0xf8d123be46e4fbf5e0f42801d048f04bf1bdacd0b017f98c1f65331974f3", + "0xd3a53944f9df4cb645cd8c2194b6e8324eb3bc20c058e5035d31c4dcafaa", + "0xca9f1ec62467ba342616bee58a661aad895f4986fb51e6dae8c2b3890e35", + "0xf3b9b2d524ea4f7192938c8f447b16a5f75620925574c4365297bd608b72", + "0x87db5ac404dc6b93d23507a633db81a64f39743dd1faee58c88624a0826d", + "0x5b6f67899c04cc21b5efe190e21489a9bc0bfc4082d3a652c12df7aa90f1", + "0xb2fc1215f57b77185ed6e6d81bedad73bf3ac88a3b9109646d28e28d6619", + "0x955286ef8600c846c384c5e1f627623cd2b0a9709565aa4ac9b7c820d19f", + "0x523761a2cece15359b136a678469f4b43e3d8e5224a5f953640916818528", + "0x262f1afd5265b51f3374c9d69c48585cdbc339e4093f5047fa71f3d4d365", + "0xe28645d44d4741828094b052e28435e1280716019ca4ec12cc7ffce9e816", + "0xcb087a5f4732a3c89acf3dcbac5e0fef18ab625d6234db920234858a2d57", + "0xbff298a518b03e268f942eb072ed293eec32fa5d30ce803349e01f16fba0", + "0x7a171c4db33f6e32deab87fdc9efb39d41954bc5b3f3e9cc2db523d02e95", + "0xeb89fc597f251aab0b06957224eca10e11a516e04a617e745f44332a4c3c", + "0xd349d92d9ea435267338826288f0dee4f4d3960659b568d6758430f8cdd3", + "0x81c439c89fb40629f61d56d98c09bf50c909792a7678b0195be29efd41f0", + "0xfa0f68a12e6ced68d3ff9c9b8d34c38450a2795b7636614e1ae36792ee8c", + "0xe16fb51e1c7211062246a02a03172e071c898d213f21aadc46e0ad22ff7f", + "0xab823f1cf133c0a8ceba59740a5eb52ee3dfa998b68ede3a5818cae2222e", + "0x55f3802ac23be0dbd76d904b42563731f9ae1cfe5de0aa7182282b420d5b", + "0x381354aeeaaf5af6e18caaa7d7ae83e68ddf751589fdfe794c21554a1122", + "0x2cd1004355b347615f09aa0d6d6d257ba4c0ff0042da9bacda38dcc11ba1", + "0x2e8f2a92ad88b3c76d008eb7560370ec0a10c8ed2668004b3e4021737e3e", + "0xd951d31b7248fb37de731073b8f0dc1ea8003b34ea53a30cdf9348c6a427", + "0xa27b3f147bfbf0f43cd50824cec72e4974c5bca548017294295606dcd4b0", + "0x5e77fefd16721551c34ee34489872646acd62899da350953b9320953afc8", + "0xe7dde974e54f929dd95c0000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000000000000000000000000000000000000000", + "0x7ce5f0cc15b1c54d3870e5724888214c37367c8a4ea5933f49b74d97ec95", + "0x32529ba452adcc506bd6df998bffd02278eb8b49cec4edd5c1a3a131e46e", + "0x9d156dcc43cf349e1dd0df8e9f71dd7080d5e0f7ecc71a2bae43ce79b4ff", + "0x7ce153efd870a0a5e996abddf380189b953567e8c87065027f5e1418190e", + "0x009a1c507102610723a595a048cab93e54d7b5b51b304a696ef8066ae8b7", + "0x601aa897cf566117211e1fc42b7ee82fb99b1bae1a1dbf8b7a7df0dde395", + "0xeed84620e44308fa07f0cce3f696ac38939f0102108f27a596249baf5c60", + "0xf2e919396be695deeae8fd6f90d01e6c78fc5a60b6ec785db8766d42c6f2", + "0xfa014b542528f8438e6e85ed726be0cec7064fd42506ee4ce7ca01bb2b48", + "0x1eaba0f31ca3277f54a83dc84ddb5f696b420cb194cbb2fe3a492059cd3c", + "0x9ba53dc301d94527b85486580ad906a6a5f91cd4cf639984a44419b972fa", + "0xe76a909dd9d0b31210ab69a66a69753cf0174a622ec8ada02f62c31b3081", + "0x2199a532b63c5afb23bf096141912cf846baba6b146c19725f3635794076", + "0x4d853aa760f8ba57a3368b27f87d700012fd68e2560c8145fe478f391d37", + "0x90a3b09096de8aeb4a0d5a4722d7d3783e5e04bddca421afd88a6189bfe7", + "0x6a71b0d7cebc6e0159f6e08f3702c88e29015993e2f61e70aed7b30e10b7", + "0xf4d3ff7f2a13eac6ce5034e2cc370625e0859479407b333a4e11f4f5b503", + "0xe92891c74158cf7c44440f5a5b102bafe68b2359fcf6cbe7612e8e8d8042", + "0xf40c33065fb05a16e4ab46b183e9177c023c746105e2e5460cb70ee58469", + "0x10bec62c407d335021f42fe7a7cb0be23ba0cd70586fa56f9b43c889a361", + "0xe3991fe5338b232a38fb3b831200f9d08dda89f0c130c4f1d5cc88828f90", + "0x2d5742c93fa4a84bf22f94527c877caef3d0bf72160bcc9d3dd4f7ec147b", + "0x9537e21fffef3418f6a51011f650b738afaf8ea39cfb834db3bcbcae7ed1", + "0x0b6ba478f6faf750aab4da9563943c610b6d73b123aeb27361b992b28205", + "0x59f77ab74013dd230dcee064d946dd9fe7c5b7a6fadbc469a1ef6bc20189", + "0xf19130ef58dc666e8760c94a4077c317f14a708722334a4fd417da1cff78", + "0x2283140e7cae1e114cc6237eb2cba728623d334bbd2472b07916a2fc73db", + "0xcb3c7370bb27b989cf53c2c5c05ec2d733b0a489dfbfc355f5e799513bb8", + "0x9f98e2a7409210a530e64b9c20ba0c2ff3c01bce5d8ed69198c54d74ed8a", + "0xb1324faee39c0f0e1eab44de327164a35c1ba1575ce4cf3634758e3ae14a", + "0x49becf4abce1c47aea3b36e89906a200e17e0ab9ce5c97fb1e773b96f2a8", + "0xcbeb8e51702d4900ca08bf3db3f645c06fcf6dfc6b3a7a56c04c81b35f95", + "0xbd1803b45c35b633eec7b05674e6df969cbe22fdea3b9945a6132144b483", + "0x3aaf014af0d3f8f8db75c93108cce440fd6ef2c532aafb89c067ed167e85", + "0xe7423457a99e17b930784f3dc1f4324ff0f4d8b905997fa0a82de33a3904", + "0x17653efa0a3d2dbe5c424ee158b2ea4ac196377dc4b6705c06f4cf046b22", + "0x6248796a116199d4cd4f9e976471a9b59b42001a67dbbb7ffa9b99df38b9", + "0xcd8ab3cc218d67511ff08e0e4713a7f8052da160ad9ac731af05e5c60f4e", + "0x3e3c471ddf94ac32a9d2dc6ff8a24a362f73a76e3e1bce2ecb9ac331f3fe", + "0xe333d3fed5b658ca9577be00d4d94db4ad69af848a623f37d2f678aa79c7", + "0x62d0f2b73fa18ab7f61cd27d2d61c35a76b58177971f714ab0d5c4b41b48", + "0xedbb74d068df5b69cade9bc859df7afdb12f8608e19eac5537a8dfc818cc", + "0x6b7b00a2c076e9f79ae5720e05319cf9f2d68857535c1b606ab9dc05a0db", + "0x1a95a991c224f119a5fd408149bf15fc44e8caa68129638e08699ef038d3", + "0xf4579f8b596c2d23b65f71e4d61fa9da515f7fa569594661a2703b88772d", + "0x0c7e1e6c3a279771a51cb8a74268354c5d5eb4eae537a8b23825a59dfdd8", + "0x9f45dbc38417fb52dfb4f0f77f58f487181b6eb9e15eeab580d90eb0b016", + "0x8d8b13e4e5b7231001cfc4bee0d684eb422165c7a9cb37060e6406b0fa97", + "0x3e39ae26804e9a68191b1ce93b501e60d8f53e57ae507b5ccb0aba9d41dd", + "0x0985514cc2322b021f362e08dd933bac5f69d8a40eb2aacd395003d19522", + "0x8027db93a3f4b57dbe07609700410247ea5c75b45271928e6b58a300ca79", + "0x7529e528e589da8813eaa0fd02878bae264f9306cde6bf0f284e3ea37e85", + "0xcfb2a939794285482b59e4abbe84961ac6a4d82b42bd96b11a5565306db7", + "0x2cae1957e0798fa65e71de6a613aa1f6547c6d5c81f1dc996540bfe0b4ea", + "0x2f8663e6427c34a6cbf0574f647d90598bb2f2b2c0878670566435656970", + "0xca6337fa2b6deb6d19b0acfddb2d9024e3edbee6704712474ca7c5b6a822", + "0xb88d12e86b523809d8507742df431317afc25b6c58adfb787c84b47c5d9f", + "0xe991ec3b88ac58b8d2576be01e4d6d3bfa9920f059421bdc01fcf77c07c3", + "0xe4a18083463565645fa2dfe88e99221a9b3ddb8039457ba54f875404cdf2", + "0x8ffa8fc3b6c25c9ec6d9d854ebecc5250ffbca35f40f7fe72f28a2a97023", + "0x228aeb7fcdabb1be05a9e2bdd1016513fffc2c0149f7dbb376f0634231fb", + "0xc0d069f1ef7e1086891ff60fc20fd882130f4ed29dd52554faf4049cc812", + "0xd16e8aabf9e146eb98bdbfc6297afa9cf1e4744a87c29014274ca4724695", + "0x5f71a6a2471fe2a988889861886e854be4bd595e71e43952ef75373fe347", + "0x2b36d4fab012a5637390e7e688c9fe5c7e1b83f297be19ebc08eddbbeb96", + "0x801f36e27ee10a74901e11fa99fc4bb1b424ffe67ec49e549b0834bfc493", + "0x3a16ea8fa0106cd092a592f0a14ab198de0f28755216c4d16a5cd385914b", + "0xd981f2dc4afce8a13d7e5fa224865b0eaa9ec2bfb11e39bf9efa08116d2e", + "0x2311af169049d38772928e360d484ea101acbfdb139cea5855e1fe93da4f", + "0x629cbc79cc478b27698cb758b70cfabd445f969eecc3af10b71983917b3d", + "0x35d85b38ffddf08cc550f0a5cbfee5fd06906e3e9366b366c4b1b7817795", + "0x4b81884cf5d7e85a6b9bbf7d45678132ecb686490d405fa72e1f64d8c1b4", + "0x540b8f999b7d5f580fe92dd02d7d7c90468e9f90aa4127c0fd1e77ea4cbc", + "0xc07d6f1e6365a6875de347b8c2c7ccc15fc35e37e5b006c7693295119e89", + "0x5169556a7ffac869499758a292d1ba44ffc8a9598ed5fdf919a8e98bb210", + "0x8084bd84987785f35d29427feb2a1f6c01d4dd454d8017a7e3f5fff12374", + "0x33dffcfd0704ff8f96e3fb4d4a738262f32d8b57af3cc1bc5c640606b0b1", + "0xdbdcc57c5495a93119943c5e55c6ba87ea4688f76de18ff1d9e2884e2965", + "0x9123c81e09a1e60c4fcc75e1054d3768252197170cdf181bb1caa35ad996", + "0x7e85aa4d839dafeb7f18284ef30e5b842f6e94bb6632859280a5142fdd6a", + "0x4e6107a60363e836c00b7a3a2b8fcde29d2e7dedcb4fe6653b2d35a47658", + "0x919e078496d7031507b2dcfbc602ada3a3b53ba6121ff90a3a7a0f6c1068", + "0x38a6c26231f8e1e5a1e81583be29a7c687b02dd1d9235c5cdbe372f151af", + "0xf2a17c579971cf20fe22184d22a1f031947c9ffeca76b45b3578b7e517dd", + "0x00ebf1405a6f27153dfaf7d1f3ee65c512e61592d816f59e4d9e499a563b", + "0x1b7ae88c3004428ed246fcc3de124dd8c4317d47fef402b04d9ae8818312", + "0x67d594b51ac3d6e2c23d3403e5b06b9929556af9127b920e1eff7e860bc8", + "0x81e6beed8ada47aa28dab3b86b249a2e452ac7c41c69d321cd0968c3660b", + "0xae6b514bf56504e08b7b194f7e376f2ff25216bbfb55c49ab0dfafab7de0", + "0x35bcdf3746fd1683f0da76df1bd7039fb93326c1e68293df39585d1ab6be", + "0x16f6d5877b63936fc3cd531557b839585c7e1969e452857de305ce306368", + "0x06435592092646ed5317c2182c5f7d15eba99329664e91457c07c9625721", + "0x8424c381db01d3533b64b8fefcf32892dacf7dfb7e96818c19b02cdcf1cb", + "0x88a2360bcc6691555a1ebf464fcb11bf22ef81008637544399b380fa7313", + "0xa422f74247d089f420f82ab32cd88bc61324cb589dae9d0833091a71b53f", + "0xe932a637a53a1d8d06cacd141f4b4f47ee9f3bf65d7e2c95e5b6b9aaea9f", + "0x75aa78c3cd020766b7fd8e12bfe18e69fff3c859efe3c4fc803b76ca0335", + "0x062b822d1394c4eaedcd808a7806a51641fb65df41cbb5664e1a80af0fdb", + "0x5e594230030de3652829506364ff321803c7909841d790bdde18934db1df", + "0xfdd68e603a0ebd473797c43a92498c053d61e3ce01adfcfb88f4dccb520e", + "0x5036b1d353c2e11352f20422ef040ea3c451a875f3b71696d58859afb1e2", + "0x7ab5635d8377de9ec70f8d1f39fc97232ed40049e85207fc3899629290b6", + "0xde12962ff6facc866351e2e22f6c9635f712f48b2b9f963e7935f502c1ae", + "0xa5d24e8ef2a4f481cf72d423aaf2b39b216c870beeb5c65903422d34e623", + "0x34f15dbd8a687c1c1f4bc73380824b1798c9396417e2ad075e1dccd8d150", + "0x784acd676333757e461c66fc1e4be1fece8f5cfd9894589d1ba8ff3ce09b", + "0x7d45eb567b23702a8fae4b79ba0f9305349cb8a6704bbdd503c0c6ca45a6", + "0xe25349267c249d21192bacd807770716d50d51f93f4b3cfa212da5e33f07", + "0xffee874a4f688a5d4f4f003008024dd8a9ce94c495d8aa4451f267ba916d", + "0xcda2aba0662a507847b4b729a9b1bc0bb6e8aecdc7dca612c35252e48511", + "0x997259c52fdbc9940e749f3c0f46788491b54ddfc858190e4c2a255a65f2", + "0x3049c85719252f991dbebedad1c56c97882e3896c61675c255257a0f635e", + "0xa841886b547bd19bd6e6632946b00ffa35723bca048fa2b020a22e0ca5b3", + "0x916f5df94ba5d83ef4397c05aee7282e7883034abeef240f78fc75b593d1", + "0x087e951c04affe4630128b6a4c8793c523b48ce9994f3a671f663e00992d", + "0x2b1cee62146f1043d4b04874bfafde9c26cd7b6027b376c8ffdf90b62508", + "0xdfc625955e0febfbb0e528784b7cd0e7b539384960920d45b6afe00f4ffe", + "0x6388fec5be6b69c7968fee2f0ea4d99d84aa5e2ae578ce28a228f5d9a4a0", + "0xaaea83eb376fff885098e8fda7f992f2cee5ace0ee9b0e68cec0b6c82bab", + "0xc58c9709d10e935bbad1f97c8127bea97fe42eac669db5be897ec77d43ec", + "0x716b043393be219a6a327ec9a960e8e4a179a477211ba61038982104ffdc", + "0xe4a40abfbb13953bd5c73c2a6b45770220dfaf17fedb9058b89d01f98827", + "0xfda3db71cdf5b224d46ba803153ca95fd7094f931ebc12524ff1f3f10e47", + "0x29686d613f111f0ab7bb33dd8d447fe70b01fafe23e2c9a866054968358d", + "0xe68dce11679e31c80e9c6bf49a3838998947cb58828bca174db2ef44cb65", + "0xb8714c58e672214feea6ceeb604948aa64fb008839be1273e2f81a41b6c2", + "0x3f2ee24aeee582f2588b99e7d8b5546fa0c7b7f72578e13dfaa7608ffef0", + "0x68783bbb660be475e7e2a4e589aabff9ba15babea4111a5b4e8f88237bc6", + "0x0c8b31256f8c2225e51bf7fd91df4f3e2f27dbf12bd04832599c02bad0f9", + "0xf28801d7e40ae891135e8a895ee5fbe5b7616aba095b2bd59c527b91c997", + "0xd84cd53b72ad60f77554410a5253e479e0786189f71af4a59ea214a60ef9", + "0x5aa994350a4f2c37ff4b07c4cb8fdbd56b8e0ad417d4f616f7a3e9d490d4", + "0x47d133d74bac876e5b21b474ba731dc1e40211d611e28689eff7db50abdb", + "0xbbe2b02e098a243f4b7f74df3f68849367de683a47ad5c4b5fb8cc46e7a5", + "0xf3bf05610e2639aca1f32e8f87f8f4124393602604103bf361cdcb50f7d9", + "0xfc89728c3ceb2135d3cb4be4f1954653f8bbda7bb0dec9a3768c77011372", + "0x7463295c3dfdbf36974cc4824bd38f4b8e8f467867ec208ee44240b32dd6", + "0x135a05b8692f3327fb3cab54f2621fbbab6f1c012e5e1ab248b941414e20", + "0xddad87e5dfed8a5f9668999e9dcaa5b4c1aa8fa017ef50c0a78cc33db0ff", + "0x19db053fe53db11bb9cd063ce841e19639e7a742d00a81ca41c87927dfbb", + "0xe88810e34f0309f76c12734c311d446af354860180d1c3960ab79633bae2", + "0xbd55f43fe1475765f7623092c73bfb52b1517e5b0148a1ab42dabf6d9024", + "0xc25b5a58f8cf7ced976cdb61fa34cfb0f22f6f3145b6d22bcb9675d2b2c3", + "0x02a358086939752c11ecb0fbd4051746f28eeb56afe1bf146e8de906e8fb", + "0xb676fac15bfc85270b6b323dfa681bf97c6f7c76e2d7269c3d9ac92cfb47", + "0xafa712b53e5bdc2a11a25b1272f8ec4011e00284c58e7ead69a97fbb25b0", + "0x2bced02f85806ed4cc84979d10b5d3ad0a77f60e6eca475883f3f5d81399", + "0x842fc2b5745ad73eb0bf1bb8609b1f4d6db8c3bdc9e4f50bd16f14bbd296", + "0xba8ab457966a00e647dfac2c23cd2d0d29cd64c1b550df04b22c0ae98855", + "0x77490a3eb3fc16c0541da928cd385bca620a3e9a0eb70084694a8d0178c2", + "0x1046309a39d4576643c87f4819b0ac05161713a8ae6784f590825f87aebf", + "0x3853536c4baafc7e1010eb3b607987a54992e7f7a31ff26ee3d708708a85", + "0xfe88c7e6c189881b2e2539bed6f04be0668974c70863c42a10decd1df443", + "0x364399944c8adb07858e7367f56122f116e0e3be15346c1624224b00abc8", + "0xc4c6515c654e60d98f5f16053f9ca251f5b380fa1c883fa235dcd2f13a28", + "0x008c0602304861a64f7610bade7e744ca4c525868956ea6e342581d018ae", + "0x883d8b242ba825b141cd96944140f318ea275e03b3c6106749f9d0300fc5", + "0x15b70b515de277201ddd9d8be634a6abfe80ef87d97618dc121259a1364a", + "0xfaee0e8b5747c071e9171f82187a67e17a207a33a7b210d49a11467899b3", + "0x59cf70c79f990fe39458af577d0ce05db493c31916fb58db93a9133bb67a", + "0x1dc19145f1a0e086cfb1be0e6260daf51f88d6c45a0758d995cc2ac421e9", + "0x875f10a540972df777821f14587db91a73868f4c7370d3578b9fc4917bda", + "0x30a8252bd92938eb6436c32453dbe631d3487884359976f181e453a7168e", + "0x622c6c7a53de34d898c3db6a084080f5ab3aad6a5b4cfba122d568a4d949", + "0xac8f1787b84b5cb97626f63d7d4ab41a57b6f95b00b1db2b86e348167b9f", + "0x3d76fd57e79464e421fac89c9d417a5d073342a76c9de40ea1743f64cb3c", + "0x59144a13cb5c81d0d4a057d837cdaa2045f986c0d02165233bbaf13c8dda", + "0xceab58f0f6929b25f480a28703ff200ae885e1101f8579f591ceb111fdf3", + "0xa46ee4cc5b9c2d24be345595861d433d0a17c0bc44bf184f775eb229fbb1", + "0x52bae920129870deaac5f5d2acdd6e01e31671d36514eb9f6d902deb36d7", + "0xac7c2ece99d041b559f7ef7445d50f6abd69de0b8d14d21a2e92cd41b52e", + "0x4e2bc3ccfc72c3aa4f8aa1370d10ac2f03982cd9da8c7d7e0ddf603a7c75", + "0xda339c8cf85ece2dfa166522366318ad73673c36db1506f263dad0f341a3", + "0xb4fae8b6f2c47f8555091cdde8bfa02687a79803ed61ddbf07caaf7a56a7", + "0xfd194ced912aa9b533e2f7ccc565a4a62b7c6874b3ffeee0beb89c3ece7b", + "0xfad856044bc558194b4ca234cda5a59b7b58be17c3b7946393338fca6d20", + "0x6c8d571f9ba71cb7101cbe45b7c84c18fde862952804a3bb319684f61d81", + "0x2b15f9ea64072fdf3c0a4a53a31a8a0f96fe80a6084b4e871a43a07ff6af", + "0xf5fe51fc04b1adda110639d92c02e2a69c5891487fba940a8e2e9211d931", + "0x10e8dae75a1705a6b6d8c71fd6df9e65226d881978408454cc9b6e87d454", + "0x10936d369142fdaa144b8762ea990918ff8f51fdc1e92933c678bacd1929", + "0x5f4164518166f6dcdf5d930154ddcc54507cd60b5db6230dbf2822760f78", + "0x72c5fc066dcd8eefdf033b8204d918a2a5eacf9771f6802d79a8e47bf946", + "0x8983e5d7e15e8b334c00fe8c6585e22ff11af7aee8daf8081096bc17fb13", + "0x13d36f3675e0fcc2f6ad2b135c2ad5a11bf9b65fb853b37e1eee474c631f", + "0xd041efed0ab2609d0da39887fd4fd16a34046ba45de3a605350c99f585e7", + "0x023ea434a0d382b11d804076654103f81d737b172e9f04914dae8017ebc6", + "0x05af2ea87bfa9dbbfe795052519f3e89b8430bb374cfbb85c15bc519e792", + "0xe11829b074406b5814afb0502e3815f39de12dd5e1f166d669cc218dba16", + "0xf6a82761a759596e747fdc08adabf8810865f7ba73199f2b2284d26499e1", + "0x391ba374cf25763140103bb5bd5758646a31fa7576be8cebee3ebb71655b", + "0x8c7f5307a23109ab759d42d280125e8ad57e1a1f6c2fa5ecd616690ca838", + "0x4ceb253d34705fe2f55900db18dce7ebc16720e10fceb89706dc2bcd8a43", + "0x01dc8c01ada72f1cb72e75d33c76dd67e03ac92cac113ef47d45e25af816", + "0xd4b38d7aee1980df7d6a8c84b852de93625ee38aac6f0bc73cc873c367e3", + "0xe5b6dba7e0c1793c0197f25d42c4e8709a2b4c39b67a069409b990589c4a", + "0xf28eb553722dfcd62c872ed9fa6706782ca0458de88e46f6749019ef36cd", + "0xd9e665f533af7fe5200880a594f86af2d4d522300217dd96be0d036f8a02", + "0xb14a0bd8988b309c0ea7e64f8854c32c2988c3effd12831759af41f29281", + "0xa34302a7fc0daa1770b8e53861adb0a6826c442a00288f83889fc84f30b7", + "0xacca33bef647a85c9b7745dc751bf48eaaa47995713cb8e41708569c08ce", + "0xdbc9d11c14ae6c884bc652c55c97e89bd6ae7cd440e329471993194e567b", + "0x124caf9422333ce30ab3c6fce0f939c8ac6ea4ab964076f2c31a56f7c742", + "0xa76c68af5fe558f3b885ba34b749f5eb9845659fb1b2c1c2197e184ab2a1", + "0xcee0f83c397e0d9b41cc9b6c9390959610e57c3b3439ffe83f86474bcb9d", + "0x37b3489e7f05e18fdc334f8896a4ed662a5d9a401742a038b163460e8f9f", + "0x1b37ddd6d7ca1d7351b317415d6912941fa240ca14bc07eb0f39a413eb01", + "0x42f9c13d4e2c8f3ebd3d3e72b28ffffb9b42301d482edc3393cc7b37791e", + "0x4f1b43c9afe3a6257bf64bee3d206dbeee046298d2d59fd39d1401c4e9c3", + "0x65b73a4f862a5ed306163fbb898edaa0df08f44760b73248c4470527b5e4", + "0x6e541d74df841cc5db25ae2371247e504e1f4682f041a4b7d1dd0019bd69", + "0xd3341063e66cee7e0da947e57214c7f00e893a1fa05e8dd65c9eed852333", + "0xb8485f9c072fd5150df5b2233876f1201922cd22ca75e37855400311c9c0", + "0xfe777b0bb530dc06024c0cc12f1d3f956bd4bff74a3f637d5c29d0e3a51c", + "0x2c43ccca08ee06271ed265f90d67f0608af3bd33fefb559ce397f2221de9", + "0xcc828d6d3d8d99c5d5f8423649034e6edc5a18749e9c1c814804989a6a2a", + "0x7382aea63be6344e08e9c77eb9c6c17917d598b8a19fabc0253561068eb3", + "0x60071c4646173393a064c40b241ea0c915b824f93fd487ddf403e5dabc37", + "0x54f37f3519e862e9aacc9cf91e7e1a6e39a9ae97d21561012880f4d13acd", + "0x95e61ab9722716f8976758a6c2e5c581fb615db6083892d8aba87a7473fb", + "0x9620d2808d9c677c3269eec3718878dfdfaef76dd7d003746190f4e178b8", + "0x8ea5ac8e281e5bd3e55f476452c12968fa9091144ef6cb6e82f527733961", + "0xfca4629b61d05b5b8d6b179e79b0c3532e4feb3d4ed3d72a3ee0354e3999", + "0x9a87ad8b4a72d4625d7d28dbd5184df4665e4693f14a8703d2e020d5cf95", + "0x8991f564bf5935723f125a1da21abf37f979fe37a6c8591d8df31269869b", + "0xd72b6b20ef3c52d7ff4701b8a01e6adf8f75f3af220f93734c17658b8dfc", + "0x68b7b742b18517852d66b0056c12777822328a20b6d556f53447d0a517dc", + "0x960e641593ca35f01c5e74c6e52bd5452881a82b663a78141ccc951677be", + "0xbea4c16c237ecbc3b852c7e6684cf812f3c7b48192f2165faf7857f027ac", + "0x353f496248d3fd99d84554fee3836956e25d194d9427a744c7d61f45551b", + "0xa1f14ecb2b29ab839baf55c1435ae818268cd2f1976e93ab643d3ee22e3d", + "0xb035764d402b14fb47144bd7b9805f3b47681eaadd723698adca789d8ae0", + "0xdb94027b4287e0479b11971c19a2bad898062831d568089456611cfeb43b", + "0x3f842cd0692e5a085601759d840fb06b56e30d7e2c3cfe8e5e739ae205af", + "0x39980f2ca3193048f89bc327b3ea76d482084639b48ee9c2a746d87e130e", + "0xfa0ec53644485c67a79471d40843919c420313bd8febca6a93f9d947071f", + "0x86226a931891ab2b8b4ff6dc6f7edbd0795417387f3db6943908fe2d01a2", + "0xa669ad610d7552145ba87e6f6f49bf09ef23e45e39bcf811907d9e2b3b70", + "0x77d24f592c1799c878de1b7fdc554674013b357db525b4f68400757490b6", + "0x7403d2dc4ba08adf70d670011fac3e582e549a8be7559200d77dd67fb949", + "0xfa2fd68c28c8a8e9c86d8351861ad14eeed12be27007111d0e124e631381", + "0xfe6868667bd3a1fd272e5df20b8986926e8b8ac1d823e156bc5aa03c36eb", + "0x853aaaa4a00ae96320f0dddba855151de168692fdafe2a76bec4198c01ae", + "0xae10d602c5cf1cdca42665cdb5cb638cabe4388eed85bd9d1a22a9ea6360", + "0x87a18c5f957f46486459337a1e7cda4f21c11f741166c55b995c526859c9", + "0x35c1165ef624a3d7c31fe06a269822453153e72c0d03724fd63b73ef3e3b", + "0x4d6db47c9bc978fabfeb1a2b9c8bc0ad0523a5d247e841876f50cb2cd6a7", + "0xb712580bc5f367a1260296736cc1f764db08606fc60e5828821777cb83d6", + "0xb2ed43b37b71d314b09b13ee69b737667587b98bb2f8dbc2085e996521e2", + "0xe9f1ad9bb8e2f0db8159268d965f7ad95040e08fad3f320c5f7541076902", + "0x0c9c36ebe34969a0bfbb1535e4edc47b856b0cd781bbf76c935a1a388e95", + "0x8b63bf5203b6a72eea7120bbb647057eaa1c36bf22738772ab379fda0cc6", + "0xb36f0347d3328875f1e3615a078340767ef1dcbff04b7adbae962a5eecef", + "0xf14b912d62fecb4272afe92ee9a66b1732879caced5022f18cb268c48384", + "0x451e5844a56e0007ad92e4d277429b193b21a353edc67b4c39710f097eec", + "0x78e2c6dd70b0e520c853ca62e13358bbff762c66329f81bccaaebf588701", + "0x737ab2787acaf860e9394e31f4e3207eae4bfb766e31ddae36b22744c522", + "0x8d63181899025d360f69770a7358f171014fd4089bf605d2f214641eb4c9", + "0x58a6482ac47074109436d25fe113c36614e7c4083152839023824a1e8abe", + "0x1cbac0b175b9c668e40b2dd015e4d6b46e92b4ee06c410baad9d9ab00dd1", + "0x83f168feeac00df7721865224ddcdd0de3f88b4116413e475541de08b39b", + "0x8c6200d513cb262c39d15a966662b0164dfe46736fc63d385938c5063ffa", + "0xd5eabbb3e3326742536d10c1ae9182c5d39b86c20275f818068da52eb605", + "0xdc95e9f0f0569325917dfcaf0502a604e2676aa56ea9272774db6ec9c478", + "0x4d950273cadf942e9149206f22ecc9e3f968fe2f630b43806902f15572ac", + "0x2fd6a52da47261469aac5aaca25ee8167df2a5050b8c4267e3d46274a2ce", + "0x2e2cd06169841035e9eb6dbce0df01b8c831ff477179fc180825fc215350", + "0x09215dae71c7c283e27a23785500421b06a37e6b229d0c4b7b9ae13988f1", + "0xe1dbd6127e00c376e39884740c44feb8ab2c59f2e2b4f3509b97780f9686", + "0x30fbd036edbbeb4d9c513d9e773d311f22321c00d95996600b003bcb4039", + "0xbd87840a818983b5b0496827eea4e822d2b80268190ed66d89475433af2a", + "0xdf16bd773e6701af4a4c7f8126123e5e6574a16eec0fdd0c847acddf9a03", + "0x143563373e25767024d553e75a0470f04c150adabd76088ef60877080666", + "0x9e343e6b097f365fc369c0d725049fc2bd918e6d182910c5fe9a00446c45", + "0x75026d24405e125594f46b428812302a55ed20a40cf78be8c4823ce4f137", + "0x2c4d5c91778fd4ba3ae963f2b776d879e53c01208d3ff1b3aa3e82f70619", + "0xfafddb0862c9a218d6262f6e84398d7e961d5cdd939ff5927b739142d22b", + "0x30e722cf92d69d037c3cc00204991ef3f81f635347643b272a53ebf8c590", + "0xab91305810db114ec61d7a62182d34799af02755cea70ea4d693f4243468", + "0x07a2cd60c57f33cdc1fb96420e3c85f79d44ea89ac6d3eb6abee9aef3b32", + "0xb8ac980b89e8d474c46b4bd69812b8de6f9a3898eef77989a4d18a540b67", + "0x6f5c29d21d0efee74fc82eaa8646e94351d77de7b328887d01534e700685", + "0xbe27726085cd770c68f349fd1c8aecc4c500c30e1e9ff69ddabb0dcba6eb", + "0xc2d56611b5d5d9212235c9f3421d221aa571314b3a3ff3d875139ded632c", + "0x56e626a356378e94ddd5c10cc539156511d89499ec285846008d4ca0c751", + "0xae8a4934481b23d139cd8a86231a7a832083e43d6b4222b1c74610f90931", + "0x5dac5fdb8fff8aa4a19a9c03be55e67b4be3cb57dbf1b3169e59fa9695ec", + "0x772e75165cd0839bfe5fd4e0ecab51fb7bf7a1a1a0a07f51fc57edbee3fc", + "0x8b76466b220fdfab1e9db4ddc1ea29824b4a3f445efcd0199f9bf9124cf1", + "0x55a98eb4fdf5f4b19abfbb634cfa9cabc5254ad9d9082009fdd6c7899555", + "0x0b30223711a46be15ef198edaac605604951a0bff2e493fe225ea145692d", + "0xcfa06a75d3f25a85a637ea621e15e1f2ac86f26b96eec47744edb8bd8356", + "0xe74012d6aad6b12038ee14ea2fd2b0cadf9a0025cd7d163a67d245e41f1e", + "0x7b095f749200ac853d27a674228b3e73de8247c50c57e49ed79d65b83bc6", + "0xd78dc8d3d108b287e7ce0498aee2f02c11b781fb7aeb646cbcbb66aa6b00", + "0xdb33f65799b1f0a618205ac1fb57dfe2208913cad204969b1193b89067ee", + "0x2e7dfb0c43c5a60fbd95dc237725d302a4dc9837d2f0eea21c5feca68a5c", + "0xa705ff2d2ec9072a9d802198c1f8ca08b9352b233db3b221e04a35668124", + "0x82a256c9a1848f6f86f7aa260d04372d8f96af6cf128acd684fc61aae6a0", + "0xbfb3adbd840bc1ba7944d816d9f843e83c1acfe4928f7b5d67c76fc4f7e8", + "0xd5e3c7df60cf0542320d7ffa7b182fe284e5bde0d83441f8ea0b4d121e9b", + "0x327d875d6a4dc578eb9ffcfe2c91b8e0a36c2e879985b2bc89c908f7c3bf", + "0x0d495d8f682a5abc3a82a1e74d89cb1788f5045c39f580e28372af1d7e57", + "0xcac52ace9a7e50c223d066682643a1d46b6b4de736a06c84152f44b078ac", + "0x10e5ea1e2c95c92719e9acc751fe3ea9ce9b200e442b74a75fbfb8a46eb4", + "0xf86ade0e39e684130384ac6dc35c39660ab767bf83e522273c58cd4fee18", + "0x7638262b789d7b13483d51e25125bf9a7e62e2c06b815ee9d1fad8f5de9b", + "0xabccd7a7c5802bdb7649325af2800a970e531c278ae2ca11ec7efcf1b073", + "0xbc8e1d33ddd5703a4b5d130391bf0f7644cd6e0fb3e3022b5083e0d4ee35", + "0x449e2c4babee34eecdc9acbb398fb3633cb5e46b63c6b5c38694b373497c", + "0x0f289fd405abe201a2599fe7d04f4ec3273b59a8a2b48b86f074af936152", + "0x8de7d386068f65095bea9a70a41652ff00f70ac5890f9f553c0966352adb", + "0xf78de073d2671903412e4ca4438a18d73ca29a2f1bbb483dd33ab030aa32", + "0xc9c8ead0d53455edffead51dd6340fce505c8406617f6ef97fd87b9db385", + "0x4ad954197647b77ecb24e5a6ed011130f59eadcdc7ce2a7b3a373927beb8", + "0xada7fd2561c62c3ef64c9602c88b6eed9022b61e114411df7e60a939a54a", + "0xb10aa6c46955d8a7bd0711bff8d0c50536cddb35f31f939e63866ebfe8d4", + "0x590942f6c6077b34cde9657da09c13743a727b75890035ac5e954f8584fb", + "0x25b2b770e3677dcb73ddd498502958e10b8c54932c8114710b683ec32d28", + "0xa22a41b4a70a4c201a937b3d4a2a92fd8d798d96c52c0bfa7f5c1668870c", + "0xcaf6b2ced29a060a6a16540da0b63236b7d8af0fd25d2a7c9b5e83026c1c", + "0xe41554a4ab495ccf2b1963f52288a471160a52504e5575ab1d8a12d63089", + "0x888f928721213ac36e648bcdeb878a704329ef8c13c758c697a95b6a67e0", + "0x72e41663147b38a02201ebc5f75cce53561247db2e26be3154870bda8dcd", + "0xab503a36515cd5774ac6e591392a14526237b73611ec5a224d9fd677ebac", + "0xf47fcaaa17a443a1303595b5bdd791c3f309121fd1ab07c6a520ba8cc0a1", + "0x8e7078e29aa918b1e96fd4b6df91fee167fd66132b49b0cd7b235c3df49e", + "0x567b0ea4c38adea5ac043a300653d3b2795ccfa54b492125ea23646de3df", + "0xd75d66c23879ac6c2eb2c1fc10fedd8fc805da05f3803da322fce51366fe", + "0xd57e5f38a9aef6bb3c2db7c2cc65d98ec8a121819d91fa6274261fe39e43", + "0x0bc31e5f03e9e449461e5486f939a29a0d3e12a428d18303a634d1d808e6", + "0x72dca4697a1243c46fe6d83649a08d15dd8f419372c0b014825717374d1f", + "0xe123f14463f70f44683852fc3f3b7ee68867a36b2e81ea429563a00e166f", + "0x795d597e1136fa4237a02bdde51ec05f659977d0a3a84d4db7ae7b86094d", + "0xfe62e7971e4bf9c40687a356fbba253383df1cd2a2583827050ca6c5edb9", + "0x0d74c4d341a40d8b19cc99e3222891972bc5b29385634e51f6bd7df503c3", + "0xf6b09ff9d033334a3d5a29c35a84a72f29db04d7666c07fefb15802675b4", + "0xc710ebab2881f4481e1cf7d0312f6b5720d4e518bdb7c9fa0090c9f76e9c", + "0xd344f185a20cffb5ca6eba21518fb90313bf937cdf464ac23a806f728efd", + "0x0dce14cca6fd4c3f8b2cc7a5a0b6cc100845540b89daf12f59785821273d", + "0x9021b2c4d93807bb1f809b0c3625bab2a45f06fc3bae57bb85a0c4f6c017", + "0x86bc13a22bf4451a9fe1b5c1cc60fc553bd1defaede59bbebf32dea359cf", + "0x106fa33a0726436f0ad5b58a744177bc5d08003f001975e00d40594fae02", + "0xfb333e0aa3bf9afe4e96326e07b7c9378e9d631a1630b8b2ee557fbd7077", + "0x8ea4c1d37f93be213ae0731df31f4088f991da31c53fe8cc4e810a29423c", + "0x01ea1be11babcb317ddf60e9b3ca15f71638c6b2a899cc57843b973bbc9e", + "0xfd6fd465435fd0e32aac344f834d8f87fe3c2e124fed065577d22a09559d", + "0x3224946953387a08e6c553a95724189f71e60d1df1e82e1b7fb7ad1fa0dc", + "0x9da5c2ec0ceec5f16ae6a7cad122efc29ce7c9751be1834fa694e3962f4c", + "0x6ad50289d2a986d244b884ddea14c3684cb2763cfffa7d6b662b62b0b068", + "0x81037c7a42f83a05fabf0765795e5a1ae63947cbd26fa14bbb0dd5bb2bd7", + "0x91e2a4ae4011f150177c724ec9355b7f738856479ca61c78162572a36b12", + "0x6326f3e82efe55e98d4aebd51a4b08deab9148bc53ef5c3ed124f33cac3d", + "0x2616e8220197fe1f5116e4149c02c2693f478e521790d662177f94f72a99", + "0xb3218817347dbd56ddc7cd2480110e3c45d4369bff8e431e53fc3bf3f5f5", + "0x4e9ba2155bfcbbf4a54e7fa50406fccb019a994ecb16130d0fa35eae9fb1", + "0x97383fb5a3c0417b940eb50bad015e17dd5f69d6dc40c2660ad64511d365", + "0x218ba16082cf13fcc80b03c580a8351c61d04a8204e9870bd150332a80f4", + "0xb9a656864fbedf6ad08837927900e476a7778c64ae2d2815bd1d00dc731a", + "0x70a0d5864ca066021582175f0e8823396c70c8aae583a4d68e53fc4e3506", + "0xbac15c7e557b1ff5a43c01b42d608e7680879fb3ba2eb0f79e50e4bed401", + "0x1199a2bb313cf9a953046ec0a5cd021e50b88b116cf3121f4330524d7a86", + "0x7ffef10a67a89f6802b97a6fd1608c720d53801cadc621660f94c1ae0733", + "0x5537fd5049c85c0eb299916c82740b5b3c5da3a9f232bc897275b6d373cc", + "0x48640364266741b0fe961ecf819b5b9fdf5af1759604277ab38cf081ecd1", + "0x272b260e23e28e18868e480dd2fc97c63f020ed12ead0b83ea2f45eef1c4", + "0x0a01bc70a4944fab071cf1d0fabe85d6adebed8c4135be8490111660afa3", + "0x8408945e89125cabe90c0bad2e5809511be9cd7735e34cfd4ca0d1d50131", + "0x38df0e70e7aeb042eaffcd3d1d42acbf82129b2520f5840eb8304e489bad", + "0x6a5d79d07785d058cb8efdfcd514071d9040e0a01ee2eb88f00b0cfe5d89", + "0xb8de742182f711da745eef987d68309e91b95f1b0306d493a832db0a0d4b", + "0xf17120314aeca5b004dba25f0969faa29d8297ac0abd3915c8ab3ac00e38", + "0xd699767c1596d52d34c643646c946c16f5beba9bfdc7c427329934ed8726", + "0x8d4fa17ae15ecc0ac5f131f89ab65edda6fbde81605a9a4725a1f68d4cbc", + "0xf94dd3ace2d738f65a15423fe59c7b6d39b44695593312ef46266caad255", + "0xea59124172d7c3462f2ff82b62cae824311c73aaf6d49ca12ecd797bfe97", + "0x25752d88d5d4a81026fce67efc9bbf252445e5161c1340358d18aa96c8da", + "0xb5abd2864e1e0ecac761f56cc28d655ced1f62ed1aec98e70dfecd4c7ead", + "0xa234162ce8f8254cf9622c24a2dd5a7dcdf2c181a5ced3ee77719d12083d", + "0x238f45e097a0299d2b61b7cd09e66d2c5cd3bc46205cfaf70920086b4d97", + "0xf0f332d842842e0419b54cc19607dc732bcb6046238064176f4642a20705", + "0xc95ea691d61ba89ad9a1c2e5282fc46616098de96c8dfd71f71307e0c1a8", + "0xe9fa682d2a62afcaeac450223f5615ea64b07578ff1aff8d582b4cd17a24", + "0x03098e1be59c0946632f12bbdfe5ab2bd127ab2c7b4c3252c68fa9afc29d", + "0x1d1f4485c57faab893436a70a1f79a95ade85cd9355befd98c0d0e17bba8", + "0x808f05ec3af83b2f22548dc969a36bdd24172c7f4cacf3ba889bf7d4b344", + "0xf0a39a482237e40876a2508ea90a8877ca5ddcc1a2b519399c6d83228e44", + "0xdcabe3bf0eff4e005944b122a6d82364428027613707408d523b8f2d0fac", + "0x37035301a8e8ce8dd82502c99d1e23fa78b6242c841663672ff2378013bd", + "0x02ab93ea162670c13430c587e2edb11baf2afcea588a3573cdbd6ba4fda4", + "0x58652e32a98a5b0ed8fbacd36920be8e71379463f9c262f93875ad0ca515", + "0x1faadd6e7da80b7ddd85ba017d7991ad38c4a1abf2e3629a9252d976b729", + "0x067469f225b4c91855c5c1f28846b15d31cc24be84bd56a62746bf414c42", + "0xb147d9f13350e510dd8ccf0d7f6cb7237dda1b93f2dd27067e7044b87a98", + "0x96d0c07d981e61cf142687e4386f0aa40e98d13ff9b4531a077db333fd35", + "0x97e5e8ee54fe8426e9fc48b02d9c185bf385b178f671aa0baeb171a05204", + "0xfedbecb001c40de88adc527e2f663305a917cf23a0d78457c92fad8e826d", + "0x3bd8d3b0f04effff3d6ed4fa58c2167ee743b1c5b8d9dc6ab325a74c2293", + "0xcd97933c336ff49e07832be31eab231f218d45ec852ded91204af722a133", + "0xed609a072f9b52f408491b74835bacb27fb69bcc30182c6547a2f3e0c1a5", + "0xafa5712820fdc37745fe070113d10591adde0f7a6e151363c3c04b91ccc2", + "0xad141c98f3da298264ed88e3a5fa234786f7cd5d259f15a41162bade008e", + "0x4a92a54a11986569ac39aecd6710d18d234716317ac1cf04b4cc4ae5cc45", + "0xd55543f506346aa41bbfbb577e344a7be825c54037f8ba912ecf579d9b1b", + "0xae22dcf89532007151ef1651257cc858c43fa4f1aeaccdf8bee397c90368", + "0x81736fc4f7ffb439e75b6c45597732c581822d1eeefb36c5d3736c4f0230", + "0x155de12d875a65403ee98c4552519560835b1103601e5e5c00dd278358e5", + "0xeb39109b2923aa0f827a1553d59f904cb488fcca5ec5f73e7350d7b9bbf4", + "0xf8b6f1959a07eef99012c83eb217fa7721952647e26faa16ea3f3beb6142", + "0x31d8055bc7eab032e446d1998efaf162ba1caf047cb335579b9e3df979a0", + "0x474255baa2a95e6ecf48f46e23dc8df46be22fae9ed3de4a4a4f160f2bbf", + "0x7d14c0be5f376a49ea2a51a76b6f15822498f22ab5f19eaed240d330bd23", + "0x5799fd4a271f28ad530823cc7b6ab8694b506a94b7e6f213aac27155ac5f", + "0xf9502bf5fa8428f5bbdc211254f6b5229442b18bd3e9eea6b5a886c8b530", + "0x8f8d5a3120e83cc0242ee786fd36dd8643a5c3d93ea5cad0698597b93ed7", + "0xc7f08f7c7dbf89932420e0b8683622a43f71381786cd2ed527d15bd2dd2c", + "0x1128356992c1075ce24339770145311b94698cf949f5d52870273dce0e37", + "0xa545380bed5acc02efe510355a5ea4978ab3e787f2080c255cf3eb30d15c", + "0xb4005daca3d712e3ddc7dbd2784e5bd2ae639bf5027d09c1eef95936d981", + "0x8885bbda079d379b7b35d33ca9c0796804c94084cc2f40195dcf54a051be", + "0xe2398c6bc798186eb57a78cc2c739556434528d9d967589e6a9d55e6aea0", + "0x28c19e933a8f1caf11d19d683c111811d7e019f2bd6965248c837fc08356", + "0x0b27ff50bfcc31fbd90edd9ec95fec3699a63537879b1a59e4a76aef7833", + "0x3be1b48ca1d69dfcc2336d6665bae1b4a29b0f2de1abfc2603e2591e0af0", + "0x992b7def81fc418d5fac5636155ec4150d6274a415a9d79057349b260fd9", + "0x9cae0029c990f7ef87e7139aee30705b160fb9c2aa54c43bfed622529748", + "0x0b662f9ca7af02c1664de51573431f1d530077dfe0ef3b2dbc18b8668146", + "0x31c570b46202215474249175e20ccfb67859793f8fbd663a912a8db3a198", + "0x5f5d2759e71ee0272e6dff9750bdf947a4d35ec9338af226d2d72560b161", + "0x403fdaca1f222996bfdbe913853f185b0d2fffa80930f6e8339198c973dc", + "0x5f8e2bc220b67ac7634240c53b4934499e380f366b09c3fa704edcadc52c", + "0x40c1427b94d35856caf38322d298c04ea0ab02dfc481a4df22c527931901", + "0xd4adff20f3af742468c0cf7cb68907e7f13a9f74d94fea37b8700438b221", + "0x30ab092b02bf55ad1dddc091a643563bb285268dab786facf96e6404fd76", + "0xc9a26d422620c01e718ba682cc21a9d55617aa39f124e1e16696433f9729", + "0x44910c702a2b486a4b77ea4f9837334f7820d53fc86103c460dbe6fdcf1c", + "0x348ebb02b74b47cfbc68a23665c0da519beaa41a21f2a64a4c67b510a8ae", + "0xa90e4d0723c01dbaddbf5f49a11301c0bb19d9c0979e2e4b003fbe63deb2", + "0x3be06b668b76ddda0fa7acb2885c2819ec650f2a0aa82605eb04dbe31c8f", + "0x7583eea0675ab38f81f59405b6e7c70d8a0186b9e8ddbed4cd450d856311", + "0x31ac909bf8aa1359e2e26d2fdf9ca4150c823915fe23c914ea66257ddd62", + "0x66209de1e1d40064218eb3a1676b7081287fc5cedfa866c64ce644a3f8c2", + "0x914e36d484f37d9872a3ea4ec1c3e5a801300390916e076f703e51cbdaff", + "0x7db412fe8f2d851f0b0b45a895e1c9163d1f8fcfb7af515f8deae0e8d946", + "0xe82cd2d5bb9f7832314e9bd08cbc22cfcd9fd84ab6d7ba13778746609a7e", + "0x498c41cb4c92820e251440b4ee668c12d6342238ba442ceccdaf416db93e", + "0xe9b5514a1235cc0979c3c2b53d1305c63c4e69aa1666d4f2a916dfcf183a", + "0x4a6c199e669d5c35dec5735dfb27097f0da25866d6b0f1966330a999a5a8", + "0x2f32e73e167bc9633cb2864436b21c2782f39b3d1df8c89eef257d1079dc", + "0xe84e4d912fb6168fb85cee5a74848b5d6e2840528bc8ec7ede5d11d2973f", + "0x8820608cf25d1f9453974ba9a9ded6b20e809df0810d9aea787ec3ac335d", + "0x313eb86ac97c03cf003ae9e3ad5e814efc0fd9811fa56a9bb7a0cdc40f0f", + "0x6747502d7c47305e96a1bca71bd177c428c791e6ec4912f97d9e285ccb06", + "0x12456f9a980729f881934296c969432d90fe541f9402dc3ef11fe4fd29f3", + "0x45b2de0f6ef8c823177ab887289fb1ee56aeba035b5bead2e8aae0927b41", + "0xbb46f8761922bfe8ac86f8ae93b63210fc3c29b785b2bca114fe4ec9b68b", + "0x17c274ac04d7dedc283e9a3d100d6f3a2ff6999b2ddce8cc04663164e348", + "0x26ae9e658ee18316698920af55fbb4453ceaf211a7b66bb537720ec58ec4", + "0xe24125fa62f66b27066c28737d5fe4f514a9221cab9c1e1ca986c19276c7", + "0xeb16e8cd1bd3c1d9cb927f93b2740b9531bb54f69a0197e11ca9c92d645d", + "0xbeecaf800d2ffe6f0c4f1533186fd199e3e1ce64299dd1da573a83042584", + "0xef5c43e5e193ce8e58f075b66b110be63e103512d899ea4d688d3def4298", + "0xa634db5bd065cb9c61a9585007dfa9460cfdf81a68556bbdb570e9dc5e12", + "0x6d52435892bd562aab9907bf9a0852519d58de9ea1f6a80ab36967cc3df3", + "0xffb817f2b9ffc2556ed7ce53769871ae5231bece643887d1d72e0975cd7b", + "0xe2719dfeff7498635d656471d31bbd8f9a8c3a52a31439f60aac02a8db4c", + "0x81699e433ab8e3f0beaf5c2d12937880a55269f65f1cfa3b3f78f736397a", + "0xdce0b88ed0c3a6c7b082a34b9e7fa587fcc929a80a75e9d0d3c174a536cf", + "0x1c62fbff847e34a142517d97b7ec1a2269eb6baee5a43e790217e6df2dc9", + "0x7cabe29caee2894dd11a11d6f8e4247818ead270f621364c9e325ca4073b", + "0xfaa8c3aa060994432c6a22b19eb7198bdcae0d552f008a181f12cfa74e4b", + "0x80952000595595d0dfbb7f73d3b0a187b08166f1a2cf68b1164e0c8e5e3c", + "0x09facc01f688a71991c6e1667e0705c2293c438a8a6d8ed50070468d0ad9", + "0x48a5c877a45cb0caa18d2191898e45e14897aa4c6beea033102d2d97cb7e", + "0x193e74acc2e5a38fed235708b6b05d3c4e3fd3e01a8918a82ebb415f11ca", + "0xb79e2b86ca4b98ba3519d38053946568f7272f51b5de5944b98758489663", + "0x8a672a55b77f1b040ecec42c4b585073edd639c6f05792e774c53c2470a1", + "0xafbd33890be02e5b3ec19387041357ce44b8057c61e6bcad2a6158030cbf", + "0x0d587d96f28131007db3b99b69988290aef12b3edff6d30ab9b7ebf28ed1", + "0x868c48063db74db058b73768c2f0a37a9bb5e216c41b124d2fdd3e733370", + "0x7bf1f4b688b62e6841cf5d0c71ceb6cbfe98e672e1bcbd21b440eb75f3b5", + "0x20d37542305e437d210aa24a1d9b3baa31be41312cc2c42fcd99362b8d51", + "0xe4a2c692b278da8cb350edeeabb00662d053f0e1ba36c9de2f3434e7e4c0", + "0x619953798820ed0619bca35f9071fb5f0b5a719243ed499a1404bfedbafa", + "0x402eb468b4cd4e7d88c0e3ba8d676f4f26bb8432ebfe0734db748c30f4a6", + "0xc008a9ff47307cf4ab7eac3b66b0022323313a82e8deea14ea81407a16f4", + "0xd2eef5b4b89c6d15b81372100696445402ba15cb6f656c66fdd797883caa", + "0x7b9db13a5177aa163a627f56f234f6246d4462ab7b1c3c13b895bb01a770", + "0x5b31472ae74f1a202e690a0e8ae307e179c6674692f1a966c2bb2dd4be4f", + "0xfc50e5b54e9083e7208e93d0479059b0de1ab0ac8b6302592037c03a13d6", + "0x333548598a9d7ef8f61888787b7b688ba92013c1f52a6fc49fcb475c0d55", + "0x575405ff3d2227f223765d8ad1cf3211848ff5951299d9e98bf485dc6206", + "0x7b8a62d84d8900066dbb781b3550aa7214d5f7cc699c5340d0ff219a2edb", + "0x417e43aab81208f73be4e89f1142373c88454c5c59c1244fcc65b1fd2900", + "0xfbc4c6055223bde2f33db79b70e6a57588dac20f8fe60c3b396c1d353c0a", + "0x1c0ba337c8ddeae452274d5804399914239dea9f9a9dbdd00febf080ec33", + "0x3ccabf4a959c19b80a6e0821139530bf8be9abddc5176d8b434ce12b1195", + "0x9bee408d6d12476c08ce29689c7cacc787fb1ab35a8d1c46ae56dca43c63", + "0x3be5ea0534402d0b3749186fe18710b71fa66deb921655f385b2b76ba272", + "0xae20526245e659a693b43b4678cdad22aea60cc82a4e54346e88c8d7235d", + "0x23a34d170e22b9debc161d2fc7a6e0872f1c8abdb963199861a12140ce86", + "0x8265bba50bfdd0096acef797bccd946a5e12c91706b3538f63e0e22e2f04", + "0x9b0696ef8c30dfc3b74729cb55dc318ff817da5e987d5e1e9f45c897334f", + "0xa146c205cead90e11c781b6709aa1a83c595753f813a23a316fc51e168a3", + "0x901bbc1e0760f380148684fa98be2dd441dd3867ff20041c62c0543bfc72", + "0x4800ac1d76c16f9a028c46378e7ee3c614b3a32e0d4329c0fd4650fb9776", + "0x41bf73b91a488f40a4527c9b34b1a5b4c2cf4a47c7bdb99ae0513107e5f6", + "0x9ddb5ebf573bf9e8abe20dcb2a83b7540ab9b36a586109eb336a2c9f90ec", + "0xd2ee2f6e144a380a2bfbd057a030358f3bb62149aa00e52f77ab78769b36", + "0x57aa689f52cd81449ba3dfa96f6469c4909430cd2af29292944e64e30f88", + "0xaa6f39c29ffd81e05ec4cca30bdf4911b229c18cdf5396088b572fc65517", + "0xbe4fd9059865337f571bf42eeaacfae45fde730aba49990737222eee14c8", + "0xe7ae825fa2d4dcf8194a7dd1ca400196b864ad7d0b6f2d4edcbc0e158926", + "0x94186a517c7fe75b0b5a8e0032e689bfad33b45107c411489a5640191203", + "0x4092e41489abb831a562ac0848ceb24552cd1bfe1c7a72184c96ec6b3172", + "0x8f030c676d6a0e3ee549c8fa59f743e442b7bfab342c8ee5cf714735cd53", + "0xc6c1c0857cf96834c99ca4ba143cc34f45996cc6207c539f5960dd339808", + "0xf56025aeeaa355ad01867e023f63b81d60f0212bb1f3dc3d8e164d4b0b30", + "0x6cfb7f62db8497dbaae62d78a571988df559f5c956a7256c31ba4c787381", + "0xa5dcf612047fdfcf53df8ccaba13a690a1809e2ea52f4b8c8f8d8b64e485", + "0x5766edf48bf213b32db19dba236f31d808e3af0a477beee840382d895f32", + "0x08b2d5825b246e7ba3a6032efe10e2c071224d0ab9ac3b4e812c41c3cb02", + "0x4f833f32b2c98b087dd7efc367a4259fdebcbfc7f896dcc341dbf8ef4c3f", + "0x9fd90d3995d1311baffe82119fbd3c6b072d72d06357d79a7aea2942823f", + "0x171a0438b00f6c66c35875cd6e5d969dc220d43650d494794b2fb851934c", + "0xd8872c216a7afc05523ea3df5e9161a08e31dfc783b88c4757432d6979b4", + "0x716fa38c0c8bf8bb770bef0425879bedc85e71a4a0060ae9fee53ce056ae", + "0xfb20ded6e282a3458e39e1ef4e854e5e98b2d312b4311f239290579f4a21", + "0xf44bbb456c5d7e0ce53cb4072995495b30098f09adb826e3b4bf008a7a2c", + "0xbb5e5819a31aff10b9bdf4657adc880bb28be6637a2a383a110e04b12b0b", + "0x5db54ed78e6b5ac696c06fd32e20915ddfa34ef710f0ca676de246ac9b5d", + "0xaec00ad6a8a15dafb9162e45ce5671192b6ba263d2473c29471fc41d5688", + "0xe6912c06f608a6b59bfa3687db8bfc6b3ebb0f0c210af0edfdd076fcdad7", + "0x346574d48ff84ef917eea3ef0c35f0fd175ab357aecc137b6eb93bb7d137", + "0x99447f7b520ae8c0364683c573f6ceed0fd03f996fc2f50face81c25005e", + "0xd1015b1f6f567e77c1dbed19d6142cda1f43ca2fddd27ee4fbc4099f7889", + "0xfd4dd4a715ccacec366eb726712b13b4c63fc4bc5b680f0d4bb4cbd2b14e", + "0x311310101b82b0974c1f3187a832f824facc694c748f24344853c3103ec7", + "0x4f0ee0c57a276a8de449f1a4f5bcf2bf9a3ec762bb1d0d8e683c5001c263", + "0xc1d244cd70dc3b57d687959de2488bbb7d5e6b39f1a28f76b7c79b1be4e1", + "0x100156074b45d8fc8b52609cc55668c8cc6dd5d29216b30db8424607aa14", + "0x9a85c5785bbf2553d0e2ff3afa5d62a8a0f11fdfeb178904cab9e74e5005", + "0x188f3e410d30e9d7d7bbe43fa7e23229d2b940d8738c5c91dedb31d50dac", + "0x9233ee5b2c7e68e4daea6801ae63b8b712c09a89420979a7e09e73bced96", + "0xaf21dc23fcf60987580fc4fd6fbb001187a4c0b412dee508e7a22c1e5cb9", + "0x70f4678a9ab871651a6aa284f5a67fc96ae5785859150095f8b9b99ba609", + "0x05e7026992216129a5139225159a80b5df5ad2260bf8ec41fc2854dcf0e6", + "0x61b94b2450f493433b8ef48369ef44a6f09cbeb6004f3394e6feb78f31d4", + "0x46925e3d606356234071aed18288bb8093fc2a24adfcc000c5f5c8e211b0", + "0xd3d12c9435bbfbf8836295b64a48f3842875f638d9e45eb98eb338f2930d", + "0x862faafabd0ced62bc23df0f4baead2d203a7da304318e7d20e5711ff510", + "0xb3cf9259b4ba0ce4f61079c4fcad520d8275382e03af0706039ecd2e3c7e", + "0xf4fa6b0d6f0f8b9dfe1b211f432ba02435601ebc05b74e1f6ad80cfd0b6a", + "0xeaa8f39ade3eba5d19334a6eb6129d40bfb9464e5e53055a8dfcd1c4cfd1", + "0x406807f94bd1379e7b9235bab722b813273de5ac9b050eca4a0801bc9a44", + "0xb3431505e374e975f6bc7cc0fbce4dda2fa85db8262f7e76964b43872e20", + "0x0e5812d9e14940e45e0e4cf1795772b745ef31ef7a7f1d521de01207f71e", + "0xd95ec77000ae74d0a062c863b895e8654aadd2de0980a21e4ddc3db5a1b9", + "0x0b3cf0a0d2fe95f8ba734a5dd24ae793877523ca8f10221d5c9f1f48e35a", + "0x875ae6b482bce0640212a8f68e3434faa87f8eaf746d85088e4b716d996f", + "0x274aa448d819ccc38f1bc96bcbf374121e34348af66d638f0d50997b8285", + "0x71d69506567c522aaabbf9a6f469942731bebe6de3be1dac3ee89deedc7f", + "0x1fdb60fde10ae8a4ed1a0cf37b99e48dcc0bf0bbf7416c481b607f00ac61", + "0x55db6c4607c316c8d132ef969dfe8165a30790f79e130ec37b5fc9b1808c", + "0x35455d189842eaf7f7b2911e6f572b7b371c626bf9e74c5bd77d2d04e6c4", + "0x21f12468f70aaf587779a699a3de6a7cdd64dfcb7de1d283e0f2a65e2fb6", + "0xfc30b5eb9b5d8441cdf185b1eea1ff73545d68475aab4b2d6d8c702f00ec", + "0xa01a1d6c969522dc2896a648fe21cee3e1c9e60741279bcc6d134ef2287f", + "0xaa276fb44e9744218765e52243d40ea3a0d152955e45e9845dd64f920617", + "0xf5b3307f9e5b6e84584bb08e10578b7863723aa459141e89561faaa27a0d", + "0x4305f32e590db7e4bd971b9c9f6caa9766372d9af29e8ddb0e8459b3ef13", + "0x593a7e445d7c2ac1c5dce86fc4c7e9fb8507fe9f6aca71f89f0518b8cc36", + "0x53794cadaecdf2764696ff0b3a1bf8a0b23cee0500917572ad10cc928982", + "0xac7bf6417f61d8f2f064437a6421c1c9f6db804296302fe999bb89d3f0ca", + "0x11a163748276b995778d5ae543ccaab16429a37a2f768760640a286e2258", + "0x643660ea7a3e58e22a60ef1518d8b8759a0bfe2560f3dee3c1e20dec3e9b", + "0xc3635e53e69322d39d2343eec244218f040ea597e0573faa9eed8b020988", + "0x9186e1aa3328c129dbedc0eaa278dc4a5bd5356726445661ea8dbc3f49c6", + "0x2605a9c8d0b7071029e27eed785579fc917cc5266957012cc57bb9f0db58", + "0xe1e5396986c2f31021f638802723dd4f713a68ef8382edb685105b0f022e", + "0xf8fa1682f4262d24534c1db959059f38f6142540b5bc7a6e64ff6faf7c87", + "0x9db108176c30a923b68dfbde0c770955f37e2aa4ebacb03772e4b56898fc", + "0xd4da1a1ca07b57b7e54780d08a5bd18982bc41879006c31bf0223625afde", + "0x5caeda52a134342f5a90cc0c6e680fd34e572a5b720bf9cd3e0fbc0b80a8", + "0x18355cf9b8e63d1978140fc125a25ac1b34887004f9d5fb5a654e470a999", + "0x184a2f4037872b74a34c7d1f864d42a39002c5fced52c731c8c4d3e5bde9", + "0x642b9d6db7a9e267b07e064b1b20fecb6deb709e411b673cfb5a6400be09", + "0xe85672937b377a81b65c478452c55abbb01e5d1c725faee4d8b814fe4528", + "0x35defe8a603c5769519a1347854c45fceff832380303123a099ac054420a", + "0x270df35174c740eb0a5b5d0c980b76fc24185d2dfaeea8f8362dff9465cc", + "0x9815aff17e45768a242c4dae189aecb31527dbaa04372bd1c22b2379ec2b", + "0x1f8cc33bbe4b94c73caee00f8c7669dc491c4e9c7580adf4cef6df4e3ce2", + "0xc1a5069c23f96ec32a7b2f83fadc756a843962f8e6d42e5e737e5f6815d1", + "0xa8e88a0985c2207216f9bbca25072aa3b43e69fc05fc3d4037434f63653c", + "0x2211ff7ec1b9dacdfc5f308cb19ae6ab67c387ea4b76cea3d42f26109a78", + "0x30a871bfe320546840ee9eddb173d298ba31bd492ecc853ef9f9ccd5dfdc", + "0xfb2c665084874dc50319907a830dd92ba4074491b7f7bdf2294d69ca8b3b", + "0x9746b1222e878bc2af3a28429e8f9d01cb41fa4e351a834dc98601e9e29e", + "0xd97b92ac7f784a31478f65595832d4084afbe386c2354af190ecbf1603e3", + "0xf5600a009c82a608ee7379f0fd64e7a07e5325cec11c912dab8ca492b941", + "0x92a82c7623648ad14f1d5fe37986babad5606a6c8361e6cd1b0e55d7a7c4", + "0x2a1932bbc730a6c46fd332eb224a484215712ff56e38577fd9242551c77b", + "0x6571de70db48be07147051fd393bd54dcb470b36f702219368c739ce457b", + "0x37f4c70f9e06c48a3857bc3fb93bfdee9862fc16f59aa7fe4aa99f932277", + "0x65ac16dcc5b583847991afbd5729bc3457b4ec5e043a211605dace2ce24b", + "0xb209dd04f14d49572e21e156cf676cd62405613893ba77c0e9c1463c23db", + "0xb27280d76c8729bd00137ffcf23194b7012cd612850fde9298f9e807c928", + "0xe67e663c4ac99a121e96bc25f4fa9d77ebdba68d143c5bff1ec8391a6897", + "0x2d9d0dd326de87a4a3828aa0129bd9364facdb1de05193f552074775767d", + "0xe67bd067530e3f67a2096c7ada61cfbf5b8070a21c23552c9f590706436c", + "0x3d6f263ecfe71f9b1d861976b6b0c903319f55656098f06c45baaef9039f", + "0xd8f90a6226480f546837737382b808209a27e74324949d5fb4cb75d94f53", + "0x616a15f11064f7e5fe8ae9c1301bdc9c28ecf4ad4be837668c83c1346b50", + "0x7956b78e3b701c7a748dfe8e17086565ccfe1bcb7a26e7a90c57a11030cc", + "0x2482ba51765e17a4249e264a638c184a404a2f2f7d3e53d6b1b2c7b92136", + "0xa1562c32e083c3492822186761a14c482deabf50442a208c4a56c7135a73", + "0xd94c9cecb1032d436290657a48d7d629127d148d85d9d502bfa1776516b2", + "0x19e31522b105058d2fd590e69a0d8e6128cc00c803ad8a68cf92df800948", + "0xac3da948628221857e7d717f38424e3e79d2b03ba4edcfc9a126b0209ccd", + "0xd6802fd1dbe8762a9df5244d4efed5835d16337b4983dc7de64f449f0cd2", + "0x40c509fc039c260d7cd6d060b6b2a1dc5ac784b1f86ff68ef1a09f9157e3", + "0x8e7f68b806bac4cadee58e5f6b131fb0e23712602fc421e527450098dec2", + "0x2c4b069db3d7010f9bdbb729521414674146e9bc42a238c1d0c1bfc8128d", + "0xd32ea08244f609afc4e6fcafabde40d2b7a041850c4c865e44a89e6b14ab", + "0xd1fd89239d2f73fa7190f49a2697c03be15d6958613585c3e1222a76ebb9", + "0x5e0218d65fe34ed02cd85046b31ed5d757423d48f2000ede4d50202ef8f5", + "0xebe77143ea4e8c5cdf6d1784501b47e946e60fb4b1a31c8e20a4442accc9", + "0xda10711173e3cf412e944f07fa1da5c5c1daafbe14f604df5cd7665d996a", + "0xff69b2138ed148012bade3a105757072b9422cc0f50770f9572d9c930b3a", + "0x933dc09c30a6bf2d2adededa3bd1768f37d4ccdc80960116df33b7d00d66", + "0xdd50971edb444d4c7640c0f0240ca4acafa59eae6162781539a56272f39b", + "0x71f183c20d33515bf4e017e2f44daeac0f2248066c1340dad19046ee20e9", + "0xe1680927352db754da0b4ed86f5292715d12b05d54bbed25c3ceaedc2131", + "0x9596d7c2b75d49b67f5eb74893055c88890e149014d392badc8cb01718b5", + "0xe6574ffb815d5f40941794a61ade5e86385125316bd173190b3a1838f3aa", + "0x82004729be699b57ea3d57bd912ed959e06c8a59f251c261dacf7a5cc3ac", + "0x18c5243fa18211a234934d3e14b68223d6277044688db929e85972d5dc22", + "0x43a48e6cffef1633b7a00b2b00caf5b15365137d006a3c2e7d3f2cc17b82", + "0x51b8e7c0228f5e85f987c2b90d4dbc008189dbaf4333d3f9ed5df5878bab", + "0xc5d5252e69635bfca1a20a333329324097955d11d94ac43713565650d730", + "0xec57fab90082eb51ccb76800e548862e88e989d1282582fb93a879271629", + "0x83b1a980c2b02fa01558a598f5dc4c2d490fb3d1b79e61fa10a79881d0eb", + "0xcedd6dd8a7a6ab6ec5b8a8562d5633ce65169dcbba1064b3e36c9e299532", + "0x581336421c7fffd7fa63653eaf6d4c4bf0cb0de6817637a1b33906006135", + "0xc8da93eedf4e59f9e664b08dc4524e4623dceee7337983fdf3c484dca98b", + "0xc393399782224aa3e9ae38027fb75e9c38d0ad520fae18944e166a5b4aa9", + "0x76212fdd7c619f7ac17436e07e681df08e7b0e7e4c9f49352e25e209a6db", + "0xcf832edbcd625d8c3f42e2e1e4220e8de5f564cab183bce33939db5f2ee6", + "0xe9fff26d7be3db82ffbde885513eea686ac8ee50a90d976156abc0193b20", + "0x7af321a96be6499f93c254005cf3ac2e580f9254e49727c17c08bf78210d", + "0x0b16fce518f708086872804362d703c38eace47a8328e60e88867e63bf56", + "0x402d57aa170770e74f2fd040138fa687a033152c209b2d85df661b67407e", + "0xe66610a109de20bacd0f41a8ae3005d8ead82ede4ddc3d122865d8168495", + "0xc98cc35c72ee79f1bfc69669d1c6ff8e64722da5065d4c71182787fef691", + "0x9bebed05e5044bcd13e400fef5177d66aca5ed7fb052dfb6a9db1b7c27eb", + "0x9ec253f7c00a33f4e08b4f9f425236749073830b308174670101948f9be9", + "0x546a86e4889ee5829cf5cad3ce05cc4ea3f94325ef43263a511e8a8e0abe", + "0x4a94531433d477417773766ba16e18dd9987a8ac21431f7b5ba21cb675f5", + "0xbb7f49dcb94e1919dcca9992208846eea4ffbb4b61e49cee5040cc7814ea", + "0x0c173681d790dd6b08c7cbe1700819d4485905456819093ae59f21caecad", + "0x45acdc06fa62b95da190162f6e03375eee33a27a46b7d9d7ab66adf1589f", + "0x9f419140b406e407f0a1bf1aef327df122bd262e54693da630aee31adaf8", + "0xee82a9c28379d35dbd3584f0a536877394c62a0f88997fd023c022070ce2", + "0x5922df65bca3ee20b6053683e04cca48c2f965ba540b3c5e120dd339b697", + "0x1d82c9a215626412db5faa9c7c1ce8a6272942f9abfec61b28b05fd9f374", + "0xcaab9cefc1bc4879769f2fe30877903b852386131c068b2a3e2d3875971c", + "0xe26e38053ebd56a6185279fe46928db56612edc1ba37f967fecb281bbd0c", + "0xc9c46a97f965244bf76ce7588e4260b16f044435346704ddde2758ae8051", + "0xc1dbb04b773054df56473c183bdfb42f4cfe2cc23721a95a9754522fb5d3", + "0x22653cab939465b3b33d11d56492b43139c0987416ee79a643bd8659457b", + "0x80ec896c27de703b07f7c9f8250f9d612a536a910b88b2cd922eaa1ca946", + "0xc7660b3be0d38d984de27a6c315a244b08a00f63846a4c66fb533ef7ec46", + "0x377f4439b0cc4ab7795da5b9c55cdedf3f70d0c8d4b348eb15013193c343", + "0xc2c0605c57aa3e26ce5d7b08ed55a606648b66d66dd0664cbfc5c3ed3cc3", + "0xb0beb7d0c625913c14c17731f2dd1baa2338f58d74715592dfd7f1481e1d", + "0x4095250c338cb6642ea7159e960f494a20c1ef49e93b9f83867151bf36af", + "0x6bce77e261b99ec11a7520e05919eb0532e0bc55733b2b09dbf6916c3f3c", + "0x8956920960705298de8b8f959e7b260ad709a3e448d841b1846bdd74c9e6", + "0xe6fa0c9d2f7161b47937edc564f75fc245e260d79d0c40002dcc466cee36", + "0x67cd361e6ca832b88b3e04b352b5f8968b8ab9d9c531a8a0064d54bf677f", + "0xa6a07d197405b2714ca3a3b89e66fce37e5a62167089c2e79688e9359a1d" + ] +} diff --git a/test/fixtures/erasure/full/ec-3.json b/test/fixtures/erasure/full/ec-3.json new file mode 100644 index 00000000..4b75ab29 --- /dev/null +++ b/test/fixtures/erasure/full/ec-3.json @@ -0,0 +1,1028 @@ +{ + "data": "0x615d17", + "shards": [ + "0x615d", + "0x1700", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x4f05", + "0xfd71", + "0x791c", + "0xa845", + "0xcc56", + "0xbd09", + "0x2bbd", + "0x9365", + "0x7c27", + "0x1496", + "0xe772", + "0x3556", + "0x566b", + "0x557f", + "0xa900", + "0x32e4", + "0x2295", + "0x9ff0", + "0x1dbb", + "0xbfff", + "0xf05d", + "0x4ced", + "0xe1ab", + "0xd8d0", + "0x6149", + "0xec27", + "0x4b15", + "0xbe94", + "0x83ad", + "0x4782", + "0x858e", + "0x2320", + "0x8a8f", + "0xc96c", + "0xdbde", + "0xd288", + "0x4afc", + "0x7d06", + "0x386f", + "0xf107", + "0xda50", + "0xe528", + "0x2b9d", + "0xbc55", + "0xb076", + "0x6598", + "0x5c40", + "0x2ae3", + "0x3384", + "0x93a8", + "0xdf23", + "0x08fe", + "0x52b2", + "0x48ca", + "0xe5aa", + "0x25dc", + "0x5ea0", + "0x2c14", + "0xc7d6", + "0xc125", + "0x2cb4", + "0xefa7", + "0x9903", + "0x79d9", + "0x7097", + "0xe2ad", + "0x70a0", + "0x7574", + "0x85ce", + "0x37f1", + "0x9a4d", + "0x2c91", + "0xcc3f", + "0x5cc5", + "0x625e", + "0xe12d", + "0x3e38", + "0x6b64", + "0xa3b4", + "0x26b7", + "0xd48d", + "0xaa7b", + "0xd289", + "0x2ee1", + "0xf258", + "0xb3d0", + "0xb27a", + "0xd870", + "0xea0f", + "0x8097", + "0x2730", + "0x8c64", + "0x9c17", + "0x338f", + "0xc933", + "0x7277", + "0xa398", + "0x2b3b", + "0x91de", + "0x507e", + "0x3032", + "0xda2d", + "0x2435", + "0x0601", + "0x6137", + "0x3860", + "0x78d6", + "0xef53", + "0x6405", + "0x837c", + "0x4b2c", + "0xd70c", + "0x8a5c", + "0x9a47", + "0x5c64", + "0x6b55", + "0x847c", + "0xb0ee", + "0x096b", + "0xc93a", + "0x4071", + "0x27ab", + "0xf5ac", + "0xc7e2", + "0x5909", + "0x1277", + "0xa0a7", + "0x50e0", + "0xe0c0", + "0x3755", + "0xaae7", + "0x64aa", + "0x4507", + "0x51f3", + "0xf1ee", + "0xb7db", + "0xbd55", + "0xe664", + "0x75a8", + "0x72ea", + "0x744e", + "0xe6c4", + "0x70e3", + "0xb94f", + "0x920a", + "0x176f", + "0x0949", + "0x6137", + "0x60ff", + "0xf7a2", + "0xb812", + "0xea60", + "0xbdf0", + "0xa294", + "0x9549", + "0x1792", + "0x9148", + "0x2f26", + "0xe509", + "0x7b18", + "0x7157", + "0x6bb8", + "0xc432", + "0xe6d6", + "0xbe88", + "0xa8e8", + "0xf398", + "0xf33e", + "0x16f3", + "0xd40d", + "0x6459", + "0x96e7", + "0x5cd9", + "0x43a2", + "0x52c5", + "0x77af", + "0xbe72", + "0xe8b6", + "0xaa29", + "0x7fdf", + "0x87e8", + "0xe2db", + "0x3e13", + "0x5e6f", + "0x7833", + "0x2c6f", + "0x04d6", + "0xe254", + "0x89fe", + "0x0971", + "0x400c", + "0x32b9", + "0xb0fa", + "0xfbce", + "0xc06a", + "0xd1d4", + "0x5e1e", + "0x14dd", + "0xa049", + "0x0c6c", + "0x4b6d", + "0xa01b", + "0x64eb", + "0x647f", + "0x7e42", + "0xa04c", + "0xef28", + "0xba5f", + "0x4aaf", + "0x4e74", + "0x9665", + "0x1bdd", + "0x416b", + "0xfc9f", + "0x1d75", + "0x5c09", + "0xa1ca", + "0x4383", + "0xb3c8", + "0xb19e", + "0xfce2", + "0x28c7", + "0x30c2", + "0xfc93", + "0xdc95", + "0xa3e2", + "0xcdcf", + "0x6aac", + "0xff6d", + "0x80e0", + "0x6393", + "0xe971", + "0x6898", + "0x5034", + "0xb6da", + "0x1ecd", + "0x5942", + "0x5b8a", + "0xb24a", + "0xcf38", + "0xd887", + "0x8b1a", + "0x9026", + "0x9a87", + "0xc5e2", + "0x436b", + "0xef67", + "0xbee4", + "0x3d89", + "0x5531", + "0xa7da", + "0x0857", + "0xfc85", + "0x6731", + "0xcb41", + "0x8653", + "0x056d", + "0xf88e", + "0x65d2", + "0x3462", + "0x13db", + "0xe031", + "0xe627", + "0x876c", + "0x28d1", + "0xeba8", + "0x16d6", + "0xbec9", + "0xc856", + "0x6525", + "0xed0b", + "0x8be5", + "0xf80c", + "0xf909", + "0xcadf", + "0xa110", + "0x5fde", + "0xd05d", + "0xa0a0", + "0x8921", + "0xa8a6", + "0x53ea", + "0xa1cd", + "0xb928", + "0x6113", + "0x9429", + "0xc824", + "0x7b03", + "0xb598", + "0xc6c7", + "0x712e", + "0x6413", + "0x11f9", + "0x66b2", + "0x5058", + "0x9f9c", + "0x9a4f", + "0xbb23", + "0x424d", + "0xd3e5", + "0xbd56", + "0xefd9", + "0xe874", + "0xd57e", + "0x1b85", + "0x70ee", + "0x8fdf", + "0x1722", + "0xc577", + "0xf87a", + "0x308c", + "0xe5d5", + "0x79c3", + "0x20c6", + "0xffe5", + "0xa9fe", + "0xfb05", + "0x6f8d", + "0xe6db", + "0x8273", + "0x9ca6", + "0xbac2", + "0x0a24", + "0x2144", + "0xd2ad", + "0xef75", + "0x4b7f", + "0x6698", + "0x3b8b", + "0x5e5d", + "0x5a61", + "0xb02d", + "0x75ca", + "0xaf0a", + "0x5b80", + "0x50b3", + "0x563a", + "0xaff5", + "0x4d05", + "0x4f17", + "0xe207", + "0x5428", + "0xfbe1", + "0x19f6", + "0x7354", + "0x01f6", + "0x41b1", + "0x9d5a", + "0xba3d", + "0xa27f", + "0x16ea", + "0x7dba", + "0x5aa6", + "0xb0e1", + "0x05c0", + "0x9227", + "0x19ac", + "0xe23e", + "0x918b", + "0x83e1", + "0xc5b9", + "0xa447", + "0xe6d5", + "0xd109", + "0x0ea3", + "0x95d7", + "0x811c", + "0xe74c", + "0x3f85", + "0xd5b3", + "0xd2ac", + "0x240d", + "0xfae5", + "0x6978", + "0x6fc3", + "0x998a", + "0x0a94", + "0x3479", + "0xf2c3", + "0x6b80", + "0x9ef8", + "0x45fb", + "0xd78f", + "0x9d9b", + "0x43a1", + "0x7643", + "0xba79", + "0xfe93", + "0x3e7e", + "0x6315", + "0x2c33", + "0x33a6", + "0xf778", + "0x6e1b", + "0x9668", + "0x01b9", + "0xdd02", + "0xe373", + "0x9bad", + "0x124d", + "0x9cc1", + "0x0414", + "0xa2d7", + "0x9b55", + "0xefc1", + "0x26e6", + "0x7805", + "0xa648", + "0x40dd", + "0x1700", + "0x8dee", + "0x9d82", + "0xed35", + "0xd9d5", + "0x22ff", + "0x8a0c", + "0x89f3", + "0xdc5d", + "0xf98f", + "0xaad8", + "0x03e3", + "0x84a0", + "0x8e6c", + "0xe361", + "0x0ecf", + "0xb9c3", + "0x0e1f", + "0x2f51", + "0x9c0d", + "0x06b8", + "0x95e1", + "0x3d0e", + "0x6146", + "0xedb1", + "0xe5ba", + "0x6b57", + "0x6a66", + "0xf76f", + "0x5374", + "0x0319", + "0x30c5", + "0x50a8", + "0x8d87", + "0xb57a", + "0xf954", + "0x74f6", + "0x2230", + "0x8914", + "0xee34", + "0x88e3", + "0x93a2", + "0x31f6", + "0xf4dd", + "0x81e0", + "0xda89", + "0x5e38", + "0x5eed", + "0x4c9c", + "0x4ea7", + "0x9cb6", + "0x03fa", + "0xa31f", + "0x14f2", + "0x95c4", + "0x5362", + "0x6fc2", + "0x0426", + "0x56af", + "0x1a82", + "0x978c", + "0x90e7", + "0x59ee", + "0x4ef0", + "0xa026", + "0xbfcd", + "0x446b", + "0xaf3b", + "0x7e17", + "0x576a", + "0x0a6a", + "0xf499", + "0x1295", + "0x758c", + "0x6559", + "0x56e6", + "0x86d9", + "0xe7a2", + "0x0b75", + "0x5953", + "0x1e93", + "0xbc92", + "0x9a65", + "0xf9ee", + "0x9305", + "0x5950", + "0x1cda", + "0x8f8c", + "0x029f", + "0xd557", + "0x3477", + "0x27f4", + "0xee60", + "0xcb23", + "0xd0f2", + "0x87d5", + "0xa9e0", + "0x3f59", + "0xb38d", + "0x0f5d", + "0xdb9e", + "0x8b2a", + "0xc4af", + "0x5930", + "0x3d98", + "0x38e0", + "0x61e5", + "0x24a5", + "0xb02d", + "0x260f", + "0x7014", + "0x30a9", + "0x43f6", + "0x2862", + "0xe7a6", + "0xcc59", + "0xd964", + "0xe6e3", + "0x91a8", + "0x42ba", + "0xda47", + "0xb5ef", + "0x88e2", + "0x3bf6", + "0x509d", + "0x9218", + "0x4741", + "0x981b", + "0xca94", + "0x04cb", + "0x9563", + "0xe4ef", + "0xd9e5", + "0x6a4b", + "0x4b27", + "0x9114", + "0xbcf3", + "0x2916", + "0x0f72", + "0x01bd", + "0x3c65", + "0x1470", + "0x3f10", + "0x6d9a", + "0x1f38", + "0x9d7e", + "0xf62e", + "0x1f87", + "0xc36c", + "0x58e3", + "0x40a1", + "0x36e4", + "0xdca8", + "0x86c1", + "0x5c01", + "0xffbc", + "0x9a6a", + "0x35fa", + "0x3ec9", + "0x077b", + "0xb154", + "0xdb29", + "0xd93b", + "0x207d", + "0xc26a", + "0xff40", + "0x068f", + "0x4159", + "0xec2a", + "0x62f6", + "0xcae9", + "0x4be9", + "0x2d07", + "0x24b1", + "0xe7c8", + "0x4532", + "0x2efd", + "0xa0e4", + "0x2f67", + "0x167f", + "0x177a", + "0xf82d", + "0xd1ac", + "0xd020", + "0x2dc3", + "0x25d6", + "0x449d", + "0x5cef", + "0x0d5f", + "0x0d0d", + "0xfee7", + "0xadb1", + "0x1e96", + "0x3e24", + "0xc568", + "0xe235", + "0x170f", + "0x0428", + "0x1ccd", + "0x5f5f", + "0xccc2", + "0x2065", + "0xd6c4", + "0xc641", + "0x3008", + "0x77a1", + "0x9d97", + "0x50d7", + "0x670b", + "0x5cc2", + "0xc7b6", + "0x1cf7", + "0x7d09", + "0xa247", + "0xc417", + "0x6ccc", + "0x5221", + "0xb69a", + "0xfc8e", + "0x0b21", + "0x9262", + "0x0268", + "0xd96b", + "0xefdd", + "0xfdb7", + "0xc796", + "0x2dd1", + "0x099c", + "0xf20e", + "0xcd6d", + "0x5a8a", + "0xe901", + "0x0b48", + "0x378f", + "0xfbde", + "0x49dd", + "0x4b8b", + "0xdbd0", + "0x0ff5", + "0xc446", + "0x6863", + "0x1455", + "0x5f61", + "0x5a8a", + "0x1049", + "0x2fdc", + "0x3e62", + "0xb95b", + "0x04af", + "0xbddb", + "0x3063", + "0x5929", + "0x1855", + "0x6644", + "0x629f", + "0x99c4", + "0x9950", + "0xc53e", + "0x1b30", + "0x4478", + "0xaf0e", + "0xc9eb", + "0x9c9c", + "0xa5e6", + "0xbf09", + "0x5fd2", + "0x5f74", + "0xe315", + "0xc1f1", + "0xb4c0", + "0xa2a0", + "0x57df" + ] +} diff --git a/test/fixtures/erasure/full/ec-32.json b/test/fixtures/erasure/full/ec-32.json new file mode 100644 index 00000000..6e92cf78 --- /dev/null +++ b/test/fixtures/erasure/full/ec-32.json @@ -0,0 +1,1028 @@ +{ + "data": "0x530cfa541c77d585dd8bdf27f1b80538d61106d5470747b3169c19b385864e75", + "shards": [ + "0x530c", + "0xfa54", + "0x1c77", + "0xd585", + "0xdd8b", + "0xdf27", + "0xf1b8", + "0x0538", + "0xd611", + "0x06d5", + "0x4707", + "0x47b3", + "0x169c", + "0x19b3", + "0x8586", + "0x4e75", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x599f", + "0x0962", + "0xf212", + "0x14e0", + "0xa08c", + "0x4402", + "0x437f", + "0x446a", + "0xe7dd", + "0x9afb", + "0xc77f", + "0x86d6", + "0xda6c", + "0xad91", + "0x1b2b", + "0xaa5a", + "0x7438", + "0x11ec", + "0x3331", + "0xa87d", + "0xe181", + "0x673c", + "0xe329", + "0xd717", + "0xbc65", + "0xaafd", + "0x732a", + "0x0b1b", + "0xc92a", + "0x13b7", + "0x8666", + "0xa9e3", + "0x1a94", + "0xbbc6", + "0x39df", + "0xaaa5", + "0x6a4c", + "0x8462", + "0x4112", + "0x9562", + "0xbc4f", + "0x0ce3", + "0x143e", + "0xaf31", + "0x5cac", + "0xc569", + "0x171d", + "0x86da", + "0x39fa", + "0x81f9", + "0x871b", + "0xf006", + "0x5a0b", + "0x01a4", + "0xe702", + "0x40ca", + "0x4c21", + "0x375d", + "0xbb1b", + "0x4a0e", + "0xc987", + "0x092f", + "0xf4e9", + "0xa216", + "0xe933", + "0x3a50", + "0xfc68", + "0xbc99", + "0x760b", + "0xf9d4", + "0xc55c", + "0xc03d", + "0x01ab", + "0xbbb9", + "0xab8d", + "0x6315", + "0x2fff", + "0xd30c", + "0xfd47", + "0x9e50", + "0x5d93", + "0x6032", + "0xb707", + "0xf37a", + "0x8751", + "0x712c", + "0x108e", + "0x2b14", + "0xde92", + "0x359a", + "0x5620", + "0xdcb0", + "0xd1e1", + "0x8606", + "0xc68b", + "0x98b1", + "0xa972", + "0xf682", + "0x8f45", + "0x8d3d", + "0x8227", + "0xc102", + "0xf1ad", + "0x7ff0", + "0x3a73", + "0x45b7", + "0x94c4", + "0xb319", + "0xbe79", + "0x3bf4", + "0x1d0e", + "0x07b1", + "0xcdcb", + "0xd7cd", + "0xd190", + "0xc0c7", + "0x1fba", + "0x5a19", + "0x9783", + "0x879d", + "0x7f52", + "0x664b", + "0x42bc", + "0x971f", + "0x80d5", + "0x5874", + "0x49a0", + "0xf943", + "0xfd47", + "0x2102", + "0xfc92", + "0x4caa", + "0xe421", + "0x35c9", + "0x49c6", + "0x0140", + "0xf1da", + "0x79ac", + "0x2d82", + "0x56bf", + "0x3122", + "0x8a2b", + "0x87db", + "0xb3d5", + "0x210f", + "0x4ad8", + "0xb666", + "0x310b", + "0x2e58", + "0x4dfc", + "0x276d", + "0xeb57", + "0x16b0", + "0x4b23", + "0x025e", + "0x3e72", + "0xa89b", + "0xaa2b", + "0xc5f4", + "0xe2a7", + "0x25d9", + "0xf05b", + "0x68c5", + "0xd507", + "0x71ee", + "0xf42c", + "0xe62b", + "0xef30", + "0x74cd", + "0x548b", + "0x02bb", + "0xda1b", + "0xfe78", + "0x7c81", + "0xf32f", + "0x3da8", + "0x8e89", + "0x94d2", + "0xae16", + "0x6659", + "0xaebd", + "0x4bf9", + "0x82f9", + "0x818b", + "0xaed4", + "0xf1f6", + "0x6265", + "0x3ea2", + "0x94c5", + "0x3830", + "0xf558", + "0x6ecb", + "0xc6a9", + "0xe7b6", + "0xd2f9", + "0xcf76", + "0x87ee", + "0xa95e", + "0xb221", + "0x6f3b", + "0x1666", + "0x1814", + "0x7c2a", + "0xa9e5", + "0xfe59", + "0xd746", + "0x9db4", + "0xf903", + "0x8ee7", + "0x4bf4", + "0x54b7", + "0xf836", + "0x8028", + "0x03e6", + "0x506e", + "0x96ab", + "0x677f", + "0x7644", + "0x1447", + "0x44ab", + "0x4333", + "0x3038", + "0xcf76", + "0xa9ac", + "0xc0d3", + "0xfaf5", + "0x8702", + "0x7be8", + "0x311c", + "0x8666", + "0xf407", + "0x3c44", + "0x2e62", + "0xce06", + "0x385c", + "0x44c8", + "0xdbc3", + "0xb1af", + "0x1c38", + "0x510a", + "0xcffe", + "0x721a", + "0x13ca", + "0xb01b", + "0x23e6", + "0xc5ff", + "0x17ab", + "0x8568", + "0x84ab", + "0x0249", + "0x1ec4", + "0x0bc6", + "0x5d93", + "0x9f8b", + "0x63b0", + "0x018b", + "0x5291", + "0x9740", + "0xa984", + "0x4d1d", + "0x6990", + "0xbe33", + "0x6a6e", + "0x2478", + "0x797f", + "0x057c", + "0x20c3", + "0x0925", + "0xcef2", + "0xd611", + "0x20c6", + "0x59e3", + "0xa84c", + "0x835a", + "0xe306", + "0xa799", + "0x71ce", + "0xc528", + "0x966a", + "0x2488", + "0x4d21", + "0xa5b5", + "0x50e1", + "0x5e51", + "0x5a7b", + "0x2048", + "0xb8ac", + "0x419a", + "0x0dc3", + "0x0cc3", + "0xfd63", + "0x44df", + "0x38d0", + "0xd0fa", + "0x18a9", + "0x67e0", + "0x63dc", + "0x3406", + "0x2fce", + "0x6726", + "0xfc32", + "0xab84", + "0xceee", + "0x7c47", + "0xada8", + "0xec68", + "0xa337", + "0x12ec", + "0x3242", + "0x680a", + "0xba5d", + "0xf622", + "0xa082", + "0xa8ee", + "0xe885", + "0xcc07", + "0x70bd", + "0x9869", + "0x5cc0", + "0x0ae5", + "0xd4b8", + "0x95ec", + "0x8356", + "0xea14", + "0x8228", + "0x5b24", + "0x1861", + "0x9709", + "0xba74", + "0x406b", + "0x4358", + "0xd1cd", + "0x2e19", + "0xdd83", + "0x72a9", + "0x97c8", + "0x96c3", + "0xa4aa", + "0x6bde", + "0x2a3b", + "0xcdac", + "0x9c70", + "0x7882", + "0xc153", + "0x9b39", + "0x1f57", + "0x01e4", + "0x6707", + "0xbe4e", + "0x4c7c", + "0x4670", + "0x4d9e", + "0x3acb", + "0xd31d", + "0xcf22", + "0x291d", + "0x2497", + "0x9f46", + "0x1056", + "0x3cdc", + "0x9779", + "0x6176", + "0x2729", + "0xae8a", + "0xb910", + "0xae75", + "0xbd3b", + "0x913d", + "0x96fe", + "0xf230", + "0x9ed8", + "0xf362", + "0xb2ad", + "0x7131", + "0x23d1", + "0xfb5c", + "0x1246", + "0x55a2", + "0x1285", + "0xa048", + "0xffe0", + "0xc3db", + "0x8946", + "0x28f5", + "0x48b4", + "0xc1bb", + "0x5fb2", + "0x7b7c", + "0xc683", + "0xeca7", + "0x8981", + "0xe2e8", + "0xacc8", + "0x37ad", + "0xd815", + "0x2bd0", + "0xe5e5", + "0x9b23", + "0x1bc4", + "0x68d0", + "0xa53d", + "0xb2bb", + "0x1741", + "0xc08b", + "0x9245", + "0xb54a", + "0x004d", + "0xf54e", + "0xd0fc", + "0x341f", + "0x4935", + "0x4cb3", + "0xe33d", + "0x19a3", + "0x7d04", + "0x7ae9", + "0x7e76", + "0x84d9", + "0x3d0e", + "0x6e14", + "0x6e45", + "0xda98", + "0x403a", + "0x5f51", + "0xb5fb", + "0xb694", + "0x72fe", + "0x3349", + "0xc4b3", + "0x9626", + "0x6785", + "0xfe6e", + "0xce87", + "0x26e1", + "0x4eba", + "0x063f", + "0xb5b6", + "0xc05d", + "0x2079", + "0xdb31", + "0x137d", + "0x6b1c", + "0x4e79", + "0xffca", + "0x2248", + "0xeed5", + "0x626d", + "0x1e1b", + "0xa7b7", + "0x5d8a", + "0x4768", + "0x46d1", + "0x2c29", + "0xe873", + "0x554f", + "0x9360", + "0x399a", + "0x3645", + "0x6b4c", + "0xe92d", + "0x8847", + "0x7148", + "0xb5c3", + "0x1991", + "0x88d7", + "0xab1a", + "0x9dc8", + "0x3259", + "0x56fe", + "0x87e9", + "0xa23e", + "0xb453", + "0x4c46", + "0x9523", + "0x0120", + "0x5402", + "0xeb4d", + "0xc171", + "0x7892", + "0xe4df", + "0xa59c", + "0x7a31", + "0x91c1", + "0xc8df", + "0x2966", + "0xc14d", + "0x4611", + "0x13f0", + "0xbea6", + "0x3b0b", + "0xe4d0", + "0x8657", + "0xbac0", + "0xa71f", + "0x05a8", + "0x1174", + "0xa5f5", + "0x2e74", + "0x0ce0", + "0x102b", + "0xac83", + "0x4c6b", + "0x93c8", + "0xef6e", + "0x390a", + "0x6e23", + "0x4188", + "0xf729", + "0xbf52", + "0x6803", + "0x7f36", + "0x6420", + "0x0c5d", + "0x8c78", + "0xa8fa", + "0x2bd4", + "0x1bd3", + "0xc5f0", + "0xb8ab", + "0xa4b9", + "0x4019", + "0x0d38", + "0xb9a0", + "0xcf42", + "0x9355", + "0xbbee", + "0x99b4", + "0xccff", + "0x213e", + "0x7ebd", + "0x901f", + "0xe727", + "0x3d0d", + "0x672b", + "0xdd43", + "0x201e", + "0x848c", + "0x4f01", + "0x12b8", + "0xbe59", + "0x88ed", + "0xba16", + "0x8f2a", + "0x73b5", + "0xde2b", + "0x1a5d", + "0x0eef", + "0x8177", + "0xebde", + "0x4af5", + "0xbc02", + "0x7eb4", + "0x9538", + "0x7fe6", + "0xfca1", + "0x35cb", + "0x62ff", + "0xe109", + "0xeb9a", + "0x4799", + "0xd547", + "0xae27", + "0xc7a8", + "0xdbcf", + "0xa572", + "0x75e9", + "0xc1b7", + "0x1f4a", + "0x6e72", + "0x2704", + "0x1d1e", + "0x493e", + "0x74b8", + "0x8fbb", + "0xbada", + "0x910f", + "0x204b", + "0x8322", + "0x2d32", + "0x113f", + "0xe9bd", + "0x8077", + "0xa85e", + "0x3f60", + "0x1af1", + "0x9e7c", + "0xdbde", + "0xf909", + "0x01d5", + "0xb5f9", + "0x3843", + "0x9001", + "0xc484", + "0x08ea", + "0x6254", + "0x26f6", + "0x8297", + "0x625b", + "0xbdd2", + "0xbe96", + "0x0177", + "0xe1f7", + "0x7471", + "0x4cfc", + "0x4a61", + "0xb093", + "0xc61a", + "0xd477", + "0x27c6", + "0xe68b", + "0xef3c", + "0xa7da", + "0x0ef9", + "0x52d1", + "0xc67d", + "0x24d7", + "0xe02f", + "0xd309", + "0xe5ce", + "0x8436", + "0x4139", + "0xb667", + "0x1a6e", + "0x8d46", + "0xb2d3", + "0x6561", + "0x4730", + "0x3789", + "0x78b4", + "0xf880", + "0xa729", + "0x9ed0", + "0x39e9", + "0xb025", + "0x6b46", + "0x2d2d", + "0xa998", + "0xd45a", + "0x7a2d", + "0x75b6", + "0xad17", + "0x8bfc", + "0x80fa", + "0x240e", + "0xe413", + "0x2afe", + "0x7251", + "0xf60e", + "0x61dd", + "0xf276", + "0x2c4d", + "0xe682", + "0x49ad", + "0xbcac", + "0xce9c", + "0x5b36", + "0x97ba", + "0x635d", + "0x883d", + "0xeab4", + "0x8e59", + "0x87d2", + "0x14de", + "0x5157", + "0x98db", + "0x65f5", + "0x0988", + "0xb7f0", + "0x7dc3", + "0x1d63", + "0xcb9d", + "0xe2d5", + "0x40e4", + "0x4d0a", + "0x7631", + "0x3fde", + "0xe300", + "0xbbc6", + "0x8485", + "0xb671", + "0x364c" + ] +} diff --git a/test/fixtures/erasure/full/ec-4096.json b/test/fixtures/erasure/full/ec-4096.json new file mode 100644 index 00000000..0de28848 --- /dev/null +++ b/test/fixtures/erasure/full/ec-4096.json @@ -0,0 +1,1028 @@ +{ + "data": "0x3690240f977a2849b3544c225911fef9dedcd0a6e8f2e24a78d35c33e1da406b98f5e636e428a8a4fffe7270157b9f700f86b10f4b3b96cd14b49cbb1ded46e6a0f1f91c34587a5e512752787a36b5d03934d1b4c58b0bdb49da16e820005e75ed7644ba962bad3734f19c41220e5f79db9f447de6c2ebf59088f3840232f2280da236ee8697fb594238030115a57ba7a57ae9505028b5a5defbaca648911acf992b1215069117fd2aaf76a209d9f2ed97c1315055181e0b3591891d6279922f4dee57c3344773fe991cc23184b007738614cdb78ace8a904bdac5fc59c089103820b8d68297c9b21c114efd428a17dd570333291c84bef92298dc35e31ef8c78532bba7fb5ebe5d3ef3a78a27042f8d8576f84304e60feacc0c9dec510b84cadb5d7a304f3f2770b96cd50eb88e90381f556463df272c4dc90d95db26d1d08616c3688d993a0be52bb68ee3cc8dad67f8b4b5f45b4e78c4f62329a5ad7c844e411b8f3321cd0e32e3c97a29843976e1f3a6354278afa857c3e3edfb4529fb09a54f41ce228462c58e8fee74cb86b67d639e79948710711402b8b6592ee6ca571adc1d0ca5515bf63c7ca9787e1398b3d5322758c0555a74df31ca3259596b6b8f3590cd91f695f16e26d203d2c3366de3393bad50d26fb63caa34c68be4c7d824b418234ea61517989392168c92abc031f31a157957eb16215a45bbce5109ab91a135baec3e0c0bbc3acdd0ad3a615fe4f47c417ed2498f116d34229775b305d243d6c047f6514f9af6abc0ebb9bf50baf938b54f3214177ba25a302abe59e5aa778b72a1d91f24a3bb4d11d7f5713a2c6a6f3a9428ddb8bc28dc411e4a31cf9dbc58d166887b8027d6992b6f8abb50b6c67f7d4c9cfe2e8100440de5b1e38c28db562c4a430cc66a5639a4b9445280441b5fd79c1e0c00a89a0a9b9aa63f6e9a4d4bd1e9c943d6618f1eab6f369f510d9e505da8f3d631b010ad70aa6244058af2a8cb93214227eb76d5953d290e52d5f0b9621bf5785d7a71de9d2c260fc1df54e2b1655ef33afe8df6e30def533b81a2bb258daf4024c154958af8c035e2f3d16233876777be253ec7d028fd4154f158429d9d91c0f0d7b3f6881450b4ceea4f9655631e75a349791ad12f11ec01403569fc3247d6797df748e03f1cc37ec67dd34e3677a418db26c93f5270550503557aec51040d1f4c4f318ec4d708d0de686fa669c122ead35d2bb36a2c84a7a1f9e1a0b73179a51526358a0e3915da60de4b1da07f20bcd43689ef597f21dbbed5c711fd0c06770d28caad03e43a068f336f0f7e4fb80ede3cae11332f307d316e36ef2091320e4210ede94eb0ff571496014bb34ea22c277f8ebb6a986dfa29e0963180f7f3b5e9b89532140242082f9f62c3168391522a68eb62408dfa35e18e87941be3caaee8371607ba602607131a750983caa48a724935fa71f8ac43042d5f3456aa2394faa40e048e638918880998fb755bc8f2a72d5abbfcf9eb0c3fb6158f141bc6381a5e749344a94a6588489d272b03f47e233896abc596557a7885aa9f589d3e38b99d3b326f345cc972fad579d549e3c49df9645deb6e3d150b8730b1ce4863eeb965fd8737e84a2902493d3a7cb28455746391e4cd805ef0a2c1d0aeffda0a3868ed14a772647722859160e4ba13e02959165355778a1bc98cfca3ef0d52101935df6f1403d0246887dbd71cacb01ab7e217f50212486e5495406e88d49389dc81e61bbdf624b6320ab70465b5876f506c00159ce15fd289010b43ddb35032785aa60b323f0b62dfb2772c518e101445a2bac43721d9c7ba950633c2b54ebb8c0e51cd25775cfa8b2e19dcb558640d8f19f93a01c01fc60e3db8997ca8901e82486f7990d2b9b3b79abc4d142d74f270ed992a6a28b73886c62c94bb6938c93716c853ec3f0968d44242fc8ba62b2c736694b8dc35b7cb89fd4a181317e95f1aead6d8fc80d6df0db2989aaa7804700f2f2d709bf600dd6b8b45fb0878a88efe50e37ec7ed71b32126c4aad784ed60cd7d1b2a12b8aaeb81875c17d4b039d47dad514805d18e02916c63b9c4a2155e9df5581bab0877ff85a67d01affaaa7a678bdb4b8bc0d49e79b5f5c02e3ac88ea8a3bb93104b5ab08c8ec908c6fc170930dde23275655f14eb5dfd9ea13952a940a8ac7f61720bbf67f56c11aa9f1d7b529fbcb43d0ed02661624a18a5866286dd16b2e701fdc7dc3d67c7c32bfc7d8bc51ed197cce404a445d391b0f10a7aa9f1cb64befba60136f2c8af77a69f7e95d131e098755e6ea86b004a1d6672349f67d28c65a576c4977275c793ea7362c097b47a879aa93ab48a52cbf12f36be462c4586871574684de7a15f3ae3982144e6b5818d6ea37b4014deea674e2b81c0bcbfd7ab27650b1d2ef235d3e4d33d3e883cddde64ddf8cdacc11e21cb3eab55af7b7562ecde4722c5314ae2dd4da5b891fc3724ae8b2c625a6289a3bfb005dd4df0f2589f61b19dbf20ae80227be9395192f7c26ba4ae71da7c667c9e99362fe88615ccc275afffe6eb31692e7761379b2ee385a8ee055cb886d74b68918645ad45d53832b37eb49036a8d7d2e4e240edceb211c3c6fc04b46aead1887013212ceb263238f4995aa6e695df500d5818b508b1c12fb7e65fa9d4a32b6092c3bf722216c8bee55ba699a90cd763bd7a1fcc60213e3dd49f75969a1a5241f734c46a4cdcc77ec50c1551acb330c908bed3541f5fd396d108bf12922a48bdaa173cdaf8c8bbefc84f6f46331bd0147fbae36c9706e4b27d8d9d18bd84a1bca4fec0b4c15f3e054723d9fc2c60d376fc5f7d8c74813b7b210f66e95b206692fd607ca1b29e3c28c0f61e2fcf27df1c7b847e190733e78c843d66958bcddcb03d0d466512cccadebd247ae5748560b4c43f41e0a1d7202bc068fbb1a60dfd81b418352b83caac2cd3348623f67cb3380f46958ded030c9b8c04a7668bfe0f711519eebe46e51f8deb80b69caf8399019afbcb8207c5cf8f209c9098404f0bbbc47f45af8591c641499e7929d9b78e13fc4c95cf0bea602aa7a0d2300c9e1ad82f790a6d78c010947a7e6eec7b1fb09884bf8e71c0cb8d2b8c8182126417cb111aee8e4bf1dd9ba87e7e0ca29011143a2dda3677b25141563d32298e56f5c09b15b26dad34816ed6506da22673ae6095c82b4a3cc97a72d8d3ef6970404189b848dc0830cb912688c6bddc50527a3cb76d3069befc63952dd82d6e2fde08d0fe18ec7c075393fa7b24ec446899a16586116ee8350e10f272cddeb6847c1b4dbe22a5508acc5bb96cf8b6b6e2eff1c781f69f9083993c684236cacc202a8002e9a7621fcb821005ce8d7470038bb8ea280a38ab7a49f23dbb2d9c1f73c0c1e760de5a5fc222de84aa0db44dafce732e703d84429191f0fde50c28df8c49a01e1ff3ae8ada3a879cfc3fd956e186171ec4588c1ad2639fac8750ed84ab456885cfe2744539af619923edada050d36b7dd3bcddbc7f56fe8bdb8568201626b5d37e281a024c8d77f7c548458fe5c708ceb221b2bfa8a29aa7afa95618c4f5f725eff018a70c63ab10750f2a359300a78a6555408835c851691b7b2756ca3bb8032a8670a78176f03dbc3eecbade8d0a5d1a9982cf4dd7e58af193540456746732601837e3782d2b0dc27bc1b82bc7945552c4a2d5f97c9eb227f462e4ccf6d9aee8e8ddffa54e9c58490e8f76671100b62a10684fa934ad3915ae801d24da907f5ed16444d0860cb032a296a494ab55bf1c0d3274fc49f4193d8c723f10b9e03f2eb23eca6950e8631e1d7ac440dc0e0d6c037bf8f04137d93e401309ee92bfffa6a5d87995e8273beeb3691f3c8820b91fc06a97fc8241aa17fcc899a882414e4f078ec97336e48a32b49189f5a759c7e93eb0cc46d9bd7f90ee8902547a88ebbd5c492c7cc016d1c4653e1d1040e3289a8ae33766754d275aa07fdfdc421c0a6bfc961bb9c2c29cae76bf7ba1f1c1899fac3172675230a9e5ecd14129a19cdb10773936265ca2ca1fccf75696b10a37eff4ee2832ff2fa215ba9ed85b7f80799602b1e8d9455f8050a8a018b667c7d1680b97f54e7c447a13ba91aee5e538f749fadba14ac85d9bf1519e4743fb6bba5c184a0eb8d1193437b0857060671b54f97a0808207d1f06ae8b60ff55957a38fe695a9f6cf761fea542e69b93fdbf91b7606362505dc93bd36747c3100b4773d352b027ec5f9043a876bf1be10efef5cb450ab4ed846aeede16ae1240f77075d9059411542697882b5a96f21316ebf9f833ef2decbbe99a1399bbf2857af35b6102f462662606f0e20ea1cc4fbb4dc3f84e5c51a934bfc71e01a9f12e2f46c60e32ea7a98c770237d35252df625a522dc6c4bd8bc7b90d8b00cbe12cdd14cf527c62f91166d226ff3a1ddce458c1d643a23e8e12741ebc52801c3cbea43becb93c36496c69e668b2e1363a16a900c74397d346ccfa3ac265f89291f010f83c2d458fe2ee810a12f4bad56a5078fc0f9dc3dfa5e565115dd62c06216a15ee267433391180c510f0201ba4de96d58e46887cb036ae811cfe8dd20d1af39183dbfb06fb80119558513636a9fa85c74ea14ea36cf5a1b6712baea1d31450119d6683fd707a784d782396da468b5add34a6bb0f8ec82205a36a390d5d51bc6bef0c247ec29e6c8adee646a23a412c025301f8b4e363138978af59dc94194862a3ad3bb40e514cbddff6f3cefcb9f93cb418e6cfe46d151be9fabead51f8b0835b94edac6665058b4707f30414ca16377a1d5f6c785d55c2cbc53db30f1946f4311ff71523641669a4e2f91912af6aac7b1480293026c3e2331c6594bc8f266e7f40bf7ad1c91a7ad552608607d5b53ed680ca7a982231f92c4104759b6710d9de1682a0be09f0a759800729ccb38a85562fb8c354e285df5a40ecb223f15f0791ef977c80fba6a02045d5354a28f4c74af704fcc626340ed58f036a8dd11317c0c26607d5e41b249ece704b434ba47657c7149347206051b798b725d32fd6b5b1945f260e3ef8267fe85d8669468cfe0049818d096b087f10570d4c274b040f34824312c1f29cc7f09bd1c4784a6f9d8cfe272e161a5d8b5e3544bfecd438ffa1da2553554654d59fbcfe9f11b1f3534ca52cd036d7e71fa9f57a7a756b5b4b02cfb9fc768250cbdee6a486b4c7ab2c7e64410fdc6a7eee10852afa8849050f750980a829f783d6153f8484386dbc757a19acb7dc5a8fc4136be78d586326c185af6f6eddec1e2ff9d18349345f78068491d4bf76414f903e245fac278f14aa038681aea8483630dce9d7fac86891d0416cd9c941adafe4d15ec1192dd1ccc64eb93aac44cc6961c3ee98ff57336503d7b3a767050aafedce51096b0ba285b15b89c32144a03c21b9da167e6b7a70addad9f27e656b1f68d781f89ae1e20b1d38d4c9d29d9720ce8b7adf35b4e37efd0195e6fb7899c71b8e6f174af3ebda2011263788f1b2570b96e0cd5fd39ef661e577f3ca0d1f3b0556980306c807514652661f93075d22f0882ad80cee551e8c08a5f658fc3e111cacf43e9565c510e03f7cf8571c6810b2d113c9defd8f4c6d92725cbe84cca399dfb69e1c7c46dded0149cca48de125716a89c6c87a9d501d7bef415635003b4041a22eb4f0b89e5280ce42ea35df7874e78472bde25781119f0dd281c5c508b3f986e74a4072a3741127b1872f02d02eb26c93c2b23d0d938ad52fbea627ab33661bf0c334d8f384e21a648f538ea62fdc6e094a2dce7fd", + "shards": [ + "0x3690240f977a2849b3544c22", + "0x5911fef9dedcd0a6e8f2e24a", + "0x78d35c33e1da406b98f5e636", + "0xe428a8a4fffe7270157b9f70", + "0x0f86b10f4b3b96cd14b49cbb", + "0x1ded46e6a0f1f91c34587a5e", + "0x512752787a36b5d03934d1b4", + "0xc58b0bdb49da16e820005e75", + "0xed7644ba962bad3734f19c41", + "0x220e5f79db9f447de6c2ebf5", + "0x9088f3840232f2280da236ee", + "0x8697fb594238030115a57ba7", + "0xa57ae9505028b5a5defbaca6", + "0x48911acf992b1215069117fd", + "0x2aaf76a209d9f2ed97c13150", + "0x55181e0b3591891d6279922f", + "0x4dee57c3344773fe991cc231", + "0x84b007738614cdb78ace8a90", + "0x4bdac5fc59c089103820b8d6", + "0x8297c9b21c114efd428a17dd", + "0x570333291c84bef92298dc35", + "0xe31ef8c78532bba7fb5ebe5d", + "0x3ef3a78a27042f8d8576f843", + "0x04e60feacc0c9dec510b84ca", + "0xdb5d7a304f3f2770b96cd50e", + "0xb88e90381f556463df272c4d", + "0xc90d95db26d1d08616c3688d", + "0x993a0be52bb68ee3cc8dad67", + "0xf8b4b5f45b4e78c4f62329a5", + "0xad7c844e411b8f3321cd0e32", + "0xe3c97a29843976e1f3a63542", + "0x78afa857c3e3edfb4529fb09", + "0xa54f41ce228462c58e8fee74", + "0xcb86b67d639e799487107114", + "0x02b8b6592ee6ca571adc1d0c", + "0xa5515bf63c7ca9787e1398b3", + "0xd5322758c0555a74df31ca32", + "0x59596b6b8f3590cd91f695f1", + "0x6e26d203d2c3366de3393bad", + "0x50d26fb63caa34c68be4c7d8", + "0x24b418234ea6151798939216", + "0x8c92abc031f31a157957eb16", + "0x215a45bbce5109ab91a135ba", + "0xec3e0c0bbc3acdd0ad3a615f", + "0xe4f47c417ed2498f116d3422", + "0x9775b305d243d6c047f6514f", + "0x9af6abc0ebb9bf50baf938b5", + "0x4f3214177ba25a302abe59e5", + "0xaa778b72a1d91f24a3bb4d11", + "0xd7f5713a2c6a6f3a9428ddb8", + "0xbc28dc411e4a31cf9dbc58d1", + "0x66887b8027d6992b6f8abb50", + "0xb6c67f7d4c9cfe2e8100440d", + "0xe5b1e38c28db562c4a430cc6", + "0x6a5639a4b9445280441b5fd7", + "0x9c1e0c00a89a0a9b9aa63f6e", + "0x9a4d4bd1e9c943d6618f1eab", + "0x6f369f510d9e505da8f3d631", + "0xb010ad70aa6244058af2a8cb", + "0x93214227eb76d5953d290e52", + "0xd5f0b9621bf5785d7a71de9d", + "0x2c260fc1df54e2b1655ef33a", + "0xfe8df6e30def533b81a2bb25", + "0x8daf4024c154958af8c035e2", + "0xf3d16233876777be253ec7d0", + "0x28fd4154f158429d9d91c0f0", + "0xd7b3f6881450b4ceea4f9655", + "0x631e75a349791ad12f11ec01", + "0x403569fc3247d6797df748e0", + "0x3f1cc37ec67dd34e3677a418", + "0xdb26c93f5270550503557aec", + "0x51040d1f4c4f318ec4d708d0", + "0xde686fa669c122ead35d2bb3", + "0x6a2c84a7a1f9e1a0b73179a5", + "0x1526358a0e3915da60de4b1d", + "0xa07f20bcd43689ef597f21db", + "0xbed5c711fd0c06770d28caad", + "0x03e43a068f336f0f7e4fb80e", + "0xde3cae11332f307d316e36ef", + "0x2091320e4210ede94eb0ff57", + "0x1496014bb34ea22c277f8ebb", + "0x6a986dfa29e0963180f7f3b5", + "0xe9b89532140242082f9f62c3", + "0x168391522a68eb62408dfa35", + "0xe18e87941be3caaee8371607", + "0xba602607131a750983caa48a", + "0x724935fa71f8ac43042d5f34", + "0x56aa2394faa40e048e638918", + "0x880998fb755bc8f2a72d5abb", + "0xfcf9eb0c3fb6158f141bc638", + "0x1a5e749344a94a6588489d27", + "0x2b03f47e233896abc596557a", + "0x7885aa9f589d3e38b99d3b32", + "0x6f345cc972fad579d549e3c4", + "0x9df9645deb6e3d150b8730b1", + "0xce4863eeb965fd8737e84a29", + "0x02493d3a7cb28455746391e4", + "0xcd805ef0a2c1d0aeffda0a38", + "0x68ed14a772647722859160e4", + "0xba13e02959165355778a1bc9", + "0x8cfca3ef0d52101935df6f14", + "0x03d0246887dbd71cacb01ab7", + "0xe217f50212486e5495406e88", + "0xd49389dc81e61bbdf624b632", + "0x0ab70465b5876f506c00159c", + "0xe15fd289010b43ddb3503278", + "0x5aa60b323f0b62dfb2772c51", + "0x8e101445a2bac43721d9c7ba", + "0x950633c2b54ebb8c0e51cd25", + "0x775cfa8b2e19dcb558640d8f", + "0x19f93a01c01fc60e3db8997c", + "0xa8901e82486f7990d2b9b3b7", + "0x9abc4d142d74f270ed992a6a", + "0x28b73886c62c94bb6938c937", + "0x16c853ec3f0968d44242fc8b", + "0xa62b2c736694b8dc35b7cb89", + "0xfd4a181317e95f1aead6d8fc", + "0x80d6df0db2989aaa7804700f", + "0x2f2d709bf600dd6b8b45fb08", + "0x78a88efe50e37ec7ed71b321", + "0x26c4aad784ed60cd7d1b2a12", + "0xb8aaeb81875c17d4b039d47d", + "0xad514805d18e02916c63b9c4", + "0xa2155e9df5581bab0877ff85", + "0xa67d01affaaa7a678bdb4b8b", + "0xc0d49e79b5f5c02e3ac88ea8", + "0xa3bb93104b5ab08c8ec908c6", + "0xfc170930dde23275655f14eb", + "0x5dfd9ea13952a940a8ac7f61", + "0x720bbf67f56c11aa9f1d7b52", + "0x9fbcb43d0ed02661624a18a5", + "0x866286dd16b2e701fdc7dc3d", + "0x67c7c32bfc7d8bc51ed197cc", + "0xe404a445d391b0f10a7aa9f1", + "0xcb64befba60136f2c8af77a6", + "0x9f7e95d131e098755e6ea86b", + "0x004a1d6672349f67d28c65a5", + "0x76c4977275c793ea7362c097", + "0xb47a879aa93ab48a52cbf12f", + "0x36be462c4586871574684de7", + "0xa15f3ae3982144e6b5818d6e", + "0xa37b4014deea674e2b81c0bc", + "0xbfd7ab27650b1d2ef235d3e4", + "0xd33d3e883cddde64ddf8cdac", + "0xc11e21cb3eab55af7b7562ec", + "0xde4722c5314ae2dd4da5b891", + "0xfc3724ae8b2c625a6289a3bf", + "0xb005dd4df0f2589f61b19dbf", + "0x20ae80227be9395192f7c26b", + "0xa4ae71da7c667c9e99362fe8", + "0x8615ccc275afffe6eb31692e", + "0x7761379b2ee385a8ee055cb8", + "0x86d74b68918645ad45d53832", + "0xb37eb49036a8d7d2e4e240ed", + "0xceb211c3c6fc04b46aead188", + "0x7013212ceb263238f4995aa6", + "0xe695df500d5818b508b1c12f", + "0xb7e65fa9d4a32b6092c3bf72", + "0x2216c8bee55ba699a90cd763", + "0xbd7a1fcc60213e3dd49f7596", + "0x9a1a5241f734c46a4cdcc77e", + "0xc50c1551acb330c908bed354", + "0x1f5fd396d108bf12922a48bd", + "0xaa173cdaf8c8bbefc84f6f46", + "0x331bd0147fbae36c9706e4b2", + "0x7d8d9d18bd84a1bca4fec0b4", + "0xc15f3e054723d9fc2c60d376", + "0xfc5f7d8c74813b7b210f66e9", + "0x5b206692fd607ca1b29e3c28", + "0xc0f61e2fcf27df1c7b847e19", + "0x0733e78c843d66958bcddcb0", + "0x3d0d466512cccadebd247ae5", + "0x748560b4c43f41e0a1d7202b", + "0xc068fbb1a60dfd81b418352b", + "0x83caac2cd3348623f67cb338", + "0x0f46958ded030c9b8c04a766", + "0x8bfe0f711519eebe46e51f8d", + "0xeb80b69caf8399019afbcb82", + "0x07c5cf8f209c9098404f0bbb", + "0xc47f45af8591c641499e7929", + "0xd9b78e13fc4c95cf0bea602a", + "0xa7a0d2300c9e1ad82f790a6d", + "0x78c010947a7e6eec7b1fb098", + "0x84bf8e71c0cb8d2b8c818212", + "0x6417cb111aee8e4bf1dd9ba8", + "0x7e7e0ca29011143a2dda3677", + "0xb25141563d32298e56f5c09b", + "0x15b26dad34816ed6506da226", + "0x73ae6095c82b4a3cc97a72d8", + "0xd3ef6970404189b848dc0830", + "0xcb912688c6bddc50527a3cb7", + "0x6d3069befc63952dd82d6e2f", + "0xde08d0fe18ec7c075393fa7b", + "0x24ec446899a16586116ee835", + "0x0e10f272cddeb6847c1b4dbe", + "0x22a5508acc5bb96cf8b6b6e2", + "0xeff1c781f69f9083993c6842", + "0x36cacc202a8002e9a7621fcb", + "0x821005ce8d7470038bb8ea28", + "0x0a38ab7a49f23dbb2d9c1f73", + "0xc0c1e760de5a5fc222de84aa", + "0x0db44dafce732e703d844291", + "0x91f0fde50c28df8c49a01e1f", + "0xf3ae8ada3a879cfc3fd956e1", + "0x86171ec4588c1ad2639fac87", + "0x50ed84ab456885cfe2744539", + "0xaf619923edada050d36b7dd3", + "0xbcddbc7f56fe8bdb85682016", + "0x26b5d37e281a024c8d77f7c5", + "0x48458fe5c708ceb221b2bfa8", + "0xa29aa7afa95618c4f5f725ef", + "0xf018a70c63ab10750f2a3593", + "0x00a78a6555408835c851691b", + "0x7b2756ca3bb8032a8670a781", + "0x76f03dbc3eecbade8d0a5d1a", + "0x9982cf4dd7e58af193540456", + "0x746732601837e3782d2b0dc2", + "0x7bc1b82bc7945552c4a2d5f9", + "0x7c9eb227f462e4ccf6d9aee8", + "0xe8ddffa54e9c58490e8f7667", + "0x1100b62a10684fa934ad3915", + "0xae801d24da907f5ed16444d0", + "0x860cb032a296a494ab55bf1c", + "0x0d3274fc49f4193d8c723f10", + "0xb9e03f2eb23eca6950e8631e", + "0x1d7ac440dc0e0d6c037bf8f0", + "0x4137d93e401309ee92bfffa6", + "0xa5d87995e8273beeb3691f3c", + "0x8820b91fc06a97fc8241aa17", + "0xfcc899a882414e4f078ec973", + "0x36e48a32b49189f5a759c7e9", + "0x3eb0cc46d9bd7f90ee890254", + "0x7a88ebbd5c492c7cc016d1c4", + "0x653e1d1040e3289a8ae33766", + "0x754d275aa07fdfdc421c0a6b", + "0xfc961bb9c2c29cae76bf7ba1", + "0xf1c1899fac3172675230a9e5", + "0xecd14129a19cdb1077393626", + "0x5ca2ca1fccf75696b10a37ef", + "0xf4ee2832ff2fa215ba9ed85b", + "0x7f80799602b1e8d9455f8050", + "0xa8a018b667c7d1680b97f54e", + "0x7c447a13ba91aee5e538f749", + "0xfadba14ac85d9bf1519e4743", + "0xfb6bba5c184a0eb8d1193437", + "0xb0857060671b54f97a080820", + "0x7d1f06ae8b60ff55957a38fe", + "0x695a9f6cf761fea542e69b93", + "0xfdbf91b7606362505dc93bd3", + "0x6747c3100b4773d352b027ec", + "0x5f9043a876bf1be10efef5cb", + "0x450ab4ed846aeede16ae1240", + "0xf77075d9059411542697882b", + "0x5a96f21316ebf9f833ef2dec", + "0xbbe99a1399bbf2857af35b61", + "0x02f462662606f0e20ea1cc4f", + "0xbb4dc3f84e5c51a934bfc71e", + "0x01a9f12e2f46c60e32ea7a98", + "0xc770237d35252df625a522dc", + "0x6c4bd8bc7b90d8b00cbe12cd", + "0xd14cf527c62f91166d226ff3", + "0xa1ddce458c1d643a23e8e127", + "0x41ebc52801c3cbea43becb93", + "0xc36496c69e668b2e1363a16a", + "0x900c74397d346ccfa3ac265f", + "0x89291f010f83c2d458fe2ee8", + "0x10a12f4bad56a5078fc0f9dc", + "0x3dfa5e565115dd62c06216a1", + "0x5ee267433391180c510f0201", + "0xba4de96d58e46887cb036ae8", + "0x11cfe8dd20d1af39183dbfb0", + "0x6fb80119558513636a9fa85c", + "0x74ea14ea36cf5a1b6712baea", + "0x1d31450119d6683fd707a784", + "0xd782396da468b5add34a6bb0", + "0xf8ec82205a36a390d5d51bc6", + "0xbef0c247ec29e6c8adee646a", + "0x23a412c025301f8b4e363138", + "0x978af59dc94194862a3ad3bb", + "0x40e514cbddff6f3cefcb9f93", + "0xcb418e6cfe46d151be9fabea", + "0xd51f8b0835b94edac6665058", + "0xb4707f30414ca16377a1d5f6", + "0xc785d55c2cbc53db30f1946f", + "0x4311ff71523641669a4e2f91", + "0x912af6aac7b1480293026c3e", + "0x2331c6594bc8f266e7f40bf7", + "0xad1c91a7ad552608607d5b53", + "0xed680ca7a982231f92c41047", + "0x59b6710d9de1682a0be09f0a", + "0x759800729ccb38a85562fb8c", + "0x354e285df5a40ecb223f15f0", + "0x791ef977c80fba6a02045d53", + "0x54a28f4c74af704fcc626340", + "0xed58f036a8dd11317c0c2660", + "0x7d5e41b249ece704b434ba47", + "0x657c7149347206051b798b72", + "0x5d32fd6b5b1945f260e3ef82", + "0x67fe85d8669468cfe0049818", + "0xd096b087f10570d4c274b040", + "0xf34824312c1f29cc7f09bd1c", + "0x4784a6f9d8cfe272e161a5d8", + "0xb5e3544bfecd438ffa1da255", + "0x3554654d59fbcfe9f11b1f35", + "0x34ca52cd036d7e71fa9f57a7", + "0xa756b5b4b02cfb9fc768250c", + "0xbdee6a486b4c7ab2c7e64410", + "0xfdc6a7eee10852afa8849050", + "0xf750980a829f783d6153f848", + "0x4386dbc757a19acb7dc5a8fc", + "0x4136be78d586326c185af6f6", + "0xeddec1e2ff9d18349345f780", + "0x68491d4bf76414f903e245fa", + "0xc278f14aa038681aea848363", + "0x0dce9d7fac86891d0416cd9c", + "0x941adafe4d15ec1192dd1ccc", + "0x64eb93aac44cc6961c3ee98f", + "0xf57336503d7b3a767050aafe", + "0xdce51096b0ba285b15b89c32", + "0x144a03c21b9da167e6b7a70a", + "0xddad9f27e656b1f68d781f89", + "0xae1e20b1d38d4c9d29d9720c", + "0xe8b7adf35b4e37efd0195e6f", + "0xb7899c71b8e6f174af3ebda2", + "0x011263788f1b2570b96e0cd5", + "0xfd39ef661e577f3ca0d1f3b0", + "0x556980306c807514652661f9", + "0x3075d22f0882ad80cee551e8", + "0xc08a5f658fc3e111cacf43e9", + "0x565c510e03f7cf8571c6810b", + "0x2d113c9defd8f4c6d92725cb", + "0xe84cca399dfb69e1c7c46dde", + "0xd0149cca48de125716a89c6c", + "0x87a9d501d7bef415635003b4", + "0x041a22eb4f0b89e5280ce42e", + "0xa35df7874e78472bde257811", + "0x19f0dd281c5c508b3f986e74", + "0xa4072a3741127b1872f02d02", + "0xeb26c93c2b23d0d938ad52fb", + "0xea627ab33661bf0c334d8f38", + "0x4e21a648f538ea62fdc6e094", + "0xa2dce7fd0000000000000000", + "0x0cc7c73e4763ce235f8aba4d", + "0x93edf03947db3486008e7e8e", + "0x3e8a2605cbcd1e1b2ece1bac", + "0x6cd1782b7466a9f85c95d620", + "0x0148095ee94ef823143ad3cf", + "0x402f924182874195871fc819", + "0x0e95899212a5a32816177231", + "0x5565be77fa39b6925e34399a", + "0xc3c911a8d97fdb9e7ef46de9", + "0xc4985b44f4c946256a4dbb63", + "0xa602c99865c41ddf23e80839", + "0x70c09319fb5d579311887bf7", + "0x39bfaecf4571abfb2a6b6c95", + "0xe88c80214f0a7a25d4f475f1", + "0x39615c161595e0eb1c3e1776", + "0xc214fa8505a2a1a499f1a773", + "0xb854034e5924f7d7e45fa01a", + "0x3c2ee391bb7d0258170f7fbb", + "0x89cd13bd55d2cb89d64b3d1d", + "0x2aee7d7b6c8545bfd07ccbe9", + "0x54134d3623d9f42cd23e1065", + "0x2c2549b461c56b4afae305ef", + "0x81739ec729fcdf4b3ee84e81", + "0xc199e523684b1450d1295b5b", + "0x6342531f52ee189d4f84716c", + "0xdf2d96aba18279f343362918", + "0x3155b7411ca49846387bdd30", + "0xb60e447732d459c0862efebe", + "0x24427418a969e75b4dacfb3f", + "0xe3680a1a546259627607a91e", + "0x3b2e5e2194b32e10f652594c", + "0x89d596aaa5af3027cd18a9b0", + "0xaafd0e73d4587a9967aa5d41", + "0x2f61be81564d549f48365608", + "0x72ef82af668160f7d2525888", + "0xd323b9ae3e724ceef1b43228", + "0x483c6f907883897d19d0f5c7", + "0x6be8a8857cf779932e791f53", + "0x6ba1b1b1fd465e3174a2ba7a", + "0xee18824dbce4548d3749dc27", + "0xb4c2afe164dc7f58f3f517d6", + "0xab3d87b4c911072de0428cec", + "0x4e4ef75ca1f4fe4f2369ad16", + "0x2a55198376fc848d6dbb8f8d", + "0x4b0e4bfbc0b371e44d4bb192", + "0x367221d13423b77770c9c2f5", + "0xcb68588d49e9e72b47c863ad", + "0xc9a43e84071c7e04887a8311", + "0x8971818f4e71b02f695b1111", + "0xed766cc485d6ec6f5e220e7d", + "0x152a1d3d1bafe588db7649b4", + "0x52e113547d4af34890d12e07", + "0xbf62df83fed0d644bb6b9c68", + "0x9d59309434076ea54c783a23", + "0x399970083cff62476a3e5b56", + "0x91ae15ff819d2a6e959d6a6f", + "0x04e64e912179367c61a46494", + "0x649f653ce0e256b765448ce4", + "0x9ef37e85add25a1ba8278d4a", + "0x94d7473c7c18b16097c3eccf", + "0xae6b4ad562de7f3acd52905c", + "0xce3a1efdd4d07ea82e4cd771", + "0x52bcef54c8c2d741acff6e76", + "0xff35e6d42b5e8c72c912fd5f", + "0x02602c8e65dcfca620e513d4", + "0x1c142f5aca0a6864cb023c0d", + "0x313ee688a2b84107870f094b", + "0xf09c23749d7ec94111ad42f4", + "0x55fa1237b2796ca66c9a7605", + "0xee15226a0ffc8d0a61823239", + "0xc80c1f9e9adc433b8ac28a48", + "0xb286d51b3b9ba1363e6a5d0b", + "0x081b9aac34081eca8ea2bb58", + "0x332b874835454513e67b5565", + "0x6a108426871c1066c2708a0a", + "0x832afc134c402954b46b2f7c", + "0x460b08a9ba079eeaeb1cade3", + "0x9318268b1eea0774aa78fbe5", + "0x4db34674b393170c17e7edfd", + "0x9f588cf31b7e507078799ba2", + "0x7453183b886efd497a9a9458", + "0x93cc00c21a16391d0ccfe2aa", + "0xbe5cfc6cb011f88eeb11d4ec", + "0x504379e15fdaffa8ed682eee", + "0x298c9942d25da97050753544", + "0xba790c7cf17ae4cf2066e1e6", + "0x27c886e73bbeb47550e2604f", + "0xf1253834ccf4e769760373c9", + "0xbc27207e1d5f3bf725f72e25", + "0x988ab9578dd4e3efd224433e", + "0x7300821e96f2f38524be33de", + "0x3e9835805fb4743750134727", + "0x3f193f8e847c9da5c31e1cab", + "0xee624ecdb1366d4f11e912e5", + "0x8989777f544cca4ba8ba201e", + "0x9f5b6706ddddc4fb873f33d4", + "0x0cf90ed39d1c4fccabfe5083", + "0xee260194a98f5e0f7eda5801", + "0x2807c3420f4cb81ffa6062da", + "0x6bf29cbf8d3790956a6670fe", + "0x4e4483d6ddd1b57eab4e690c", + "0xd260e1554ebae43ae77e513d", + "0xeab9a9744d906e26979d60c2", + "0xe9e057e1e86049face0d9400", + "0xa2aa091cf6f5bb7ccd253c16", + "0x0e90c1aae6ed6e37327b9aa1", + "0xc6d564ef9621f7df75a725c6", + "0x0927786b732f167ca8f9ff7f", + "0x8e8745dddf5e8e735534bcd2", + "0xde56c9c67dceec0a8b14cf94", + "0x08f5022929cd9d727413be65", + "0xd410ecaa2afa211b055f0476", + "0x070c56d060b0869040e09696", + "0xea1e2d5160e48f9d78af7f40", + "0xb1d7d1663f0372946f431c2d", + "0x4c93d35b4ba515557e6df289", + "0x5d3abb76f1842ad38baa9ca4", + "0x3f7ec0877bde782a1a28a4e8", + "0x0d5f5e296b3959f6dd8e4623", + "0x45a1ed7d193d43be1ee06ab9", + "0xe7fccce5c7927b39907a2ea2", + "0xf5c4a953484bfd2b7ccf82b5", + "0x2b7abf8b23727afb223290c4", + "0x647d020d2af999629b2e934f", + "0x9fc3cd202d6ffbf20050f2ff", + "0x3024087ca87b0b34e68e6231", + "0xc4a3639d4edf538357e0dbb7", + "0xb9c995d0550b1bd9b4d1cf71", + "0x059f8ffce5bb76c9b336c291", + "0x63786a940ae647573f9f757e", + "0xe1c6ef556050be1d3e017177", + "0x2d06ce722960860eafa21fa8", + "0xe399725641765f70978ad951", + "0xba8be8455ea985afd34a0a55", + "0xe00cb58920de0aa7bb745197", + "0x12c3274df6249b4d73fd0159", + "0xf3736bd9d145a040caa17155", + "0x874737db9e8c370f71d1cc04", + "0xf3ebc64e3b20f02e34fac21b", + "0x645ccde786089f8b567981b4", + "0xec8fa99e22d2faf3cc3502d9", + "0xedfdca13e34e80f7d16c75d1", + "0x466db0820dad4603f9fe1659", + "0x3f98321f7ba4745d9c65c7bb", + "0xd1292947bc83383703dbcf72", + "0xbde3b374af48e28a55f0c134", + "0x5a5acc9ddba9eb614ef3539c", + "0xc2be40c46e552548c52489ab", + "0x7e9a21608947cd73f14e5991", + "0x37400e86fb614440c5b9d194", + "0x79fef48b04d29036511ba640", + "0x480f012b85afe5d294a8c988", + "0xa08419f66030dd6457ae9c43", + "0xb93abf21ff458d027c02306a", + "0x03dca47a2485dec072ad4f06", + "0xf552778bcf0a183c088940d5", + "0x96a486793af3f325f2d21e3d", + "0x39dea82bc9801bb9dd005647", + "0x4e620d82976386f7c42d6b7e", + "0x3187a4f204e985005416270c", + "0x7ba527fe873bdd47bc61fbc5", + "0x354ef1d6aa727f0173c0c22f", + "0x7e970d49314fc1f326c39e01", + "0x2f0d5916026549f97677884a", + "0xed7753ff8dd27d8e42e31539", + "0x1f228e50e5700a0389fbd890", + "0x9ad14952c1f5eae00bbd2350", + "0xa2cfce1bea378551c346283b", + "0x25945c43dfd7bd8383dba20c", + "0xda275f5596f78b4234c23a72", + "0xef2635a868db7c2a0c452992", + "0x16207bbb7e54e2d0eed897f8", + "0x06ee3e5ebc2d0bbafbebeb3f", + "0xdff6f2158c8175e1936c9dcf", + "0x16c0f22a02a1a8c7e1517e1d", + "0xae6e4ca341a5ef6caced1782", + "0x92af60b852994b8288b8ad63", + "0x3db0295d6201b60b64ec6c77", + "0xe100713589b71b3a401a8e70", + "0x5615b9428a0bae4dbc7f202b", + "0xa8c69e7659f8f28a0a41f333", + "0xb3b4c8c811637082a06a08a5", + "0x6ca30d67d623075b70255d05", + "0xf1bd965b7068545df416290e", + "0xb750c03f37ee8e5a1490e4fb", + "0xdff3933ae6387ed946d9332c", + "0x48956c019215951fa8192d9f", + "0x527abbfc2dd22007bc385cb7", + "0xdbb65e554cbd0f64ca1e3357", + "0x7e853660c83c32460b697ecb", + "0x7f0ed9b107b17352f9918c45", + "0x1a3d82850f71d7d8d3ed27b1", + "0x204db7f962186244884341bd", + "0x595fff0ab777b369a366717a", + "0x943b4fc56949c2128e238145", + "0x6889fce177a8db61dc2a666e", + "0x2c691fa85c59b5be5bd7a38d", + "0xd52bb53d88f9d0ddf6864f2b", + "0x72983c21cc960b1bd139e6f8", + "0x6adfb74c008d43342d4d941e", + "0xb0160ebe951389f2a9d1752c", + "0xb6f1b16aa16cdcbd27f68401", + "0x1d8c987774294e4e7290242d", + "0x9520f946c3aa7b6152902088", + "0x9612dd9469cbb4d67bf05a30", + "0x7c77c8ce3282be7f34fd31c3", + "0xade38f5a0a80807eb96dc468", + "0xe5e26782e4f8950b6fef89b3", + "0xb905083c6ddf87b2205b93e4", + "0x7d5cc636ff69184888732a83", + "0xc9b383b6c0efa3391dba40d7", + "0xfcd64c65d9106829d22fa64a", + "0x002ac448702a66426f1cfe3b", + "0x4fa43505d5c925615727345c", + "0xaa7096d7ecb7b237cdd0d1c1", + "0x3936d28d9616f70894705fec", + "0x7444a41aa0c253d2cbefe8de", + "0xc73a17c6bef7e3ecc70b51f5", + "0xd66dfb3cefb7cd731c240641", + "0xbd78e1dcfc8fcdffdd9bb547", + "0xe99cbd0c739c9dc54406345f", + "0xd7758dcd761591321c8ff685", + "0xc45715af314cb04e8d38a1fa", + "0x2c13b56f5041241a4f2904e3", + "0x81362a52ab07af875d484eac", + "0x7da6dd5a049c67a69ee87fb0", + "0xcdff002faee4b7b676ac7991", + "0x15719abc8c789fbcdb9296e4", + "0x73813cfb471fa5325c59f174", + "0x2f2aa5587a6fe8011f337b20", + "0xe2e3741fab4d1e7d5bd8967c", + "0x54b40d2970765bcb45c1b1cb", + "0x7f6c408c6217ca733c199c64", + "0xe04b7866826d27c682c39cec", + "0x18372415a4b3c0598cd6d835", + "0x3986e40da9a3d4a75f8b7711", + "0xda19fc4366d51ad8bad9a7e7", + "0x727b32eff7ac34f15a152e2e", + "0x0320d46ff939eb7fc104dc8c", + "0xad1a10d69325f59c91be86ad", + "0xab578fe5f26ef2dcfb1747cf", + "0x1907f2538245cb7dab111769", + "0x42ba5d2a6716c583c0ff46fa", + "0x7afff3171b90c19b36839fcf", + "0xc7cd8ba1bba5751801c81122", + "0xf8636900efd81061e7df3cbe", + "0xac57ccf1b54364255513a5bc", + "0xb486095be338537f9a32a382", + "0xb79d79d3385f9d0738faa7a8", + "0x6fa07344d89a4ea36e239f18", + "0x55062143bfc8761823e92f12", + "0xa5bced118b9e34a79fda04b6", + "0xcf163b5c9b874045cf68eb20", + "0x26c602a134b885f8fe6183e9", + "0x4874f0b526e3ba70270aff8a", + "0xf7db40cae79fc33c9041500f", + "0x6ff40dd9c273c76931eb558f", + "0x10985ab2dfa0745891cbe65f", + "0x9961759c274f4758342a9dd8", + "0x332b7557eebfb766392d99f3", + "0xd5d172c6a839c23e7cc79caa", + "0xa3a458aa5bede1ce151c6e26", + "0x3894ab91f747b11ac8f173a8", + "0x46a6804df5a4719ff3db7059", + "0x5eadecdf1aade9bcfb11e3ae", + "0x90804677c972f06caea8c2f5", + "0x362b7b5d63ed4c039b20cf53", + "0xd330dc2a82c872b453f6fc29", + "0xeb565ac12fd7203d5d74b643", + "0x80501f8cc9b488be95b617b1", + "0xab6f001bd0751430e4658517", + "0xa71e861e7a5d40ce46699aa2", + "0x632a085b09d63412de7918fe", + "0xf93bec4e220be64fc9bf28e3", + "0x2ba94819cbcf2bcf6563aa85", + "0xadcd678c770f5c4107981c60", + "0x535e28c05446e31ca44c206c", + "0x53001cb95e1be69f82a991b8", + "0x1548462db6c08f9557c92240", + "0x44e31e2a3c447c30a4d025d6", + "0x0e9e46ebd4bfdec18d03cc8c", + "0x0b081a01eb434b4fe92f00e9", + "0xe1155111f54318f52be4582b", + "0x13630eb88adb7cf7d0ffba83", + "0xa26c33649025fca4f7e33cb5", + "0x362926801ba9d5bcbdc287ae", + "0x56ee855b55cfb378a0dc4b22", + "0x11d69c91c3152e8d6c404a6d", + "0xa6b6e304f1bd497762536081", + "0x322d74ef9af9d93124462819", + "0x6a4e2e2f4e9c333267ab576c", + "0x1f722d96cf5394016bd01514", + "0x85baafbe6a8665dbaeb5adbe", + "0x1ef76e7872774b01ae0a485d", + "0x8d0d76980f0b0a9d1e652538", + "0x9d79fc514ee752ed13e7244a", + "0x7750d35f07cb92fdd39fcc95", + "0x4338d57c88f67efc318ecc91", + "0x2d2f8e93fe449d10b988f7e2", + "0x98d7bafd44dba6f9416f15c1", + "0x8d001cdbb178d7c235119075", + "0xbf8c9eeacef369c72a89e512", + "0x4324a66505833f5a3339c2bd", + "0x52673c65cd8014b7184d0952", + "0xa0902e74eb9a04adc727af6b", + "0xf87b68d7bdcd8785b12d2568", + "0x41d13692aac36fde5ce2734e", + "0x9e14dfbc16865136bf77ff6a", + "0x6d87ff4a2c53c34ada44e0be", + "0xb89cf8a6e7520e1bee659998", + "0x0a3f2083b9a728bb005af316", + "0x1bcf146b8e33551f262e1918", + "0x3b3643ce9d7e79afa64b1117", + "0xa4441a65dee835488398b9c0", + "0x0496edb2b81125df64aa1f7b", + "0xc4a5e0c1fc9c601b2d8fdccb", + "0x79ea400118e998656fc498c6", + "0x600f7474458de080a95e10be", + "0x25a9c84ba4b64ee3041f6db6", + "0xf24edc0f78a8011e6d002f53", + "0x6e60d312aa783f7810b6da36", + "0xc8bfcd968d44c9ec3cbeb87b", + "0xf55d26cfe567f17eac7184da", + "0x2905d489350fc3b218bb8ca3", + "0x1ca9df2c18956ae2f2d10228", + "0xebda7511508192eab0e1dcc5", + "0x2ee8d5bb2889f77df2ea1746", + "0x27903d2e464f29518e3fc767", + "0x499cd6367f3bae162c269a9f", + "0xec0924b6dc03bc3577bdb136", + "0x0556ad6f36f258110d379fac", + "0x797d5e71f3a36355118f88ac", + "0x59aa7472f7a1da1e0f8af755", + "0x4c12c1294ac0c8670e6fcd59", + "0x13a1d21d33b45261c5623264", + "0x54b4e0c370920787cb463fec", + "0x5c2458407f8a79d8a58be8c2", + "0x224244cc1db1da94e4ca838e", + "0x61725382fbf390ac91e46e06", + "0xe437ed5a80434f386566eeb5", + "0xcb4fbcf3e1922516bea7d814", + "0xabd7f7880aced5b38988e7c8", + "0xe83df1a84e7e6792e420e69c", + "0x72251d3f320c133dbf91bade", + "0x8b2a07acde87af903159cd00", + "0x570a71b040ac06dfdc1b205d", + "0xd5762ff7ce737c34685b6ee9", + "0x91d4ba06e50fddb72b7dd4c1", + "0xab51dbd565ff4ae7ff2e4abc", + "0xd9c29714aa8702aef5c2c652", + "0xb27529fe39b38b2c6a9bc8ce", + "0x826ab5c793a2f2d9bfeb915f", + "0xbd1638bc6b876db44b4741de", + "0x5aac958a4452d7c877070a76", + "0xe6503106d6e1966fbfc88e15", + "0x6b4a45d63e23efca07c25b5e", + "0xf32c57b71512256761d5a6ed", + "0xdc31cdb2a5e6b9c929242e17", + "0x8d9d9ba2a435b8e7002fb700", + "0x1f53cad4f6e4d6e64ad43f5d", + "0xea462b68e2b58d3fcebcc4ac", + "0x6d24d8dd0320a57cd5872496", + "0x1e5b0928815089a09a40fbc9", + "0xa46515e62222a9384c4a0181", + "0xfc49d18942097be40ae23b28", + "0x29868c0304489349efbab083", + "0x151023300f473ba8183f4ed8", + "0x89a02f43fcdfe9797b6683c9", + "0xcac0517fb330942eae85c0f3", + "0x2c6a2a59d9fbda602b5ac2df", + "0x8621a06f45e325126059d3be", + "0x2eb615d50301d34099cd8c42", + "0x071f0cf011e2fde9cdcd3b2c", + "0xaf04db7c36fceb6cc9ac577d", + "0xfdf03c96736c010ae3c79e29", + "0x0bfc81b06a0c78a1fd604658", + "0x31bdb5728b23abef54c27bdc", + "0xe8f85a90bc7f1d053736eac8", + "0xf64878f763b5388ff29171d4", + "0x24e3dc589a803c8f8f99283f", + "0xbb1c3dd9835d2903453519fb", + "0x72fba204c00290c01cb3354c", + "0xe4ebb439c29def878ad09a73", + "0xb4353437e6f744a7403a503c", + "0x3096a3ef09964ca502de9ce5", + "0x6683af06d14ec730f12b1eab", + "0xb0d117c4679af127fb0a57f6", + "0xc7434d0b8e4c6e5ba2e70717", + "0xb53dc6727b136faeac60a2b7", + "0x135f1da45be1ee6c480e1e20", + "0x2b0c726f950a2f9ff6aec049", + "0xc28265957585f6aef274c38e", + "0xcf0c49e5e5a170d442c81992", + "0x8e702bc631d28046e2ac4002", + "0xffbaa523900374890451bca7", + "0x444b63e66b3ec752c5e2b416", + "0xc31e7c64c83e8f5fe0b6db23", + "0xde6e17ea5e2f5a8802898604", + "0x3e14ec6a550b0d299e0c7676", + "0x90d9f7bd3d1c80150dc94878", + "0x276c99ff82f3fb857b3073d0", + "0x9c6b23d7e420d6e54eeb2698", + "0x72a4ac1ee4f4aa531ca10e4a", + "0x3094b04ce3f374b687d49f0e", + "0x9363106c44af5fe7b9f0acb1", + "0x0ae29fa2e1221d0eb3c33ec2", + "0x5cdbded3086c4e682824d64e", + "0x740fafc2ce9bec76e0693886", + "0x622110f925dbe2b316d77580", + "0xf66e034b2a4670c4d77c9216", + "0x2f1dea5d61ad2aad5e70b799", + "0x6e25a71ecc904afebfc3002e", + "0x537f2a1f31b6b1c3121469ba", + "0x587a9d6bf4ae04afcec6aff2", + "0x2ff027f665a2662de5070c28", + "0xb61911657c5fd00293c9fc49", + "0x0f0e76693c33c513277fc64c", + "0xf2e80c64ef9a65e2643b1983", + "0xc5987ea2211e6b504a9b132d", + "0x863c4fcf4906d92984aa2ccd", + "0x669f81ea69ca0eae8b92a2d8", + "0x73862332db8917f3cd71af64", + "0x54d387c9b85f343477796a52", + "0x5c59f1de70c10449704bd4d9", + "0x1d31a199422b31e8512186e6", + "0x04adb0442283a318dd9e00fa", + "0x6d8c9e7844adabfcd432e93f", + "0xc428d14a2e6e51204750e169", + "0x0d8eeac625e2c2b8cc6edb68", + "0x1b9837c3e8355fa7dc2a97fd", + "0xdfa939e4df6ab07569a21fbd", + "0x5828baa8720f53adba3de7e1", + "0x72ca0ec1cda0bc44d6dc0c20", + "0x8aaa6d6f80ffbf5db3c93206", + "0x23bc4ef9995a3916b883f5e0", + "0xfd361bf0d07d395f46c80d99", + "0x095a417820f3873315d07801", + "0x2517e1c9b2fe99137385ed33", + "0xa36e4d4b5eb0555949c6c831", + "0x7b97da575f0d1e8ba1f2c6b4", + "0x60b1e84e6af688be7cd081b2", + "0xa6fc4b09d8d70c13f0179aad", + "0x72817c2876ba5ff61493ebf7", + "0x1ea4f251217af4856c39b92c", + "0xa367f2fffa3873a14b7a77c9", + "0x11523327e60286dec7d32935", + "0xa1b88d4cb20ba84e9d47f8d4", + "0x510eb5e1641c6ac557059f6d", + "0xb7fbac750a26a5c2be74ba4b", + "0xc12b589c238c57917e59eb93", + "0xe85fc8186680ae412fdd055d", + "0x73f2528521ef657a378f9eaa", + "0x1f3373c79890882156694efc", + "0x53d5baea63dff7255dc5457c", + "0x3e489a411496b9523e9f5f65", + "0x39fd804bbd9c41475c7b5835", + "0xcdfa49f0377ccaea0082febe", + "0x92cc439456b09b3f5ecaff18", + "0x1dbf016804e8c813474d4785", + "0xea60dec6f3717a24e8afaf49", + "0x25ead15b38edf41596c0d83e", + "0xde5280fc2e7167dd64a5c1b9", + "0xf7849ec76966c90b00d1aa36", + "0x4767ffb3c1d3f9846b7ec371", + "0x60c875f4f7160d9f2d2d30d4", + "0x6370b4d9c2b8389988d03afc", + "0x7bc990c52ddccfbfa82f9cda", + "0x681431fcf3205590d26cff4c", + "0xf592887261b6fffc52be6f6e", + "0xa73d1d2c00fb959828966c8a", + "0x04ab8600f88f40649e5c3b6f", + "0x0470dab703d8207792154b1d", + "0x769dca377261824aac13656c", + "0x2b802ffdc83f3402d674c986", + "0x0814a765b64909b0f5da988f", + "0x4a17b3379fe55567e7ca82a3", + "0xe51007d6950e7a3c9069c9c3", + "0x1a2c2aaa1f3fc1b03cf69210", + "0x23c59061678067c1c4740645", + "0x766c9a79c04a0cf1e008024c", + "0xe2e38964d425c600455689d0", + "0x3f5334f215ef3c14cdfbba90", + "0x29559e1c83dbc1a17ce30b66", + "0xcd32b276206d0d7b6af526e1", + "0xc791637398218f202ac7abb3", + "0xcdc094970b2287ffaa0fc9b5", + "0xedd0a4b0894a4cd97b18f6a9", + "0x7c5c2d4660753580b3af6ba9", + "0x50e54957dd259f8e8378d89a", + "0x0d0c0e40f841521399494cb3", + "0xdd546e4d7f2f342d47d29562", + "0x567c6d2d1d876a9715e500fc", + "0x0783a2e0d94f0e1fe4699b34", + "0x28e62938470cc646d4871f34", + "0x60c6e6195a48b6a1863a73d1", + "0xf836cff9fb270b3520cc6090", + "0x45b0caefc612ed2e471da905", + "0xd0e73cf3c4f02f7f656d792e", + "0xc508381108ae59b5de4093e3", + "0x4d05f9e9a94a2b4d3f7a6d31", + "0x0bbd75003dd9fb78c022fd9c", + "0x7e241f5575f6ae4918fc7ccc", + "0x597092507574c5adbba1a4ec", + "0x86cb7854bee5e16fa7b570bc", + "0x0192588a868de0659e785870", + "0x03a00c1cc18dfe79f14e434a", + "0x2a1361b3dc1ef6e09634bdf0", + "0xaa45d8fde7f52a3630306454", + "0xde3c106f889b5c74a444b3bc", + "0x20d1a424385755d189680f4a", + "0x81c93cea5d1e1a5c13415fdf", + "0x31010b49c0aad119b8539c02", + "0x5da0c57ac898f01c93999e6e", + "0xf229e2a48901479d08c81ebd", + "0x561833e27a3f3e84fb8ccc63", + "0x01107c5e96f978ba3637298f", + "0xb5e76bf65be0687376c17c04", + "0x38af91e24682831ba2ce450f", + "0x834980a06c97d3fd87295b86", + "0x61e8463f09598bdf40b4493e", + "0x1dad944e6b5c0b04c4385b08", + "0x0e57d4dcf8c9c63f5d99df6a", + "0xf747bea8b7cb8c966ebc32d3", + "0xd3c17bd9e18d620ae3361d46", + "0xf0617bf7d815c40c91663631", + "0x9652c28d3e9abb60e9e17546", + "0x35fc7e412fbe8ffbf6e5207f", + "0x45faba8365844030ef2d51fa", + "0xa4339f23ac0a87c6816243d9", + "0x06372f7c1a40a5d12507399e", + "0x70cc369f36985e2228147204", + "0x58355cd1c4deb65bda5f6e29", + "0xf7bf340ac5f313ca7c49cc6a", + "0x7d46a98a9ca69281c36b8a3c", + "0x0d2d26daa15313e82d61fc83", + "0x5d20ac008dcc94100e12a13c", + "0xe5aca64687644f53c46dcf07", + "0x9d29d5d785da0394497e450a", + "0x7786a358bc1a05e04a69e73a", + "0xa203b6b56cb59d5d146837ef", + "0x99fb56b05d33090837db910d", + "0x6c4ca110fb40300bc98a690b", + "0xa032a60888cc2d9532283b61", + "0x30fd8e23180bd5e9e50488dc", + "0x1afe67d938052482e5fd9082", + "0xae68a504eb76a1d971d415c2", + "0x5c9ad33d8b0bbe63b9ce0b40", + "0xa6eb4808683944767917fc0c", + "0xba09388004aa74ba6abd6383", + "0x37d875a3c608abdb4c578988", + "0xc3716ca67d3d06f2ad74727a", + "0x1b7906fa138fe8c2432bb59c", + "0x08f8ff20fde25c682c55e6c5", + "0xbd4dbf8450439364470d0a60", + "0x4e028eded88d2976290eee18", + "0x3d9cecadd672415e4505500d", + "0x775f2301aac8e0f7ff322134", + "0x7600ae819e1a590557fad0a1", + "0x86f4e94ea87a00449e48877e", + "0xc26f33ffea4ee6d5a4de0d6b", + "0x6547d932498aafe1ff14b4fd", + "0x01ece72893a7ae10d70f65ad", + "0x9e40515f5574eec9694c90fe", + "0xa782704f810305c1eab1d473", + "0xea560822d81cf32972e2ea38", + "0xd0dd41e204059a0b2097b5f2", + "0xd4f765d37d8158cea3e25bec", + "0x1d1bae42fdfc1804b4e062bf", + "0x18d69384bc855d067bb3544a", + "0x81ebee01df35f773169db87c", + "0xf5c8c120650b980f6cf9569a", + "0xb6ef1a4f09b78d9ac4880120", + "0x62e7830ea7ae4bf9f11fe729", + "0x1486871e5b1c000cc5d946c5", + "0x68542e8f5da6028ae876293f", + "0x3caeec0ca0e6695e6b38ede6", + "0x9ebb9fbe6cbdc3f48294fc39", + "0x7e7ba594a9e412eaf01dab16", + "0xbf2ff7155b9184fa679b9faf", + "0xaf77d6ea764bad12aa67a565", + "0x798291e56c1715b2f5ad3294", + "0x890e984adbc233599d7dcc27", + "0xa0fe753cf899184eeb631867", + "0xb7ea0d3016ca3fc8ee4ab0b1", + "0x372f23386db39612769ad955", + "0xa733dbd2e57f7f83f5cc7597", + "0xfbdd168fce0b635a7b166eaf", + "0x3a30616d6e38112d790f2c48", + "0x5df498f5e29733edaca12687", + "0x5a8d0af4e012806344838d57", + "0xabd2f035b3695d41ce46e08f", + "0xe744c2769faf8fb0c7cbc9e3", + "0x49a02dc7fee3b0a17be8eb20", + "0xada35645f87857889cf39bf2", + "0x4292c4acf13d5caf86552075", + "0x41c0b7df8d09a5c5f9e15801", + "0x90dc7fea192088de014b35b0", + "0x4687f475b8022ca4fa3ed15e", + "0x3dc70cc100760fc66e79c205", + "0x7d6341a01b7af87294728af2", + "0x930455a8ff04b0372432259c", + "0x8ffa1412f594ca11476bb72a", + "0x59bee3cffa65eb1be142ed3b", + "0x01821c40a872887d3640754d", + "0x9c85cf9eb256b4715b1ab99a", + "0x602863fd6750147ce89b531e", + "0xb017116d0bfe35eed3819ef6", + "0x588afc50606d03ee875c5959", + "0x1fbaa79b9e689496aa6efeb5", + "0x9ccd189c0ec214407ec4d44c", + "0x6ca4cc294ebfd272a242f3cc", + "0xd5a13fb4c0da1a78d5e82d63", + "0x9966f6c436d61ede741e333a", + "0x462c070f33511acf7b87e2d0", + "0x23feac740fcfe2c1e1b17a18", + "0xde09a276202b3633e5b01c85", + "0x1c42ac9f22c7045b44fa7d1f", + "0xcb98729691eb8a43e6165f49", + "0xde35e7da554b3abedea7d592", + "0x741663101d3623e1d367977a", + "0x6cd06f24b11c7b19e997c78f", + "0x94a5ec155367158c1a71dab4", + "0xa9df5a695a00e33e0b5e8091", + "0x619aa8beb234c859ee568074", + "0x8581f7cbd26ebe4601b28669", + "0x2bfd43612d100525958fc839", + "0x7a4788f87e9fdc970a2ec298", + "0x3a4752effda12a22f97e93ec", + "0x0214ffd71b67d7b0f8a92783", + "0x14772c1a9ff68df4372d1566", + "0x9135e0fe1f92a5695efc4f10", + "0x2bec5c394717d003dd2891dc", + "0x9e69a51eb4da51eeee224681", + "0x7f7e8f8e38380d83c40462bd", + "0x4068c79e26fd8fdf27980818", + "0x21c26ec572f713a78314b276", + "0x315db06abc79a6b0a0a74ddd", + "0x8ea752aa68712fbc66ec7998", + "0x384500805a5687721ee4d436", + "0x89f6f246346c56a51c1d3e3f", + "0x0cc81c00b09215a328561802", + "0x5484af2aa4d50de227171792", + "0xbc60ccc7528d1230ca8a0e59", + "0xe16e4512d65d57e73e61607d", + "0x0a3322cd383a54ffd7234e23", + "0xeeed8f5a7cbd5f6a1fab2e19", + "0xacd0b9f4fa8f1ee7642e487c", + "0xe0969f59b5b3a13f836d2f36", + "0x91098da89218eb05b4a79fb7", + "0xdbf8742fde665be09388fa26", + "0x23b2be2c87068597aceec4e4", + "0x246aa01437f527b0f077149a", + "0x2cd43cb6391f1e9580ceac48", + "0x9a64bbc98d58fc74ce7fe98d", + "0x4a65fb2fabd4aaeb0cf7474d", + "0x60b9cd1cba24352b4a55dd55", + "0x6b1084e53ea302e5de1b6e38", + "0x4da4d0028fdd41df099da36b", + "0xcb0a6b025a20972189f5bb5b", + "0xd38de75898c8097c28cbc83b", + "0x5a68b4b0e16aa5e1eece1f64", + "0xf51a5aacc3d1b0195d533baf", + "0xf8c85cc011efb415fdedb250", + "0x01a3fd4de1ef99a8feb967db", + "0x00b860306fd6d95f1ec68002", + "0xb12d79dbd66a082cdea2478d", + "0xc32dd35f8141d646ce0dbb8b", + "0x584f1f886a323bf2e8dee429", + "0x96c6372619780bc4bf40978a", + "0x91bc614b60fc6c3b7f3ad714", + "0xa238a28c5f744696b25fe3c4", + "0x2c6bdda7122bca6c265685d8", + "0x22d6054e38849c59891f5670", + "0x5db2a46bd3a5d8597f5a51a7", + "0x75fb58350a3824dce2635cb0", + "0x3c56ae2820eef8150c74363d", + "0xd6a731c76d454fce70911a61", + "0x1f32fbbcfe61fdbd345077c8", + "0x293e0c55c5112589c373a610", + "0x3e8e7b67d43ae0583b304342", + "0x908066a4b9081431073d55dc" + ] +} diff --git a/test/fixtures/erasure/full/ec-4104.json b/test/fixtures/erasure/full/ec-4104.json new file mode 100644 index 00000000..d68096f3 --- /dev/null +++ b/test/fixtures/erasure/full/ec-4104.json @@ -0,0 +1,1028 @@ +{ + "data": "0x63f12e1ea2a0e7883f81f2f87a705eba0e0b16316044fbf92bab9e578ea696321211e3ff7e51a5c5ddb793877c3f038416430a56a56b0ae0ce5274f1f4ca5dc89d7ef1dd2ec40ecb5087391e426f7e9879b73f66f5d01bb771cd898378682a0c7b69cc149ccfa18060da0215d2cadc699ffeb2a7f65d3e54df3559dca6c2fddd84323cb1574479cdf75bbefc6c71342a06fa091fa5b7f7e509257def0e9ec8835b66dde4f8c6338135f15984f5a52452fe67700bca54195eadb4ee773835f72b13a511256b18aa8dc51db66e5a3b7145a339ecc58bb894764596ec0c7988815b3081c2bf5f4626d77f0c4d86260e5f4489a2bdb19da024824e6c4e964725bf588b5b9688a8c7ce9536d6c8bf7e2ae98c2b25b5035f98dcd76765d668a4e8dfe4904462973e6d60451af1c7168b2c45ccd34551c88589ee6bb2ff19fab7a95352dd97e4bdb32d36e074ef6031051069385652ec51507ac8b23df5e836192219674de69446167da079a274253bede779c5a21b40f66ced8723285189823eba552cec3a3bf50142bfbb612a673b52de19fbcc445c47be851a65cdcff649c451f6275d274e1ebb9f2d0438a863c315c26c6ced473b9216181ef83c9a8556e29b03be6687f37ae676f119927286d428a0b1280fbf8db7ca6141339a543576233ef5fe6ded544fe4bdd101dd001fb184ab9e46d1cc65c0716e600c06106d9b3f271c9a6b186562b43e1676a7aa6269cd78fefc7086305407b363c2cddddb36e6229d5d82f102f04e4845a0798b78cbafb6f82f07062b76f041a93a95ee9975c7f0c901f39db49681adf0f2d025ab968135ea655deb2a869ac228e5be393aaa2276fd9492902b346c5e38ea9b2303ab81a5a5a193e926b9ec573f7d3c382eaa9043247d84fc5b197de5188717525a0fb30124a9905259ff2b569f1741275953e6182590e3c88282d21b4f0bd2f81a31d5241765f88dd3e7e184c258207c184cd0ec2bad9be983f94f0cba311c21079fc067c7d9772be698e208ab9a57a34bf8e6a9f1e0c3237de1678023f784af171067fba277f2cba8f5bccc1a2a5fa498f888f725b2e3f9d2161f676aad58fe831b9e9ccae5d21b26521666dce91cb8fdf53f6a1946106a1839ffad76a329e7812defa9e4933e26ea49636e15c97b490acb5c35c0268b8e6a2ac3e2ebcba84407621fe2960901c72cb29ab40f8fd8dc34cac6ffcba7679165df6937bed26474d17540ef2a9d86447a83ae55231b530afa089be699f7342420bb4d70c101d3f350f3923ab858c014aeb547a1232a104ab7f4b9b78dc45d85a6caefc5c2e9e7d324999dbc9e38d234d7ebe028f8540db25034572af2fc99b7d6589010fdf41a9e057b91d9e78c5966691975eedf6fb136691cd78257ce34859f29dc849190889d8b6d41a9db84eee8cf30cc7b54eeb7801e2128ea04cca32cec6dc579926e0bb142da47dede22d73f60e57d837b0e0512cffe58e4152ef77af9f7c24f7c31315388d345a52d8590f91ec198d42c464f487c58d8c7201a4debbc94cdc8a221c355aa69b68a7fc83240860663278b595164a8b081a9b7348bea62373320e93c5880e277b5b3003ef9c98a07ff806d50536215192619a7a2e514ac5129d73b553cf8ca5d471e54c3fc65ff178327bbed87f52026ec3e3605bb9fd0fd84b00e018a38a9064a97d6d1d241d5520f4706e1f151e17b77499619cfb9c3aa7a0f57c7cc5b971281b87a86a3527afd53a7ff21e7e32eee1f336393d2e1022f4e0632bad8ef7dcf09f3aeb82f764480f034a9a3b643e994ae22877c2941550889d52248a823a740cb67d2d79e226034f27435e2d1d2f9e6a42fae82df275d05534825633d037744e5751a9853fe554cc7b9743f9800ccb20a9631d4ab045a839321bafe5c1698ed8aae93a21c93a912e2d482f3d7c0d92946f2233bc15d1935371f5b7bfa5cbcca3ca8b30772108821ef8a27f29d4e309483acf21349beaf8cc76451c8a4a07af5f8a992a9f3cd1b8f25d95f88826e80673b5f7fe45b77511ad1083e5c5110b3828aca2e15d3d601a09f2d0b21b2533cec8513cffc3be24af44fe7134c1d7f309d30727724eae89b5b9d1773b87a7fa81a02193e779c426e3eb46213dc1d99c8d7005f97bd13be31966ac220ff272dbe6c0839a508ea2c138c71ae2d4b273ea4c56471b698b18bf3c171ce6cf6cc997a31280a6576a2efc9ed5b377346ebd0726a3e5c8cc36a259f74c47241fcef495bdf894fedb7a0580ed95d051f57b9e4f129ee5b7a76dd268c314ddfd184ba513880b42c5a1de2200cfe5a295bd5e21af1536638eabca61f8ec6d60bbc82faef866b297b153f9958beb2db338e4c4fc591623e3e928eab60ee961c78d1a1236d852beeedc42c3c239f08a1d4087ddce7dbeca173db068c1740695ac1619b6aad787d09a0a5d39407a9ce4dabdafab3579c9ba43aef70de838c8a820599ef5b555ee641e7110b62be9280e7d2c9b9a4a2f666a2667f19e8681be6b36654729f1fbb584da74263201dec014862071988439e200e2e5ee1de0db4366391a2839946aae0cf1686732bd409e3a7d4d33cecc1197b391c311b8f93ff50a64b3382b755f5f498059ef780d529043bd7434740c31ef5d5e53b9ee2b96c7e397bbe943915c019d30b8408f7d3d84d04127a6783a2a1203583d684a1abdbdd4e8b83514c123e37cc78fbc235ca2090e5de89aac1577f10df8c4a1b820a0c37a4d61dc3617a7919978956ca79ecf321cec778853634d50f1c9647a8e0b362fa23d4084f9fdf8dbede501239d68642edded8381d41c12b947366f3d5009c5da28d521505eeaa5d9ad39cf57728fe071f3976303fe686ed17cccd1895630dcbdd9c6461066a15f393a5735b61cf4d9b1d053e6bb33573500aeab66ca976b4c56ad6d3fc895d34a68f509fd4ae46477415e35bc0e4474f175c2c8f6d74e4435042eae203212348b2b2877a82076d61da455e9f84dc8fa22d2eaf0ca6573451cba54289117b8da967ef29ccd8ff990361d35415685db4d78b0d94cdef63ee1cc82e29ddf4d6d2821f12e534262e954e04fc8947bc20493e0f66e3314f2e693508b4f8321ef0a4e842b7cd2469d85d65e4ce5f3239ef541f66e27d44feba656abb57e0fde2ef6fc849941a95642d7a9a7e43de2186e54d686f181f93506617ea5f6be3e8cb2e4ac54216b523f343c90077d123fd8be1e1cb7be30d241bd9dcc7b9299f7a033e5651f47c167d9e85a2a4a6a6a237994c13998555c0812458a41bb0cc30e372163e1526269619dcc96e3c663257ca8dce809fee9e94908f9138c6c3462fa9cbaeed8e0de13edf863626279d23c011f00e5a72f87d250bb3ea6f97c4f3fd8f6674ce51bf923b82ed116a1a1b08735fe2569e11e3ff0b24f63c51934bba3b5dcc8ab57be9dab9708871dd2832bc577c9a3ad97b1a42d53c3c95734dd6c90a2feee0231063a7b441bc6f6bc706e717b4c5bc1cf49f026e346bf0c85b38ec4979ba2b2a9dca8dfb1aa45df73ea3af1242753603d739e3c541b43772802fbf735887b83db0910af46209afcc8e3fa523a913eb8acb53fd49994bf58e6c868fc121b8c23402d9dafea7e8911e2f305c96281a37c4670edbd8813079d59587f4accb1d66ccc6e80d7bc6d1480ca99f46066e7ab4c8d2bd325d81abdf8bc3338015d0925dca623d35102145089f752ae8379d37465224d97893cab7f8605c59b7acb98807a20e15af94cb2ef26c0a0a7ebb98f9b5f1bf96d8c4c16845e15b2d3dd07c5ad8f76c06182a1995a2f1714bf593a04fe2c2eeaf61f5ab276465c1213ecfb515b03aba4b875b1775beadec6dfd0405b41623827dcf44de910aff3d95a0496ea5a1b50ccd12066b8d5c254c25752c470209c1e0edbcac72c2486707864ca072782aca521892bb9cafa90e6c6d79d7fd06bf99910e3df8a3f509d330d248fcf3411a3787bd2ac144e018f3fdac4049f080372f7e65690dd9a64ea43763724f8338ea0b2a074889e6e35ce6981597a663742d87f5edf2782a45c0660fb25dc0eeb0bea86fa83d16ae07f1054f677fc12eb1431f8868ba507d57355ec795cd405910bc80e1f27fc63f1dd2d09cb8593f4270f25f8b638c71fa63b674c6f346854755c1865ebdbce699d6dda2e8a5c7d4a9f3a774d3d45321d5e1cd5f0d028ff30635c802478b930f7dbddaa877d8e4fe119cc5c3e869a70f27e9d47fb6044d29482bde296b51c55f5fbb3075919e8b8fb80b692a98e45a7696cfb912298c0898cd41b98730e08a66e7706123e31f3c90b4d607c589fbfc14eae2931935b03fe84928fd70e90fce7958bccfafecad8f9237f184495b955004b02d7c92a2b6a5c241e37a6c2637e2c01e0b2c5c81f8d07fb64d5baad4bad7067943c7a110e20b5cea067d912f5d4eb7d3128fd8c68da57fb68288555c116a8ebdf94e4026c1692d90ac93e8d792ad6860fce3d2c8849db61064b6b5682127f09825bf7680cd273d74b70e46f042deb83962faeda909750ae6d429b1162106525315f81bd061bd0bbebc16589a87edb1c71c987f80ee2f1675617bdde6c1d6f85bb9004d4951dcf8266bcb1164243dfe60feeaaba4fcf2e8d8686bc3d1e73a4aecf90cd5b5e124f94fd8b4b89bade89c793998e6c5d4394465a76cef2a52b288dfea005a7d5a576bb9c6c9343b39c97746ffa2cd3740ef34db42fff51a63379a4ba1385fe10088a1833bea7234c122c3dda944dcbdbeb00eb8bd67a3d3bb2936d9341ecdb8ea74063bbc11ed31e0b32205578f00757d7e746cd2c3b14e8741506da8bcb0de7684d2f7854070ca6018afefa6e296ffa288bb30e59e4b693c8f546989c779634eda687bd6aeb5e5c2634411aed4491e4c58dc8be585c8f42a693fda293476016427baef71c9e0dab0796af622b8c888b18e37bbe0eab92b578f25ffb9b42e58836f89814d11debca556a96eae1b05dc04836cde866e474f2520945ccc7c4996dc0ea460b82ab566c2771f5914cce9feb2f358641544bbce8535f395645742d518a5c706d9518253683c89fa8e8a5049f6cf88fb84b08f48a0837b93705f20090812aa69e97bad7610d9d86f1f09c402186b37f4c15220d2822ee7dcabc53f072516425d181c32b4f9f0bebf99edf16541c153a326629065cd6850a459f3925d8a61a4f66228d46b8d0e299591a28611552591b203e481ac8f4c61f0c19c31a711b6d3a057da106857ac6f90c886c598b66e84c8c7d039d9bd3a1a67bb93eadd19c47e2e1814a259ec819c39afe7126d1349a3e908449e689e6f1e81bdfd8f3a0af1094bd69b6ef8f3f0b0f89aceeb1550da9739a4ce73195277af69f7ffe074607a8d7b08db125bf2d69d855fea71fed8f59c1130e2378e64a3be68b78153857f2d57e3747369855e2090a24a40ce91a9a8b8fca6aafcca0b3da5852d8a6751cb610883d81936ed02ff275b85e8f9ea30b689a8cdff28922a26d005d83b2671c401a20c7fa20151c7cf8e1a01548e0e8d3751792c70bad435c21f3ffc5a97b310461c62dd5505c24344db70bb949204af8b93549f51d6e3845474d03331ef770cb3c4f03a4752b91c0e61f351a05f6ddb23d1990e068ee0df008a6ce503f2e6f78802f0ef7bbe0a5dc5ab1f0c1a05bba847a01fa8d694a27d65d5275870ec4d27ef70fe797c3909c1c3024326655ba3096f1885c84dbd165322d8ce32e57966bc36930c54727cc9ee967fb6adc419b33581102860c968b6e65743b806d7afae291af42ebeb1b02b1f16a0adfeefbfcee24ac859ab8a", + "shards": [ + "0x63f12e1ea2a0e7883f81f2f8", + "0x7a705eba0e0b16316044fbf9", + "0x2bab9e578ea696321211e3ff", + "0x7e51a5c5ddb793877c3f0384", + "0x16430a56a56b0ae0ce5274f1", + "0xf4ca5dc89d7ef1dd2ec40ecb", + "0x5087391e426f7e9879b73f66", + "0xf5d01bb771cd898378682a0c", + "0x7b69cc149ccfa18060da0215", + "0xd2cadc699ffeb2a7f65d3e54", + "0xdf3559dca6c2fddd84323cb1", + "0x574479cdf75bbefc6c71342a", + "0x06fa091fa5b7f7e509257def", + "0x0e9ec8835b66dde4f8c63381", + "0x35f15984f5a52452fe67700b", + "0xca54195eadb4ee773835f72b", + "0x13a511256b18aa8dc51db66e", + "0x5a3b7145a339ecc58bb89476", + "0x4596ec0c7988815b3081c2bf", + "0x5f4626d77f0c4d86260e5f44", + "0x89a2bdb19da024824e6c4e96", + "0x4725bf588b5b9688a8c7ce95", + "0x36d6c8bf7e2ae98c2b25b503", + "0x5f98dcd76765d668a4e8dfe4", + "0x904462973e6d60451af1c716", + "0x8b2c45ccd34551c88589ee6b", + "0xb2ff19fab7a95352dd97e4bd", + "0xb32d36e074ef603105106938", + "0x5652ec51507ac8b23df5e836", + "0x192219674de69446167da079", + "0xa274253bede779c5a21b40f6", + "0x6ced8723285189823eba552c", + "0xec3a3bf50142bfbb612a673b", + "0x52de19fbcc445c47be851a65", + "0xcdcff649c451f6275d274e1e", + "0xbb9f2d0438a863c315c26c6c", + "0xed473b9216181ef83c9a8556", + "0xe29b03be6687f37ae676f119", + "0x927286d428a0b1280fbf8db7", + "0xca6141339a543576233ef5fe", + "0x6ded544fe4bdd101dd001fb1", + "0x84ab9e46d1cc65c0716e600c", + "0x06106d9b3f271c9a6b186562", + "0xb43e1676a7aa6269cd78fefc", + "0x7086305407b363c2cddddb36", + "0xe6229d5d82f102f04e4845a0", + "0x798b78cbafb6f82f07062b76", + "0xf041a93a95ee9975c7f0c901", + "0xf39db49681adf0f2d025ab96", + "0x8135ea655deb2a869ac228e5", + "0xbe393aaa2276fd9492902b34", + "0x6c5e38ea9b2303ab81a5a5a1", + "0x93e926b9ec573f7d3c382eaa", + "0x9043247d84fc5b197de51887", + "0x17525a0fb30124a9905259ff", + "0x2b569f1741275953e6182590", + "0xe3c88282d21b4f0bd2f81a31", + "0xd5241765f88dd3e7e184c258", + "0x207c184cd0ec2bad9be983f9", + "0x4f0cba311c21079fc067c7d9", + "0x772be698e208ab9a57a34bf8", + "0xe6a9f1e0c3237de1678023f7", + "0x84af171067fba277f2cba8f5", + "0xbccc1a2a5fa498f888f725b2", + "0xe3f9d2161f676aad58fe831b", + "0x9e9ccae5d21b26521666dce9", + "0x1cb8fdf53f6a1946106a1839", + "0xffad76a329e7812defa9e493", + "0x3e26ea49636e15c97b490acb", + "0x5c35c0268b8e6a2ac3e2ebcb", + "0xa84407621fe2960901c72cb2", + "0x9ab40f8fd8dc34cac6ffcba7", + "0x679165df6937bed26474d175", + "0x40ef2a9d86447a83ae55231b", + "0x530afa089be699f7342420bb", + "0x4d70c101d3f350f3923ab858", + "0xc014aeb547a1232a104ab7f4", + "0xb9b78dc45d85a6caefc5c2e9", + "0xe7d324999dbc9e38d234d7eb", + "0xe028f8540db25034572af2fc", + "0x99b7d6589010fdf41a9e057b", + "0x91d9e78c5966691975eedf6f", + "0xb136691cd78257ce34859f29", + "0xdc849190889d8b6d41a9db84", + "0xeee8cf30cc7b54eeb7801e21", + "0x28ea04cca32cec6dc579926e", + "0x0bb142da47dede22d73f60e5", + "0x7d837b0e0512cffe58e4152e", + "0xf77af9f7c24f7c31315388d3", + "0x45a52d8590f91ec198d42c46", + "0x4f487c58d8c7201a4debbc94", + "0xcdc8a221c355aa69b68a7fc8", + "0x3240860663278b595164a8b0", + "0x81a9b7348bea62373320e93c", + "0x5880e277b5b3003ef9c98a07", + "0xff806d50536215192619a7a2", + "0xe514ac5129d73b553cf8ca5d", + "0x471e54c3fc65ff178327bbed", + "0x87f52026ec3e3605bb9fd0fd", + "0x84b00e018a38a9064a97d6d1", + "0xd241d5520f4706e1f151e17b", + "0x77499619cfb9c3aa7a0f57c7", + "0xcc5b971281b87a86a3527afd", + "0x53a7ff21e7e32eee1f336393", + "0xd2e1022f4e0632bad8ef7dcf", + "0x09f3aeb82f764480f034a9a3", + "0xb643e994ae22877c29415508", + "0x89d52248a823a740cb67d2d7", + "0x9e226034f27435e2d1d2f9e6", + "0xa42fae82df275d0553482563", + "0x3d037744e5751a9853fe554c", + "0xc7b9743f9800ccb20a9631d4", + "0xab045a839321bafe5c1698ed", + "0x8aae93a21c93a912e2d482f3", + "0xd7c0d92946f2233bc15d1935", + "0x371f5b7bfa5cbcca3ca8b307", + "0x72108821ef8a27f29d4e3094", + "0x83acf21349beaf8cc76451c8", + "0xa4a07af5f8a992a9f3cd1b8f", + "0x25d95f88826e80673b5f7fe4", + "0x5b77511ad1083e5c5110b382", + "0x8aca2e15d3d601a09f2d0b21", + "0xb2533cec8513cffc3be24af4", + "0x4fe7134c1d7f309d30727724", + "0xeae89b5b9d1773b87a7fa81a", + "0x02193e779c426e3eb46213dc", + "0x1d99c8d7005f97bd13be3196", + "0x6ac220ff272dbe6c0839a508", + "0xea2c138c71ae2d4b273ea4c5", + "0x6471b698b18bf3c171ce6cf6", + "0xcc997a31280a6576a2efc9ed", + "0x5b377346ebd0726a3e5c8cc3", + "0x6a259f74c47241fcef495bdf", + "0x894fedb7a0580ed95d051f57", + "0xb9e4f129ee5b7a76dd268c31", + "0x4ddfd184ba513880b42c5a1d", + "0xe2200cfe5a295bd5e21af153", + "0x6638eabca61f8ec6d60bbc82", + "0xfaef866b297b153f9958beb2", + "0xdb338e4c4fc591623e3e928e", + "0xab60ee961c78d1a1236d852b", + "0xeeedc42c3c239f08a1d4087d", + "0xdce7dbeca173db068c174069", + "0x5ac1619b6aad787d09a0a5d3", + "0x9407a9ce4dabdafab3579c9b", + "0xa43aef70de838c8a820599ef", + "0x5b555ee641e7110b62be9280", + "0xe7d2c9b9a4a2f666a2667f19", + "0xe8681be6b36654729f1fbb58", + "0x4da74263201dec0148620719", + "0x88439e200e2e5ee1de0db436", + "0x6391a2839946aae0cf168673", + "0x2bd409e3a7d4d33cecc1197b", + "0x391c311b8f93ff50a64b3382", + "0xb755f5f498059ef780d52904", + "0x3bd7434740c31ef5d5e53b9e", + "0xe2b96c7e397bbe943915c019", + "0xd30b8408f7d3d84d04127a67", + "0x83a2a1203583d684a1abdbdd", + "0x4e8b83514c123e37cc78fbc2", + "0x35ca2090e5de89aac1577f10", + "0xdf8c4a1b820a0c37a4d61dc3", + "0x617a7919978956ca79ecf321", + "0xcec778853634d50f1c9647a8", + "0xe0b362fa23d4084f9fdf8dbe", + "0xde501239d68642edded8381d", + "0x41c12b947366f3d5009c5da2", + "0x8d521505eeaa5d9ad39cf577", + "0x28fe071f3976303fe686ed17", + "0xcccd1895630dcbdd9c646106", + "0x6a15f393a5735b61cf4d9b1d", + "0x053e6bb33573500aeab66ca9", + "0x76b4c56ad6d3fc895d34a68f", + "0x509fd4ae46477415e35bc0e4", + "0x474f175c2c8f6d74e4435042", + "0xeae203212348b2b2877a8207", + "0x6d61da455e9f84dc8fa22d2e", + "0xaf0ca6573451cba54289117b", + "0x8da967ef29ccd8ff990361d3", + "0x5415685db4d78b0d94cdef63", + "0xee1cc82e29ddf4d6d2821f12", + "0xe534262e954e04fc8947bc20", + "0x493e0f66e3314f2e693508b4", + "0xf8321ef0a4e842b7cd2469d8", + "0x5d65e4ce5f3239ef541f66e2", + "0x7d44feba656abb57e0fde2ef", + "0x6fc849941a95642d7a9a7e43", + "0xde2186e54d686f181f935066", + "0x17ea5f6be3e8cb2e4ac54216", + "0xb523f343c90077d123fd8be1", + "0xe1cb7be30d241bd9dcc7b929", + "0x9f7a033e5651f47c167d9e85", + "0xa2a4a6a6a237994c13998555", + "0xc0812458a41bb0cc30e37216", + "0x3e1526269619dcc96e3c6632", + "0x57ca8dce809fee9e94908f91", + "0x38c6c3462fa9cbaeed8e0de1", + "0x3edf863626279d23c011f00e", + "0x5a72f87d250bb3ea6f97c4f3", + "0xfd8f6674ce51bf923b82ed11", + "0x6a1a1b08735fe2569e11e3ff", + "0x0b24f63c51934bba3b5dcc8a", + "0xb57be9dab9708871dd2832bc", + "0x577c9a3ad97b1a42d53c3c95", + "0x734dd6c90a2feee0231063a7", + "0xb441bc6f6bc706e717b4c5bc", + "0x1cf49f026e346bf0c85b38ec", + "0x4979ba2b2a9dca8dfb1aa45d", + "0xf73ea3af1242753603d739e3", + "0xc541b43772802fbf735887b8", + "0x3db0910af46209afcc8e3fa5", + "0x23a913eb8acb53fd49994bf5", + "0x8e6c868fc121b8c23402d9da", + "0xfea7e8911e2f305c96281a37", + "0xc4670edbd8813079d59587f4", + "0xaccb1d66ccc6e80d7bc6d148", + "0x0ca99f46066e7ab4c8d2bd32", + "0x5d81abdf8bc3338015d0925d", + "0xca623d35102145089f752ae8", + "0x379d37465224d97893cab7f8", + "0x605c59b7acb98807a20e15af", + "0x94cb2ef26c0a0a7ebb98f9b5", + "0xf1bf96d8c4c16845e15b2d3d", + "0xd07c5ad8f76c06182a1995a2", + "0xf1714bf593a04fe2c2eeaf61", + "0xf5ab276465c1213ecfb515b0", + "0x3aba4b875b1775beadec6dfd", + "0x0405b41623827dcf44de910a", + "0xff3d95a0496ea5a1b50ccd12", + "0x066b8d5c254c25752c470209", + "0xc1e0edbcac72c2486707864c", + "0xa072782aca521892bb9cafa9", + "0x0e6c6d79d7fd06bf99910e3d", + "0xf8a3f509d330d248fcf3411a", + "0x3787bd2ac144e018f3fdac40", + "0x49f080372f7e65690dd9a64e", + "0xa43763724f8338ea0b2a0748", + "0x89e6e35ce6981597a663742d", + "0x87f5edf2782a45c0660fb25d", + "0xc0eeb0bea86fa83d16ae07f1", + "0x054f677fc12eb1431f8868ba", + "0x507d57355ec795cd405910bc", + "0x80e1f27fc63f1dd2d09cb859", + "0x3f4270f25f8b638c71fa63b6", + "0x74c6f346854755c1865ebdbc", + "0xe699d6dda2e8a5c7d4a9f3a7", + "0x74d3d45321d5e1cd5f0d028f", + "0xf30635c802478b930f7dbdda", + "0xa877d8e4fe119cc5c3e869a7", + "0x0f27e9d47fb6044d29482bde", + "0x296b51c55f5fbb3075919e8b", + "0x8fb80b692a98e45a7696cfb9", + "0x12298c0898cd41b98730e08a", + "0x66e7706123e31f3c90b4d607", + "0xc589fbfc14eae2931935b03f", + "0xe84928fd70e90fce7958bccf", + "0xafecad8f9237f184495b9550", + "0x04b02d7c92a2b6a5c241e37a", + "0x6c2637e2c01e0b2c5c81f8d0", + "0x7fb64d5baad4bad7067943c7", + "0xa110e20b5cea067d912f5d4e", + "0xb7d3128fd8c68da57fb68288", + "0x555c116a8ebdf94e4026c169", + "0x2d90ac93e8d792ad6860fce3", + "0xd2c8849db61064b6b5682127", + "0xf09825bf7680cd273d74b70e", + "0x46f042deb83962faeda90975", + "0x0ae6d429b1162106525315f8", + "0x1bd061bd0bbebc16589a87ed", + "0xb1c71c987f80ee2f1675617b", + "0xdde6c1d6f85bb9004d4951dc", + "0xf8266bcb1164243dfe60feea", + "0xaba4fcf2e8d8686bc3d1e73a", + "0x4aecf90cd5b5e124f94fd8b4", + "0xb89bade89c793998e6c5d439", + "0x4465a76cef2a52b288dfea00", + "0x5a7d5a576bb9c6c9343b39c9", + "0x7746ffa2cd3740ef34db42ff", + "0xf51a63379a4ba1385fe10088", + "0xa1833bea7234c122c3dda944", + "0xdcbdbeb00eb8bd67a3d3bb29", + "0x36d9341ecdb8ea74063bbc11", + "0xed31e0b32205578f00757d7e", + "0x746cd2c3b14e8741506da8bc", + "0xb0de7684d2f7854070ca6018", + "0xafefa6e296ffa288bb30e59e", + "0x4b693c8f546989c779634eda", + "0x687bd6aeb5e5c2634411aed4", + "0x491e4c58dc8be585c8f42a69", + "0x3fda293476016427baef71c9", + "0xe0dab0796af622b8c888b18e", + "0x37bbe0eab92b578f25ffb9b4", + "0x2e58836f89814d11debca556", + "0xa96eae1b05dc04836cde866e", + "0x474f2520945ccc7c4996dc0e", + "0xa460b82ab566c2771f5914cc", + "0xe9feb2f358641544bbce8535", + "0xf395645742d518a5c706d951", + "0x8253683c89fa8e8a5049f6cf", + "0x88fb84b08f48a0837b93705f", + "0x20090812aa69e97bad7610d9", + "0xd86f1f09c402186b37f4c152", + "0x20d2822ee7dcabc53f072516", + "0x425d181c32b4f9f0bebf99ed", + "0xf16541c153a326629065cd68", + "0x50a459f3925d8a61a4f66228", + "0xd46b8d0e299591a286115525", + "0x91b203e481ac8f4c61f0c19c", + "0x31a711b6d3a057da106857ac", + "0x6f90c886c598b66e84c8c7d0", + "0x39d9bd3a1a67bb93eadd19c4", + "0x7e2e1814a259ec819c39afe7", + "0x126d1349a3e908449e689e6f", + "0x1e81bdfd8f3a0af1094bd69b", + "0x6ef8f3f0b0f89aceeb1550da", + "0x9739a4ce73195277af69f7ff", + "0xe074607a8d7b08db125bf2d6", + "0x9d855fea71fed8f59c1130e2", + "0x378e64a3be68b78153857f2d", + "0x57e3747369855e2090a24a40", + "0xce91a9a8b8fca6aafcca0b3d", + "0xa5852d8a6751cb610883d819", + "0x36ed02ff275b85e8f9ea30b6", + "0x89a8cdff28922a26d005d83b", + "0x2671c401a20c7fa20151c7cf", + "0x8e1a01548e0e8d3751792c70", + "0xbad435c21f3ffc5a97b31046", + "0x1c62dd5505c24344db70bb94", + "0x9204af8b93549f51d6e38454", + "0x74d03331ef770cb3c4f03a47", + "0x52b91c0e61f351a05f6ddb23", + "0xd1990e068ee0df008a6ce503", + "0xf2e6f78802f0ef7bbe0a5dc5", + "0xab1f0c1a05bba847a01fa8d6", + "0x94a27d65d5275870ec4d27ef", + "0x70fe797c3909c1c302432665", + "0x5ba3096f1885c84dbd165322", + "0xd8ce32e57966bc36930c5472", + "0x7cc9ee967fb6adc419b33581", + "0x102860c968b6e65743b806d7", + "0xafae291af42ebeb1b02b1f16", + "0xa0adfeefbfcee24ac859ab8a", + "0x3a409c4f4b2633668ed7245c", + "0x54bf1e438f0251316410e953", + "0x0d4647474383c08e3099a694", + "0x4039c2c81aeb62f74c6c0f9f", + "0xbe24ccd16c4be6eb08a145ea", + "0x80273daeab001f8004729544", + "0x3f5ee47bdf2c700831d91161", + "0x48c71907b74ae2d41e0096d2", + "0xf255e5232388f047a9cbe0c7", + "0x465773c49b84f825801a5089", + "0x20cf8aef0f15983eced42d8c", + "0xf35a41fc8827761159dee148", + "0x7d448dd1f19e98098ad56283", + "0x66a46023b77c7ada0198d7e3", + "0xabbe7844be83bb2001db2954", + "0x5dab903d639b1810781f448b", + "0x39cefb6a2b8de05872ca6d16", + "0xa6fc1992d54bc6ac8908e51a", + "0xf906f1172958761abae718e7", + "0xdc5008bc12f70d31dd1bff52", + "0x1fc23f11c2091b42896efb24", + "0xba895a09d1b633c175f752c4", + "0x072438cfd237e39bab50212c", + "0x358e5eca7cc11d2bd6816a66", + "0xc8aeaeec2711f320ba964153", + "0x2a18974a0394af067e4d9456", + "0xc52c3de936197d2acf0266c9", + "0x64ec041da473efb85f9c6ce1", + "0x1c8a36b1b55c4c748dca106d", + "0xc8bbe66e91f9e793b5bd3f78", + "0x0dac4a542cdedebf01f091b7", + "0x0c53923da85e40c95fa98369", + "0xf7496d93a52b1852e3846e60", + "0xeefbf3dc1b15123cbd34bbd0", + "0x8bd55db1bd7a5100d7cdb190", + "0x15d5a4a486573ec226809c6e", + "0x7dee992667e6b29aad21fea9", + "0xf5fe22541ece571c516c0827", + "0x17e97f6f9d0f19589b4fc539", + "0x2936a16b54e1a60f252a833c", + "0xf84ded7734c11f1d637b943b", + "0x68a1d604c4d7c4870f7e5bbc", + "0x79e9aea937916fdaecbc6bf1", + "0xd5ca0753a7cc0c4d434f7a60", + "0x6be2cc957694116447f82d4f", + "0xb4fdec4bf50a11242ca3a82c", + "0x53da7b27488287816d3f5cc7", + "0x9a5c2f2d2062a12107715563", + "0xcae2396a9eb584113d95004d", + "0x7e72a219adbb967348b1d1f4", + "0x3ad2fbe0677c04fb19314987", + "0x004371ed34afa262515f2125", + "0x3609b2aa23db3aa0b25e723b", + "0x910a6d4444e129d0ee8db2c8", + "0xc56a979fd605362903ccc2a1", + "0xf2ceb17d90d442ab63d55562", + "0x656b60de2ecf4b11a3f7ab64", + "0x8eb8c1233011138b165ac763", + "0x704e83e50db86dd0c1a31b98", + "0x1e7e40670a900aad2f79c93e", + "0xd5f230352b3b4b2185133fa2", + "0x595cf3a4b6f86bd8b2d16008", + "0x6bea554d450b1211ef8a1f63", + "0x2fddd0ccb9d6f143a15740bf", + "0x2324af9e38d423dc6ebe23cc", + "0xd6d7217782027ec002b299dc", + "0x98ea8daa73f6916e7226e2be", + "0x1fd8f88bb045b5e302a75c34", + "0xb71e262c27b50c199929a422", + "0xfb8c4272bcb0fdfbaf04cdf2", + "0x4d9c62b5b479e3ee697daaf2", + "0xacbaad0359b55c0cd4f13885", + "0x0f0b1d3477fdfc8d466dc7c5", + "0xa384c7e1e1303812ad3221e0", + "0x058059e01d086f807a1c45f2", + "0x29bf1ba038dd7c8e0cd96b1b", + "0x4a822f9903b36966baef0d7a", + "0x8d7dc4065952c5442a522516", + "0xe7f4ed377be071a0f00ff90d", + "0x287ef633c43932edac5ef16a", + "0x7f28b1a6219c82b0362c19ad", + "0xb7ee1e1e3226bdba81ae7e82", + "0xbecc2bb2a6114e0b5fd5fbe6", + "0x2c1fc4d9d10134cce07b0774", + "0xf2dea88e860840ee54742c47", + "0xfc7ab7d3df6f403eba34fbdb", + "0x04c29619ce846eb0f21d49cf", + "0x248d56c40b649c550a3d5cc2", + "0x7eeaf356383e417b04a17336", + "0xbb6861d4b26538aff3524700", + "0x11ff9dd63320a56a74ba84b6", + "0x8aac83bda4495a4178aa6960", + "0x29ce1157a2190d221905ab9f", + "0x6ce9ae01ea3628c713716b08", + "0x0de562cc3c1faa7fa8fbc556", + "0x789b20dc5d5cb81af8f60ab5", + "0xa6d6a7587b7f16891fb9374e", + "0x7279e15872ff2f45137bc7bd", + "0xd274fb9b51212e1d6b8d2ecf", + "0xf1724d8fd880fe545b21749b", + "0xf678d9e607d268f63e23026c", + "0x96f3c801efef07f18ecc3cd2", + "0x54041badb04102140b0f40fc", + "0x80032b9e04240c5fc30fe543", + "0xa92ee9348b5cb97819b9ef87", + "0x295428bdacc3070b670029b7", + "0xdadbf350bd4c2f26a7c6d0fe", + "0xb92b824428574252bf9109ae", + "0x54eb7b8f172bc40ab10138d2", + "0xec1bc25df647d74eab4441cc", + "0xb7d591bddffd4c1a9de31c67", + "0xebc923ca1be41c83729fc439", + "0x70cd1831ae5bd1a841bbe66b", + "0x00ff259f3de7b21496c512aa", + "0xe0a4d38db0664a1af93c5b5f", + "0x4d0921ac087a9b702c95f15a", + "0x39352de2e7f78845cfd17daf", + "0x0a67e8d5bdc5c8b9626c8861", + "0x26740df9dd60398b6c1dc3cb", + "0x947d9ec288102be0cb71f574", + "0x51cec079bbdc620be2585b8f", + "0x261ce5b2b72d7349a25b30f2", + "0x5d2345a4eba3dfb523547dc3", + "0x7306a0ee23951b0d0d383020", + "0x35731d88cb1a86ce3258934c", + "0xf54597581d8bce2cb576d767", + "0x27af2aaa9fe464d9d6410ede", + "0xdddaf47a99a46d7b2768200f", + "0xae098864902afba0164d2268", + "0x3fe0d3feb9d2006e851a6ee3", + "0x106d0f811cfc8a47ec694305", + "0xdac62018ececa2dc38161be3", + "0xb97c0a40d0c65a4f712537b5", + "0x6e0eb98ce5662df5965b7861", + "0xf36b69bf8d4f44e8c4193cc1", + "0x2edb7cd65f513ce1fc5b3e55", + "0xa8390b50bef4a460a98d8333", + "0xa39a36fc1b01dc0067a3f988", + "0xc7dd6c901270d9fdb366f54b", + "0x34dce8dc0c4d9f00f894a321", + "0x20ecb21523e34f6eeef96314", + "0x518242bb4f55ddba7da80af8", + "0xa4e8d6c6d1d7fb8b11e24801", + "0xc3fa82a39acde7bd460cdc2a", + "0xb8a7204395ad3fd4ba492741", + "0x3dbd38a7787b6d282d77b408", + "0xa5b4580a97547199a903a2e9", + "0x70ae79cabd32c3ac0fe1e835", + "0x38f97a873c7bd1071287aa7d", + "0x492ab754c4407449d6d7c924", + "0xf75fe766fa1103959fe9c9a0", + "0x3491ac4a8372d0ba55120551", + "0x952be9db197f875bf94cfd6f", + "0xf80933e50b4b91d8102297e9", + "0xeb5466f945a0873d51a95301", + "0x6ef1aabb5fa8f4d661a46619", + "0xb2584fd92cda3a26f5c92ef6", + "0xb071998f0fdf63e261754b94", + "0x4fbb7fd825891cb59f6f0141", + "0x3d6cfae6049c244888a1b504", + "0xa76274962ad3f537bf380518", + "0x97111479ca98970f22bf7bd7", + "0x956de6496a049087d2fc0ce7", + "0x32805d29eb4d866d77028deb", + "0xb00b3ebdbdc055d8a01f7933", + "0xa3769f912549e0a7383b8d43", + "0xac27027f9b375df91a294da3", + "0x5e049742e8d10156665c7931", + "0xda006129e5e93d77f0af08cb", + "0x7dbab26fa19968415ab6f02b", + "0x3552e0d1ecdbb33b03d78574", + "0x24b166427baf9bd617f1d9a3", + "0xecac2f86ba71f021a5fc864c", + "0x799a7fab38f41df3087decef", + "0x39da466fb364b16cc337361f", + "0xf117b18721420934be898326", + "0x88fb972abda4b78939d65973", + "0xa0d682018790cebd4a0950bc", + "0x7d507ff17c57cf96f16e423c", + "0x8ae1869ea28184bacd4705c3", + "0xcc4c0f6433dd75cc7f6e423f", + "0x850b98d48343a46e97898a01", + "0x12d6b9cad76031715bcce8ac", + "0x17ae45c9f0ac05808d6e7bc5", + "0x219cacb2d9b5f4e8feb3296a", + "0x1ecec3d8d777414699db961d", + "0x4d41fbc93d52e741f4ccecd4", + "0x3a633e77dd7ebdee523c8d21", + "0xeb230bb5d6c6546083bdf228", + "0xaa7dd5fe1389c575f90e4f5a", + "0xf4b9223ffa38dbd7746d8bae", + "0x9a02a95b3f3b9f5f3ed98bcf", + "0xe1e3b460eda2c3a4f8bfffa5", + "0x29c53e3e67c9457782d928a4", + "0x63dd396b9a41bcf1448af58b", + "0x4d330922452a4adc55ba2325", + "0x7f395e204638fe8078b51aa3", + "0x820adff20e9d6542942c48e1", + "0x90d64c84a87d95c677831e91", + "0x5a643bdc635da585dc60c63f", + "0xa1d897b359ab10ffe43715a1", + "0x58ce08549b06b926ef9d4b89", + "0x60940d9adbe867727c0ca1f6", + "0x80588a51af438158f1bda28a", + "0xa4cb1bfa2c32e12a63666763", + "0x4e5f34d0b00a3c9b1a548901", + "0xa1777db64cfeb14fa09454fa", + "0x0c50542b68d4095fd4702abc", + "0x362220a9abe7697e2164ac8a", + "0xaf0c3543caca2c40dedb1c10", + "0x02567fa45cdd6857a97254fb", + "0xa82039cd3e1d93ed328b3e12", + "0xaff93597f12a6a5c54fb3279", + "0x3d7f1f4aa5b07be901e9474f", + "0xf8ca67083230568c1ce5ffc8", + "0xd03cca5de60d404fabca0141", + "0x48f505dca086db0d3f77adcf", + "0xff194afe00057f6de17917bd", + "0x780296a38bb221f5a4a443c4", + "0x4482852c64b41187aa490b8f", + "0xe6f12e5f2cb4cecbf12afa72", + "0xc0a19964c5c212b51574d195", + "0x5ecbd354e7c1c7fdc815f3c5", + "0x2b4548bcf16d8801d4b07444", + "0xc1bd072861e220031d4b000a", + "0xc70b7caf3e38ca34442dca72", + "0x7c1a27802e4f46189da3edfd", + "0xf259d8c32b123768a8a33844", + "0x90e19f70d337a359dfefdaf0", + "0x565e3ba314919d243c6458c8", + "0x6e2566bb485599058cacc777", + "0xa2c78814dba5bf89ad2da397", + "0x04536b231943270476d8014a", + "0xf06ee18eaf62b2d873367d5f", + "0xf598de0608b058e6b7aa3f7a", + "0x9928425d4c7b02260085bca6", + "0xc3959c9f8624b7cfa79b1a3c", + "0xad656ff38b472ccceee3937c", + "0x512d636a8df298a710f437b6", + "0xd240b59d362fe7bafa974bb3", + "0xdf31fc6b96874391f6ad97c2", + "0x5b5cf2d50a48121489262809", + "0x35cba5e91e9ba962c6a6dced", + "0x16764509ccaa400bacb0242f", + "0x1a131561edba4c75962d1cae", + "0x76cf066720589c3e45361b65", + "0xa3b5b9bf22f86346a86b71fe", + "0x04b30a2dc0afbfb0092d1ed5", + "0xd5e9e2a93de5007e990e5f6f", + "0x7e8b0f26163666c0bb30d8b0", + "0x9f53839c335884223592e7ff", + "0x7aa97c66636b911adce88655", + "0x55927f61a41b5389e6d1ee23", + "0x9bbbd4730f7273356782b205", + "0xe76ab7a5b4cc09c19e0eee5b", + "0xddd39bab95b642f394c2dd4e", + "0xa38dabee8079c8f41b7f05be", + "0x2cbca351c430e4ba9d114978", + "0x1d00f1964a8d7403fe257486", + "0x701a238599be6084bbad37ba", + "0xee521e28a0655f8edd511196", + "0xe8afb429982f8c308823a859", + "0x5285ca0653e5448101d2b6e5", + "0x80e062de039b9ad2815cbf19", + "0xf85f578deecf6f719f3cc0dd", + "0x29740faf80c438032a2fbc85", + "0x0bbfec14a13fd2d4152973cd", + "0x710b92e94e341ff56c9d6d1f", + "0x7f4a666117b4df616fcb6875", + "0xa5b8392d4fbe695b0a99b7e0", + "0x9b6b8aca97d0acbbb17c2a36", + "0x77d8c7994ccb213f97cd1a31", + "0xc5d06fc21f55bc9fb7b5fbaf", + "0x6f4955f23db8e5e4a08de377", + "0x7276d693f88c4b728ff7da53", + "0xb17399b1dc7c8bb1823b71e0", + "0xb2b63daadc8187fb3dd98dda", + "0xe2570092c4c6850b13049a3c", + "0x17eca73a62fb8f1aa3d2f25b", + "0x91f0dad1eb5b81bd9bd3a9e3", + "0x92baf940603c124a839664ab", + "0x638c827f532420f5d6dc3318", + "0xcf30dbe18da3977ec8d5cb07", + "0x5c82e79489c6db20ab101cd5", + "0x8fdcfe7c746da61da47aca78", + "0xd7239ea706944bc81962e900", + "0x5e0d0e241b5bcc9955bc6fe4", + "0x05f73a4eef6c0dadfb066eb6", + "0x7143afd988608054d6ff79fb", + "0x08ca54e8b17b214f642009e3", + "0xfcc40b5ace05d3f65efa7d05", + "0x6ab32538ccdd07b50a350aed", + "0x8b68e60101e7125b43e47d19", + "0xc21de824543c1bb52567ae97", + "0x251c7c282d31d492d2122a60", + "0x849560e95360cf9ad5300304", + "0x59e0b98ae202716a9bcfddb5", + "0x4a9fcbff1cf289c4d7b4c573", + "0xe9c4f1ab1a3129e5c990cfbe", + "0x67722d28a87ebcc109de080b", + "0xe453078ccb6975cb0290c12a", + "0x9cbcb8be52705526fdfcc541", + "0xba43c055f23e863c29d44d1a", + "0x6119f26bc027c07fa76ae62d", + "0xc7c129e8fc8cc054ec33b566", + "0xc16aea7416c82979484918b9", + "0x86beb0c1b736e9ff574aa168", + "0x722af218efc8309e37b4f578", + "0x756afc4e630ed7b05fda90c6", + "0xfc3005d6936be77bfb096c3f", + "0x867bf25537280b31f5b3a005", + "0xf6358b11dd1f8188232525aa", + "0xde85e5a872e3363c240632ae", + "0xecdf8f6980bf6d9b4a629627", + "0x30d87322816e5dbfe84e7b2d", + "0x1365d7a48535d22732852dfc", + "0x96452753c7350504fd7fe2e0", + "0xc599db9cf9693b5350ba459b", + "0xa9dc7963d22703f07f5cdd2c", + "0x8112ef9d5474d5ec7c60b84a", + "0x8bf62c18f1dc598f42b7a8a2", + "0xeef63aa75fab80b33c373343", + "0xf7146200f90e0e548cf9044b", + "0xc56a4f5f9e80d7c788027715", + "0x897c77abf7c082cbd9868c4c", + "0x4f58163edb5721dccdf47260", + "0xb08f3c23468b0240ad485772", + "0xcdb2322b7df87395786f8117", + "0x61c7b4ab71f4ba1eab902d8e", + "0xfda54f1a315e6a212eb35d16", + "0x85f960b2ed507142e0962f2a", + "0x0ac584d7f838f2b7adc6f11e", + "0x504c78ff5771280cb1cead32", + "0xdd5c35531d44ed07b4efbf49", + "0xe2caa5cc05b315d7ce0ff047", + "0xaa3f9b1e8b87d6508c96bd10", + "0xbd45c6e16910425bb1690171", + "0x129f50387cad7a563e534f9d", + "0x6c241af30d46b355d5254b33", + "0x12b2236310e46e0b27a73e08", + "0x2d760c771eaaf4a301294b4e", + "0xcdbe2fccc6a7425b8f428609", + "0x72ef188346c6b5cdc76ac263", + "0x0a090ec8d5000d54504759cc", + "0x3a54d8c9a467d20c3e0fb625", + "0x28c74a65c16ad0edfca2e146", + "0xbe1158eb2190e45695fdd8b9", + "0x71588214cd4f982c1ec85641", + "0x19e7967d8618470d6b762de0", + "0xcae505ae0d03c599a1444b62", + "0x11822bc907fde4b072f52ba7", + "0xc475b3819e15222899a6f4f9", + "0x31275285074eb760fa7f848b", + "0x821cc64197baf821ca2bf130", + "0x3a0a5c2b42e1d96905c3115f", + "0x781e2c1cb25af0521255c49e", + "0xbeaf5b256db4e7cb6f031eef", + "0x91710b06b59903ba43dbdf6c", + "0x5056f704fe368c7d69dde6c7", + "0x708a585cf57f23762f9dd407", + "0x2e8b53f6d01736dba2b13d7c", + "0xff31546aa20f441e210f6c51", + "0xcfe2938174cb90126f791521", + "0x5cd6fbf26528a620a2f4d0ba", + "0x88d66ec82b547bea3918fac0", + "0xe8577c3ca2602faaffb58f5c", + "0xdf54d875326c2bd5c0ac1077", + "0xea003f4136dcbfd31d5bdf1d", + "0x97e2af7d0ec3cb178a880f87", + "0x1d797d485b5e847d2e0bd69c", + "0xb7af31c6bf0460a51cecd9a7", + "0xb77dbf70e961b07def781611", + "0xf2278241951b2690b6481037", + "0x84b744d66fc79968fff79930", + "0x71c6b14573d9f5fcec1aaff6", + "0xfba2b9d75cd61e491d2d7994", + "0xd3d9d299c9ca99d4945183ae", + "0xb6b62d268130591f6b7c6277", + "0x4322326faf82208f3d92c634", + "0xa24f308a09892d6b55b23eee", + "0x1dcf8d7b9ed5632db43771ef", + "0x9cafacb34a1ac93d0907519b", + "0xf244dd868e92e4cc197d8b4a", + "0xaba08bad855662e594ac51c3", + "0xd5969f7ee40dcfbc43e46918", + "0x96aac2c78cc9950b66d70d8d", + "0x3fb5cbb8a997732fdab6ceb3", + "0x51d05d6eee4857693e71ba10", + "0xa78528225a4348eea153a649", + "0x287b6194de26ab7b17d89dfe", + "0x0fffeb69bf980b1ce6e71545", + "0x9589ea0e5ae4aba3f9dfae4b", + "0x8eed8a8cee90d5395b1e47eb", + "0x76bdd16a0d09309f4aabc2d0", + "0x1bafb39f1ee8e442d931e611", + "0x085cab5de19592bcbda5b3f7", + "0x732dc9499b915da645cd059b", + "0x22a18b1459426bcddf0b95c2", + "0x9a3d67e39867fa0ab8390658", + "0x090e7549808a5c70174c985c", + "0xf8f5e07ed569843ef1c16e9d", + "0x17502c418aae817a5d5fb870", + "0x8d08ed99098dfc5095694d86", + "0x9b009e61667a38ccbc8dd05c", + "0xd9c546e5ba7374532f22928f", + "0x43a1caba5a3810e469942979", + "0x09442ddaaae6f97a9dffe065", + "0xaa1e2547b9e8a62328c7af69", + "0x497d090af846710a0a0c7d27", + "0x5d0eb1e75b374e7246d48908", + "0x039e14430f66ba9b7fd2bb0d", + "0x7e09fa39cde29776a1795d2a", + "0xcfce42a8a9d12ed6d49e515d", + "0x35efff4d948e50ea04d042c6", + "0xf6eac9659699d90b9dba7017", + "0x8503f42c5696a0f1dcde7fec", + "0x21ed4cba55270d8028d7bea2", + "0x9faa2c163392a028bf33e4c9", + "0x2b18d3de292cf4aa5d901141", + "0x5162ac399af5f4019c3f54a8", + "0x5e1642bb7a8571fdf1e1712f", + "0xf68af58680495f6df86315b4", + "0xea2436be038bac4575688a9a", + "0xc80e854455bbfc1c13e72b25", + "0x3b0fbec1a3dfb432b1bac0f9", + "0x795ba65d40de38593652d162", + "0x73b626efd8f3f78cc83c5080", + "0x6a42fc44e7b77c30e0bd276c", + "0xaf90c86530bcac0e5e244919", + "0x33814a850c88f2c4aff7efdf", + "0x603570afdd2a11e352a88593", + "0xe2c4bcc48c032ef93db7ff76", + "0x285e72c69b832a04e996d447", + "0x76b8f2e3d3c4ea6818ef4d02", + "0x905d52a5e355e67db9f498ed", + "0x9cb0dfecf210bd1d95f2c7ed", + "0x3e53512ef8ec4a6b1452ab34", + "0xeab843cb13cbcd1fd1b82756", + "0x6d7b711410a63fe3bf85a1d7", + "0xda29948acb915e1e73d5eb73", + "0xfe3b75a47ed2bcfde5083660", + "0x58f8e5b5cdb4a31e805b48bc", + "0xc07b3b06290dd9895c231fcb", + "0x4336ea22eed9e7b1d745a8be", + "0x070309f41161bb1f2d386ab2", + "0x228fee9ce1e1e7d7061891b3", + "0x34eb5206dc428b4e6f21e2a5", + "0xb23e6ba6e0846c111e4b2b42", + "0x8dda0cf9cef8b3fee1f3b512", + "0x99c2f0f65944a9ea1d984061", + "0x23c1f4a1f599c667c3169c8d", + "0x80cd27aac733ed7c39ced3e2", + "0x54ed2925a27eae622dc6ef1b", + "0x262ab81de2b9a4755ba96738", + "0x2ed2f20899d240b73ebadcc6", + "0x6eee99f7c0964e50c8af7d2e", + "0x4f3040ca636b7c916010b5d1", + "0x7f71d52654007c075c8d8bc9", + "0x1a630a58a2f7b902bcfa82cf", + "0x50b22c4bb06700d5b0120303", + "0x5e561a63d0f11f0d05164a1e", + "0x2204e43bf5368254bad7e662", + "0x807b0eda2267a0e9afa8a820", + "0x00a89a11e8d5762cc068437c", + "0x9b872b6fc5ac031e956a30c8", + "0xd99dc20af332bcc962a41300", + "0x674c7781020ba1c990a8463f", + "0xfc15e5241e5eb4a1d05c4162", + "0x4067e07d1ff48679ea059abd", + "0xe0cbb4c50bd58848175d87ac", + "0x367b1cb2c7da2ee74ecdd99b", + "0xec145968b4a3252202026b49", + "0xe2f21a237f697c504f1005f0", + "0x174eb83cfb958104344a2c3c", + "0x4a449d0d99b2f4191eba324c", + "0x874ba263621f699d0b5520b1", + "0x96e1dd72504120fc0533c4aa", + "0xeab0183334da9aff0fd697dd", + "0x0f61a0bb59a852d6d55d847f", + "0xef4920f3e60e17413a481814", + "0x636568292c7f63782e164eb9", + "0xaab8262be3515f870bd7e6db", + "0x19f8103acab4398fa5412936", + "0x373751e0bb858b44a77cf447", + "0x03ba00fd8b78c4890a5c6c2e", + "0x830915a9d04847670507c8d7", + "0x0d37a31c55f371d06d45effd", + "0x4935afd63ac8d2dbf036805a", + "0x5433a1e8ec0e7ed3aa501ec6", + "0xd123a38be18022d473ae29b7", + "0x66e8191ed35f1e8c01a3b7c9", + "0xfcb570e60417e13d067292b0", + "0xad7323141442af6312241207", + "0x046e3f2ba2758ba6db52c1f3", + "0xa0f0e36110450af7ce272b99", + "0xefa48049f830fc196780e44d", + "0x8d3aa0ae95014cc0e53e0ed8", + "0xdf9d3c02952ef99a4bd88cdd", + "0xe2f28711e08aabe3a718d294", + "0x659ac3fc8807c946e5fbb9c5", + "0x60a622a77538922dd58f64d1", + "0x9b6787a381527093f4a44fad", + "0x6382ba26a4f98e0b0494a9c0", + "0xed5fbac66bd5fffb747a6e70", + "0x986e97df132f54ed302cf0f2", + "0x3134d7ad51458872f8618019", + "0x1a952e1f16653ed2e8a211d9", + "0x8b6ba06be67c2e20c79c3508", + "0x84e78629145d32ea70834043", + "0xfc079fd274441ba3c0f2d0e9", + "0xe9539d4350a23abcc5379e01", + "0x8fa54b18556094626bcc2ed8", + "0x8d334b9a1d89c39d3059df4c", + "0xab1aa750bb719eb7018d9004", + "0x89122ec38c0aa69c94562567", + "0x139b44706c300d098ad5686e", + "0x65d33c97e9da526bb632e202", + "0x550b4d63a9b992734aaa7dde", + "0x52e1359a39e05a63b5c8a09f", + "0xbbfeb113be74f6b1197c5c6f", + "0x66caf53d9be227b1306c5917", + "0xf79d9a5d6c05bd8067123bea", + "0x2987e1561b51915424b6daf4", + "0x1340c7c694cfb848be0cb8b5", + "0xc4d0fdfc205832677c8168f2", + "0xa1f2f1908d5b08ae3bc0a455", + "0xb01a42cd002a1d05db21357d", + "0x83d7edb82a4ee1fe2d6bbe39", + "0x436559f448db90e793cfe583", + "0x99534857f091d7b959b67061", + "0x629a66785333ce238b0d5f12", + "0x6f2b650ca15ed7fd841c1d30", + "0x531bc54de29bab84482cb3af", + "0xf548edb0a6e215f3e75aaf1e", + "0x01976014f48082783fd41de2", + "0xeb130f73641e8ad312c7d069", + "0x3e59a0480359c84c97e9c259", + "0x2115c760be3cc6d0ffd5d2c6", + "0x77fc37a481b817397b13e206", + "0x7114521ea5edf76ea07ee857", + "0xa9c69d9757211bf4702a79ea", + "0x34d6000b891c86fd39f818e1", + "0x034a035ed0bd7a0903bfa1b5", + "0xf08e9c510f6017ac9f009da7", + "0x28059d8dc835426a86e0f43b", + "0x7d1f276c151ed6af6fdd5744", + "0x97f2538619037b5ec962d67a", + "0xc1a9556a034238f71347b6d9", + "0xe661edf207804daf27854e41", + "0x3c55ce95ba89df9c77975660", + "0x4a16c9a585b1e5ef105fbbef", + "0x626307c5f7445df3d1d3cdd9", + "0x6fc9a125f82964d3e5653c8c", + "0x54b7f6275f1f3e8b265676cd", + "0xaa866c92b4bf1d33d5451ef8", + "0xcf345fbfc3505b585904571b", + "0x9ba9e7467d789c588a7ad27d", + "0xe2c1280fa6101eb06f349bc6", + "0x9c502727f80a14cea3fe5dd4", + "0x4a2c1811e87459fded6cc12a", + "0x5b32f94819916447ccbcce34", + "0x48135376e6c6d8bb7f8c1248", + "0x0e74dae26a95f96d80cc2706", + "0xdeffbe1b12fb2b307fdebe64", + "0x515382c25040f6578bb892f9", + "0xf8747c414bd4d53d2322a0bf", + "0xf6b15ab1ff244eab4b173b43", + "0x2d2c3ae9a7104988b071b487", + "0x15513f7ccd0bf8ee146b73cc", + "0xa83d98f56d0adbeef6022c8d", + "0xbb95437218382b11d3e22197", + "0x85aaacb1aa6c46b7eaca9a05", + "0xd7e9893181c9c41ec830d22e", + "0x5e9dd3a31f392467a0b3781f", + "0x1039fe52752e1657042c1478", + "0x2dfb60692002a20e864fe663", + "0x19940188b8a1aa4a32c9cdf8", + "0xa5be392787787795d224bc7a", + "0x0b17d5ddeb378bca4796f03f", + "0x723585060a1cafedfd78c335", + "0xf8c675e6a0174983f2fbbb6f", + "0xfb258934311c904cc3074c7c", + "0xd53cf746309489b94f71fc12", + "0x5fefa55c12bea6dd0812dc4b", + "0x5469d25283417e062476fc84", + "0x23efd6757a742306e238ad9e", + "0xc8fddec5dda6d874d407bc40", + "0x26188083c3308b750f9ad229", + "0x9c831b284b0e3810c7f6724c", + "0x4f1dd9943aab7e016b443fa5", + "0x20eef0d1139af616adcaa9cd", + "0xc47fa51845db4b8648a6c9e8", + "0xecce9f68320e2296d10ceb46", + "0xc8424817c66e1c553646f190", + "0x7395747103d21639bb6c596a", + "0xc8782ab476b02314e32d1233", + "0xc0fc72dfc4971a6ff9850f99", + "0xea1e3723f4bf66994e2aea39", + "0x1a8a1f57da8cdf4f45174bcf", + "0x218f63678030cbfbf6f9604c", + "0x7f5a092ed811776b2d69e1db", + "0x539e2f4421e788f2140216a7", + "0xbe24abb1849a9c56ad80dd1b", + "0xc38fa2606313a76aa7f33f5e", + "0x09230b5ca5b393465d515003", + "0xf2cd66c6810402a98561d0a9", + "0x0e276a54c96a176faf15a440", + "0xa1a66fa32a498c1fca07021e", + "0xe989f1cd754c22f76058c082", + "0x7f4626a560a366416e9ba852", + "0xb12a620cbe0b0c6984d4310c", + "0xcbca650479bdec0365c32674", + "0xd67b2250e6abdd9de2eafdcf", + "0x1bf98814b6563c33b42ea5ba", + "0x5cc2488ab4dcb35ba77ea741", + "0xfd951cf75d6a858d18fddbf7", + "0xeccb26a61b40c2c624111ece", + "0xa219037bf0bb7379a96de00e", + "0xe03d07f4abb25748b62bf009", + "0xb83a3e8292d1fea91d36ae27", + "0x91e6bb3c24eddd20447407fd", + "0x9c6fb3807a8052824c9f4e97", + "0x7509fb0aa2549837bc4e9316", + "0xe3357c4d715f581b9c12b244", + "0x3276794880ed3ec143136e47", + "0x5d15386a47e387de429ae415", + "0x46b3d549ffe650bd1d09db9c", + "0xc7f9952eace22d1ba979b8d3", + "0x099a5ddf8ee7b3baec73578a", + "0x2ac6f1f719f3d151e807090d", + "0x8328ba684eaa132801f5f0cf", + "0x0912ec9ad2c9dd425602a92d", + "0x67fbaeadf5ec9cf333937843", + "0x6dcdcbb860cbf1713df7662d", + "0x13b30742d5716b154c09907e", + "0x68e50d90cc19fd9be38ebb2f", + "0x42daf4d8d21505dc4c894d58", + "0x006c384dcf408139de882d4e", + "0x39ad6ed96be369cad30b26f0", + "0xe76f8d6b4f0d1630fc4e686c", + "0xde06a21a671c1b17c9f679e3", + "0x2d1f210bf7c382dc35390a12", + "0x5430594dc97515bbcfcfe5e3", + "0x6c7f8abb47378c3020837dd3", + "0x57695f4572b0c93627dfdf3e", + "0xefee29cd17ca234614bd0756", + "0xe9ecf203fe3339ccc720a6be", + "0xea8091a2e719a5ca3f4b64fb", + "0x7565c0781e532321f45c1c44", + "0x9545e0e07c1a5974db95255c", + "0x2ba4d3cc7a47ad9a21fd4f2a", + "0x780204e4381c2bc27122137f", + "0x1017277df5cf6816949d8a90", + "0x54ac077bd3940df1af963b9a", + "0xa19ffc71b024c1f2d12c15d4", + "0x26415d2f10e1cf61ce9cefb6", + "0x08dfaa81b4833a87bd8d741e", + "0x6f291cc8b9e91a7b0901eada", + "0x2b37af001ccbeebeea266774", + "0x98c7e84ffcaf17562398cc25", + "0x02e41bf1e0196fe5573f1fea", + "0xb117cb84737baa50486e0a2a", + "0x8e1dd94793e7b80eefe9cc52", + "0xfd8159f5647e39944cf01e02", + "0x23d2c4dd0bb603ff1238c875", + "0x75e5e2a2616ca22e979e9745", + "0x79496fe203ebc910e7658b45", + "0xe156cc6d5c2e582a0cce26a5", + "0x2f33928949c2da935727185c", + "0x1fc3409ab60cf7665b2d0352", + "0xcbc3210311de1e25b6b87ec9", + "0x27da3fd3e2b8051b0f5ed66a", + "0xaa2d42b23fd13a6bbd618d4c", + "0x9a4ccb9995cec280ed8a97b5", + "0xc020d00171d22a787ca5c169", + "0x7633315ded8e92ca462c99d7", + "0x691b45a4f322fc7518c64993", + "0x219e5a9f77d82984aa7e819b", + "0xaf199e8dd3e0ebc46de9accd", + "0x8bb73b5a870970077458a7d5", + "0x46d45573b04d55fca5033c90" + ] +} diff --git a/test/fixtures/erasure/tiny/ec-100.json b/test/fixtures/erasure/tiny/ec-100.json new file mode 100644 index 00000000..0f3d0b69 --- /dev/null +++ b/test/fixtures/erasure/tiny/ec-100.json @@ -0,0 +1,11 @@ +{ + "data": "0xc39caf301288501d98f635ed7d28be53e108793f79353267dcfb3545eb1fe946c057accb24156c21df443a0608eb530a97817748b965f9458738a01bd0a92f6f154eed69ba7ec560cb39dd77e95cc622bf6a7c5a0cced1a56832e1cd3763e2e85f574a0b", + "shards": [ + "0xc39caf301288501d98f635ed7d28be53e108793f79353267dcfb3545eb1fe946c057", + "0xaccb24156c21df443a0608eb530a97817748b965f9458738a01bd0a92f6f154eed69", + "0xba7ec560cb39dd77e95cc622bf6a7c5a0cced1a56832e1cd3763e2e85f574a0b0000", + "0x31f2257c3886599999546a565c4c936a0a0e2bcf2a0cde1467db03b6b105cff54c78", + "0x64901fe3a9e46effd57fdc6231d3bb516dafced0a2cc74831eddd351244699fc8655", + "0xf3b037bb775bec57df4ad23642960678cfd00f036198d1d8025441127defa9b5bdfd" + ] +} diff --git a/test/fixtures/erasure/tiny/ec-10000.json b/test/fixtures/erasure/tiny/ec-10000.json new file mode 100644 index 00000000..8614d631 --- /dev/null +++ b/test/fixtures/erasure/tiny/ec-10000.json @@ -0,0 +1,11 @@ +{ + "data": "0xda1070331c8cb0834c79ee893ed1bfb7d43cfa744053a0748e200e0a858614d01039620f02a7395524781b9f6efa83cdcd273aeeb79e51f95ba34b646ef35409df5e572fcb0d65e712a53fe5970de227c067f2fb576472696eb390c7b3b93c4bd3be3e5b6e0586a6c72893807c7f4b4133e59031d7d27f3bf60a81e328c973b7018099ea638c7419fec8360dbc692b09207e353bec9e4f0c1f1b4071aeb06c02d5229495c4146475170aafa607a0f76870de09987d388dd7f25a1b0640b56935869042d05f5685663afd9ed779e7ea3c53fe9fe1f1c63e8d530c68445cdb901a21fa57f94a8e03bbf07937665f05f1e9bc41223b83cb82401098426bd539017edaecf79226669d2f181bfaeaca5a93fa24429c46478e7c72d16fa46a66c1996a2772c9a44574f3194618b29b73072771b09ed218685cf03c90fda74d220e33f6cf0fca4f806adc774f8ccd265131de97669d1aa3f5099c8dacf77a2b66e2d083b7a2b7458580277b090856f1ca96c10c764b394b575aa34c32d7e79a68e2e965084c61755e8818528cd351ccb9f25c79ca2c1a9a16d530f6791223d5fa1d631e97e08ab70b5cc09986876534116f10aed3baf7b369343e2cafe21324098a2d0719eeb3cd14df8717417227aef76937c7ac6814ac8f8ca05a7be534ac945a5d0924368df84c6229eccdc6ebc10c3fc269103a9333a01798b56b9b606fbad6b747230ee19213243292f4443151bc554bd7cfe6a8717cc74fea9a4fb31a4bf608d4cd7c15ac9c605d5d426f82b55612bba6c8493711418f4c829495f29c211b460d402bab518ac1348a5c1fb500d49cc88aef9b4c7108d40c5d20f7a0be1cf9b847375310f73ef9ba8956e71ea6864488d98cbf47dc9e801ba43545ff7f2b08f66ed20e48aec25f65dade315aafec314138d59abd0cc64cad98e49498b8790f017eb8914549413862226eac76bdfff7f6cdb78ced5e0fca93fbda46bcb9f202ec58a568e941bcf7a4cfc31563abd16cbc26ab2e08658ea1061aaeb7407221dee452d7d29a2a994ef2af124aaaffbf37ed86d4e8d849b11f38df0f534bfb17b4485111f2d166c0a81d3f87b3856c8f3125e9ec7d68cb1ab55b6655d344888a58fc71185c7978cc7d48c99ea1ca00713ee840027c223b8fa499965b7e25247c26856ef49ee0f6cc63918e73472be0a05adb4d1fe8c5a31c0e28a14c29a549d3deea3aea79542c575e1f612aefdc4357ed60d8256dec976a0519988ee12bb0bd9cf4a60acf80a7164ed5e37dbd5abea667e88361d99fa02ff4ba70ae890f543c80767d0f53b55be423de83d206744145dfd913c007e3e56a420529d58d2f9d8b9e842a70b2ecc3e77505172dd27bbd01b68028dbf5bd82525b51dbc9a186e86308d935f637149f5171b519ebbba3f464e4247e674051cc392777ffe4a4b16ecf4cf938720426fa3421668f0b609bc5c62ff3db795a32b5dd2c5ff8380b8496395f42bafe3d1a318aa6f38266e752ec39ed881e783f2f4623893403cb1daf9b6744636efce6e8672536ff84a4fa355853a86fe8ecd1b011bcfbe29e0b054bf9c11509c71fcaad61b1c457da71327635b0743f060b1a337855a7e821c9846eff4e3a4b72e6c44d615a0ed4c3eb143d8fdeb1f6ef5b5c19a8f2843dd9435c67aa0381faea10ab45b708c2972b78a02d2a35ee4cc0cff721c31fcdbc0830ef6766221b1fd07f80c219e776517fa7b2b318997aea3261593981195efb321b5c9d3970838121b101bd342c2163da8a075a56fa435e005cadc1ddf2cd1a9d844c6745b253539785a07edd92f6d2d853501e533a59cb2928c95d90e6a80e6a64ae2377bc0811d802722b9b27e8edeb245e00d7a24b7763b6fb91ca64ca40dafde3e2f732c4debaefcc927976ee30461d4dd3b5388ce7aea6a516019bcab7a3adec41a14e9841abb1c02623b0bdc09b1352da1f97bf801bf01db8cd4cdf4c76529f96c65f8c1e984a5c5c8f9a8d0f4d4931ad1dccf5218da6d705b8a58423dd64d1f2c4907a4df4539760de9577b6d9228f968cb30d4aa851e21ac03dd9d24c21ea1ffeb9a2bea5c9e918efe68100103690240f977a2849b3544c225911fef9dedcd0a6e8f2e24a78d35c33e1da406b98f5e636e428a8a4fffe7270157b9f700f86b10f4b3b96cd14b49cbb1ded46e6a0f1f91c34587a5e512752787a36b5d03934d1b4c58b0bdb49da16e820005e75ed7644ba962bad3734f19c41220e5f79db9f447de6c2ebf59088f3840232f2280da236ee8697fb594238030115a57ba7a57ae9505028b5a5defbaca648911acf992b1215069117fd2aaf76a209d9f2ed97c1315055181e0b3591891d6279922f4dee57c3344773fe991cc23184b007738614cdb78ace8a904bdac5fc59c089103820b8d68297c9b21c114efd428a17dd570333291c84bef92298dc35e31ef8c78532bba7fb5ebe5d3ef3a78a27042f8d8576f84304e60feacc0c9dec510b84cadb5d7a304f3f2770b96cd50eb88e90381f556463df272c4dc90d95db26d1d08616c3688d993a0be52bb68ee3cc8dad67f8b4b5f45b4e78c4f62329a5ad7c844e411b8f3321cd0e32e3c97a29843976e1f3a6354278afa857c3e3edfb4529fb09a54f41ce228462c58e8fee74cb86b67d639e79948710711402b8b6592ee6ca571adc1d0ca5515bf63c7ca9787e1398b3d5322758c0555a74df31ca3259596b6b8f3590cd91f695f16e26d203d2c3366de3393bad50d26fb63caa34c68be4c7d824b418234ea61517989392168c92abc031f31a157957eb16215a45bbce5109ab91a135baec3e0c0bbc3acdd0ad3a615fe4f47c417ed2498f116d34229775b305d243d6c047f6514f9af6abc0ebb9bf50baf938b54f3214177ba25a302abe59e5aa778b72a1d91f24a3bb4d11d7f5713a2c6a6f3a9428ddb8bc28dc411e4a31cf9dbc58d166887b8027d6992b6f8abb50b6c67f7d4c9cfe2e8100440de5b1e38c28db562c4a430cc66a5639a4b9445280441b5fd79c1e0c00a89a0a9b9aa63f6e9a4d4bd1e9c943d6618f1eab6f369f510d9e505da8f3d631b010ad70aa6244058af2a8cb93214227eb76d5953d290e52d5f0b9621bf5785d7a71de9d2c260fc1df54e2b1655ef33afe8df6e30def533b81a2bb258daf4024c154958af8c035e2f3d16233876777be253ec7d028fd4154f158429d9d91c0f0d7b3f6881450b4ceea4f9655631e75a349791ad12f11ec01403569fc3247d6797df748e03f1cc37ec67dd34e3677a418db26c93f5270550503557aec51040d1f4c4f318ec4d708d0de686fa669c122ead35d2bb36a2c84a7a1f9e1a0b73179a51526358a0e3915da60de4b1da07f20bcd43689ef597f21dbbed5c711fd0c06770d28caad03e43a068f336f0f7e4fb80ede3cae11332f307d316e36ef2091320e4210ede94eb0ff571496014bb34ea22c277f8ebb6a986dfa29e0963180f7f3b5e9b89532140242082f9f62c3168391522a68eb62408dfa35e18e87941be3caaee8371607ba602607131a750983caa48a724935fa71f8ac43042d5f3456aa2394faa40e048e638918880998fb755bc8f2a72d5abbfcf9eb0c3fb6158f141bc6381a5e749344a94a6588489d272b03f47e233896abc596557a7885aa9f589d3e38b99d3b326f345cc972fad579d549e3c49df9645deb6e3d150b8730b1ce4863eeb965fd8737e84a2902493d3a7cb28455746391e4cd805ef0a2c1d0aeffda0a3868ed14a772647722859160e4ba13e02959165355778a1bc98cfca3ef0d52101935df6f1403d0246887dbd71cacb01ab7e217f50212486e5495406e88d49389dc81e61bbdf624b6320ab70465b5876f506c00159ce15fd289010b43ddb35032785aa60b323f0b62dfb2772c518e101445a2bac43721d9c7ba950633c2b54ebb8c0e51cd25775cfa8b2e19dcb558640d8f19f93a01c01fc60e3db8997ca8901e82486f7990d2b9b3b79abc4d142d74f270ed992a6a28b73886c62c94bb6938c93716c853ec3f0968d44242fc8ba62b2c736694b8dc35b7cb89fd4a181317e95f1aead6d8fc80d6df0db2989aaa7804700f2f2d709bf600dd6b8b45fb0878a88efe50e37ec7ed71b32126c4aad784ed60cd7d1b2a12b8aaeb81875c17d4b039d47dad514805d18e02916c63b9c4a2155e9df5581bab0877ff85a67d01affaaa7a678bdb4b8bc0d49e79b5f5c02e3ac88ea8a3bb93104b5ab08c8ec908c6fc170930dde23275655f14eb5dfd9ea13952a940a8ac7f61720bbf67f56c11aa9f1d7b529fbcb43d0ed02661624a18a5866286dd16b2e701fdc7dc3d67c7c32bfc7d8bc51ed197cce404a445d391b0f10a7aa9f1cb64befba60136f2c8af77a69f7e95d131e098755e6ea86b004a1d6672349f67d28c65a576c4977275c793ea7362c097b47a879aa93ab48a52cbf12f36be462c4586871574684de7a15f3ae3982144e6b5818d6ea37b4014deea674e2b81c0bcbfd7ab27650b1d2ef235d3e4d33d3e883cddde64ddf8cdacc11e21cb3eab55af7b7562ecde4722c5314ae2dd4da5b891fc3724ae8b2c625a6289a3bfb005dd4df0f2589f61b19dbf20ae80227be9395192f7c26ba4ae71da7c667c9e99362fe88615ccc275afffe6eb31692e7761379b2ee385a8ee055cb886d74b68918645ad45d53832b37eb49036a8d7d2e4e240edceb211c3c6fc04b46aead1887013212ceb263238f4995aa6e695df500d5818b508b1c12fb7e65fa9d4a32b6092c3bf722216c8bee55ba699a90cd763bd7a1fcc60213e3dd49f75969a1a5241f734c46a4cdcc77ec50c1551acb330c908bed3541f5fd396d108bf12922a48bdaa173cdaf8c8bbefc84f6f46331bd0147fbae36c9706e4b27d8d9d18bd84a1bca4fec0b4c15f3e054723d9fc2c60d376fc5f7d8c74813b7b210f66e95b206692fd607ca1b29e3c28c0f61e2fcf27df1c7b847e190733e78c843d66958bcddcb03d0d466512cccadebd247ae5748560b4c43f41e0a1d7202bc068fbb1a60dfd81b418352b83caac2cd3348623f67cb3380f46958ded030c9b8c04a7668bfe0f711519eebe46e51f8deb80b69caf8399019afbcb8207c5cf8f209c9098404f0bbbc47f45af8591c641499e7929d9b78e13fc4c95cf0bea602aa7a0d2300c9e1ad82f790a6d78c010947a7e6eec7b1fb09884bf8e71c0cb8d2b8c8182126417cb111aee8e4bf1dd9ba87e7e0ca29011143a2dda3677b25141563d32298e56f5c09b15b26dad34816ed6506da22673ae6095c82b4a3cc97a72d8d3ef6970404189b848dc0830cb912688c6bddc50527a3cb76d3069befc63952dd82d6e2fde08d0fe18ec7c075393fa7b24ec446899a16586116ee8350e10f272cddeb6847c1b4dbe22a5508acc5bb96cf8b6b6e2eff1c781f69f9083993c684236cacc202a8002e9a7621fcb821005ce8d7470038bb8ea280a38ab7a49f23dbb2d9c1f73c0c1e760de5a5fc222de84aa0db44dafce732e703d84429191f0fde50c28df8c49a01e1ff3ae8ada3a879cfc3fd956e186171ec4588c1ad2639fac8750ed84ab456885cfe2744539af619923edada050d36b7dd3bcddbc7f56fe8bdb8568201626b5d37e281a024c8d77f7c548458fe5c708ceb221b2bfa8a29aa7afa95618c4f5f725eff018a70c63ab10750f2a359300a78a6555408835c851691b7b2756ca3bb8032a8670a78176f03dbc3eecbade8d0a5d1a9982cf4dd7e58af193540456746732601837e3782d2b0dc27bc1b82bc7945552c4a2d5f97c9eb227f462e4ccf6d9aee8e8ddffa54e9c58490e8f76671100b62a10684fa934ad3915ae801d24da907f5ed16444d0860cb032a296a494ab55bf1c0d3274fc49f4193d8c723f10b9e03f2eb23eca6950e8631e1d7ac440dc0e0d6c037bf8f04137d93e401309ee92bfffa6a5d87995e8273beeb3691f3c8820b91fc06a97fc8241aa17fcc899a882414e4f078ec97336e48a32b49189f5a759c7e93eb0cc46d9bd7f90ee8902547a88ebbd5c492c7cc016d1c4653e1d1040e3289a8ae33766754d275aa07fdfdc421c0a6bfc961bb9c2c29cae76bf7ba1f1c1899fac3172675230a9e5ecd14129a19cdb10773936265ca2ca1fccf75696b10a37eff4ee2832ff2fa215ba9ed85b7f80799602b1e8d9455f8050a8a018b667c7d1680b97f54e7c447a13ba91aee5e538f749fadba14ac85d9bf1519e4743fb6bba5c184a0eb8d1193437b0857060671b54f97a0808207d1f06ae8b60ff55957a38fe695a9f6cf761fea542e69b93fdbf91b7606362505dc93bd36747c3100b4773d352b027ec5f9043a876bf1be10efef5cb450ab4ed846aeede16ae1240f77075d9059411542697882b5a96f21316ebf9f833ef2decbbe99a1399bbf2857af35b6102f462662606f0e20ea1cc4fbb4dc3f84e5c51a934bfc71e01a9f12e2f46c60e32ea7a98c770237d35252df625a522dc6c4bd8bc7b90d8b00cbe12cdd14cf527c62f91166d226ff3a1ddce458c1d643a23e8e12741ebc52801c3cbea43becb93c36496c69e668b2e1363a16a900c74397d346ccfa3ac265f89291f010f83c2d458fe2ee810a12f4bad56a5078fc0f9dc3dfa5e565115dd62c06216a15ee267433391180c510f0201ba4de96d58e46887cb036ae811cfe8dd20d1af39183dbfb06fb80119558513636a9fa85c74ea14ea36cf5a1b6712baea1d31450119d6683fd707a784d782396da468b5add34a6bb0f8ec82205a36a390d5d51bc6bef0c247ec29e6c8adee646a23a412c025301f8b4e363138978af59dc94194862a3ad3bb40e514cbddff6f3cefcb9f93cb418e6cfe46d151be9fabead51f8b0835b94edac6665058b4707f30414ca16377a1d5f6c785d55c2cbc53db30f1946f4311ff71523641669a4e2f91912af6aac7b1480293026c3e2331c6594bc8f266e7f40bf7ad1c91a7ad552608607d5b53ed680ca7a982231f92c4104759b6710d9de1682a0be09f0a759800729ccb38a85562fb8c354e285df5a40ecb223f15f0791ef977c80fba6a02045d5354a28f4c74af704fcc626340ed58f036a8dd11317c0c26607d5e41b249ece704b434ba47657c7149347206051b798b725d32fd6b5b1945f260e3ef8267fe85d8669468cfe0049818d096b087f10570d4c274b040f34824312c1f29cc7f09bd1c4784a6f9d8cfe272e161a5d8b5e3544bfecd438ffa1da2553554654d59fbcfe9f11b1f3534ca52cd036d7e71fa9f57a7a756b5b4b02cfb9fc768250cbdee6a486b4c7ab2c7e64410fdc6a7eee10852afa8849050f750980a829f783d6153f8484386dbc757a19acb7dc5a8fc4136be78d586326c185af6f6eddec1e2ff9d18349345f78068491d4bf76414f903e245fac278f14aa038681aea8483630dce9d7fac86891d0416cd9c941adafe4d15ec1192dd1ccc64eb93aac44cc6961c3ee98ff57336503d7b3a767050aafedce51096b0ba285b15b89c32144a03c21b9da167e6b7a70addad9f27e656b1f68d781f89ae1e20b1d38d4c9d29d9720ce8b7adf35b4e37efd0195e6fb7899c71b8e6f174af3ebda2011263788f1b2570b96e0cd5fd39ef661e577f3ca0d1f3b0556980306c807514652661f93075d22f0882ad80cee551e8c08a5f658fc3e111cacf43e9565c510e03f7cf8571c6810b2d113c9defd8f4c6d92725cbe84cca399dfb69e1c7c46dded0149cca48de125716a89c6c87a9d501d7bef415635003b4041a22eb4f0b89e5280ce42ea35df7874e78472bde25781119f0dd281c5c508b3f986e74a4072a3741127b1872f02d02eb26c93c2b23d0d938ad52fbea627ab33661bf0c334d8f384e21a648f538ea62fdc6e094a2dce7fd4f68b69ba3bf0ec2da739d1719772abda80e5ef8d5c5e5ae9024fa813d583fabd7a65130f81d180a78edff0cbdaf4028c7bbd65aaba8f9082f7432e9510597476b1a8f933e54f4ffbae0aa8c9626836ae3f10945bf4e0ebcc3cbf74dea1aee6b2a1cce2060795cb2095646ab7254a71c57ab86187aae72529dc2f925bab401f7fdfae20dc0b39389ba83471d5e267546bc6679705d151af8787c726d8e8c506a8ddf7cf184fee7411528841811ee2b4cb9135c0f16af8f9ea632eb7d241bd70c197eced9f445c216451aa65825a107a070fd33284af1cd8dac8976d7c9d569eae863ff201c5b73436c1581d46e52fff116b1ea69813c2919f623096984a932161e907cce5f6f687b3f0b642cbc3e726f009d1dd0887cfbabfd3f8a087c298eee900c2bb47bd9b0cf06cd21b6cd467b28a2fc64feacdb74beb26116ae503f0ccc8f9be67a4dd13af13f535a97ad721e78f44830ddd1cb804d63a8c186383cc6b13bcf9ea84bc688aa11386cdeadc2b568e68c9ae0c5e8179791acc13d6ceafbadb4899d6bbae67429ba7f040420195b888c9b36243e8e84edbf2371b63e88983ace1b8724c537f3c77b08850e56063a992ccf3b2cacefedcf0ec5b42e64e06c0b1697ec8e8cfb3542504680f35455ae6d6392da1c9dae326a5cbdf94b93d07dd9cd6ac6a3005ae21eb8bef5637c74af158de427b11e2a93379cdd7568695c85c30af2ee76b568980f64fc0a0be6039f107f8148a769ead2e9c3cf900b42b22adc56f4abb10e4c590903e1a8bec130742e6ad75eeb1936cfed577dc5c1aefe7b2f9ef251e264c575c9963ec304ae76276ea1faf76611f8645f8fa83de2fe446af5f11e4a84d92fccdf8af3f3da225d47012b823e52dd0d2060314c0fa78203f6065f6dd08e1d51cf9278665ff28b0a7690ff1654fa0e3d4f686f8bdfc4564421dbaffb36420b892f2ebd3e3de6c49b081bb1d3ac843f54ff4c8a5b3c03af6735a8e74b693b97b88c9881d640e46d75127903af9048e638dacaf2de6758627196dd55201d66aaa078db9c11ac9043244603befe0d9e26c073940a480c2f08d0c529c6277adb307b9388899850082f2bb4f4ee21ba485c59f3a58fbd1834d5cdef80e04e64fd8bae97e0e609fbcaec7cc46e5536f474c55e8bc469ab034400907855db88884b306a6f2fff684573f41dd1de25b7901e6156b592034085e70e03676fce899c26c39804c906181b7fc31c4723b6b190885c90a34f1a50b1d170aa3bcfbfc9ecb286b7f67dcb456e08a26fedbb0c4d595f67ae069cfd61480abef4ce6b744ac01b226c887da3d47f43b57c2729465dddc3a71ad4e407080016829d98aae5f21a2833bdfecdee439eb142a29a943ca8c2011b82d70a9d492c5f468411728df49a65d07d2f51f7f2e9a0160c974da5fe2cbabc04cb57646a30120081f2083391555dbc430f83eacf7785a2a7eedf19866fced5acf1319212190f984ca20c116d53201362c96816ee8fc8bd627fb597088eda84c22ce53d072b75d9f3fa1698c83bee8d4d97083813bc47b7e96a1cbb5b200bd4b931274a383504e2b07c976b8c2e1823000d311cdcd9dbdc5fb6115d083e28a74939cad20479386cfccf888c07598ae558cc5947f446f6ccefa6940900eb3928c5523ed82a632d51ff735cc33bcae052046362cd6286c5a409bc1df500761b55563a368539772e30127d6ba75462387509d6b095f8b47bc9a0ea9fba0293eb86a5c28e814456725bcdd4a9bff7c1e415e96491262da688aed88cfc47284250c62c93f8950d931e51cdc83f6c0a6c5bf0f26fe00b2fdb3739b9124fc50a4bf62a6b9c050cc6a94ea93c1294334271f95da99530382544b37b73e4c3db933b606a8bed418b7f3efe90c77ccd4feb097344b05f150e9e6a7465a69462c0ab8bf719e6d6d8c3fe8b8b8cd0f54b18b221cc56b6500d35c3114963836e58063f1849593adc570e41ac3a78d2f9a32dfade222c49c14b7e64c5b577a7ae4efb4df702c4c84c5382afc6c9f92143f60777e85a47eb372f1ad1b77c5a96787904bbde0dd0eb49901aeba656ffe934382056dc4d58f5422316cdf9359b708bf36cceb0220ad5976a96d78f9b0d996fa1b9684e393a6fabd97515c96cd6b039584c6b40c0e3bddd6c78912dcf59b85caa4d16b960837c6031b6af053feb6832f8e3374e2c7cf6528494f9b219a8460a0c4414c22030d3a6bbeb113443a4e861181b08ef31f8c9ee0b7e8e0469f0dc59d02d23b73ec2a7eea0b80548c0538d80ca81281f9b09fa85df97415dfaa13e8fb496ee58b7871095f45460af8313e63fca99c5ba10d82043d1a6051dec6590b464e85d214884610d115f7137c6d01536b221118df4dd3d7513fe7d0c8df2f2dc0d0e0a924f7b63f695f7c6bb8da9fed07f950ba9e64acbb1901d9a252e38605813e40e0d51bfaf61bb56e3a062c5335c8b4e27287394256bbb99852c39b5605125ce5f8fc668d5056ca3ff5d3d92f6326767dfcb522a7baf019dfee3a3126da855acb18b2bbbf78b1b3184d9d13ff3e70422df81d1968337e1e8e185422ee9efc5fcbf2c76c48595c57d7334e66b6fc2d2b38297420996e8e9f56082cbf41e093c5ef76dd01743af5865c3feafb1299d86bb5e5c6e0d0136da32c5886b78efbb5dd05b15c0f57bec4db15eb908859913a7870537fb31ce67160fb04d28df4dc4a192b8363bc0af3926eb2bedb2710e98e35caeee9dc1a4ba89e74f8a7b0ab1882128c58bb61c071320950acf4d0f85bdb9068af77948de28456aae25722c95d7b76dc75c56b2955d1c78dbe534a8c507f5b91f75e1145fa55f0ca13cd40475373502f37b5ab09da906467f1e911fab2b3ea67373c8a84fd23129378773fd6f487c502c2b038cd584627dcc68653f3bdebda10e6b28214448e60574fd17bba014d9e46567414bab6cf41c68d055271a31aa8952a1cb06fee801e8b0c70da5567dd3b0ff12799a806e217db7700ec7876c2322a178fae4b859a0375c9401df4336fd7a2f6274ba20dc5f181b51482a83ddc3be77037c5184284f663035919fce4aac71a0c6d664b85ea7c4e84cd6cbec0742e255c22403d262a02471e1e02d14e02ced170be107513bf9d87555344c8293379d89693a90819e28b69fc7fc73684364d8fd07f0331db4ba6ce6a161e4204c9d0e0f51287fc7235c09bfb47af7fb7dadeb6bb8c45c02a892e225aef82893082fbe92ac947381f9c3f9b44aaf44ca05bfc814c9765134c2a772de0cc41182715e20ff03ca25c4ee1955034155e21d9411c9dfb9401871b67b3519b96f1872ad26d3198c6ff914b05f04b918d4144e06b2b0e73198bd92a87c012e2e899d66544d8afec1ef1dcf6dbe529ae81be6c112f12ebb158035f4a2658aaf4bea4365f8b1132eb7c80babad7eaca5206b3185c4e0f0e2feb49d154b43a55b3e600317c012d3773bf08b061fd8cd7faa99c3bc9b622071bb6b5c2f2d95f755488c02900ba9ab8a4b4dea214c89d8bdfee2ce43965911d8d18bf0383f253e1eb707d89e7c24bda06535e27c4b03159040bb2a5664b29e73d9310054c9237c7e50fe9867a2c62a7c5e61b0d7e554baaa90d5aa1db032695273f4d4e8bccb4cdebdeb63b5183792e0a0b502a7695ec5d1d17687bf9d2f8cae05fa1d5edaad95cf4936e07fc6e5b757659e3dffec6a20b1ae9937c68f944d501522531034020279a082f75044b10a8340850df5f9ee3390f868316ec68e07468ad5f4215d50be2f91567eccfd60c0782122ab9ef63fca9bcce7ad7d301adcdf259c09c93e3376e5af58ea2d8bc3c3152a8f7a26046358822d907399bb0cd70d5755c474ccaf2aea7fb1d06773b7975adbde0894fb4f295da1bd01b5b255418985a76e27a547a353fcd96ace08b9ba3a94f478d73fc2e65313c14fa063d427fe5b7851798454aca4db560534f4d13ecc14edb2bcb0975711122166a795be9c767a80febbb14a418feb477d2293e3896346f79099638ad0b674d4030ab52691bc3ec3355601e849a805c3cd324d29c31e5d985e4c87cb62a0675802444f9f5e38dbe04d7cedc6d124accc32871efb5c9dfc63b06890242490591f0db37b72b88a0655443e60b18bb7766486ccd6910365ec7455f5a5755d2d3773766697f4ee48f44c2ccc3bd0e5a055a2e7109c4a665a10636c3899070b627191c082c1d4bf46fbb63a7ec9704397ce11556dd66e5688b2aa9dff4999b3823b8349e4907a08ea2fef7526655c316cf798536bd9413b31ffa66f354020f65709ce3bb8db9a2d7d860eae7292355e1969193ae795fc1081aa213fd23df86ad4f3ea21b8acf7ab217561fbd0dbcf23bd59714dc11d7bd262b48e0228e535f9d556a41d7e0da09b94c8b95fa61b3b9593e837b157df585a47ff7661ca2a4cb210b71dac84a7bb3e626d3f03e31a618c4a1c685c4f20e3835007c6ff7935677c88c3951a77698a7067e2d6fd9d8919b9c045302c02b6b2c7a2489b2170ad1f09babdf36590c17255526d1426d9e3ea359d34c7a28fb27c50dec6167e13b31d626f75529e4dba8300f22049a5e46893294ddea86e75d72b95609a203c238454174bbc0d7cf8c74b208dd88c250d77714a18210a5df12801b4b97ed796b37898a1277c71d7696c2785763df05dd9dff834e2fc8a03bcabea63f12e1ea2a0e7883f81f2f87a705eba0e0b16316044fbf92bab9e578ea696321211e3ff7e51a5c5ddb793877c3f038416430a56a56b0ae0ce5274f1f4ca5dc89d7ef1dd2ec40ecb5087391e426f7e9879b73f66f5d01bb771cd898378682a0c7b69cc149ccfa18060da0215d2cadc699ffeb2a7f65d3e54df3559dca6c2fddd84323cb1574479cdf75bbefc6c71342a06fa091fa5b7f7e509257def0e9ec8835b66dde4f8c6338135f15984f5a52452fe67700bca54195eadb4ee773835f72b13a511256b18aa8dc51db66e5a3b7145a339ecc58bb894764596ec0c7988815b3081c2bf5f4626d77f0c4d86260e5f4489a2bdb19da024824e6c4e964725bf588b5b9688a8c7ce9536d6c8bf7e2ae98c2b25b5035f98dcd76765d668a4e8dfe4904462973e6d60451af1c7168b2c45ccd34551c88589ee6bb2ff19fab7a95352dd97e4bdb32d36e074ef6031051069385652ec51507ac8b23df5e836192219674de69446167da079a274253bede779c5a21b40f66ced8723285189823eba552cec3a3bf50142bfbb612a673b52de19fbcc445c47be851a65cdcff649c451f6275d274e1ebb9f2d0438a863c315c26c6ced473b9216181ef83c9a8556e29b03be6687f37ae676f119927286d428a0b1280fbf8db7ca6141339a543576233ef5fe6ded544fe4bdd101dd001fb184ab9e46d1cc65c0716e600c06106d9b3f271c9a6b186562b43e1676a7aa6269cd78fefc7086305407b363c2cddddb36e6229d5d82f102f04e4845a0798b78cbafb6f82f07062b76f041a93a95ee9975c7f0c901f39db49681adf0f2d025ab968135ea655deb2a869ac228e5be393aaa2276fd9492902b346c5e38ea9b2303ab81a5a5a193e926b9ec573f7d3c382eaa9043247d84fc5b197de5188717525a0fb30124a9905259ff2b569f1741275953e6182590e3c88282d21b4f0bd2f81a31d5241765f88dd3e7e184c258207c184cd0ec2bad9be983f94f0cba311c21079fc067c7d9772be698e208ab9a57a34bf8e6a9f1e0c3237de1678023f784af171067fba277f2cba8f5bccc1a2a5fa498f888f725b2e3f9d2161f676aad58fe831b9e9ccae5d21b26521666dce91cb8fdf53f6a1946106a1839ffad76a329e7812defa9e4933e26ea49636e15c97b490acb5c35c0268b8e6a2ac3e2ebcba84407621fe2960901c72cb29ab40f8fd8dc34cac6ffcba7679165df6937bed26474d17540ef2a9d86447a83ae55231b530afa089be699f7342420bb4d70c101d3f350f3923ab858c014aeb547a1232a104ab7f4b9b78dc45d85a6caefc5c2e9e7d324999dbc9e38d234d7ebe028f8540db25034572af2fc99b7d6589010fdf41a9e057b91d9e78c5966691975eedf6fb136691cd78257ce34859f29dc849190889d8b6d41a9db84eee8cf30cc7b54eeb7801e2128ea04cca32cec6dc579926e0bb142da47dede22d73f60e57d837b0e0512cffe58e4152ef77af9f7c24f7c31315388d345a52d8590f91ec198d42c464f487c58d8c7201a4debbc94cdc8a221c355aa69b68a7fc83240860663278b59", + "shards": [ + "0xda1070331c8cb0834c79ee893ed1bfb7d43cfa744053a0748e200e0a858614d01039620f02a7395524781b9f6efa83cdcd273aeeb79e51f95ba34b646ef35409df5e572fcb0d65e712a53fe5970de227c067f2fb576472696eb390c7b3b93c4bd3be3e5b6e0586a6c72893807c7f4b4133e59031d7d27f3bf60a81e328c973b7018099ea638c7419fec8360dbc692b09207e353bec9e4f0c1f1b4071aeb06c02d5229495c4146475170aafa607a0f76870de09987d388dd7f25a1b0640b56935869042d05f5685663afd9ed779e7ea3c53fe9fe1f1c63e8d530c68445cdb901a21fa57f94a8e03bbf07937665f05f1e9bc41223b83cb82401098426bd539017edaecf79226669d2f181bfaeaca5a93fa24429c46478e7c72d16fa46a66c1996a2772c9a44574f3194618b29b73072771b09ed218685cf03c90fda74d220e33f6cf0fca4f806adc774f8ccd265131de97669d1aa3f5099c8dacf77a2b66e2d083b7a2b7458580277b090856f1ca96c10c764b394b575aa34c32d7e79a68e2e965084c61755e8818528cd351ccb9f25c79ca2c1a9a16d530f6791223d5fa1d631e97e08ab70b5cc09986876534116f10aed3baf7b369343e2cafe21324098a2d0719eeb3cd14df8717417227aef76937c7ac6814ac8f8ca05a7be534ac945a5d0924368df84c6229eccdc6ebc10c3fc269103a9333a01798b56b9b606fbad6b747230ee19213243292f4443151bc554bd7cfe6a8717cc74fea9a4fb31a4bf608d4cd7c15ac9c605d5d426f82b55612bba6c8493711418f4c829495f29c211b460d402bab518ac1348a5c1fb500d49cc88aef9b4c7108d40c5d20f7a0be1cf9b847375310f73ef9ba8956e71ea6864488d98cbf47dc9e801ba43545ff7f2b08f66ed20e48aec25f65dade315aafec314138d59abd0cc64cad98e49498b8790f017eb8914549413862226eac76bdfff7f6cdb78ced5e0fca93fbda46bcb9f202ec58a568e941bcf7a4cfc31563abd16cbc26ab2e08658ea1061aaeb7407221dee452d7d29a2a994ef2af124aaaffbf37ed86d4e8d849b11f38df0f534bfb17b4485111f2d166c0a81d3f87b3856c8f3125e9ec7d68cb1ab55b6655d344888a58fc71185c7978cc7d48c99ea1ca00713ee840027c223b8fa499965b7e25247c26856ef49ee0f6cc63918e73472be0a05adb4d1fe8c5a31c0e28a14c29a549d3deea3aea79542c575e1f612aefdc4357ed60d8256dec976a0519988ee12bb0bd9cf4a60acf80a7164ed5e37dbd5abea667e88361d99fa02ff4ba70ae890f543c80767d0f53b55be423de83d206744145dfd913c007e3e56a420529d58d2f9d8b9e842a70b2ecc3e77505172dd27bbd01b68028dbf5bd82525b51dbc9a186e86308d935f637149f5171b519ebbba3f464e4247e674051cc392777ffe4a4b16ecf4cf938720426fa3421668f0b609bc5c62ff3db795a32b5dd2c5ff8380b8496395f42bafe3d1a318aa6f38266e752ec39ed881e783f2f4623893403cb1daf9b6744636efce6e8672536ff84a4fa355853a86fe8ecd1b011bcfbe29e0b054bf9c11509c71fcaad61b1c457da71327635b0743f060b1a337855a7e821c9846eff4e3a4b72e6c44d615a0ed4c3eb143d8fdeb1f6ef5b5c19a8f2843dd9435c67aa0381faea10ab45b708c2972b78a02d2a35ee4cc0cff721c31fcdbc0830ef6766221b1fd07f80c219e776517fa7b2b318997aea3261593981195efb321b5c9d3970838121b101bd342c2163da8a075a56fa435e005cadc1ddf2cd1a9d844c6745b253539785a07edd92f6d2d853501e533a59cb2928c95d90e6a80e6a64ae2377bc0811d802722b9b27e8edeb245e00d7a24b7763b6fb91ca64ca40dafde3e2f732c4debaefcc927976ee30461d4dd3b5388ce7aea6a516019bcab7a3adec41a14e9841abb1c02623b0bdc09b1352da1f97bf801bf01db8cd4cdf4c76529f96c65f8c1e984a5c5c8f9a8d0f4d4931ad1dccf5218da6d705b8a58423dd64d1f2c4907a4df4539760de9577b6d9228f968cb30d4aa851e21ac03dd9d24c21ea1ffeb9a2bea5c9e918efe68100103690240f977a2849b3544c225911fef9dedcd0a6e8f2e24a78d35c33e1da406b98f5e636e428a8a4fffe7270157b9f700f86b10f4b3b96cd14b49cbb1ded46e6a0f1f91c34587a5e512752787a36b5d03934d1b4c58b0bdb49da16e820005e75ed7644ba962bad3734f19c41220e5f79db9f447de6c2ebf59088f3840232f2280da236ee8697fb594238030115a57ba7a57ae9505028b5a5defbaca648911acf992b1215069117fd2aaf76a209d9f2ed97c1315055181e0b3591891d6279922f4dee57c3344773fe991cc23184b007738614cdb78ace8a904bdac5fc59c089103820b8d68297c9b21c114efd428a17dd570333291c84bef92298dc35e31ef8c78532bba7fb5ebe5d3ef3a78a27042f8d8576f84304e60feacc0c9dec510b84cadb5d7a304f3f2770b96cd50eb88e90381f556463df272c4dc90d95db26d1d08616c3688d993a0be52bb68ee3cc8dad67f8b4b5f45b4e78c4f62329a5ad7c844e411b8f3321cd0e32e3c97a29843976e1f3a6354278afa857c3e3edfb4529fb09a54f41ce228462c58e8fee74cb86b67d639e79948710711402b8b6592ee6ca571adc1d0ca5515bf63c7ca9787e1398b3d5322758c0555a74df31ca3259596b6b8f3590cd91f695f16e26d203d2c3366de3393bad50d26fb63caa34c68be4c7d824b418234ea61517989392168c92abc031f31a157957eb16215a45bbce5109ab91a135baec3e0c0bbc3acdd0ad3a615fe4f47c417ed2498f116d34229775b305d243d6c047f6514f9af6abc0ebb9bf50baf938b54f3214177ba25a302abe59e5aa778b72a1d91f24a3bb4d11d7f5713a2c6a6f3a9428ddb8bc28dc411e4a31cf9dbc58d166887b8027d6992b6f8abb50b6c67f7d4c9cfe2e8100440de5b1e38c28db562c4a430cc66a5639a4b9445280441b5fd79c1e0c00a89a0a9b9aa63f6e9a4d4bd1e9c943d6618f1eab6f369f510d9e505da8f3d631b010ad70aa6244058af2a8cb93214227eb76d5953d290e52d5f0b9621bf5785d7a71de9d2c260fc1df54e2b1655ef33afe8df6e30def533b81a2bb258daf4024c154958af8c035e2f3d16233876777be253ec7d028fd4154f158429d9d91c0f0d7b3f6881450b4ceea4f9655631e75a349791ad12f11ec01403569fc3247d6797df748e03f1cc37ec67dd34e3677a418db26c93f5270550503557aec51040d1f4c4f318ec4d708d0de686fa669c122ead35d2bb36a2c84a7a1f9e1a0b73179a51526358a0e3915da60de4b1da07f20bcd43689ef597f21dbbed5c711fd0c06770d28caad03e43a068f336f0f7e4fb80ede3cae11332f307d316e36ef2091320e4210ede94eb0ff571496014bb34ea22c277f8ebb6a986dfa29e0963180f7f3b5e9b89532140242082f9f62c3168391522a68eb62408dfa35e18e87941be3caaee8371607ba602607131a750983caa48a724935fa71f8ac43042d5f3456aa2394faa40e048e638918880998fb755bc8f2a72d5abbfcf9eb0c3fb6158f141bc6381a5e749344a94a6588489d272b03f47e233896abc596557a7885aa9f589d3e38b99d3b326f345cc972fad579d549e3c49df9645deb6e3d150b8730b1ce4863eeb965fd8737e84a2902493d3a7cb28455746391e4cd805ef0a2c1d0aeffda0a3868ed14a772647722859160e4ba13e02959165355778a1bc98cfca3ef0d52101935df6f1403d0246887dbd71cacb01ab7e217f50212486e5495406e88d49389dc81e61bbdf624b6320ab70465b5876f506c00159ce15fd289010b43ddb35032785aa60b323f0b62dfb2772c518e101445a2bac43721d9c7ba950633c2b54ebb8c0e51cd25775cfa8b2e19dcb558640d8f19f93a01c01fc60e3db8997ca8901e82486f7990d2b9b3b79abc4d142d74f270ed992a6a28b73886c62c94bb6938c93716c853ec3f0968d44242fc8ba62b2c736694b8dc35b7cb89fd4a181317e95f1aead6d8fc80d6df0db2989aaa7804700f2f2d709bf600dd6b8b45fb0878a88efe50e37ec7ed71b32126c4aad784ed60cd7d1b2a12b8aaeb81875c17d4b039d47dad514805d18e02916c63b9c4a2155e9df5581bab0877ff85a67d01affaaa7a678bdb4b8bc0d49e79b5f5c02e3ac88ea8a3bb93104b5ab08c8ec908c6fc170930dde23275655f14eb5dfd9ea13952a940a8ac7f61720bbf67f56c11aa9f1d7b529fbcb43d0ed02661624a18a5866286dd16b2e701fdc7dc3d67c7c32bfc7d8bc51ed197cce404a445d391b0f10a7aa9f1cb64befba60136f2c8af77a69f7e95d131e098755e6ea86b004a1d6672349f67d28c65a576c4977275c793ea7362c097b47a879aa93ab48a52cbf12f36be462c4586871574684de7a15f3ae3982144e6b5818d6ea37b4014deea674e2b81c0bcbfd7ab27650b1d2ef235d3e4d33d3e883cddde64ddf8cdacc11e21cb3eab55af7b7562ecde4722c5314ae2dd4da5b891fc3724ae8b2c625a6289a3bfb005dd4df0f2589f61b19dbf20ae80227be9395192f7c26ba4ae71da7c667c9e99362fe88615ccc275afffe6eb31692e7761379b2ee385a8ee055cb886d74b68918645ad45d53832b37eb49036a8d7d2e4e240edceb211c3c6fc", + "0x04b46aead1887013212ceb263238f4995aa6e695df500d5818b508b1c12fb7e65fa9d4a32b6092c3bf722216c8bee55ba699a90cd763bd7a1fcc60213e3dd49f75969a1a5241f734c46a4cdcc77ec50c1551acb330c908bed3541f5fd396d108bf12922a48bdaa173cdaf8c8bbefc84f6f46331bd0147fbae36c9706e4b27d8d9d18bd84a1bca4fec0b4c15f3e054723d9fc2c60d376fc5f7d8c74813b7b210f66e95b206692fd607ca1b29e3c28c0f61e2fcf27df1c7b847e190733e78c843d66958bcddcb03d0d466512cccadebd247ae5748560b4c43f41e0a1d7202bc068fbb1a60dfd81b418352b83caac2cd3348623f67cb3380f46958ded030c9b8c04a7668bfe0f711519eebe46e51f8deb80b69caf8399019afbcb8207c5cf8f209c9098404f0bbbc47f45af8591c641499e7929d9b78e13fc4c95cf0bea602aa7a0d2300c9e1ad82f790a6d78c010947a7e6eec7b1fb09884bf8e71c0cb8d2b8c8182126417cb111aee8e4bf1dd9ba87e7e0ca29011143a2dda3677b25141563d32298e56f5c09b15b26dad34816ed6506da22673ae6095c82b4a3cc97a72d8d3ef6970404189b848dc0830cb912688c6bddc50527a3cb76d3069befc63952dd82d6e2fde08d0fe18ec7c075393fa7b24ec446899a16586116ee8350e10f272cddeb6847c1b4dbe22a5508acc5bb96cf8b6b6e2eff1c781f69f9083993c684236cacc202a8002e9a7621fcb821005ce8d7470038bb8ea280a38ab7a49f23dbb2d9c1f73c0c1e760de5a5fc222de84aa0db44dafce732e703d84429191f0fde50c28df8c49a01e1ff3ae8ada3a879cfc3fd956e186171ec4588c1ad2639fac8750ed84ab456885cfe2744539af619923edada050d36b7dd3bcddbc7f56fe8bdb8568201626b5d37e281a024c8d77f7c548458fe5c708ceb221b2bfa8a29aa7afa95618c4f5f725eff018a70c63ab10750f2a359300a78a6555408835c851691b7b2756ca3bb8032a8670a78176f03dbc3eecbade8d0a5d1a9982cf4dd7e58af193540456746732601837e3782d2b0dc27bc1b82bc7945552c4a2d5f97c9eb227f462e4ccf6d9aee8e8ddffa54e9c58490e8f76671100b62a10684fa934ad3915ae801d24da907f5ed16444d0860cb032a296a494ab55bf1c0d3274fc49f4193d8c723f10b9e03f2eb23eca6950e8631e1d7ac440dc0e0d6c037bf8f04137d93e401309ee92bfffa6a5d87995e8273beeb3691f3c8820b91fc06a97fc8241aa17fcc899a882414e4f078ec97336e48a32b49189f5a759c7e93eb0cc46d9bd7f90ee8902547a88ebbd5c492c7cc016d1c4653e1d1040e3289a8ae33766754d275aa07fdfdc421c0a6bfc961bb9c2c29cae76bf7ba1f1c1899fac3172675230a9e5ecd14129a19cdb10773936265ca2ca1fccf75696b10a37eff4ee2832ff2fa215ba9ed85b7f80799602b1e8d9455f8050a8a018b667c7d1680b97f54e7c447a13ba91aee5e538f749fadba14ac85d9bf1519e4743fb6bba5c184a0eb8d1193437b0857060671b54f97a0808207d1f06ae8b60ff55957a38fe695a9f6cf761fea542e69b93fdbf91b7606362505dc93bd36747c3100b4773d352b027ec5f9043a876bf1be10efef5cb450ab4ed846aeede16ae1240f77075d9059411542697882b5a96f21316ebf9f833ef2decbbe99a1399bbf2857af35b6102f462662606f0e20ea1cc4fbb4dc3f84e5c51a934bfc71e01a9f12e2f46c60e32ea7a98c770237d35252df625a522dc6c4bd8bc7b90d8b00cbe12cdd14cf527c62f91166d226ff3a1ddce458c1d643a23e8e12741ebc52801c3cbea43becb93c36496c69e668b2e1363a16a900c74397d346ccfa3ac265f89291f010f83c2d458fe2ee810a12f4bad56a5078fc0f9dc3dfa5e565115dd62c06216a15ee267433391180c510f0201ba4de96d58e46887cb036ae811cfe8dd20d1af39183dbfb06fb80119558513636a9fa85c74ea14ea36cf5a1b6712baea1d31450119d6683fd707a784d782396da468b5add34a6bb0f8ec82205a36a390d5d51bc6bef0c247ec29e6c8adee646a23a412c025301f8b4e363138978af59dc94194862a3ad3bb40e514cbddff6f3cefcb9f93cb418e6cfe46d151be9fabead51f8b0835b94edac6665058b4707f30414ca16377a1d5f6c785d55c2cbc53db30f1946f4311ff71523641669a4e2f91912af6aac7b1480293026c3e2331c6594bc8f266e7f40bf7ad1c91a7ad552608607d5b53ed680ca7a982231f92c4104759b6710d9de1682a0be09f0a759800729ccb38a85562fb8c354e285df5a40ecb223f15f0791ef977c80fba6a02045d5354a28f4c74af704fcc626340ed58f036a8dd11317c0c26607d5e41b249ece704b434ba47657c7149347206051b798b725d32fd6b5b1945f260e3ef8267fe85d8669468cfe0049818d096b087f10570d4c274b040f34824312c1f29cc7f09bd1c4784a6f9d8cfe272e161a5d8b5e3544bfecd438ffa1da2553554654d59fbcfe9f11b1f3534ca52cd036d7e71fa9f57a7a756b5b4b02cfb9fc768250cbdee6a486b4c7ab2c7e64410fdc6a7eee10852afa8849050f750980a829f783d6153f8484386dbc757a19acb7dc5a8fc4136be78d586326c185af6f6eddec1e2ff9d18349345f78068491d4bf76414f903e245fac278f14aa038681aea8483630dce9d7fac86891d0416cd9c941adafe4d15ec1192dd1ccc64eb93aac44cc6961c3ee98ff57336503d7b3a767050aafedce51096b0ba285b15b89c32144a03c21b9da167e6b7a70addad9f27e656b1f68d781f89ae1e20b1d38d4c9d29d9720ce8b7adf35b4e37efd0195e6fb7899c71b8e6f174af3ebda2011263788f1b2570b96e0cd5fd39ef661e577f3ca0d1f3b0556980306c807514652661f93075d22f0882ad80cee551e8c08a5f658fc3e111cacf43e9565c510e03f7cf8571c6810b2d113c9defd8f4c6d92725cbe84cca399dfb69e1c7c46dded0149cca48de125716a89c6c87a9d501d7bef415635003b4041a22eb4f0b89e5280ce42ea35df7874e78472bde25781119f0dd281c5c508b3f986e74a4072a3741127b1872f02d02eb26c93c2b23d0d938ad52fbea627ab33661bf0c334d8f384e21a648f538ea62fdc6e094a2dce7fd4f68b69ba3bf0ec2da739d1719772abda80e5ef8d5c5e5ae9024fa813d583fabd7a65130f81d180a78edff0cbdaf4028c7bbd65aaba8f9082f7432e9510597476b1a8f933e54f4ffbae0aa8c9626836ae3f10945bf4e0ebcc3cbf74dea1aee6b2a1cce2060795cb2095646ab7254a71c57ab86187aae72529dc2f925bab401f7fdfae20dc0b39389ba83471d5e267546bc6679705d151af8787c726d8e8c506a8ddf7cf184fee7411528841811ee2b4cb9135c0f16af8f9ea632eb7d241bd70c197eced9f445c216451aa65825a107a070fd33284af1cd8dac8976d7c9d569eae863ff201c5b73436c1581d46e52fff116b1ea69813c2919f623096984a932161e907cce5f6f687b3f0b642cbc3e726f009d1dd0887cfbabfd3f8a087c298eee900c2bb47bd9b0cf06cd21b6cd467b28a2fc64feacdb74beb26116ae503f0ccc8f9be67a4dd13af13f535a97ad721e78f44830ddd1cb804d63a8c186383cc6b13bcf9ea84bc688aa11386cdeadc2b568e68c9ae0c5e8179791acc13d6ceafbadb4899d6bbae67429ba7f040420195b888c9b36243e8e84edbf2371b63e88983ace1b8724c537f3c77b08850e56063a992ccf3b2cacefedcf0ec5b42e64e06c0b1697ec8e8cfb3542504680f35455ae6d6392da1c9dae326a5cbdf94b93d07dd9cd6ac6a3005ae21eb8bef5637c74af158de427b11e2a93379cdd7568695c85c30af2ee76b568980f64fc0a0be6039f107f8148a769ead2e9c3cf900b42b22adc56f4abb10e4c590903e1a8bec130742e6ad75eeb1936cfed577dc5c1aefe7b2f9ef251e264c575c9963ec304ae76276ea1faf76611f8645f8fa83de2fe446af5f11e4a84d92fccdf8af3f3da225d47012b823e52dd0d2060314c0fa78203f6065f6dd08e1d51cf9278665ff28b0a7690ff1654fa0e3d4f686f8bdfc4564421dbaffb36420b892f2ebd3e3de6c49b081bb1d3ac843f54ff4c8a5b3c03af6735a8e74b693b97b88c9881d640e46d75127903af9048e638dacaf2de6758627196dd55201d66aaa078db9c11ac9043244603befe0d9e26c073940a480c2f08d0c529c6277adb307b9388899850082f2bb4f4ee21ba485c59f3a58fbd1834d5cdef80e04e64fd8bae97e0e609fbcaec7cc46e5536f474c55e8bc469ab034400907855db88884b306a6f2fff684573f41dd1de25b7901e6156b592034085e70e03676fce899c26c39804c906181b7fc31c4723b6b190885c90a34f1a50b1d170aa3bcfbfc9ecb286b7f67dcb456e08a26fedbb0c4d595f67ae069cfd61480abef4ce6b744ac01b226c887da3d47f43b57c2729465dddc3a71ad4e407080016829d98aae5f21a2833bdfecdee439eb142a29a943ca8c2011b82d70a9d492c5f468411728df49a65d07d2f51f7f2e9a0160c974da5fe2cbabc04cb57646a30120081f2083391555dbc430f83eacf7785a2a7eedf19866fced5acf1319212190f984ca20c116d53201362c96816ee8fc8bd627fb597088eda84c22ce53d072b75d9f3fa1698c83bee", + "0x8d4d97083813bc47b7e96a1cbb5b200bd4b931274a383504e2b07c976b8c2e1823000d311cdcd9dbdc5fb6115d083e28a74939cad20479386cfccf888c07598ae558cc5947f446f6ccefa6940900eb3928c5523ed82a632d51ff735cc33bcae052046362cd6286c5a409bc1df500761b55563a368539772e30127d6ba75462387509d6b095f8b47bc9a0ea9fba0293eb86a5c28e814456725bcdd4a9bff7c1e415e96491262da688aed88cfc47284250c62c93f8950d931e51cdc83f6c0a6c5bf0f26fe00b2fdb3739b9124fc50a4bf62a6b9c050cc6a94ea93c1294334271f95da99530382544b37b73e4c3db933b606a8bed418b7f3efe90c77ccd4feb097344b05f150e9e6a7465a69462c0ab8bf719e6d6d8c3fe8b8b8cd0f54b18b221cc56b6500d35c3114963836e58063f1849593adc570e41ac3a78d2f9a32dfade222c49c14b7e64c5b577a7ae4efb4df702c4c84c5382afc6c9f92143f60777e85a47eb372f1ad1b77c5a96787904bbde0dd0eb49901aeba656ffe934382056dc4d58f5422316cdf9359b708bf36cceb0220ad5976a96d78f9b0d996fa1b9684e393a6fabd97515c96cd6b039584c6b40c0e3bddd6c78912dcf59b85caa4d16b960837c6031b6af053feb6832f8e3374e2c7cf6528494f9b219a8460a0c4414c22030d3a6bbeb113443a4e861181b08ef31f8c9ee0b7e8e0469f0dc59d02d23b73ec2a7eea0b80548c0538d80ca81281f9b09fa85df97415dfaa13e8fb496ee58b7871095f45460af8313e63fca99c5ba10d82043d1a6051dec6590b464e85d214884610d115f7137c6d01536b221118df4dd3d7513fe7d0c8df2f2dc0d0e0a924f7b63f695f7c6bb8da9fed07f950ba9e64acbb1901d9a252e38605813e40e0d51bfaf61bb56e3a062c5335c8b4e27287394256bbb99852c39b5605125ce5f8fc668d5056ca3ff5d3d92f6326767dfcb522a7baf019dfee3a3126da855acb18b2bbbf78b1b3184d9d13ff3e70422df81d1968337e1e8e185422ee9efc5fcbf2c76c48595c57d7334e66b6fc2d2b38297420996e8e9f56082cbf41e093c5ef76dd01743af5865c3feafb1299d86bb5e5c6e0d0136da32c5886b78efbb5dd05b15c0f57bec4db15eb908859913a7870537fb31ce67160fb04d28df4dc4a192b8363bc0af3926eb2bedb2710e98e35caeee9dc1a4ba89e74f8a7b0ab1882128c58bb61c071320950acf4d0f85bdb9068af77948de28456aae25722c95d7b76dc75c56b2955d1c78dbe534a8c507f5b91f75e1145fa55f0ca13cd40475373502f37b5ab09da906467f1e911fab2b3ea67373c8a84fd23129378773fd6f487c502c2b038cd584627dcc68653f3bdebda10e6b28214448e60574fd17bba014d9e46567414bab6cf41c68d055271a31aa8952a1cb06fee801e8b0c70da5567dd3b0ff12799a806e217db7700ec7876c2322a178fae4b859a0375c9401df4336fd7a2f6274ba20dc5f181b51482a83ddc3be77037c5184284f663035919fce4aac71a0c6d664b85ea7c4e84cd6cbec0742e255c22403d262a02471e1e02d14e02ced170be107513bf9d87555344c8293379d89693a90819e28b69fc7fc73684364d8fd07f0331db4ba6ce6a161e4204c9d0e0f51287fc7235c09bfb47af7fb7dadeb6bb8c45c02a892e225aef82893082fbe92ac947381f9c3f9b44aaf44ca05bfc814c9765134c2a772de0cc41182715e20ff03ca25c4ee1955034155e21d9411c9dfb9401871b67b3519b96f1872ad26d3198c6ff914b05f04b918d4144e06b2b0e73198bd92a87c012e2e899d66544d8afec1ef1dcf6dbe529ae81be6c112f12ebb158035f4a2658aaf4bea4365f8b1132eb7c80babad7eaca5206b3185c4e0f0e2feb49d154b43a55b3e600317c012d3773bf08b061fd8cd7faa99c3bc9b622071bb6b5c2f2d95f755488c02900ba9ab8a4b4dea214c89d8bdfee2ce43965911d8d18bf0383f253e1eb707d89e7c24bda06535e27c4b03159040bb2a5664b29e73d9310054c9237c7e50fe9867a2c62a7c5e61b0d7e554baaa90d5aa1db032695273f4d4e8bccb4cdebdeb63b5183792e0a0b502a7695ec5d1d17687bf9d2f8cae05fa1d5edaad95cf4936e07fc6e5b757659e3dffec6a20b1ae9937c68f944d501522531034020279a082f75044b10a8340850df5f9ee3390f868316ec68e07468ad5f4215d50be2f91567eccfd60c0782122ab9ef63fca9bcce7ad7d301adcdf259c09c93e3376e5af58ea2d8bc3c3152a8f7a26046358822d907399bb0cd70d5755c474ccaf2aea7fb1d06773b7975adbde0894fb4f295da1bd01b5b255418985a76e27a547a353fcd96ace08b9ba3a94f478d73fc2e65313c14fa063d427fe5b7851798454aca4db560534f4d13ecc14edb2bcb0975711122166a795be9c767a80febbb14a418feb477d2293e3896346f79099638ad0b674d4030ab52691bc3ec3355601e849a805c3cd324d29c31e5d985e4c87cb62a0675802444f9f5e38dbe04d7cedc6d124accc32871efb5c9dfc63b06890242490591f0db37b72b88a0655443e60b18bb7766486ccd6910365ec7455f5a5755d2d3773766697f4ee48f44c2ccc3bd0e5a055a2e7109c4a665a10636c3899070b627191c082c1d4bf46fbb63a7ec9704397ce11556dd66e5688b2aa9dff4999b3823b8349e4907a08ea2fef7526655c316cf798536bd9413b31ffa66f354020f65709ce3bb8db9a2d7d860eae7292355e1969193ae795fc1081aa213fd23df86ad4f3ea21b8acf7ab217561fbd0dbcf23bd59714dc11d7bd262b48e0228e535f9d556a41d7e0da09b94c8b95fa61b3b9593e837b157df585a47ff7661ca2a4cb210b71dac84a7bb3e626d3f03e31a618c4a1c685c4f20e3835007c6ff7935677c88c3951a77698a7067e2d6fd9d8919b9c045302c02b6b2c7a2489b2170ad1f09babdf36590c17255526d1426d9e3ea359d34c7a28fb27c50dec6167e13b31d626f75529e4dba8300f22049a5e46893294ddea86e75d72b95609a203c238454174bbc0d7cf8c74b208dd88c250d77714a18210a5df12801b4b97ed796b37898a1277c71d7696c2785763df05dd9dff834e2fc8a03bcabea63f12e1ea2a0e7883f81f2f87a705eba0e0b16316044fbf92bab9e578ea696321211e3ff7e51a5c5ddb793877c3f038416430a56a56b0ae0ce5274f1f4ca5dc89d7ef1dd2ec40ecb5087391e426f7e9879b73f66f5d01bb771cd898378682a0c7b69cc149ccfa18060da0215d2cadc699ffeb2a7f65d3e54df3559dca6c2fddd84323cb1574479cdf75bbefc6c71342a06fa091fa5b7f7e509257def0e9ec8835b66dde4f8c6338135f15984f5a52452fe67700bca54195eadb4ee773835f72b13a511256b18aa8dc51db66e5a3b7145a339ecc58bb894764596ec0c7988815b3081c2bf5f4626d77f0c4d86260e5f4489a2bdb19da024824e6c4e964725bf588b5b9688a8c7ce9536d6c8bf7e2ae98c2b25b5035f98dcd76765d668a4e8dfe4904462973e6d60451af1c7168b2c45ccd34551c88589ee6bb2ff19fab7a95352dd97e4bdb32d36e074ef6031051069385652ec51507ac8b23df5e836192219674de69446167da079a274253bede779c5a21b40f66ced8723285189823eba552cec3a3bf50142bfbb612a673b52de19fbcc445c47be851a65cdcff649c451f6275d274e1ebb9f2d0438a863c315c26c6ced473b9216181ef83c9a8556e29b03be6687f37ae676f119927286d428a0b1280fbf8db7ca6141339a543576233ef5fe6ded544fe4bdd101dd001fb184ab9e46d1cc65c0716e600c06106d9b3f271c9a6b186562b43e1676a7aa6269cd78fefc7086305407b363c2cddddb36e6229d5d82f102f04e4845a0798b78cbafb6f82f07062b76f041a93a95ee9975c7f0c901f39db49681adf0f2d025ab968135ea655deb2a869ac228e5be393aaa2276fd9492902b346c5e38ea9b2303ab81a5a5a193e926b9ec573f7d3c382eaa9043247d84fc5b197de5188717525a0fb30124a9905259ff2b569f1741275953e6182590e3c88282d21b4f0bd2f81a31d5241765f88dd3e7e184c258207c184cd0ec2bad9be983f94f0cba311c21079fc067c7d9772be698e208ab9a57a34bf8e6a9f1e0c3237de1678023f784af171067fba277f2cba8f5bccc1a2a5fa498f888f725b2e3f9d2161f676aad58fe831b9e9ccae5d21b26521666dce91cb8fdf53f6a1946106a1839ffad76a329e7812defa9e4933e26ea49636e15c97b490acb5c35c0268b8e6a2ac3e2ebcba84407621fe2960901c72cb29ab40f8fd8dc34cac6ffcba7679165df6937bed26474d17540ef2a9d86447a83ae55231b530afa089be699f7342420bb4d70c101d3f350f3923ab858c014aeb547a1232a104ab7f4b9b78dc45d85a6caefc5c2e9e7d324999dbc9e38d234d7ebe028f8540db25034572af2fc99b7d6589010fdf41a9e057b91d9e78c5966691975eedf6fb136691cd78257ce34859f29dc849190889d8b6d41a9db84eee8cf30cc7b54eeb7801e2128ea04cca32cec6dc579926e0bb142da47dede22d73f60e57d837b0e0512cffe58e4152ef77af9f7c24f7c31315388d345a52d8590f91ec198d42c464f487c58d8c7201a4debbc94cdc8a221c355aa69b68a7fc83240860663278b590000", + "0x816494e26ec97a81f8f36b5fa1bdc704c65c917332bc159f0269dee4ebd155b32b0833ef090111ac25b9902a4d57bc6816bd921097df1f199c40bf2a428e5109ce9089cff676b7d19572c5bd0e51102bffb0eb2e8aa508fd39aa1fdb997b3921ddd06688717c6ffed79f862d04f55c5c0177af1f52e292275a0ac4e266a2c481dc4a1170934f2cfee3368091444581703df7001c60ed0ea982f776a6a1e0b031a4178db24737d10c3adeca502f7bcbaa0bfbbaa8cc60ee1a6ecc3fc3eefe4f4862c9d160c36cf935bfcf8b995d309d4a955f862202299accc3045e5c14ea9bf9a2a2d54edbb75986677619930dcfa150ab74c30419a17c648e454da51184063f8a0820557c990f16775a259e51fa697a72018c87e2260a2deeddaab20d294e833cfe110bfd019a586478f63da99b136aae40dac514eedf0ba547029970debe776c710bf09495ca835ce51ea10c71bc2164ea54709bdc8c3aeab63afa010bb5077a2beb3da502724abe6ec94fd0b3f35961b81d68525940b0cf0802111d8bcc3932578ad7687c91c88e42a9e55c1261f21457e3f1340ad4fc87f4c0c4be15b6c7e4bd1489011849ad455732d59188c46f4a69436c5c784608e2cd9f06f65f005ccf0a04dc451b45ca5495c25bbc6c6e0ed173c8569af11ddd7982051ba62e1d1319013898ba8928ab70463d1a223ec650a504c3171431b11764e0adbb8351745560baa55d352d2c30d30d40c73a399eb1d66bbda72c2462daac3f4e1b4d6d2815e379464db3fbdbe6fe490b05b3b1e22edc523bddddeeb0526dd6e0e88cde6887ff9652eb51e037c0e6afcd8d8852a4e0ec7a20d25be89b2a9067d00812ecf1acee5ad315e5e461c736dfd2f20f5857c278da4f4a23f59ef6785a47a7e5cbf28bb50fdcd814b5ef823e05f599d679aec7d4d4845b55562c6d5cfb61d98bfed67d7c0e558fcb74d3d0f57d02ac4125c887d72869438b932122dbb3085d40a4e24251e87ad5ce58b6b4878f4a690067a76d4ebbd270eb20a8d418f2321aa6b1f57a405ca01f480d1561625557340289ee4b2f3f9707a3c71d1c53fc7e66a0fbb23263cab6e61e74a0ac6f606b4f8211bc343d2b6ce0b38e61f77bca3b44f9441bb09a21b3664af4880a1fa55aff9428cda7a24fc82d0144711ab4c5e22e75bea7686e76099688da455a3db380b717dffacab4e805cc9966a70bce88497de138ec317cf5f6e56a494b4911f80f0a96a21577cfbd20f3ab05526722ffcb936e65dbbb79b731a13eb93653249ea1c2a2585aafdf87d790cbbb9fa34be2afc4fb0a2638504393042e82a8d894a5d7972ae90f9ff6325df9cc49fe9c870bf52511b4cd0118aef44745c1c8f5dc764c4d07b6abe612615ab11047d978f2b10c030265c0925729e9c94e6da31f08c3c855446cdde313a1d7ac65717b45c93b3f4f8f76e20b313f18338e2cfcd563a3726819b7ad6baee8a6eddf9456118b28ca0eaaf514b9183130441aab8db8893fc70b0fc4185958504576a8de996895478a7e2b50c0d5200eca489820e9feda4433eb3f1dc880763c196a3f01315c59086149b6f4f6e52feb5dbd0479e6b8f7a861d5ff60679b211966b151ab8fadc2d2b30bd694d67483792b9f5b092cbe666b3d9e53e43ab0d9dcc3d7b42de4fc6a50823b37ecb733041b07d7dcf180be2e18e5fbea877a41b5c39dcadb5dd27785b182102214bf499b2a10d23648ea75359d2ec0fcec28e37b7579f6f5d91783fb53996b7daf38d3073f70b7c33c5c9042d8772d07d0f67ef7720ce582bec470692e400a7963b13f6e8534228258d53afa8a66626408d254c43c1d4f024311414933bcb428199be867bc646585bf0f7b7bf7e6a00ad8c9e89fc2a9c057916dfc07ae0b9fea72006b76021670d550778efdaee07876a5ceda1d7da93a56fbe94233ab85f36ec29e1c2bd2dba6ac936555cd291d0d9cc71ec3abad983b4152dad3b6467d1d2f54e17cf9bc12193c61392a2aea66e48bb65b715ddbebe04e808e32fddb0b28bc9833e7f987c5576c537f8cfceb7ae1779fae3f5c88e84ca07a3f110c6d4f387d2707ef1ef132a8e026524a1e9cd1a5049c0ea4c7fdd38bc9e155fd2d009ab4be726bb6b22d9b80022baed28d90c88a1f486e9a23a876fbe71b77aff84c0fd0dd4e1796f223f2b6ecc25700be4281f35138a27d5b6c0e45654c41c94525c8eab6589061af23dff9c5db18e7c4d0cb8edaf493777f13d0e1720c214db15bf2393decd9ed584c4d6c563b16e8c7c0e124583bd7922d483c6db28a9d145206f6fdf80bb3bea41454b1039f211fd75d7a0c2e2e3dc5ffe70bd385528ca62e5bd7b73ff8226f8f4c379f7d0aacb34bf218e94fd6d2695233b87c33e9767d945bd8142e39b47d143caf0138b119f418259f79a2c7c3ab8f31b0494699e1c4fb2d858648ccbd3d2e1d7a53a916b143e89f4fd55c040f1b7d5e037b1bebe00536bfe8c2c1516fc83dec11f4aaa3fae1186dad35dcdd65365f59b414185b8ceffef1ae4b20587edaf20b85b04a8698ff4fd95e06758d22fd785ba26c88121d48d57f83f100dffa256b4745c7be2a0237e65d84194c298ffc922381f7384427612b4eb29b2bcdabc1242098ed3f9702cd293c5dd525812f681f65119cc42597c7002c61128fbd147def48bc81b99e02d01afc1264707c529cf0ff76ba051009de090e3e5b96bc1d68b9bbdd04a5e54a3c150a149b1db0520e0d1841a1ca52f943bae65ad7dc07947ff94edd89ac0866d94392a1b05fe6c4745520d03cc38b9d7ea25a34744fa3f0b3df991957c2cb794f688d78ca905515d31a2cf4c350fce6e90c833181296c8b03b0ced6deb8af15a0ce2a44bc6dab48199841ac9c58d7bb8e3847e9d1c045300e6377ff9fb85a99215e213c1228be346a076cac9da69ddb4ee3b58860d59dd218d0a5ec61c65323e4a9dfa00cd0301c2bddd1bd7c413e7f7475285ac9d8397235ae7b8d75f793bab29af8b061532b023197b9f3baa83fd41dcd159edb99f31658304e0e9ff6d920ade0ce074ff6cdc6b9db10648fbd10e0cb3039fe4f115efff3933743bfb2a309183c76b9886b532a1e4964de03e673d3ea1b20cfd53230ae0c990d667043e34d2767eaf2bbaa4e47da38fa43992d3d23b668f16b3034cba7e5659ced8a457909fbc2a2ecbf4213beeeed99778a73e871cd4a3ed21fdf6c5e4146ad2d1f7f0f13c648fd6d4b9378fc33d72fe2e576fe5b39bd8027e41b3e8790a5950c5a7103dfb87a17fa67c848c92241162f39f72d484f735050d1017dc8ca08d28f26ab52787988cb65b09f4f2ebfceece45bedcf28e121924207924d1f2eaf8fe806a3438030be304f3f9f6df856b09cce7333418bb7d5100bf398b8ab549393a44a4522093b480dda94d515e7a095d0601ecef1f50f0e13fe8ed353d51dd4906c1b0e6a4c3c12aa968d262e039078d675e2f632a8904a26cb819d0f65b988ae611e11537d9ae64638324115eded0b2b19ac6d52147b869bc11ffd8a6174e8e323634e6f21b77ea2c23d532add8bd6a028d6b86733eb6d1d67c4d92902dd19bca316e9bf54954bc112665c3b4082d4c0749e82889cbba8efeb69a53c78453f5bd4000b2df5f02e4d1a5069158d1baf75a5be6e0d0dc2026ca708b8085db2c12fce75876220b518f9a6e9eaace70980594f537ae01ecd1cd5a1228c6f1a47cdfdb17a87b3baea3331d113c3f5508037100fd6c309c707a036fab97dc4b1c0abeb9f8ddb884b85eac1d8a38aec98ed285827444d4d9c9689f9721292cd2be53873909bb8d3ea71b6fd35b8119043fd8935392323e21e169d413c1b0e79884475241a86ea616c0743057ba598b04d94f48e1bb14d43cfe5ac07ab32555f2af26a8bfcfeb01488be4a5de938c75a9a862f1cc1b460dea8bf3a265746ca16606ae3d134a8ee8171eebb53965313a2218b0487b25fd6650a369f22eac7a078d71561e7cdcd1b28e5e3f3a4b5f0e10602a8b6bd54fabc5441ccadba9844bad722228b417db784af56d50d169385640e663c444b19951052a2b9abbe63d0f706475a6d0b603aa36fb27ee0f86cc4ac6dad26a1d5f58afd19c18f4e6011c655fad0eae0129f4c54d2754b29d43a2ce8b9401bfb36bc71f5eb3926e7288133774772ace44024665aff868fa19d645ba862111ef0ae07e1ab90f1a86523ef9e96123081964eb429d8394c88ec662ff058105008363010b0e36ae62b1a056a772d2a5239f1ab58ff2d4d2b393ff4be0478c0e62156900af4bad9538f752fd6006aaacd2102e7fa9afe2209338e1608339e513ce10cb84e58a738fa9c1daf69c9f98ec6d4d12c8256c7ac055724a919645e568188ebfe441ec44c639221fd7889453f334cd13623fe950d7b6b79128926601be0edf54c4e823aecf7322f3f488967234eb8ea4c3097203bf543b9a914553d06bf1f1638b31c7c1b2fe8eba9dc2d1d21c0469bc14bc0a022e81a687ece4ae303ff11d98038dfb3b474189da34cd67470173299c486dffe0bc82c3cd6cfa452a049a76280b0e89e92556575e6f6a9fdc58dd5117ead55a1de5b582c9574401a40ae0ec76e18e95714aa6967b3a823b773ce3f981e0868b6521b18c9a1bb9030f19ffbbec68504b0b07a288cd756880ddc807396bb508ef581d1e37b215b9bb4b675ce50e4424cf32a9d5f93b7d089a3665475d60506f18248", + "0x97a1414179eb96634f515e0324a5031a70fe0ecef5a5f98433ccc863984832baff53e28fefe5658efe25206610a57b0a594856c5ad6ff167abe5613cc31819b6c793097581c65c3298845a5d6e85042f26c6e3c89de5a9666f6ff61ce473a4bdcfac37d434b15ce2832366f3c1ae9a77bb9c771cba613c7cb3c160e6c4e4dab8fa1b4960a72528d73737cf900da57a0cf3467e36f9deecc111f297c5463b495da4e656353460c3d5afd23c37a42d9066db7571ae3a71e1fdaa6eb1fb45d31ededb875a3b05d282c44c6cfc16171dda394ee200ce8ea2a53acc908fc5aeeb3763ed8787e5948c5309631f2db1c619c3785877ae4b7cb0662d512b781a4e99d649089a26933e6582901bfe2e1c138e36e071c4a8692b0dfea7be22467b0f23d46dac8eab855bcb7703d5d1c4abad776053cb17c7254fa718c5e61807358284588c35e032e72857e4705bbfe5972bb74faa6265fda5595ede46c3e4903eb2366794cd0b23ce8b20f3be565cebf50e6326895752256b45d1e472c017959a40510a4fd18a51882111c6591a3a975c70563dfb04211a5c548bd49a26221a6dbc09226c4e68bd421dbf3bdd35eac936a78d61054b16ad7255d4056d33f7ea2b310856c8923e4b5313db3e6e6acbe03bd04e8a2f433a61b09abbd9d74491c455bc16648f973b2bea4806d3efd8dfd76468fdb4e4a8f2db8dd085fc8fb2a7330e953d562be97f2fbe95bac1d55b81206e265155097fa6154a7513813f7805536915ffa7184b5e85e7fb71b20d3f58b8b2a0a8ce3f7ce8834c115d483463128f8a0dff272ffe6d3e779ce4c98ad8124b167a9684674fb91f1bae7516617f3080159a3fa5623d66b887f293a69c20387bc9b5b0e87e13077ece2bfebb1ae9f226ee9367471872efa51d3ec3449fe8cd93dfebf442bc34392fa94901d36a245db1f1721b743e6fbc614a75947ee0054a181ec03f399bb4b650f5eaa154bb19ea6140a96d6aa9e6dc434228160a87129b05a9afb3f78411ec91feca09173963259b118c55e1da7ada70bb14bbac59d2ffcae82ed08a05396afbc41db40f9b67afe2907ae9c36d8555f03ec6d220fa596764118058455cb51290053a83817a0c729dc99c2d38568e5844598776cb70c7b7b0225f28524f9f96a7eb5ef2395cd617625a187a2a479fc3dd95f715abe924a45edd1dfbf92e0f450653b53a8c0dfed53a98dbe878d7cea9ff8555f37bbad3c7be11254a979ca80f770657e62672b00b96d967583ece5492530b5ecd43ad975f4a4259b379fdd00c90bfea512544a4d2b750be761f145d82cea6b673c3822aa51346d876f4d6f3b432e0fdf820a89b0cd22e601344c34f3d0e6d1ca42012ef82f765d78a6e87aa19fe255b71b0d4e7f543d960618aa1bacc5d81b6004d901fb33e477b45e1dab9404b348311fc7d9ef9eec62ef9cdd17f1c79d9d69bb8fe6b09020ce0b6e8f5179089e44af286f2c9658be1ae3232094ca65edac10e27cf00ad881fa45def9d8f6344d2636f0b57e267cec3f25abf2c169bf14387dcdce051833ca5cb854fd3e02fb65aa9a9f8aa4ec096288e90139033bc1d50cb023fe198a7857274f8f573bffb1aa875bd14b1e0ba096bb5887aab554729300bf4c5a795e641d37e01957743b7a8e3aa1e56aea518c7cde410a5b31d5cd9d9ece36f6a2b28185074f4f35377f151bae9d37f15578a8a0cb887b73272abdec68c59503101414b2a384c66e5aef11e4f991750bb2de3e6b3dd6a406f3e27d1460fa76d46023b53866043f5ba8dbf0126ddcae940bc535f1cb27a690ef0ccfb1547fa07f447d3dc92cc9ae7b7c677b0aa51a4e16a3e893cc8a5f39649a1cc7ab08fce1fb8192c2982a9d4fe462da54b963c728b6f8d44aa331d70e41670b76785d1e4cf4f4cb0a3292b8c8606287a5dc3073b6fa160d1210c3438b11a0e9badfd56271eea06a7c07709c65ae4ff801261fb463d21c49d347f93a4ea994da7e8cf02acf846b33982dd595fac264edee203210d42600f8fba243b0e52a2aa315c3b296a28e2241e88f8576ddb6b10ecccfdddfa3786505e9b12ac291ba6138e28503d5fcf3feb1fc2d148713e59d380e52829e28a663ec70f433836b59e3a47498e633788dcd843e895fb483b115952a3ede8969d5aa0b029cd64d5d4c850aae68eec50c50cbba9af7dbbbbfee6a4d1fac19579b9cec467afbd7ed8e3a26ace5daca9e77aabd674a367a08b45f7858843bea67cb6cc98d9f707d9034842a6b89bfc03088200a2b62e6fb5b692f70c50dd6b7102fa2181177b6a23c413caed7491f002c9968bdc05fdb5e974df2eece3042f4bbc6adf1cdacee10ae4e6c0bdddb16561bf043ed3d63648f11b31386052e80490df2c381af5c3acc5eda8a4e3c7e2f288061e880e2e8476ff1730a64d17d10a6167f9d2679d38d7c3a4d13a3b227bcb92fb91361beb4ac682ef554cc2d9c204d8381b2caef736071b10147f8fc6df8c7aa065ce14107daa5e2e5abb7260d5717729469d647359d93fdfe5762b8b1dd390817c27427778757310f13636de8dc1e4e49e6b5ec85c6f723ba2d2bf0ccfc61031d9d73cb1e4f1f641151d9f357a8bb65d08187293a4ee25f0f2dcbb67cf5d93c52d8d0750e2dc46abb61215f12287867a6072ef173064b8105e4b1ecb4a1bca2b1ad90e64bf6dc0ef38200e919d8e03f1151069a44da540c2ecb1369a4f8844f2ed2c5b1f67849b2712c8a58edd13aa28b30b276f88485f6314e1b15d87ddb3727498a9011e6e9526cd3b1ac90105b4869a7ee5800e5e02bd4846112e623505e6c450711948f64893a9020878d41afffee1553b94cbe059b6616af97e77e5b35eb9d13b9bf73a5e74db62ced82b83e76ccf523dc957803b4c070ea38082f0fa824c8f990fc1468ba97b47a4b3a6359f7d7f74e3e671ce5f6545ad96fd4dd13e1595f848a852c9d604294e53d975f52dcae761597de18fc1a6b8ada995ad0bf78ecf784b97ec67652a0c1400f515d31cde01460e5bcce07066ab9cd9776640e52d2c509ad56ae9cf5f9d2205c5e968a196f4c50d4f44e65710e5227033777c4175a2df9ce64e478f6e7c759867ceac9a661f31e416d01a8a0f46934401fa1a952fc3b1339d6273cdc3532b3d6a75e51cab25fbc3c3b740d5e5a345915fdf4b926370ab864a075a97eb973a39619277a51cb2787690f3b445e22caeb912f9634a79212f4a5b835542e5024509bc9a5301e43d68dc218740fdb0e0cd69af4e14fc3c2d40f0f5ad14b87ba728ffbcc7424071169da88140433fcc35127c5c19e852f2047fbb33b37e16b4e00572a481323d758fa0054c09d858325b39e5dcd5b41959ccb6a73fd48ab004746ccc168df4f209d2c77bd4668f13d176ee52f5c1049debd02024c601b6cb005f1ddd247afffbc3b72ae5b86b968cce6f7047593ae3d846030460246ed178f9a60b5fce266d31756f7ba7c0297dbfcb9da3a6be3f3607c4e29432d7f105be470304a82ba4c491a0d288d4f95cb2f4da5e78833cac47679a82df21280d5a9411c4071f3aee8b2b3b30e1cd48d09189ec58cf63a3c595ee5fed4e8f89eed1f17d9b3a02f2a20debecaf09d5c55ef7bbeeecd50baa34f73ccfeda07730e809642492a92d27659b18575d993499197d3b1365f441551df691ad9d5abbc92b2558e24c4f2db130050bbb946c7697bb5a1e0d2ff1b18146f118860bca7c4663df508a02501456da002ca8c68cab71bc5bac9ee44a326cd18977bd4222cfc477d3d3376d540e9a0038a098b9f21300693b9ce438a9b55c1cea19809986b1b03b37410bb1c66711cd7af8225f50248e7689a5866c19af86f826bc27e72fee4d22cfb510a40b4fadbccfc815271f6e83147659930770839eeb3d5bb77cecd9b7cad44d21673acdd86026cfe84c2ba65acc7171e168e9e80d701bdd6d79d8d92e949179c10e0113fbf9bbd2ebb5d6c4fd2747d7d65a25f643fc421bfac6e71fd06f2e4b1b6ab808983ec15ec74cc377b906a6e719c708d3fbeba650d9eeb397f589f4c5f8960d0c7833bfb34fc5d52ea2f7c6ba61312627348c443f95a5263bdd98920d887acea3be67e866e02b591541242041f980c8f5dd52f12456cb85f436f67d13dcd597d73306f1fec1814dff94272b8753b35202fa5f5bd66e42dcdffa810b0ee826fa2c534fa50e6473cc8f2221e733f96dfbab118767bcaf966aca3cbe2fbd9440426ef420ec69b633f2be0e127c4d2a112872b95b5075d9852a5ea94d9fbc8f3bd6cc804bd8314f949c1c6c35fb02879bcec94710168b8e4ff7ac73ed75f0c891a82977342b07c006fd99c38ba285f011e6f4bd4f491629581c08a663ee4c9a907031a4259f4ed6f44c31bb48c6ffd90103c9cc5265f5f5edd64c122eb38ede02c2e79fbfb33f56cafe3046ae5dda44436cfdde696e71e48526f91d1be73ba4b3b7634aa6b4d04ae3d9b6c887502222af19a67c4342303929d45c1cb952e76e3f147615ce447febdd9b3d7c82b037ef9b22e2747004d0be793aa6989197377572986fe261df8ca3861611c7a1111d106ef01e2893f6cacf92777a5b99e8570eed73c08d7a8caee0c15ac279bbec10d793f3614236d825ceb40143462963521a2f481ce281ef04c728a5ee00824a5f738280144e81ad8a29fcdd7836f2d3d72f12914c5439555ccd421720a48b77a5836649ce471a665b75", + "0x751a462bcf24eeb41aa10e0d55f71b10ab720ba0ae0bc9485e515bd7d673a7df7d5d9cb22100f0b4e67fd1c907346045ab84029336102f1e527e424a99ffdaf43afab68efb441868b39e617fa318bf49864c6ca140f561e1cf9137ca8c86f33bbdd7f4ca76e59fdd32e1fe5105e68c7e55991a66ed5f798b73524472639c8a04bda81bdd2eb9b8f8f7a3708f58130a16cf8ebf526783dd768ac55197ed7f4ef43670d91989bec092d4481280bc4f601310f34a55b0f583457843d9f1819c08c43efcd60c4890f683ca2aabe767009ea737833ffedaea1e54bbc1408858b3610c2cdeb10dfab105f8c5dd8a0c3098981cd39d237df00767885ae5ecb137c9d834cb8f309d247da9de67ea2b26c54a6c623874fc60ad18a5de48bd02bf4f0192fe0cdd0684f8be64ab2f3af81b08ec0ded68f145d80ef1e09f8f4d2c7e59dd86e3777d9f93fb6d7a875154347442295e9d5f7313a0f3a84d2149d8ea52c256bc303781c511cacab26ea60bb1261d8a3e141812803b4cfee3298ea924edbf10746c703a703027ce9b5483e3db120200767a995e34ec5e60c90b6bb1c0b2ecd36a623e64b4448d059ef8666493e5ae9eb3f999854601c9a1561368bbc7a2f30edaa98c5d887aeb73306819f6b980ff9a6ae15cbdac6207dad337dd4e3c712ab83b6d4cdc0a356676290fccdd52d375eacc2f81861caa5edf035f632d3313086a7cebfa0fbdaf848e6cb2d7ce964a0d83582ca004937c0a1c236d564256522bc4c3203166c87f4bc4012b165529c16b208392d4bb55dab73c9b1298b6f6110229fbf2b95c508ea5e98ba32d50b7e1f691ac266341f5f74e71161d19936a158f5fe88fdf0a4d7c7c889e8a8d6052e0ae20c79b960109a4356a7e97229b8eadaa378c5f046062717480fa8c1b9cba5fdd973e8e8e8fc8231ada58b749e80640b7f826e23950fd558a14f7cb40cb5638c5ed0ddcf5e9d84e594f1d0d97ec6274f9aa39d771961da0cdc25f979652f82c4ed17fe0b75262eccb84db724dd7ee48c2bc0817450c5ceb5dd0aa637b90511a4271668165a0a17e4711c2c14a727848b48eed9bc83dcaf9ac080daa202fb0effddb29b25c2d8f806f1a5acbc4943cd92d32cbd6280bdde1bf91b879cbb956e83d1585b58558dd48f55171b65e700ce55291d99fb7e62f96b2aed06c385c329dcf0533ad27acdf49e38e486a722e3cffc68b42d48ee7912ede448c3f2ec4620a21d98d54ca11dc78216d2297e890930edaaff49ac9b40e427bd2446d22ea613000b2aa932b45e5d0232c0678c3dfc158d351c9a1b1ea02a2f3fcf2295bfab7d1217b526f2b947ff9041c6f0a5afa4c70b422cdc4350fb2239f87dbab9b70bbc4c37bc829b0a6c16767a2e0e8ea8c79359713fc5493713ef5a9729914167c2a505c60b9c582b8f3e6e5ae2ec9b04a1494617a99ba714b7a0b17ba558498965742d7cefe57e5ece9070d93d5d5e96340c6a0b73c9d127ef7c6e94ce00332ff6b67c86d9c602cb9e24aca4c0d0e1ba76bedd94c89b204826771a55c4548b78168ff1f0262f845d3fa545ccb128d315f6b5f6a4e6c408171e087c6cb9243a43de3587a399de2ee94ac93f7ba21401b3e709c1469d529b671f5ec6a4abaa12eac66c4c265064ec7bef330bb39228ba1a912508582f4d69e73ec73346542b540db1ad3bfc16d355feb3e941c5321329e000839653100ebf6c11b321c0fd5ef35c7b8d3f109d2f3202fe099f766f5f194e1e3ad42528822535692d61328d6748628167837a4f3e3db8b98e6262826052a539806c04a71cf4dfae141aaafcba7b6cd1421b8b0219c14173b0d0ccaef48e3e6b017ccc9806c8b1734c255b365a44096354eda66e953a37a15a0ee38f6d1abd0d041c564c78be92c2b12fddcd0554afcdf1fd9349c5c84d4263fef1e6fc8741c78bb120fbec9b02d09f5e741ad3dd5465cf479d6768b809f523053cf27e9bd1710ffdcd4bb7d5e09152a41bd7b74728656779e2c24d545c7896b223ed96c9c51530464a7b1914779646487964124378195ead5cc4b8828e38beee1d014424b4f0758f5b0d9e363745ff35b85e43d6cc0e25dcf029b9dfd491c6db2641a46d1de94774511f64392d4f3ee3d7118f5a6e3a0c8b955a408bbafc650d2a73a591a7b09626ac683c80f004e788063f0466cbf762f5fe3df0b067b0bcd3c1b306922a78d903d7273c0b03043477c5dd16587793c7d29ac8898157a718e49ac1fc3052edd84c9897dfb65715e2bbca5b8c1f823be2a08348e7bc32d471803a2f2d25ac6962bafc577920a39d48b57b36bb1876087add6e5a398a55311609b88d01c0b5b2db5dde067c120a2c1981711b7206fed6a3f313e7092e8a0a5d9da1defe2bfec7c6840d02068a7b394550f7c266bd840b6358a3cc3c43b1c2667ea3bac4b412cf1288a931f6e85137969029b90b647e7e60f651a3046eb99a4e30f4e19c6de09dc901c91d252b007b17fcaf276d683cc8274fec87c76a3c0be25f130a356c8075bb30217a4be91eab55c6ea2b017ba437b53d62a7e8e1db12b82641f714678743b49d809ec4ef5e3bd8a441841301b5c4d0cba8596332228c9a36224bcfc67d2ef062e9382b9372b8dd73a8d9f5bdbd25b9152e06068e12b1c4ffabd55f10f6154a8eadef7febe1422979434b53a01d54c1cc30e056f7af98ea8c097732dc41cfc54be808a8a71a7b522286a96ec58e8c37d9081b4480dfb2300b81421c0ce1524e6410eaf48688dad61e3e309735872cdb4290c5950611c143e208dc76b1b0ddbdaf8a42747540992d0c0a8c7872f82f0c7bef22736548fb118cd5048be0d10808c76ee837da5aaafc78f5519549d0f0e6fa9977c24f3133d7efa8c072fa73540e015017b576b94abcd4d2c944b1002a6d1aefb97bd4658fe0403f3f41f5172240a93540360e0f0f7c68bf9f8c359d843db539495ad03ca50c6bfca52e6449e98b236154c2092d16011639e25fd4e9c2481ebf7139e339c5bb00e36f9c7f144d4d412050e34237c865e41637a0464e4729019f7e513a923f32efe8fbd90b87d5164b9c1f7231c22b2eab63c7cf5436ecda767e627b976f8277de708e93145d957a2ac7c99b95beb119735f28eccfae1fe3bfe50ebc72caf676006f6082a35e96f4645bf6f758ea6ca8366416a45d91102fd215d067cd40975e589621b6b3ddcf5d9455c5ab6783122f61bd7ef557e67b79fc92f8ebfb5f0f84482e38fe8db3fa4f69fbe29f2cd8dcc9bc54182ff1b2c6d939e30bc8397e81f1da1a730b2db6489cf53496cc4478fd07c2239dd32bb16466230523be114fb09dea582bfe7aee4b81567a1bf96b822580bae2ebb1c48f50bd8377d3a455ba5d61cbe9e847ac07b74652cd04e7b809a2f17e2c919559b9667b832a671067cca8a9d1b1cf8dee5c96849df0017236a8dcaa6751a631367b55296c2895cd9db851fe5a164fff953fac2afa74a154f2cef7156b7a6f389f0a967b192c5652cc4690ec1d7d3cf3853faafdbb5f5d0d05980032a84e568d8eb4c77f6f712d03df31171c5189d301ef9abc0bb40e751c63f1f954b838480abc45b57f9f7b58bcbde67967d02bac8a0ed3eab281854bac0ca5babe067d408b3f047116b69b3beb1a4ef810b1e3a189256ad170b9e8e10250adb7093668bd8eb93978a8cf46cb566f41a11818511d563870d3e4ea4b4dd7ad38b8aab6005eb9391feaf3b7c0b8f2edaac1873882974f11612ab5975f368c6ce9898429d887765bd47f71c241fba5f876d861f8a497fd2ecc476df54aeadd08409b876af5ce94476a057ef8473b6b6ae18b64b564cf96654b7a291845919d3a74441ce063d83f0c88dadc41d74e23c491a5859b426098d0de44648d041cd977e68c904ae7e4a4a0fec62678595f1fa6bc1ad567ad11eaeb27f7007cecab808d04aa39e9f3e9dd01c9f50063ec69032ae91d0037daded10f49034e89bc28c49765a90a6539da30acb632fb89bc73e36dfc09e383699661afcc5de9e0bdb742447ea59393a5a4e43b7e05b7de0d6ad826e732e3d06791829f05f683a1ec32f999692bec8f9d26825f904371925739ab5215ca703f8eb8deea407978ddffd8613dab75ae5ec43770ad5ffe4c6b792af9622294c016c65f2aa205e1fd2ce245c594c4d1b0540a7181413b2002644ab6c648ecd2ee30b24dd8ef8345d45a1a5a03bd2d19f95eb3c1fa8c797c679309ae4d1aa1c6e998d1563575dd41467268d609bfe9c6ba5a97257167010d1afde2802bd1dccaa1ec08011bedfd5e72a3b9471ccbed0dbaff88d0c906400dca1bf186a00303a5ac915ec31c4dba836f7cc65c082ce99229a661558f30159e9e067d0507b4eb8e659dd0abde75a42b3f728ffc9f6917dc6b18dfa2e57ed8fcfab69311fb2e640265eaa1471c2e7025814d1ede2814fe8fd6811c226b84fd26c0094e01ee54129da2d728c0063e6068f372447fe1ec7e1efb31f1404ab657be2c4fe72ab982b605714d0cd89d1914e3681adbd8babb59daf81a5e3509339a23b3b53e78c8e7c40106844b17060fc263f866cf45ddc18e0c7d6e6f76a20ff2c4f2e83758880bc65d41db9d5b034ac617717ef2f4b55e82bf057adcca10723242f6cea387f2faf88acb0f6962c77aff1f6ef742cd85c32502977cafc53133a79148ded69e214bc443f257755897a3b120beaf03505e98b87ad8e35c8" + ] +} diff --git a/test/fixtures/erasure/tiny/ec-3.json b/test/fixtures/erasure/tiny/ec-3.json new file mode 100644 index 00000000..bb609b52 --- /dev/null +++ b/test/fixtures/erasure/tiny/ec-3.json @@ -0,0 +1,11 @@ +{ + "data": "0x615d17", + "shards": [ + "0x615d", + "0x1700", + "0x0000", + "0x59d0", + "0x0615", + "0x756d" + ] +} diff --git a/test/fixtures/erasure/tiny/ec-32.json b/test/fixtures/erasure/tiny/ec-32.json new file mode 100644 index 00000000..26230343 --- /dev/null +++ b/test/fixtures/erasure/tiny/ec-32.json @@ -0,0 +1,11 @@ +{ + "data": "0x59c94b46e64373d8fff08923a0a07d4b164c42c058fc00136899c10632848450", + "shards": [ + "0x59c94b46e64373d8fff08923", + "0xa0a07d4b164c42c058fc0013", + "0x6899c1063284845000000000", + "0x1db0baf051d4203e2ab265a6", + "0x3798e9f23133609b18bb0083", + "0x86b3cabcb605a42e5d4a3055" + ] +} diff --git a/test/fixtures/erasure/tiny/ec-4096.json b/test/fixtures/erasure/tiny/ec-4096.json new file mode 100644 index 00000000..d1f88114 --- /dev/null +++ b/test/fixtures/erasure/tiny/ec-4096.json @@ -0,0 +1,11 @@ +{ + "data": "0x13816466f7769ddf41dec0aeb7f82b3428e90ab5e6931583dbd772182a2be12949ec0a648b2d36b6a9a4bbb58e69782eb9af87824b49649067471b6c4c97044c73be085468b8635802c36b0671a58c0e376a9538d6598908860ec3d5df92932e9e9d6e690d00da3644108c54609b832aca70f2c5fcafbb3ee52ef9c03827a06d8216fe5731d82f9614e0ec8c08cc6d85bd4cb21a351787ca8481012d55271523ec079683143b7906c1e593e1a7894fc57c7039d79d20ccba20fff1803505c77d91bec19c6596e64e46169269775dcba3ed7d688aaa2a009ce29a3d5616a2c3c0191b8aee986d5b037df560eab69ad868fc435ac7fceb45ec266abcbbd6ecbac54e57205430899d69a991e2298ce9dc483ef2f9d10a128eb45f14aad28b36c6e700e874e479766ecf5abdf70c18f9553d755412f0c46470d0cfb20bc23b178497be97bec4f26d29c3cc3deaea3f8af37eb391ace3c3e53aa999e0e86a15a373c164f3aff0ea7343a497210b00b5bfa0b27f35a7da67739aa41b06e8419ab0e76bfbb3964c974d8ca763a913d6defbf728ca8c9f4574254d29caa74268be57b4f3124736498b7be69c15fb32970947b5d192b243930df33835c4e4be0d4c6e0cc32c8778f51731b890536607f68e6f16ee4d1a438bf5161a674ec0c2dd92fd72a22d8ccb43d24fbff2ef5e868c5c0a09d273a201548b3dd97f8475e4b0327ea61cec2f39f862f40fb36fe8ed6349a66cb1ee2b6344f0f07bd822a898845775ed3cd90e65b53e4d293489ddba7a75783c90ad12f2acb72b6edf58b2f593887b4e62d07162a1ae28b120469f7a59af54d7801a33f78353c6b426b40e2dd50b03e371d894dabe80f572a23722c3991759c8fc0c7bf6788bd7ed3520dd28361f7c9e1d895f74aaa5063e0e04473afd7509ad204266966242f4103717ef36fd4a5c351210d4ab2c66c6dfe2af87c0f8f718999d75cc670d9574b0e00400fd407e143d8d20c6ea06a69c23b552e3dcabcf9406a7ad0f2df8a69e6793f40ef0533961b1e3d8c1e013c16c193736bd64979f87ee74129e7453c29ff892f7cd0879835339473dce735ef244622596c16b30b343305b282b73fdd40c4fbda762b3bc6ef8635519771af9f340fdc2fda85e2e750d12ad4ea66765ddb5ecfb56592bb083c4ba032b9b1367b9117827d38d96631a5fcfa07f7a3b6dbd27541a883db09655463d8d56d2e632030a2520c027311cc9113cb236096e58cf8a2c262ab19b8285377b1cbe2a75c646189fec643abfc5aca7c86478ab1cfa87c4dfbb744c33ab44a6d5ced9c4a09fe4ee14eb8fcc2d311cee944f5c1b222b6ce1bfc09fe8fea1ec0048884af1e497ea5aa8cdc7fa1d61ee8ffc6fe65c7fa267421d7c3be5439998addd1517a7140107c6d99033a7ceb4b416b3595fa1ae53009b0c51766ccab6cd5dfe01de1b54526b5c8c5270a0f5e19678a94e6fbf0a62411aaa0f9718845d69834e7bebf98bc99f6b3fcedc717d7e8585b89fe218bb1e3ee11e87efd6002f248ad14f0cc22ae6d9fe9d31dcf202c959bfb9c46bea8cc049f7357747f0ff9bf27e2c73f62d0c927981971db7620c5a8e5a31a3bd235da3310e8c322db4cfa44d18e5f86c6f4b287638f590cb9b1ec962579e3d4b40493eccefccf9acce7a966bbb2d8f9eec2ca7a6040190fa06401762b66fc18d90958461b9543bbc64be197530a9452b2802e502aa291a18ddf9d23cdf330b7dddc9dc8d51e2247f19ce23d173c8054aee7e6d562dc1fe4250e5cee386ba65673edb10dc2397d3dd4ff7f50db6f4ae7e02b837334e115a6e60fb0f6b4bd4d11c9ada6777bb22a92d40e7e8eaf105a2062df6b6858060ba5d44bec0cf6c6a89ab5b6836ba9b1d82a84bb3f2a6588393948bb2cfa581192e162bb3f5c4451c241fbe24209a10728f9f77fb226c9caa77140be9167a31a0bd26a72e2a83cfb64e1734e7563f7ad0401271d33b23e5ff5d0d80c0be3f72cd98b8f4093dbb60ad6e27b633f0ad99021ad663f662932abc4e1aeffb11f119136baa010327dab9439e661ed35457a9b88b0b18d3c6a854a2a2273c3be93a00b3f1ea1cf68932a0cf6cd1ccac838167bd22322e32fd7b263dd0937840bf36d9e359fb6fe30ccbf649cd61f6ae760f497f2ea37b5aaec56acbbdb82247286522a53ae4f6e11d703111d19e7695a24418fe35ca8892fb03f357a9675d011f0af39f0f550302425558dabf80a93eca1524a1191edda8f5ee0f654425c148c0d72b222f1e4684723f96f824641add5125b2d71b748e8d4515da4cebf79c26efe32a5d8b4cf5661d97e95bd8d2b514c3d9a031f330288fe76ce519c0e36930c39be2b6e642198a2a49d9e8af764bea7f1fffb110e40d6e21140a911b169c8b476159bba793f6c314ea40a78d3daa751f6bfb60ad611e393457f8f6d1c10c6acccc8a8f0ace39d0d3a4835466c1e6fe55fd8e3f0951431bc9cb605c56db1df3303d034f88b15a008394db304a0a4d09e475c0905da281b2768e8d9eb6b342dda88bb350e2290a696b2f95b389a8e282ad173a0193d20ed108d3659b9c24df59f5cefef25bcb53f4ca679b5c31d853e9086fd6f4614d1007d8877fcb8ae9eb10e29dba496579d6ebbc3d4fad30ff73876088444448aa3b5786d3cb50793f907609d0a97f03d1b7fa29ff28c00ce6a725134f075e708261fb3aba3a3d4d3f04b106a26b1266f2153d2970607909ba9df09f7f5de7f9e213ab09c091795be07fe53f01dd1a2a6cdc1b8a24790ea0a7a3cce40c2ca9f1a39a958903e725c1f795598be32cdeb887dbc54de266ed9b87f817add0de0397d92ee2fb5d900f9cc4322abf2964f3e07e4026fc03c750cef3ef91193732823fde4b00b25ae60b18b7e21ed73ebb838c7f6db63682be677ef9e790984312253c2a1259ab6a9ecc429f0c6bc83bd396651b5b1351d89a412cd7ef788f9cec6fcc448b6e3f1b61c4cadb8d5ae37a050f6e3ad9f730010004b04aaa389f90260c65da55d61ecc3dd34c6e1f962c12a8b48f1aef2bd7a98eb03bd16e1f497cb6b5e8ac44aabe3ed8f49fcf8d0299aef24090bd40f5d2c370162a05326933dcbcd4b7e8bdfa96f93de1e4b57632260e7c286c41bf40b31e2e717a64c8e1de6a5e8d857afdd4155bd4850069031a54eaab6495a3f986d5871736d41c110652ed8aacff42a8dfa481b07738f545a1ae42c2c1c283f249a2e79815e8529b0e202f05b2b8014e8c5e06574198b79ace28cdeb3fa015282ae0c673f3a9fdda27d21214b52dade7518b00c3cfe83d98cf63889901b1b73577b5bc001a13cd007ddd5dee4d66a11515c718698218920cd98ad87783e2bb98300216acccbe31db157a6d51dacaff1c5cd35fb156537be636243e24c3452082029599a0f8cc454422b0a8d87971890a0c160e5b7e3e6522f9743365706b4a672b414e87fffee63b847a05518f1eaf61638ea1814fee8f2f783f9d02e0aea8619e4f58a6508345087fd491483c68fbf4503a6b39bca6cc7845b22a03526a43f35aeb72654e0b713b463314b572c46e9993407d94d346e3c129d4676e6560b946902e14d971e1a103c5cdd40e037f35de4f7d26887649c157f4ad9ed21229df56ecddc4c707409fa92d366eecf38f72c7a7d29c039ac4da89099fb1628de141864c110046107a98c312d054b16223f2285a0885b849e451a8111483920cca619f5ca14eabd16a77fcae24193a343eeac10dc7fbafda861fff3a19982ca2cafee02b8aff18de59a5998a14f5e24f7ada94000e21162b3d7dce5d9da71331842a00ea24cf6cc3b19c1333736b99866bfd7e88ffc19b5562faea28d757e5ea9c6c702335b552d3861b00240e9135ad35d1378c11f6f8a7b3fbcd83e45573af9417c8a4f8b343574bfd927102eea571d5a40df2bd834e35faca4254efe690466e68f5285955c8e53e1cd718556fe33c54fff406c4818599a1b8519d72955565968c109cd6c843388516ba74ff6793be45efd6f0df58a6416cdb01bd0f4a2ef59097d3c9c40ad7c6d9595b7a4eb3351f699fef7613d52570da42cff2380172f3f73ff64dd30d982d7e68a7a514de0879cf7be4c4a464eba787d43685bd7d0a1c578a8e737e759e51c2b50b49c3a91fcbc2960771dee8b79a7f3d3b13df2d65cbdd502fd67436e208ebb1f7113abebb594ec80f18fc1338036c29febc8d91eee8dd9680ef6dd578623c4d8c5652e0231522df03ebbfcaae62cf1a94e0b8628c451353a8a4a1668ea62f430fef3b59a433ed530cfa541c77d585dd8bdf27f1b80538d61106d5470747b3169c19b385864e75c706da7610a7f8313f6c4bee2f6f27f7ddfc6c7c76bb49d0a414717c5d5ab2d9137085424c09216d8faa993067f86356d5181ad7871bfe7bafb4c6c6d53b73b46b5625f9bfa296470343be0edfadd79e6336e7ab0f287da4640f10f822a0d4ab65cc3fd93413eae35520a16158a442af0f4e560213df73b7ea6dae7cd6aac8046f8663e2db8f9b7b6fd2849802304ac2709f0a3ac6b2befff74c9f551b3ae2e78eb07d037a5416091f42dd06b8ef9a165e86680d747d60864acf7f10dee4ecffd4bff03c8e352dc629f7c9fc1c1cb713e142beb7783ae87ea39c3f60a854daadd25a169a5e38269f46841948d08e0fb0b33d3d4a451263f8aa78741f15b78d1eae378b3e34260d385316ab43f7ad0eaf1a4e1ad3d28ac5ac26d80e7a8134d73e260249763d8976d382964c9a90c9399b0fc9425d5efee59aa8991f2738f524a27f60e2753a70ee5a836cb73955bc6bcaec25bffbe01db5dda5257300eba807de0a19d5fb393fa3bb1d9ea2ec7e3418eea1b5ff788c9e3640b08898b0bd68ede9d9fa3cfd9ac422f74e27c94551228af3eaf22dc8b115d34902d8427e63c44e2ac2056b347b71ebf61f0ac9e14ab3d9658036d435c57841c7a19c6865ea56298aaed2f6cc5a2df68ceda0d693aa295da9bf421342964552941674c8e6d1f807d5f274cfe9fcb70b8196baa457b96a9f07bc12e7e79dd137ad77ce30b9547047639493e7b520b512ba12c950d0452e563529fd224e5aeead34889ef3cdf264fd91d05c664f6bff58f163bf9dd2a75f10858df9808a027c65864152074ba6ce69ed9d6c78db7a2ff8508fc92a6c2aec2c17e83b7541727d62a1302c9c3feb6d1348c17d4fc57f7effd87679611eb7a2aa16fe0236e0708340beef32a14617d4d16f441391604433b1ccf40fafe07f736ecd887151b66801ce0716013da7b09e4b14337e99dd8bd8df0acc08af42132765948bb53c0073bce3a3d761f46eb4b53f3a15bf0855055c2a4d2a7ae1c3baa144ececed62702ea0d18e0b11a4062c12f52882a363ea5c5f768aeaf327f8d425f05da1671f68340c009212301b304066dfb3d5fa67788b7888eec4f0bf7dfb4ab60a4d892c826ae373c1f0f18a0615a9a5d073ad53d423f2f2bb004f5dc7db95276495aea9ab3540c529aba937da6df33bcaf90362dd4abdf28b42fcdfdbbefb8864bcfe66290ef052d62e7a5600326bc3867b5014ecf47245b3019db04f28259ad17607bba2e48c28e92350c5b062c3302e96c0c40e2f953031818e8617de765c21a8cf93123f57c99cbff35bb07a4e2ff1d96b32dadf9f2af2cac91f3ad12a2818ed989712c35f9b3b672279bdd0852d9f10697e5e55255473919319ebe8b05f0d762c37d5c16eb137a949034457f337116a278468ec1baf4d79b5106a2567789c7d666006d0b17b9fbb6069842d02d6f34c16db064b0ea6d1", + "shards": [ + "0x13816466f7769ddf41dec0aeb7f82b3428e90ab5e6931583dbd772182a2be12949ec0a648b2d36b6a9a4bbb58e69782eb9af87824b49649067471b6c4c97044c73be085468b8635802c36b0671a58c0e376a9538d6598908860ec3d5df92932e9e9d6e690d00da3644108c54609b832aca70f2c5fcafbb3ee52ef9c03827a06d8216fe5731d82f9614e0ec8c08cc6d85bd4cb21a351787ca8481012d55271523ec079683143b7906c1e593e1a7894fc57c7039d79d20ccba20fff1803505c77d91bec19c6596e64e46169269775dcba3ed7d688aaa2a009ce29a3d5616a2c3c0191b8aee986d5b037df560eab69ad868fc435ac7fceb45ec266abcbbd6ecbac54e57205430899d69a991e2298ce9dc483ef2f9d10a128eb45f14aad28b36c6e700e874e479766ecf5abdf70c18f9553d755412f0c46470d0cfb20bc23b178497be97bec4f26d29c3cc3deaea3f8af37eb391ace3c3e53aa999e0e86a15a373c164f3aff0ea7343a497210b00b5bfa0b27f35a7da67739aa41b06e8419ab0e76bfbb3964c974d8ca763a913d6defbf728ca8c9f4574254d29caa74268be57b4f3124736498b7be69c15fb32970947b5d192b243930df33835c4e4be0d4c6e0cc32c8778f51731b890536607f68e6f16ee4d1a438bf5161a674ec0c2dd92fd72a22d8ccb43d24fbff2ef5e868c5c0a09d273a201548b3dd97f8475e4b0327ea61cec2f39f862f40fb36fe8ed6349a66cb1ee2b6344f0f07bd822a898845775ed3cd90e65b53e4d293489ddba7a75783c90ad12f2acb72b6edf58b2f593887b4e62d07162a1ae28b120469f7a59af54d7801a33f78353c6b426b40e2dd50b03e371d894dabe80f572a23722c3991759c8fc0c7bf6788bd7ed3520dd28361f7c9e1d895f74aaa5063e0e04473afd7509ad204266966242f4103717ef36fd4a5c351210d4ab2c66c6dfe2af87c0f8f718999d75cc670d9574b0e00400fd407e143d8d20c6ea06a69c23b552e3dcabcf9406a7ad0f2df8a69e6793f40ef0533961b1e3d8c1e013c16c193736bd64979f87ee74129e7453c29ff892f7cd0879835339473dce735ef244622596c16b30b343305b282b73fdd40c4fbda762b3bc6ef8635519771af9f340fdc2fda85e2e750d12ad4ea66765ddb5ecfb56592bb083c4ba032b9b1367b9117827d38d96631a5fcfa07f7a3b6dbd27541a883db09655463d8d56d2e632030a2520c027311cc9113cb236096e58cf8a2c262ab19b8285377b1cbe2a75c646189fec643abfc5aca7c86478ab1cfa87c4dfbb744c33ab44a6d5ced9c4a09fe4ee14eb8fcc2d311cee944f5c1b222b6ce1bfc09fe8fea1ec0048884af1e497ea5aa8cdc7fa1d61ee8ffc6fe65c7fa267421d7c3be5439998addd1517a7140107c6d99033a7ceb4b416b3595fa1ae53009b0c51766ccab6cd5dfe01de1b54526b5c8c5270a0f5e19678a94e6fbf0a62411aaa0f9718845d69834e7bebf98bc99f6b3fcedc717d7e8585b89fe218bb1e3ee11e87efd6002f248ad14f0cc22ae6d9fe9d31dcf202c959bfb9c46bea8cc049f7357747f0ff9bf27e2c73f62d0c927981971db7620c5a8e5a31a3bd235da3310e8c322db4cfa44d18e5f86c6f4b287638f590cb9b1ec962579e3d4b40493eccefccf9acce7a966bbb2d8f9eec2ca7a6040190fa06401762b66fc18d90958461b9543bbc64be197530a9452b2802e502aa291a18ddf9d23cdf330b7dddc9dc8d51e2247f19ce23d173c8054aee7e6d562dc1fe4250e5cee386ba65673edb10dc2397d3dd4ff7f50db6f4ae7e02b837334e115a6e60fb0f6b4bd4d11c9ada6777bb22a92d40e7e8eaf105a2062df6b6858060ba5d44bec0cf6c6a89ab5b6836ba9b1d82a84bb3f2a6588393948bb2cfa581192e162bb3f5c4451c241fbe24209a10", + "0x728f9f77fb226c9caa77140be9167a31a0bd26a72e2a83cfb64e1734e7563f7ad0401271d33b23e5ff5d0d80c0be3f72cd98b8f4093dbb60ad6e27b633f0ad99021ad663f662932abc4e1aeffb11f119136baa010327dab9439e661ed35457a9b88b0b18d3c6a854a2a2273c3be93a00b3f1ea1cf68932a0cf6cd1ccac838167bd22322e32fd7b263dd0937840bf36d9e359fb6fe30ccbf649cd61f6ae760f497f2ea37b5aaec56acbbdb82247286522a53ae4f6e11d703111d19e7695a24418fe35ca8892fb03f357a9675d011f0af39f0f550302425558dabf80a93eca1524a1191edda8f5ee0f654425c148c0d72b222f1e4684723f96f824641add5125b2d71b748e8d4515da4cebf79c26efe32a5d8b4cf5661d97e95bd8d2b514c3d9a031f330288fe76ce519c0e36930c39be2b6e642198a2a49d9e8af764bea7f1fffb110e40d6e21140a911b169c8b476159bba793f6c314ea40a78d3daa751f6bfb60ad611e393457f8f6d1c10c6acccc8a8f0ace39d0d3a4835466c1e6fe55fd8e3f0951431bc9cb605c56db1df3303d034f88b15a008394db304a0a4d09e475c0905da281b2768e8d9eb6b342dda88bb350e2290a696b2f95b389a8e282ad173a0193d20ed108d3659b9c24df59f5cefef25bcb53f4ca679b5c31d853e9086fd6f4614d1007d8877fcb8ae9eb10e29dba496579d6ebbc3d4fad30ff73876088444448aa3b5786d3cb50793f907609d0a97f03d1b7fa29ff28c00ce6a725134f075e708261fb3aba3a3d4d3f04b106a26b1266f2153d2970607909ba9df09f7f5de7f9e213ab09c091795be07fe53f01dd1a2a6cdc1b8a24790ea0a7a3cce40c2ca9f1a39a958903e725c1f795598be32cdeb887dbc54de266ed9b87f817add0de0397d92ee2fb5d900f9cc4322abf2964f3e07e4026fc03c750cef3ef91193732823fde4b00b25ae60b18b7e21ed73ebb838c7f6db63682be677ef9e790984312253c2a1259ab6a9ecc429f0c6bc83bd396651b5b1351d89a412cd7ef788f9cec6fcc448b6e3f1b61c4cadb8d5ae37a050f6e3ad9f730010004b04aaa389f90260c65da55d61ecc3dd34c6e1f962c12a8b48f1aef2bd7a98eb03bd16e1f497cb6b5e8ac44aabe3ed8f49fcf8d0299aef24090bd40f5d2c370162a05326933dcbcd4b7e8bdfa96f93de1e4b57632260e7c286c41bf40b31e2e717a64c8e1de6a5e8d857afdd4155bd4850069031a54eaab6495a3f986d5871736d41c110652ed8aacff42a8dfa481b07738f545a1ae42c2c1c283f249a2e79815e8529b0e202f05b2b8014e8c5e06574198b79ace28cdeb3fa015282ae0c673f3a9fdda27d21214b52dade7518b00c3cfe83d98cf63889901b1b73577b5bc001a13cd007ddd5dee4d66a11515c718698218920cd98ad87783e2bb98300216acccbe31db157a6d51dacaff1c5cd35fb156537be636243e24c3452082029599a0f8cc454422b0a8d87971890a0c160e5b7e3e6522f9743365706b4a672b414e87fffee63b847a05518f1eaf61638ea1814fee8f2f783f9d02e0aea8619e4f58a6508345087fd491483c68fbf4503a6b39bca6cc7845b22a03526a43f35aeb72654e0b713b463314b572c46e9993407d94d346e3c129d4676e6560b946902e14d971e1a103c5cdd40e037f35de4f7d26887649c157f4ad9ed21229df56ecddc4c707409fa92d366eecf38f72c7a7d29c039ac4da89099fb1628de141864c110046107a98c312d054b16223f2285a0885b849e451a8111483920cca619f5ca14eabd16a77fcae24193a343eeac10dc7fbafda861fff3a19982ca2cafee02b8aff18de59a5998a14f5e24f7ada94000e21162b3d7dce5d9da71331842a00ea24cf6cc3b19c1333736b99866bfd7e88ffc19b5562faea28d757e5ea9c6c702335", + "0xb552d3861b00240e9135ad35d1378c11f6f8a7b3fbcd83e45573af9417c8a4f8b343574bfd927102eea571d5a40df2bd834e35faca4254efe690466e68f5285955c8e53e1cd718556fe33c54fff406c4818599a1b8519d72955565968c109cd6c843388516ba74ff6793be45efd6f0df58a6416cdb01bd0f4a2ef59097d3c9c40ad7c6d9595b7a4eb3351f699fef7613d52570da42cff2380172f3f73ff64dd30d982d7e68a7a514de0879cf7be4c4a464eba787d43685bd7d0a1c578a8e737e759e51c2b50b49c3a91fcbc2960771dee8b79a7f3d3b13df2d65cbdd502fd67436e208ebb1f7113abebb594ec80f18fc1338036c29febc8d91eee8dd9680ef6dd578623c4d8c5652e0231522df03ebbfcaae62cf1a94e0b8628c451353a8a4a1668ea62f430fef3b59a433ed530cfa541c77d585dd8bdf27f1b80538d61106d5470747b3169c19b385864e75c706da7610a7f8313f6c4bee2f6f27f7ddfc6c7c76bb49d0a414717c5d5ab2d9137085424c09216d8faa993067f86356d5181ad7871bfe7bafb4c6c6d53b73b46b5625f9bfa296470343be0edfadd79e6336e7ab0f287da4640f10f822a0d4ab65cc3fd93413eae35520a16158a442af0f4e560213df73b7ea6dae7cd6aac8046f8663e2db8f9b7b6fd2849802304ac2709f0a3ac6b2befff74c9f551b3ae2e78eb07d037a5416091f42dd06b8ef9a165e86680d747d60864acf7f10dee4ecffd4bff03c8e352dc629f7c9fc1c1cb713e142beb7783ae87ea39c3f60a854daadd25a169a5e38269f46841948d08e0fb0b33d3d4a451263f8aa78741f15b78d1eae378b3e34260d385316ab43f7ad0eaf1a4e1ad3d28ac5ac26d80e7a8134d73e260249763d8976d382964c9a90c9399b0fc9425d5efee59aa8991f2738f524a27f60e2753a70ee5a836cb73955bc6bcaec25bffbe01db5dda5257300eba807de0a19d5fb393fa3bb1d9ea2ec7e3418eea1b5ff788c9e3640b08898b0bd68ede9d9fa3cfd9ac422f74e27c94551228af3eaf22dc8b115d34902d8427e63c44e2ac2056b347b71ebf61f0ac9e14ab3d9658036d435c57841c7a19c6865ea56298aaed2f6cc5a2df68ceda0d693aa295da9bf421342964552941674c8e6d1f807d5f274cfe9fcb70b8196baa457b96a9f07bc12e7e79dd137ad77ce30b9547047639493e7b520b512ba12c950d0452e563529fd224e5aeead34889ef3cdf264fd91d05c664f6bff58f163bf9dd2a75f10858df9808a027c65864152074ba6ce69ed9d6c78db7a2ff8508fc92a6c2aec2c17e83b7541727d62a1302c9c3feb6d1348c17d4fc57f7effd87679611eb7a2aa16fe0236e0708340beef32a14617d4d16f441391604433b1ccf40fafe07f736ecd887151b66801ce0716013da7b09e4b14337e99dd8bd8df0acc08af42132765948bb53c0073bce3a3d761f46eb4b53f3a15bf0855055c2a4d2a7ae1c3baa144ececed62702ea0d18e0b11a4062c12f52882a363ea5c5f768aeaf327f8d425f05da1671f68340c009212301b304066dfb3d5fa67788b7888eec4f0bf7dfb4ab60a4d892c826ae373c1f0f18a0615a9a5d073ad53d423f2f2bb004f5dc7db95276495aea9ab3540c529aba937da6df33bcaf90362dd4abdf28b42fcdfdbbefb8864bcfe66290ef052d62e7a5600326bc3867b5014ecf47245b3019db04f28259ad17607bba2e48c28e92350c5b062c3302e96c0c40e2f953031818e8617de765c21a8cf93123f57c99cbff35bb07a4e2ff1d96b32dadf9f2af2cac91f3ad12a2818ed989712c35f9b3b672279bdd0852d9f10697e5e55255473919319ebe8b05f0d762c37d5c16eb137a949034457f337116a278468ec1baf4d79b5106a2567789c7d666006d0b17b9fbb6069842d02d6f34c16db064b0ea6d10000", + "0x6907bd3fa3cf43467849369c3dbb888fff0369e060d86ab746379cf3b5a50592d2d276d23a6fa553db0ea2bcb32bac56c009faad90628bee0d3a753d136f095f4c350c03facbc3f2c4717b11628f7e1342c56f619ffe27da654f771d0ecf4981716f7b977c6dd31c14d10ba83b424d1fa2f3a140763ce10b8f2dbc18fdc0cb0385c23cd0938a39f0904ef0f5fdff12d8a4dfa82daf2c255750385b45c89d62f9a7cba15871f42a0b2f97a25bd4c4241eb50734c939d103c2c7fb5c83b1be62c57f1cfe4302f8c777d7fcf0b78a27362e63da4d0827ca272ce003c609a3091351ee01a70696508776718fd7015a45aa9a8b2c6855ef3ea6f8bc3405905ac8f9d8a691537a3f7f3ae171d086a72a8516051e16480305b68803f82eb8a1b953fe95455b146ff6f683a27fefc998fd0ec6879511d0ec452bef77a5e03631ba3c75b1c3849ff6758f6dfb674c3069415cfe2c9b137108d61d6332fe3d2649528e9392b3f1c986ef9ee4da6ff0dd4327add4392c9403c9ffb9da453a367f08ba974bd486832948e97e1da08482b0c40cea1bc6629a7acf224a679713f44d2897d159f736d78731a3d7d9355ea35260da66d64b3af3564481400ca77cd13f84ea1ce6154fd1ac655e8c1f678d99c2f844e0074c3df1fa112cb125e53e6f5c9253b0a856aa4eb274631c9f0f5f7b05f42c2be107ea2e6c108c361b618d0f9ad7fd0dea25b40821ad6305f0b3c890caf8f1bd7cce9827319cffe3c0b21b4319834ebe1fc54d28ac393e2d223c13efb775abe1d251741938925834ae0f2e061307ddd8ed9669a7c4844ae4acd0e93dec244e1170098006770e73db38c6e2690600cabbd68f01dfd5f4e4a4b423081f6326b50697c3dec13b012f0af1bba4ab319774fb9d61af65332b6a0948fa9ca58f78e37f7743f08d2cc020ac64d4c29795a27afaaaef0d7358fd0b14688271bffd0134a5eb89470137f25fbcd1ad4823e25058b3f6f0dd936433a3c9d0586706b2d23edff9b7824cd6bcdab7ba9aeb9ea3365b0504636b33d1d4ecbbd28707f717720cc6e2f2ba6ad787d6c2534c2a9c860a6e864e2b65b20a2c156db7fbba2f954ae31803a46e54eb64dc3d5f76f02edc759f13f27af23adc5ae2cb1359f85c3ac19c9fc95d9595b585ceb94e0da88f9e9138b1ef50ac57ecd8570392b8ec74100b251e7de70870c777fbdca6c09612cd35f5422167c086656941771d79f945b54cd6b43b7bf3b981c7ff2153e06e84b062d11bf039976b2619393c3f5c2dc3fe70b26ea3374b03d6d215db481ba35f006235db88662573c767eb3c729a8e9f3c70720579839be3755c1f369a53189369842fcc627a4752415c5e779a5f23029d7f0dbe307698cd7abadf720cbce8bfbf9651914ce242470df2449f3229cb967f8373a5a0c80fd151f56077a3869cfff567ced6111a93a5f5d4660924afc8a6fcfca39a9f3907ab8e50995fff77860c4f0d44e74cf3b492cd891e16bfb4f693f610701897ea0b018d48ad826af653326d858df63418af5df7d806918f3f4a57f8bd8004fd1d85d45c3ddd4e4eaabe228473f16b314370c8e3186d976d709b2bc3cda34e35adc367c2392dbf6bd51fadf44ca5815aa40db589af6c81f9126b0f647568127a71ace74e543d2857b05f462761be8154619f3928683aedaea256ff17fc1fd71956a58ac5f7ad663760f672cb1ac0247a92dba039f4024dd69478b58b6337a8fda1cd95afc3e903dc13c82874bfada52cc09bda278dd3c27507a36416a64d518028ec29837b2e2d98809c692d1329ed4cf3a5df07d3d8fe5d18a6bfe7010df3374130959786ea7c5920045c40d06513d8dc981d1f72907305182b379137ddbda15008ad6f5fb3698807756841466d960651ce48d1770922aa5c5dff14d8de7ca929f60474427374", + "0x33930aefbf0fb9b16d2e5cf2d12164ad858c712e70ccb42b36ce302313234d1089170e5e6395f79d396dade49c893865bd9460399c0b5036a4ed331ec1c0ed68401e79380e16c5b3d070de0db3881a7d6728ec9d2cbd6b3ed282014ea579da9bc5efa3ac4a0833b22258f1feb5e5a17d754134629329ad5c60e0bedaf4c84a5b119aee772f0f96078f779fcd9242923315dffa826644a26015674aa21018b26dd812ff4f96773bcf5f50549df4dfc14b4591f13ebbe3015485e748a96e2c73833cb22727eb17d46a299dacca95df329f3af51ec8143c1acb0995b0ccb8d8d17e506e63435c4640675e3345a940897c2f30d4fcbe6b27f5c9c6a47a921467dc8eb1c35dc53700e43d2539e8d3df8a3418201d4645fd7dcb3a8a511e6bf03e5bb7058289cf31aad9a64ce67914db29d1b0c7fe218a2c389741112ac24823fe422c98e4fc94e3bb70995fb46d1e61ca17966aecd52f5d2018d17153d9963381721305cb337bc94789bfecd3af3ef9dfcbaa8cb6e0cbb214a24428933decba34c9272ce53bea5aef7065f92267ad00edc7964c48df41ed8865212daa0af04a8cc301ccdb3d769dd94f456e84681554b12ad41511c976622433519ae449d8153f7da2429ec7289221717966fcf7efd353a71ec0e21c167f6b2498d2c86caac8c2b99743387dfc42fcedf453c46374405234ea27235f7a03e2414c9f99746540d686eb7d4ef6d49482834f9bae4a0e513eb3e45224bb73e905b1472e1b38b533ea3c1c44eebd3eb038babeac2019728ead642211db531acad9cffbbba1dffdaf48da060ee93d882d5619b9415e29192ae060df880e4ed1f0050eb0bcc63102d08e463359d3cc39c90d71775f8ea33c9fac86c570bcb3047195e0b0090ea4cff5081c6ff1b000857575d79aa741843ac5b9b9101342414a12250e7c307a16c6b03593b880d17665fefd9b8d0a3f0e44f11a87d003e31ce5ce83590215e38a48b726e50802e8dbb31408d9b76dff03c088559e28a8fef18bb81b1e2538bcb83d77c25b32571cf6365d00e7e68273ec7d022a3739037ffcae34ba1c79e4b34e23340670deae609c76626b3842ebd54fb24e824446f61b87bbd14fbf9be1d1720ef6e2344547d047d204df84078b3b3bcce2669cf8ff4639757ca128fbe9dc59fd52221b7e4e3ddaae4f3ba07d103de1b0fc0732bdb0b94921e8d0159227d3ddee73594378a12fdae82b8d3594e0d00db248d1b6f5e6ae87f9651352bd69f9abd501b0fe860b6c1414efeb932699900c7d8ae41630f3d1be4b6867ba8ff4464061c2a89947a10dc010474238c0c6d2fab74d3ec5af3c05d628c19f5c39b4be3872186605454315c77ec6cab4ecbe4c4a45a41794439e5e3fbdcdcafe0e49a76a9bf6e3ccad13d2bccb5d9e60494d1257e0ff57c3a67c56cf68cf27bd8d1e656847033951d5bbf98af005eda3ac72ee0be94faad142ca873969b698f8579b778a5ce5aaf629552dccfe07e408eb324448e1dd75823c704edb71a4bcf2b9921dea2e54c7e8a834f9917a98526968b2e010cdf92f5b2f4880462bad4b0aa077489e2782f91a86d75b84aa25925a6e3a6205ad901c5fa0bdd37d0b31895e499b26b99d7a447d8cec7cabdb1383b968f8ed472a3b7670c3990bf76cc2fbb1ded61ab7b7a81e0f3096218fcbdd95ae98eb829be0397087008c684aad694f206f4854d62268203034c731eb8dcc02675f96d98697340fa548e37bfb1c5811bcde5a6efd09a48907a260d140bc6c97a308f79c1d01228ec2e15e588f55ca137648fe484f34de7243885a689e7648a6f750cdd2447fc4bb2e63ef6a304b6990330376979b028dae925e8e53f2755ba36dd76ea4f411403c56881e2d9ac037dbdb05315e8606e109465e4d35a4f9c4764afe480a34af3a025bb64c1a71f73e61", + "0x503362b7ff5f430188c6466bc58701d5c8a6245de7c6b76d54bdbfb454823df33d5dbc1078c3e30f34e86bf93ab102e7bea764c733bad4e230212cfc7f6b1f586674f86fcaab845d906c3986bd47f921c0392f957855bf2e6d9955befabb9f91a6509d21039678b6cbf3901074ba95b78987d92dbb300851bc1a282c1479df2b5b2b9de291425179a5953a73f9b88ad21a661254680809acc6197d3127f4c3c59b9983bc00b2f1519f959d7d8b3e92eb9e27832660cba5161fa103efe3956dbc564437eb2b5952b16149434cadea094bf59d3fad8d3946154165972e261954895ddda4f70df0419cc4caf6945131f3c12ab17cd4dc1083ce050c67b7ed7b690dfd67bf3407e3e6f8a08bbec4cb61cd0889bb0b34a050c224ef2fcf20ed2d27f56f5f618c02e1092780051962ca280af8f8bfa0aec949bb240a58c30640751736b50e00c3c48bedc9484b58fb515f78cc794eb675f9f7ef7151b8ed00494823b59392a974b31b62a4263c9d61066fcd8be47b52660f6bb9a312a5c34bad631eb29890d03fba572ec68c9afcea2524c5e8a70b4a2369075eebb867cb1854a45cc296624cebc4a9267203d2db17f2462185d6c6fa7678583977871433bf6e29468b0e0672b6cf3656972fbaf5a31b771d19c4e5c750d377ec2c611b1d1ce7e6ec555d9ab47c03e6e25ca2386385857f88e524b9fc5b59c7f0cb8122488a4b9818d55d27c54484fb032e78db296c00d265ec9a4023c05040d49e023c73c48d26155c3d8c7f45b6d54b55dcec755a6d6c146383a23504cc8281cfc7e4ffece86db5f924a3324f615dad51cd5108b2009553858bc6ec8e93ef8edd3bc7b789764c3d3502e1befd9c3c782e06f8f75bfea848f610a169e39d430091dfa0e9db8439434fbd17276f45a03a1fa0b3a817f2e0a0c1a6cb20b0c202b25ffaa793619bbc0cff86eadbcd711f0569f444e3ad5c52f41567bedcbd71ab10619485aa611ec430246ffd2a93c212663de708730b050e16f1c4396455482a78dd62b2400a4de804cfe5908f7c26193469e249a91fa27cd2259c981c63c1e5687b026319dfb9bb27bf8ffc2d3eaa35bffd96411e426b4cc5e64e4e0d7be2d484e4ee2c9c2502f77cd62bf6f89745eedb261d8a23708bc37ed00d9928d45d4c645c92cc05329a4c5d5aba41085f93438997d7f9d84124fca6cb840ee29e73d2ca26cf3805a58cc87fc7c376953053fedb421f9284d94289016ae77d86817a31b93c2cb1ef10b9b10bd10a87f67d16510f891abc44688994c8ce281dfb962d6feb50df67917cac83e9f89acd5d10b39af95947e89621ae502031320bc356a2e6f53e41f14003a73bcd530dcabaf43537224c78acae1e6b74dd1697550537006dde44a33d7524154a70d7e662db8f5c5886f3ae0e2a97f5e21e12cfc8cd28c18f2f5a77e93010505839f4b4320a0f2313bd8685296ff86c75abf7bcf768ccff62e88c73f2afe1657e3b00976c2d58445b181d191013061ddb2de981e8938270727edbb6ce3b68c0735a751d6679d466c6bc243181662649033869959ec68f9cd199142a4e52884437487e3bb980f3c875d7c78ad0f21e762e889aac7069087449594c6e211ad3f12385d1d7b3d1c30ae2e8af57c3a8ff245ca9899d7932bf53e42ccdaa8f92c7a3df457af1176da0399e5345423dffed97a4b42d43e7e7f8db17aed36734deea03148479e4ae51771e102484aa551ad83bad9e9f3867a31d255dad67143f8839442e19680704868f40eaa419dd2273f1d9e9d53ea9bb9cdf1152eefa56096e8f9bc883569bb0f4535a22e367b1681bab850dd97f736d00c87ae27286ec166774484bcac941888b8b8e3dd0c25e913b95970079e89567f961194c8afc6527e36ed03ececc349a1c8365b7b321e043acf36c3c9e8cdf1aa2ae55cc" + ] +} diff --git a/test/fixtures/erasure/tiny/ec-4104.json b/test/fixtures/erasure/tiny/ec-4104.json new file mode 100644 index 00000000..1bfab01f --- /dev/null +++ b/test/fixtures/erasure/tiny/ec-4104.json @@ -0,0 +1,11 @@ +{ + "data": "0x41598a5f24f0b7d91d0710e418a88af45e340c918b00782d61f2f2eed6065411697953a5900a9bca8e2ac6270d546a6e23d3da90ea8eb55ce76c2e1c587211c0ca051bc1e79a4660caa73e0ffd76614101822e4cedf67dbe41f264d406e987a38b0dce6d635c19f8b8a13bc866820d59452a5d0654f950ef8602a2959fc2f95f10a3f9f05a29f620ceea6dad5b3e732807df463c22f2a05461b2e8fa8a4ae1d101e035961f039584622804c30667ad40cd9b015b89dced6d7db1a23aa52896d1bfa8f6c5406e9ea1bf0211a10fd0bf038a74fa8d02b31304aaffd18342568e514c7a34a7dec60e59e22c5ffea289ffa4c2a968aeb2fd880932c8a0d172ee08ab05fbefa4615bd09da52d6010dbbbff07a7eab2c99ec9a5feb57f873f9c1622ebd0db205e3e923391c607f7af66a9ba902ed54c3d8e1f675ff1184f7a0af38eeed7dd9021143599edcd7b313e9bdf161db55a3d61ac2664fffa2383de2ac76945743b4913d20d09b8435fab4fbcb99d077909d0e848f7271b0dd3ef3b4b51821cb621e6df8912ec59f8b6be7ab2749c10b453669a2131805b66ca700502a6b5691f1954d3bcf88362ecc17b94740d2e6c2b38c939743ed8459d6e853bb53e0b7f5b0dfbedefbfc681b94fe175ae5d6f7d988705cbe7004cef9e60cba1ec6336ec595bc7703aaec1fa2e2ee9ad47d928f7cc553b94feda1494e83d687cda2e0cb8bd8b049825547a894d831122b0064b4ddc1de8e0edcfa55dfb9866627d2a23659127a88b8a3ae186df08a3681425f0f6cc4f730d3b2ab0de946754cecf007d2e28509daeae6ee6d58d7876d21c05b0840e25ac205af34dd797e71ed8693878a39f6371ea7e90ec9a27176c6935ddb253b7132d6b527bb726d45a45c6fc8bf8e27038b8fd7ba382613aafdca2e9b4738b35e19b1fcc71ef3d02e585477fd7482212bdbddbf3560d0aaf177ed7ca057982a28bb05a293a27de0ddd9003c5f0337be68ce9f6855c2831627ae7dadc32185369a6e43eea7af8e999195cc7c70d1789f16e04cb6bbccf94655dce4d7f2233e55be05801fdaff05b591c0e7e650c01dcdfb032f7edad0813ec29686b60ef4508cea62c8d0c637b8d71aa527d117237a08eb491206b348bcc27191c47ff7d53d65f9e56cef42e5462b04b62bf3cc8cf7c5d8cd0f3370bf92c0b0e1301d4906ce9e8f131f076a8ba908a1c8177063562e58d3700804d4a3ef57fca67c49ac0db12f02b80e022b837c7517633b9aac167cb7ef6a33ea117149285e403e4a24a7fbd31aae56e9e604d5bfb059e63917b8ff00f5a9e904f1dcf982e6e86f7654d77f7d9bf1a7a49807c325fa6c271d64d58e9e7495fcf4ef6c229c7823e8cce7ebbd238bf88c1549fa6c55d9aee06fe49e3be52943cb9b76cc748633cd079e8a34ef09368bf864609a3ab990051b7323fc2ce46fa4eaef725720e9dda0312f40fc69c437ed816648ae84095ab8417783224203c908740b6559df82dd9183c6f0fafe610e0433fd33ff33f261f6a9ffbc832f55190c3f42b5aeaa838f305cb8a11999c3a0956a0d90ff3bc10114da278ff7dba75ba30df7f9738d25009813dbc1ac9e46f25719a3de62f71cc64f971d46f66cc0d1b1e543651b9cac85387cfb362caffda7c8ede2c0c0b1576be4c95534d6462f3a2b46c298226161d9390cdfd8ec3159a7509baa1d59b4e259829c653103101978473c73819e658b4860bae0004c963826021e4d9aa0a04d2f5e33e2557dfa636466ea6963b786e14dd086c3bcc61b5770c8ffb0acdd54f0527661308a4e153082db25c188217e05264ba056c66c1c1b515eaf1af8dd437e1263131ccd438f9e6f804ac22fb02f83ee54204d437e61f905578cefdf526f969b49e9d2d9384f7b2acf96f085b4ede8889237d4c770e08432c5b837cf2113e64fa76bcf4f80e2c93338d6ec58d2b0a30c1931512e1e4f7647c114d0b8c277407eeab703d5ba90ca39e7fb8a6a3d007e6afcf30eb2e75ed120e52d5256e9db949c05609d4522303082c1a1c56bc0fab0f9ba6346e1aa06cd2c1f73b98c8a4cc9458c9506bb62e82ba76ee5fc1027cbaeacee355b335cb8d24fd0ee80d19de5ef32fd5bb1f4fb95dc57a25234dd76df52b6779e6e6582e0ff83938bd4aab7f24e76dd78b2005e8a753649cfadbc2e4d0556a6dbb6889c26639e6b334fd5867b41526078fbf016e479681e8703025bdb0f4287c1a0f998fa2ba5dd1dcd6ba66617e37cbfd0e7aca26d071ecc0f6a75b32fb6d4dbb206e4447f1fea03eac1f2c9016b10c9ed9dc4b288e965e2dca1fffe59438c918dfe4ede97d50cfef45a16121aca48f4cbc39074787da130457c983dcd62e35bae8687c83be7c132eb7ffed03c1a7736434172599a27bccc219335556c7a20353274224d9a966cdd1822d52f93a3982e8f93655c34dbb3514ffa0a69f6a877fd1f55edceae6b10b45744d704508ce5770a88213bf9e045ffea140a93f88170b7b10351ef0084d2baf686af0b8101240d7bc142812fb35b346380b1b9dec84414398ebe75f99da17f0538fe7cf5d61545c8ec5fb321e18b7579fccf011c648680f8f86117e575a44b15cee47576d651b0cfcd7a82143b44a9d297b90068f3022c1538d2a988bd35bd6496858ebdf42fd6c34bfaebb496d767ec64933d8a7d285e080c21af9d2504559dc4d51334a10f9d5fc1118ac53d9ed159d58e0612e45e4ec3aa74832a9e363caa70a446dab3f796c9fa77ee08344090a2309947ac8c516c57a5633d2ba0b750c8bb0edb24fd69566d88bb8f5ef9f7d5be1b947b4c13da90ef91c0ffdf561e6e9cdd9fa74936f16ae0ac56faf95262f464c68e69ff1e3dd1b60020680c9e7bc0b23fe4ed11a6f12daa8e3dd5e1bba03822c8e13d13634929d55e8e8dcaeecc2b64490f36609e0d1720c09f4fb2834aaf7bcee7c0cbe75792b79470a557a4fd886cdf28e15e47e1bbf3f8c404b897eaec21d8cc82c724f3c6e70705304a0cf6fa0a1fe30d9447775a6f9c4c695c5a0ac4ffa6ab349bef688405d5d51ea6f63206d9e7111631a5456439dcc804cdab226157212e5c034111bd3ffa1f73e677a68b8d523a488d3bcd96051770026474b1532d7270e562ccbe4ef1e2a05d7470216fbba74e6a7e6282cc932020769e1ea516bfe3296d2c3acd4391a07694a7180590283f8a6126360da52fad8c62ecc9960af4418c0c0a50b27d6d5607d5ce5e560786e266a0d9315f659374b566b1aecf95bbf7fc516b3eac8699a54b7fd8be394646f2e56bf76ecf9ab8e2a780b29ab9d487b3e06a9e33de6946764f183f041cc07df786ec36b28bbec1f3b9aa2cc915ea06c001258387fa62bb77f1357ced990b171ce1fb60b78974bac3a2559844beca6b3bea6a74024e4503353efe43dc191925737d4f6d0daca20fde2dc15ff06ff5789994ab6e160e5ed0b7fd341f836833940c7feb85b8a6ae324a8a5b6fb97f13837668cda427cf4910a07559fd3f33eace365965baac3affca395c9876462dd67d1a7f1398bef39e2105cb59fd9b3c2071a1824a16aa35a2584d7e959f458791fe9357fa1c6db02f5ae099a0f409179a96d452d49d3eab136185f2add350d36b6bd2edd46d604bcd05ecf6a88b6030578320df3b00edb2a8afc9381085f0cb5f0cce892134588bcbc85d7320def2223815d90247147cdb64a6a4d1daa03b66207489510226d446eb6d80106e5811d4754d2a256ca04824a587de78602989fa3a5c3f4ad85b913dbb533b248ccc5322370e5316cb87dc1a5c32b0c6b2a1549393d73cce67a5e90245a5cec8739f0c798f733020065297ed6d49698b36e3e08191afca84e12081812e46e5a31e113dbdb6d0ab9c5cad5e7714ee9990834774323264ae82e3657a5b8b66622d94b9a9e0203727b74b962b27447118b9eeaa230f8cc8a438957b27a296422044f97877192a03330d4171eb127c01d988a6df5a77c706a66793b1fb39f34de66fc6318594cbd33d77572173ad3f032c3c7dd9657651baad9c7038733fcb4758e00d8d5181dbed7cbc850278a582e8b0901405e09567f809463d0c4339672f86d5c6b26b16110239409289042f6954adbab35d1671feb5385be79d86d24aa2c92efe33cc2fbec49de44d1527c3e11e0b4c0fe2ebf5aac89685509cf3bd1f9c88be5086fae2c2bdbe7845255facc725c597c193b5adf08fadd988bc9ed7842418966b0a57de2e2715f920a86ac53422fc8a84a7f1f88aade98aa6a0fa0fc62a70e251a30be4e4926633c787199c8665139726132648c26a8847e2f404ffc463fc3e1bf2a4250b76d8205bbd96150d1c2bb33eb80f3682b21126ca2c271ac48aaf4ca5627efdbe0290861bf8dc17c74b94d118301d9734810c90e11183a83bebb2fdc9c5a5e8fe0e5020be6884fef36602d3adcdf69f501443f73fd4082056afa1baec419d6a88a3b2c69818084c00bc9019c2c5983de56fa8e9149b0fbbf8f2624fb0907d72e58cd353a95a3a9a381d16e0231bb19d5fda9dff990c699cfcce4edd394205ee30817c7b50549d9f46e0fc71440f326ca4b7f590dc92af4d6aaabb83a8800f06252e8afbc8679a7f8df1931238195e7fa435b9fb4a35f9aa909e6c5133e7a4f6a73825c0f37007fe1257e74e4c56ea60112fbc810b6ff6a2a16787cb408f303a597f208c0b1576c3909ac7d138bd77a71f68ec0f5879a05a11309956e54033025ce1e7cd1845901aafb721705d87a56fe9ab2ffee7368fc41929c10bcd76a6e172e971d0d4d43290ed9dac5da49d8bb584e8251a2577a3aba38ddf4a91405ac0d977adb91257b5a595e91664cff6b53cbc7ce3a40caf667d7757cd4f5f4613a08279235f0b448071320b03345802aaf8e277e8e9b1ce3fb3fc975b8dc46fd00e88f52e29f968108df27a824384477f2a9308d1a70397983201875726003333c68d3d5de57d22c8279ed04251d66ac5268e05de938c74a3579cbba37151adb1488ad1a6e8659a2bec9cb7e1f33f4c92f8bae0d28595faa56de012fba4852d823af51e684a4f425766c7481f5357e28ba6f7bb42e3e5ebd3c023574d4c25c83642f03fa006337a2bbceb3b8ad0a6c85c4494d6e6c190cb6140eebafeebfacc3b060b3aaae6fb0e4e9858e16392ec9ee65fe20b7e672a0db29643506d6bb22d70f7d65c4e70c5d4fcb43683f97fff95cbc52e54b5617676e5cc251ccde52e8c6ad473498a9032ca2c695fd4af63e9b78cabb11fac627efcadddce7981598203148f92c0bc76940d90a9894494aa1f9f601fb096c851c10b7138dcc2e4f4c583636ee612e6cc0007b68eec021fac5fba66d266192ba44644853fb33e552dbac25e7c2c2aaf5731801db1b2ad8465bce3a524ec170918e1c0483926fa57509cef6e83c8ea0aa61ae9d046bd70348214176a1c2ee4ce8366082727cbc0145dfc4f791a609d84aac34e95ec989ace85feeae1dec63fb16bbdd7f4731491ef4313d2542e6793185b96c39cd3b637eaa8f700d1c5a7341bf113e3aa8ac28bd4b00314e22e7118815ffbada8169e06be86b67a92d9cfcbfb074dae8165cd03245ed01469b7541760752868d21ffc7d2d1d903702a2ea0e93edf849342bad54becdf962e74830c5983dee0999a56dbef2f8bdd2f188b4995213211235e854718beb180b09ee32724beac6cbd81bc70c55731646d2efeee9a06f585f8c9e6d7510ae23cab99bb813086e5f7c1465f13ef264e18cabf63374b4ba1f7991499e1f9fc3531ff6dcaa0a0416318a2adc6a5fd42f5e6dde07938e0e31003", + "shards": [ + "0x41598a5f24f0b7d91d0710e418a88af45e340c918b00782d61f2f2eed6065411697953a5900a9bca8e2ac6270d546a6e23d3da90ea8eb55ce76c2e1c587211c0ca051bc1e79a4660caa73e0ffd76614101822e4cedf67dbe41f264d406e987a38b0dce6d635c19f8b8a13bc866820d59452a5d0654f950ef8602a2959fc2f95f10a3f9f05a29f620ceea6dad5b3e732807df463c22f2a05461b2e8fa8a4ae1d101e035961f039584622804c30667ad40cd9b015b89dced6d7db1a23aa52896d1bfa8f6c5406e9ea1bf0211a10fd0bf038a74fa8d02b31304aaffd18342568e514c7a34a7dec60e59e22c5ffea289ffa4c2a968aeb2fd880932c8a0d172ee08ab05fbefa4615bd09da52d6010dbbbff07a7eab2c99ec9a5feb57f873f9c1622ebd0db205e3e923391c607f7af66a9ba902ed54c3d8e1f675ff1184f7a0af38eeed7dd9021143599edcd7b313e9bdf161db55a3d61ac2664fffa2383de2ac76945743b4913d20d09b8435fab4fbcb99d077909d0e848f7271b0dd3ef3b4b51821cb621e6df8912ec59f8b6be7ab2749c10b453669a2131805b66ca700502a6b5691f1954d3bcf88362ecc17b94740d2e6c2b38c939743ed8459d6e853bb53e0b7f5b0dfbedefbfc681b94fe175ae5d6f7d988705cbe7004cef9e60cba1ec6336ec595bc7703aaec1fa2e2ee9ad47d928f7cc553b94feda1494e83d687cda2e0cb8bd8b049825547a894d831122b0064b4ddc1de8e0edcfa55dfb9866627d2a23659127a88b8a3ae186df08a3681425f0f6cc4f730d3b2ab0de946754cecf007d2e28509daeae6ee6d58d7876d21c05b0840e25ac205af34dd797e71ed8693878a39f6371ea7e90ec9a27176c6935ddb253b7132d6b527bb726d45a45c6fc8bf8e27038b8fd7ba382613aafdca2e9b4738b35e19b1fcc71ef3d02e585477fd7482212bdbddbf3560d0aaf177ed7ca057982a28bb05a293a27de0ddd9003c5f0337be68ce9f6855c2831627ae7dadc32185369a6e43eea7af8e999195cc7c70d1789f16e04cb6bbccf94655dce4d7f2233e55be05801fdaff05b591c0e7e650c01dcdfb032f7edad0813ec29686b60ef4508cea62c8d0c637b8d71aa527d117237a08eb491206b348bcc27191c47ff7d53d65f9e56cef42e5462b04b62bf3cc8cf7c5d8cd0f3370bf92c0b0e1301d4906ce9e8f131f076a8ba908a1c8177063562e58d3700804d4a3ef57fca67c49ac0db12f02b80e022b837c7517633b9aac167cb7ef6a33ea117149285e403e4a24a7fbd31aae56e9e604d5bfb059e63917b8ff00f5a9e904f1dcf982e6e86f7654d77f7d9bf1a7a49807c325fa6c271d64d58e9e7495fcf4ef6c229c7823e8cce7ebbd238bf88c1549fa6c55d9aee06fe49e3be52943cb9b76cc748633cd079e8a34ef09368bf864609a3ab990051b7323fc2ce46fa4eaef725720e9dda0312f40fc69c437ed816648ae84095ab8417783224203c908740b6559df82dd9183c6f0fafe610e0433fd33ff33f261f6a9ffbc832f55190c3f42b5aeaa838f305cb8a11999c3a0956a0d90ff3bc10114da278ff7dba75ba30df7f9738d25009813dbc1ac9e46f25719a3de62f71cc64f971d46f66cc0d1b1e543651b9cac85387cfb362caffda7c8ede2c0c0b1576be4c95534d6462f3a2b46c298226161d9390cdfd8ec3159a7509baa1d59b4e259829c653103101978473c73819e658b4860bae0004c963826021e4d9aa0a04d2f5e33e2557dfa636466ea6963b786e14dd086c3bcc61b5770c8ffb0acdd54f0527661308a4e153082db25c188217e05264ba056c66c1c1b515eaf1af8dd437e1263131ccd438f9e6f804ac22fb02f83ee54204d437e61f905578cefdf526f969b49e9d2d9384f7b2acf96f085b4ede8889237d4c770e08432c5b837cf2113e", + "0x64fa76bcf4f80e2c93338d6ec58d2b0a30c1931512e1e4f7647c114d0b8c277407eeab703d5ba90ca39e7fb8a6a3d007e6afcf30eb2e75ed120e52d5256e9db949c05609d4522303082c1a1c56bc0fab0f9ba6346e1aa06cd2c1f73b98c8a4cc9458c9506bb62e82ba76ee5fc1027cbaeacee355b335cb8d24fd0ee80d19de5ef32fd5bb1f4fb95dc57a25234dd76df52b6779e6e6582e0ff83938bd4aab7f24e76dd78b2005e8a753649cfadbc2e4d0556a6dbb6889c26639e6b334fd5867b41526078fbf016e479681e8703025bdb0f4287c1a0f998fa2ba5dd1dcd6ba66617e37cbfd0e7aca26d071ecc0f6a75b32fb6d4dbb206e4447f1fea03eac1f2c9016b10c9ed9dc4b288e965e2dca1fffe59438c918dfe4ede97d50cfef45a16121aca48f4cbc39074787da130457c983dcd62e35bae8687c83be7c132eb7ffed03c1a7736434172599a27bccc219335556c7a20353274224d9a966cdd1822d52f93a3982e8f93655c34dbb3514ffa0a69f6a877fd1f55edceae6b10b45744d704508ce5770a88213bf9e045ffea140a93f88170b7b10351ef0084d2baf686af0b8101240d7bc142812fb35b346380b1b9dec84414398ebe75f99da17f0538fe7cf5d61545c8ec5fb321e18b7579fccf011c648680f8f86117e575a44b15cee47576d651b0cfcd7a82143b44a9d297b90068f3022c1538d2a988bd35bd6496858ebdf42fd6c34bfaebb496d767ec64933d8a7d285e080c21af9d2504559dc4d51334a10f9d5fc1118ac53d9ed159d58e0612e45e4ec3aa74832a9e363caa70a446dab3f796c9fa77ee08344090a2309947ac8c516c57a5633d2ba0b750c8bb0edb24fd69566d88bb8f5ef9f7d5be1b947b4c13da90ef91c0ffdf561e6e9cdd9fa74936f16ae0ac56faf95262f464c68e69ff1e3dd1b60020680c9e7bc0b23fe4ed11a6f12daa8e3dd5e1bba03822c8e13d13634929d55e8e8dcaeecc2b64490f36609e0d1720c09f4fb2834aaf7bcee7c0cbe75792b79470a557a4fd886cdf28e15e47e1bbf3f8c404b897eaec21d8cc82c724f3c6e70705304a0cf6fa0a1fe30d9447775a6f9c4c695c5a0ac4ffa6ab349bef688405d5d51ea6f63206d9e7111631a5456439dcc804cdab226157212e5c034111bd3ffa1f73e677a68b8d523a488d3bcd96051770026474b1532d7270e562ccbe4ef1e2a05d7470216fbba74e6a7e6282cc932020769e1ea516bfe3296d2c3acd4391a07694a7180590283f8a6126360da52fad8c62ecc9960af4418c0c0a50b27d6d5607d5ce5e560786e266a0d9315f659374b566b1aecf95bbf7fc516b3eac8699a54b7fd8be394646f2e56bf76ecf9ab8e2a780b29ab9d487b3e06a9e33de6946764f183f041cc07df786ec36b28bbec1f3b9aa2cc915ea06c001258387fa62bb77f1357ced990b171ce1fb60b78974bac3a2559844beca6b3bea6a74024e4503353efe43dc191925737d4f6d0daca20fde2dc15ff06ff5789994ab6e160e5ed0b7fd341f836833940c7feb85b8a6ae324a8a5b6fb97f13837668cda427cf4910a07559fd3f33eace365965baac3affca395c9876462dd67d1a7f1398bef39e2105cb59fd9b3c2071a1824a16aa35a2584d7e959f458791fe9357fa1c6db02f5ae099a0f409179a96d452d49d3eab136185f2add350d36b6bd2edd46d604bcd05ecf6a88b6030578320df3b00edb2a8afc9381085f0cb5f0cce892134588bcbc85d7320def2223815d90247147cdb64a6a4d1daa03b66207489510226d446eb6d80106e5811d4754d2a256ca04824a587de78602989fa3a5c3f4ad85b913dbb533b248ccc5322370e5316cb87dc1a5c32b0c6b2a1549393d73cce67a5e90245a5cec8739f0c798f733020065297ed6d49698b36e3e08191afca84e12081812e46e5a31e1", + "0x13dbdb6d0ab9c5cad5e7714ee9990834774323264ae82e3657a5b8b66622d94b9a9e0203727b74b962b27447118b9eeaa230f8cc8a438957b27a296422044f97877192a03330d4171eb127c01d988a6df5a77c706a66793b1fb39f34de66fc6318594cbd33d77572173ad3f032c3c7dd9657651baad9c7038733fcb4758e00d8d5181dbed7cbc850278a582e8b0901405e09567f809463d0c4339672f86d5c6b26b16110239409289042f6954adbab35d1671feb5385be79d86d24aa2c92efe33cc2fbec49de44d1527c3e11e0b4c0fe2ebf5aac89685509cf3bd1f9c88be5086fae2c2bdbe7845255facc725c597c193b5adf08fadd988bc9ed7842418966b0a57de2e2715f920a86ac53422fc8a84a7f1f88aade98aa6a0fa0fc62a70e251a30be4e4926633c787199c8665139726132648c26a8847e2f404ffc463fc3e1bf2a4250b76d8205bbd96150d1c2bb33eb80f3682b21126ca2c271ac48aaf4ca5627efdbe0290861bf8dc17c74b94d118301d9734810c90e11183a83bebb2fdc9c5a5e8fe0e5020be6884fef36602d3adcdf69f501443f73fd4082056afa1baec419d6a88a3b2c69818084c00bc9019c2c5983de56fa8e9149b0fbbf8f2624fb0907d72e58cd353a95a3a9a381d16e0231bb19d5fda9dff990c699cfcce4edd394205ee30817c7b50549d9f46e0fc71440f326ca4b7f590dc92af4d6aaabb83a8800f06252e8afbc8679a7f8df1931238195e7fa435b9fb4a35f9aa909e6c5133e7a4f6a73825c0f37007fe1257e74e4c56ea60112fbc810b6ff6a2a16787cb408f303a597f208c0b1576c3909ac7d138bd77a71f68ec0f5879a05a11309956e54033025ce1e7cd1845901aafb721705d87a56fe9ab2ffee7368fc41929c10bcd76a6e172e971d0d4d43290ed9dac5da49d8bb584e8251a2577a3aba38ddf4a91405ac0d977adb91257b5a595e91664cff6b53cbc7ce3a40caf667d7757cd4f5f4613a08279235f0b448071320b03345802aaf8e277e8e9b1ce3fb3fc975b8dc46fd00e88f52e29f968108df27a824384477f2a9308d1a70397983201875726003333c68d3d5de57d22c8279ed04251d66ac5268e05de938c74a3579cbba37151adb1488ad1a6e8659a2bec9cb7e1f33f4c92f8bae0d28595faa56de012fba4852d823af51e684a4f425766c7481f5357e28ba6f7bb42e3e5ebd3c023574d4c25c83642f03fa006337a2bbceb3b8ad0a6c85c4494d6e6c190cb6140eebafeebfacc3b060b3aaae6fb0e4e9858e16392ec9ee65fe20b7e672a0db29643506d6bb22d70f7d65c4e70c5d4fcb43683f97fff95cbc52e54b5617676e5cc251ccde52e8c6ad473498a9032ca2c695fd4af63e9b78cabb11fac627efcadddce7981598203148f92c0bc76940d90a9894494aa1f9f601fb096c851c10b7138dcc2e4f4c583636ee612e6cc0007b68eec021fac5fba66d266192ba44644853fb33e552dbac25e7c2c2aaf5731801db1b2ad8465bce3a524ec170918e1c0483926fa57509cef6e83c8ea0aa61ae9d046bd70348214176a1c2ee4ce8366082727cbc0145dfc4f791a609d84aac34e95ec989ace85feeae1dec63fb16bbdd7f4731491ef4313d2542e6793185b96c39cd3b637eaa8f700d1c5a7341bf113e3aa8ac28bd4b00314e22e7118815ffbada8169e06be86b67a92d9cfcbfb074dae8165cd03245ed01469b7541760752868d21ffc7d2d1d903702a2ea0e93edf849342bad54becdf962e74830c5983dee0999a56dbef2f8bdd2f188b4995213211235e854718beb180b09ee32724beac6cbd81bc70c55731646d2efeee9a06f585f8c9e6d7510ae23cab99bb813086e5f7c1465f13ef264e18cabf63374b4ba1f7991499e1f9fc3531ff6dcaa0a0416318a2adc6a5fd42f5e6dde07938e0e31003", + "0x5219b1a279ed17c97c85609339b74d41a567715db4455ba6b29a03437d002258c7724cb14bab39f9a725f5f87c6d817bdf81e426703a77ca86f3aa1b112c8a427189855c63189ee0c8fa9b12e86ddd94a66c2d18aad4daf650581ba39ade20c68973f70ca8f4425c0cca5221835b85f53f0a80b7fcc6a2216bfa245e9e74e481660fb6000a51632c988ce97a395f81115ac71b5690affe97b8e609ec4196ea32ba0e1d03ec8b6efecf3b47a0d13e2aa57dc6df86d79ecf513e4821dd9ccd7f395c48fa42b805b54db467a213df709af56893f9b929131a9831565de2a49e8a731cc4a3b02dc372f6f59429b1684d79f59a22f981ffd426cbc7114011b72f8a98bbea4af85a72cc3ec98d0b47d039c0b918ec38a3eb595456116b43f78c55811010ae28f803dfad2a254310f69faf17ae9e338b218b4fe0dde55e18007b5177a14631f9a4774883859dc964e01484dee84fd06383301e7803ce42176da07a61f5531c0884cdb3f142cd5e65547f72c90e749e7cf16ac5d81f797de72c2ee417af5700f90e8018878930e7ad7a1cb8b23b7f370f212959a0c2e6662d8e42e999cf8176e58afb14ba90c638df90fd0ac4b82d678611bbcbe9cd2016583ee5994cb4beee1d825c6e5f876b1b0abc03f0b009e7f52235e4978c2e8ad9f6617f0c9a60151b8287a0c9ee733670b8db39d1b4f889b1ad8e31d2fab90ec208bbe0ad35750ecef8bbf340d3fb60e6fd43ea99d3fb72345f4d231515ae3ae15d58015fd48ead62b3c5ca0a7b5a647a586059fa7a72320731de9d2a5f83ab2b403d8bb8b5f55f640ec7bad3d04b5b71486923b484c7bcdd54ff27c1e38e12fdb7ccaf7bace25cf01eb0ec18eadd3dea29cdb3ad54fad7180bcb7be4196c16e3485905d0eced232d517c2378fc1c907555494b6b8656f0d666fd5aedfc20c1f2c76ad87cf73d3e707a275bec84c095ceabd78ac6cbe31364ea11ea948b4d7c0ad2db8b512ab8d9be3cb0fca0804bc030e93c179dcdfde34031051f42cc4ab7b1779523d5168f5c16eee6c2cb1317d785a4f0a650177992836bd7e81901aadfdddcb0373319a7650004e53a9948ad4eeed39dad8b4af4b90de160cc6a8721103422cb41af3fe5c197c1453bb948205ff077002ed7fbcaf658a090df110e91e32db9468cba45395902daf3d17a538b3c5a0d06bca72a5d6050d1f74c7547d9bab0247a248f370fb9c91d8f8a14a6e5c086b95814ef3013f22e2389e73212478ffc04150c1bc9ae22c4b8d40bfc426134e61e4b5e9908fa28f4df581fdbb739deaaf364228ee0eac524317f5f1e3fb7c9d9b739e0c46e5ddc067a1846c490075dfb15439d1d7fa99291c0418b86378967ca69cb68ac6f753978ea2b8b3d7d467ad37e3a7eecf0c017f3ab87e6124543bcba6897132adebf9b1729f82878a75b0d6ec2adf163f1aa6117e61457f6c014039bf9b410f4747214db8fcef4f12575cbb9fc93a141932fbb840bbc893f4f6f782ddb5785efa07fe6358d039546d4d92f5a8ed72e237db9b494366d5db8a97f37150b54bbaf6a787aa976ff8234d3185ff1f22f235aefd829920ae94f9a4bc5c9cdb2161b64d878fc877517ab4489e66ae9694045260c49379e4d28d63d06af2029314c5f0f5f1b8bef6f57b9583fb6b3fe7c3d8536f8d6254453572d079a53b85da3f866c8b638c35790783800828714dce1b4f705f467d8f357b587e724f07660ca856b360bbf8146aa61885e022069b78f0ac7c8e23e67944b05775d79edd4801c0c1959cf2fed454b9bd27045c0d1ca381a8e21c6c6de02c5156199a8ee8144c726acaa816942ef2d621ad91f85ce03a8870ad15b20ef8fc3f0a41c6de3f9d16319e975833e27a31bc9c8898010c5b453c686eeece295a3c871e63c1e6dcb42848c42dcf7caae93cdbedd1fb1e7", + "0xe71249a0fd151b2dd2c8b7465565c2e6a5689504e5a89014ff227dc5305aa60252e9b81481ce529d9d9981119a39b0f42f4bd4092ef64f1e49b3dd0b74126a5028b5c410349fc72e91690e782f3b5393d681916e40d28445c88c433b2c463eacdd23a5d6330cbb284277ee364269d705371dc359a22f62cba554bb7b9239a1f4b34367031aeeb56fb33d9e2a04db2d00f28f415b3516dd24299195b73295e90a4e939719714590d2fc710142e03beee2eef43a6927b345ff5207000611d3edb38070b5de9c9ad4b43fa11896a734b5f23ea32b34a389dce4f833946bcbf21c5801e5194ed5ef71b73b1d8d39aecf53806a2be3bfc3f293d8c75075272b76d94b3abf35b42483a47da9105ad89d127d8b0e6ddedb7b8f0fe07fa783d6aa1ca0a20887cf7a372e5a24ba265b0e9c5ce6dc3a07667af57832417a0cf87b2e0d66d039506ca3f0b4cda1c941342243fd287d512786913bd4d2c96c19acdb28ba1f29f2743c5cb29c9d662f8a7e3246ff15b52e85926c00e68c83a58e9e06aaec37abae1fbe167540326fa9133b0fe4acc9545b4d40ad9e47fdfe47e8f2706c57b33bc402316ffcac93a3e36a483630064d3631ca2257548e574938153f4db3ead9fa7a7f015203a33205030b5741542464fd9d4a05e86282cbbd043c6b0c550bdde608af83562c44c4d6cd58597221f0f6f99c66eef139833de8ce0d5f11acac2351531e76996413523080b7ecf93f76f949e6cc57ffd8d0ca002bb50c7595e55e5c27fd8ca56a8db85bc773bb8c2a8bb67960d62f7fd41d2cfdf8c43e169c1cb60a3584a2930c4c0f92cfd2a3cbea1cbc96a1fb183721e7036f9170f7465cd87349ecabc78cd78399d0648969a7126ef60c299e2feb9a465b67fa86e583863221ca9d637c8eeab7c534442269bf009723da422a1f47aca4affd83ebd48b0f2aa3a91c02bce5ebd5d9300428ca8da927c26b64b3a9d6fe25c415e0ac733a9dc8a0c47e4552eb587f4d21ccc1b316f92863dec0301906588cab28c93e993d10933466d72a8edce180f57762905faf9514de50a5b44423889b7577c891b132ea2615aa1a890850f90877bf40684ee1e9d04b862b5e609317269198c1b991aceab25c52c73d72741182f2d4347ea895101edbb253090f7ea04ab1ccf49c6049ffcca51bed1f87373449f6c6a10b178c30a00fb4258dca690b2c51beb4942e08260c2b676c7f257891e130a874627cde158696089f1b7790f8f4d32f1464e6314550abd81b6310c4d2bb24d88f5bf55dd94eaf7e350a672557be4bea3112ef40573b6d6b11d82e6df1b8a99c11e4facabd21eb9efd32f54226f44b183a9e48eeeb8bdb0be83a00bad9f5adadc98a6116d616d363b7473ec669d42ed2f7005c5e64efdf250505ce78858ef47ac1c3b8fa92e8028af52472805f4e6acfcbee49f20f661feb546cf61d004e30d63847d8ad0ff9de1da89e07bba0a38d85b8caccecb1d1475292172901c638f2caecf9438d90017be233cee5fcb27cbd2e76a06229ad8755127fccf8bdffdb379363fbf595e4c90e34dbafafb279511a8939d8f4d08fbc1009588897fe1225e31875ba9c35d94f37b1293f3b4ca4257f1cecf549274ab7e0bb1b6aaa57d2ba3c79a87e2c6fa31ed67a79b5e4ed61a28c9e063c4c26f98c12dc668be2b18180ea3c3eeb6f479ad53f75a3bca4d186c9216849a7bb867f89e5241ff373fdd58d1fd0223b601c04c817683cf9a0768b913ac968a20b327f391058865ae484b663241bf7a88895f7aee706e29212ddd0d63997b071cc5d93db357fedbab4297b8b1cedf514e9fe69658f1442debef538ff28def96844057d5d88c072687af4884fec01b41d31149df14bfaf0cd15829f0c49cf3d475d447ff2dbaf708750e91d1b430de1ff78bcdccf1794f9d48942570b2545", + "0xa4d30d881a69d80f1f9dbcb3f644bd09d2d9665c48ab799049671a633899c5a6ab93f8e11577a6c62ebe2e6c47f3c1e843f34f4d8edfa9e7aa928ad0652d8632733ece03d7e086d7e837c725fa6690a682818425d0552a500b0301ba50cc9b0e2e2ff7c6b0a01cd70b7bb722af8e1ea3e1b0f632249e25f5f34051faf3d93ef5b3d1b113270092f5539138450e4d861af3dc55a73a1bad058bacd8bac5a3d4e6ee870a8a947a1f5ede532a427bc964625555283a89324906f64f7af8b9589c1296b397d4cb78f1e9e14f0b20b28a2e9eab70c944cf5b772c33f8c427c7788ffb5738f172da01b05476fad0acdcd0255763bf075ec76f24c4decd16319a00cd958fb8a54a2a826366817ee259557d194904952785e0ccf68407ab446aee81fe14044f9a0c0eac697dc54dd4b301d69bf664ebe081e18a05f379a33a4063e73315027f576b0a43ee55b7eb67a61a0b20a28e755ab92560584dccc99c66373ddbc8e9e2040df06bd6cf646824cce06000f0bea5901f12c42830c07ab12a014719a224b268ad5c6e3a36f24241f60a91dca9eda4759f668bd3889120b4620fa51b1ae24394cba1437c271434e4fcc902dc02cd09c8d0be984123e41f4c1a52e1dc0e9ff29414e078db36e1ac8bf9a495b9a5529d3cd5b8a1e85649911ff102bd70bb802134bff0687b7be41345f52ffe8f826656b9251753ca69df769d6dd96ad7bc836395ceec2b6d37c15d66a9f7e58c4838693f7a7c239554ef062be9fd06eeeb8a427c94d321d49263b351c3a1ad0fa4205ae19fe65f410f95016a99658ed2466e000e1f0d319e3c3b8abd404082d08f8fe54f522bc332ce903c1c80f7af0682dab7b00749cfeaeafae0edda91234ca46515676c180d9f84a9c2e0c8a8d8124620adb0e992834d27564f4fedb46ab47471400e3e5d61696415fca85577a5b62aa82ad704b85c34a19bd48e524c8ff92a3891b28ce8b053dbcc5c802e28b67314ece493d002f6788533d2a4c936bc49de1a0888c67a7104030be0648056fdc7be310e39fdd46ae68a2b7a49272747d1cd5471790c6c2113f4b6ad9456fd57697b58d382d1cc24bf8a2d49c39e35fd23384ef3ffa44c112ad73cf0ec84653341ac586d1d49cc8cd146802f6be627fc63c7445526372aaf57a1b10b00fb282002a879d673d87aa77702e7ffcdee8751fd4e9a014c4ad1475e67293cd7f4730c10c2e8dfe09e9ec620973a973751a468ded9545550410f1ed291ebb15ca8c9c5798e142773a9a37dcc4b258e4aac87d9744d25b1ef7b107b147ab703b3965a3541c89ee8083ea52954cc3ee33a2cf6ac9424cb2610d7560235ef2d71f7f3434b1d60f974a955909e628e2bae146c94ed79197f95a56b34bbe2d62f9760fdc01ff4be2575365db9d569fc433417ec7fe05a5ea20b41c2acaa18cdcef5475e52db919a121814c813fbd4f1d47c54264294c4961e1c141b10f31cd236978a7e7acad9e1e140ab88c90c4fd23d26f1dfa45396396f78ed86ab1aeccfa871f7a21bdcd095e1b53c7d9da651b3ecdd18e7062396a1e1fda541faf6605001fe79f14510e40e299d069256dfc81bbf44d05a2977b9af764eb59439007097bfa656ad61aa4c57849fa204cae4d85f2737db27a89b1c305749bf14442a2b327df622ff66a48ff8fff094bfe012afb15f3c23b5ed360893b8e80e51e4d20c6ddf47169f86be5cad6966cf3b4aecf3d84c773786593cd19bd4850277665eb5b53162ced55cd93f9068f0c18a3eb80dcce4934d7186f0a2d538beea2000b6fa584d856e4e61f01565006667c52a5c837a3ce337a6c516146a8673e4ca2984897c3a168e0e672fcaa3e052ddfad22fe844655c9da35a9e327f6b0b4b816bd25aca3b2f87acb4b10e9505ad38c4e3366e162bc853dd638a397f8aa350efa39b1427" + ] +} diff --git a/test/test_accumulate_invocation.py b/test/test_accumulate_invocation.py new file mode 100644 index 00000000..32382c7e --- /dev/null +++ b/test/test_accumulate_invocation.py @@ -0,0 +1,57 @@ +"""GP-0.8.0-eq:B.13: normal returns override yielded output only when they are hashes.""" + +from types import SimpleNamespace +from unittest.mock import Mock + +import pytest + +from pyjamaz.hostcalls import invocation +from pyjamaz.models.state import BeefyCommitmentMap, EntropyState +from pyjamaz.pvm.constants import ExitCondition, ExitReason +from pyjamaz.pvm.invocation import PvmMarshallingOutput + + +RETURNED_HASH = b'r' * 32 +YIELDED_HASH = b'y' * 32 + + +@pytest.mark.parametrize('returned,yielded,expected', [ + (b'', None, None), + (b'r' * 31, None, None), + (RETURNED_HASH, None, RETURNED_HASH), + (b'r' * 33, None, None), + (b'', YIELDED_HASH, YIELDED_HASH), + (b'r' * 31, YIELDED_HASH, YIELDED_HASH), + (RETURNED_HASH, YIELDED_HASH, RETURNED_HASH), + (b'r' * 33, YIELDED_HASH, YIELDED_HASH), +]) +def test_normal_return_selects_a_valid_accumulation_hash(monkeypatch, returned, yielded, expected): + services = Mock() + services.retrieve_service_account.return_value = SimpleNamespace(code_hash=bytes(32)) + services.retrieve_preimage.return_value = b'code' + state = SimpleNamespace(services=services) + context = SimpleNamespace(context=SimpleNamespace( + state_context=state, deferred_transfers=[], invocation_output=yielded, preimages=[], + )) + monkeypatch.setattr(invocation.Preimage, 'extract', lambda blob: SimpleNamespace( + serialized_program=b'', program_name='test', + )) + monkeypatch.setattr(invocation.AccumulateInvocationContext, 'create_from_accumulation_state', + lambda **kwargs: context) + monkeypatch.setattr(invocation.PVMInvocation, 'pvm_invoke_marshalling', + lambda self, **kwargs: PvmMarshallingOutput( + gas_used=17, exit_condition=ExitCondition(ExitReason.halt, returned), context=context, + )) + + output = invocation.pvm_invoke_accumulate( + state_context=state, timeslot=1, service_id=42, gas_limit=100, + accumulation_inputs=[], post_entropy=EntropyState([bytes(32)] * 4), + ) + + assert output.accumulation_output == expected + assert output.state_context is state + assert output.gas_used == 17 + commitments = BeefyCommitmentMap() + if output.accumulation_output is not None: + commitments.add_accumulation_output(42, output.accumulation_output) + commitments.to_jam_bytes() diff --git a/test/test_availability_artifacts.py b/test/test_availability_artifacts.py new file mode 100644 index 00000000..14c8f7b5 --- /dev/null +++ b/test/test_availability_artifacts.py @@ -0,0 +1,195 @@ +"""GP 14.18 artifacts and JAMNP-S e0b7d291 CE 137/138/140 co-paths.""" + +from dataclasses import replace + +import pytest + +from pyjamaz import erasure +from pyjamaz.availability import ( + audit_shard_justification, availability_spec, build_availability_artifacts, + paged_proof_segments, segment_shard_justification, verify_audit_shard, + verify_segment_shard, verify_validator_shard, +) +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, MAXIMUM_SIZE_AUDITABLE_BUNDLE, valid_validator_count +from pyjamaz.hashing import blake2b_256_hash as hash_blob +from pyjamaz.merkle import ConstantDepthMerkleTree, WellBalancedMerkleTree + + +@pytest.fixture(autouse=True) +def full_validator_domain(monkeypatch): + monkeypatch.setattr(erasure, 'valid_validator_count', + lambda count: valid_validator_count(count, core_count=341)) + + +def exports(count): + return [index.to_bytes(4, 'little') * (EC_SEGMENT_SIZE // 4) for index in range(count)] + + +def test_well_balanced_trace_matches_three_leaf_definition(): + a, b, c = b'a' * 64, b'b' * 64, b'c' * 64 + ab = hash_blob(b'node' + a + b) + tree = WellBalancedMerkleTree([a, b, c]) + assert tree.root() == hash_blob(b'node' + ab + c) + assert tree.trace(0) == [c, b] + assert tree.trace(1) == [c, a] + assert tree.trace(2) == [ab] + + +@pytest.mark.parametrize('count', [1, 2, 3, 5, 6, 9, 17]) +@pytest.mark.parametrize('leaf_size', [12, 32, 64, 1368]) +def test_well_balanced_proofs_use_exact_index_and_leaf_count(count, leaf_size): + leaves = [bytes([index]) * leaf_size for index in range(count)] + tree = WellBalancedMerkleTree(leaves) + for index, leaf in enumerate(leaves): + proof = tree.trace(index) + assert tree.verify(leaf, index, count, proof, tree.root()) + assert not tree.verify(leaf + b'x', index, count, proof, tree.root()) + assert not tree.verify(leaf, index, count, proof + [bytes(32)], tree.root()) + assert not tree.verify(leaf, index, count, proof, bytes(32)) + if count == 1: + assert tree.root() == hash_blob(leaves[0]) + assert tree.root_from_trace(leaves[0], 0, 1, []) == leaves[0] + assert not tree.verify(hash_blob(leaves[0]), 0, 1, [], tree.root()) + + +@pytest.mark.parametrize('index,count', [(True, 1), (0, True), (-1, 1), (1, 1), (0, 0)]) +def test_invalid_merkle_positions(index, count): + assert not WellBalancedMerkleTree.verify(b'a', index, count, (), bytes(32)) + + +@pytest.mark.parametrize('validators', [6, 9, 1020, 1023]) +@pytest.mark.parametrize('count', [0, 1, 65]) +def test_artifacts_match_independent_per_segment_construction(validators, count): + segments = exports(count) + bundle = b'canonical bundle contents' * 3 + artifacts = build_availability_artifacts(b'p' * 32, bundle, segments, validators) + bundle_shards = erasure.encode_blob(validators, bundle) + segment_columns = [erasure.encode_blob(validators, segment) + for segment in segments + paged_proof_segments(segments)] + rows = list(zip(*segment_columns)) if segment_columns else [()] * validators + leaves = [hash_blob(bundle_shard) + WellBalancedMerkleTree(list(row)).root() + for bundle_shard, row in zip(bundle_shards, rows)] + assert artifacts.spec.hash == b'p' * 32 + assert artifacts.spec.length == len(bundle) + assert artifacts.spec.erasure_shards == validators + assert artifacts.spec.exports_count == count + assert artifacts.spec.exports_root == ConstantDepthMerkleTree(segments).root() + assert artifacts.spec.erasure_root == WellBalancedMerkleTree(leaves).root() + assert len(artifacts.shards) == validators + for index, shard in enumerate(artifacts.shards): + assert shard.shard_index == index + assert shard.bundle_shard == bundle_shards[index] + assert shard.segment_shards == rows[index] + verify_validator_shard(shard, artifacts.spec) + verify_audit_shard(shard.bundle_shard, index, audit_shard_justification(shard), artifacts.spec) + originals = erasure.erasure_data_shards(validators) + selected = artifacts.shards[validators - originals:] + assert erasure.recover_blob(validators, len(bundle), + {row.shard_index: row.bundle_shard for row in selected}) == bundle + if count: + combined = segments + paged_proof_segments(segments) + for segment_index in {0, count - 1, count, len(combined) - 1}: + assert erasure.recover_segment(validators, { + row.shard_index: row.segment_shards[segment_index] for row in selected + }) == combined[segment_index] + + +@pytest.mark.parametrize('count', [0, 1, 63, 64, 65, 129, 3072]) +def test_distribution_proofs_cover_page_boundaries_and_export_limit(count): + artifacts = build_availability_artifacts(bytes(32), b'bundle', exports(count), 6) + for row in artifacts.shards: + verify_validator_shard(row, artifacts.spec) + if not row.segment_shards: + with pytest.raises(ProcessWorkpackageError, match='index'): + verify_segment_shard(b'', 0, row.shard_index, (), artifacts.spec) + continue + positions = {0, count - 1, count, len(row.segment_shards) - 1} + for index in positions: + proof = segment_shard_justification(row, index) + verify_segment_shard(row.segment_shards[index], index, row.shard_index, proof, artifacts.spec) + + +def test_spec_api_returns_only_the_same_specification(): + args = (b'p' * 32, b'bundle', exports(3), 6) + assert availability_spec(*args) == build_availability_artifacts(*args).spec + + +@pytest.fixture +def example(): + artifacts = build_availability_artifacts(b'p' * 32, b'bundle', exports(3), 6) + return artifacts.spec, artifacts.shards[1] + + +@pytest.mark.parametrize('fault', ['index', 'bundle', 'row_count', 'chunk_size', 'proof_size', 'proof_hash']) +def test_invalid_validator_rows_are_rejected(example, fault): + spec, shard = example + if fault == 'index': + shard = replace(shard, shard_index=True) + elif fault == 'bundle': + shard = replace(shard, bundle_shard=bytes(len(shard.bundle_shard))) + elif fault == 'row_count': + shard = replace(shard, segment_shards=shard.segment_shards[:-1]) + elif fault == 'chunk_size': + shard = replace(shard, segment_shards=(b'x',) + shard.segment_shards[1:]) + elif fault == 'proof_size': + shard = replace(shard, justification=shard.justification[:-1]) + else: + shard = replace(shard, justification=(bytes(len(shard.justification[0])),) + shard.justification[1:]) + with pytest.raises(ProcessWorkpackageError): + verify_validator_shard(shard, spec) + + +@pytest.mark.parametrize('fault', ['chunk', 'chunk_size', 'proof', 'missing', 'index']) +def test_invalid_audit_proofs_are_rejected(example, fault): + spec, shard = example + chunk, index, proof = shard.bundle_shard, shard.shard_index, audit_shard_justification(shard) + if fault == 'chunk': + chunk = bytes(len(chunk)) + elif fault == 'chunk_size': + chunk += b'x' + elif fault == 'proof': + proof = proof[:-1] + (bytes(32),) + elif fault == 'missing': + proof = () + else: + index = 6 + with pytest.raises(ProcessWorkpackageError): + verify_audit_shard(chunk, index, proof, spec) + + +@pytest.mark.parametrize('fault', ['chunk', 'chunk_size', 'segment_index', 'shard_index', + 'bundle_hash', 'inner_leaf', 'outer_leaf', 'truncated']) +def test_invalid_combined_segment_proofs_are_rejected(example, fault): + spec, shard = example + index, shard_index = 0, shard.shard_index + chunk = shard.segment_shards[index] + proof = segment_shard_justification(shard, index) + if fault == 'chunk': + chunk = b'!' * len(chunk) + elif fault == 'chunk_size': + chunk += b'x' + elif fault == 'segment_index': + index = len(shard.segment_shards) + elif fault == 'shard_index': + shard_index = -1 + elif fault == 'bundle_hash': + depth = len(shard.justification) + proof = proof[:depth] + (bytes(32),) + proof[depth + 1:] + elif fault == 'inner_leaf': + proof = proof[:-1] + (bytes(len(proof[-1])),) + elif fault == 'outer_leaf': + proof = (bytes(len(proof[0])),) + proof[1:] + else: + proof = proof[:-1] + with pytest.raises(ProcessWorkpackageError): + verify_segment_shard(chunk, index, shard_index, proof, spec) + + +@pytest.mark.parametrize('field,value', [('length', -1), ('length', MAXIMUM_SIZE_AUDITABLE_BUNDLE + 1), + ('length', True), ('exports_count', -1), ('exports_count', 3073), + ('erasure_shards', 7), ('erasure_root', b'x')]) +def test_invalid_specs_are_rejected(example, field, value): + spec, shard = example + with pytest.raises(ProcessWorkpackageError): + verify_validator_shard(shard, replace(spec, **{field: value})) diff --git a/test/test_availability_lifecycle.py b/test/test_availability_lifecycle.py new file mode 100644 index 00000000..9128f851 --- /dev/null +++ b/test/test_availability_lifecycle.py @@ -0,0 +1,387 @@ +import asyncio +from dataclasses import replace +from types import SimpleNamespace +from unittest.mock import AsyncMock, MagicMock, Mock + +import pytest + +from pyjamaz import app as app_module +from pyjamaz.app import PyjamazApp +from pyjamaz.availability import DataUnavailable, build_availability_artifacts +from pyjamaz.constants import MESSAGE_TYPES, WELL_KNOWN_STORAGE_KEYS +from pyjamaz.d3l import AvailabilitySource, DataAvailabilityStore +from pyjamaz.graypaper_constants import CORE_COUNT, EPOCH_TIMESLOTS, ROTATION_PERIOD_CORE +from pyjamaz.models.block import Assurance as ExtrinsicAssurance, Block, Extrinsic, Header +from pyjamaz.models.common import Assurance, Credential, Guarantee, RefinementContext, ValidatorData, WorkReport +from pyjamaz.models.context import AppContext +from pyjamaz.models.state import AssurancesState, EntropyState, JamState, ValidatorArchiveState, ValidatorPoolState +from pyjamaz.runtime.availability import AvailabilityRuntime +from pyjamaz.runtime.node_runtime import NodeRuntime +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import FileStorageEngine, InMemoryStorageEngine +from pyjamaz.transport.pubsub import PubSub + + +@pytest.fixture +def source_data(): + exports = [b'x' * 4104] + artifacts = build_availability_artifacts(b'p' * 32, b'bundle', exports, 6) + report = WorkReport(artifacts.spec, RefinementContext(*([bytes(32)] * 4), 0, []), + 0, bytes(32), 0, b'', {}, []) + validators = [ValidatorData(bytes(32), bytes([i]) * 32, bytes(144), bytes(128)) for i in range(6)] + return artifacts, report, validators, exports + + +def test_previous_rotation_signers_and_post_transition_assurers_are_recorded_separately(source_data): + _, report, validators, _ = source_data + historical = replace(validators[0], ed25519=b'h' * 32, metadata=b'm' * 128) + block = Block(Header.default(), Extrinsic.default()) + block.header.timeslot = EPOCH_TIMESLOTS + block.extrinsic.guarantees = [Guarantee(report, block.header.timeslot - ROTATION_PERIOD_CORE, + [Credential(0, bytes(64))])] + app = SimpleNamespace(d3l_store=DataAvailabilityStore(InMemoryStorageEngine()), + config=SimpleNamespace(keys=SimpleNamespace(ed25519=SimpleNamespace(public_key=validators[0].ed25519))), + state_storage=SimpleNamespace(finalized_block_hash=None, parents={}), + retrieve_block_header=lambda _: None) + runtime = AvailabilityRuntime(app) + context = SimpleNamespace( + guarantor_assignments=[SimpleNamespace(validator_ed25519=validators[0].ed25519)], + prev_guarantor_assignments=[SimpleNamespace(validator_ed25519=historical.ed25519)], + ) + runtime.record_committed(block, validators, [historical], context, []) + source = app.d3l_store.source_for(package_hash=report.package_spec.hash) + assert source.validators == validators + assert source.guarantors == [historical] + assert runtime.assigned_index(source) == 0 + + +@pytest.fixture +def transition_app(monkeypatch, source_data): + _, report, validators, _ = source_data + app = PyjamazApp.__new__(PyjamazApp) + app.app_context = AppContext() + app.block_context = MagicMock() + app.block_context.guarantor_assignments = [SimpleNamespace(validator_ed25519=validators[0].ed25519)] + app.block_context.accumulatable_work_reports = [] + app.block_context.queued_work_reports = [] + app.working_state = SimpleNamespace(**{name: MagicMock() for name in JamState.__dataclass_fields__}) + app.working_state.state_root = bytes(32) + app.initialize = AsyncMock() + app.store_jam_state = AsyncMock() + app.state_storage = MagicMock() + app.state_storage.get_parent.return_value = Header.default() + app.state_storage.finalized_block_hash = None + app.state_storage.state_root.return_value = bytes(32) + app.d3l_store = DataAvailabilityStore(InMemoryStorageEngine()) + app.config = SimpleNamespace(keys=SimpleNamespace(ed25519=SimpleNamespace(public_key=validators[0].ed25519))) + app.retrieve_block_header = lambda _: None + app.components = MagicMock() + app.components.validator_pool.state_transition.return_value.post_state.validators = validators + app.components.validator_archive.state_transition.return_value.post_state.validators = [] + app.components.assurances.state_transition_after_assurances.return_value.reported = [] + app.components.services.state_transition_accumulation = AsyncMock(return_value=MagicMock()) + app.components.services.state_transition_after_preimages = AsyncMock(return_value=MagicMock()) + app.runtime = SimpleNamespace(availability=AvailabilityRuntime(app)) + monkeypatch.setattr(app_module, 'BlockValidation', Mock()) + monkeypatch.setattr(app_module, 'SKIP_VALIDATE_GUARANTEES', False) + monkeypatch.setattr(app_module.settings, 'SKIP_TIMESLOT_WALL_CLOCK_CHECK', True) + monkeypatch.setattr(Header, 'set_author_bandersnatch_key', Mock()) + block = Block(Header.default(), Extrinsic.default()) + block.header.timeslot = 1 + block.extrinsic.guarantees = [Guarantee(report, 1, [Credential(0, bytes(64))])] + block.header.extrinsic_hash = block.extrinsic.generate_extrinsic_hash() + return app, block + + +def test_source_metadata_is_published_after_successful_state_commit(transition_app): + app, block = transition_app + committed = [] + app.state_storage.commit.side_effect = lambda: committed.append(True) + original = app.runtime.availability.record_committed + + def record(*args): + assert committed == [True] + original(*args) + + app.runtime.availability.record_committed = record + asyncio.run(app.state_transition(block)) + source = app.d3l_store.source_for(package_hash=block.extrinsic.guarantees[0].report.package_spec.hash) + assert source.registered_block == block.header.hash + app.components.assurances.validate_guarantees.assert_called_once() + + +def test_failed_state_commit_does_not_publish_source_metadata(transition_app): + app, block = transition_app + app.state_storage.commit.side_effect = OSError('commit failed') + with pytest.raises(OSError, match='commit failed'): + asyncio.run(app.state_transition(block)) + assert app.d3l_store.sources() == [] + assert app.runtime.availability._queue.empty() + + +def test_skipped_guarantee_validation_does_not_publish_source_metadata(transition_app, monkeypatch): + app, block = transition_app + monkeypatch.setattr(app_module, 'SKIP_VALIDATE_GUARANTEES', True) + asyncio.run(app.state_transition(block)) + assert app.d3l_store.sources() == [] + + +def test_placeholder_signals_and_parent_finalization_retain_data_until_confirmed(source_data): + async def run(): + artifacts, report, validators, exports = source_data + app = PyjamazApp.__new__(PyjamazApp) + app.block_db = InMemoryStorageEngine() + app.state_storage = StateStorage(InMemoryStorageEngine()) + app.d3l_store = DataAvailabilityStore(InMemoryStorageEngine()) + app.config = SimpleNamespace(ring_data=b'') + app.pubsub = PubSub() + app.working_state = SimpleNamespace(statistics=MagicMock()) + genesis = Header.default() + registration = replace(genesis, parent=genesis.hash, timeslot=1) + assurance = replace(genesis, parent=registration.hash, timeslot=2) + expiry = replace(genesis, parent=assurance.hash, timeslot=1 + 672 * EPOCH_TIMESLOTS) + headers = {header.hash: header for header in (genesis, registration, assurance, expiry)} + app.retrieve_block_header = headers.get + app.state_storage.set_finalized_header(genesis) + for header in (registration, assurance, expiry): + app.state_storage.set_header(header) + app.state_storage.commit() + app.runtime = NodeRuntime(app) + app.add_ancestor_header = AsyncMock() + app.store_block = AsyncMock() + app.d3l_store.store_work_report(report, b'bundle', exports, artifacts=artifacts) + app.d3l_store.register_source(AvailabilitySource(report, validators, validators[:2], + registration.hash, 1, assurance.hash, 2)) + app.d3l_store.prune = Mock(wraps=app.d3l_store.prune) + await app.add_ancestor_block(Block(assurance, Extrinsic.default())) + messages = [await app.pubsub.receive_stream.receive() for _ in range(3)] + assert [message.topic for message in messages] == [MESSAGE_TYPES.BEST_BLOCK, MESSAGE_TYPES.FINALIZED_BLOCK, + MESSAGE_TYPES.STATISTICS] + for message in messages: + for subscriber in app.pubsub.subscriptions[message.topic.value]: + await subscriber(message.data) + app.d3l_store.prune.assert_not_called() + assert app.d3l_store.retrieve_validator_shard(report.package_spec, 0) == artifacts.shards[0] + await app.finalize(assurance.hash) + assert app.state_storage.finalized_block_hash == assurance.hash + assert app.retrieve_finalized_head() == assurance.hash + app.d3l_store.prune.assert_not_called() + assert app.d3l_store.retrieve_validator_shard(report.package_spec, 0) == artifacts.shards[0] + assert not app.runtime.availability._assurance_finalized(app.d3l_store.sources()[0]) + + # A trusted confirmation can arrive after the local parent-finalization call. + await app.finalize(assurance.hash, availability_finality_confirmed=True) + app.d3l_store.prune.assert_called_once() + with pytest.raises(DataUnavailable, match='audit'): + app.d3l_store.retrieve_validator_shard(report.package_spec, 0) + assert app.d3l_store.retrieve_segment_shard(report.package_spec, 0, 0)[0] + await app.finalize(assurance.hash) + app.d3l_store.prune.assert_called_once() + await app.finalize(assurance.hash, availability_finality_confirmed=True) + assert app.d3l_store.prune.call_count == 2 + + # The minimum D3L lifetime also needs a trusted checkpoint before pruning. + await app.finalize(expiry.hash) + assert app.d3l_store.retrieve_segment_shard(report.package_spec, 0, 0)[0] + await app.finalize(expiry.hash, availability_finality_confirmed=True) + with pytest.raises(DataUnavailable, match='assigned shard'): + app.d3l_store.retrieve_segment_shard(report.package_spec, 0, 0) + + asyncio.run(run()) + + +@pytest.mark.parametrize('fault', ['unknown', 'mismatched_header', 'uncommitted', 'candidate', 'orphan', 'transaction']) +def test_availability_finality_confirmation_rejects_untrusted_state(fault): + app = PyjamazApp.__new__(PyjamazApp) + app.block_db = InMemoryStorageEngine() + app.state_storage = StateStorage(InMemoryStorageEngine()) + app.d3l_store = DataAvailabilityStore(InMemoryStorageEngine()) + availability = SimpleNamespace(on_finalized=Mock()) + app.runtime = SimpleNamespace(availability=availability) + genesis = Header.default() + active = replace(genesis, parent=genesis.hash, timeslot=1) + other = replace(genesis, parent=genesis.hash, timeslot=2) + headers = {header.hash: header for header in (genesis, active)} + app.retrieve_block_header = headers.get + app.state_storage.set_finalized_header(genesis) + app.state_storage.set_header(active) + app.state_storage.commit() + target = active.hash + if fault == 'unknown': + target = b'u' * 32 + elif fault == 'mismatched_header': + headers[active.hash] = other + elif fault == 'uncommitted': + headers[other.hash] = other + target = other.hash + elif fault == 'candidate': + app.state_storage.set_header(other) + target = other.hash + elif fault == 'orphan': + app.state_storage.set_header(other) + app.state_storage.commit() + headers[other.hash] = other + app.state_storage.select_block_hash(active.hash) + target = other.hash + else: + app.state_storage.put(b'k' * 31, b'pending') + + with pytest.raises(ValueError, match='availability finality requires'): + asyncio.run(app.finalize(target, availability_finality_confirmed=True)) + assert app.state_storage.finalized_block_hash == genesis.hash + availability.on_finalized.assert_not_called() + + +def test_trusted_confirmation_may_lag_local_storage_finality(source_data): + async def run(): + artifacts, report, validators, exports = source_data + app = PyjamazApp.__new__(PyjamazApp) + app.block_db = InMemoryStorageEngine() + app.state_storage = StateStorage(InMemoryStorageEngine()) + app.d3l_store = DataAvailabilityStore(InMemoryStorageEngine()) + app.runtime = SimpleNamespace(availability=AvailabilityRuntime(app)) + genesis = Header.default() + headers = [genesis] + for slot in (1, 2, 3, 4, 1 + 672 * EPOCH_TIMESLOTS): + headers.append(replace(genesis, parent=headers[-1].hash, timeslot=slot)) + _, registration, assurance, later_registration, later_assurance, storage_tip = headers + app.state_storage.set_finalized_header(genesis) + for header in headers: + await app.store_block_header(header) + if header != genesis: + app.state_storage.set_header(header) + app.state_storage.commit() + app.d3l_store.store_work_report(report, b'bundle', exports, artifacts=artifacts) + app.d3l_store.register_source(AvailabilitySource(report, validators, validators[:2], + registration.hash, 1, assurance.hash, 2)) + later_exports = [b'y' * 4104] + later_artifacts = build_availability_artifacts(b'q' * 32, b'later', later_exports, 6) + later_report = replace(report, package_spec=later_artifacts.spec) + app.d3l_store.store_work_report(later_report, b'later', later_exports, artifacts=later_artifacts) + app.d3l_store.register_source(AvailabilitySource(later_report, validators, validators[:2], + later_registration.hash, 3, later_assurance.hash, 4)) + + await app.finalize(storage_tip.hash) + assert not app.state_storage.has_state_at(assurance.hash) + await app.finalize(assurance.hash, availability_finality_confirmed=True) + assert app.state_storage.finalized_block_hash == storage_tip.hash + assert app.retrieve_finalized_head() == storage_tip.hash + assert app.runtime.availability._availability_finalized_hash == assurance.hash + with pytest.raises(DataUnavailable, match='audit'): + app.d3l_store.retrieve_validator_shard(report.package_spec, 0) + assert app.d3l_store.retrieve_validator_shard(later_report.package_spec, 0) == later_artifacts.shards[0] + # Storage's newer slot does not prematurely expire D3L at the older trusted tip. + assert app.d3l_store.retrieve_segment_shard(report.package_spec, 0, 0)[0] + assert app.d3l_store.retrieve_segment_shard(later_report.package_spec, 0, 0)[0] + + await app.finalize(later_assurance.hash, availability_finality_confirmed=True) + with pytest.raises(DataUnavailable, match='audit'): + app.d3l_store.retrieve_validator_shard(later_report.package_spec, 0) + assert app.state_storage.finalized_block_hash == storage_tip.hash + + asyncio.run(run()) + + +@pytest.fixture +def backfill_app(monkeypatch, tmp_path, request): + from pyjamaz import erasure, graypaper_constants + + # Exercise a historical set larger than Tiny's active set using Full's bounds. + monkeypatch.setattr(erasure, 'valid_validator_count', + lambda count: graypaper_constants.valid_validator_count(count, core_count=341)) + for state in (ValidatorPoolState, ValidatorArchiveState): + monkeypatch.setattr(state.__dataclass_fields__['validators'].metadata['codec'], 'maximum', 1023) + historical = [ValidatorData(bytes(32), bytes([i + 10]) * 32, bytes(144), bytes(128)) for i in range(9)] + current = [replace(validator, ed25519=bytes([i + 40]) * 32) for i, validator in enumerate(historical[:6])] + spec = build_availability_artifacts(b'p' * 32, b'old bundle', [b'x' * 4104], 9).spec + report = WorkReport(spec, RefinementContext(*([bytes(32)] * 4), 0, []), 0, bytes(32), 0, b'', {}, []) + genesis = Header.default() + registration = Block(replace(genesis, parent=genesis.hash, timeslot=1), Extrinsic.default()) + registration.extrinsic.guarantees = [Guarantee(report, 1, [Credential(0, bytes(64))])] + registration.header.extrinsic_hash = registration.extrinsic.generate_extrinsic_hash() + head = Block(replace(genesis, parent=registration.header.hash, timeslot=2), Extrinsic.default()) + head.extrinsic.assurances = [ + ExtrinsicAssurance(registration.header.hash, [True] + [False] * (CORE_COUNT - 1), i, bytes(64)) + for i in range(getattr(request, 'param', 7)) + ] + head.header.extrinsic_hash = head.extrinsic.generate_extrinsic_hash() + app = PyjamazApp.__new__(PyjamazApp) + app.block_db = InMemoryStorageEngine() + app.state_storage = StateStorage(InMemoryStorageEngine()) + app.d3l_store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + app.config = SimpleNamespace(keys=SimpleNamespace(ed25519=SimpleNamespace(public_key=historical[0].ed25519))) + app.working_state = SimpleNamespace(validator_pool=ValidatorPoolState(current)) + app.state_storage.set_finalized_header(genesis) + app.state_storage.set_header(registration.header) + for component, value in ((8, ValidatorPoolState(historical)), (9, ValidatorArchiveState(current)), + (6, EntropyState([bytes(32)] * 4)), + (10, AssurancesState([Assurance(registration.extrinsic.guarantees[0], 1)] + + [None] * (CORE_COUNT - 1)))): + app.state_storage.put(WELL_KNOWN_STORAGE_KEYS[component], value.to_jam_bytes().to_bytes()) + app.state_storage.commit() + app.state_storage.set_header(head.header) + app.state_storage.put(WELL_KNOWN_STORAGE_KEYS[8], ValidatorPoolState(current).to_jam_bytes().to_bytes()) + app.state_storage.put(WELL_KNOWN_STORAGE_KEYS[10], AssurancesState([None] * CORE_COUNT).to_jam_bytes().to_bytes()) + app.state_storage.commit() + + async def persist(): + await app.store_block_header(genesis) + await app.store_block(registration) + await app.store_block(head) + + asyncio.run(persist()) + app.runtime = SimpleNamespace(availability=AvailabilityRuntime(app)) + return app, registration, head, historical + + +def test_backfill_uses_committed_historical_state_and_retries_missing_source_at_same_head(backfill_app): + app, registration, _, historical = backfill_app + runtime = app.runtime.availability + package_hash = registration.extrinsic.guarantees[0].report.package_spec.hash + source = runtime.source_for(package_hash=package_hash) + assert source.validators == historical + assert source.spec.erasure_shards == 9 + assert len(app.working_state.validator_pool.validators) == 6 + assert source.guarantors == historical[:1] + app.d3l_store.storage_engine.delete(b'source-v1:' + source.identity) + assert runtime.source_for(package_hash=package_hash) == source + + +def test_backfill_does_not_fabricate_missing_historical_state(backfill_app): + app, registration, _, _ = backfill_app + del app.state_storage.change_sets[registration.header.hash][WELL_KNOWN_STORAGE_KEYS[6]] + with pytest.raises(DataUnavailable, match='chain-backed'): + app.runtime.availability.source_for(package_hash=registration.extrinsic.guarantees[0].report.package_spec.hash) + assert app.d3l_store.sources() == [] + + +def test_backfill_preserves_existing_assurance_reference(backfill_app): + app, registration, head, _ = backfill_app + runtime = app.runtime.availability + report = registration.extrinsic.guarantees[0].report + source = runtime.source_for(package_hash=report.package_spec.hash) + app.d3l_store.mark_assured(report, head.header.hash, head.header.timeslot, lambda _: True) + retained = replace(source, assured_block=head.header.hash, assured_slot=head.header.timeslot) + app.runtime.availability = AvailabilityRuntime(app) + app.runtime.availability._backfill_sources() + assert app.runtime.availability.source_for(package_hash=report.package_spec.hash) == retained + + +@pytest.mark.parametrize('backfill_app', [6, 7], indirect=True) +def test_backfill_replays_assurances_against_prior_set_in_chronological_order(backfill_app): + app, registration, head, _ = backfill_app + source = app.runtime.availability.source_for(package_hash=registration.extrinsic.guarantees[0].report.package_spec.hash) + # Nine prior assurers require seven votes, even though the post-state has six. + if len(head.extrinsic.assurances) == 7: + assert source.assured_block == head.header.hash + assert source.assured_slot == 2 + else: + assert source.assured_block is None + assert source.assured_slot is None + + +def test_backfill_retains_audit_payload_when_assurance_parent_context_is_missing(backfill_app): + app, registration, _, _ = backfill_app + del app.state_storage.change_sets[registration.header.hash][WELL_KNOWN_STORAGE_KEYS[10]] + source = app.runtime.availability.source_for(package_hash=registration.extrinsic.guarantees[0].report.package_spec.hash) + assert source.assured_block is None diff --git a/test/test_availability_submission.py b/test/test_availability_submission.py new file mode 100644 index 00000000..42d3f895 --- /dev/null +++ b/test/test_availability_submission.py @@ -0,0 +1,93 @@ +"""The staged CE facade validates full B(p,l) before queue admission.""" + +import asyncio +from types import SimpleNamespace + +import pytest + +from pyjamaz.availability import BundleData, DataUnavailable +from pyjamaz.bundle import decode_bundle +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.common import ImportSegment, WorkItemExtrinsic +from pyjamaz.runtime.availability import AvailabilityRuntime +from pyjamaz.transport.jamnp_messages import encode_import_proofs +from test.test_runtime_refinement import runtime, package + + +def staged(runtime): + availability = AvailabilityRuntime(runtime.app) + runtime.app.runtime = SimpleNamespace(availability=availability, refine_pipeline=runtime.pipeline) + return availability + + +def test_ce133_facade_retains_bundle_and_authorization_for_requested_core(runtime): + availability = staged(runtime) + value = package() + blob = b'extrinsic' + value.items[0].extrinsic = [WorkItemExtrinsic(blake2b_256_hash(blob), len(blob))] + + async def submit(): + context = await availability.authorize_submission(bytes(32), 0, value, {}) + await availability.complete_submission(context, 133, [blob]) + item = runtime.pipeline._pending_work_packages[value.hash()] + assert item.core_index == 0 and item.authorization_context is context.authorization + assert decode_bundle(item.bundle).extrinsics == [blob] + await runtime.pipeline._refine_work_package(item) + assert item.work_report.core_index == 0 + + asyncio.run(submit()) + + +def test_ce146_facade_checks_tagged_imports_and_preserves_complete_bundle(runtime): + availability = staged(runtime) + exports = [b'a' * 4104, b'b' * 4104] + tree = ConstantDepthMerkleTree(exports) + source_hash = b'p' * 32 + value = package(imports=[ImportSegment.from_work_package_hash(source_hash, 1)]) + runtime.app.working_state.recent_history.recent_blocks = [SimpleNamespace(reported=[ + SimpleNamespace(hash=source_hash, exports_root=tree.root()), + ])] + + async def submit(): + context = await availability.authorize_submission(bytes(32), 0, value, {source_hash: tree.root()}) + await availability.complete_submission(context, 146, [b'', exports[1], encode_import_proofs([tree.trace(1)])]) + item = runtime.pipeline._pending_work_packages[value.hash()] + expected = BundleData.from_parts(value, [], [exports[1]], [tree.trace(1)]).assemble_bundle(value, context.mappings) + assert item.bundle == expected + assert runtime.app.d3l_store.storage_engine.as_dict() == {} + await runtime.pipeline._refine_work_package(item) + assert item.work_report.segment_root_lookup == {source_hash: tree.root()} + + asyncio.run(submit()) + + +@pytest.mark.parametrize('payload', [[b''], [b'bad', b''], [b'', b'', b'\x00']]) +def test_malformed_staged_payload_never_enters_queue_or_verified_storage(runtime, payload): + availability = staged(runtime) + value = package() + + async def submit(): + context = await availability.authorize_submission(bytes(32), 0, value, {}) + with pytest.raises((ProcessWorkpackageError, ValueError)): + await availability.complete_submission(context, 146, payload) + assert runtime.pipeline._pending_work_packages == {} + assert runtime.app.d3l_store.storage_engine.as_dict() == {} + + asyncio.run(submit()) + + +def test_stale_submission_restarts_before_payload_verification(runtime, monkeypatch): + availability = staged(runtime) + value = package() + + async def submit(): + context = await availability.authorize_submission(bytes(32), 0, value, {}) + runtime.app.working_state.state_root = b'n' * 32 + monkeypatch.setattr(BundleData, 'from_parts', lambda *_: pytest.fail('stale payload was processed')) + with pytest.raises(DataUnavailable, match='stale'): + await availability.complete_submission(context, 133, [b'']) + assert runtime.pipeline._pending_work_packages == {} + + asyncio.run(submit()) diff --git a/test/test_bless_compatibility.py b/test/test_bless_compatibility.py new file mode 100644 index 00000000..9b21c810 --- /dev/null +++ b/test/test_bless_compatibility.py @@ -0,0 +1,143 @@ +# import os +# import subprocess +# import sys +# import unittest +# from copy import deepcopy +# from pathlib import Path +# from types import SimpleNamespace +# from unittest.mock import patch +# +# import numpy as np +# +# from pyjamaz import settings +# from pyjamaz.graypaper_constants import CORE_COUNT +# from pyjamaz.hostcalls.accumulate import hc_bless +# from pyjamaz.hostcalls.constants import HostCallResult +# from pyjamaz.models.state import PrivilegedServicesState +# from pyjamaz.pvm import PVMMemory +# from pyjamaz.pvm.constants import ExitCondition, ExitReason, MEM_R +# from pyjamaz.pvm.invocation import InvocationMutationOutput +# +# +# class TestBlessCompatibility(unittest.TestCase): +# def invoke(self, *, compatibility=False, version="0.8.0", caller=2, +# overrides=None, gas=1000): +# privileges = PrivilegedServicesState( +# manager=1, assigners=[1] * CORE_COUNT, delegator=2, +# registrar=3, always_accumulators={4: 100}, +# ) +# before = deepcopy(privileges) +# context = SimpleNamespace(context=SimpleNamespace( +# service_account_id=caller, +# state_context=SimpleNamespace(privileged_services=privileges), +# )) +# address = 131072 +# assigners = b"".join((20 + core).to_bytes(4, "little") for core in range(CORE_COUNT)) +# auto_accumulate = (40).to_bytes(4, "little") + (500).to_bytes(8, "little") +# memory = PVMMemory() +# memory.add_segment(address, 4096, MEM_R, (assigners + auto_accumulate).ljust(4096, b"\0")) +# registers = [0] * 13 +# registers[7:13] = [10, address, 30, 31, address + len(assigners), 1] +# for index, value in (overrides or {}).items(): +# registers[index] = value +# output = InvocationMutationOutput( +# exit_condition=ExitCondition(reason=ExitReason.resume), +# gas_limit=gas, +# registers=np.array(registers, dtype=np.uint64), +# memory=memory, +# ) +# with patch.object(settings, "GP080_NON_MANAGER_BLESS_COMPAT", compatibility), \ +# patch.object(settings, "GP_VERSION", version): +# hc_bless(registers, memory, context, output, None) +# return before, privileges, output +# +# def assert_success(self, privileges, output): +# self.assertEqual(output.exit_condition.reason, ExitReason.resume) +# self.assertEqual(output.registers[7], HostCallResult.OK.value) +# self.assertEqual(output.gas_limit, 558) +# self.assertEqual(privileges, PrivilegedServicesState( +# manager=10, assigners=[20 + core for core in range(CORE_COUNT)], +# delegator=30, registrar=31, always_accumulators={40: 500}, +# )) +# +# def test_environment_requires_explicit_one(self): +# for value, expected in ((None, "False"), ("0", "False"), ("true", "False"), ("1", "True")): +# with self.subTest(value=value): +# environment = os.environ.copy() +# environment.pop("GP080_NON_MANAGER_BLESS_COMPAT", None) +# if value is not None: +# environment["GP080_NON_MANAGER_BLESS_COMPAT"] = value +# actual = subprocess.check_output( +# [sys.executable, "-B", "-c", +# "from pyjamaz.settings import GP080_NON_MANAGER_BLESS_COMPAT; " +# "print(GP080_NON_MANAGER_BLESS_COMPAT)"], +# cwd=Path(__file__).resolve().parents[1], env=environment, text=True, +# ).strip() +# self.assertEqual(actual, expected) +# +# def test_non_manager_rejected_by_default(self): +# before, privileges, output = self.invoke() +# self.assertEqual(output.exit_condition.reason, ExitReason.resume) +# self.assertEqual(output.registers[7], HostCallResult.HUH.value) +# self.assertEqual(output.gas_limit, 558) +# self.assertEqual(privileges, before) +# +# def test_non_manager_accepted_with_opt_in(self): +# _, privileges, output = self.invoke(compatibility=True) +# self.assert_success(privileges, output) +# +# def test_manager_unaffected_by_flag(self): +# for compatibility in (False, True): +# with self.subTest(compatibility=compatibility): +# _, privileges, output = self.invoke(compatibility=compatibility, caller=1) +# self.assert_success(privileges, output) +# +# def test_compatibility_is_limited_to_gp080(self): +# for version in ("0.7.2", "0.8.1"): +# with self.subTest(version=version): +# before, privileges, output = self.invoke(compatibility=True, version=version) +# self.assertEqual(output.exit_condition.reason, ExitReason.resume) +# self.assertEqual(output.registers[7], HostCallResult.HUH.value) +# self.assertEqual(privileges, before) +# +# def test_invalid_memory_still_panics(self): +# for compatibility in (False, True): +# for caller in (1, 2): +# for register in (8, 11): +# with self.subTest(compatibility=compatibility, caller=caller, register=register): +# before, privileges, output = self.invoke( +# compatibility=compatibility, caller=caller, +# overrides={register: 262144}, +# ) +# self.assertEqual(output.exit_condition.reason, ExitReason.panic) +# self.assertEqual(privileges, before) +# +# def test_invalid_service_ids_still_rejected(self): +# cases = ( +# (False, 1, HostCallResult.WHO), +# (False, 2, HostCallResult.HUH), +# (True, 1, HostCallResult.WHO), +# (True, 2, HostCallResult.WHO), +# ) +# for compatibility, caller, result in cases: +# for register in (7, 9, 10): +# with self.subTest(compatibility=compatibility, caller=caller, register=register): +# before, privileges, output = self.invoke( +# compatibility=compatibility, caller=caller, +# overrides={register: 2 ** 32}, +# ) +# self.assertEqual(output.exit_condition.reason, ExitReason.resume) +# self.assertEqual(output.registers[7], result.value) +# self.assertEqual(privileges, before) +# +# def test_out_of_gas_still_prevents_mutation(self): +# for compatibility in (False, True): +# with self.subTest(compatibility=compatibility): +# before, privileges, output = self.invoke(compatibility=compatibility, gas=441) +# self.assertEqual(output.exit_condition.reason, ExitReason.out_of_gas) +# self.assertEqual(output.registers[7], 10) +# self.assertEqual(privileges, before) +# +# +# if __name__ == "__main__": +# unittest.main() diff --git a/test/test_block_seals.py b/test/test_block_seals.py new file mode 100644 index 00000000..b21908e4 --- /dev/null +++ b/test/test_block_seals.py @@ -0,0 +1,99 @@ +"""GP-0.8.0-eq:6.16: a valid ticket seal must also identify the winning ticket.""" + +from types import SimpleNamespace + +import bandersnatch_vrfs +import pytest + +from pyjamaz.exceptions import BlockValidationError, BlockValidationErrorCode +from pyjamaz.graypaper_constants import CORE_COUNT, EPOCH_TIMESLOTS +from pyjamaz.models.block import EpochMark, EpochMarkValidatorKeys, Extrinsic, Header +from pyjamaz.models.common import TicketBody +from pyjamaz.models.context import BlockContext +from pyjamaz.models.state import EntropyState, SlotSealerSeries +from pyjamaz.utils import vrf_input_ticket_seal +from pyjamaz.validation import BlockValidation + + +@pytest.fixture +def seal_validation(): + secret = bandersnatch_vrfs.secret_from_seed(bytes(32)) + public = bandersnatch_vrfs.public_from_secret(secret) + entropy = b'e' * 32 + header = Header.default() + header.author_index = 0 + header.timeslot = EPOCH_TIMESLOTS + 3 + context = BlockContext() + + def validate(series): + BlockValidation(context).validate_header_after_safrole( + header=header, + post_entropy=EntropyState([bytes(32)] * 3 + [entropy]), + post_validator_pool=SimpleNamespace(validators=[SimpleNamespace(bandersnatch=public)]), + safrole_output=SimpleNamespace( + post_state=SimpleNamespace(slot_sealer_series=series), + tickets_mark=header.tickets_marker, epoch_mark=header.epoch_marker, + ), + disputes_output=SimpleNamespace(offenders_mark=header.offenders_marker), + extrinsic=Extrinsic.default(), + ) + return context.seal_vrf_output + + ticket = TicketBody(bandersnatch_vrfs.vrf_output(secret, vrf_input_ticket_seal(entropy, 1)), 1) + header.seal = header.generate_ticket_seal(secret, entropy, ticket.attempt) + return header, secret, public, entropy, ticket, validate + + +def test_matching_ticket_seal_is_accepted(seal_validation): + header, secret, public, entropy, ticket, validate = seal_validation + assert validate(SlotSealerSeries(tickets=[ticket] * EPOCH_TIMESLOTS)) == ticket.id + + +def test_valid_seal_for_another_ticket_is_rejected(seal_validation): + header, secret, public, entropy, ticket, validate = seal_validation + # The signature remains valid: only the selected winning ticket differs. + other = TicketBody(bytes(32), ticket.attempt) + assert header.verify_ticket_seal(public, other, entropy) == ticket.id + tickets = [ticket] * EPOCH_TIMESLOTS + tickets[header.timeslot % EPOCH_TIMESLOTS] = other + + with pytest.raises(BlockValidationError, match='winning ticket'): + validate(SlotSealerSeries(tickets=tickets)) + + +def test_invalid_ticket_signature_is_still_rejected(seal_validation): + header, secret, public, entropy, ticket, validate = seal_validation + header.seal = bytes(96) + with pytest.raises(BlockValidationError, match='Invalid seal key'): + validate(SlotSealerSeries(tickets=[ticket] * EPOCH_TIMESLOTS)) + + +def test_fallback_seal_is_still_accepted(seal_validation): + header, secret, public, entropy, ticket, validate = seal_validation + header.seal = header.generate_fallback_seal(secret, entropy) + expected = header.verify_fallback_seal(public, entropy) + assert validate(SlotSealerSeries(keys=[public] * EPOCH_TIMESLOTS)) == expected + + +@pytest.mark.parametrize('count', [0, 3, 5] + ([7] if 3 * CORE_COUNT >= 7 else [])) +def test_invalid_epoch_marker_count_is_a_block_error(seal_validation, count): + header, secret, public, entropy, ticket, validate = seal_validation + header.epoch_marker = EpochMark( + bytes(32), bytes(32), [EpochMarkValidatorKeys(public, bytes(32)) for _ in range(count)], + ) + header.seal = header.generate_ticket_seal(secret, entropy, ticket.attempt) + + with pytest.raises(BlockValidationError) as error: + validate(SlotSealerSeries(tickets=[ticket] * EPOCH_TIMESLOTS)) + assert error.value.custom_error_code == BlockValidationErrorCode.bad_epoch_marker_data + + +@pytest.mark.parametrize('count', sorted({6, 3 * CORE_COUNT})) +def test_valid_epoch_marker_count_is_accepted(seal_validation, count): + header, secret, public, entropy, ticket, validate = seal_validation + header.epoch_marker = EpochMark( + bytes(32), bytes(32), [EpochMarkValidatorKeys(public, bytes(32)) for _ in range(count)], + ) + header.seal = header.generate_ticket_seal(secret, entropy, ticket.attempt) + + assert validate(SlotSealerSeries(tickets=[ticket] * EPOCH_TIMESLOTS)) == ticket.id diff --git a/test/test_block_storage_serialization.py b/test/test_block_storage_serialization.py new file mode 100644 index 00000000..7befd43e --- /dev/null +++ b/test/test_block_storage_serialization.py @@ -0,0 +1,33 @@ +import asyncio + +from pyjamaz.app import PyjamazApp +from pyjamaz.models.block import Block, Extrinsic, Header +from pyjamaz.storage import InMemoryStorageEngine + + +def test_store_block_serializes_each_sibling_once_and_keeps_both_indexes(monkeypatch): + app = PyjamazApp.__new__(PyjamazApp) + app.block_db = InMemoryStorageEngine() + first = Block(Header.default(), Extrinsic.default()) + second = Block(Header.default(), Extrinsic.default()) + second.header.author_index += 1 + expected = [block.to_jam_bytes().to_bytes() for block in (first, second)] + serializations = [] + original = Block.to_jam_bytes + + def serialize(block): + serializations.append(block) + return original(block) + + monkeypatch.setattr(Block, "to_jam_bytes", serialize) + + async def store(): + await app.store_block(first) + await app.store_block(second) + + asyncio.run(store()) + + assert serializations == [first, second] + for block, canonical in zip((first, second), expected): + assert app.retrieve_block_by_hash(block.header.hash).to_jam_bytes().to_bytes() == canonical + assert app.retrieve_block(second.header.timeslot).to_jam_bytes().to_bytes() == expected[1] diff --git a/test/test_bundle_submission.py b/test/test_bundle_submission.py new file mode 100644 index 00000000..85418ad6 --- /dev/null +++ b/test/test_bundle_submission.py @@ -0,0 +1,244 @@ +import asyncio +from types import SimpleNamespace +from unittest.mock import AsyncMock + +import pytest + +from pyjamaz import refinement as refinement_module +from pyjamaz.availability import BundleData, DataUnavailable +from pyjamaz.bundle import decode_bundle, decode_package, encode_bundle +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.common import ImportSegment, WorkExecResult, WorkItemExtrinsic +from pyjamaz.refinement import Refinement +from pyjamaz.rpc.rpc import rpcSubmitWorkPackageBundle +from pyjamaz.rpc.ws_client import WebsocketClient +from pyjamaz.runtime.availability import AvailabilityRuntime +from pyjamaz.transport.jamnp_messages import encode_import_proofs +from pyjamaz.utils import base64_encode +from test.test_runtime_refinement import package, runtime + + +def bundle_case(): + segments = [b'x' * 4104, b'y' * 4104] + tree = ConstantDepthMerkleTree(segments) + value = package(imports=[ImportSegment.from_segment_root(tree.root(), 1), + ImportSegment.from_segment_root(tree.root(), 0)]) + value.items[0].extrinsic = [WorkItemExtrinsic.from_blob(b'abc')] + proofs = [tree.trace(1), tree.trace(0)] + imports = list(reversed(segments)) + return value, imports, proofs + + +def test_canonical_bundle_matches_gp_assembly(): + value, imports, proofs = bundle_case() + encoded = encode_bundle(value, [b'abc'], imports, proofs) + data = BundleData.from_parts(value, [b'abc'], imports, proofs) + assert encoded == data.assemble_bundle(value, {}) + parts = decode_bundle(encoded) + assert parts.package == value + assert parts.extrinsics == [b'abc'] + assert parts.segments == imports and parts.justifications == proofs + assert decode_package(encoded) == (value, len(value.to_jam_bytes().to_bytes())) + + +@pytest.mark.parametrize('fault', ['short_package', 'short_data', 'trailing', 'proof_count']) +def test_canonical_decoder_rejects_malformed_bundles(fault): + value, imports, proofs = bundle_case() + encoded = encode_bundle(value, [b'abc'], imports, proofs) + if fault == 'short_package': + encoded = encoded[:20] + elif fault == 'short_data': + encoded = encoded[:-1] + elif fault == 'trailing': + encoded += b'!' + else: + offset = len(value.to_jam_bytes().to_bytes()) + 3 + 2 * 4104 + encoded = encoded[:offset] + b'\x80\x01' + encoded[offset + 1:] + with pytest.raises(ValueError): + decode_bundle(encoded) + + +def test_representation_decoder_preserves_invalid_semantics_for_authorized_validation(): + value, imports, proofs = bundle_case() + encoded = encode_bundle(value, [b'xyz'], imports, proofs) + assert decode_bundle(encoded).extrinsics == [b'xyz'] + with pytest.raises(ProcessWorkpackageError, match='extrinsic hash'): + BundleData.from_parts(value, [b'xyz'], imports, proofs) + + +def test_client_and_server_preserve_the_complete_bundle_and_core(runtime): + value, imports, proofs = bundle_case() + client = WebsocketClient('ws://unused') + client._send_and_wait = AsyncMock() + asyncio.run(client.submitWorkPackageBundle(1, value, imports, [b'abc'], proofs)) + method, params = client._send_and_wait.call_args.args + assert method == 'submitWorkPackageBundle' + assert params == [1, base64_encode(encode_bundle(value, [b'abc'], imports, proofs))] + app = SimpleNamespace(add_work_package=runtime.pipeline.add_work_package) + rpcSubmitWorkPackageBundle(app, params) + item = runtime.pipeline._pending_work_packages[value.hash()] + assert item.bundle == encode_bundle(value, [b'abc'], imports, proofs) + assert item.core_index == 1 + + +def test_client_requires_proofs_for_imports(): + value, imports, _ = bundle_case() + client = WebsocketClient('ws://unused') + client._send_and_wait = AsyncMock() + with pytest.raises(ValueError, match='justifications'): + asyncio.run(client.submitWorkPackageBundle(0, value, imports, [b'abc'])) + client._send_and_wait.assert_not_called() + + +def test_client_without_imports_remains_compatible(): + value = package() + client = WebsocketClient('ws://unused') + client._send_and_wait = AsyncMock() + asyncio.run(client.submitWorkPackageBundle(0, value, [], [])) + assert client._send_and_wait.call_args.args == ( + 'submitWorkPackageBundle', [0, base64_encode(value.to_jam_bytes().to_bytes())], + ) + + +def test_complete_bundle_refines_without_preexisting_import_storage(runtime): + value, imports, proofs = bundle_case() + runtime.app.working_state.recent_history.recent_blocks = [SimpleNamespace(reported=[ + SimpleNamespace(hash=b's' * 32, exports_root=value.items[0].import_segments[0].tree_root), + ])] + runtime.app.d3l_store = None + encoded = encode_bundle(value, [b'abc'], imports, proofs) + runtime.pipeline.add_work_package(value, [], core_index=0, bundle=encoded) + item = runtime.pipeline._pending_work_packages[value.hash()] + asyncio.run(runtime.pipeline._refine_work_package(item)) + assert item.status.Reported + assert runtime.invocations[-1]['work_items_import_segments'] == [imports] + assert runtime.invocations[-1]['extrinsics'] == [[b'abc']] + assert len(runtime.signed) == 1 + + +def test_unauthorized_bundle_is_rejected_before_payload_decode(runtime, monkeypatch): + value = package() + runtime.pipeline.add_work_package(value, [], core_index=0, + bundle=value.to_jam_bytes().to_bytes() + b'garbage') + monkeypatch.setattr(refinement_module, 'pvm_invoke_is_authorized', lambda *_: SimpleNamespace( + work_exec_result=WorkExecResult(panic=True), gas_used=1, + )) + + def unexpected(*_): + pytest.fail('unauthorized package reached payload decoding') + + monkeypatch.setattr('pyjamaz.runtime.pipelines.refine.decode_bundle', unexpected) + with pytest.raises(ProcessWorkpackageError, match='Unauthorized'): + asyncio.run(runtime.pipeline._refine_work_package(runtime.pipeline._pending_work_packages[value.hash()])) + assert runtime.invocations == [] + + +def test_requested_core_is_not_silently_changed(runtime): + value = package() + runtime.pipeline.add_work_package(value, [], core_index=1) + item = runtime.pipeline._pending_work_packages[value.hash()] + asyncio.run(runtime.pipeline._refine_work_package(item)) + assert item.status.Reportable + assert runtime.invocations == runtime.signed == [] + + +def test_staged_authorization_runs_once_for_same_snapshot(runtime, monkeypatch): + value = package() + calls = [] + original = Refinement.authorize + + def authorize(self, *args): + calls.append(args) + return original(self, *args) + + monkeypatch.setattr(Refinement, 'authorize', authorize) + + async def run(): + context = await runtime.pipeline.authorize_submission(0, value) + runtime.pipeline.add_work_package(value, [], core_index=0, authorization_context=context) + item = runtime.pipeline._pending_work_packages[value.hash()] + await runtime.pipeline._refine_work_package(item) + assert item.status.Reported + + asyncio.run(run()) + assert len(calls) == 1 + + +def test_stale_staged_authorization_is_not_reused(runtime, monkeypatch): + value = package() + calls = [] + original = Refinement.authorize + + def authorize(self, *args): + calls.append(args) + return original(self, *args) + + monkeypatch.setattr(Refinement, 'authorize', authorize) + + async def run(): + context = await runtime.pipeline.authorize_submission(0, value) + context.head_root = b'old' * 10 + b'!!' + runtime.pipeline.add_work_package(value, [], core_index=0, authorization_context=context) + await runtime.pipeline._refine_work_package(runtime.pipeline._pending_work_packages[value.hash()]) + + asyncio.run(run()) + assert len(calls) == 2 + + +@pytest.mark.parametrize('kind', [133, 146]) +def test_staged_network_payloads_queue_complete_bundle_and_reuse_authorization(runtime, monkeypatch, kind): + if kind == 146: + value, imports, proofs = bundle_case() + runtime.app.working_state.recent_history.recent_blocks = [SimpleNamespace(reported=[ + SimpleNamespace(hash=b's' * 32, exports_root=value.items[0].import_segments[0].tree_root), + ])] + payloads = [b'abc', b''.join(imports), encode_import_proofs(proofs)] + else: + value, imports, proofs = package(), [], [] + value.items[0].extrinsic = [WorkItemExtrinsic.from_blob(b'abc')] + payloads = [b'abc'] + availability = AvailabilityRuntime(runtime.app) + runtime.app.runtime = SimpleNamespace(refine_pipeline=runtime.pipeline, availability=availability) + calls = [] + authorize = Refinement.authorize + + def counted(self, *args): + calls.append(args) + return authorize(self, *args) + + monkeypatch.setattr(Refinement, 'authorize', counted) + + async def run(): + context = await availability.authorize_submission(bytes(32), 0, value, {}) + assert await availability.complete_submission(context, kind, payloads) == [] + item = runtime.pipeline._pending_work_packages[value.hash()] + assert item.bundle == encode_bundle(value, [b'abc'], imports, proofs) + await runtime.pipeline._refine_work_package(item) + assert item.status.Reported + + asyncio.run(run()) + assert len(calls) == 1 + assert runtime.invocations[-1]['extrinsics'] == [[b'abc']] + assert runtime.invocations[-1]['work_items_import_segments'] == [imports] + + +def test_staged_completion_rejects_stale_snapshot_before_payload_validation(runtime, monkeypatch): + value = package() + availability = AvailabilityRuntime(runtime.app) + runtime.app.runtime = SimpleNamespace(refine_pipeline=runtime.pipeline, availability=availability) + + def unexpected(*_): + pytest.fail('stale submission reached payload validation') + + monkeypatch.setattr(BundleData, 'from_parts', unexpected) + + async def run(): + context = await availability.authorize_submission(bytes(32), 0, value, {}) + context.authorization.head_root = b'old' * 10 + b'!!' + with pytest.raises(DataUnavailable, match='stale'): + await availability.complete_submission(context, 133, [b'invalid data']) + + asyncio.run(run()) + assert runtime.pipeline._pending_work_packages == {} + assert runtime.invocations == [] diff --git a/test/test_capture_refinement_trace.py b/test/test_capture_refinement_trace.py new file mode 100644 index 00000000..84aa938f --- /dev/null +++ b/test/test_capture_refinement_trace.py @@ -0,0 +1,193 @@ +import asyncio +import base64 +from copy import deepcopy +from dataclasses import replace +import hashlib +import importlib.util +from pathlib import Path +import sys +from types import SimpleNamespace + +import pytest +from jamcodec.types import Bytes, U32, Vec + +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.models.block import Header +from pyjamaz.models.common import RefinementContext, WorkItem, WorkPackage +from pyjamaz.models.state import ServiceAccount +from pyjamaz.state.base import ( + state_key_constructor_preimage, + state_key_constructor_preimage_availability, + state_key_constructor_service_account, +) + + +REPOSITORY = Path(__file__).resolve().parents[1] + + +@pytest.fixture +def capture_module(monkeypatch): + # Loading the executable script must not change the rest of pytest's profile + # or import path, including when running the Full-profile test lane. + with monkeypatch.context() as scoped: + scoped.setenv('JAM_FUZZ', '1') + scoped.setenv('JAM_FUZZ_SPEC', 'tiny') + scoped.setattr(sys, 'path', list(sys.path)) + spec = importlib.util.spec_from_file_location( + 'capture_refinement_trace_under_test', REPOSITORY / 'scripts/capture_refinement_trace.py', + ) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +@pytest.fixture +def historical_case(capture_module): + auth_code = Bytes.encode(b'authorizer metadata').to_bytes() + b'authorizer program' + refine_code = Bytes.encode(b'refine metadata').to_bytes() + b'refine program' + auth_hash, refine_hash = map(blake2b_256_hash, (auth_code, refine_code)) + account = ServiceAccount( + code_hash=auth_hash, balance=10_000_000, gas_limit_accumulate=10, + gas_limit_on_transfer=10, footprint_storage_bytes=200, deposit_offset=0, + footprint_storage_items=4, storage_items={}, preimages={}, preimage_availability={}, + creation_slot=0, last_accumulation_slot=0, parent_service=0, + ) + accounts = { + 0: account.to_serialized_bytes(), + 7: replace(account, code_hash=refine_hash).to_serialized_bytes(), + } + codes = {(0, auth_hash): auth_code, (7, refine_hash): refine_code} + state = {state_key_constructor_service_account(sid): raw for sid, raw in accounts.items()} + for (sid, code_hash), code in codes.items(): + state[state_key_constructor_preimage(sid, code_hash)] = code + state[state_key_constructor_preimage_availability(sid, code_hash, len(code))] = ( + Vec(U32).encode([0]).to_bytes() + ) + header = Header.default() + header.parent_state_root = b'p' * 32 + spec = { + 'genesis_header': header.to_jam_bytes().to_bytes().hex(), + 'genesis_state': {key.hex(): value.hex() for key, value in state.items()}, + } + genesis, services = capture_module.reference_genesis(spec) + package = WorkPackage( + auth_code_host=0, + auth_code_hash=auth_hash, + context=RefinementContext( + anchor=b'a' * 32, state_root=b's' * 32, beefy_root=b'b' * 32, + lookup_anchor=b'l' * 32, lookup_anchor_slot=42, prerequisites=[], + ), + authorization=b'', + authorizer_config=b'', + items=[WorkItem(7, refine_hash, 1_000_000, 1_000_000, 0, b'', [], [])], + ) + + class Rpc: + def __init__(self): + self.calls = [] + self.accounts = dict(accounts) + self.codes = dict(codes) + self.histories = {key: [0] for key in codes} + + async def request(self, method, params): + self.calls.append((method, params)) + assert params[0] == capture_module.b64(package.context.lookup_anchor) + sid = params[1] + if method == 'serviceData': + return capture_module.b64(self.accounts[sid]) + code_hash = base64.b64decode(params[2], validate=True) + if method == 'servicePreimage': + code = self.codes[(sid, code_hash)] + return capture_module.b64(code) if code is not None else None + assert method == 'serviceRequest' + assert params[3] == len(codes[(sid, code_hash)]) + return self.histories[(sid, code_hash)] + + return SimpleNamespace( + spec=spec, genesis=genesis, services=services, package=package, + rpc=Rpc(), accounts=accounts, codes=codes, + ) + + +def verify(module, case): + return asyncio.run(module.verify_genesis_inputs( + case.rpc, case.genesis, case.services, case.package, + )) + + +def test_decode_rejects_trailing_bytes(capture_module): + header = Header.default() + encoded = header.to_jam_bytes().to_bytes() + assert capture_module.decode(Header, encoded).to_jam_bytes().to_bytes() == encoded + + with pytest.raises(ValueError, match='Noncanonical Header from PolkaJam'): + capture_module.decode(Header, encoded + b'\x00') + + +def test_reference_genesis_preserves_encoded_header_and_state(capture_module, historical_case): + spec = historical_case.spec + original = deepcopy(spec) + genesis, services = capture_module.reference_genesis(spec) + keyvals = [(bytes.fromhex(key), bytes.fromhex(value)) + for key, value in spec['genesis_state'].items()] + + assert genesis.header.to_jam_bytes().to_bytes() == bytes.fromhex(spec['genesis_header']) + assert genesis.state.keyvals == keyvals + assert genesis.state.state_root == PatriciaMerkleTrie(keyvals).root() + assert genesis.state.state_root != genesis.header.parent_state_root + assert dict(services.state_storage.as_list()) == dict(keyvals) + assert services.pending_changes.service_accounts == {} + assert spec == original + + +def test_verify_genesis_inputs_checks_both_codes_at_exact_anchor(capture_module, historical_case): + case = historical_case + checks = verify(capture_module, case) + + assert checks == [ + { + 'service_id': sid, 'code_hash': code_hash.hex(), 'code_length': len(code), + 'availability_history': [0], + 'account_sha256': hashlib.sha256(case.accounts[sid]).hexdigest(), + } + for (sid, code_hash), code in case.codes.items() + ] + assert [method for method, _ in case.rpc.calls] == [ + 'serviceData', 'servicePreimage', 'serviceRequest', + 'serviceData', 'servicePreimage', 'serviceRequest', + ] + + +@pytest.mark.parametrize('service_id', [0, 7]) +@pytest.mark.parametrize('changed', ['account', 'code', 'history', 'missing_code']) +def test_verify_genesis_inputs_rejects_changed_rpc_inputs( + capture_module, historical_case, service_id, changed): + case = historical_case + code_hash = next(code_hash for sid, code_hash in case.codes if sid == service_id) + if changed == 'account': + case.rpc.accounts[service_id] += b'changed' + message = f'Service {service_id} differs from genesis at the lookup anchor' + elif changed == 'history': + case.rpc.histories[(service_id, code_hash)] = [1] + message = f'Service {service_id} preimage history differs from genesis' + else: + case.rpc.codes[(service_id, code_hash)] = b'changed' if changed == 'code' else None + message = f'Service {service_id} historical code differs from genesis' + + with pytest.raises(ValueError, match=message): + verify(capture_module, case) + + +@pytest.mark.parametrize('service_id', [0, 7]) +def test_verify_genesis_inputs_requires_code_available_at_lookup_slot( + capture_module, historical_case, service_id): + case = historical_case + code_hash = next(code_hash for sid, code_hash in case.codes if sid == service_id) + code = case.codes[(service_id, code_hash)] + # Bytes exist in genesis and the RPC, but they only become historically + # available after this package's lookup slot. Current presence is insufficient. + case.services.pending_changes.preimages_availability[(service_id, code_hash, len(code))] = [43] + + with pytest.raises(ValueError, match=f'Service {service_id} historical code differs from genesis'): + verify(capture_module, case) diff --git a/test/test_checkpoint_trace_replay.py b/test/test_checkpoint_trace_replay.py new file mode 100644 index 00000000..183e6940 --- /dev/null +++ b/test/test_checkpoint_trace_replay.py @@ -0,0 +1,136 @@ +import asyncio + +import pytest +from asyncclick.testing import CliRunner + +from pyjamaz import cli +from pyjamaz.app import AppConfig, PyjamazApp +from pyjamaz.graypaper_constants import COMMON_ERA +from pyjamaz.models.app import StateDump, Trace, TraceGenesis +from pyjamaz.models.block import Block, Extrinsic, Header +from pyjamaz.models.state import JamState +from pyjamaz.storage import InMemoryStorageEngine + + +@pytest.fixture +def replay_app(monkeypatch): + app = PyjamazApp(AppConfig( + ring_data=b'', storage_engine=InMemoryStorageEngine(), common_era=COMMON_ERA, + )) + app.working_state = JamState.create_genesis_state() + asyncio.run(app.store_jam_state()) + state = StateDump(app.state_storage.state_root(), app.state_db.as_list()) + imported = [] + + async def initialize_app(**kwargs): + return app + + async def transition(block, produce=False): + imported.append((block.header.hash, app.app_context.skip_lookup_anchor_ancestry.get())) + + monkeypatch.setattr(cli, 'initialize_app', initialize_app) + monkeypatch.setattr(cli, 'setup_logging', lambda *args: None) + monkeypatch.setattr(cli.settings, 'SOLO_MODE', False) + monkeypatch.setattr(cli.settings, 'SKIP_TIMESLOT_WALL_CLOCK_CHECK', False) + monkeypatch.setattr(app, 'state_transition', transition) + return app, state, imported + + +def write_short_trace(folder, state, *, corrupt_checkpoint=False): + checkpoint = Header.default() + checkpoint.timeslot = 7 + checkpoint.parent = b'p' * 32 + checkpoint.parent_state_root = state.state_root + post_state = StateDump(b'!' * 32, state.keyvals) if corrupt_checkpoint else state + (folder / '00000001.bin').write_bytes(Trace( + state, Block(checkpoint, Extrinsic.default()), post_state, + ).to_jam_bytes().to_bytes()) + child = Header.default() + child.timeslot = 9 + child.parent = checkpoint.hash + child.parent_state_root = state.state_root + (folder / '00000002.bin').write_bytes(Trace( + state, Block(child, Extrinsic.default()), state, + ).to_jam_bytes().to_bytes()) + return checkpoint, child + + +def replay(folder, *options): + return asyncio.run(CliRunner().invoke(cli.main, ['traces', str(folder), *options])) + + +@pytest.mark.parametrize('strict', [False, True]) +def test_short_trace_uses_first_record_as_checkpoint(tmp_path, replay_app, strict): + app, state, imported = replay_app + checkpoint, child = write_short_trace(tmp_path, state) + options = ['--prompt', '--strict-ancestry'] if strict else ['--prompt'] + + result = replay(tmp_path, *options) + + assert result.exit_code == 0, result.output + assert imported == [(child.hash, not strict)] + assert app.retrieve_block_header(checkpoint.hash).to_jam_bytes().to_bytes() == checkpoint.to_jam_bytes().to_bytes() + assert not app.app_context.skip_lookup_anchor_ancestry.get() + + +def test_short_trace_rejects_corrupt_checkpoint_state(tmp_path, replay_app): + _, state, imported = replay_app + write_short_trace(tmp_path, state, corrupt_checkpoint=True) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert 'Checkpoint state root mismatch' in result.output + assert imported == [] + + +def test_checkpoint_alone_is_not_a_successful_replay(tmp_path, replay_app): + _, state, imported = replay_app + write_short_trace(tmp_path, state) + (tmp_path / '00000002.bin').unlink() + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert 'no subsequent block' in result.output + assert imported == [] + + +def test_checkpoint_policy_does_not_leak_to_genesis_corpus(tmp_path, replay_app): + app, state, imported = replay_app + shortened, complete = tmp_path / 'a-shortened', tmp_path / 'b-complete' + shortened.mkdir() + complete.mkdir() + _, short_child = write_short_trace(shortened, state) + genesis = Header.default() + (complete / 'genesis.bin').write_bytes(TraceGenesis(genesis, state).to_jam_bytes().to_bytes()) + child = Header.default() + child.timeslot = 1 + child.parent = genesis.hash + child.parent_state_root = state.state_root + (complete / '00000001.bin').write_bytes(Trace( + state, Block(child, Extrinsic.default()), state, + ).to_jam_bytes().to_bytes()) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert imported == [(short_child.hash, True), (child.hash, False)] + assert not app.app_context.skip_lookup_anchor_ancestry.get() + + +def test_checkpoint_policy_is_restored_after_unexpected_failure(tmp_path, replay_app, monkeypatch): + app, state, _ = replay_app + write_short_trace(tmp_path, state) + + async def fail(block, produce=False): + assert app.app_context.skip_lookup_anchor_ancestry.get() + raise RuntimeError('unexpected import failure') + + monkeypatch.setattr(app, 'state_transition', fail) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert isinstance(result.exception, RuntimeError) + assert not app.app_context.skip_lookup_anchor_ancestry.get() diff --git a/test/test_d3l.py b/test/test_d3l.py new file mode 100644 index 00000000..1f0a5bc4 --- /dev/null +++ b/test/test_d3l.py @@ -0,0 +1,116 @@ +import pytest + +from pyjamaz.availability import DataUnavailable, ImportedSegment +from pyjamaz.d3l import DataAvailabilityStore +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.app import D3LEntry +from pyjamaz.storage import FileStorageEngine, InMemoryStorageEngine + + +@pytest.fixture +def imports(): + exports = [bytes([index + 1]) * EC_SEGMENT_SIZE for index in range(3)] + tree = ConstantDepthMerkleTree(exports) + return exports, tree.root(), ImportedSegment(exports[1], tuple(tree.trace(1))) + + +def test_verified_import_is_idempotent_and_does_not_create_package_mapping(imports): + exports, root, imported = imports + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + store.store_segments(D3LEntry(root, exports)) + retained = engine.get(root) + store.store_import(root, 1, imported) + stored = engine.as_dict() + store.store_import(root, 1, imported) + assert store.retrieve_import(root, 1) == imported + assert engine.as_dict() == stored + assert engine.get(root) == retained + assert store.retrieve_segments(root).segments == exports + with pytest.raises(DataUnavailable, match='mapping'): + store.segment_root_for_package(b'p' * 32) + + +def test_import_survives_reopening_disk_store(tmp_path, imports): + _, root, imported = imports + store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + store.store_import(root, 1, imported) + reopened = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + assert reopened.retrieve_import(root, 1) == imported + + +@pytest.mark.parametrize('kind', ['import', 'segments', 'mapping']) +def test_missing_disk_data_is_retryable(tmp_path, kind): + store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + with pytest.raises(DataUnavailable): + if kind == 'import': + store.retrieve_import(b'r' * 32, 1) + elif kind == 'segments': + store.retrieve_segments(b'r' * 32) + else: + store.segment_root_for_package(b'p' * 32) + + +@pytest.mark.parametrize('fault', ['segment', 'proof', 'truncated', 'trailing', 'noncanonical']) +def test_corrupt_cache_record_is_rejected_on_read(imports, fault): + _, root, imported = imports + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + store.store_import(root, 1, imported) + key, data = engine.as_list()[0] + if fault == 'segment': + data = bytes([data[0] ^ 1]) + data[1:] + elif fault == 'proof': + data = data[:-1] + bytes([data[-1] ^ 1]) + elif fault == 'truncated': + data = data[:EC_SEGMENT_SIZE] + elif fault == 'trailing': + data += bytes(1) + else: + # Two hashes encoded with an overlong length prefix. + data = data[:EC_SEGMENT_SIZE] + b'\x80\x02' + data[EC_SEGMENT_SIZE + 1:] + engine.put(key, data) + with pytest.raises(DataUnavailable, match='invalid'): + store.retrieve_import(root, 1) + + +@pytest.mark.parametrize('fault', ['root', 'index', 'segment', 'proof']) +def test_invalid_import_is_not_stored(imports, fault): + _, root, imported = imports + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + index = 1 + if fault == 'root': + root = bytes(32) + elif fault == 'index': + index = True + elif fault == 'segment': + imported = ImportedSegment(imported.segment[:-1], imported.justification) + else: + imported = ImportedSegment(imported.segment, ()) + with pytest.raises(ProcessWorkpackageError): + store.store_import(root, index, imported) + assert engine.as_list() == [] + + +@pytest.mark.parametrize('fault', ['malformed', 'trailing', 'noncanonical', 'root']) +def test_corrupt_complete_export_record_is_retryable(imports, fault): + exports, root, _ = imports + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + data = D3LEntry(root, exports).to_jam_bytes().to_bytes() + if fault == 'malformed': + data = data[:33] + elif fault == 'trailing': + data += bytes(1) + elif fault == 'noncanonical': + data = data[:32] + b'\x80\x03' + data[33:] + else: + data = bytes(32) + data[32:] + engine.put(root, data) + with pytest.raises(DataUnavailable, match='invalid'): + store.retrieve_segments(root) + store.store_segments(D3LEntry(root, exports)) + assert store.retrieve_segments(root).segments == exports diff --git a/test/test_d3l_availability.py b/test/test_d3l_availability.py new file mode 100644 index 00000000..0951dd38 --- /dev/null +++ b/test/test_d3l_availability.py @@ -0,0 +1,497 @@ +from dataclasses import replace + +import pytest +from jamcodec.types import H256, Vec + +from pyjamaz.availability import ( + AvailabilityArtifacts, DataUnavailable, ImportedSegment, build_availability_artifacts, + verify_segment_shard, +) +from pyjamaz.d3l import AvailabilitySource, DataAvailabilityStore +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.graypaper_constants import EPOCH_TIMESLOTS +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.common import RefinementContext, ValidatorData, WorkReport +from pyjamaz.storage import FileStorageEngine, InMemoryStorageEngine + + +@pytest.fixture +def data(): + exports = [bytes([i + 1]) * 4104 for i in range(3)] + bundle = b'canonical bundle' + artifacts = build_availability_artifacts(b'p' * 32, bundle, exports, 6) + report = WorkReport(artifacts.spec, RefinementContext(*([bytes(32)] * 4), 0, []), + 1, bytes(32), 0, b'', {}, []) + validators = [ValidatorData(bytes(32), bytes([i]) * 32, bytes(144), bytes(128)) for i in range(6)] + source = AvailabilitySource(report, validators, validators[:2], b'b' * 32, 10) + return bundle, exports, artifacts, source + + +def retain(store, data, source=None): + bundle, exports, artifacts, original = data + store.store_work_report(original.report, bundle, exports, artifacts=artifacts) + store.register_source(original if source is None else source) + + +def test_artifacts_and_source_metadata_survive_restart(tmp_path, data): + store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + retain(store, data) + store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + bundle, exports, artifacts, source = data + assert store.sources() == [source] + assert store.source_for(package_hash=source.spec.hash) == source + assert store.source_for(exports_root=source.spec.exports_root) == source + assert store.source_for(erasure_root=source.spec.erasure_root) == source + assert store.specification(source.spec.erasure_root) == source.spec + assert store.segment_root_for_package(source.spec.hash) == source.spec.exports_root + assert store.retrieve_segments(source.spec.exports_root).segments == exports + assert store.storage_engine.get(b'bundle:' + source.spec.hash) == bundle + for shard in artifacts.shards: + assert store.retrieve_validator_shard(source.spec, shard.shard_index) == shard + chunk, proof = store.retrieve_segment_shard(source.spec, shard.shard_index, len(exports)) + verify_segment_shard(chunk, len(exports), shard.shard_index, proof, source.spec) + + +def test_local_reports_do_not_establish_chain_backed_metadata(data): + bundle, exports, artifacts, source = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.store_work_report(source.report, bundle, exports, artifacts=artifacts) + assert store.specification(source.spec.erasure_root) == source.spec + with pytest.raises(DataUnavailable, match='chain-backed'): + store.source_for(package_hash=source.spec.hash) + + +def test_source_lookup_selects_active_branch_and_preserves_historical_set(data): + _, _, _, original = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + later = replace(original, registered_block=b'c' * 32, registered_slot=20) + store.register_source(original) + store.register_source(later) + assert store.source_for(package_hash=original.spec.hash) == later + assert store.source_for(package_hash=original.spec.hash, + canonical=lambda block: block == original.registered_block) == original + assert store.source_for(exports_root=original.spec.exports_root).validators == original.validators + with pytest.raises(DataUnavailable, match='chain-backed'): + store.source_for(erasure_root=original.spec.erasure_root, canonical=lambda _: False) + + +@pytest.mark.parametrize('fault', ['count', 'duplicate', 'guarantor_duplicate', 'guarantor_encoding', 'assurance', 'slot']) +def test_invalid_source_context_is_not_published(data, fault): + _, _, _, source = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + if fault == 'count': + source = replace(source, validators=source.validators[:-1]) + elif fault == 'duplicate': + source = replace(source, validators=source.validators[:-1] + source.validators[:1]) + elif fault == 'guarantor_duplicate': + source = replace(source, guarantors=source.guarantors[:1] * 2) + elif fault == 'guarantor_encoding': + source = replace(source, guarantors=[replace(source.validators[0], metadata=b'x' * 127)]) + elif fault == 'assurance': + source = replace(source, assured_block=b'a' * 32) + else: + source = replace(source, registered_slot=True) + with pytest.raises(ProcessWorkpackageError): + store.register_source(source) + assert store.storage_engine.as_dict() == {} + + +def test_previous_rotation_guarantor_is_retained_independently_of_assurers(data): + _, _, _, source = data + historical = replace(source.guarantors[0], ed25519=b'h' * 32, metadata=b'm' * 128) + source = replace(source, guarantors=[historical]) + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.register_source(source) + retrieved = store.source_for(package_hash=source.spec.hash) + assert historical.ed25519 not in {validator.ed25519 for validator in retrieved.validators} + assert retrieved.guarantors == [historical] + + +@pytest.mark.parametrize('fault', ['truncated', 'trailing', 'identity', 'validators']) +def test_corrupt_source_metadata_is_retryable(data, fault): + _, _, _, source = data + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + store.register_source(source) + raw = source.to_jam_bytes().to_bytes() + if fault == 'truncated': + raw = raw[:20] + elif fault == 'trailing': + raw += bytes(1) + elif fault == 'identity': + raw = replace(source, registered_block=bytes(32)).to_jam_bytes().to_bytes() + else: + raw = replace(source, validators=source.validators[:-1]).to_jam_bytes().to_bytes() + engine.put(b'source-v1:' + source.identity, raw) + assert store.sources() == [] + with pytest.raises(DataUnavailable, match='chain-backed'): + store.source_for(package_hash=source.spec.hash) + + +@pytest.mark.parametrize('fault', ['missing', 'corrupt']) +def test_unavailable_source_does_not_hide_healthy_sources_or_remove_repair_indexes(data, fault): + _, _, _, source = data + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + healthy = replace(source, registered_block=b'c' * 32, registered_slot=20) + store.register_source(source) + store.register_source(healthy) + key = b'source-v1:' + source.identity + if fault == 'missing': + engine.delete(key) + else: + engine.put(key, b'corrupt record') + assert store.sources() == [healthy] + assert store.source_for(package_hash=source.spec.hash) == healthy + assert set(store._index(b'source-list-v1')) == {source.identity, healthy.identity} + assert set(store._index(b'source-index-v1:package' + source.spec.hash)) == {source.identity, healthy.identity} + store.register_source(source) + assert set(record.identity for record in store.sources()) == {source.identity, healthy.identity} + + +def test_corrupt_global_source_index_remains_unavailable(data): + _, _, _, source = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.register_source(source) + store.storage_engine.put(b'source-list-v1', b'corrupt index') + with pytest.raises(DataUnavailable, match='index'): + store.sources() + + +def test_historical_assurance_selects_registration_that_existed_at_its_slot(data): + _, _, _, original = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + later = replace(original, registered_block=b'l' * 32, registered_slot=100) + store.register_source(original) + store.register_source(later) + store.mark_assured(original.report, b'a' * 32, 20, lambda _: True) + assert store._source(original.identity).assured_slot == 20 + assert store._source(later.identity).assured_block is None + + +def test_assurance_matches_full_report_when_erasure_root_is_shared(data): + _, _, _, original = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + another_report = replace(original.report, core_index=original.report.core_index + 1) + other = replace(original, report=another_report, registered_block=b'o' * 32, registered_slot=11) + store.register_source(original) + store.register_source(other) + store.mark_assured(original.report, b'a' * 32, 20, lambda _: True) + assert store._source(original.identity).assured_slot == 20 + assert store._source(other.identity).assured_block is None + + +def test_older_assurance_replay_preserves_existing_canonical_reference(data): + _, _, _, original = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + existing = replace(original, assured_block=b'n' * 32, assured_slot=30) + store.register_source(existing) + store.mark_assured(original.report, b'a' * 32, 20, lambda _: True) + assert store._source(original.identity) == existing + + +def test_assurance_replay_replaces_orphan_reference_and_ignores_unavailable_source(data): + _, _, _, original = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + existing = replace(original, assured_block=b'o' * 32, assured_slot=30) + missing = replace(original, registered_block=b'm' * 32, registered_slot=11) + store.register_source(existing) + store.register_source(missing) + store.storage_engine.delete(b'source-v1:' + missing.identity) + canonical = lambda block: block in {original.registered_block, b'a' * 32} + store.mark_assured(original.report, b'a' * 32, 20, canonical) + repaired = store._source(original.identity) + assert repaired.assured_block == b'a' * 32 and repaired.assured_slot == 20 + + +def test_assurance_without_a_matching_eligible_registration_remains_unavailable(data): + _, _, _, original = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.register_source(original) + for report, slot, canonical in ((original.report, 5, lambda _: True), + (replace(original.report, core_index=0), 20, lambda _: True), + (original.report, 20, lambda _: False)): + with pytest.raises(DataUnavailable, match='matching source'): + store.mark_assured(report, b'a' * 32, slot, canonical) + + +def test_local_report_lookup_establishes_only_local_source_provenance(data): + bundle, exports, artifacts, source = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.store_work_report(source.report, bundle, exports, artifacts=artifacts) + assert store.local_report_for_exports(source.spec.exports_root) == source.report + with pytest.raises(DataUnavailable, match='chain-backed'): + store.source_for(exports_root=source.spec.exports_root) + + +def test_missing_local_report_does_not_hide_another_report_for_same_exports(data): + bundle, exports, artifacts, source = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.store_work_report(source.report, bundle, exports, artifacts=artifacts) + other_artifacts = build_availability_artifacts(b'q' * 32, b'other bundle', exports, 6) + other_report = replace(source.report, package_spec=other_artifacts.spec) + store.store_work_report(other_report, b'other bundle', exports, artifacts=other_artifacts) + store.storage_engine.delete(b'local-report-v1:' + source.spec.erasure_root) + assert store.local_report_for_exports(source.spec.exports_root) == other_report + + +def test_local_report_lookup_checks_index_root_and_report_dimensions(data): + bundle, exports, artifacts, source = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.store_work_report(source.report, bundle, exports, artifacts=artifacts) + wrong_root = b'w' * 32 + store.storage_engine.put(b'local-exports-v1:' + wrong_root, + Vec(H256).encode([source.spec.erasure_root]).to_bytes()) + with pytest.raises(DataUnavailable, match='index'): + store.local_report_for_exports(wrong_root) + bad = replace(source.report, package_spec=replace(source.spec, erasure_shards=0)) + store.storage_engine.put(b'local-report-v1:' + source.spec.erasure_root, bad.to_jam_bytes().to_bytes()) + with pytest.raises(DataUnavailable): + store.local_report_for_exports(source.spec.exports_root) + + +@pytest.mark.parametrize('fault', ['truncated', 'trailing', 'noncanonical', 'duplicates', 'mismatch']) +def test_corrupt_source_indexes_are_retryable(data, fault): + _, _, _, source = data + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + store.register_source(source) + lookup = source.spec.hash + raw = Vec(H256).encode([source.identity]).to_bytes() + if fault == 'truncated': + raw = raw[:-1] + elif fault == 'trailing': + raw += bytes(1) + elif fault == 'noncanonical': + raw = b'\x80\x01' + raw[1:] + elif fault == 'duplicates': + raw = Vec(H256).encode([source.identity, source.identity]).to_bytes() + else: + lookup = b'q' * 32 + engine.put(b'source-index-v1:package' + lookup, raw) + with pytest.raises(DataUnavailable, match='index'): + store.source_for(package_hash=lookup) + + +@pytest.mark.parametrize('kind', ['source', 'row', 'audit']) +def test_missing_retained_records_are_retryable(tmp_path, data, kind): + store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + retain(store, data) + _, _, artifacts, source = data + if kind == 'source': + store.storage_engine.delete(b'source-v1:' + source.identity) + read = lambda: store.source_for(package_hash=source.spec.hash) + else: + prefix = b'row-v1:' if kind == 'row' else b'audit-v1:' + store.storage_engine.delete(store._shard_key(prefix, source.spec, 0)) + read = lambda: store.retrieve_validator_shard(artifacts.spec, 0) + with pytest.raises(DataUnavailable): + read() + + +@pytest.mark.parametrize('kind', ['local-report', 'row', 'audit']) +def test_corrupt_artifact_records_are_retryable(data, kind): + store = DataAvailabilityStore(InMemoryStorageEngine()) + retain(store, data) + _, _, artifacts, source = data + if kind == 'local-report': + key = b'local-report-v1:' + source.spec.erasure_root + store.storage_engine.put(key, store.storage_engine.get(key) + bytes(1)) + read = lambda: store.specification(source.spec.erasure_root, canonical=lambda _: False) + else: + prefix = b'row-v1:' if kind == 'row' else b'audit-v1:' + key = store._shard_key(prefix, source.spec, 0) + store.storage_engine.put(key, store.storage_engine.get(key)[:-1]) + read = lambda: store.retrieve_validator_shard(artifacts.spec, 0) + with pytest.raises(DataUnavailable, match='invalid'): + read() + + +def test_artifact_records_are_verified_before_metadata_is_published(data): + bundle, exports, artifacts, source = data + engine = InMemoryStorageEngine() + store = DataAvailabilityStore(engine) + bad = AvailabilityArtifacts(artifacts.spec, artifacts.shards[:-1]) + with pytest.raises(ProcessWorkpackageError): + store.store_work_report(source.report, bundle, exports, artifacts=bad) + bad = replace(artifacts, shards=artifacts.shards[:-1] + (replace(artifacts.shards[-1], bundle_shard=b''),)) + with pytest.raises(ProcessWorkpackageError): + store.store_work_report(source.report, bundle, exports, artifacts=bad) + assert engine.as_dict() == {} + + +def test_failed_payload_write_does_not_publish_report_metadata(data): + class FailingStorage(InMemoryStorageEngine): + def put(self, key, value): + if key.startswith(b'row-v1:'): + raise OSError('disk full') + super().put(key, value) + + bundle, exports, artifacts, source = data + store = DataAvailabilityStore(FailingStorage()) + with pytest.raises(OSError, match='disk full'): + store.store_work_report(source.report, bundle, exports, artifacts=artifacts) + assert not any(key.startswith((b'local-report-v1:', b'package-root:', b'row-index-v1:')) + for key in store.storage_engine.as_dict()) + + +def test_finality_prunes_audit_payload_but_keeps_proven_segment_rows(data): + store = DataAvailabilityStore(InMemoryStorageEngine()) + retain(store, data) + _, _, artifacts, source = data + store.mark_assured(source.report, b'a' * 32, 12, canonical=lambda _: True) + assert store.source_for(package_hash=source.spec.hash).assured_slot == 12 + store.prune(20, lambda _: True, lambda _: False) + assert store.retrieve_validator_shard(source.spec, 0) == artifacts.shards[0] + store.prune(20, lambda _: True, lambda block: block == b'a' * 32) + with pytest.raises(DataUnavailable, match='audit'): + store.retrieve_validator_shard(source.spec, 0) + assert store.storage_engine.get(b'bundle:' + source.spec.hash) is None + for shard in artifacts.shards: + chunk, proof = store.retrieve_segment_shard(source.spec, shard.shard_index, 0) + verify_segment_shard(chunk, 0, shard.shard_index, proof, source.spec) + + +def test_retention_boundary_and_active_holds_protect_shared_roots(data): + store = DataAvailabilityStore(InMemoryStorageEngine()) + retain(store, data) + _, exports, _, source = data + tree = ConstantDepthMerkleTree(exports) + store.store_import(tree.root(), 0, ImportedSegment(exports[0], tuple(tree.trace(0)))) + store.mark_assured(source.report, b'a' * 32, 12, canonical=lambda _: True) + later = replace(source, registered_block=b'c' * 32, registered_slot=30, + assured_block=b'd' * 32, assured_slot=31) + store.register_source(later) + expiry = 30 + 672 * EPOCH_TIMESLOTS + store.prune(expiry - 1, lambda _: True, lambda _: True) + assert store.retrieve_segment_shard(source.spec, 0, 0)[0] + assert store.retrieve_import(tree.root(), 0).segment == exports[0] + with store.hold(source.spec.erasure_root): + with store.hold(source.spec.erasure_root): + store.prune(expiry, lambda _: True, lambda _: True) + assert store.retrieve_segment_shard(source.spec, 0, 0)[0] + store.prune(expiry, lambda _: True, lambda _: True) + assert store.retrieve_segments(tree.root()).segments == exports + store.prune(expiry, lambda _: True, lambda _: True) + with pytest.raises(DataUnavailable): + store.retrieve_segment_shard(source.spec, 0, 0) + with pytest.raises(DataUnavailable): + store.retrieve_segments(tree.root()) + with pytest.raises(DataUnavailable): + store.retrieve_import(tree.root(), 0) + + +def test_unassured_fork_does_not_prevent_canonical_audit_pruning(data): + store = DataAvailabilityStore(InMemoryStorageEngine()) + _, _, _, source = data + canonical = replace(source, assured_block=b'a' * 32, assured_slot=12) + retain(store, data, canonical) + store.register_source(replace(source, registered_block=b'c' * 32, registered_slot=20)) + store.prune(30, lambda block: block == source.registered_block, lambda _: True) + with pytest.raises(DataUnavailable, match='audit'): + store.retrieve_validator_shard(source.spec, 0) + assert store.retrieve_segment_shard(source.spec, 0, 0)[0] + + +def test_shared_exports_wait_for_every_retained_source_and_active_request(data): + store = DataAvailabilityStore(InMemoryStorageEngine()) + retain(store, data) + _, exports, _, source = data + store.mark_assured(source.report, b'a' * 32, 12, canonical=lambda _: True) + artifacts = build_availability_artifacts(b'q' * 32, b'another bundle', exports, 6) + later = replace(source, report=replace(source.report, package_spec=artifacts.spec), + registered_block=b'c' * 32, registered_slot=30, + assured_block=b'd' * 32, assured_slot=31) + store.store_work_report(later.report, b'another bundle', exports, artifacts=artifacts) + store.register_source(later) + expiry = 30 + 672 * EPOCH_TIMESLOTS + store.prune(expiry - 1, lambda _: True, lambda _: True) + assert store.retrieve_segments(source.spec.exports_root).segments == exports + with pytest.raises(DataUnavailable): + store.retrieve_segment_shard(source.spec, 0, 0) + with store.hold(later.spec.erasure_root): + store.prune(expiry, lambda _: True, lambda _: True) + assert store.retrieve_segments(source.spec.exports_root).segments == exports + store.prune(expiry, lambda _: True, lambda _: True) + with pytest.raises(DataUnavailable): + store.retrieve_segments(source.spec.exports_root) + + +@pytest.mark.parametrize('sharing', ['unrelated', 'erasure', 'exports', 'package']) +def test_missing_metadata_protects_shared_payloads_without_blocking_unrelated_pruning(data, sharing): + bundle, exports, artifacts, source = data + store = DataAvailabilityStore(InMemoryStorageEngine()) + source = replace(source, assured_block=b'a' * 32, assured_slot=12) + retain(store, data, source) + if sharing == 'erasure': + missing = replace(source, registered_block=b'c' * 32, registered_slot=20, + assured_block=None, assured_slot=None) + store.register_source(missing) + else: + other_exports = exports if sharing == 'exports' else [b'z' * 4104] + other_hash = source.spec.hash if sharing == 'package' else b'q' * 32 + other_artifacts = build_availability_artifacts(other_hash, b'other bundle', other_exports, 6) + missing = replace(source, report=replace(source.report, package_spec=other_artifacts.spec), + registered_block=b'c' * 32, registered_slot=20, + assured_block=None, assured_slot=None) + store.store_work_report(missing.report, b'other bundle', other_exports, artifacts=other_artifacts) + store.register_source(missing) + store.storage_engine.delete(b'source-v1:' + missing.identity) + expiry = 20 + 672 * EPOCH_TIMESLOTS + store.prune(expiry, lambda _: True, lambda _: True) + if sharing == 'erasure': + assert store.retrieve_validator_shard(source.spec, 0) == artifacts.shards[0] + else: + with pytest.raises(DataUnavailable): + store.retrieve_segment_shard(source.spec, 0, 0) + if sharing in ('erasure', 'exports'): + assert store.retrieve_segments(source.spec.exports_root).segments == exports + else: + with pytest.raises(DataUnavailable): + store.retrieve_segments(source.spec.exports_root) + if sharing in ('erasure', 'package'): + assert store.storage_engine.get(b'bundle:' + source.spec.hash) is not None + else: + assert store.storage_engine.get(b'bundle:' + source.spec.hash) is None + assert missing.identity in store._index(b'source-list-v1') + + +@pytest.mark.parametrize('assured', [False, True]) +def test_audit_serving_survives_export_expiry_until_assurance_finality(data, assured): + store = DataAvailabilityStore(InMemoryStorageEngine()) + retain(store, data) + _, _, artifacts, source = data + if assured: + store.mark_assured(source.report, b'a' * 32, 12, canonical=lambda _: True) + expiry = source.registered_slot + 672 * EPOCH_TIMESLOTS + store.prune(expiry, lambda _: True, lambda _: False) + for shard in artifacts.shards: + assert store.retrieve_validator_shard(source.spec, shard.shard_index) == shard + if assured: + store.prune(expiry, lambda _: True, lambda _: True) + with pytest.raises(DataUnavailable): + store.retrieve_validator_shard(source.spec, 0) + + +def test_atomic_file_replacement_preserves_previous_record_on_failure(tmp_path, monkeypatch): + import pyjamaz.storage as storage_module + + engine = FileStorageEngine(str(tmp_path)) + engine.put(b'key', b'previous') + original = storage_module.os.replace + observed = [] + + def replace_record(temporary, destination): + with open(temporary, 'rb') as stream: + observed.append((engine.get(b'key'), stream.read())) + raise OSError('replacement failed') + + monkeypatch.setattr(storage_module.os, 'replace', replace_record) + with pytest.raises(OSError, match='replacement failed'): + engine.put(b'key', b'complete new record') + assert observed == [(b'previous', b'complete new record')] + assert engine.get(b'key') == b'previous' + assert [path.name for path in tmp_path.iterdir()] == [b'key'.hex() + '.bin'] + monkeypatch.setattr(storage_module.os, 'replace', original) + engine.put(b'key', b'complete new record') + assert engine.get(b'key') == b'complete new record' diff --git a/test/test_disputes_offender_overlap.py b/test/test_disputes_offender_overlap.py new file mode 100644 index 00000000..3f2ddd10 --- /dev/null +++ b/test/test_disputes_offender_overlap.py @@ -0,0 +1,147 @@ +from copy import deepcopy + +import pytest + +from pyjamaz.exceptions import StateTransitionError +from pyjamaz.models.block import Culprit, ExtrinsicDisputes, Fault +from pyjamaz.models.context import AppContext, BlockContext +from pyjamaz.models.state import DisputesState +from pyjamaz.models.stf_output import DisputesErrorCode +from pyjamaz.signing import Ed25519Keypair +from pyjamaz.state.components import Disputes + + +BAD_REPORT = b'b' * 32 +GOOD_REPORT = b'g' * 32 + + +def prior_state(offenders=()): + return DisputesState( + good_set=[GOOD_REPORT], bad_set=[BAD_REPORT], wonky_set=[], offenders=list(offenders), + ) + + +def culprit(key): + return Culprit( + target=BAD_REPORT, key=key.public_key, + signature=key.sign(b'jam_guarantee' + BAD_REPORT), + ) + + +def fault(key, *, target=BAD_REPORT, vote=True): + return Fault( + target=target, vote=vote, key=key.public_key, + signature=key.sign((b'jam_valid' if vote else b'jam_invalid') + target), + ) + + +@pytest.fixture +def keys(): + return sorted( + [Ed25519Keypair.from_seed(bytes([seed]) * 32) for seed in range(1, 4)], + key=lambda key: key.public_key, + ) + + +@pytest.mark.parametrize('same_report', [False, True]) +def test_culprit_and_fault_share_key_without_duplicate_posterior_offender(keys, same_report): + key = keys[1] + prior = prior_state([keys[0].public_key]) + original = deepcopy(prior) + evidence = ExtrinsicDisputes( + verdicts=[], culprits=[culprit(key)], + faults=[fault(key) if same_report else fault(key, target=GOOD_REPORT, vote=False)], + ) + + output = Disputes(BlockContext(), AppContext()).state_transition(evidence, prior) + + assert output.offenders_mark == [key.public_key, key.public_key] + assert output.post_state.offenders == [keys[0].public_key, key.public_key] + assert output.post_state.bad_set == prior.bad_set + assert output.post_state.good_set == prior.good_set + assert prior == original + + +def test_offender_marker_concatenates_lists_while_posterior_unions_keys(keys): + first, second, third = keys + evidence = ExtrinsicDisputes( + verdicts=[], culprits=[culprit(first), culprit(third)], + faults=[fault(first), fault(second)], + ) + + output = Disputes(BlockContext(), AppContext()).state_transition(evidence, prior_state()) + + assert output.offenders_mark == [ + first.public_key, third.public_key, first.public_key, second.public_key, + ] + assert output.post_state.offenders == [key.public_key for key in keys] + + +@pytest.mark.parametrize('kind', ['culprit', 'fault', 'both']) +def test_previously_reported_offender_is_still_rejected(keys, kind): + key = keys[0] + prior = prior_state([key.public_key]) + original = deepcopy(prior) + evidence = ExtrinsicDisputes( + verdicts=[], culprits=[culprit(key)] if kind != 'fault' else [], + faults=[fault(key)] if kind != 'culprit' else [], + ) + + with pytest.raises(StateTransitionError) as error: + Disputes(BlockContext(), AppContext()).state_transition(evidence, prior) + + assert error.value.custom_error_code == DisputesErrorCode.offender_already_reported + assert prior == original + + +@pytest.mark.parametrize('kind,error_code', [ + ('culprit', DisputesErrorCode.culprits_not_sorted_unique), + ('fault', DisputesErrorCode.faults_not_sorted_unique), +]) +def test_duplicate_key_within_one_evidence_list_is_still_rejected(keys, kind, error_code): + key = keys[0] + evidence = ExtrinsicDisputes( + verdicts=[], culprits=[culprit(key)] * 2 if kind == 'culprit' else [], + faults=[fault(key)] * 2 if kind == 'fault' else [], + ) + + with pytest.raises(StateTransitionError) as error: + Disputes(BlockContext(), AppContext()).state_transition(evidence, prior_state()) + + assert error.value.custom_error_code == error_code + + +def test_shared_key_does_not_skip_fault_signature_validation(keys): + key = keys[0] + invalid_fault = fault(key) + invalid_fault.signature = bytes(64) + evidence = ExtrinsicDisputes(verdicts=[], culprits=[culprit(key)], faults=[invalid_fault]) + + with pytest.raises(StateTransitionError) as error: + Disputes(BlockContext(), AppContext()).state_transition(evidence, prior_state()) + + assert error.value.custom_error_code == DisputesErrorCode.bad_signature + + +def test_shared_key_does_not_skip_fault_verdict_validation(keys): + key = keys[0] + evidence = ExtrinsicDisputes(verdicts=[], culprits=[culprit(key)], faults=[fault(key, vote=False)]) + + with pytest.raises(StateTransitionError) as error: + Disputes(BlockContext(), AppContext()).state_transition(evidence, prior_state()) + + assert error.value.custom_error_code == DisputesErrorCode.fault_verdict_wrong + + +def test_reused_component_refreshes_prior_offender_snapshot(keys): + key = keys[0] + component = Disputes(BlockContext(), AppContext()) + evidence = ExtrinsicDisputes(verdicts=[], culprits=[culprit(key)], faults=[fault(key)]) + first = component.state_transition(evidence, prior_state()) + + with pytest.raises(StateTransitionError) as error: + component.state_transition(evidence, first.post_state) + + assert error.value.custom_error_code == DisputesErrorCode.offender_already_reported + assert first.offenders_mark == [key.public_key, key.public_key] + assert first.post_state.offenders == [key.public_key] diff --git a/test/test_epoch_marker_codec.py b/test/test_epoch_marker_codec.py new file mode 100644 index 00000000..5ba0cf23 --- /dev/null +++ b/test/test_epoch_marker_codec.py @@ -0,0 +1,40 @@ +"""Epoch-marker cardinality is a block-validity check, within a bounded codec.""" + +import pytest + +from jamcodec.base import JamBytes +from jamcodec.types import VarInt64 +from pyjamaz.fuzzer.v1.types import FuzzerMessage +from pyjamaz.graypaper_constants import CORE_COUNT +from pyjamaz.models.block import Block, EpochMark, Extrinsic, Header +from pyjamaz.models.state import ValidatorPoolState + + +MAX_VALIDATORS = 3 * CORE_COUNT +COUNTS = sorted({0, 3, 5, 6, MAX_VALIDATORS} | ({7} if MAX_VALIDATORS >= 7 else set())) + + +@pytest.mark.parametrize('count', COUNTS) +def test_marker_count_can_reach_block_validation(count): + encoded = bytes(64) + VarInt64.encode(count).to_bytes() + bytes(64 * count) + marker = EpochMark.from_jam_bytes(JamBytes(encoded)) + assert len(marker.validators) == count + assert marker.to_jam_bytes().to_bytes() == encoded + + header = Header.default() + header.epoch_marker = marker + request = FuzzerMessage(import_block=Block(header, Extrinsic.default())) + decoded = FuzzerMessage.from_jam_bytes(request.to_jam_bytes()) + assert decoded.import_block.header.epoch_marker == marker + assert decoded.import_block.header.hash == header.hash + + +def test_marker_decoder_keeps_the_maximum_size_bound(): + encoded = bytes(64) + VarInt64.encode(MAX_VALIDATORS + 1).to_bytes() + with pytest.raises(ValueError, match='invalid sequence length'): + EpochMark.from_jam_bytes(JamBytes(encoded)) + + +def test_validator_state_decoder_remains_strict(): + with pytest.raises(ValueError, match='invalid sequence length'): + ValidatorPoolState.from_jam_bytes(JamBytes(VarInt64.encode(5).to_bytes())) diff --git a/test/test_erasure.py b/test/test_erasure.py new file mode 100644 index 00000000..98067938 --- /dev/null +++ b/test/test_erasure.py @@ -0,0 +1,179 @@ +"""GP 0.8.0 Appendix H, including the pinned upstream byte-level oracles.""" + +import json +from pathlib import Path + +import pytest + +from pyjamaz import erasure +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, valid_validator_count + + +FIXTURES = Path(__file__).parent / 'fixtures' / 'erasure' +VECTORS = [(count, path) for profile, count in [('tiny', 6), ('full', 1023)] + for path in sorted((FIXTURES / profile).glob('*.json'))] + + +@pytest.fixture(autouse=True) +def full_validator_domain(monkeypatch): + # Test Full and Tiny in one process without changing the configured profile. + monkeypatch.setattr(erasure, 'valid_validator_count', + lambda count: valid_validator_count(count, core_count=341)) + + +@pytest.mark.parametrize(('validator_count', 'path'), VECTORS, + ids=[f'{path.parent.name}-{path.stem}' for _, path in VECTORS]) +@pytest.mark.parametrize('selection', ['systematic', 'parity', 'mixed']) +def test_upstream_erasure_vectors(validator_count, path, selection): + vector = json.loads(path.read_text()) + data = bytes.fromhex(vector['data'][2:]) + expected = [bytes.fromhex(value[2:]) for value in vector['shards']] + originals = erasure.erasure_data_shards(validator_count) + assert erasure.encode_blob(validator_count, data) == expected + if selection == 'systematic': + indexes = range(originals) + elif selection == 'parity': + indexes = range(validator_count - originals, validator_count) + else: + indexes = list(range(0, originals, 2)) + indexes += list(range(originals, originals + originals - len(indexes))) + # Shuffled input must retain global indexes and recover the original ordering. + shards = {index: expected[index] for index in reversed(list(indexes))} + padded = data + bytes(-len(data) % (2 * originals)) + pieces = len(padded) // (2 * originals) + assert erasure.recover_chunks(validator_count, pieces, shards) == padded + assert erasure.recover_blob(validator_count, len(data), shards) == data + + +def test_fixture_inventory(): + assert len(VECTORS) == 12 + + +def test_every_supported_validator_count_recovers_parity(): + for validators in range(6, 1024, 3): + originals = erasure.erasure_data_shards(validators) + data = bytes((index * 29 + 7) % 256 for index in range(2 * originals)) + shards = erasure.encode_chunks(validators, 1, data) + parity = {index: shards[index] for index in range(validators - originals, validators)} + assert erasure.recover_chunks(validators, 1, parity) == data + + +@pytest.mark.parametrize('length', [0, 1, 5, 6, 7, 4104, 4105]) +def test_blob_boundaries_and_surplus_shards(length): + data = bytes(index % 251 for index in range(length)) + shards = erasure.encode_blob(6, data) + assert erasure.recover_blob(6, length, dict(enumerate(shards))) == data + assert erasure.recover_blob(6, length, {index: shards[index] for index in [5, 3, 4]}) == data + + +def test_complete_systematic_set_bypasses_native_recovery(monkeypatch): + def unexpected(*_): + pytest.fail('systematic reconstruction must not invoke the native decoder') + + monkeypatch.setattr(erasure, 'recover_shards', unexpected) + assert erasure.recover_chunks(6, 1, {2: b'ef', 0: b'ab', 1: b'cd'}) == b'abcdef' + # Even with surplus shards, the convenience function prefers the systematic set. + assert erasure.recover_blob(6, 6, {5: b'zz', 2: b'ef', 1: b'cd', 0: b'ab'}) == b'abcdef' + + +def test_surplus_selection_is_deterministic(monkeypatch): + selected = [] + + def recover(originals, parity, chunks): + selected.append(chunks) + return b'abcdef' + + monkeypatch.setattr(erasure, 'recover_shards', recover) + shards = {5: b'zz', 4: b'yy', 3: b'xx', 1: b'cd'} + assert erasure.recover_blob(6, 6, shards) == b'abcdef' + assert selected == [[(1, b'cd'), (3, b'xx'), (4, b'yy')]] + + +def test_segment_recovery(): + segment = bytes(index % 251 for index in range(EC_SEGMENT_SIZE)) + shards = erasure.encode_blob(6, segment) + assert erasure.recover_segment(6, {index: shards[index] for index in [3, 4, 5]}) == segment + + +@pytest.mark.parametrize('piece_count', [-1, True, 1.5]) +def test_invalid_piece_count(piece_count): + with pytest.raises(ValueError, match='piece count'): + erasure.recover_chunks(6, piece_count, {}) + + +@pytest.mark.parametrize('validator_count', [-1, 0, 3, 7, True, 6.0, 1026]) +def test_invalid_validator_count(validator_count): + with pytest.raises(ValueError, match='assurer count'): + erasure.recover_chunks(validator_count, 1, {}) + + +@pytest.mark.parametrize('chunks', [ + {}, {0: b'ab', 1: b'cd'}, + {0: b'ab', 1: b'cd', 2: b'ef', 3: b'gh'}, +]) +def test_gp_recovery_requires_exact_threshold(chunks): + with pytest.raises(ValueError, match='exactly D'): + erasure.recover_chunks(6, 1, chunks) + + +@pytest.mark.parametrize('index', [-1, 6, True, 1.5, '0']) +def test_invalid_chunk_index(index): + with pytest.raises(ValueError, match='index'): + erasure.recover_chunks(6, 1, {index: b'ab', 2: b'cd', 3: b'ef'}) + + +@pytest.mark.parametrize('chunk', [b'', b'a', b'abc', 'ab', bytearray(b'ab')]) +def test_invalid_chunk_dimensions(chunk): + with pytest.raises(ValueError, match='dimensions'): + erasure.recover_chunks(6, 1, {0: chunk, 1: b'cd', 2: b'ef'}) + + +def test_invalid_surplus_shards_are_checked(): + with pytest.raises(ValueError, match='dimensions'): + erasure.recover_blob(6, 6, {0: b'ab', 1: b'cd', 2: b'ef', 5: b'odd'}) + with pytest.raises(ValueError, match='index'): + erasure.recover_blob(6, 6, {0: b'ab', 1: b'cd', 2: b'ef', 6: b'gh'}) + + +@pytest.mark.parametrize('length', [-1, True, 1.5]) +def test_invalid_original_length(length): + with pytest.raises(ValueError, match='blob length'): + erasure.recover_blob(6, length, {}) + + +def test_insufficient_shards(): + with pytest.raises(ValueError, match='insufficient'): + erasure.recover_blob(6, 6, {3: b'ab', 4: b'cd'}) + + +def test_nonzero_recovered_padding_is_rejected(): + shards = erasure.encode_blob(6, b'abcdef') + with pytest.raises(ValueError, match='nonzero padding'): + erasure.recover_blob(6, 5, {index: shards[index] for index in [3, 4, 5]}) + + +def test_empty_data_needs_no_native_calls(monkeypatch): + def unexpected(*_): + pytest.fail('empty data must not invoke the native backend') + + monkeypatch.setattr(erasure, 'encode_shards', unexpected) + monkeypatch.setattr(erasure, 'recover_shards', unexpected) + assert erasure.encode_blob(6, b'') == [b''] * 6 + assert erasure.recover_blob(6, 0, {}) == b'' + assert erasure.recover_chunks(6, 0, {3: b'', 4: b'', 5: b''}) == b'' + with pytest.raises(ValueError, match='dimensions'): + erasure.recover_blob(6, 0, {0: b'x'}) + + +@pytest.mark.parametrize('recovered', [b'', b'abcde', b'abcdefg', 'abcdef']) +def test_malformed_native_recovery_is_rejected(monkeypatch, recovered): + monkeypatch.setattr(erasure, 'recover_shards', lambda *_: recovered) + with pytest.raises(RuntimeError, match='recovered dimensions'): + erasure.recover_chunks(6, 1, {3: b'ab', 4: b'cd', 5: b'ef'}) + + +@pytest.mark.parametrize('encoded', [[], [b'ab'] * 5, [b'a'] * 6]) +def test_malformed_native_encoding_is_rejected(monkeypatch, encoded): + monkeypatch.setattr(erasure, 'encode_shards', lambda *_: encoded) + with pytest.raises(RuntimeError, match='shard dimensions'): + erasure.encode_blob(6, b'abcdef') diff --git a/test/test_fuzzer_ancestry.py b/test/test_fuzzer_ancestry.py new file mode 100644 index 00000000..274029d5 --- /dev/null +++ b/test/test_fuzzer_ancestry.py @@ -0,0 +1,201 @@ +import asyncio +from types import SimpleNamespace + +import pytest + +from pyjamaz.app import PyjamazApp +from pyjamaz.exceptions import StateTransitionError +from pyjamaz.fuzzer.v1.target import FuzzerTarget +from pyjamaz.fuzzer.v1.types import AncestryItem, FuzzerMessage, InitializeMessage +from pyjamaz.models.block import Block, Extrinsic, Header +from pyjamaz.models.context import AppContext +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + + +COUNTER = bytes([1]) * 31 +REMOVED = bytes([2]) * 31 +@pytest.fixture +def target(tmp_path): + # Exercise the real application import/rollback boundary with a small + # deterministic STF, without signatures, PVM execution, or a disk database. + engine = InMemoryStorageEngine() + app = PyjamazApp.__new__(PyjamazApp) + app.state_db = engine.namespace(b"state") + app.block_db = engine.namespace(b"block") + app.state_storage = StateStorage(app.state_db) + app.app_context = AppContext(state_storage=app.state_storage) + app.pubsub = None + app.working_state = None + app.retrieve_jam_state = lambda: SimpleNamespace(state_root=app.state_storage.state_root()) + app.import_block = app._import_block + + async def transition(block, produce=False): + await app.initialize(block.header) + value = int.from_bytes(app.state_storage.get(COUNTER), "little") + value += block.header.author_index + app.state_storage.put(COUNTER, value.to_bytes(4, "little")) + app.state_storage.commit() + app.working_state = app.retrieve_jam_state() + + app.state_transition = transition + return FuzzerTarget(str(tmp_path / "target.sock"), app) + + +async def initialize(target, *, header=None, ancestry=None): + header = header or Header.default() + response = await target.msg_initialize(FuzzerMessage(initialize=InitializeMessage( + header=header, + state=[(COUNTER, (10).to_bytes(4, "little")), (REMOVED, b"old")], + ancestry=ancestry or [], + ))) + assert response.error is None + assert response.state_root == target.app.state_storage.state_root() + return header + + +def child(parent, slot, increment=1): + header = Header.default() + header.parent = parent.hash + header.timeslot = slot + header.author_index = increment + return Block(header=header, extrinsic=Extrinsic.default()) + + +def test_initialize_preserves_real_header_when_ancestry_includes_it(target): + async def run(): + header = Header.default() + header.timeslot = 22 + header.parent = bytes([17]) * 32 + header.parent_state_root = bytes([31]) * 32 + await initialize(target, header=header, ancestry=[ + AncestryItem(slot=22, header_hash=header.hash), + AncestryItem(slot=17, header_hash=header.parent), + ]) + retained = target.app.state_storage.ancestors[header.hash] + assert retained is header + assert retained.parent_state_root == bytes([31]) * 32 + assert retained.parent == header.parent + + asyncio.run(run()) + + +def test_initialize_rejects_conflicting_slot_for_its_header(target): + async def run(): + header = Header.default() + with pytest.raises(ValueError, match="ancestry slot mismatch"): + await initialize(target, header=header, ancestry=[ + AncestryItem(slot=1, header_hash=header.hash), + ]) + + asyncio.run(run()) + + +@pytest.mark.parametrize("local_ancestry", [False, True]) +@pytest.mark.parametrize("peer_ancestry", [False, True]) +def test_import_uses_negotiated_session_ancestry(target, monkeypatch, local_ancestry, peer_ancestry): + async def run(): + genesis = Header.default() + block = child(genesis, 1) + ordinary_transition = target.app.state_transition + seen = [] + + async def transition(block, produce=False): + seen.append(target.app.app_context.skip_lookup_anchor_ancestry.get()) + await ordinary_transition(block, produce) + + target.app.state_transition = transition + ordinary_handshake = target.msg_handshake + + def handshake(): + message = ordinary_handshake() + message.peer_info.features.block_ancestry = local_ancestry + return message + + monkeypatch.setattr(target, 'msg_handshake', handshake) + peer = ordinary_handshake() + peer.peer_info.features.block_ancestry = peer_ancestry + reader = asyncio.StreamReader() + reader.feed_data(peer.fuzzer_encode()) + reader.feed_data(FuzzerMessage(initialize=InitializeMessage( + header=genesis, + state=[(COUNTER, (10).to_bytes(4, "little")), (REMOVED, b"old")], + ancestry=[], + )).fuzzer_encode()) + reader.feed_data(FuzzerMessage(import_block=block).fuzzer_encode()) + reader.feed_eof() + + class Writer: + closed = False + + def get_extra_info(self, name): + return 'test peer' + + def write(self, data): + pass + + async def drain(self): + pass + + def close(self): + self.closed = True + + async def wait_closed(self): + pass + + writer = Writer() + await target._handle_client(reader, writer) + assert seen == [not (local_ancestry and peer_ancestry)] + assert int.from_bytes(target.app.state_storage.get(COUNTER), "little") == 11 + assert not target.app.app_context.skip_lookup_anchor_ancestry.get() + assert writer.closed + + asyncio.run(run()) + + +@pytest.mark.parametrize("error_type", [StateTransitionError, RuntimeError, asyncio.CancelledError]) +def test_failed_import_restores_strict_ancestry_policy(target, error_type): + async def run(): + genesis = await initialize(target) + + async def reject(block): + assert target.app.app_context.skip_lookup_anchor_ancestry.get() + raise error_type('rejected candidate') + + target.app.import_block = reject + request = FuzzerMessage(import_block=child(genesis, 1)) + if error_type is StateTransitionError: + response = await target.msg_import_block(request, ancestry_enabled=False) + assert 'rejected candidate' in response.error + else: + with pytest.raises(error_type): + await target.msg_import_block(request, ancestry_enabled=False) + assert not target.app.app_context.skip_lookup_anchor_ancestry.get() + + asyncio.run(run()) + + +def test_fuzzer_ancestry_override_is_local_to_import_task(target): + async def run(): + genesis = await initialize(target) + entered, resume = asyncio.Event(), asyncio.Event() + + async def importing(block): + assert target.app.app_context.skip_lookup_anchor_ancestry.get() + entered.set() + await resume.wait() + assert target.app.app_context.skip_lookup_anchor_ancestry.get() + + target.app.import_block = importing + task = asyncio.create_task(target.msg_import_block( + FuzzerMessage(import_block=child(genesis, 1)), ancestry_enabled=False, + )) + await entered.wait() + assert not target.app.app_context.skip_lookup_anchor_ancestry.get() + assert not AppContext().skip_lookup_anchor_ancestry.get() + resume.set() + response = await task + assert response.error is None + + asyncio.run(run()) + diff --git a/test/test_fuzzer_checkpoint_replay.py b/test/test_fuzzer_checkpoint_replay.py new file mode 100644 index 00000000..614cb8c0 --- /dev/null +++ b/test/test_fuzzer_checkpoint_replay.py @@ -0,0 +1,212 @@ +import asyncio + +import pytest +from asyncclick.testing import CliRunner + +from pyjamaz import cli +from pyjamaz.fuzzer.v1.types import FuzzerMessage +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.models.app import StateDump, Trace, TraceGenesis +from pyjamaz.models.block import Block, Extrinsic, Header + + +def state_dump(value): + keyvals = [(b'\x01' * 31, value)] + return StateDump(PatriciaMerkleTrie(keyvals).root(), keyvals) + + +def write_chain(folder, *, genesis=False, corrupt_checkpoint=False): + folder.mkdir(exist_ok=True) + prior, state = state_dump(b'before checkpoint'), state_dump(b'checkpoint') + header = Header.default() + header.timeslot = 7 + header.parent = b'p' * 32 + header.parent_state_root = prior.state_root + checkpoint_state = StateDump(b'!' * 32, state.keyvals) if corrupt_checkpoint else state + if genesis: + (folder / 'genesis.bin').write_bytes(TraceGenesis(header, state).to_jam_bytes().to_bytes()) + else: + (folder / '00000001.bin').write_bytes(Trace( + prior, Block(header, Extrinsic.default()), checkpoint_state, + ).to_jam_bytes().to_bytes()) + + def candidate(number=2, post_state=None): + child = Header.default() + child.parent = header.hash + child.parent_state_root = state.state_root + child.timeslot = header.timeslot + 1 + child.author_index = number + trace = Trace(state, Block(child, Extrinsic.default()), post_state or state) + (folder / f'{number:08}.bin').write_bytes(trace.to_jam_bytes().to_bytes()) + return trace + + return header, state, candidate + + +@pytest.fixture +def fake_session(monkeypatch): + monkeypatch.setattr(cli, 'setup_logging', lambda *args: None) + + def install(responses, fail_connect=None): + class Session: + def __init__(self): + self.responses = iter(responses) + self.requests = [] + self.connections = [] + self.connect_count = 0 + self.close_count = 0 + + async def connect(self): + self.connect_count += 1 + self.writer = object() + if self.connect_count == fail_connect: + raise RuntimeError('handshake failed') + + async def send_request(self, request): + self.requests.append(request) + self.connections.append(self.connect_count) + return next(self.responses) + + async def close(self): + self.close_count += 1 + + session = Session() + monkeypatch.setattr(cli, 'FuzzerSession', lambda *args, **kwargs: session) + return session + + return install + + +def replay(folder): + return asyncio.run(CliRunner().invoke(cli.main, ['fuzzer', 'traces', str(folder)])) + + +def test_shortened_trace_initializes_real_checkpoint_without_importing_it(tmp_path, fake_session): + header, state, candidate = write_chain(tmp_path) + expected = state_dump(b'after candidate') + trace = candidate(post_state=expected) + session = fake_session([ + FuzzerMessage(state_root=state.state_root), + FuzzerMessage(state_root=expected.state_root), + ]) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert len(session.requests) == 2 + initialization = session.requests[0].initialize + assert initialization.header.to_jam_bytes().to_bytes() == header.to_jam_bytes().to_bytes() + assert initialization.state == state.keyvals + assert initialization.ancestry == [] + assert session.requests[1].import_block.header.hash == trace.block.header.hash + assert session.close_count == 1 + + +def test_rejected_candidate_queries_checkpoint_and_then_imports_sibling(tmp_path, fake_session): + header, state, candidate = write_chain(tmp_path) + rejected = candidate() + expected = state_dump(b'accepted sibling') + accepted = candidate(3, expected) + session = fake_session([ + FuzzerMessage(state_root=state.state_root), + FuzzerMessage(error='Invalid author key'), + FuzzerMessage(state=state.keyvals), + FuzzerMessage(state_root=expected.state_root), + ]) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert session.requests[0].initialize.header.hash == header.hash + assert session.requests[1].import_block.header.hash == rejected.block.header.hash + assert session.requests[2].get_state == header.hash + assert session.requests[3].import_block.header.hash == accepted.block.header.hash + assert session.connect_count == session.close_count == 1 + + +def test_changed_parent_state_after_rejection_fails(tmp_path, fake_session): + header, state, candidate = write_chain(tmp_path) + candidate() + session = fake_session([ + FuzzerMessage(state_root=state.state_root), + FuzzerMessage(error='Invalid seal key'), + FuzzerMessage(state=state_dump(b'corrupt parent').keyvals), + ]) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert '1 fuzzer trace state-root mismatch' in result.output + assert session.requests[-1].get_state == header.hash + assert session.close_count == 1 + + +def test_corrupt_checkpoint_is_rejected_before_initializing_target(tmp_path, fake_session): + _, _, candidate = write_chain(tmp_path, corrupt_checkpoint=True) + candidate() + session = fake_session([]) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert 'Checkpoint state root mismatch' in result.output + assert session.requests == [] + assert session.close_count == 1 + + +def test_checkpoint_without_candidates_does_not_pass(tmp_path, fake_session): + write_chain(tmp_path) + session = fake_session([]) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert 'no subsequent block' in result.output + assert session.requests == [] + assert session.close_count == 1 + + +def test_checkpoint_target_root_mismatch_closes_session(tmp_path, fake_session): + _, _, candidate = write_chain(tmp_path) + candidate() + session = fake_session([FuzzerMessage(state_root=b'!' * 32)]) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert 'initial state root mismatch' in result.output + assert len(session.requests) == 1 + assert session.close_count == 1 + + +@pytest.mark.parametrize('second_has_genesis', [False, True]) +def test_independent_directories_get_fresh_sessions(tmp_path, fake_session, second_has_genesis): + first_header, state, first_candidate = write_chain(tmp_path / 'a-first') + first_candidate() + second_header, _, second_candidate = write_chain(tmp_path / 'b-second', genesis=second_has_genesis) + second_candidate() + session = fake_session([FuzzerMessage(state_root=state.state_root)] * 4) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert session.connect_count == session.close_count == 2 + assert session.connections == [1, 1, 2, 2] + assert session.requests[0].initialize.header.hash == first_header.hash + assert session.requests[2].initialize.header.hash == second_header.hash + assert all(request.import_block is not None for request in session.requests[1::2]) + + +def test_partial_reconnect_failure_closes_new_session(tmp_path, fake_session): + _, state, candidate = write_chain(tmp_path / 'a-first') + candidate() + _, _, candidate = write_chain(tmp_path / 'b-second') + candidate() + session = fake_session([FuzzerMessage(state_root=state.state_root)] * 2, fail_connect=2) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert str(result.exception) == 'handshake failed' + assert session.connect_count == session.close_count == 2 + assert session.connections == [1, 1] diff --git a/test/test_fuzzer_refinement.py b/test/test_fuzzer_refinement.py index c387a73e..d2ea5321 100644 --- a/test/test_fuzzer_refinement.py +++ b/test/test_fuzzer_refinement.py @@ -235,6 +235,36 @@ async def run(): asyncio.run(run()) +def test_bundle_validation_follows_successful_authorization(target, refine_request, vm, monkeypatch): + calls = [] + from_parts = BundleData.from_parts + + def authorize(*_): + calls.append('authorize') + return vm.auth + + def validate(*args): + calls.append('bundle') + return from_parts(*args) + + monkeypatch.setattr(refinement_module, 'pvm_invoke_is_authorized', authorize) + monkeypatch.setattr(BundleData, 'from_parts', validate) + + async def run(): + await initialize(target) + vm.auth.work_exec_result = WorkExecResult(panic=True) + response = await target.msg_refine_bundle(FuzzerMessage(refine_bundle=refine_request)) + assert response.error == 'Unauthorized' + assert calls == ['authorize'] + + vm.auth.work_exec_result = WorkExecResult(ok=b'auth') + response = await target.msg_refine_bundle(FuzzerMessage(refine_bundle=refine_request)) + assert response.work_report is not None + assert calls == ['authorize', 'authorize', 'bundle'] + + asyncio.run(run()) + + @pytest.mark.parametrize('metadata', [b'', bytes(5), b'\xff']) def test_real_authorizer_and_refine_pvm_on_historical_state(target, refine_request, metadata): # Return an empty successful result from both real invocations. @@ -506,11 +536,11 @@ async def run(): asyncio.run(run()) -def test_internal_refinement_error_and_duplicate_initialize_close_session(target, refine_request, monkeypatch): +def test_internal_refinement_error_and_duplicate_initialize_close_session(target, refine_request, vm, monkeypatch): def fail(*args, **kwargs): raise RuntimeError('internal failure') - monkeypatch.setattr(Refinement, 'compute_work_report', fail) + monkeypatch.setattr(Refinement, '_compute_authorized_report', fail) async def run(): server = await asyncio.start_unix_server(target._handle_client, path=target.path) diff --git a/test/test_fuzzer_refinement_batch.py b/test/test_fuzzer_refinement_batch.py new file mode 100644 index 00000000..c5c7c12f --- /dev/null +++ b/test/test_fuzzer_refinement_batch.py @@ -0,0 +1,175 @@ +"""Deferred contract tests for batch continuation and JSON result reporting. + +Re-enable this module when ``fuzzer traces`` implements ``--results-file`` and +``--continue-on-error``, including the result schema asserted below. +""" + +import asyncio +import json +from copy import deepcopy + +import pytest +from asyncclick.testing import CliRunner + +from pyjamaz import cli +from pyjamaz.fuzzer.v1.types import FuzzerMessage +from test.test_fuzzer_refinement_traces import case, fake_session + + +pytestmark = pytest.mark.skip( + reason='Deferred: fuzzer traces batch reporting and continuation are not implemented', +) + + +def replay(folder, results_file, *options): + return asyncio.run(CliRunner().invoke(cli.main, [ + 'fuzzer', 'traces', str(folder), '--results-file', str(results_file), *options, + ])) + + +def test_batch_continues_after_rejection_and_preserves_expected_reports(case, fake_session): + case.write(case.folder / 'second') + expected_before = {file: file.read_bytes() for file in case.folder.rglob('report.bin')} + session = fake_session() + send = session.send_request + attempts = [] + + async def respond(request): + if request.refine_bundle is not None: + attempts.append(request) + if len(attempts) == 1: + return FuzzerMessage(error='Unauthorized') + return await send(request) + + session.send_request = respond + report_file = case.folder / 'results.json' + result = replay(case.folder, report_file, '--continue-on-error') + assert result.exit_code != 0 + report = json.loads(report_file.read_text()) + assert (report['total'], report['passed'], report['failed']) == (2, 1, 1) + assert [row['status'] for row in report['results']] == ['failed', 'passed'] + assert report['results'][0]['response_error'] == 'Unauthorized' + assert 'Unauthorized' in '\n'.join(report['results'][0]['failures']) + assert all(row['state_unchanged'] is True for row in report['results']) + assert session.connections == session.closes == 2 + assert sum(request.initialize is not None for request in session.requests) == 2 + assert sum(request.get_state is not None for request in session.requests) == 2 + assert len(attempts) == 2 + assert all(file.read_bytes() == raw for file, raw in expected_before.items()) + + +def test_results_file_records_first_failure_before_default_fail_fast(case, fake_session): + case.write(case.folder / 'second') + session = fake_session(response=FuzzerMessage(error='Unauthorized')) + report_file = case.folder / 'results.json' + result = replay(case.folder, report_file) + assert result.exit_code != 0 + report = json.loads(report_file.read_text()) + assert (report['total'], report['passed'], report['failed']) == (1, 0, 1) + assert report['results'][0]['response_error'] == 'Unauthorized' + assert session.connections == session.closes == 1 + assert sum(request.initialize is not None for request in session.requests) == 1 + + +def test_batch_preserves_rejection_and_get_state_failure_before_next_case(case, fake_session): + case.write(case.folder / 'second') + session = fake_session() + send = session.send_request + attempts = [] + + async def respond(request): + if request.refine_bundle is not None: + attempts.append(request) + if len(attempts) == 1: + return FuzzerMessage(error='Unauthorized') + if request.get_state is not None and len(attempts) == 1: + raise RuntimeError('GetState disconnected') + return await send(request) + + session.send_request = respond + report_file = case.folder / 'results.json' + result = replay(case.folder, report_file, '--continue-on-error') + assert result.exit_code != 0 + report = json.loads(report_file.read_text()) + assert (report['total'], report['passed'], report['failed']) == (2, 1, 1) + first, second = report['results'] + assert first['status'] == 'failed' + assert first['response_error'] == 'Unauthorized' + assert first['state_unchanged'] is None + failures = '\n'.join(first['failures']) + assert 'Unauthorized' in failures + assert 'GetState disconnected' in failures + assert second['status'] == 'passed' + assert second['state_unchanged'] is True + assert len(attempts) == 2 + assert session.connections == session.closes == 2 + assert sum(request.initialize is not None for request in session.requests) == 2 + + +def test_batch_report_records_field_differences_and_state_mutation(case, fake_session): + actual = deepcopy(case.report) + actual.auth_gas_used += 1 + actual.results[0].result.ok = b'different output' + fake_session(response=FuzzerMessage(work_report=actual), state=[(b'm' * 31, b'changed')]) + report_file = case.folder / 'results.json' + result = replay(case.folder, report_file, '--continue-on-error') + assert result.exit_code != 0 + report = json.loads(report_file.read_text()) + assert report['failed'] == report['total'] == 1 + row = report['results'][0] + assert row['status'] == 'failed' + assert row['response_error'] is None + assert row['state_unchanged'] is False + differences = '\n'.join(row['report_differences']) + assert 'auth_gas_used' in differences + assert 'results[0].result.ok' in differences + assert 'expected=' in differences and 'actual=' in differences + assert any('Refinement changed initialized state' in failure for failure in row['failures']) + + +def test_successful_batch_has_zero_exit_and_complete_summary(case, fake_session): + case.write(case.folder / 'second') + session = fake_session() + report_file = case.folder / 'results.json' + result = replay(case.folder, report_file, '--continue-on-error') + assert result.exit_code == 0, result.output or result.exception + report = json.loads(report_file.read_text()) + assert (report['total'], report['passed'], report['failed']) == (2, 2, 0) + assert all(row['status'] == 'passed' for row in report['results']) + assert all(row['failures'] == [] for row in report['results']) + assert all(row['state_unchanged'] is True for row in report['results']) + assert session.connections == session.closes == 2 + + +def test_batch_records_incomplete_case_and_runs_remaining_case(case, fake_session): + case.write(case.folder / 'second') + (case.folder / 'second' / 'genesis.bin').unlink() + session = fake_session() + report_file = case.folder / 'results.json' + result = replay(case.folder, report_file, '--continue-on-error') + assert result.exit_code != 0 + report = json.loads(report_file.read_text()) + assert (report['total'], report['passed'], report['failed']) == (2, 1, 1) + failed = next(row for row in report['results'] if row['status'] == 'failed') + assert 'genesis.bin' in '\n'.join(failed['failures']) + assert failed['state_unchanged'] is None + assert sum(request.initialize is not None for request in session.requests) == 1 + + +def test_results_file_cannot_overwrite_fixture_input(case, fake_session): + session = fake_session() + report_file = case.folder / 'report.bin' + expected_before = report_file.read_bytes() + result = replay(case.folder, report_file, '--continue-on-error') + assert result.exit_code != 0 + assert report_file.read_bytes() == expected_before + assert session.requests == [] + + +def test_continue_on_error_rejects_mixed_block_and_refinement_inputs(case, fake_session): + (case.folder / '00000001.bin').write_bytes(b'block trace') + session = fake_session() + result = replay(case.folder, case.folder / 'results.json', '--continue-on-error') + assert result.exit_code != 0 + assert 'refinement' in result.output.lower() + assert session.requests == [] diff --git a/test/test_fuzzer_refinement_traces.py b/test/test_fuzzer_refinement_traces.py new file mode 100644 index 00000000..41a23bcb --- /dev/null +++ b/test/test_fuzzer_refinement_traces.py @@ -0,0 +1,252 @@ +import asyncio +import os +from copy import deepcopy +from pathlib import Path +from types import SimpleNamespace + +import pytest +from asyncclick.testing import CliRunner +from jamcodec.types import Bytes, U32, Vec + +from pyjamaz import cli +from pyjamaz.availability import BundleData, availability_spec +from pyjamaz.fuzzer.v1.types import Features, FuzzerMessage, RefineBundle, WorkPackageBundle +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.models.app import StateDump, TraceGenesis +from pyjamaz.models.block import Header +from pyjamaz.models.common import RefinementContext, WorkDigest, WorkExecResult, WorkItem, WorkPackage, WorkReport +from pyjamaz.models.state import PendingChanges, ServicesState +from pyjamaz.pvm.constants import Opcode +from pyjamaz.pvm.types import PVMCode +from pyjamaz.refinement import Refinement +from pyjamaz.state.base import state_key_constructor_preimage, state_key_constructor_preimage_availability +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + +# Exercise the real target and PVM using the existing detached-storage harness. +from test.test_fuzzer_refinement import target + + +@pytest.fixture +def case(tmp_path): + item = WorkItem(0, bytes(32), 1_000_000, 1_000_000, 0, b'', [], []) + package = WorkPackage(0, bytes(32), RefinementContext( + bytes(32), bytes(32), bytes(32), bytes(32), 0, [], + ), b'', b'', [item]) + request = RefineBundle(0, {}, 6, WorkPackageBundle(package, [], [], [])) + report = WorkReport( + availability_spec(package.hash(), package.to_jam_bytes().to_bytes(), [], 6), + package.context, 0, package.authorizer_hash(), 2, b'', {}, + [WorkDigest.from_work_item(item, WorkExecResult(ok=b''), 2)], + ) + keyvals = [(b'm' * 31, b'initial state')] + genesis = TraceGenesis(Header.default(), StateDump(PatriciaMerkleTrie(keyvals).root(), keyvals)) + fixture = SimpleNamespace(folder=tmp_path, genesis=genesis, request=request, report=report) + + def write(folder=None): + folder = folder or fixture.folder + folder.mkdir(parents=True, exist_ok=True) + for name, value in [('genesis', fixture.genesis), ('refine', fixture.request), ('report', fixture.report)]: + (folder / f'{name}.bin').write_bytes(value.to_jam_bytes().to_bytes()) + fixture.write = write + write() + return fixture + + +@pytest.fixture +def fake_session(monkeypatch, case): + monkeypatch.setattr(cli, 'setup_logging', lambda *args: None) + + def install(*, refine=True, response=None, state=None): + class Session: + features = Features(refine=refine) + + def __init__(self): + self.requests = [] + self.connections = self.closes = 0 + + async def connect(self): + self.connections += 1 + + async def close(self): + self.closes += 1 + + async def send_request(self, request): + self.requests.append(request) + if request.initialize is not None: + return FuzzerMessage(state_root=case.genesis.state.state_root) + if request.refine_bundle is not None: + return response or FuzzerMessage(work_report=case.report) + assert request.get_state == case.genesis.header.hash + return FuzzerMessage(state=case.genesis.state.keyvals if state is None else state) + + session = Session() + monkeypatch.setattr(cli, 'FuzzerSession', lambda *args, **kwargs: session) + return session + return install + + +def replay(folder): + return asyncio.run(CliRunner().invoke(cli.main, ['fuzzer', 'traces', str(folder)])) + + +def test_matching_report_and_unchanged_state_pass_twice(case, fake_session): + for _ in range(2): + session = fake_session() + result = replay(case.folder) + assert result.exit_code == 0, result.output + assert [request.enum_value()[0] for request in session.requests] == [ + 'initialize', 'refine_bundle', 'get_state', + ] + assert session.connections == session.closes == 1 + + +def test_each_refinement_fixture_gets_fresh_session(case, fake_session, tmp_path): + case.write(tmp_path / 'another') + session = fake_session() + result = replay(tmp_path) + assert result.exit_code == 0, result.output + assert session.connections == session.closes == 2 + assert sum(request.initialize is not None for request in session.requests) == 2 + + +@pytest.mark.parametrize('change,field', [ + ('auth_gas', 'auth_gas_used'), ('refine_gas', 'results[0].refine_load.gas_used'), + ('erasure_root', 'package_spec.erasure_root'), ('result', 'results[0].result.ok'), +]) +def test_complete_report_mismatch_reports_changed_field(case, fake_session, change, field): + actual = deepcopy(case.report) + if change == 'auth_gas': + actual.auth_gas_used += 1 + elif change == 'refine_gas': + actual.results[0].refine_load.gas_used += 1 + elif change == 'erasure_root': + actual.package_spec.erasure_root = b'!' * 32 + else: + actual.results[0].result.ok = b'wrong result' + session = fake_session(response=FuzzerMessage(work_report=actual)) + result = replay(case.folder) + assert result.exit_code != 0 + assert 'Work report mismatch' in result.output + assert field in result.output + assert 'expected=' in result.output and 'actual=' in result.output + assert session.requests[-1].get_state == case.genesis.header.hash + assert session.closes == 1 + + +@pytest.mark.parametrize('error', ['Unauthorized', '']) +def test_unexpected_error_fails_and_checks_state(case, fake_session, error): + session = fake_session(response=FuzzerMessage(error=error)) + result = replay(case.folder) + assert result.exit_code != 0 + assert 'RefineBundle failed' in result.output + assert session.requests[-1].get_state == case.genesis.header.hash + + +def test_refinement_must_not_mutate_initialized_state(case, fake_session): + fake_session(state=[(b'm' * 31, b'changed')]) + result = replay(case.folder) + assert result.exit_code != 0 + assert 'Refinement changed initialized state' in result.output + + +def test_refinement_requires_negotiated_feature(case, fake_session): + session = fake_session(refine=False) + result = replay(case.folder) + assert result.exit_code != 0 + assert 'Refinement was not negotiated' in result.output + assert session.requests == [] + + +@pytest.mark.parametrize('missing', ['genesis.bin', 'refine.bin', 'report.bin']) +def test_incomplete_fixture_fails(case, fake_session, missing): + (case.folder / missing).unlink() + session = fake_session() + result = replay(case.folder) + assert result.exit_code != 0 + assert f'missing {case.folder / missing}' in result.output + assert session.requests == [] + + +@pytest.mark.parametrize('name', ['genesis.bin', 'refine.bin', 'report.bin']) +def test_fixture_with_trailing_bytes_fails(case, fake_session, name): + file = case.folder / name + file.write_bytes(file.read_bytes() + b'\x00') + session = fake_session() + result = replay(case.folder) + assert result.exit_code != 0 + assert 'trailing bytes' in result.output + assert name in result.output + assert session.requests == [] + + +def test_real_target_replays_real_pvm_report_twice(case, target, monkeypatch): + monkeypatch.setattr(cli, 'setup_logging', lambda *args: None) + raw = bytes((Opcode.load_imm.value, 8, 0, 0, 0, 0, Opcode.jump_ind.value, 0)) + code = PVMCode(0, 0, len(raw), [], raw, [True, False, False, False, False, False, True, False]) + encoded = code.to_jam_bytes().to_bytes() + preimage = (Bytes.encode(b'').to_bytes() + bytes(8) + (4096).to_bytes(3, 'little') + + len(encoded).to_bytes(4, 'little') + encoded) + code_hash = blake2b_256_hash(preimage) + package = case.request.bundle.work_package + package.auth_code_hash = package.items[0].code_hash = code_hash + keyvals = [ + (state_key_constructor_preimage(0, code_hash), preimage), + (state_key_constructor_preimage_availability(0, code_hash, len(preimage)), Vec(U32).encode([0]).to_bytes()), + ] + case.genesis.state = StateDump(PatriciaMerkleTrie(keyvals).root(), keyvals) + engine = InMemoryStorageEngine() + for key, value in keyvals: + engine.put(key, value) + services = ServicesState(services={}) + services.set_state_storage(StateStorage(engine)) + services.pending_changes = PendingChanges() + case.report = Refinement(services, BundleData.from_parts(package, [], [], [])).compute_work_report( + package, 0, {}, 6, + ) + assert case.report.results[0].result.ok == b'' + assert case.report.auth_gas_used > 0 + case.write() + + async def run(): + server = await asyncio.start_unix_server(target._handle_client, path=target.path) + try: + for _ in range(2): + result = await CliRunner().invoke(cli.main, [ + 'fuzzer', 'traces', str(case.folder), '--socket-path', target.path, + ]) + assert result.exit_code == 0, result.output or result.exception + assert target.app.state_storage.state_root() == case.genesis.state.state_root + finally: + server.close() + await server.wait_closed() + asyncio.run(run()) + + +def test_captured_polkajam_fixture_replays_twice(target, monkeypatch): + fixture_dir = os.getenv('PYJAMAZ_REFINEMENT_TRACE_DIR') + if fixture_dir is None: + pytest.skip('Set PYJAMAZ_REFINEMENT_TRACE_DIR to replay a captured reference fixture') + assert fixture_dir, 'PYJAMAZ_REFINEMENT_TRACE_DIR must name a fixture directory' + folder = Path(fixture_dir) + assert folder.is_dir(), f'Captured fixture directory does not exist: {folder}' + # Validate the supplied oracle rather than computing an expected report here. + for name in ('genesis.bin', 'refine.bin', 'report.bin'): + assert (folder / name).is_file(), f'Captured fixture is missing {folder / name}' + genesis = cli._read_refinement_fixture(folder / 'genesis.bin', TraceGenesis) + monkeypatch.setattr(cli, 'setup_logging', lambda *args: None) + + async def run(): + server = await asyncio.start_unix_server(target._handle_client, path=target.path) + try: + for _ in range(2): + result = await CliRunner().invoke(cli.main, [ + 'fuzzer', 'traces', str(folder), '--socket-path', target.path, + ]) + assert result.exit_code == 0, result.output or result.exception + assert target.app.state_storage.state_root() == genesis.state.state_root + finally: + server.close() + await server.wait_closed() + asyncio.run(run()) diff --git a/test/test_fuzzer_target.py b/test/test_fuzzer_target.py new file mode 100644 index 00000000..4e963330 --- /dev/null +++ b/test/test_fuzzer_target.py @@ -0,0 +1,238 @@ +import asyncio +from copy import deepcopy +from types import SimpleNamespace + +import pytest + +from pyjamaz.app import PyjamazApp +from pyjamaz.exceptions import BlockValidationError, StateTransitionError +from pyjamaz.fuzzer.v1.target import FuzzerTarget +from pyjamaz.fuzzer.v1.types import AncestryItem, FuzzerMessage, InitializeMessage +from pyjamaz.models.block import AncestorReference, Block, Extrinsic, Header +from pyjamaz.models.context import AppContext +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + + +COUNTER = bytes([1]) * 31 +REMOVED = bytes([2]) * 31 +ADDED = bytes([3]) * 31 + + +@pytest.fixture +def target(tmp_path): + # Exercise the real application import/rollback boundary with a small + # deterministic STF, without signatures, PVM execution, or a disk database. + engine = InMemoryStorageEngine() + app = PyjamazApp.__new__(PyjamazApp) + app.state_db = engine.namespace(b"state") + app.block_db = engine.namespace(b"block") + app.state_storage = StateStorage(app.state_db) + app.app_context = AppContext(state_storage=app.state_storage) + app.pubsub = None + app.working_state = None + app.retrieve_jam_state = lambda: SimpleNamespace(state_root=app.state_storage.state_root()) + app.import_block = app._import_block + + async def transition(block, produce=False): + await app.initialize(block.header) + value = int.from_bytes(app.state_storage.get(COUNTER), "little") + value += block.header.author_index + app.state_storage.put(COUNTER, value.to_bytes(4, "little")) + app.state_storage.commit() + app.working_state = app.retrieve_jam_state() + + app.state_transition = transition + return FuzzerTarget(str(tmp_path / "target.sock"), app) + + +async def initialize(target, *, header=None, ancestry=None): + header = header or Header.default() + response = await target.msg_initialize(FuzzerMessage(initialize=InitializeMessage( + header=header, + state=[(COUNTER, (10).to_bytes(4, "little")), (REMOVED, b"old")], + ancestry=ancestry or [], + ))) + assert response.error is None + assert response.state_root == target.app.state_storage.state_root() + return header + + +def child(parent, slot, increment=1): + header = Header.default() + header.parent = parent.hash + header.timeslot = slot + header.author_index = increment + return Block(header=header, extrinsic=Extrinsic.default()) + + +def test_get_state_returns_selected_overlay_including_deletions(target): + async def run(): + genesis = await initialize(target) + block = child(genesis, 1) + storage = target.app.state_storage + storage.set_header(block.header) + storage.put(COUNTER, (11).to_bytes(4, "little")) + storage.delete(REMOVED) + storage.put(ADDED, b"new") + storage.commit() + + response = target.msg_get_state() + assert dict(response.state) == {COUNTER: (11).to_bytes(4, "little"), ADDED: b"new"} + requested = await target._dispatch(FuzzerMessage(get_state=block.header.hash)) + assert requested.state == response.state + assert dict(target.app.state_db.as_list()) == { + COUNTER: (10).to_bytes(4, "little"), REMOVED: b"old" + } + + asyncio.run(run()) + + +def test_get_state_returns_requested_retained_branch_without_selecting_it(target): + async def run(): + genesis = await initialize(target) + parent = child(genesis, 1) + left = child(parent.header, 2, increment=2) + right = child(parent.header, 2, increment=3) + left_child = child(left.header, 3, increment=4) + + for block in (parent, left, right, left_child): + response = await target.msg_import_block(FuzzerMessage(import_block=block)) + assert response.error is None + + storage = target.app.state_storage + selected_state = target.app.working_state + selected_root = storage.state_root() + for header, value in ((parent.header, 11), (left.header, 13), + (right.header, 14), (left_child.header, 17), (genesis, 10)): + response = await target._dispatch(FuzzerMessage(get_state=header.hash)) + assert dict(response.state) == { + COUNTER: value.to_bytes(4, "little"), REMOVED: b"old" + } + assert storage.block_hash == left_child.header.hash + assert storage.state_root() == selected_root + assert target.app.working_state is selected_state + assert storage.finalized_block_hash == genesis.hash + + asyncio.run(run()) + + +@pytest.mark.parametrize("known_ancestor", [False, True]) +def test_get_state_rejects_unavailable_state_without_returning_selected(target, known_ancestor): + async def run(): + missing_hash = bytes([29]) * 32 + genesis_header = Header.default() + ancestry = [] + if known_ancestor: + genesis_header.parent = missing_hash + genesis_header.timeslot = 1 + ancestry = [AncestryItem(slot=0, header_hash=missing_hash)] + genesis = await initialize(target, header=genesis_header, ancestry=ancestry) + block = child(genesis, 2) + response = await target.msg_import_block(FuzzerMessage(import_block=block)) + assert response.error is None + storage = target.app.state_storage + selected_state = target.app.working_state + selected_root = storage.state_root() + + with pytest.raises(KeyError, match="state for block hash is unavailable"): + await target._dispatch(FuzzerMessage(get_state=missing_hash)) + + assert storage.block_hash == block.header.hash + assert storage.state_root() == selected_root + assert target.app.working_state is selected_state + + asyncio.run(run()) + + +def test_initialize_preserves_supplied_ancestry_slots_without_inventing_commitments(target): + async def run(): + older_hash, newer_hash = bytes([7]) * 32, bytes([17]) * 32 + header = Header.default() + header.parent = newer_hash + header.timeslot = 22 + await initialize(target, header=header, ancestry=[ + AncestryItem(slot=17, header_hash=newer_hash), + AncestryItem(slot=7, header_hash=older_hash), + ]) + + ancestors = target.app.state_storage.ancestors + assert ancestors[header.hash] == header + assert isinstance(ancestors[newer_hash], AncestorReference) + assert ancestors[newer_hash].timeslot == 17 + assert ancestors[newer_hash].parent == older_hash + assert ancestors[older_hash].timeslot == 7 + assert ancestors[older_hash].parent == bytes(32) + assert ancestors[newer_hash].parent_state_root is None + assert ancestors[older_hash].parent_state_root is None + + asyncio.run(run()) + + +def test_import_retains_same_slot_siblings_and_their_independent_state(target): + async def run(): + genesis = await initialize(target) + parent = child(genesis, 1) + left = child(parent.header, 2, increment=2) + right = child(parent.header, 2, increment=3) + left_child = child(left.header, 3, increment=4) + + for block in (parent, left, right, left_child): + response = await target.msg_import_block(FuzzerMessage(import_block=block)) + assert response.error is None + assert response.state_root == target.app.state_storage.state_root() + + storage = target.app.state_storage + assert storage.finalized_block_hash == genesis.hash + assert genesis.hash in storage.ancestors + for block, value in ((parent, 11), (left, 13), (right, 14), (left_child, 17)): + assert storage.has_state_at(block.header.hash) + assert storage.as_dict_at(block.header.hash)[COUNTER] == value.to_bytes(4, "little") + assert target.app.state_db.get(COUNTER) == (10).to_bytes(4, "little") + + asyncio.run(run()) + + +@pytest.mark.parametrize("error_type", [BlockValidationError, StateTransitionError]) +def test_rejected_import_leaves_application_restored_parent_intact(target, error_type): + async def run(): + genesis = await initialize(target) + parent = child(genesis, 1) + response = await target.msg_import_block(FuzzerMessage(import_block=parent)) + assert response.error is None + storage = target.app.state_storage + parent_changes = deepcopy(storage.change_sets[parent.header.hash]) + parent_root = storage.state_root() + rejected = child(parent.header, 2, increment=2) + ordinary_transition = target.app.state_transition + + async def reject(block, produce=False): + await target.app.initialize(block.header) + storage.put(COUNTER, b"uncommitted") + target.app.app_context.post_commit_signals.append(object()) + raise error_type("rejected candidate") + + target.app.state_transition = reject + response = await target.msg_import_block(FuzzerMessage(import_block=rejected)) + + assert "rejected candidate" in response.error + assert storage.block_hash == parent.header.hash + assert storage.change_sets[parent.header.hash] == parent_changes + assert storage.state_root() == parent_root + assert target.app.working_state.state_root == parent_root + assert rejected.header.hash not in storage.change_sets + assert rejected.header.hash not in storage.parents + assert rejected.header.hash not in storage.ancestors + assert storage.transaction == {} + assert target.app.app_context.post_commit_signals == [] + + # A second adapter rollback would discard the restored parent's overlay + # and prevent this sibling from executing against the original state. + target.app.state_transition = ordinary_transition + sibling = child(parent.header, 2, increment=3) + response = await target.msg_import_block(FuzzerMessage(import_block=sibling)) + assert response.error is None + assert storage.get(COUNTER) == (14).to_bytes(4, "little") + assert storage.change_sets[parent.header.hash] == parent_changes + + asyncio.run(run()) diff --git a/test/test_fuzzer_trace_replay.py b/test/test_fuzzer_trace_replay.py new file mode 100644 index 00000000..eb978cd5 --- /dev/null +++ b/test/test_fuzzer_trace_replay.py @@ -0,0 +1,198 @@ +import asyncio + +import pytest +from asyncclick.testing import CliRunner + +from pyjamaz import cli +from pyjamaz.fuzzer.v1.types import FuzzerMessage +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.models.app import StateDump, Trace, TraceGenesis +from pyjamaz.models.block import Block, Extrinsic, Header + + +@pytest.fixture +def trace_files(tmp_path): + keyvals = [(b'\x01' * 31, b'parent state')] + state = StateDump(PatriciaMerkleTrie(keyvals).root(), keyvals) + genesis = Header.default() + (tmp_path / 'genesis.bin').write_bytes(TraceGenesis(genesis, state).to_jam_bytes().to_bytes()) + + def write_trace(number=1, pre_state=None, post_state=None): + header = Header.default() + header.timeslot = number + header.parent = genesis.hash + header.parent_state_root = state.state_root + trace = Trace(pre_state or state, Block(header, Extrinsic.default()), post_state or state) + (tmp_path / f'{number:08}.bin').write_bytes(trace.to_jam_bytes().to_bytes()) + return trace + + return tmp_path, state, genesis, write_trace + + +@pytest.fixture +def fake_session(monkeypatch): + monkeypatch.setattr(cli, 'setup_logging', lambda *args: None) + + def install(responses, connect_error=None): + class Session: + def __init__(self): + self.requests = [] + self.responses = iter(responses) + self.closed = False + + async def connect(self): + self.writer = object() + if connect_error is not None: + raise connect_error + + async def send_request(self, request): + self.requests.append(request) + response = next(self.responses) + if isinstance(response, Exception): + raise response + return response + + async def close(self): + self.closed = True + + session = Session() + monkeypatch.setattr(cli, 'FuzzerSession', lambda *args, **kwargs: session) + return session + + return install + + +def replay(folder, prompt=False): + args = ['fuzzer', 'traces', str(folder)] + if prompt: + args.append('--prompt-on-diff') + return asyncio.run(CliRunner().invoke(cli.main, args, input='q\n' if prompt else None)) + + +def test_matching_roots_succeed_and_close_session(trace_files, fake_session): + folder, state, _, write_trace = trace_files + write_trace() + session = fake_session([FuzzerMessage(state_root=state.state_root)] * 2) + + result = replay(folder) + + assert result.exit_code == 0, result.output + assert len(session.requests) == 2 + assert session.closed + + +@pytest.mark.parametrize('prompt,expected_count', [(False, 2), (True, 1)]) +def test_root_mismatches_fail_even_after_prompt_quit(trace_files, fake_session, prompt, expected_count): + folder, state, _, write_trace = trace_files + write_trace(1) + write_trace(2) + session = fake_session([ + FuzzerMessage(state_root=state.state_root), + FuzzerMessage(state_root=b'!' * 32), + FuzzerMessage(state_root=b'!' * 32), + ]) + + result = replay(folder, prompt) + + assert result.exit_code != 0 + assert f'{expected_count} fuzzer trace state-root mismatch' in result.output + assert len(session.requests) == 1 + expected_count + assert session.closed + + +@pytest.mark.parametrize('error', ['bad block', '']) +def test_expected_rejection_checks_actual_parent_state(trace_files, fake_session, error): + folder, state, genesis, write_trace = trace_files + # The fixture's pre-state root must never substitute for the target's root. + write_trace(pre_state=StateDump(b'!' * 32, state.keyvals)) + session = fake_session([ + FuzzerMessage(state_root=state.state_root), + FuzzerMessage(error=error), + FuzzerMessage(state=state.keyvals), + ]) + + result = replay(folder) + + assert result.exit_code == 0, result.output + assert session.requests[-1].get_state == genesis.hash + assert session.closed + + +def test_rejected_block_with_changed_parent_state_fails(trace_files, fake_session): + folder, state, genesis, write_trace = trace_files + write_trace() + session = fake_session([ + FuzzerMessage(state_root=state.state_root), + FuzzerMessage(error='bad block'), + FuzzerMessage(state=[(state.keyvals[0][0], b'changed by failed import')]), + ]) + + result = replay(folder) + + assert result.exit_code != 0 + assert '1 fuzzer trace state-root mismatch' in result.output + assert session.requests[-1].get_state == genesis.hash + assert session.closed + + +@pytest.mark.parametrize('operation,response', [ + ('Initialize', FuzzerMessage(error='invalid initial state')), + ('Initialize', FuzzerMessage(state=[])), + ('ImportBlock', FuzzerMessage(state=[])), + ('GetState', FuzzerMessage(error='unknown parent')), + ('GetState', FuzzerMessage(state_root=bytes(32))), +]) +def test_protocol_errors_fail_and_close_session(trace_files, fake_session, operation, response): + folder, state, _, write_trace = trace_files + write_trace() + responses = [] + if operation != 'Initialize': + responses.append(FuzzerMessage(state_root=state.state_root)) + if operation == 'GetState': + responses.append(FuzzerMessage(error='bad block')) + responses.append(response) + session = fake_session(responses) + + result = replay(folder) + + assert result.exit_code != 0 + assert operation in result.output + assert session.closed + + +def test_initial_root_mismatch_fails_and_closes_session(trace_files, fake_session): + folder, _, _, write_trace = trace_files + write_trace() + session = fake_session([FuzzerMessage(state_root=b'!' * 32)]) + + result = replay(folder) + + assert result.exit_code != 0 + assert 'initial state root mismatch' in result.output + assert len(session.requests) == 1 + assert session.closed + + +def test_request_failure_closes_session(trace_files, fake_session): + folder, state, _, write_trace = trace_files + write_trace() + session = fake_session([FuzzerMessage(state_root=state.state_root), RuntimeError('request timed out')]) + + result = replay(folder) + + assert result.exit_code != 0 + assert str(result.exception) == 'request timed out' + assert session.closed + + +def test_handshake_failure_closes_open_socket(trace_files, fake_session): + folder, _, _, write_trace = trace_files + write_trace() + session = fake_session([], connect_error=RuntimeError('invalid PeerInfo')) + + result = replay(folder) + + assert result.exit_code != 0 + assert str(result.exception) == 'invalid PeerInfo' + assert session.requests == [] + assert session.closed diff --git a/test/test_import_recovery.py b/test/test_import_recovery.py new file mode 100644 index 00000000..443ec52c --- /dev/null +++ b/test/test_import_recovery.py @@ -0,0 +1,172 @@ +"""Recover imports using H.6 and verify the 14.12/14.15 proof construction.""" + +from dataclasses import replace + +import pytest +from jamcodec.types import H256, Vec + +from pyjamaz import erasure +from pyjamaz.availability import ( + ImportedSegment, decode_paged_proof, import_justification, paged_proof_segments, + recover_import, verify_import, +) +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, valid_validator_count +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.common import WorkPackageSpec + + +def source(count, validators=6): + segments = [index.to_bytes(4, 'little') * (EC_SEGMENT_SIZE // 4) for index in range(count)] + tree = ConstantDepthMerkleTree(segments) + spec = WorkPackageSpec(b'p' * 32, 0, b'e' * 32, tree.root(), count, erasure_shards=validators) + return segments, tree, spec + + +def parity_shards(validators, data): + encoded = erasure.encode_blob(validators, data) + originals = erasure.erasure_data_shards(validators) + return {index: encoded[index] for index in reversed(range(validators - originals, validators))} + + +@pytest.mark.parametrize('count', [1, 2, 63, 64, 65, 127, 128, 129, 3072]) +def test_recovered_pages_produce_the_original_direct_proof(count): + segments, tree, spec = source(count) + pages = paged_proof_segments(segments) + # Check both sides of a page boundary as well as the final partial page. + for index in sorted({0, min(63, count - 1), min(64, count - 1), count - 1}): + shards = parity_shards(6, segments[index]) + page_index = index // 64 + path, leaves = decode_paged_proof(pages[page_index], count, page_index) + assert len(leaves) == min(64, count - 64 * page_index) + assert path == tuple(tree.trace(index)[:max(0, (count - 1).bit_length() - 6)]) + expected = ImportedSegment(segments[index], tuple(tree.trace(index))) + assert recover_import(spec, index, shards, justification=expected.justification) == expected + assert recover_import(spec, index, shards, + proof_page_shards=parity_shards(6, pages[page_index])) == expected + + +@pytest.mark.parametrize('validators', [6, 9, 15, 1020, 1023]) +def test_recovery_uses_the_source_reports_validator_count(monkeypatch, validators): + monkeypatch.setattr(erasure, 'valid_validator_count', + lambda value: valid_validator_count(value, core_count=341)) + segments, tree, spec = source(65, validators) + page = paged_proof_segments(segments)[1] + # The segment and proof page can be reconstructed from different index sets. + page_shards = dict(enumerate(erasure.encode_blob(validators, page))) + originals = erasure.erasure_data_shards(validators) + page_shards = {index: page_shards[index] for index in range(originals)} + imported = recover_import(spec, 64, parity_shards(validators, segments[64]), + proof_page_shards=page_shards) + assert imported == ImportedSegment(segments[64], tuple(tree.trace(64))) + + +@pytest.mark.parametrize('fault', ['missing', 'both', 'bad_root', 'bad_depth', 'bad_hash', + 'bad_segment', 'insufficient_segment', 'insufficient_page']) +def test_invalid_recovery_inputs_are_rejected(fault): + segments, tree, spec = source(65) + index = 64 + shards = parity_shards(6, segments[index]) + kwargs = {'justification': tuple(tree.trace(index))} + if fault == 'missing': + kwargs = {} + elif fault == 'both': + kwargs['proof_page_shards'] = parity_shards(6, paged_proof_segments(segments)[1]) + elif fault == 'bad_root': + spec = replace(spec, exports_root=b'!' * 32) + elif fault == 'bad_depth': + kwargs['justification'] = kwargs['justification'][:-1] + elif fault == 'bad_hash': + kwargs['justification'] = (b'!' * 32,) + kwargs['justification'][1:] + elif fault == 'bad_segment': + shards = parity_shards(6, b'!' * EC_SEGMENT_SIZE) + elif fault == 'insufficient_segment': + shards.pop(3) + elif fault == 'insufficient_page': + kwargs = {'proof_page_shards': {}} + with pytest.raises(ProcessWorkpackageError): + recover_import(spec, index, shards, **kwargs) + + +@pytest.mark.parametrize('field,value', [('exports_count', 0), ('exports_count', 3073), + ('exports_count', True), ('erasure_shards', 7)]) +def test_invalid_source_spec(field, value): + segments, _, spec = source(1) + with pytest.raises(ProcessWorkpackageError): + recover_import(replace(spec, **{field: value}), 0, parity_shards(6, segments[0]), justification=()) + + +@pytest.mark.parametrize('index', [-1, 1, 3072, True, 0.5]) +def test_invalid_segment_index(index): + segments, _, spec = source(1) + with pytest.raises(ProcessWorkpackageError): + recover_import(spec, index, parity_shards(6, segments[0]), justification=()) + + +@pytest.mark.parametrize('fault', ['path_count', 'leaf_count', 'noncanonical_path', + 'noncanonical_leaves', 'padding', 'short', 'long']) +def test_malformed_proof_pages_are_rejected(fault): + segments, _, _ = source(1) + original = paged_proof_segments(segments)[0] + page = bytearray(original) + if fault == 'path_count': + page[0] = 1 + elif fault == 'leaf_count': + page[1] = 0 + elif fault == 'noncanonical_path': + page = b'\x80\x00' + original[:-1] + elif fault == 'noncanonical_leaves': + page = original[:1] + b'\x80\x01' + original[2:-1] + elif fault == 'padding': + page[-1] = 1 + elif fault == 'short': + page = page[:-1] + elif fault == 'long': + page.append(0) + with pytest.raises(ProcessWorkpackageError): + decode_paged_proof(bytes(page), 1, 0) + + +@pytest.mark.parametrize('count,index', [(0, 0), (3073, 0), (True, 0), (1, -1), + (1, 1), (65, 2), (65, True)]) +def test_invalid_page_context(count, index): + with pytest.raises(ProcessWorkpackageError): + decode_paged_proof(bytes(EC_SEGMENT_SIZE), count, index) + + +@pytest.mark.parametrize('count,index,segment', [(None, 0, bytes(4104)), + (65, 65, bytes(4104)), + (1, 0, bytes(4103)), (1, 0, None)]) +def test_justification_rejects_invalid_context_or_segment(count, index, segment): + segments, _, spec = source(65 if count == 65 else 1) + page = paged_proof_segments(segments)[-1] + with pytest.raises(ProcessWorkpackageError): + import_justification(segment, index, page, count, spec.exports_root) + + +@pytest.mark.parametrize('hash_index', [0, 1, 64]) +def test_altered_page_path_or_leaves_cannot_justify_an_import(hash_index): + segments, _, spec = source(65) + page = paged_proof_segments(segments)[0] + path, leaves = decode_paged_proof(page, 65, 0) + hashes = list(path + leaves) + hashes[hash_index] = b'!' * 32 + encoded = Vec(H256).encode(hashes[:1]).to_bytes() + Vec(H256).encode(hashes[1:]).to_bytes() + altered = encoded + bytes(EC_SEGMENT_SIZE - len(encoded)) + with pytest.raises(ProcessWorkpackageError): + import_justification(segments[0], 0, altered, 65, spec.exports_root) + with pytest.raises(ProcessWorkpackageError): + recover_import(spec, 0, parity_shards(6, segments[0]), proof_page_shards=parity_shards(6, altered)) + + +@pytest.mark.parametrize('root,index,imported', [ + (b'x', 0, ImportedSegment(bytes(4104), ())), + (b'x' * 32, True, ImportedSegment(bytes(4104), ())), + (b'x' * 32, 3072, ImportedSegment(bytes(4104), ())), + (b'x' * 32, 0, ImportedSegment(bytes(4103), ())), + (b'x' * 32, 0, ImportedSegment(bytes(4104), (b'x',))), + (b'x' * 32, 0, ImportedSegment(bytes(4104), (b'x' * 32,) * 13)), +]) +def test_import_verification_rejects_invalid_dimensions(root, index, imported): + with pytest.raises(ProcessWorkpackageError): + verify_import(root, index, imported) diff --git a/test/test_import_source_eligibility.py b/test/test_import_source_eligibility.py new file mode 100644 index 00000000..23950945 --- /dev/null +++ b/test/test_import_source_eligibility.py @@ -0,0 +1,94 @@ +"""Runtime admission of known import roots, before the pure Xi calculation.""" + +import asyncio +from types import SimpleNamespace + +import pytest + +from pyjamaz.availability import DataUnavailable, ImportedSegment, availability_spec +from pyjamaz.bundle import encode_bundle +from pyjamaz.d3l import AvailabilitySource, DataAvailabilityStore +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.app import D3LEntry +from pyjamaz.models.common import ImportSegment, ValidatorData, WorkReport +from test.test_runtime_refinement import package, runtime, submit + + +def known_history(runtime, root): + runtime.app.working_state.recent_history.recent_blocks = [SimpleNamespace(reported=[ + SimpleNamespace(hash=b's' * 32, exports_root=root), + ])] + + +@pytest.mark.parametrize('route', ['bundle', 'complete_exports', 'individual_import']) +def test_valid_proof_without_known_source_never_reaches_refine(runtime, route): + segment = b'x' * 4104 + root = ConstantDepthMerkleTree([segment]).root() + value = package(imports=[ImportSegment.from_segment_root(root, 0)]) + store = runtime.app.d3l_store + if route == 'complete_exports': + store.store_segments(D3LEntry(root, [segment])) + elif route == 'individual_import': + store.store_import(root, 0, ImportedSegment(segment, ())) + bundle = encode_bundle(value, [], [segment], [[]]) if route == 'bundle' else None + runtime.pipeline.add_work_package(value, [], bundle=bundle) + item = runtime.pipeline._pending_work_packages[value.hash()] + before = store.storage_engine.as_dict() + with pytest.raises(DataUnavailable, match='source'): + asyncio.run(runtime.pipeline._refine_work_package(item)) + assert runtime.invocations == runtime.signed == [] + assert store.storage_engine.as_dict() == before + + +def test_recent_report_allows_supplied_import_without_local_storage(runtime): + segment = b'x' * 4104 + root = ConstantDepthMerkleTree([segment]).root() + known_history(runtime, root) + runtime.app.d3l_store = None + value = package(imports=[ImportSegment.from_segment_root(root, 0)]) + runtime.pipeline.add_work_package(value, [], bundle=encode_bundle(value, [], [segment], [[]])) + item = runtime.pipeline._pending_work_packages[value.hash()] + asyncio.run(runtime.pipeline._refine_work_package(item)) + assert item.status.Reported + assert runtime.invocations[-1]['work_items_import_segments'] == [[segment]] + + +def test_local_computed_report_remains_known_after_store_restart_and_queue_clear(runtime): + async def run(): + first = package(b'local source') + source_item = submit(runtime, first) + await runtime.pipeline._refine_work_package(source_item) + root = source_item.work_report.package_spec.exports_root + runtime.pipeline._pending_work_packages.clear() + runtime.app.d3l_store = DataAvailabilityStore(runtime.app.d3l_store.storage_engine) + assert runtime.app.working_state.recent_history.recent_blocks == [] + second = submit(runtime, package(b'consumer', [ImportSegment.from_segment_root(root, 1)])) + await runtime.pipeline._refine_work_package(second) + assert second.status.Reported + assert runtime.invocations[-1]['work_items_import_segments'] == [[b'b' * 4104]] + + asyncio.run(run()) + + +@pytest.mark.parametrize('canonical', [True, False]) +def test_retained_chain_source_eligibility_follows_branch_without_an_age_cutoff(runtime, canonical): + segment = b'x' * 4104 + spec = availability_spec(b's' * 32, b'source bundle', [segment], 6) + value = package(imports=[ImportSegment.from_segment_root(spec.exports_root, 0)]) + report = WorkReport(spec, value.context, 0, bytes(32), 0, b'', {}, []) + validators = [ValidatorData(bytes(32), bytes([i]) * 32, bytes(144), bytes(128)) for i in range(6)] + store = runtime.app.d3l_store + store.register_source(AvailabilitySource(report, validators, validators[:2], b'h' * 32, 0)) + runtime.app.working_state.timeslot.number = 10_000_000 + runtime.app.runtime = SimpleNamespace(availability=SimpleNamespace( + source_for=lambda **lookup: store.source_for(**lookup, canonical=lambda _: canonical), + )) + runtime.pipeline.add_work_package(value, [], bundle=encode_bundle(value, [], [segment], [[]])) + item = runtime.pipeline._pending_work_packages[value.hash()] + if canonical: + asyncio.run(runtime.pipeline._refine_work_package(item)) + assert item.status.Reported + else: + with pytest.raises(DataUnavailable, match='source'): + asyncio.run(runtime.pipeline._refine_work_package(item)) + assert runtime.invocations == runtime.signed == [] diff --git a/test/test_jamnp_transport.py b/test/test_jamnp_transport.py new file mode 100644 index 00000000..9b62903c --- /dev/null +++ b/test/test_jamnp_transport.py @@ -0,0 +1,585 @@ +"""Pinned JAMNP-S v1 framing and authenticated QUIC availability exchanges.""" + +import asyncio +import ipaddress +from dataclasses import replace +from types import SimpleNamespace + +import pytest +from cryptography import x509 +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey + +from jamcodec.types import VarInt64 +from pyjamaz.availability import ( + ImportedSegment, audit_shard_justification, build_availability_artifacts, + segment_shard_justification, +) +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.constants import MESSAGE_TYPES +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.common import ValidatorData +from pyjamaz.transport.cert import generate_cert, validate_peer_certificate +from pyjamaz.transport.jamnp_messages import ( + InvalidJAMNPSMessage, decode_import_proofs, decode_justification, + decode_segment_indices, decode_segment_requests, encode_import_proofs, + encode_justification, encode_segment_indices, encode_segment_request, frame, +) +from pyjamaz.transport.protocol_jamnp_s import ( + JAMNPS, MAX_PACKAGE_BYTES, StreamBuffer, wrap_protocol, ClientProtocol, +) +from pyjamaz.transport.pubsub import PubSub +from pyjamaz.utils import quic_peer_id +from test.test_runtime_refinement import package + + +def identity(tmp_path, name): + private = Ed25519PrivateKey.generate() + secret = private.private_bytes(serialization.Encoding.Raw, serialization.PrivateFormat.Raw, + serialization.NoEncryption()) + public = private.public_key().public_bytes(serialization.Encoding.Raw, serialization.PublicFormat.Raw) + keys = SimpleNamespace(ed25519=SimpleNamespace(private_key=secret)) + private_pem, cert_pem = generate_cert(keys, '127.0.0.1', quic_peer_id(public)) + cert, key = tmp_path / (name + '.crt'), tmp_path / (name + '.key') + cert.write_bytes(cert_pem) + key.write_bytes(private_pem) + return public, str(cert), str(key) + + +def application(service): + return SimpleNamespace(pubsub=PubSub(), runtime=SimpleNamespace(availability=service), + retrieve_block_hash=lambda slot: b'g' * 32, + retrieve_finalized_head=lambda: None, + retrieve_block_header=lambda h: None) + + +def peer(key, port): + metadata = ipaddress.IPv6Address('::ffff:127.0.0.1').packed + port.to_bytes(2, 'little') + bytes(110) + return ValidatorData(bytes(32), key, bytes(144), metadata) + + +class Service: + def __init__(self): + self.exports = [b'x' * 4104, b'y' * 4104] + self.bundle = b'bundle' * 500 + self.artifacts = build_availability_artifacts(b'p' * 32, self.bundle, self.exports, 6) + self.seen_peers = [] + self.authorized = [] + self.completed = [] + self.reject = False + + async def handle_request(self, peer_key, kind, messages): + self.seen_peers.append(peer_key) + request = messages[0] + if kind in (137, 138): + assert request[:32] == self.artifacts.spec.erasure_root + shard = self.artifacts.shards[int.from_bytes(request[32:], 'little')] + if kind == 137: + return [shard.bundle_shard, b''.join(shard.segment_shards), encode_justification(shard.justification)] + return [shard.bundle_shard, encode_justification(audit_shard_justification(shard))] + if kind in (139, 140): + groups = decode_segment_requests(request) + result, proofs = [], [] + for root, index, indices in groups: + assert root == self.artifacts.spec.erasure_root + shard = self.artifacts.shards[index] + for segment_index in indices: + result.append(shard.segment_shards[segment_index]) + proofs.append(encode_justification(segment_shard_justification(shard, segment_index), 1368)) + return [b''.join(result)] + (proofs if kind == 140 else []) + if kind == 148: + result, proofs = [], [] + tree = ConstantDepthMerkleTree(self.exports) + for root, indices in decode_segment_indices(request): + assert root == tree.root() + result.extend(self.exports[index] for index in indices) + proofs.extend(tree.trace(index) for index in indices) + return [b''.join(result), encode_import_proofs(proofs)] + if kind == 147: + return [self.bundle] + raise ValueError('unsupported') + + async def authorize_submission(self, key, core, value, mappings): + self.authorized.append((key, core, value, mappings)) + if self.reject: + raise ValueError('authorization rejected') + return 'authorized' + + async def complete_submission(self, context, kind, messages): + assert context == 'authorized' + self.completed.append((kind, messages)) + return [] + + +async def nodes(tmp_path): + server_key, server_cert, server_private = identity(tmp_path, 'server') + client_key, client_cert, client_private = identity(tmp_path, 'client') + service = Service() + server = JAMNPS('127.0.0.1', 0, server_cert, server_private, application(service)) + client = JAMNPS('127.0.0.1', 0, client_cert, client_private, application(Service())) + await server.listen() + port = server.server._transport.get_extra_info('sockname')[1] + return server, client, service, peer(server_key, port), client_key + + +def test_certificate_identity_is_the_only_dns_san(tmp_path): + public, certificate_path, _ = identity(tmp_path, 'node') + certificate = x509.load_pem_x509_certificate(open(certificate_path, 'rb').read()) + assert validate_peer_certificate(certificate, public) == public + names = list(certificate.extensions.get_extension_for_class(x509.SubjectAlternativeName).value) + assert names == [x509.DNSName(quic_peer_id(public))] + with pytest.raises(ValueError, match='expected validator'): + validate_peer_certificate(certificate, bytes(32)) + + +def test_independent_stream_readers_accept_fragmented_interleaved_frames(): + async def run(): + first, second = StreamBuffer(), StreamBuffer() + first_result = asyncio.create_task(first.read_all()) + second_result = asyncio.create_task(second.read_all()) + a, b = frame(b'abc') + frame(b''), frame(b'xyz123') + for i in range(max(len(a), len(b))): + if i < len(a): + first.feed(a[i:i+1], i == len(a)-1) + if i < len(b): + second.feed(b[i:i+1], i == len(b)-1) + await asyncio.sleep(0) + assert await first_result == [b'abc', b''] + assert await second_result == [b'xyz123'] + asyncio.run(run()) + + +@pytest.mark.parametrize('data', [b'\x01', b'\x01\x00\x00\x00', b'\x02\x00\x00\x00x']) +def test_fin_requires_complete_length_and_message(data): + async def run(): + reader = StreamBuffer() + reader.feed(data, True) + with pytest.raises(InvalidJAMNPSMessage, match='truncated'): + await reader.read_all() + asyncio.run(run()) + + +def test_limits_abort_and_cancellation(): + async def run(): + reader = StreamBuffer(8) + reader.feed(b'x' * 9) + with pytest.raises(InvalidJAMNPSMessage, match='byte limit'): + await reader.read_message() + reader = StreamBuffer() + reader.feed((100).to_bytes(4, 'little')) + with pytest.raises(InvalidJAMNPSMessage, match='byte limit'): + await reader.read_message(maximum=10) + reader = StreamBuffer() + pending = asyncio.create_task(reader.read_message()) + await asyncio.sleep(0) + reader.abort(ConnectionError('reset')) + with pytest.raises(ConnectionError, match='reset'): + await pending + asyncio.run(run()) + + +def test_wire_codecs_match_pinned_tagged_proofs_and_requests(): + proof = (b'h' * 32, b'p' * 64, b's' * 1368) + wire = b'\0' + proof[0] + b'\1' + proof[1] + b'\2' + proof[2] + assert encode_justification(proof, 1368) == wire + assert decode_justification(wire, 1368) == proof + with pytest.raises(InvalidJAMNPSMessage): + decode_justification(wire[:-1], 1368) + with pytest.raises(InvalidJAMNPSMessage): + decode_justification(b'\x03') + request = b'r' * 32 + b'\x05\x00\x02\x01\x00\x02\x00' + assert encode_segment_request(b'r' * 32, 5, [1, 2]) == request + assert decode_segment_requests(request) == [(b'r' * 32, 5, (1, 2))] + assert decode_segment_indices(encode_segment_indices(b'r' * 32, [2, 1, 2])) == [(b'r' * 32, (2, 1, 2))] + proofs = ((b'h' * 32,), (), (b'j' * 32, b'k' * 32)) + assert decode_import_proofs(encode_import_proofs(proofs), 3) == proofs + with pytest.raises(InvalidJAMNPSMessage): + decode_segment_requests(b'r' * 32 + b'\0\0' + VarInt64.encode(6145).to_bytes()) + with pytest.raises(InvalidJAMNPSMessage): + decode_import_proofs(encode_import_proofs(proofs) + b'!', 3) + + +def test_real_quic_all_availability_streams_and_mutual_identity(tmp_path): + async def run(): + server, client, service, target, client_key = await nodes(tmp_path) + try: + spec = service.artifacts.spec + assert client.PROTOCOL_NAME == 'jamnp-s/1/67676767' + actual = await client.request_validator_shard(target, spec, 5) + assert actual == service.artifacts.shards[5] + chunk, proof = await client.request_audit_shard(target, spec, 4) + assert chunk == service.artifacts.shards[4].bundle_shard + for proven in [False, True]: + results = await client.request_segment_shards(target, spec, 3, [0, 2, 1], proven=proven) + assert [entry[0] for entry in results] == [service.artifacts.shards[3].segment_shards[i] for i in [0, 2, 1]] + assert all((entry[1] is not None) == proven for entry in results) + imports = await client.request_segments(target, spec.exports_root, [1, 0, 1]) + assert [entry.segment for entry in imports] == [service.exports[i] for i in [1, 0, 1]] + assert await client.request_bundle(target, spec) == service.bundle + assert service.seen_peers and set(service.seen_peers) == {client_key} + finally: + server.server.close() + asyncio.run(run()) + + +def test_real_quic_refuses_wrong_expected_peer_identity(tmp_path): + async def run(): + server, client, service, target, _ = await nodes(tmp_path) + try: + with pytest.raises(ConnectionError, match='expected validator'): + await client.request_bundle(replace(target, ed25519=bytes(32)), service.artifacts.spec) + assert not service.seen_peers + finally: + server.server.close() + asyncio.run(run()) + + +def test_real_quic_interleaved_requests_and_altered_proof(tmp_path): + async def run(): + server, client, service, target, _ = await nodes(tmp_path) + original = service.handle_request + try: + from aioquic.asyncio.client import connect + async with connect('127.0.0.1', target.get_metadata_port(), + configuration=client._configuration(is_client=True), + create_protocol=wrap_protocol(client, ClientProtocol, target.ed25519)) as protocol: + root = service.artifacts.spec.erasure_root + responses = await asyncio.gather(*(protocol.request(137, [root + index.to_bytes(2, 'little')]) for index in range(6))) + assert [response[0] for response in responses] == [row.bundle_shard for row in service.artifacts.shards] + async def altered(*args): + response = await original(*args) + response[2] = response[2][:-1] + bytes([response[2][-1] ^ 1]) + return response + service.handle_request = altered + with pytest.raises(ProcessWorkpackageError): + await client.request_validator_shard(target, service.artifacts.spec, 0) + finally: + server.server.close() + asyncio.run(run()) + + +def test_real_quic_staged_submission_authorizes_once_before_body(tmp_path): + async def run(): + server, client, service, target, client_key = await nodes(tmp_path) + try: + value = package() + encoded = value.to_jam_bytes().to_bytes() + assert await client.request(target, 133, [b'\x01\0' + encoded, b'extrinsics']) == [] + assert service.authorized == [(client_key, 1, value, {})] + assert service.completed == [(133, [b'extrinsics'])] + mappings = {b'p' * 32: b'r' * 32} + header = b'\x00\0\x01' + b'p' * 32 + b'r' * 32 + assert await client.request(target, 146, [header, encoded, b'e', b's', b'j']) == [] + assert service.authorized[-1] == (client_key, 0, value, mappings) + assert service.completed[-1] == (146, [b'e', b's', b'j']) + service.reject = True + with pytest.raises(ConnectionError): + await client.request(target, 133, [b'\0\0' + encoded, b'x' * (1024 * 1024)]) + assert len(service.completed) == 2 + finally: + server.server.close() + asyncio.run(run()) + + +def test_staged_quic_flow_credit_is_bounded_until_authorization(tmp_path): + async def run(): + from aioquic.asyncio.client import connect + server, client, service, target, _ = await nodes(tmp_path) + authorization_started, authorize = asyncio.Event(), asyncio.Event() + original = service.authorize_submission + async def gated(*args): + authorization_started.set() + await authorize.wait() + return await original(*args) + service.authorize_submission = gated + try: + async with connect('127.0.0.1', target.get_metadata_port(), + configuration=client._configuration(is_client=True), + create_protocol=wrap_protocol(client, ClientProtocol, target.ed25519)) as protocol: + value = package().to_jam_bytes().to_bytes() + body = b'x' * (2 * 1024 * 1024) + request = asyncio.create_task(protocol.request(133, [b'\0\0' + value, body])) + await asyncio.wait_for(authorization_started.wait(), 1) + await asyncio.sleep(0.05) + remote = next(iter(server.conn_in.values())) + reader = next(iter(remote.streams.values())) + assert reader.received <= MAX_PACKAGE_BYTES + 1024 + assert not service.completed + authorize.set() + assert await request == [] + assert service.completed == [(133, [body])] + finally: + authorize.set() + server.server.close() + asyncio.run(run()) + + +def test_real_quic_timeout_and_cancellation_reset_only_their_stream(tmp_path): + async def run(): + from aioquic.asyncio.client import connect + server, client, service, target, _ = await nodes(tmp_path) + entered, cancelled = asyncio.Event(), asyncio.Event() + original = service.handle_request + async def slow(peer_key, kind, messages): + if kind == 147: + entered.set() + try: + await asyncio.Event().wait() + finally: + cancelled.set() + return await original(peer_key, kind, messages) + service.handle_request = slow + try: + async with connect('127.0.0.1', target.get_metadata_port(), + configuration=client._configuration(is_client=True), + create_protocol=wrap_protocol(client, ClientProtocol, target.ed25519)) as protocol: + root = service.artifacts.spec.erasure_root + with pytest.raises(TimeoutError): + await protocol.request(147, [root], timeout=0.05) + await asyncio.wait_for(cancelled.wait(), 1) + entered.clear() + cancelled.clear() + pending = asyncio.create_task(protocol.request(147, [root])) + await asyncio.wait_for(entered.wait(), 1) + pending.cancel() + with pytest.raises(asyncio.CancelledError): + await pending + await asyncio.wait_for(cancelled.wait(), 1) + # The same authenticated connection remains usable. + response = await protocol.request(137, [root + b'\0\0']) + assert response[0] == service.artifacts.shards[0].bundle_shard + finally: + server.server.close() + asyncio.run(run()) + + +def test_real_quic_rejects_another_genesis_alpn(tmp_path): + async def run(): + server, client, service, target, _ = await nodes(tmp_path) + _, cert, key = identity(tmp_path, 'otherchain') + other = JAMNPS('127.0.0.1', 0, cert, key, application(Service()), genesis_hash=b'z' * 32) + try: + with pytest.raises(ConnectionError): + await other.request_bundle(target, service.artifacts.spec) + assert not service.seen_peers + finally: + server.server.close() + asyncio.run(run()) + + +def test_real_runtime_persisted_historical_sources_recover_import_over_quic(tmp_path): + """Six authenticated historical endpoints, real storage and H.6 recovery.""" + async def run(): + from pyjamaz.d3l import AvailabilitySource, DataAvailabilityStore + from pyjamaz.models.common import WorkReport + from pyjamaz.runtime.availability import AvailabilityRuntime + from pyjamaz.storage import FileStorageEngine + + nodes, peers, runtimes, apps = [], [], [], [] + registered = b'b' * 32 + exports = [(index + 1).to_bytes(4, 'little') * 1026 for index in range(65)] + bundle = b'original complete bundle' + artifacts = build_availability_artifacts(b'p' * 32, bundle, exports, 6) + report = WorkReport(artifacts.spec, package().context, 1, bytes(32), 0, b'', {}, []) + try: + for index in range(6): + public, cert, private = identity(tmp_path, 'historical' + str(index)) + directory = tmp_path / ('data' + str(index)) + directory.mkdir() + app = application(None) + app.d3l_store = DataAvailabilityStore(FileStorageEngine(str(directory))) + app.state_storage = SimpleNamespace(block_hash=registered, parents={registered: None}, + finalized_block_hash=None) + # The current set deliberately excludes every source participant. + app.working_state = SimpleNamespace(validator_pool=SimpleNamespace(validators=[])) + app.config = SimpleNamespace(keys=SimpleNamespace(ed25519=SimpleNamespace(public_key=public))) + runtime = AvailabilityRuntime(app) + app.runtime.availability = runtime + protocol = JAMNPS('127.0.0.1', 0, cert, private, app) + app.protocol = protocol + await protocol.listen() + port = protocol.server._transport.get_extra_info('sockname')[1] + nodes.append(protocol) + peers.append(peer(public, port)) + runtimes.append(runtime) + apps.append(app) + source = AvailabilitySource(report, peers, [peers[1]], registered, 1) + for index, app in enumerate(apps): + if index: + app.d3l_store.store_work_report(report, bundle, exports, artifacts=artifacts) + app.d3l_store.register_source(source) + # Reopen persisted records before any network request. + app.d3l_store = DataAvailabilityStore(FileStorageEngine(str(tmp_path / ('data' + str(index))))) + client, target, spec = nodes[0], peers[1], artifacts.spec + assert await client.request_validator_shard(target, spec, 2) == artifacts.shards[2] + audit, _ = await client.request_audit_shard(target, spec, 3) + assert audit == artifacts.shards[3].bundle_shard + chunks = await client.request_segment_shards(target, spec, 4, [64, 66], proven=True) + assert [chunk for chunk, _ in chunks] == [artifacts.shards[4].segment_shards[i] for i in [64, 66]] + await runtimes[1].handle_request(peers[0].ed25519, 148, [encode_segment_indices(spec.exports_root, [64])]) + assert (await client.request_segments(target, spec.exports_root, [64]))[0].segment == exports[64] + assert await client.request_bundle(target, spec) == bundle + await runtimes[0].acquire_assigned(source) + assert runtimes[0].assigned_ready(source) + assigned = runtimes[0].assigned_index(source) + assert apps[0].d3l_store.retrieve_validator_shard(spec, assigned) == artifacts.shards[assigned] + + calls = [] + for runtime in runtimes: + runtime.store.storage_engine.delete(spec.exports_root) + original = runtime.handle_request + async def alter_ordinary(key, kind, messages, handler=original): + calls.append((key, kind)) + response = await handler(key, kind, messages) + if kind == 139: + response[0] = bytes([response[0][0] ^ 1]) + response[0][1:] + return response + runtime.handle_request = alter_ordinary + imported = await runtimes[0].acquire_import(spec.exports_root, 64) + assert imported.segment == exports[64] + assert runtimes[0].store.retrieve_import(spec.exports_root, 64) == imported + assert {139, 140}.issubset({kind for _, kind in calls}) + assert {key for key, _ in calls} == {peers[0].ed25519} + assert all(not app.working_state.validator_pool.validators for app in apps) + for selector in (5, 6): + for index in (0, 1, 2, 64): + runtimes[0].store.storage_engine.delete(runtimes[0].store._import_key(spec.exports_root, index)) + await assert_quic_imports_reach_pvm(runtimes[0], client, source, exports, selector) + finally: + for node in nodes: + node.server.close() + asyncio.run(run()) + + +async def assert_quic_imports_reach_pvm(availability, protocol, source, exports, selector): + """Use real Psi_R/fetch, then compare Xi and B with a complete-export store.""" + from jamcodec.types import U32, Vec + from pyjamaz.d3l import DataAvailabilityStore + from pyjamaz.hashing import blake2b_256_hash + from pyjamaz.models.app import D3LEntry + from pyjamaz.models.common import ImportSegment, WorkItem, WorkPackage + from pyjamaz.models.state import PendingChanges, ServicesState + from pyjamaz.pvm.constants import Opcode + from pyjamaz.state.base import state_key_constructor_preimage, state_key_constructor_preimage_availability + from pyjamaz.state.storage import StateStorage + from pyjamaz.storage import InMemoryStorageEngine + from test.test_recovered_import_refine import load, pipeline, program_preimage + + source_hash, root = source.spec.hash, source.spec.exports_root + output_address = 2 * 2**16 + refine_code = program_preimage([ + load(7, output_address), load(8, 0), load(9, 4104), + load(10, selector), load(11, 1), load(12, 1), + bytes((Opcode.ecalli.value, 2)), + load(7, output_address), load(8, 4104), bytes((Opcode.jump_ind.value, 0)), + ], heap_pages=2) + auth_code = program_preimage([load(8, 0), bytes((Opcode.jump_ind.value, 0))]) + auth_hash, refine_hash = map(blake2b_256_hash, (auth_code, refine_code)) + state_engine = InMemoryStorageEngine() + for code_hash, preimage in ((auth_hash, auth_code), (refine_hash, refine_code)): + state_engine.put(state_key_constructor_preimage(0, code_hash), preimage) + state_engine.put(state_key_constructor_preimage_availability(0, code_hash, len(preimage)), + Vec(U32).encode([0]).to_bytes()) + services = ServicesState() + services.set_state_storage(StateStorage(state_engine)) + services.pending_changes = PendingChanges() + initial_state = state_engine.as_dict() + value = WorkPackage(0, auth_hash, source.report.context, b'', b'', [ + WorkItem(0, refine_hash, 1000, 1000, 0, b'', [ + ImportSegment.from_segment_root(root, 0), + ImportSegment.from_work_package_hash(source_hash, 1), + ], []), + WorkItem(0, refine_hash, 1000, 1000, 0, b'', [ + ImportSegment.from_segment_root(root, 2), + ImportSegment.from_work_package_hash(source_hash, 64), + ], []), + ]) + complete_store = DataAvailabilityStore(InMemoryStorageEngine()) + complete_store.store_segments(D3LEntry(root, exports)) + original_app = availability.app + + async def run(store, network=False): + execution = pipeline(services, store, source_hash, root) + if network: + execution.app.protocol = protocol + execution.app.state_storage = original_app.state_storage + execution.app.retrieve_block_header = original_app.retrieve_block_header + execution.app.runtime = SimpleNamespace(availability=availability) + availability.app = execution.app + execution.add_work_package(value, []) + item = execution._pending_work_packages[value.hash()] + await execution._refine_work_package(item) + assert item.status.Reported + assert [result.result.ok for result in item.work_report.results] == [ + exports[64] if selector == 5 else exports[1], exports[64], + ] + return item.work_report.to_jam_bytes().to_bytes(), store.storage_engine.get(b'bundle:' + value.hash()) + + try: + actual = await run(original_app.d3l_store, network=True) + assert actual == await run(complete_store) + assert state_engine.as_dict() == initial_state + assert services.state_storage.transaction == {} + finally: + availability.app = original_app + + +def test_canonical_bundle_client_uses_ce133_or_ce146_and_builder_alpn(tmp_path): + async def run(): + from pyjamaz.bundle import encode_bundle + from test.test_bundle_submission import bundle_case + server, client, service, target, _ = await nodes(tmp_path) + try: + value = package() + await client.submit_work_package_bundle(target, 1, encode_bundle(value, [], [], [])) + assert service.authorized[-1][1:3] == (1, value) + assert service.completed[-1] == (133, [b'']) + value, imports, proofs = bundle_case() + bundle = encode_bundle(value, [b'abc'], imports, proofs) + await client.submit_work_package_bundle(target, 0, bundle, {b'p' * 32: b'r' * 32}) + assert service.authorized[-1][1:] == (0, value, {b'p' * 32: b'r' * 32}) + assert service.completed[-1] == (146, [b'abc', b''.join(imports), encode_import_proofs(proofs)]) + finally: + server.server.close() + asyncio.run(run()) + + +def test_up0_header_announcements_and_ce128_keep_existing_block_subscriber(tmp_path): + async def run(): + from aioquic.asyncio.client import connect + from jamcodec.base import JamBytes + from jamcodec.decoding import decode_to_object + from jamcodec.types import Vec + from pyjamaz.models.block import Block, Extrinsic, Header + server, client, _, target, _ = await nodes(tmp_path) + blocks = [Block(Header.default(), Extrinsic.default()) for _ in range(3)] + for index, block in enumerate(blocks): + block.header.timeslot = index + if index: + block.header.parent = blocks[index - 1].header.hash + by_hash = {block.header.hash: block for block in blocks} + app = server.app + app.working_state = SimpleNamespace(timeslot=SimpleNamespace(number=2)) + app.retrieve_block_hash = lambda slot: blocks[slot].header.hash if 0 <= slot <= 2 else None + app.retrieve_block_by_hash = by_hash.get + app.retrieve_block_header = lambda block_hash: by_hash[block_hash].header if block_hash in by_hash else None + app.retrieve_finalized_head = lambda: blocks[0].header.hash + try: + async with connect('127.0.0.1', target.get_metadata_port(), + configuration=client._configuration(is_client=True), + create_protocol=wrap_protocol(client, ClientProtocol, target.ed25519)) as protocol: + await protocol.open_stream_up_0() + descending = await client.fetch_blocks(protocol, blocks[2].header.hash, 1, 2) + assert descending == [blocks[2], blocks[1]] + signal = await asyncio.wait_for(client.broadcaster.receive_stream.receive(), 1) + decoded = decode_to_object(Vec(Block.to_codec_def()), JamBytes(signal.data)) + assert decoded == descending + ascending = await client.fetch_blocks(protocol, blocks[0].header.hash, 0, 2) + assert ascending == blocks[1:] + await asyncio.wait_for(client.broadcaster.receive_stream.receive(), 1) + await server.broadcast_block(blocks[2]) + signal = await asyncio.wait_for(client.broadcaster.receive_stream.receive(), 1) + assert signal.topic == MESSAGE_TYPES.REQUESTED_BLOCKS + finally: + server.server.close() + asyncio.run(run()) diff --git a/test/test_local_availability_fixes.py b/test/test_local_availability_fixes.py new file mode 100644 index 00000000..f171f94d --- /dev/null +++ b/test/test_local_availability_fixes.py @@ -0,0 +1,194 @@ +"""Local availability lookup, bounded history repair and corrupt-cache behavior.""" + +import asyncio +from dataclasses import replace +from types import SimpleNamespace +from unittest.mock import Mock + +import pytest + +from pyjamaz.availability import DataUnavailable +from pyjamaz.constants import WELL_KNOWN_STORAGE_KEYS +from pyjamaz.d3l import AvailabilitySource, DataAvailabilityStore +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.models.app import D3LEntry +from pyjamaz.models.block import Header +from pyjamaz.runtime.availability import AvailabilityRuntime +from pyjamaz.storage import InMemoryStorageEngine +from test.test_availability_lifecycle import backfill_app, source_data + + +def local_runtime(source_data): + artifacts, report, validators, exports = source_data + registration = Header.default() + registration.timeslot = 1 + source = AvailabilitySource(report, validators, validators[:2], registration.hash, 1) + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.register_source(source) + app = SimpleNamespace( + d3l_store=store, + state_storage=SimpleNamespace(block_hash=None, finalized_block_hash=registration.hash, parents={}), + retrieve_block_header=lambda h: registration if h == registration.hash else None, + retrieve_block_by_hash=lambda _: None, + config=SimpleNamespace(keys=SimpleNamespace(ed25519=SimpleNamespace(public_key=validators[0].ed25519))), + ) + return AvailabilityRuntime(app), source, artifacts, exports + + +def test_restart_uses_retained_finalized_head_for_sources_and_assigned_data(source_data): + runtime, source, artifacts, _ = local_runtime(source_data) + runtime.store.store_validator_shard(source.spec, artifacts.shards[0]) + assert runtime.canonical(source.registered_block) + assert runtime.source_for(package_hash=source.spec.hash) == source + assert runtime.store.specification(source.spec.erasure_root, runtime.canonical) == source.spec + assert runtime.assigned_ready(source) + + +def test_trusted_finality_lineage_is_reused_until_next_confirmation(source_data): + runtime, source, _, _ = local_runtime(source_data) + assured = replace(source, assured_block=source.registered_block, assured_slot=1) + next_header = Header.default() + next_header.parent = source.registered_block + next_header.timeslot = 2 + original_lookup = runtime.app.retrieve_block_header + runtime.app.retrieve_block_header = lambda h: next_header if h == next_header.hash else original_lookup(h) + runtime._lineage = Mock(wraps=runtime._lineage) + runtime.on_finalized(source.registered_block) + for _ in range(100): + assert runtime._assurance_finalized(assured) + runtime._lineage.assert_called_once_with(source.registered_block) + + newly_assured = replace(source, assured_block=next_header.hash, assured_slot=2) + assert not runtime._assurance_finalized(newly_assured) + runtime.on_finalized(next_header.hash) + assert runtime._assurance_finalized(newly_assured) + assert runtime._lineage.call_count == 2 + runtime.on_finalized(source.registered_block) + assert runtime._availability_finalized_hash == next_header.hash + assert runtime._assurance_finalized(newly_assured) + assert runtime._lineage.call_count == 2 + + +def history_runtime(count): + def block_hash(number): + return number.to_bytes(32, 'little') + + calls = {'headers': 0, 'blocks': 0} + headers = {block_hash(i): SimpleNamespace(parent=block_hash(i - 1) if i else None, timeslot=i) + for i in range(count + 1)} + + def header(h): + calls['headers'] += 1 + return headers.get(h) + + def block(h): + calls['blocks'] += 1 + return None + + app = SimpleNamespace( + d3l_store=DataAvailabilityStore(InMemoryStorageEngine()), + state_storage=SimpleNamespace(block_hash=block_hash(count), finalized_block_hash=block_hash(0), parents={}), + retrieve_block_header=header, retrieve_block_by_hash=block, + ) + return AvailabilityRuntime(app), headers, calls, block_hash + + +def test_history_backfill_is_bounded_and_unknown_roots_do_not_restart_it(): + runtime, _, calls, _ = history_runtime(1000) + for _ in range(100): + before = dict(calls) + with pytest.raises(DataUnavailable): + runtime.source_for(exports_root=b'?' * 32) + # A new head and an older-ancestor batch each have their own small bound. + assert calls['headers'] - before['headers'] <= 2 * runtime.BACKFILL_BATCH_SIZE + assert calls['blocks'] - before['blocks'] <= runtime.BACKFILL_BATCH_SIZE + if runtime._canonical_cursor is None and not runtime._backfill_pending: + break + else: + pytest.fail('bounded backfill made no progress') + finished = dict(calls) + for _ in range(3): + with pytest.raises(DataUnavailable): + runtime.source_for(exports_root=b'?' * 32) + assert calls == finished + + +def test_extending_or_reorganizing_head_does_not_rescan_completed_history(): + runtime, headers, calls, h = history_runtime(300) + while True: + runtime._backfill_sources() + if runtime._canonical_cursor is None and not runtime._backfill_pending: + break + headers[h(301)] = SimpleNamespace(parent=h(300), timeslot=301) + runtime.app.state_storage.block_hash = h(301) + before = dict(calls) + runtime._backfill_sources() + assert calls['headers'] - before['headers'] == 1 + assert calls['blocks'] - before['blocks'] == 1 + assert runtime.canonical(h(0)) and runtime.canonical(h(301)) + + fork = b'f' * 32 + headers[fork] = SimpleNamespace(parent=h(299), timeslot=301) + runtime.app.state_storage.block_hash = fork + before = dict(calls) + runtime._backfill_sources() + assert calls['headers'] - before['headers'] == 1 + assert calls['blocks'] - before['blocks'] == 1 + assert runtime.canonical(fork) and runtime.canonical(h(299)) + assert not runtime.canonical(h(300)) and not runtime.canonical(h(301)) + + +def test_background_backfill_yields_between_batches(): + async def run(): + runtime, _, calls, h = history_runtime(1000) + runtime._backfill_wakeup.set() + task = asyncio.create_task(runtime._backfill_worker()) + previous = 0 + passes = 0 + try: + while passes < 100: + await asyncio.sleep(0) + passes += 1 + assert calls['blocks'] - previous <= runtime.BACKFILL_BATCH_SIZE + previous = calls['blocks'] + if runtime._canonical_cursor is None and not runtime._backfill_pending: + break + assert passes > 1 + assert calls['blocks'] == 1001 + assert runtime.canonical(h(0)) + finally: + task.cancel() + await asyncio.gather(task, return_exceptions=True) + + asyncio.run(run()) + + +def test_corrupt_complete_exports_remain_retryable(source_data): + runtime, source, _, exports = local_runtime(source_data) + runtime.store.store_segments(D3LEntry(source.spec.exports_root, [bytes(4104)])) + with pytest.raises(DataUnavailable, match='do not match'): + runtime._local_import(source.spec.exports_root, 0) + runtime.store.store_segments(D3LEntry(source.spec.exports_root, exports)) + assert runtime._local_import(source.spec.exports_root, 0).segment == exports[0] + + +def test_valid_complete_exports_still_reject_invalid_manifest_index(source_data): + runtime, source, _, exports = local_runtime(source_data) + runtime.store.store_segments(D3LEntry(source.spec.exports_root, exports)) + with pytest.raises(ProcessWorkpackageError, match='index out of range') as error: + runtime._local_import(source.spec.exports_root, 1) + assert not isinstance(error.value, DataUnavailable) + + +def test_restored_historical_state_repairs_source_without_changing_head(backfill_app): + app, registration, _, historical = backfill_app + runtime = app.runtime.availability + changes = app.state_storage.change_sets[registration.header.hash] + key = WELL_KNOWN_STORAGE_KEYS[6] + entropy = changes.pop(key) + package_hash = registration.extrinsic.guarantees[0].report.package_spec.hash + with pytest.raises(DataUnavailable): + runtime.source_for(package_hash=package_hash) + assert app.d3l_store.sources() == [] + changes[key] = entropy + assert runtime.source_for(package_hash=package_hash).validators == historical diff --git a/test/test_numba_gas_cache.py b/test/test_numba_gas_cache.py new file mode 100644 index 00000000..588923cd --- /dev/null +++ b/test/test_numba_gas_cache.py @@ -0,0 +1,106 @@ +import pytest + +from pyjamaz import settings + + +if not settings.PVM_INTERPRETER.startswith("NUMBA_"): + pytest.skip("Numba gas metadata cache", allow_module_level=True) + +from pyjamaz.pvm import PVMInterpreter, PVMMemory +from pyjamaz.pvm.constants import ExitReason, Opcode +from pyjamaz.pvm.gas_model import GasModel +from pyjamaz.pvm.interpreters.numba import interpreter_numba_jit +from pyjamaz.pvm.types import PVMCode, PVMProgram + + +@pytest.fixture(autouse=True) +def isolated_cache(monkeypatch): + monkeypatch.setattr(interpreter_numba_jit, "_CODE_METADATA_CACHE", {}) + + +@pytest.fixture +def gas_calculations(monkeypatch): + calls = [] + original = GasModel.compute_block_gas_cost + + def compute(self, start, *args, **kwargs): + calls.append(start) + return original(self, start, *args, **kwargs) + + monkeypatch.setattr(GasModel, "compute_block_gas_cost", compute) + return calls + + +def code(*opcodes): + return PVMCode(0, 0, len(opcodes), [], list(opcodes), [True] * len(opcodes)) + + +def vm(program_code): + return PVMInterpreter(PVMProgram(program_code, [0] * 13, PVMMemory())) + + +def test_reused_code_calculates_gas_once_but_charges_each_vm(gas_calculations): + program_code = code(Opcode.trap.value) + first = vm(program_code) + cost = first.basic_block_gas[0] + first.invoke(0, cost) + assert first.status == ExitReason.panic.value + assert first.gas == 0 + + second = vm(program_code) + assert second.current_block_start == -1 + second.invoke(0, cost + 3) + assert second.status == ExitReason.panic.value + assert second.gas == 3 + + insufficient = vm(program_code) + insufficient.invoke(0, cost - 1) + assert insufficient.status == ExitReason.out_of_gas.value + assert insufficient.gas == cost - 1 + assert gas_calculations == [0] + + +def test_instance_mutations_do_not_corrupt_cached_gas(gas_calculations): + program_code = code(Opcode.trap.value) + first = vm(program_code) + cost = first.basic_block_gas[0] + first.basic_block_gas[0] = 999 + first.basic_block_starts_sorted[0] = 99 + first.block_starts_array[0] = 99 + first.block_gas_costs_array[0] = 999 + first.gas_model.sim_code = b"\xff" + first.current_block_start = 0 + + second = vm(program_code) + assert second.basic_block_gas == {0: cost} + assert second.basic_block_starts_sorted == [0] + assert second.block_starts_array.tolist() == [0] + assert second.block_gas_costs_array.tolist() == [cost] + second.invoke(0, cost) + assert second.status == ExitReason.panic.value + assert second.gas == 0 + assert gas_calculations == [0] + + +def test_different_code_uses_its_own_gas_cost(gas_calculations): + first = vm(code(Opcode.trap.value)) + second = vm(code(Opcode.unlikely.value, Opcode.trap.value)) + assert second.basic_block_gas[0] > first.basic_block_gas[0] + second.invoke(0, first.basic_block_gas[0]) + assert second.status == ExitReason.out_of_gas.value + assert gas_calculations == [0, 0] + + +@pytest.mark.parametrize("opcodes", [(), (255,), (Opcode.unlikely.value,)]) +def test_invalid_code_panics_without_gas_calculation_on_cache_hit(opcodes, gas_calculations): + program_code = code(*opcodes) + for _ in range(2): + interpreter = vm(program_code) + assert not interpreter.code_valid + assert interpreter.basic_block_gas == {} + assert interpreter.block_starts_array.size == 0 + assert interpreter.block_gas_costs_array.size == 0 + interpreter.invoke(0, 100) + assert interpreter.status == ExitReason.panic.value + assert interpreter.gas == 100 + assert gas_calculations == [] diff --git a/test/test_numba_paid_block.py b/test/test_numba_paid_block.py new file mode 100644 index 00000000..31487f6d --- /dev/null +++ b/test/test_numba_paid_block.py @@ -0,0 +1,131 @@ +"""Block lookup shortcuts must preserve gas charging and saved block state.""" + +import pytest + +from pyjamaz import settings + +if not settings.PVM_INTERPRETER.startswith("NUMBA_"): + pytest.skip("Numba basic-block gas charging", allow_module_level=True) + +from pyjamaz.pvm import PVMInterpreter, PVMMemory +from pyjamaz.pvm.constants import ExitReason, Opcode +from pyjamaz.pvm.types import PVMCode, PVMProgram + + +def make_vm(instructions): + code = [byte for instruction in instructions for byte in instruction] + bitmask = [ + flag + for instruction in instructions + for flag in [True] + [False] * (len(instruction) - 1) + ] + program = PVMProgram(PVMCode(0, 0, len(code), [], code, bitmask), [0] * 13, PVMMemory()) + return PVMInterpreter(program) + + +@pytest.mark.parametrize("taken", [False, True]) +@pytest.mark.parametrize("extra_gas", [-1, 0, 7]) +def test_conditional_branch_charges_the_visited_destination(taken, extra_gas): + # PC 2 branches to PC 10; the other path starts at PC 6. + vm = make_vm([ + [Opcode.unlikely.value], + [Opcode.unlikely.value], + [Opcode.branch_eq_imm.value, 0x17, 1, 8], + [Opcode.load_imm.value, 8, 11], + [Opcode.trap.value], + [Opcode.unlikely.value], + [Opcode.trap.value], + ]) + vm.reg[7] = int(taken) + destination = 10 if taken else 6 + destination_cost = vm.basic_block_gas[destination] + vm.invoke(0, vm.basic_block_gas[0] + destination_cost + extra_gas) + + if extra_gas < 0: + assert vm.status == ExitReason.out_of_gas.value + assert vm.pc == destination + assert vm.gas == destination_cost - 1 + assert vm.current_block_start == -1 + assert vm.inst_nr == 3 + # An unpaid destination is charged normally when execution resumes. + vm.invoke(destination, destination_cost + 7) + extra_gas = 7 + + assert vm.status == ExitReason.panic.value + assert vm.pc == (11 if taken else 9) + assert vm.gas == extra_gas + assert vm.current_block_start == destination + assert vm.reg[8] == (0 if taken else 11) + + +def test_backward_jump_charges_each_loop_iteration(): + vm = make_vm([[Opcode.unlikely.value], [Opcode.jump.value, 255]]) + cost = vm.basic_block_gas[0] + + vm.invoke(0, 4 * cost - 1) + + assert vm.status == ExitReason.out_of_gas.value + assert vm.pc == 0 + assert vm.gas == cost - 1 + assert vm.inst_nr == 6 + assert vm.current_block_start == -1 + + +@pytest.mark.parametrize("offset", [1, 255]) +def test_paid_block_still_rejects_invalid_jump_destinations(offset): + # PC 2 targets either its operand at PC 3 or a non-block-start at PC 1. + vm = make_vm([ + [Opcode.unlikely.value], + [Opcode.unlikely.value], + [Opcode.jump.value, offset], + [Opcode.trap.value], + ]) + + vm.invoke(0, vm.basic_block_gas[0] + 7) + + assert vm.status == ExitReason.panic.value + assert vm.pc == 2 + assert vm.gas == 7 + assert vm.inst_nr == 3 + assert vm.current_block_start == 0 + + +@pytest.mark.parametrize("restore_paid_state", [False, True]) +def test_paid_external_entry_refreshes_the_exact_block_start(restore_paid_state): + prefix = [[Opcode.ecalli.value, 7], [Opcode.fallthrough.value]] + prefix += [[Opcode.unlikely.value], [Opcode.fallthrough.value]] * 8 + late_block_start = 19 + vm = make_vm(prefix + [[Opcode.unlikely.value], [Opcode.trap.value]]) + if restore_paid_state: + vm.gas_paid = True + else: + vm.invoke(0, vm.basic_block_gas[0] + 7) + assert vm.status == ExitReason.host_halt.value + assert vm.current_block_start == 0 + + vm.invoke(late_block_start + 1, 7) + + assert vm.status == ExitReason.panic.value + assert vm.pc == late_block_start + 1 + assert vm.gas == 7 + assert vm.current_block_start == late_block_start + + +@pytest.mark.parametrize("invalid_pc", [1, 4, 2**32 - 1]) +def test_invalid_resume_pc_preserves_paid_block_state(invalid_pc): + vm = make_vm([ + [Opcode.ecalli.value, 7], + [Opcode.unlikely.value], + [Opcode.trap.value], + ]) + vm.invoke(0, vm.basic_block_gas[0] + 7) + assert vm.status == ExitReason.host_halt.value + assert vm.current_block_start == 0 + + vm.invoke(invalid_pc, 7) + + assert vm.status == ExitReason.panic.value + assert vm.pc == invalid_pc + assert vm.gas == 7 + assert vm.inst_nr == 1 + assert vm.current_block_start == 0 diff --git a/test/test_peer_availability.py b/test/test_peer_availability.py new file mode 100644 index 00000000..84191e3b --- /dev/null +++ b/test/test_peer_availability.py @@ -0,0 +1,361 @@ +"""Peer acquisition uses retained source metadata and authenticates recovered imports.""" + +import asyncio +from dataclasses import replace +from types import SimpleNamespace + +import pytest +from jamcodec.types import U32, Vec + +from pyjamaz import erasure +from pyjamaz.availability import ( + DataUnavailable, ImportedSegment, build_availability_artifacts, segment_shard_justification, +) +from pyjamaz.d3l import AvailabilitySource, DataAvailabilityStore +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, valid_validator_count +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.app import D3LEntry +from pyjamaz.models.common import ImportSegment, ValidatorData, WorkItem, WorkPackage, WorkReport +from pyjamaz.models.state import PendingChanges, ServicesState +from pyjamaz.pvm.constants import Opcode +from pyjamaz.runtime.availability import AvailabilityRuntime +from pyjamaz.state.base import state_key_constructor_preimage, state_key_constructor_preimage_availability +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine +from test.test_recovered_import_refine import load, pipeline, program_preimage +from test.test_runtime_refinement import package + + +def validators(count, offset=0): + return [ValidatorData(bytes(32), (index + offset).to_bytes(32, 'little'), bytes(144), bytes(128)) + for index in range(count)] + + +class SourceProtocol: + """A source that returns real H/E artifacts through the transport's decoded API.""" + + def __init__(self, source, artifacts, exports): + self.source, self.artifacts, self.exports = source, artifacts, exports + self.calls = [] + self.complete = False + self.corrupt_ordinary = False + + async def request_segments(self, peer, root, indices): + self.calls.append(('complete', peer.ed25519, root, tuple(indices))) + if not self.complete: + raise DataUnavailable('complete exports not retained') + tree = ConstantDepthMerkleTree(self.exports) + return [ImportedSegment(self.exports[index], tuple(tree.trace(index))) for index in indices] + + async def request_segment_shards(self, peer, spec, shard_index, indices, *, proven): + self.calls.append(('coded', peer.ed25519, spec, shard_index, tuple(indices), proven)) + row = self.artifacts.shards[shard_index] + values = [(row.segment_shards[index], segment_shard_justification(row, index) if proven else ()) + for index in indices] + if self.corrupt_ordinary and not proven: + return [(bytes([chunk[0] ^ 1]) + chunk[1:], proof) for chunk, proof in values] + return values + + async def request_validator_shard(self, peer, spec, index): + self.calls.append(('assigned', peer.ed25519, spec, index)) + return self.artifacts.shards[index] + + +@pytest.fixture +def peer_runtime(monkeypatch): + # Exercise historical 9-validator reports even under the Tiny node profile. + monkeypatch.setattr(erasure, 'valid_validator_count', + lambda count: valid_validator_count(count, core_count=341)) + + def make(*, validator_count=6, export_count=65): + exports = [(index + 1).to_bytes(4, 'little') * (EC_SEGMENT_SIZE // 4) + for index in range(export_count)] + artifacts = build_availability_artifacts(b'p' * 32, b'source bundle', exports, validator_count) + report = WorkReport(artifacts.spec, package().context, 1, bytes(32), 0, b'', {}, []) + original = validators(validator_count) + source = AvailabilitySource(report, original, original[:2], b'b' * 32, 1) + store = DataAvailabilityStore(InMemoryStorageEngine()) + store.register_source(source) + protocol = SourceProtocol(source, artifacts, exports) + active = {source.registered_block} + app = SimpleNamespace( + d3l_store=store, protocol=protocol, + state_storage=SimpleNamespace(block_hash=source.registered_block), + working_state=SimpleNamespace(validator_pool=SimpleNamespace(validators=validators(6, 100))), + config=SimpleNamespace(keys=SimpleNamespace(ed25519=SimpleNamespace(public_key=original[2].ed25519))), + ) + runtime = AvailabilityRuntime(app) + runtime.canonical = active.__contains__ + return SimpleNamespace(runtime=runtime, source=source, artifacts=artifacts, exports=exports, + protocol=protocol, store=store, active=active, app=app) + + return make + + +def test_complete_segments_are_verified_before_caching_and_coded_requests(peer_runtime): + case = peer_runtime() + original = case.protocol.request_segments + case.protocol.complete = True + + async def request(peer, *args): + values = await original(peer, *args) + if peer == case.source.guarantors[0]: + return [replace(values[0], segment=bytes(EC_SEGMENT_SIZE))] + return values + + case.protocol.request_segments = request + imported = asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 64)) + assert imported.segment == case.exports[64] + assert case.store.retrieve_import(case.source.spec.exports_root, 64) == imported + assert [call[0] for call in case.protocol.calls] == ['complete', 'complete'] + + +def test_bad_ordinary_chunks_retry_proven_historical_set_and_page_index(peer_runtime): + case = peer_runtime(validator_count=9) + case.protocol.corrupt_ordinary = True + imported = asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 64)) + assert imported.segment == case.exports[64] + coded = [call for call in case.protocol.calls if call[0] == 'coded'] + assert {call[5] for call in coded} == {False, True} + for _, peer, spec, shard_index, indices, _ in coded: + assert spec.erasure_shards == 9 + assert indices == (64, 66) + owner = (shard_index - case.source.report.core_index * erasure.erasure_data_shards(9)) % 9 + assert peer == case.source.validators[owner].ed25519 + assert peer not in {validator.ed25519 for validator in case.app.working_state.validator_pool.validators} + + +def test_insufficient_data_is_retryable_without_storing_unverified_imports(peer_runtime): + case = peer_runtime() + original = case.protocol.request_segment_shards + + async def unavailable(*args, **kwargs): + raise ConnectionError('peer disconnected') + + case.protocol.request_segment_shards = unavailable + with pytest.raises(DataUnavailable, match='not enough'): + asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 0)) + with pytest.raises(DataUnavailable): + case.store.retrieve_import(case.source.spec.exports_root, 0) + case.protocol.request_segment_shards = original + assert asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 0)).segment == case.exports[0] + + +def test_peer_timeouts_remain_retryable_and_cancel_transport_work(peer_runtime): + case = peer_runtime() + case.runtime.REQUEST_TIMEOUT = .01 + cancelled = 0 + + async def request(*args, **kwargs): + nonlocal cancelled + try: + await asyncio.Event().wait() + except asyncio.CancelledError: + cancelled += 1 + raise + + case.protocol.request_segment_shards = request + with pytest.raises(DataUnavailable, match='not enough'): + asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 0)) + # One bounded pass for CE139 and one for CE140, with no task left behind. + assert cancelled == 2 * case.source.spec.erasure_shards + assert case.store._active_roots == {} + + +def test_altered_individual_proof_is_discarded_in_proven_retry(peer_runtime): + case = peer_runtime() + case.protocol.corrupt_ordinary = True + original = case.protocol.request_segment_shards + + async def request(*args, **kwargs): + values = await original(*args, **kwargs) + if args[2] == 0 and kwargs['proven']: + return [(chunk, proof[:-1] + (bytes(len(proof[-1])),)) for chunk, proof in values] + return values + + case.protocol.request_segment_shards = request + imported = asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 1)) + assert imported.segment == case.exports[1] + assert case.store.retrieve_import(case.source.spec.exports_root, 1) == imported + + +def test_proven_inconsistent_source_commitment_is_rejected_without_a_judgment(peer_runtime): + case = peer_runtime() + # A guaranteed report may commit to incompatible erasure and export roots. + bad_spec = replace(case.source.spec, exports_root=b'!' * 32) + bad_source = replace(case.source, report=replace(case.source.report, package_spec=bad_spec)) + case.store.register_source(bad_source) + with pytest.raises(ProcessWorkpackageError, match='proven shards contradict'): + asyncio.run(case.runtime.acquire_import(bad_spec.exports_root, 0)) + with pytest.raises(DataUnavailable): + case.store.retrieve_import(bad_spec.exports_root, 0) + + +def test_branch_change_during_recovery_does_not_publish_import(peer_runtime): + case = peer_runtime() + original = case.protocol.request_segment_shards + + async def reorg(*args, **kwargs): + values = await original(*args, **kwargs) + case.active.clear() + return values + + case.protocol.request_segment_shards = reorg + with pytest.raises(DataUnavailable, match='branch changed'): + asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 0)) + with pytest.raises(DataUnavailable): + case.store.retrieve_import(case.source.spec.exports_root, 0) + assert case.store._active_roots == {} + + +@pytest.mark.parametrize('proven', [False, True]) +def test_package_acquisition_deduplicates_imports_and_reuses_pages(peer_runtime, proven): + case = peer_runtime() + case.protocol.corrupt_ordinary = proven + root, source_hash = case.source.spec.exports_root, case.source.spec.hash + value = package(imports=[ImportSegment.from_segment_root(root, 0), + ImportSegment.from_work_package_hash(source_hash, 1), + ImportSegment.from_segment_root(root, 0)]) + asyncio.run(case.runtime.acquire_package_imports(value, {source_hash: root})) + complete = [call for call in case.protocol.calls if call[0] == 'complete'] + assert [call[3] for call in complete] == [(0,), (0,), (1,), (1,)] + requests = [call for call in case.protocol.calls if call[0] == 'coded' and call[5] == proven] + assert any(call[4] == (0, 65) for call in requests) + assert any(call[4] == (1,) for call in requests) + assert not any(call[4] == (1, 65) for call in requests) + assert case.store.retrieve_import(root, 0).segment == case.exports[0] + assert case.store.retrieve_import(root, 1).segment == case.exports[1] + + +def test_coded_acquisition_bounds_tasks_and_cancels_surplus(peer_runtime): + case = peer_runtime() + original = case.protocol.request_segment_shards + live = maximum = cancelled = 0 + + async def request(*args, **kwargs): + nonlocal live, maximum, cancelled + live += 1 + maximum = max(maximum, live) + try: + if args[2] == 3: + await asyncio.Event().wait() + await asyncio.sleep(0) + return await original(*args, **kwargs) + except asyncio.CancelledError: + cancelled += 1 + raise + finally: + live -= 1 + + case.protocol.request_segment_shards = request + imported = asyncio.run(case.runtime.acquire_import(case.source.spec.exports_root, 0)) + assert imported.segment == case.exports[0] + assert maximum == 4 and live == 0 and cancelled == 1 + assert case.store._active_roots == {} + + +def test_cancelling_acquisition_cancels_requests_and_releases_retention_hold(peer_runtime): + case = peer_runtime() + started = asyncio.Event() + live = cancelled = 0 + + async def request(*args, **kwargs): + nonlocal live, cancelled + live += 1 + if live == 4: + started.set() + try: + await asyncio.Event().wait() + except asyncio.CancelledError: + cancelled += 1 + raise + finally: + live -= 1 + + case.protocol.request_segment_shards = request + + async def run(): + task = asyncio.create_task(case.runtime.acquire_import(case.source.spec.exports_root, 0)) + await asyncio.wait_for(started.wait(), 1) + task.cancel() + with pytest.raises(asyncio.CancelledError): + await task + + asyncio.run(run()) + assert cancelled == 4 and live == 0 + assert case.store._active_roots == {} + + +def test_assigned_acquisition_rejects_valid_row_for_another_index(peer_runtime): + case = peer_runtime() + requested = case.runtime.assigned_index(case.source) + assert requested == 5 # (core 1 * D(6) + validator 2) mod 6. + original = case.protocol.request_validator_shard + + async def request(peer, spec, index): + row = await original(peer, spec, index) + return case.artifacts.shards[0] if peer == case.source.guarantors[0] else row + + case.protocol.request_validator_shard = request + asyncio.run(case.runtime.acquire_assigned(case.source)) + assert case.runtime.assigned_ready(case.source) + assert len(case.protocol.calls) == 2 + + +@pytest.mark.parametrize('selector', [5, 6]) +def test_peer_imports_reach_real_pvm_fetch_and_match_complete_exports(peer_runtime, selector): + case = peer_runtime() + case.protocol.corrupt_ordinary = True + source_hash, root = case.source.spec.hash, case.source.spec.exports_root + output_address = 2 * 2**16 + refine_code = program_preimage([ + load(7, output_address), load(8, 0), load(9, EC_SEGMENT_SIZE), + load(10, selector), load(11, 1), load(12, 1), + bytes((Opcode.ecalli.value, 2)), + load(7, output_address), load(8, EC_SEGMENT_SIZE), bytes((Opcode.jump_ind.value, 0)), + ], heap_pages=2) + auth_code = program_preimage([load(8, 0), bytes((Opcode.jump_ind.value, 0))]) + auth_hash, refine_hash = map(blake2b_256_hash, (auth_code, refine_code)) + state_engine = InMemoryStorageEngine() + for code_hash, preimage in ((auth_hash, auth_code), (refine_hash, refine_code)): + state_engine.put(state_key_constructor_preimage(0, code_hash), preimage) + state_engine.put(state_key_constructor_preimage_availability(0, code_hash, len(preimage)), + Vec(U32).encode([0]).to_bytes()) + services = ServicesState() + services.set_state_storage(StateStorage(state_engine)) + services.pending_changes = PendingChanges() + initial_state = state_engine.as_dict() + value = WorkPackage(0, auth_hash, package().context, b'', b'', [ + WorkItem(0, refine_hash, 1000, 1000, 0, b'', [ + ImportSegment.from_segment_root(root, 0), + ImportSegment.from_work_package_hash(source_hash, 1), + ], []), + WorkItem(0, refine_hash, 1000, 1000, 0, b'', [ + ImportSegment.from_segment_root(root, 2), + ImportSegment.from_work_package_hash(source_hash, 64), + ], []), + ]) + complete_store = DataAvailabilityStore(InMemoryStorageEngine()) + complete_store.store_segments(D3LEntry(root, case.exports)) + + async def run(store, peer=False): + execution = pipeline(services, store, source_hash, root) + if peer: + execution.app.protocol = case.protocol + case.runtime.app = execution.app + execution.app.runtime = SimpleNamespace(availability=case.runtime) + execution.add_work_package(value, []) + item = execution._pending_work_packages[value.hash()] + await execution._refine_work_package(item) + assert item.status.Reported + assert [result.result.ok for result in item.work_report.results] == [ + case.exports[64] if selector == 5 else case.exports[1], case.exports[64], + ] + return item.work_report.to_jam_bytes().to_bytes(), store.storage_engine.get(b'bundle:' + value.hash()) + + assert asyncio.run(run(case.store, peer=True)) == asyncio.run(run(complete_store)) + assert any(call[0] == 'coded' and call[5] for call in case.protocol.calls) + assert state_engine.as_dict() == initial_state + assert services.state_storage.transaction == {} diff --git a/test/test_recovered_import_refine.py b/test/test_recovered_import_refine.py new file mode 100644 index 00000000..d9631420 --- /dev/null +++ b/test/test_recovered_import_refine.py @@ -0,0 +1,139 @@ +"""Recover imports locally, then consume them through the real refine PVM.""" + +import asyncio +from types import SimpleNamespace + +import pytest +from jamcodec.types import Bytes, U32, Vec + +from pyjamaz.availability import availability_spec, paged_proof_segments, recover_import +from pyjamaz.d3l import DataAvailabilityStore +from pyjamaz.erasure import encode_blob, erasure_data_shards +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.app import D3LEntry +from pyjamaz.models.common import Credential, ImportSegment, RefinementContext, WorkItem, WorkPackage +from pyjamaz.models.state import PendingChanges, ServicesState +from pyjamaz.pvm.constants import Opcode +from pyjamaz.pvm.types import PVMCode +from pyjamaz.runtime.pipelines.refine import RefinePipeline +from pyjamaz.state.base import state_key_constructor_preimage, state_key_constructor_preimage_availability +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + + +def load(register, value): + return bytes((Opcode.load_imm.value, register)) + value.to_bytes(4, 'little') + + +def program_preimage(instructions, heap_pages=0): + raw = b''.join(instructions) + starts = [bit for instruction in instructions + for bit in [True] + [False] * (len(instruction) - 1)] + code = PVMCode(0, 0, len(raw), [], raw, starts).to_jam_bytes().to_bytes() + # GP-0.8.0-eq:A.42: no initial data, z heap pages and one stack page. + return (Bytes.encode(b'').to_bytes() + bytes(6) + heap_pages.to_bytes(2, 'little') + + (4096).to_bytes(3, 'little') + len(code).to_bytes(4, 'little') + code) + + +def pipeline(services, store, source_hash, exports_root): + app = SimpleNamespace( + working_state=SimpleNamespace( + services=services, state_root=b's' * 32, timeslot=SimpleNamespace(number=1), + validator_pool=SimpleNamespace(validators=[SimpleNamespace(ed25519=bytes([i]) * 32) + for i in range(6)]), + recent_history=SimpleNamespace(recent_blocks=[SimpleNamespace( + reported=[SimpleNamespace(hash=source_hash, exports_root=exports_root)], + )]), + ), + d3l_store=store, pubsub=None, get_core_assigment=lambda: 0, + retrieve_block_hash=lambda _: b'h' * 32, + block_context=SimpleNamespace(guarantor_assignments=[]), + config=SimpleNamespace(keys=SimpleNamespace(ed25519=SimpleNamespace(public_key=bytes(32)))), + ) + + async def sign(report): + return Credential(0, bytes(64)) + + app.create_guarantee_signature = sign + return RefinePipeline(app) + + +@pytest.mark.parametrize('selector', [5, 6]) +@pytest.mark.parametrize('proof_route', ['direct', 'page']) +def test_recovered_imports_match_complete_exports_in_real_refine(selector, proof_route): + validator_count = 6 + source_hash = b'p' * 32 + exports = [index.to_bytes(4, 'little') * (EC_SEGMENT_SIZE // 4) for index in range(65)] + tree = ConstantDepthMerkleTree(exports) + spec = availability_spec(source_hash, b'source bundle', exports, validator_count) + pages = paged_proof_segments(exports) + complete_store = DataAvailabilityStore(InMemoryStorageEngine()) + complete_store.store_segments(D3LEntry(spec.exports_root, exports)) + recovered_store = DataAvailabilityStore(InMemoryStorageEngine()) + + def parity_shards(data): + shards = encode_blob(validator_count, data) + return {index: shards[index] for index in range(erasure_data_shards(validator_count), validator_count)} + + for index in (0, 1, 2, 64): + proof = ({'justification': tree.trace(index)} if proof_route == 'direct' else + {'proof_page_shards': parity_shards(pages[index // 64])}) + imported = recover_import(spec, index, parity_shards(exports[index]), **proof) + recovered_store.store_import(spec.exports_root, index, imported) + # Only individual imports were retained, without a complete export set or root mapping. + assert recovered_store.storage_engine.get(spec.exports_root) is None + assert recovered_store.storage_engine.get(b'package-root:' + source_hash) is None + + output_address = 2 * 2**16 + # GP-0.8.0-sec:B.5 fetch: selector 5 reads another item's segment; + # selector 6 reads the current item's segment. Both return import index 1. + refine_code = program_preimage([ + load(7, output_address), load(8, 0), load(9, EC_SEGMENT_SIZE), + load(10, selector), load(11, 1), load(12, 1), + bytes((Opcode.ecalli.value, 2)), + load(7, output_address), load(8, EC_SEGMENT_SIZE), bytes((Opcode.jump_ind.value, 0)), + ], heap_pages=2) + auth_code = program_preimage([load(8, 0), bytes((Opcode.jump_ind.value, 0))]) + auth_hash, refine_hash = map(blake2b_256_hash, (auth_code, refine_code)) + state_engine = InMemoryStorageEngine() + for code_hash, preimage in ((auth_hash, auth_code), (refine_hash, refine_code)): + state_engine.put(state_key_constructor_preimage(0, code_hash), preimage) + state_engine.put(state_key_constructor_preimage_availability(0, code_hash, len(preimage)), + Vec(U32).encode([0]).to_bytes()) + services = ServicesState(services={}) + services.set_state_storage(StateStorage(state_engine)) + services.pending_changes = PendingChanges() + package = WorkPackage(0, auth_hash, RefinementContext( + bytes(32), bytes(32), bytes(32), bytes(32), 0, [], + ), b'', b'', [ + WorkItem(0, refine_hash, 1000, 1000, 0, b'', [ + ImportSegment.from_segment_root(spec.exports_root, 0), + ImportSegment.from_work_package_hash(source_hash, 1), + ], []), + WorkItem(0, refine_hash, 1000, 1000, 0, b'', [ + ImportSegment.from_segment_root(spec.exports_root, 2), + ImportSegment.from_work_package_hash(source_hash, 64), + ], []), + ]) + initial_state = state_engine.as_dict() + + async def run(store): + runtime = pipeline(services, store, source_hash, spec.exports_root) + runtime.add_work_package(package, []) + item = runtime._pending_work_packages[package.hash()] + await runtime._refine_work_package(item) + assert item.status.Reported + report = item.work_report + assert report.auth_output == b'' and report.auth_gas_used > 0 + assert all(result.refine_load.gas_used > 0 for result in report.results) + assert [result.result.ok for result in report.results] == [ + exports[64] if selector == 5 else exports[1], exports[64], + ] + assert report.segment_root_lookup == {source_hash: spec.exports_root} + return report.to_jam_bytes().to_bytes(), store.storage_engine.get(b'bundle:' + package.hash()) + + assert asyncio.run(run(recovered_store)) == asyncio.run(run(complete_store)) + assert state_engine.as_dict() == initial_state + assert services.state_storage.transaction == {} diff --git a/test/test_refinement_json_import.py b/test/test_refinement_json_import.py new file mode 100644 index 00000000..40a88692 --- /dev/null +++ b/test/test_refinement_json_import.py @@ -0,0 +1,188 @@ +"""JSON adaptation preserves the reference oracle and malformed execution inputs.""" + +import asyncio +import json + +import pytest +from jamcodec.base import JamBytes +from jamcodec.types import H256, U32, Vec + +from pyjamaz.fuzzer.refinement_vectors import import_refinement_vector, load_refinement_vector +from pyjamaz.fuzzer.v1.types import FuzzerMessage, InitializeMessage, RefineBundle +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.models.app import TraceGenesis +from pyjamaz.models.common import ( + ImportSegment, RefinementContext, WorkDigest, WorkExecResult, WorkItem, + WorkItemExtrinsic, WorkPackage, WorkPackageSpec, WorkReport, +) +from pyjamaz.models.state import ServiceAccount, STORAGE_KEY_MAPPING, TimeslotState +from pyjamaz.state.base import ( + state_key_constructor_preimage, state_key_constructor_preimage_availability, + state_key_constructor_service_account, +) + + +@pytest.fixture +def vector(tmp_path): + code = b'reference service code' + code_hash = blake2b_256_hash(code) + context = RefinementContext( + b'a' * 32, b's' * 32, bytes(32), b'l' * 32, 7, [], + anchor_slot=9, lookup_anchor_state_root=b'k' * 32, + ) + item = WorkItem(1000, code_hash, 1000, 1000, 0, b'input', [], []) + package = WorkPackage(0, code_hash, context, b'authorization', b'config', [item]) + # Deliberately disagree with locally computed authorization/hash: adaptation + # must preserve the supplied oracle, never manufacture a passing report. + expected = WorkReport( + WorkPackageSpec(b'p' * 32, 123, b'e' * 32, b'x' * 32, 0, erasure_shards=6), + context, 1, b'h' * 32, 123456, b'expected auth', {}, + [WorkDigest.from_work_item(item, WorkExecResult(ok=b'reference result'), 123)], + ) + availability_key = state_key_constructor_preimage_availability(1000, code_hash, len(code)) + availability_value = Vec(U32).encode([0]).to_bytes() + data = { + 'name': 'reference-test', + 'core_idx': 1, + 'services': {'1000': { + 'service': { + 'code_hash': '0x' + code_hash.hex(), 'balance': 999999, + 'min_item_gas': 123, 'min_memo_gas': 456, 'bytes': 777, + 'items': 2, 'deposit_offset': 12, 'creation_slot': 1, + 'last_accumulation_slot': 2, 'parent_service': 42, + }, + 'data': [{'key': '0x' + availability_key.hex(), + 'value': '0x' + availability_value.hex()}], + 'preimage_blobs': [{'hash': '0x' + code_hash.hex(), 'blob': '0x' + code.hex()}], + }}, + 'work_package': package.to_json(), + 'bundle': '0x' + package.to_jam_bytes().to_bytes().hex(), + 'expected': {'work_report': expected.to_json(), 'exported_segments': []}, + } + source = tmp_path / 'reference-test.json' + source.write_text(json.dumps(data, indent=2) + '\n') + return source, data, package, expected, code, availability_key, availability_value + + +def test_import_preserves_source_package_and_complete_expected_report(vector, tmp_path): + source, _, package, expected, *_ = vector + original = source.read_bytes() + destination = tmp_path / 'imported' + manifest = import_refinement_vector(source, destination) + + assert isinstance(manifest, dict) + assert json.loads((destination / 'manifest.json').read_text()) == manifest + assert source.read_bytes() == original + assert (destination / 'source.json').read_bytes() == original + assert (destination / 'report.bin').read_bytes() == expected.to_jam_bytes().to_bytes() + request = RefineBundle.from_jam_bytes(JamBytes((destination / 'refine.bin').read_bytes())) + assert request.bundle.work_package == package + assert request.core_index == 1 + assert request.erasure_shards == 6 + assert request.segment_root_lookup == expected.segment_root_lookup + assert expected.authorizer_hash != package.authorizer_hash() + + for name, codec in [('genesis', TraceGenesis), ('refine', RefineBundle), ('report', WorkReport)]: + raw = (destination / f'{name}.bin').read_bytes() + stream = JamBytes(raw) + decoded = codec.from_jam_bytes(stream) + assert stream.get_remaining_length() == 0 + assert decoded.to_jam_bytes().to_bytes() == raw + + +def test_initialization_preserves_supplied_services_without_inventing_authorizer(vector): + source, _, package, _, code, availability_key, availability_value = vector + genesis, request, _ = load_refinement_vector(source) + state = dict(genesis.state.keyvals) + assert all(key in state for key in STORAGE_KEY_MAPPING) + assert len(state) == len(genesis.state.keyvals) + assert PatriciaMerkleTrie(genesis.state.keyvals).root() == genesis.state.state_root + assert genesis.header.timeslot == package.context.lookup_anchor_slot + timeslot_key = next(key for key, codec in STORAGE_KEY_MAPPING.items() if codec is TimeslotState) + assert TimeslotState.from_jam_bytes(JamBytes(state[timeslot_key])).number == genesis.header.timeslot + assert request.bundle.work_package.context == package.context + assert state_key_constructor_service_account(0) not in state + assert state_key_constructor_preimage(0, package.auth_code_hash) not in state + assert state[state_key_constructor_preimage(1000, package.items[0].code_hash)] == code + assert state[availability_key] == availability_value + account = ServiceAccount.from_serialized_bytes(state[state_key_constructor_service_account(1000)]) + assert (account.gas_limit_accumulate, account.gas_limit_on_transfer) == (123, 456) + assert (account.footprint_storage_bytes, account.footprint_storage_items) == (777, 2) + assert (account.deposit_offset, account.creation_slot, account.last_accumulation_slot, + account.parent_service) == (12, 1, 2, 42) + + +def test_imported_full_state_initializes_real_target(vector, tmp_path): + from pyjamaz.cli import initialize_app + from pyjamaz.fuzzer.v1.target import FuzzerTarget + + genesis, _, _ = load_refinement_vector(vector[0]) + + async def run(): + app = await initialize_app(read_state=False, storage_engine='memory', pubsub=False) + target = FuzzerTarget(str(tmp_path / 'unused.sock'), app) + response = await target.msg_initialize(FuzzerMessage(initialize=InitializeMessage( + genesis.header, genesis.state.keyvals, [], + ))) + assert response.state_root == genesis.state.state_root + assert app.working_state.timeslot.number == genesis.header.timeslot + + asyncio.run(run()) + + +def test_availability_bundle_order_and_invalid_import_proofs_are_preserved(vector): + source, data, package, expected, *_ = vector + roots = [b'r' * 32, b't' * 32] + extrinsics = [b'first extrinsic', b'second extrinsic'] + segments = [b'x' * 4104, b'y' * 4104] + proofs = [[], [b'z' * 32]] # Deliberately invalid proofs: the target must reject them. + package.items = [ + WorkItem(1000, package.auth_code_hash, 1000, 1000, 0, bytes([i]), + [ImportSegment.from_segment_root(root, 0)], [WorkItemExtrinsic.from_blob(blob)]) + for i, (root, blob) in enumerate(zip(roots, extrinsics)) + ] + expected.segment_root_lookup = {b'w' * 32: b'm' * 32} + data['work_package'] = package.to_json() + data['expected']['work_report'] = expected.to_json() + raw = (package.to_jam_bytes().to_bytes() + b''.join(extrinsics) + b''.join(segments) + + b''.join(Vec(H256).encode(proof).to_bytes() for proof in proofs)) + data['bundle'] = '0x' + raw.hex() + source.write_text(json.dumps(data)) + + _, request, oracle = load_refinement_vector(source) + assert request.bundle.work_package == package + assert request.bundle.extrinsics == extrinsics + assert request.bundle.import_segments == segments + assert request.bundle.justifications == proofs + assert request.segment_root_lookup == expected.segment_root_lookup + assert oracle == expected + + +@pytest.mark.parametrize('fault', ['trailing', 'truncated', 'package_mismatch', 'invalid_json']) +def test_corrupt_input_is_rejected_without_writing_fixture(vector, tmp_path, fault): + source, data, *_ = vector + if fault == 'trailing': + data['bundle'] += '00' + elif fault == 'truncated': + data['bundle'] = data['bundle'][:-2] + elif fault == 'package_mismatch': + data['work_package']['items'][0]['payload'] = '0x01' + source.write_text('{' if fault == 'invalid_json' else json.dumps(data)) + destination = tmp_path / 'invalid-import' + with pytest.raises(ValueError): + import_refinement_vector(source, destination) + assert not destination.exists() or not list(destination.iterdir()) + + +def test_existing_destination_and_source_are_never_overwritten(vector, tmp_path): + source = vector[0] + original = source.read_bytes() + destination = tmp_path / 'existing' + destination.mkdir() + sentinel = destination / 'report.bin' + sentinel.write_bytes(b'keep this report') + with pytest.raises((ValueError, FileExistsError)): + import_refinement_vector(source, destination) + assert sentinel.read_bytes() == b'keep this report' + assert source.read_bytes() == original diff --git a/test/test_refinement_vector_diagnostics.py b/test/test_refinement_vector_diagnostics.py new file mode 100644 index 00000000..514b6478 --- /dev/null +++ b/test/test_refinement_vector_diagnostics.py @@ -0,0 +1,145 @@ +"""Component diagnostics retain the oracle and isolate a bare-code adapter.""" + +import importlib.util +import json +from pathlib import Path +import sys + +import pytest +from jamcodec.types import Bytes, U32, Vec + +from pyjamaz.availability import availability_spec +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.models.common import ( + RefinementContext, WorkDigest, WorkExecResult, WorkItem, WorkPackage, WorkReport, +) +from pyjamaz.pvm.constants import Opcode +from pyjamaz.pvm.types import PVMCode +from pyjamaz.state.base import state_key_constructor_preimage_availability + + +@pytest.fixture +def diagnostic_module(monkeypatch): + with monkeypatch.context() as scoped: + scoped.setattr(sys, 'path', list(sys.path)) + spec = importlib.util.spec_from_file_location( + 'refinement_vector_diagnostics_under_test', + Path(__file__).resolve().parents[1] / 'scripts/diagnose_refinement_vectors.py', + ) + module = importlib.util.module_from_spec(spec) + scoped.setitem(sys.modules, spec.name, module) + spec.loader.exec_module(module) + return module + + +@pytest.fixture +def vector_factory(tmp_path): + def create(*, metadata_wrapped=False): + raw = bytes((Opcode.load_imm.value, 8, 0, 0, 0, 0, Opcode.jump_ind.value, 0)) + code = PVMCode(0, 0, len(raw), [], raw, + [True, False, False, False, False, False, True, False]) + encoded = code.to_jam_bytes().to_bytes() + program = bytes(8) + (4096).to_bytes(3, 'little') + len(encoded).to_bytes(4, 'little') + encoded + blob = Bytes.encode(b'').to_bytes() + program if metadata_wrapped else program + code_hash = blake2b_256_hash(blob) + context = RefinementContext(bytes(32), bytes(32), bytes(32), bytes(32), 0, []) + item = WorkItem(1000, code_hash, 1000, 1000, 0, b'', [], []) + package = WorkPackage(0, code_hash, context, b'', b'', [item]) + # The small program independently has an empty successful result and + # consumes 22 gas. Preserve the corpus's deliberately raw authorizer + # code hash so component success cannot manufacture a full-report pass. + expected = WorkReport( + availability_spec(package.hash(), package.to_jam_bytes().to_bytes(), [], 6), + context, 0, code_hash, 1_000_000, b'auth', {}, + [WorkDigest.from_work_item(item, WorkExecResult(ok=b''), 22)], + ) + availability_key = state_key_constructor_preimage_availability(1000, code_hash, len(blob)) + data = { + 'name': 'wrapped-code' if metadata_wrapped else 'bare-code', + 'core_idx': 0, + 'services': {'1000': { + 'service': { + 'code_hash': '0x' + code_hash.hex(), 'balance': 1_000_000, + 'min_item_gas': 1000, 'min_memo_gas': 1000, 'bytes': len(blob), + 'items': 2, 'deposit_offset': 0, 'creation_slot': 0, + 'last_accumulation_slot': 0, 'parent_service': 0, + }, + 'data': [{'key': '0x' + availability_key.hex(), + 'value': '0x' + Vec(U32).encode([0]).to_bytes().hex()}], + 'preimage_blobs': [{'hash': '0x' + code_hash.hex(), 'blob': '0x' + blob.hex()}], + }}, + 'work_package': package.to_json(), + 'bundle': '0x' + package.to_jam_bytes().to_bytes().hex(), + 'expected': {'work_report': expected.to_json(), 'exported_segments': []}, + } + source = tmp_path / (data['name'] + '.json') + source.write_text(json.dumps(data, indent=2) + '\n') + return source + + return create + + +def test_bare_blob_requires_explicit_adapter_to_reach_real_refinement(diagnostic_module, vector_factory): + source = vector_factory() + original = source.read_bytes() + baseline = diagnostic_module.diagnose_vector(source) + assert baseline['name'] == 'bare-code' + assert baseline['items'][0]['pvm_entered'] is False + assert baseline['items'][0]['gas_used'] == 0 + assert baseline['items'][0]['result_matches'] is False + assert baseline['items_match'] is False + assert baseline['full_report_matches'] is False + assert baseline['source_unchanged'] is True + assert source.read_bytes() == original + + +def test_adapter_matches_real_pvm_output_but_keeps_report_disagreement(diagnostic_module, vector_factory): + source = vector_factory() + original = source.read_bytes() + result = diagnostic_module.diagnose_vector(source, bare_service_code=True) + assert result['items'][0]['pvm_entered'] is True + assert result['items'][0]['gas_used'] == 22 + assert result['items'][0]['result_matches'] is True + assert result['items'][0]['gas_matches'] is True + assert result['items_match'] is True + assert result['exported_segments_match'] is True + assert result['full_report_matches'] is False + assert any('authorizer_hash' in difference for difference in result['report_differences']) + assert result['assumptions'] + assert result['source_unchanged'] is True + assert source.read_bytes() == original + + # A diagnostic adapter must not change extraction in subsequent calls. + baseline = diagnostic_module.diagnose_vector(source) + assert baseline['items'][0]['pvm_entered'] is False + assert baseline['items_match'] is False + + +def test_metadata_wrapped_service_runs_without_adapter(diagnostic_module, vector_factory): + source = vector_factory(metadata_wrapped=True) + original = source.read_bytes() + result = diagnostic_module.diagnose_vector(source) + assert result['name'] == 'wrapped-code' + assert result['items'][0]['pvm_entered'] is True + assert result['items'][0]['gas_used'] == 22 + assert result['items_match'] is True + assert result['exported_segments_match'] is True + assert result['full_report_matches'] is False + assert result['source_unchanged'] is True + assert source.read_bytes() == original + + +def test_null_result_variants_compare_by_wire_value(diagnostic_module, vector_factory): + source = vector_factory() + data = json.loads(source.read_text()) + data['expected']['work_report']['results'][0]['result'] = {'panic': None} + data['expected']['work_report']['results'][0]['refine_load']['gas_used'] = 0 + source.write_text(json.dumps(data)) + original = source.read_bytes() + # Normal extraction of this bare blob fails before PVM entry. The actual + # True marker and decoded Null marker encode the same panic variant. + result = diagnostic_module.diagnose_vector(source) + assert result['items'][0]['pvm_entered'] is False + assert result['items'][0]['result_matches'] is True + assert result['items_match'] is True + assert source.read_bytes() == original diff --git a/test/test_refinement_vector_inner_adapter.py b/test/test_refinement_vector_inner_adapter.py new file mode 100644 index 00000000..71dc914c --- /dev/null +++ b/test/test_refinement_vector_inner_adapter.py @@ -0,0 +1,68 @@ +"""Nested-code compatibility is explicit, narrow and confined to diagnostics.""" + +import pytest +from jamcodec.base import JamBytes +from jamcodec.exceptions import RemainingScaleBytesNotEmptyException + +from pyjamaz.pvm.types import PVMCode +from test.test_refinement_vector_diagnostics import diagnostic_module, vector_factory + + +@pytest.mark.parametrize('child,canonical', [ + ('00041832000000ffff01', '00040632000000ffff01'), + ('0004080a0003', '0004020a0003'), +]) +def test_observed_child_adapter_is_opt_in_and_restored( + diagnostic_module, vector_factory, monkeypatch, child, canonical): + source = vector_factory() + original_source = source.read_bytes() + original_decoder = PVMCode.from_jam_bytes.__func__ + invoke = diagnostic_module.pvm_invoke_refine + + def decode_child_then_invoke(**kwargs): + # Exercise a nonzero stream offset as well as complete consumption. + stream = JamBytes(b'prefix' + bytes.fromhex(child)) + stream.get_next_bytes(6) + decoded = PVMCode.from_jam_bytes(stream) + assert stream.get_remaining_length() == 0 + assert decoded.to_jam_bytes().to_bytes() == bytes.fromhex(canonical) + assert decoded.is_valid(0) + return invoke(**kwargs) + + monkeypatch.setattr(diagnostic_module, 'pvm_invoke_refine', decode_child_then_invoke) + with pytest.raises(RemainingScaleBytesNotEmptyException, match='No more bytes available'): + diagnostic_module.diagnose_vector(source, bare_service_code=True) + + result = diagnostic_module.diagnose_vector( + source, bare_service_code=True, scale_inner_code=True, + ) + assert result['inner_code_adaptations'] == [ + {'original': child, 'diagnostic_header': canonical}, + ] + assert result['items'][0]['pvm_entered'] is True + assert result['items'][0]['gas_used'] == 22 + assert result['items_match'] is True + assert result['full_report_matches'] is False + assert any('authorizer_hash' in entry for entry in result['report_differences']) + assert source.read_bytes() == original_source + assert PVMCode.from_jam_bytes.__func__ is original_decoder + with pytest.raises(RemainingScaleBytesNotEmptyException, match='No more bytes available'): + PVMCode.from_jam_bytes(JamBytes(bytes.fromhex(child))) + + +def test_unrecognized_child_is_rejected_and_adapter_restored_after_error( + diagnostic_module, vector_factory, monkeypatch): + source = vector_factory() + original_source = source.read_bytes() + original_decoder = PVMCode.from_jam_bytes.__func__ + + def reject_unknown_child(**kwargs): + # This malformed blob differs from either recognized child; the + # diagnostic must not broadly accept SCALE or malformed programs. + return PVMCode.from_jam_bytes(JamBytes(bytes.fromhex('00041832000000ffff02'))) + + monkeypatch.setattr(diagnostic_module, 'pvm_invoke_refine', reject_unknown_child) + with pytest.raises(RemainingScaleBytesNotEmptyException, match='No more bytes available'): + diagnostic_module.diagnose_vector(source, bare_service_code=True, scale_inner_code=True) + assert source.read_bytes() == original_source + assert PVMCode.from_jam_bytes.__func__ is original_decoder diff --git a/test/test_report_export_padding.py b/test/test_report_export_padding.py new file mode 100644 index 00000000..d2e031dd --- /dev/null +++ b/test/test_report_export_padding.py @@ -0,0 +1,66 @@ +from unittest.mock import Mock + +import pytest + +import pyjamaz.refinement as refinement_module +from pyjamaz.availability import BundleData +from pyjamaz.graypaper_constants import EC_SEGMENT_SIZE, MAXIMUM_SIZE_ENCODED_WORK_REPORT, VALIDATOR_COUNT +from pyjamaz.hostcalls.models import PvmIsAuthorizedOutput, PvmRefineOutput +from pyjamaz.merkle import ConstantDepthMerkleTree +from pyjamaz.models.common import RefinementContext, WorkExecResult, WorkItem, WorkPackage +from pyjamaz.models.state import ServicesState +from pyjamaz.refinement import Refinement + + +@pytest.fixture +def produce_report(monkeypatch): + def produce(declared, outputs): + items = [WorkItem(service=42, code_hash=bytes(32), refine_gas_limit=10, accumulate_gas_limit=10, + export_count=count, payload=b'', import_segments=[], extrinsic=[]) + for count in declared] + context = RefinementContext(anchor=bytes(32), anchor_slot=0, state_root=bytes(32), + beefy_root=bytes(32), lookup_anchor=bytes(32), lookup_anchor_slot=0, + lookup_anchor_state_root=bytes(32), prerequisites=[]) + package = WorkPackage(auth_code_host=42, auth_code_hash=bytes(32), context=context, + authorization=b'', authorizer_config=b'', items=items) + monkeypatch.setattr(WorkPackage, 'set_authorization_code', lambda *_: None) + monkeypatch.setattr(refinement_module, 'pvm_invoke_is_authorized', + lambda *args: PvmIsAuthorizedOutput(WorkExecResult(ok=b''), 0)) + refine = Mock(side_effect=outputs) + monkeypatch.setattr(refinement_module, 'pvm_invoke_refine', refine) + execution = Refinement(ServicesState(), BundleData()) + report = execution.compute_work_report(package, 0, {}, VALIDATOR_COUNT) + return report, execution.exported_segments, refine + return produce + + +@pytest.mark.parametrize('declared,actual,result,expected_error', [ + (2, 2, 'ok', 'ok'), + (2, 1, 'ok', 'bad_exports'), + (1, 2, 'ok', 'bad_exports'), + (2, 0, 'panic', 'bad_exports'), + (2, 2, 'panic', 'panic'), + (0, 0, 'panic', 'panic'), + (2, 0, 'oversize', 'digest_oversize'), +]) +def test_failed_exports_are_padded_to_declared_count(produce_report, declared, actual, result, expected_error): + returned = [bytes([i + 1]) * EC_SEGMENT_SIZE for i in range(actual)] + execution = (WorkExecResult(panic=True) if result == 'panic' else + WorkExecResult(ok=b'x' * (MAXIMUM_SIZE_ENCODED_WORK_REPORT + 1) if result == 'oversize' else b'ok')) + report, segments, _ = produce_report([declared], [PvmRefineOutput(execution, returned, 10)]) + assert report.results[0].result.enum_value()[0] == expected_error + assert report.package_spec.exports_count == sum(r.refine_load.exports for r in report.results) == declared + expected = returned if expected_error == 'ok' else [bytes(EC_SEGMENT_SIZE)] * declared + assert segments == expected + assert report.package_spec.exports_root == ConstantDepthMerkleTree(expected).root() + + +def test_padding_preserves_subsequent_segment_positions(produce_report): + final_segment = b'z' * EC_SEGMENT_SIZE + report, segments, refine = produce_report([2, 1], [ + PvmRefineOutput(WorkExecResult(ok=b'first'), [], 10), + PvmRefineOutput(WorkExecResult(ok=b'second'), [final_segment], 10), + ]) + assert segments == [bytes(EC_SEGMENT_SIZE), bytes(EC_SEGMENT_SIZE), final_segment] + assert report.package_spec.exports_count == sum(r.refine_load.exports for r in report.results) == 3 + assert refine.call_args_list[1].kwargs['export_segment_offset'] == 2 diff --git a/test/test_runtime_author_resize.py b/test/test_runtime_author_resize.py new file mode 100644 index 00000000..5fd8341b --- /dev/null +++ b/test/test_runtime_author_resize.py @@ -0,0 +1,139 @@ +import asyncio +from hashlib import sha256 +from types import SimpleNamespace +from unittest.mock import AsyncMock, Mock + +import pytest + +from pyjamaz import app as app_module, graypaper_constants as gp_const, signing +from pyjamaz.app import PyjamazApp +from pyjamaz.models.common import ValidatorData +from pyjamaz.models.context import AppContext, BlockContext +from pyjamaz.models.state import ( + EntropyState, SafroleState, SlotSealerSeries, TimeslotState, + ValidatorPoolState, ValidatorQueueState, +) +from pyjamaz.runtime import extrinsics +from pyjamaz.runtime.extrinsics import BlockExtrinsicCollector +from pyjamaz.runtime.pipelines.accumulate import AccumulatePipeline +from pyjamaz.state.components import ValidatorPool + + +AUTHOR_KEY = b"\xff" * 32 + + +def validator_set(count, prefix, author_index=None): + keys = [bytes([prefix]) + index.to_bytes(31, "little") for index in range(count)] + if author_index is not None: + keys[author_index] = AUTHOR_KEY + return [ValidatorData(key, key, bytes(144), bytes(128)) for key in keys] + + +def pending_state(validators): + return SafroleState( + validators=validators, + ring_commitment=bytes(144), + slot_sealer_series=SlotSealerSeries(keys=[bytes(32)] * gp_const.EPOCH_TIMESLOTS), + ticket_accumulator=[], + ) + + +def bare_app(): + app = PyjamazApp.__new__(PyjamazApp) + app.config = SimpleNamespace( + keys=SimpleNamespace(bandersnatch=SimpleNamespace(public_key=AUTHOR_KEY, private_key=bytes(32))), + ring_data=b"ring-data", + create_traces=False, + ) + app.block_extrinsic = BlockExtrinsicCollector(app.config.ring_data) + app.working_state = SimpleNamespace( + timeslot=TimeslotState(gp_const.EPOCH_TIMESLOTS + 1), + validator_pool=ValidatorPoolState(validator_set(min(9, gp_const.VALIDATOR_COUNT), 1, 1)), + safrole=pending_state(validator_set(6, 2, 3)), + validator_queue=ValidatorQueueState(validator_set(min(12, gp_const.VALIDATOR_COUNT), 3, 5)), + entropy=EntropyState([bytes([index]) * 32 for index in range(4)]), + services=SimpleNamespace(), + disputes=SimpleNamespace(), + state_root=b"s" * 32, + ) + app.generate_entropy_source = Mock(return_value=bytes(96)) + app.state_transition = AsyncMock() + app.add_ancestor_block = AsyncMock() + return app + + +@pytest.mark.parametrize("epoch_gap", [0, 1, 3], ids=["same-epoch", "next-epoch", "skipped-epochs"]) +@pytest.mark.parametrize("pending_member", [True, False], ids=["pending-member", "leaving-validator"]) +def test_block_author_and_ticket_signer_use_their_own_validator_sets(monkeypatch, epoch_gap, pending_member): + app = bare_app() + timeslot = (1 + epoch_gap) * gp_const.EPOCH_TIMESLOTS + 2 + if epoch_gap: + pending = pending_state(validator_set( + min(12, gp_const.VALIDATOR_COUNT), 3, 5 if pending_member else None, + )) + expected_header_index, expected_ticket_index = 3, 5 + else: + app.working_state.safrole = pending_state(validator_set(6, 2, 3 if pending_member else None)) + pending = app.working_state.safrole + expected_header_index, expected_ticket_index = 1, 3 + + sign = Mock(return_value=bytes(784)) + ring = Mock(return_value=SimpleNamespace(ring_vrf_sign=sign)) + monkeypatch.setattr(app_module, "SOLO_MODE", False) + monkeypatch.setattr(signing, "jam_ring_context", ring) + monkeypatch.setattr(extrinsics, "vrf_output", lambda key, message: sha256(message).digest()) + + block = asyncio.run(app.produce_block(timeslot, b"p" * 32, pending, app.working_state.entropy)) + + assert block.header.author_index == expected_header_index + app.state_transition.assert_awaited_once_with(block, produce=True) + app.add_ancestor_block.assert_awaited_once_with(block) + if pending_member: + ring.assert_called_once_with(app.config.ring_data, [v.bandersnatch for v in pending.validators]) + assert sign.call_count == gp_const.ticket_entries(len(pending.validators)) + assert all(call.args[0] == expected_ticket_index for call in sign.call_args_list) + assert app.block_extrinsic.own_ticket_count() == sign.call_count + assert len(block.extrinsic.tickets) == min(sign.call_count, gp_const.MAXIMUM_EXTRINSIC_TICKETS) + else: + ring.assert_not_called() + sign.assert_not_called() + assert block.extrinsic.tickets == [] + + +@pytest.mark.parametrize("epoch_gap", [1, 3], ids=["next-epoch", "skipped-epochs"]) +def test_epoch_preview_uses_rotated_validator_pool_for_safrole(epoch_gap): + async def run(): + app = bare_app() + old_pool = app.working_state.validator_pool + parent_pending = app.working_state.safrole + new_pending = pending_state(app.working_state.validator_queue.validators) + safrole_transition = Mock(return_value=SimpleNamespace(post_state=new_pending)) + pool_transition = Mock(wraps=ValidatorPool(BlockContext(), AppContext()).state_transition) + app.components = SimpleNamespace( + entropy=SimpleNamespace(state_transition=Mock(return_value=SimpleNamespace( + post_state=app.working_state.entropy, + ))), + validator_pool=SimpleNamespace(state_transition=pool_transition), + safrole=SimpleNamespace(state_transition=safrole_transition), + ) + app.should_produce_block = Mock(return_value=False) + pipeline = AccumulatePipeline(app) + timeslot = (1 + epoch_gap) * gp_const.EPOCH_TIMESLOTS + 2 + await pipeline.notify_timeslot(timeslot) + worker = asyncio.create_task(pipeline._timeslot_worker()) + try: + await asyncio.wait_for(pipeline._timeslot_queue.join(), timeout=2) + finally: + worker.cancel() + with pytest.raises(asyncio.CancelledError): + await worker + + pool_transition.assert_called_once() + safrole_transition.assert_called_once() + selected_pool = safrole_transition.call_args.kwargs["post_state_validator_pool"] + assert selected_pool.validators == parent_pending.validators + assert selected_pool.validators != old_pool.validators + assert app.working_state.validator_pool is old_pool + app.should_produce_block.assert_called_once_with(timeslot, new_pending) + + asyncio.run(run()) diff --git a/test/test_runtime_refinement.py b/test/test_runtime_refinement.py index e409c529..62e4da6d 100644 --- a/test/test_runtime_refinement.py +++ b/test/test_runtime_refinement.py @@ -5,10 +5,14 @@ import pytest from pyjamaz import refinement as refinement_module, graypaper_constants as gp_const -from pyjamaz.availability import BundleData, DataUnavailable, availability_spec, validate_work_package, zero_pad +from pyjamaz.availability import ( + BundleData, DataUnavailable, ImportedSegment, availability_spec, recover_import, + validate_work_package, zero_pad, +) from pyjamaz.d3l import DataAvailabilityStore -from pyjamaz.erasure import encode_chunks, erasure_data_shards +from pyjamaz.erasure import encode_blob, encode_chunks, erasure_data_shards from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.merkle import ConstantDepthMerkleTree from pyjamaz.models.app import D3LEntry from pyjamaz.models.common import ( Credential, ImportSegment, RefinementContext, WorkExecResult, WorkItem, WorkPackage, @@ -17,7 +21,7 @@ from pyjamaz.refinement import Refinement from pyjamaz.runtime.pipelines import refine from pyjamaz.state.storage import StateStorage -from pyjamaz.storage import InMemoryStorageEngine +from pyjamaz.storage import FileStorageEngine, InMemoryStorageEngine def package(payload=b'package', imports=None): @@ -127,6 +131,155 @@ def test_runtime_uses_recent_history_mapping_for_external_package(runtime): assert item.work_report.segment_root_lookup == {source_hash: root} +def test_recovered_cached_and_complete_exports_make_identical_reports(runtime): + exports = [bytes([index + 1]) * 4104 for index in range(3)] + tree = ConstantDepthMerkleTree(exports) + root = tree.root() + spec = availability_spec(b's' * 32, b'source bundle', exports, 6) + mappings = {spec.hash: root} + value = package(imports=[ + ImportSegment.from_work_package_hash(spec.hash, 2), + ImportSegment.from_segment_root(root, 0), + ImportSegment.from_work_package_hash(spec.hash, 2), + ]) + second = deepcopy(value.items[0]) + second.import_segments = list(reversed(value.items[0].import_segments[:2])) + value.items.append(second) + runtime.app.working_state.recent_history.recent_blocks = [SimpleNamespace( + reported=[SimpleNamespace(hash=spec.hash, exports_root=root)], + )] + item = submit(runtime, value) + store = runtime.app.d3l_store + store.store_segments(D3LEntry(root, exports)) + + def compute(): + data = runtime.pipeline._bundle_data(value, mappings) + execution = Refinement(runtime.app.working_state.services.snapshot(), data) + report = execution.compute_work_report(value, 0, mappings, 6) + return report.to_jam_bytes().to_bytes(), execution.bundle + + expected = compute() + shards = encode_blob(6, exports[2]) + recovered = recover_import(spec, 2, {i: shards[i] for i in (3, 4, 5)}, + justification=tree.trace(2)) + store.store_import(root, 2, recovered) + # One cached segment, with the other supplied by the complete-export fallback. + assert compute() == expected + store.store_import(root, 0, ImportedSegment(exports[0], tuple(tree.trace(0)))) + store.storage_engine.delete(root) + assert compute() == expected + asyncio.run(runtime.pipeline._refine_work_package(item)) + assert item.work_report.to_jam_bytes().to_bytes() == expected[0] + expected_imports = [[exports[2], exports[0], exports[2]], [exports[0], exports[2]]] + assert runtime.invocations[-1]['work_items_import_segments'] == expected_imports + + +def test_corrupt_individual_import_falls_back_to_complete_exports(runtime): + exports = [b'x' * 4104, b'y' * 4104] + tree = ConstantDepthMerkleTree(exports) + root = tree.root() + store = runtime.app.d3l_store + store.store_import(root, 1, ImportedSegment(exports[1], tuple(tree.trace(1)))) + key = next(iter(store.storage_engine.as_dict())) + store.storage_engine.put(key, b'corrupt') + store.store_segments(D3LEntry(root, exports)) + value = package(imports=[ImportSegment.from_segment_root(root, 1)]) + data = runtime.pipeline._bundle_data(value, {}) + assert data.import_segments({}, value.items[0]) == [exports[1]] + + +@pytest.mark.parametrize('corrupt', [False, True]) +def test_worker_retries_disk_import_until_verified_data_is_inserted(runtime, tmp_path, corrupt): + exports = [b'x' * 4104, b'y' * 4104] + tree = ConstantDepthMerkleTree(exports) + root = tree.root() + runtime.app.working_state.recent_history.recent_blocks = [SimpleNamespace(reported=[ + SimpleNamespace(hash=b's' * 32, exports_root=root), + ])] + runtime.app.d3l_store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + store = runtime.app.d3l_store + if corrupt: + store.store_import(root, 1, ImportedSegment(exports[1], tuple(tree.trace(1)))) + next(tmp_path.iterdir()).write_bytes(b'corrupt') + item = submit(runtime, package(imports=[ImportSegment.from_segment_root(root, 1)])) + + async def run(): + worker = asyncio.create_task(runtime.pipeline._refine_worker()) + try: + await runtime.pipeline._refine_queue.put(item) + await asyncio.wait_for(runtime.pipeline._refine_queue.join(), timeout=2) + assert item.status.Reportable + assert runtime.invocations == runtime.signed == [] + store.store_import(root, 1, ImportedSegment(exports[1], tuple(tree.trace(1)))) + await runtime.pipeline._refine_queue.put(item) + await asyncio.wait_for(runtime.pipeline._refine_queue.join(), timeout=2) + assert item.status.Reported + assert len(runtime.signed) == 1 + finally: + worker.cancel() + with pytest.raises(asyncio.CancelledError): + await worker + + asyncio.run(run()) + + +@pytest.mark.parametrize('corrupt_import', [False, True]) +@pytest.mark.parametrize('fault', ['malformed', 'trailing', 'noncanonical', 'root', 'tree']) +def test_worker_retries_corrupt_complete_exports_until_repaired(runtime, tmp_path, corrupt_import, fault): + exports = [b'x' * 4104, b'y' * 4104] + tree = ConstantDepthMerkleTree(exports) + root = tree.root() + runtime.app.working_state.recent_history.recent_blocks = [SimpleNamespace(reported=[ + SimpleNamespace(hash=b's' * 32, exports_root=root), + ])] + runtime.app.d3l_store = DataAvailabilityStore(FileStorageEngine(str(tmp_path))) + store = runtime.app.d3l_store + if corrupt_import: + store.store_import(root, 1, ImportedSegment(exports[1], tuple(tree.trace(1)))) + next(tmp_path.iterdir()).write_bytes(b'corrupt') + data = D3LEntry(root, exports).to_jam_bytes().to_bytes() + if fault == 'malformed': + data = data[:33] + elif fault == 'trailing': + data += bytes(1) + elif fault == 'noncanonical': + data = data[:32] + b'\x80\x02' + data[33:] + elif fault == 'root': + data = bytes(32) + data[32:] + else: + data = D3LEntry(root, [b'z' * 4104] * 2).to_jam_bytes().to_bytes() + store.storage_engine.put(root, data) + item = submit(runtime, package(imports=[ImportSegment.from_segment_root(root, 1)])) + + async def run(): + worker = asyncio.create_task(runtime.pipeline._refine_worker()) + try: + await runtime.pipeline._refine_queue.put(item) + await asyncio.wait_for(runtime.pipeline._refine_queue.join(), timeout=2) + assert item.status.Reportable + assert runtime.invocations == runtime.signed == [] + store.store_segments(D3LEntry(root, exports)) + await runtime.pipeline._refine_queue.put(item) + await asyncio.wait_for(runtime.pipeline._refine_queue.join(), timeout=2) + assert item.status.Reported + assert len(runtime.signed) == 1 + finally: + worker.cancel() + with pytest.raises(asyncio.CancelledError): + await worker + + asyncio.run(run()) + + +def test_complete_exports_still_reject_out_of_range_manifest_index(runtime): + exports = [b'x' * 4104, b'y' * 4104] + root = ConstantDepthMerkleTree(exports).root() + runtime.app.d3l_store.store_segments(D3LEntry(root, exports)) + value = package(imports=[ImportSegment.from_segment_root(root, 2)]) + with pytest.raises(ProcessWorkpackageError, match='index out of range'): + runtime.pipeline._bundle_data(value, {}) + + @pytest.mark.parametrize('in_progress', ['transaction', 'candidate']) def test_runtime_waits_for_block_transition_before_taking_snapshot(runtime, in_progress): item = submit(runtime, package()) diff --git a/test/test_runtime_ticket_resize.py b/test/test_runtime_ticket_resize.py new file mode 100644 index 00000000..a65bab09 --- /dev/null +++ b/test/test_runtime_ticket_resize.py @@ -0,0 +1,167 @@ +from types import SimpleNamespace +from unittest.mock import Mock + +import pytest + +from pyjamaz import graypaper_constants as gp_const +from pyjamaz.models.block import TicketEnvelope +from pyjamaz.models.common import TicketBody +from pyjamaz.models.stf_output import SafroleErrorCode +from pyjamaz.runtime import extrinsics + + +def ticket_id(value): + return value.to_bytes(32, "big") + + +def ticket(value=0, *, attempt=0): + return TicketEnvelope(attempt=attempt, signature=value.to_bytes(784, "big")) + + +@pytest.fixture +def collector(): + return extrinsics.BlockExtrinsicCollector(b"ring-data") + + +@pytest.fixture(params=[6, 9], ids=["six-validators", "nine-validators"]) +def attempt_bound(request): + if request.param == 9: + if gp_const.VALIDATOR_COUNT < 9: + pytest.skip("Nine validators exceed the Tiny validator maximum") + return 9, 134 + # Known GP configurations: E=12 in Tiny and E=600 in Full. + return 6, 4 if gp_const.EPOCH_TIMESLOTS == 12 else 200 + + +def test_received_ticket_accepts_last_attempt_for_pending_set(collector, attempt_bound): + validator_count, limit = attempt_bound + ring = SimpleNamespace(ring_vrf_verify=Mock(return_value=ticket_id(1))) + entropy = b"e" * 32 + envelope = ticket(attempt=limit - 1) + + body = collector.create_ticket_body( + envelope, ring, entropy, validator_count=validator_count, + ) + + assert body == TicketBody(id=ticket_id(1), attempt=limit - 1) + ring.ring_vrf_verify.assert_called_once_with( + b"jam_ticket_seal" + entropy + bytes([limit - 1]), b"", bytes(784), + ) + + +@pytest.mark.parametrize("negative", [False, True], ids=["upper-bound", "negative"]) +def test_received_invalid_attempt_is_rejected_before_verification(collector, attempt_bound, negative): + validator_count, limit = attempt_bound + ring = SimpleNamespace(ring_vrf_verify=Mock()) + + with pytest.raises(ValueError) as error: + collector.create_ticket_body( + ticket(attempt=-1 if negative else limit), ring, bytes(32), + validator_count=validator_count, + ) + + assert error.value.args == (SafroleErrorCode.bad_ticket_attempt,) + ring.ring_vrf_verify.assert_not_called() + assert collector.tickets_queue == {} + + +def test_received_ticket_uses_jam_ring_wrapper_and_unpadded_validator_count( + monkeypatch, collector, attempt_bound, +): + validator_count, limit = attempt_bound + public_keys = [ticket_id(index) for index in range(validator_count)] + ring = SimpleNamespace(ring_vrf_verify=Mock(return_value=ticket_id(123))) + make_ring = Mock(return_value=ring) + monkeypatch.setattr(extrinsics, "jam_ring_context", make_ring) + envelope = ticket(attempt=limit - 1) + + collector.add_ticket(envelope, public_keys, b"e" * 32) + + make_ring.assert_called_once_with(b"ring-data", public_keys) + ring.ring_vrf_verify.assert_called_once() + assert collector.tickets_queue == {ticket_id(123): envelope} + + +def test_own_attempt_limit_ignores_peer_queue_and_rejects_equality( + monkeypatch, collector, attempt_bound, +): + validator_count, limit = attempt_bound + collector.own_tickets_next = [ticket_id(index) for index in range(limit - 1)] + # Peers can fill the shared queue without consuming this validator's attempts. + collector.tickets_queue = { + ticket_id(1000 + index): ticket(index) for index in range(limit + 1) + } + ring = SimpleNamespace(ring_vrf_sign=Mock(return_value=bytes(784))) + keypair = SimpleNamespace(private_key=b"private-key") + entropy = b"e" * 32 + derive_id = Mock(return_value=ticket_id(999)) + monkeypatch.setattr(extrinsics, "vrf_output", derive_id) + + assert collector.can_add_own_ticket(0, validator_count=validator_count) + collector.add_own_ticket(ring, entropy, keypair, 0, validator_count=validator_count) + + assert collector.own_tickets_next[-1] == ticket_id(999) + assert collector.own_ticket_count() == limit + assert collector.tickets_queue[ticket_id(999)].attempt == limit - 1 + assert len(collector.tickets_queue) == limit + 2 + ring.ring_vrf_sign.assert_called_once_with( + 0, keypair.private_key, b"jam_ticket_seal" + entropy + bytes([limit - 1]), b"", + ) + assert not collector.can_add_own_ticket(0, validator_count=validator_count) + + # The attempt limit must also hold after every queued envelope was collected. + collector.tickets_queue.clear() + with pytest.raises(ValueError): + collector.add_own_ticket(ring, entropy, keypair, 0, validator_count=validator_count) + assert collector.own_ticket_count() == limit + assert collector.tickets_queue == {} + assert ring.ring_vrf_sign.call_count == 1 + assert derive_id.call_count == 1 + + +def test_own_ticket_generation_stops_at_epoch_submission_cutoff(collector): + epoch_start = 3 * gp_const.EPOCH_TIMESLOTS + cutoff = epoch_start + gp_const.TICKET_SUBMISSION_END_SLOT + + assert collector.can_add_own_ticket(cutoff - 1, validator_count=6) + assert not collector.can_add_own_ticket(cutoff, validator_count=6) + assert not collector.can_add_own_ticket(epoch_start + gp_const.EPOCH_TIMESLOTS - 1, validator_count=6) + assert collector.can_add_own_ticket(epoch_start + gp_const.EPOCH_TIMESLOTS, validator_count=6) + + +def test_collection_excludes_duplicates_and_non_winners_and_limits_extrinsic(collector): + accumulator = [ + TicketBody(id=ticket_id(1000 + index), attempt=0) + for index in range(gp_const.EPOCH_TIMESLOTS) + ] + candidates = { + ticket_id(index): ticket(index) + for index in range(gp_const.MAXIMUM_EXTRINSIC_TICKETS + 1, 0, -1) + } + collector.tickets_queue = { + ticket_id(1000): ticket(1000), # Already present in the accumulator. + ticket_id(10000): ticket(10000), # Cannot survive the lowest-E selection. + **candidates, + } + + collected = collector.collect_tickets(accumulator) + + assert collected == [ + candidates[ticket_id(index)] for index in range(1, gp_const.MAXIMUM_EXTRINSIC_TICKETS + 1) + ] + remaining_id = ticket_id(gp_const.MAXIMUM_EXTRINSIC_TICKETS + 1) + assert collector.tickets_queue == {remaining_id: candidates[remaining_id]} + assert accumulator == [ + TicketBody(id=ticket_id(1000 + index), attempt=0) + for index in range(gp_const.EPOCH_TIMESLOTS) + ] + + +def test_collection_at_cutoff_emits_nothing_and_preserves_queue(collector): + envelope = ticket(1) + collector.tickets_queue = {ticket_id(1): envelope} + + assert collector.collect_tickets(submission_allowed=False) == [] + assert collector.tickets_queue == {ticket_id(1): envelope} + assert collector.collect_tickets() == [envelope] + assert collector.tickets_queue == {} diff --git a/test/test_safrole_ticket_retention.py b/test/test_safrole_ticket_retention.py new file mode 100644 index 00000000..111604a2 --- /dev/null +++ b/test/test_safrole_ticket_retention.py @@ -0,0 +1,73 @@ +"""GP-0.8.0-eq:6.36: submitted tickets must survive accumulator truncation.""" + +from types import SimpleNamespace + +import pytest + +from pyjamaz import graypaper_constants as gp_const +from pyjamaz.exceptions import StateTransitionError +from pyjamaz.models.block import Header, TicketEnvelope +from pyjamaz.models.common import TicketBody, ValidatorData +from pyjamaz.models.context import AppContext, BlockContext +from pyjamaz.models.state import ( + DisputesState, EntropyState, SafroleState, SlotSealerSeries, TimeslotState, + ValidatorPoolState, ValidatorQueueState, +) +from pyjamaz.models.stf_output import SafroleErrorCode +from pyjamaz.state import components + + +E = gp_const.EPOCH_TIMESLOTS + + +@pytest.mark.parametrize('threaded', [False, True]) +@pytest.mark.parametrize('prior_count,scores,epoch_change,rejected', [ + (E, [1, 2], False, False), + (E, [1, E * 10 + 1], False, True), + (E - 2, [E * 10 + 1, E * 10 + 2], False, False), + (E - 1, [E * 10 + 1], False, False), + (E - 1, [E * 10 + 1, E * 10 + 2], False, True), + (E, [], False, False), + (E, [E * 10 + 1, E * 10 + 2], True, False), +]) +def test_submitted_tickets_must_be_retained( + monkeypatch, threaded, prior_count, scores, epoch_change, rejected, +): + monkeypatch.setattr(components, 'USE_THREAD_POOL_SAFROLE', threaded) + ring = SimpleNamespace( + commitment=bytes(144), ring_vrf_verify=lambda data, aux, proof: proof[:32], + ) + monkeypatch.setattr(components, 'jam_ring_context', lambda *args: ring) + validators = [ValidatorData(bytes([i + 1]) * 32, bytes(32), bytes(144), bytes(128)) for i in range(6)] + prior = [TicketBody(((i + 1) * 10).to_bytes(32, 'big'), 0) for i in range(prior_count)] + submitted = [TicketBody(score.to_bytes(32, 'big'), 0) for score in scores] + pre_state = SafroleState( + validators=validators, ring_commitment=bytes(144), ticket_accumulator=prior, + slot_sealer_series=SlotSealerSeries(keys=[bytes(32)] * E), + ) + header = Header.default() + header.timeslot = E if epoch_change else E + 1 + safrole = components.Safrole(BlockContext(), AppContext(), b'') + + def transition(): + return safrole.state_transition( + header=header, + extrinsic_tickets=[TicketEnvelope(0, ticket.id + bytes(752)) for ticket in submitted], + pre_state_timeslot=TimeslotState(E - 1 if epoch_change else E), + pre_state_safrole=pre_state, + pre_state_validator_queue=ValidatorQueueState(validators), + post_state_entropy=EntropyState([bytes(32)] * 4), + post_state_validator_pool=ValidatorPoolState(validators), + post_state_disputes=DisputesState([], [], [], []), + ) + + if rejected: + with pytest.raises(StateTransitionError) as error: + transition() + assert error.value.custom_error_code == SafroleErrorCode.ticket_not_retained + else: + output = transition() + assert all(ticket in output.post_state.ticket_accumulator for ticket in submitted) + if epoch_change: + assert output.post_state.ticket_accumulator == submitted + diff --git a/test/test_safrole_verification_pool.py b/test/test_safrole_verification_pool.py new file mode 100644 index 00000000..b1f7f441 --- /dev/null +++ b/test/test_safrole_verification_pool.py @@ -0,0 +1,316 @@ +"""Safrole verification preserves extrinsic order and drains shared-pool work.""" + +from concurrent.futures import Future, ThreadPoolExecutor, wait as wait_for_futures +from threading import Event +from types import SimpleNamespace + +import pytest + +from pyjamaz import graypaper_constants as gp_const +from pyjamaz.exceptions import StateTransitionError +from pyjamaz.models.block import Header, TicketEnvelope +from pyjamaz.models.common import TicketBody, ValidatorData +from pyjamaz.models.context import AppContext, BlockContext +from pyjamaz.models.state import ( + DisputesState, EntropyState, SafroleState, SlotSealerSeries, TimeslotState, + ValidatorPoolState, ValidatorQueueState, +) +from pyjamaz.models.stf_output import SafroleErrorCode +from pyjamaz.state import components + + +def envelope(score, attempt=0): + return TicketEnvelope(attempt, score.to_bytes(32, "big") + bytes(752)) + + +@pytest.fixture +def transition(monkeypatch): + def verify(data, aux, proof): + if proof[:32] == bytes([255]) * 32: + raise ValueError("invalid ring proof") + return proof[:32] + + monkeypatch.setattr( + components, "jam_ring_context", + lambda *_: SimpleNamespace(ring_vrf_verify=verify), + ) + validators = [ + ValidatorData(bytes([index + 1]) * 32, bytes(32), bytes(144), bytes(128)) + for index in range(6) + ] + + def run(tickets, prior=()): + header = Header.default() + header.timeslot = gp_const.EPOCH_TIMESLOTS + 1 + safrole = components.Safrole(BlockContext(), AppContext(), b"") + return safrole.state_transition( + header=header, + extrinsic_tickets=tickets, + pre_state_timeslot=TimeslotState(gp_const.EPOCH_TIMESLOTS), + pre_state_safrole=SafroleState( + validators=validators, + ring_commitment=bytes(144), + ticket_accumulator=list(prior), + slot_sealer_series=SlotSealerSeries(keys=[bytes(32)] * gp_const.EPOCH_TIMESLOTS), + ), + pre_state_validator_queue=ValidatorQueueState(validators), + post_state_entropy=EntropyState([bytes(32)] * 4), + post_state_validator_pool=ValidatorPoolState(validators), + post_state_disputes=DisputesState([], [], [], []), + ) + + return run + + +class RecordingFuture(Future): + def __init__(self, index, events): + super().__init__() + self.index = index + self.events = events + + def result(self, timeout=None): + self.events.append(("result", self.index)) + return super().result(timeout) + + def cancel(self): + self.events.append(("cancel", self.index)) + return super().cancel() + + +class ReverseCompletionExecutor: + """Complete a whole submitted batch backwards, without scheduler timing.""" + + def __init__(self, batch_size): + self.batch_size = batch_size + self.jobs = [] + self.events = [] + + def submit(self, function, *args): + future = RecordingFuture(len(self.jobs), self.events) + self.jobs.append((future, function, args)) + if len(self.jobs) % self.batch_size == 0: + for queued, callback, callback_args in reversed(self.jobs[-self.batch_size:]): + try: + queued.set_result(callback(*callback_args)) + except BaseException as error: + queued.set_exception(error) + self.events.append(("completed", queued.index)) + return future + + +@pytest.mark.parametrize("scores,rejected", [([1, 2], False), ([2, 1], True)]) +def test_ticket_order_uses_extrinsic_order_despite_reverse_completion( + monkeypatch, transition, scores, rejected, +): + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", True) + executor = ReverseCompletionExecutor(2) + monkeypatch.setattr(components, "_get_safrole_ticket_executor", lambda: executor) + + if rejected: + with pytest.raises(StateTransitionError) as error: + transition([envelope(score) for score in scores]) + assert error.value.custom_error_code == SafroleErrorCode.bad_ticket_order + else: + output = transition([envelope(score) for score in scores]) + assert output.post_state.ticket_accumulator == [ + TicketBody(score.to_bytes(32, "big"), 0) for score in scores + ] + + assert [event for event in executor.events if event[0] == "completed"] == [ + ("completed", 1), ("completed", 0), + ] + assert [event for event in executor.events if event[0] == "result"] == [ + ("result", 0), ("result", 1), + ] + + +@pytest.mark.parametrize("threaded", [False, True]) +@pytest.mark.parametrize("first,second,expected", [ + ("duplicate", "proof", SafroleErrorCode.duplicate_ticket), + ("proof", "attempt", SafroleErrorCode.bad_ticket_proof), + ("attempt", "duplicate", SafroleErrorCode.bad_ticket_attempt), +]) +def test_multiple_ticket_errors_preserve_sequential_precedence( + monkeypatch, transition, threaded, first, second, expected, +): + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", threaded) + executor = ReverseCompletionExecutor(2) + monkeypatch.setattr(components, "_get_safrole_ticket_executor", lambda: executor) + bad_proof_score = int.from_bytes(bytes([255]) * 32, "big") + tickets = { + "duplicate": envelope(1), + "proof": envelope(bad_proof_score), + "attempt": envelope(2, gp_const.ticket_entries(6)), + } + + with pytest.raises(StateTransitionError) as error: + transition( + [tickets[first], tickets[second]], + prior=[TicketBody((1).to_bytes(32, "big"), 0)], + ) + + assert error.value.custom_error_code == expected + if threaded: + assert [event for event in executor.events if event[0] == "result"] == [("result", 0)] + else: + assert executor.jobs == [] + + +def test_failure_cancels_queued_work_and_waits_for_running_work(monkeypatch, transition): + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", True) + events = [] + futures = [RecordingFuture(index, events) for index in range(3)] + original_error = StateTransitionError(SafroleErrorCode.bad_ticket_proof) + futures[0].set_exception(original_error) + assert futures[1].set_running_or_notify_cancel() + submitted = iter(futures) + monkeypatch.setattr( + components, "_get_safrole_ticket_executor", + lambda: SimpleNamespace(submit=lambda *_: next(submitted)), + ) + + def drain(submitted_futures): + assert list(submitted_futures) == futures + assert futures[1].running() + assert futures[2].cancelled() + events.append(("wait", None)) + futures[1].set_exception(ValueError("later worker error must not replace the first")) + + monkeypatch.setattr(components, "wait", drain) + + with pytest.raises(StateTransitionError) as error: + transition([envelope(score) for score in (1, 2, 3)]) + + assert error.value is original_error + assert futures[1].done() + assert futures[2].cancelled() + assert [event for event in events if event[0] == "result"] == [("result", 0)] + assert {event for event in events if event[0] == "cancel"} == { + ("cancel", 0), ("cancel", 1), ("cancel", 2), + } + assert events[-1] == ("wait", None) + + +def test_real_workers_finish_before_verification_error_escapes(monkeypatch, transition): + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", True) + second_started, release_second, second_finished, wait_entered = (Event() for _ in range(4)) + original_error = StateTransitionError(SafroleErrorCode.bad_ticket_proof) + + def verify(data, aux, proof): + if proof[:32] == (1).to_bytes(32, "big"): + assert second_started.wait(10), "second proof never started" + raise original_error + second_started.set() + try: + assert release_second.wait(10), "second proof was never released" + return proof[:32] + finally: + second_finished.set() + + def drain(futures): + wait_entered.set() + return wait_for_futures(futures) + + monkeypatch.setattr( + components, "jam_ring_context", lambda *_: SimpleNamespace(ring_vrf_verify=verify), + ) + monkeypatch.setattr(components, "wait", drain) + with ThreadPoolExecutor(max_workers=2) as workers, ThreadPoolExecutor(max_workers=1) as caller: + monkeypatch.setattr(components, "_get_safrole_ticket_executor", lambda: workers) + result = caller.submit(transition, [envelope(1), envelope(2)]) + try: + assert wait_entered.wait(10), "transition never began draining workers" + assert not second_finished.is_set() + assert not result.done() + finally: + release_second.set() + + with pytest.raises(StateTransitionError) as error: + result.result(timeout=10) + assert error.value is original_error + assert second_finished.is_set() + + +def test_submission_failure_still_waits_for_already_running_work(monkeypatch, transition): + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", True) + events = [] + running = RecordingFuture(0, events) + assert running.set_running_or_notify_cancel() + submission_error = RuntimeError("executor could not accept another job") + submissions = 0 + + def submit(*_): + nonlocal submissions + submissions += 1 + if submissions == 1: + return running + raise submission_error + + monkeypatch.setattr( + components, "_get_safrole_ticket_executor", lambda: SimpleNamespace(submit=submit), + ) + + def drain(futures): + assert list(futures) == [running] + assert running.running() + events.append(("wait", None)) + running.set_result(TicketBody((1).to_bytes(32, "big"), 0)) + + monkeypatch.setattr(components, "wait", drain) + + with pytest.raises(RuntimeError) as error: + transition([envelope(1), envelope(2)]) + + assert error.value is submission_error + assert running.done() + assert events == [("cancel", 0), ("wait", None)] + + +@pytest.mark.parametrize("threaded,count", [(False, 2), (True, 0), (True, 1)]) +def test_sequential_setting_and_small_batches_do_not_acquire_pool( + monkeypatch, transition, threaded, count, +): + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", threaded) + + def unexpected_executor(): + pytest.fail("this transition should verify tickets without acquiring the executor") + + monkeypatch.setattr(components, "_get_safrole_ticket_executor", unexpected_executor) + output = transition([envelope(score) for score in range(1, count + 1)]) + assert output.post_state.ticket_accumulator == [ + TicketBody(score.to_bytes(32, "big"), 0) for score in range(1, count + 1) + ] + + +def test_executor_is_reused_between_safrole_instances(monkeypatch, transition): + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", True) + monkeypatch.setattr(components, "_safrole_ticket_executor", None) + monkeypatch.setattr(components, "SAFROLE_THREAD_POOL_MAX_WORKERS", 3) + constructed = [] + + def construct_executor(*args, **kwargs): + executor = ReverseCompletionExecutor(2) + constructed.append((args, kwargs, executor)) + return executor + + monkeypatch.setattr(components, "ThreadPoolExecutor", construct_executor) + first = transition([envelope(1), envelope(2)]) + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", False) + sequential = transition([envelope(3), envelope(4)]) + assert len(constructed[0][2].jobs) == 2 + monkeypatch.setattr(components, "USE_THREAD_POOL_SAFROLE", True) + second = transition([envelope(5), envelope(6)]) + + assert [ticket.id for ticket in first.post_state.ticket_accumulator] == [ + score.to_bytes(32, "big") for score in (1, 2) + ] + assert [ticket.id for ticket in sequential.post_state.ticket_accumulator] == [ + score.to_bytes(32, "big") for score in (3, 4) + ] + assert [ticket.id for ticket in second.post_state.ticket_accumulator] == [ + score.to_bytes(32, "big") for score in (5, 6) + ] + assert len(constructed) == 1 + args, kwargs, executor = constructed[0] + assert kwargs.get("max_workers", args[0] if args else None) == 3 + assert len(executor.jobs) == 4 diff --git a/test/test_signing_ring.py b/test/test_signing_ring.py new file mode 100644 index 00000000..4575f68f --- /dev/null +++ b/test/test_signing_ring.py @@ -0,0 +1,98 @@ +"""The JAM adapter supplies membership; the native library supplies padding.""" + +from pathlib import Path + +import bandersnatch_vrfs +import pytest + +from pyjamaz import signing + + +MEMBER_COUNTS = sorted( + {count for count in (6, 9, 300, signing.VALIDATOR_COUNT) + if count <= signing.VALIDATOR_COUNT} +) + + +@pytest.mark.parametrize("count", MEMBER_COUNTS) +def test_jam_ring_context_forwards_members_and_profile_capacity(monkeypatch, count): + keys = [index.to_bytes(32, "little") for index in range(count)] + expected_context = object() + + def construct(ring_data, public_keys, *, ring_capacity): + assert ring_data == b"ring parameters" + assert public_keys == keys + assert all(type(key) is bytes for key in public_keys) + assert ring_capacity == signing.VALIDATOR_COUNT + return expected_context + + monkeypatch.setattr(signing.bandersnatch_vrfs, "RingContext", construct) + + assert signing.jam_ring_context( + b"ring parameters", (memoryview(key) for key in keys) + ) is expected_context + + +@pytest.mark.parametrize("count", [0, 3, 7, signing.VALIDATOR_COUNT + 3]) +def test_jam_ring_context_rejects_invalid_member_count(monkeypatch, count): + def construct(*_args, **_kwargs): + pytest.fail("invalid validator membership reached the native backend") + + monkeypatch.setattr(signing.bandersnatch_vrfs, "RingContext", construct) + + with pytest.raises(ValueError, match="invalid JAM validator ring"): + signing.jam_ring_context(b"", [bytes(32)] * count) + + +@pytest.mark.parametrize("key_length", [0, 31, 33]) +def test_jam_ring_context_rejects_invalid_key_length(monkeypatch, key_length): + def construct(*_args, **_kwargs): + pytest.fail("malformed public key reached the native backend") + + monkeypatch.setattr(signing.bandersnatch_vrfs, "RingContext", construct) + + with pytest.raises(ValueError, match="invalid JAM validator ring"): + signing.jam_ring_context(b"", [bytes(32)] * 5 + [bytes(key_length)]) + + +@pytest.fixture(scope="module") +def native_ring_material(): + ring_data = ( + Path(__file__).resolve().parents[1] + / "pyjamaz/data/zcash-srs-2-11-uncompressed.bin" + ).read_bytes() + secrets = [ + bandersnatch_vrfs.secret_from_seed(index.to_bytes(8, "little")) + for index in range(signing.VALIDATOR_COUNT) + ] + public_keys = [bandersnatch_vrfs.public_from_secret(key) for key in secrets] + return ring_data, secrets, public_keys + + +@pytest.mark.parametrize("count", MEMBER_COUNTS) +def test_native_padding_preserves_commitments_and_proofs(native_ring_material, count): + ring_data, secrets, public_keys = native_ring_material + keys = public_keys[:count] + context = signing.jam_ring_context(ring_data, keys) + # Previous caller-side padding is an interoperability oracle, never members + # supplied by the production JAM adapter after the native API migration. + padding_point = bytes.fromhex( + "92ca79e61dd90c1573a8693f199bf6e1e86835cc715cdcf93f5ef222560023aa" + ) + legacy = bandersnatch_vrfs.RingContext( + ring_data, keys + [padding_point] * (signing.VALIDATOR_COUNT - count) + ) + assert context.commitment == legacy.commitment + + index = count - 1 + vrf_input, aux_data = b"jam_ticket_seal" + bytes(33), b"" + expected_output = bandersnatch_vrfs.vrf_output(secrets[index], vrf_input) + for prover, verifier in ((context, legacy), (legacy, context)): + proof = prover.ring_vrf_sign(index, secrets[index], vrf_input, aux_data) + assert len(proof) == 784 + assert verifier.ring_vrf_verify(vrf_input, aux_data, proof) == expected_output + + # Reserved capacity must not enlarge the set of usable member indices. + for invalid_index in {count, signing.VALIDATOR_COUNT}: + with pytest.raises(ValueError, match="supplied public key"): + context.ring_vrf_sign(invalid_index, secrets[0], vrf_input, aux_data) diff --git a/test/test_state_materialization.py b/test/test_state_materialization.py new file mode 100644 index 00000000..556cd6f9 --- /dev/null +++ b/test/test_state_materialization.py @@ -0,0 +1,118 @@ +from copy import deepcopy + +import pytest + +from pyjamaz.merkle import PatriciaMerkleTrie +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + + +KEYS = [bytes([index]) * 31 for index in range(8)] +FINALIZED, PARENT, LEFT, RIGHT, CHILD = [bytes([index]) * 32 for index in range(1, 6)] + + +def commit(storage, block_hash, parent_hash, changes): + storage.set_block_hash(block_hash, parent_hash) + for key, value in changes.items(): + storage.put(key, value) + storage.commit() + + +@pytest.fixture +def forked_state(): + a, b, c, d, e, f, g, _ = KEYS + base = {d: b"base d", c: b"", b: b"b" * 33, a: b"base a"} + storage = StateStorage(InMemoryStorageEngine(base.copy())) + storage.set_finalized_block_hash(FINALIZED) + commit(storage, PARENT, FINALIZED, {a: b"parent a", b: None, e: b"parent e"}) + commit(storage, LEFT, PARENT, {a: None, b: b"restored b", e: b"left e", f: b"left f"}) + commit(storage, RIGHT, PARENT, {a: b"right a", d: None, e: None, g: b"right g"}) + commit(storage, CHILD, LEFT, {b: None, e: b"child e"}) + expected = { + FINALIZED: base, + PARENT: {a: b"parent a", c: b"", d: b"base d", e: b"parent e"}, + LEFT: {b: b"restored b", c: b"", d: b"base d", e: b"left e", f: b"left f"}, + RIGHT: {a: b"right a", c: b"", g: b"right g"}, + CHILD: {c: b"", d: b"base d", e: b"child e", f: b"left f"}, + } + return storage, expected + + +def assert_state(storage, block_hash, expected): + ordered = sorted(expected.items()) + root = PatriciaMerkleTrie(ordered).root() + storage.select_block_hash(block_hash) + assert storage.as_dict() == expected + assert storage.as_list() == ordered + assert storage.state_root() == root + assert storage.as_dict_at(block_hash) == expected + assert storage.as_list_at(block_hash) == ordered + assert storage.state_root_at(block_hash) == root + + +def test_newest_changes_and_deletions_win_on_each_branch(forked_state): + storage, expected = forked_state + changes = deepcopy(storage.change_sets) + + for block_hash in (CHILD, RIGHT, LEFT, PARENT, FINALIZED, CHILD): + assert_state(storage, block_hash, expected[block_hash]) + + assert storage.storage_engine.as_dict() == expected[FINALIZED] + assert storage.change_sets == changes + + +def test_views_follow_rollback_and_finalization(forked_state): + storage, expected = forked_state + storage.select_block_hash(CHILD) + storage.put(KEYS[7], b"pending") + storage.rollback() + assert_state(storage, LEFT, expected[LEFT]) + + storage.finalize(PARENT) + for block_hash in (PARENT, LEFT, RIGHT): + assert_state(storage, block_hash, expected[block_hash]) + storage.finalize(LEFT) + assert_state(storage, LEFT, expected[LEFT]) + assert RIGHT not in storage.change_sets + + +@pytest.mark.parametrize("method", ["as_dict", "as_list", "state_root"]) +def test_materialization_rejects_pending_transactions(forked_state, method): + storage, _ = forked_state + storage.put(KEYS[7], b"pending") + + with pytest.raises(ValueError, match="Pending transaction"): + getattr(storage, method)() + + +def test_retained_snapshots_exclude_pending_writes(forked_state): + storage, expected = forked_state + storage.put(KEYS[7], b"pending") + ordered = sorted(expected[CHILD].items()) + + assert storage.as_dict_at(CHILD) == expected[CHILD] + assert storage.as_list_at(CHILD) == ordered + assert storage.state_root_at(CHILD) == PatriciaMerkleTrie(ordered).root() + assert storage.transaction == {KEYS[7]: b"pending"} + + +@pytest.mark.parametrize("method", ["as_dict", "as_list", "state_root"]) +def test_materialization_still_rejects_parent_cycles(forked_state, method): + storage, _ = forked_state + storage.parents[PARENT] = CHILD + + with pytest.raises(ValueError, match="Cycle detected"): + getattr(storage, method)() + + +@pytest.mark.parametrize("count", [0, 1, 8]) +def test_root_is_independent_of_storage_iteration_order(count): + items = [(key, bytes([index]) * (31 + index)) for index, key in enumerate(KEYS[:count])] + expected_root = PatriciaMerkleTrie(items).root() + + for order in (items, items[::-1]): + storage = StateStorage(InMemoryStorageEngine(dict(order))) + storage.set_finalized_block_hash(FINALIZED) + assert storage.state_root() == expected_root + assert storage.state_root_at(FINALIZED) == expected_root + assert storage.as_list() == sorted(items) diff --git a/test/test_trace_ancestry_reuse.py b/test/test_trace_ancestry_reuse.py new file mode 100644 index 00000000..8264e4c0 --- /dev/null +++ b/test/test_trace_ancestry_reuse.py @@ -0,0 +1,152 @@ +import asyncio + +import pytest +from asyncclick.testing import CliRunner + +from pyjamaz import cli +from pyjamaz.app import AppConfig, PyjamazApp +from pyjamaz.exceptions import StateTransitionError +from pyjamaz.graypaper_constants import COMMON_ERA +from pyjamaz.models.app import StateDump, Trace, TraceGenesis +from pyjamaz.models.block import Block, Extrinsic, Header +from pyjamaz.models.state import JamState +from pyjamaz.models.stf_output import SafroleErrorCode +from pyjamaz.state.storage import StateStorage +from pyjamaz.storage import InMemoryStorageEngine + + +@pytest.fixture +def replay_app(monkeypatch): + app = PyjamazApp(AppConfig( + ring_data=b"", storage_engine=InMemoryStorageEngine(), common_era=COMMON_ERA, + )) + app.working_state = JamState.create_genesis_state() + asyncio.run(app.store_jam_state()) + state = StateDump(app.state_storage.state_root(), app.state_db.as_list()) + + async def initialize_app(**_kwargs): + return app + + monkeypatch.setattr(cli, "initialize_app", initialize_app) + monkeypatch.setattr(cli, "setup_logging", lambda *_args: None) + monkeypatch.setattr(cli.settings, "SOLO_MODE", False) + monkeypatch.setattr(cli.settings, "SKIP_TIMESLOT_WALL_CLOCK_CHECK", False) + return app, state + + +def write_chain(folder, state, count): + parent = Header.default() + (folder / "genesis.bin").write_bytes(TraceGenesis(parent, state).to_jam_bytes().to_bytes()) + headers = [parent] + for slot in range(1, count + 1): + header = Header.default() + header.parent, header.timeslot = parent.hash, slot + header.parent_state_root = state.state_root + (folder / f"{slot:03}.bin").write_bytes(Trace( + state, Block(header, Extrinsic.default()), state, + ).to_jam_bytes().to_bytes()) + headers.append(header) + parent = header + return headers + + +def replay(folder): + return asyncio.run(CliRunner().invoke(cli.main, ["traces", str(folder)])) + + +def test_linear_replay_reuses_headers_without_retaining_state(tmp_path, replay_app, monkeypatch): + app, state = replay_app + headers = write_chain(tmp_path, state, 12) + checked_headers = [] + stored_headers = [] + resolve = cli._trace_ancestor_headers + store = app.store_block_header + + def resolve_ancestry(block, known): + checked_headers.append(len(known)) + return resolve(block, known) + + async def store_header(header): + stored_headers.append(header.hash) + await store(header) + + async def inspect(block, produce=False): + slot = block.header.timeslot + assert set(app.state_storage.ancestors) == {header.hash for header in headers[:slot + 1]} + assert len(app.state_storage.parents) <= 2 + assert set(app.state_storage.change_sets) == {block.header.hash} + assert app.state_storage.transaction == {} + + monkeypatch.setattr(cli, "_trace_ancestor_headers", resolve_ancestry) + monkeypatch.setattr(app, "store_block_header", store_header) + monkeypatch.setattr(app, "state_transition", inspect) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert checked_headers == [1] * 12 + assert len(stored_headers) <= 3 * 12 + + +def test_rejected_parent_rebuilds_ancestry_for_next_input(tmp_path, replay_app, monkeypatch): + app, state = replay_app + headers = write_chain(tmp_path, state, 2) + checked_headers = [] + resolve = cli._trace_ancestor_headers + + def resolve_ancestry(block, known): + checked_headers.append(len(known)) + return resolve(block, known) + + async def reject_first(block, produce=False): + if block.header.timeslot == 1: + raise StateTransitionError(SafroleErrorCode.bad_ticket_attempt) + assert set(app.state_storage.ancestors) == {header.hash for header in headers} + + monkeypatch.setattr(cli, "_trace_ancestor_headers", resolve_ancestry) + monkeypatch.setattr(app, "state_transition", reject_first) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert checked_headers == [1, 2] + + +def test_reused_parent_still_checks_canonical_identity(tmp_path, replay_app, monkeypatch): + app, state = replay_app + write_chain(tmp_path, state, 2) + + async def mutate_header(block, produce=False): + block.header.entropy_source = b"changed".ljust(96, b"!") + + monkeypatch.setattr(app, "state_transition", mutate_header) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert "does not match its indexed hash" in str(result.exception) + + +def test_clear_can_retain_headers_without_retaining_executable_state(): + engine = InMemoryStorageEngine() + engine.put(b"key", b"base") + storage = StateStorage(engine) + parent, child = Header.default(), Header.default() + child.parent, child.timeslot = parent.hash, 1 + storage.set_finalized_header(parent) + storage.add_ancestor(child) + storage.set_block_hash(child.hash, parent.hash) + storage.put(b"key", b"committed overlay") + storage.commit() + storage.put(b"key", b"pending overlay") + ancestors = storage.ancestors + + storage.clear(keep_ancestors=True) + + assert storage.ancestors is ancestors + assert set(storage.ancestors) == {parent.hash, child.hash} + assert storage.get(b"key") == b"base" + assert storage.change_sets == storage.parents == storage.transaction == {} + assert storage.block_hash is storage.finalized_block_hash is None + storage.clear() + assert storage.ancestors == {} diff --git a/test/test_trace_header_cache.py b/test/test_trace_header_cache.py new file mode 100644 index 00000000..e0ec9796 --- /dev/null +++ b/test/test_trace_header_cache.py @@ -0,0 +1,318 @@ +import asyncio +from collections import Counter +from dataclasses import fields + +import pytest +from asyncclick.testing import CliRunner +from jamcodec.base import JamBytes + +from pyjamaz import cli +from pyjamaz.app import AppConfig, PyjamazApp +from pyjamaz.graypaper_constants import COMMON_ERA, EPOCH_TIMESLOTS, VALIDATOR_COUNT +from pyjamaz.hashing import blake2b_256_hash +from pyjamaz.models.app import StateDump, Trace, TraceGenesis +from pyjamaz.models.block import Block, EpochMark, EpochMarkValidatorKeys, Extrinsic, Header +from pyjamaz.models.common import TicketBody +from pyjamaz.models.state import JamState +from pyjamaz.storage import InMemoryStorageEngine + + +def plain_header(header): + return Header(**{field.name: getattr(header, field.name) for field in fields(Header)}) + + +def marked_header(): + header = Header.default() + header.epoch_marker = EpochMark( + entropy=b"e" * 32, + tickets_entropy=b"t" * 32, + validators=[EpochMarkValidatorKeys(b"b" * 32, b"v" * 32) for _ in range(VALIDATOR_COUNT)], + ) + header.tickets_marker = [TicketBody(b"i" * 32, 0) for _ in range(EPOCH_TIMESLOTS)] + header.offenders_marker = [b"o" * 32] + return header + + +def test_trace_header_caches_canonical_encoding_and_ignores_input_hash(monkeypatch): + source = marked_header() + canonical = source.to_jam_bytes().to_bytes() + source.hash = b"stale input override".ljust(32, b"!") + header = cli._TraceHeader.from_header(source) + serializations = [] + original = Header.to_jam_bytes + + def serialize(self): + serializations.append(self) + return original(self) + + monkeypatch.setattr(Header, "to_jam_bytes", serialize) + for _ in range(3): + assert header.to_jam_bytes().to_bytes() == canonical + assert header.hash == blake2b_256_hash(canonical) + assert header.get_unsigned_payload() == canonical[:-96] + header._author_bandersnatch_key = b"derived author key".ljust(32, b"!") + assert header.hash == blake2b_256_hash(canonical) + assert serializations == [header] + + +@pytest.mark.parametrize("mutate", [ + lambda header: setattr(header, "parent", b"p" * 32), + lambda header: setattr(header, "parent_state_root", b"r" * 32), + lambda header: setattr(header, "extrinsic_hash", b"x" * 32), + lambda header: setattr(header, "timeslot", header.timeslot + 1), + lambda header: setattr(header, "author_index", header.author_index + 1), + lambda header: setattr(header, "entropy_source", b"s" * 96), + lambda header: setattr(header, "seal", b"z" * 96), + lambda header: setattr(header.epoch_marker, "entropy", b"n" * 32), + lambda header: setattr(header.epoch_marker, "tickets_entropy", b"n" * 32), + lambda header: setattr(header.epoch_marker.validators[0], "ed25519", b"n" * 32), + lambda header: setattr(header.tickets_marker[0], "attempt", 1), + lambda header: header.tickets_marker.__setitem__(0, TicketBody(b"n" * 32, 0)), + lambda header: header.offenders_marker.append(b"n" * 32), + lambda header: header.offenders_marker.__setitem__(0, b"n" * 32), + lambda header: setattr(header, "epoch_marker", None), + lambda header: setattr(header, "tickets_marker", None), +]) +def test_trace_header_invalidates_cache_on_codec_field_mutation(mutate): + header = cli._TraceHeader.from_header(marked_header()) + before_bytes = header.to_jam_bytes().to_bytes() + before_hash = header.hash + + mutate(header) + + canonical = plain_header(header).to_jam_bytes().to_bytes() + assert canonical != before_bytes + assert header.to_jam_bytes().to_bytes() == canonical + assert header.hash == blake2b_256_hash(canonical) != before_hash + + +@pytest.mark.parametrize("mutate", [ + lambda header: setattr(header, "timeslot", False), + lambda header: setattr(header, "author_index", 0.0), + lambda header: setattr(header.tickets_marker[0], "attempt", False), + lambda header: setattr(header.tickets_marker[0], "attempt", 0.0), +]) +def test_trace_header_does_not_hide_invalid_equal_valued_types(mutate): + header = cli._TraceHeader.from_header(marked_header()) + header.to_jam_bytes() + mutate(header) + + with pytest.raises(ValueError, match="integer"): + plain_header(header).to_jam_bytes() + with pytest.raises(ValueError, match="integer"): + header.to_jam_bytes() + with pytest.raises(ValueError, match="integer"): + header.hash + + +def test_trace_header_jam_bytes_have_independent_cursors_and_buffers(): + header = cli._TraceHeader.from_header(marked_header()) + first = header.to_jam_bytes() + canonical = first.to_bytes() + first.get_next_bytes(10) + first.data[0] ^= 0xFF + + second = header.to_jam_bytes() + + assert second.offset == 0 + assert second.to_bytes() == canonical + assert Header.from_jam_bytes(second).to_jam_bytes().to_bytes() == canonical + assert first.offset == 10 + + +def test_trace_header_does_not_change_shared_header_codec_or_runtime_mutability(): + source = Header.default() + codec = Header.to_codec_def() + header = cli._TraceHeader.from_header(source) + header.hash + assert cli._TraceHeader.to_codec_def() is codec + assert codec._deserialize_type is Header + block_bytes = Block(header, Extrinsic.default()).to_jam_bytes() + assert type(Block.from_jam_bytes(block_bytes).header) is Header + + before_hash = source.hash + source.timeslot += 1 + assert source.hash != before_hash + assert source.hash == blake2b_256_hash(source.to_jam_bytes().to_bytes()) + + +def test_cached_ancestry_still_rejects_changed_header_identity(): + parent = cli._TraceHeader.from_header(Header.default()) + indexed_hash = parent.hash + child = Header.default() + child.parent = indexed_hash + child.timeslot = parent.timeslot + 2 + parent.timeslot += 1 + + with pytest.raises(ValueError, match="does not match its indexed hash"): + cli._trace_ancestor_headers(Block(child, Extrinsic.default()), {indexed_hash: parent}) + + +def test_cached_ancestry_still_rejects_nonincreasing_slots(): + grandparent = cli._TraceHeader.from_header(Header.default()) + grandparent.timeslot = 3 + parent = cli._TraceHeader.from_header(Header.default()) + parent.parent, parent.timeslot = grandparent.hash, 3 + child = Header.default() + child.parent = parent.hash + child.timeslot = 4 + + with pytest.raises(ValueError, match="timeslots are not strictly increasing"): + cli._trace_ancestor_headers( + Block(child, Extrinsic.default()), {parent.hash: parent, grandparent.hash: grandparent}, + ) + + +@pytest.mark.parametrize("candidate_slot", [2, 3]) +def test_candidate_slot_is_left_to_block_validation(candidate_slot): + parent = cli._TraceHeader.from_header(Header.default()) + parent.timeslot = 3 + child = Header.default() + child.parent, child.timeslot = parent.hash, candidate_slot + + assert cli._trace_ancestor_headers(Block(child, Extrinsic.default()), {parent.hash: parent}) == [parent] + + +def test_trace_ancestry_still_rejects_cycles(): + first, second, child = Header.default(), Header.default(), Header.default() + first.hash, second.hash = b"a" * 32, b"b" * 32 + first.parent, second.parent, child.parent = second.hash, first.hash, first.hash + first.timeslot, second.timeslot, child.timeslot = 2, 1, 3 + + with pytest.raises(ValueError, match="cycle in trace header ancestry"): + cli._trace_ancestor_headers( + Block(child, Extrinsic.default()), {first.hash: first, second.hash: second}, + ) + + +@pytest.fixture +def cache_replay_app(monkeypatch): + app = PyjamazApp(AppConfig( + ring_data=b"", storage_engine=InMemoryStorageEngine(), common_era=COMMON_ERA, + )) + app.working_state = JamState.create_genesis_state() + asyncio.run(app.store_jam_state()) + state = StateDump(app.state_storage.state_root(), app.state_db.as_list()) + + async def initialize_app(**kwargs): + return app + + async def unchanged_state(block, produce=False): + # Keep import/rollback, ancestry, persistence and state-root validation; + # these synthetic headers do not carry valid consensus seals. + return None + + monkeypatch.setattr(cli, "initialize_app", initialize_app) + monkeypatch.setattr(cli, "setup_logging", lambda *args: None) + monkeypatch.setattr(cli.settings, "SOLO_MODE", False) + monkeypatch.setattr(cli.settings, "SKIP_TIMESLOT_WALL_CLOCK_CHECK", False) + monkeypatch.setattr(app, "state_transition", unchanged_state) + return app, state + + +def write_header_trace(folder, filename, state, parent, slot, seal=None): + header = Header.default() + header.parent = parent.hash + header.parent_state_root = state.state_root + header.timeslot = slot + if seal is not None: + header.seal = seal + trace = Trace(state, Block(header, Extrinsic.default()), state) + (folder / filename).write_bytes(trace.to_jam_bytes().to_bytes()) + return header + + +def write_genesis(folder, state): + genesis = Header.default() + (folder / "genesis.bin").write_bytes(TraceGenesis(genesis, state).to_jam_bytes().to_bytes()) + return genesis + + +def replay(folder): + return asyncio.run(CliRunner().invoke(cli.main, ["traces", str(folder)])) + + +def test_trace_header_work_scales_with_unique_headers(tmp_path, cache_replay_app, monkeypatch): + app, state = cache_replay_app + parent = write_genesis(tmp_path, state) + headers = [parent] + for slot in range(1, 9): + parent = write_header_trace(tmp_path, f"{slot:03}.bin", state, parent, slot) + headers.append(parent) + serialized = [] + persisted = [] + original_encode = Header.to_jam_bytes + original_put = app.block_db.put + + def encode(header): + if isinstance(header, cli._TraceHeader): + serialized.append(header.timeslot) + return original_encode(header) + + def put(key, value): + if key.startswith(b"block_header:"): + persisted.append(key) + original_put(key, value) + + monkeypatch.setattr(Header, "to_jam_bytes", encode) + monkeypatch.setattr(app.block_db, "put", put) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert Counter(serialized) == Counter(range(9)) + assert Counter(persisted) == Counter(b"block_header:" + header.hash for header in headers) + + +def test_replay_restores_cached_same_slot_sibling_indexes(tmp_path, cache_replay_app, monkeypatch): + app, state = cache_replay_app + genesis = write_genesis(tmp_path, state) + first = write_header_trace(tmp_path, "001.bin", state, genesis, 7) + sibling = write_header_trace(tmp_path, "002.bin", state, genesis, 7, seal=b"s" * 96) + child = write_header_trace(tmp_path, "003.bin", state, first, 20) + observed = {} + + async def inspect(block, produce=False): + observed[block.header.hash] = app.retrieve_block_hash(7) + + monkeypatch.setattr(app, "state_transition", inspect) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert observed == {first.hash: first.hash, sibling.hash: sibling.hash, child.hash: first.hash} + for header in (first, sibling): + assert app.retrieve_block_header(header.hash).to_jam_bytes() == header.to_jam_bytes() + assert app.block_db.get(b"block_number:" + header.hash) == (7).to_bytes(4, "little") + + +def test_persistence_reuse_restores_indexes_and_repairs_changed_bytes(cache_replay_app): + app, _ = cache_replay_app + header = cli._TraceHeader.from_header(Header.default()) + key = b"block_header:" + header.hash + asyncio.run(app.store_block_header(header)) + app.block_db.put(key, b"corrupted stored bytes") + app.block_db.delete(b"block_hash:" + header.timeslot.to_bytes(4, "little")) + app.block_db.delete(b"block_number:" + header.hash) + + asyncio.run(app.store_block_header(header)) + + assert app.block_db.get(key) == header.to_jam_bytes().to_bytes() + assert app.retrieve_block_hash(header.timeslot) == header.hash + assert app.block_db.get(b"block_number:" + header.hash) == header.timeslot.to_bytes(4, "little") + + +def test_replay_does_not_reuse_ancestor_cache_between_corpora(tmp_path, cache_replay_app): + _, state = cache_replay_app + first_folder, second_folder = tmp_path / "a", tmp_path / "b" + first_folder.mkdir() + second_folder.mkdir() + genesis = write_genesis(first_folder, state) + first = write_header_trace(first_folder, "001.bin", state, genesis, 7) + write_genesis(second_folder, state) + write_header_trace(second_folder, "001.bin", state, first, 20) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert "missing its parent header" in result.output diff --git a/test/test_trace_replay.py b/test/test_trace_replay.py new file mode 100644 index 00000000..8825188e --- /dev/null +++ b/test/test_trace_replay.py @@ -0,0 +1,225 @@ +import asyncio + +import pytest +from asyncclick.testing import CliRunner + +from pyjamaz import cli +from pyjamaz.app import AppConfig, PyjamazApp +from pyjamaz.exceptions import ( + BlockValidationError, BlockValidationErrorCode, StateTransitionError, +) +from pyjamaz.graypaper_constants import COMMON_ERA +from pyjamaz.models.app import StateDump, Trace, TraceGenesis +from pyjamaz.models.block import Block, Extrinsic, Header +from pyjamaz.models.state import JamState +from pyjamaz.models.stf_output import SafroleErrorCode +from pyjamaz.storage import InMemoryStorageEngine + + +@pytest.fixture +def replay_app(monkeypatch): + app = PyjamazApp(AppConfig( + ring_data=b"", storage_engine=InMemoryStorageEngine(), common_era=COMMON_ERA, + )) + app.working_state = JamState.create_genesis_state() + asyncio.run(app.store_jam_state()) + state = StateDump(app.state_storage.state_root(), app.state_db.as_list()) + + async def initialize_app(**kwargs): + return app + + async def unchanged_state(block, produce=False): + # Synthetic headers have no valid seal. Keep real import/rollback, + # storage, ancestry and codecs, replacing only the consensus transition. + return None + + monkeypatch.setattr(cli, "initialize_app", initialize_app) + monkeypatch.setattr(cli, "setup_logging", lambda *args: None) + monkeypatch.setattr(cli.settings, "SOLO_MODE", False) + monkeypatch.setattr(cli.settings, "SKIP_TIMESLOT_WALL_CLOCK_CHECK", False) + monkeypatch.setattr(app, "state_transition", unchanged_state) + return app, state + + +def header_at(slot, parent=None, state_root=bytes(32)): + header = Header.default() + header.timeslot = slot + header.parent = parent.hash if parent is not None else bytes(32) + header.parent_state_root = state_root + return header + + +def write_genesis(folder, state): + header = header_at(0) + (folder / "genesis.bin").write_bytes(TraceGenesis(header, state).to_jam_bytes().to_bytes()) + return header + + +def write_trace(folder, name, header, pre_state, post_state=None): + trace = Trace(pre_state, Block(header, Extrinsic.default()), post_state or pre_state) + (folder / name).write_bytes(trace.to_jam_bytes().to_bytes()) + + +def replay(folder): + return asyncio.run(CliRunner().invoke(cli.main, ["traces", str(folder)])) + + +def test_replay_uses_genesis_and_actual_branch_ancestry(tmp_path, replay_app, monkeypatch): + app, state = replay_app + genesis = write_genesis(tmp_path, state) + first = header_at(7, genesis, state.state_root) + sibling = header_at(13, genesis, state.state_root) + child = header_at(20, first, state.state_root) + for name, header in [("001.bin", first), ("002.bin", sibling), ("003.bin", child)]: + write_trace(tmp_path, name, header, state) + observed_ancestry = {} + + async def inspect_ancestry(block, produce=False): + observed_ancestry[block.header.hash] = { + ancestor.hash: ancestor.to_jam_bytes().to_bytes() + for ancestor in app.state_storage.ancestors.values() + } + + monkeypatch.setattr(app, "state_transition", inspect_ancestry) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + for block, ancestors in [ + (first, [genesis, first]), + (sibling, [genesis, sibling]), + (child, [genesis, first, child]), + ]: + assert observed_ancestry[block.hash] == { + ancestor.hash: ancestor.to_jam_bytes().to_bytes() for ancestor in ancestors + } + assert app.retrieve_block_header(genesis.hash) == genesis + assert app.retrieve_block_header(first.hash).timeslot == 7 + + +def test_replay_missing_parent_is_an_error(tmp_path, replay_app, monkeypatch): + app, state = replay_app + missing_parent = header_at(0) + write_trace(tmp_path, "001.bin", header_at(7, missing_parent, state.state_root), state) + imported = [] + + async def record_import(block, produce=False): + imported.append(block.header.hash) + + monkeypatch.setattr(app, "state_transition", record_import) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert "missing its parent header" in result.output + assert imported == [] + + +def test_replay_pre_state_root_mismatch_is_an_error(tmp_path, replay_app, monkeypatch): + app, state = replay_app + genesis = write_genesis(tmp_path, state) + invalid_pre_state = StateDump(b"!" * 32, state.keyvals) + write_trace(tmp_path, "001.bin", header_at(7, genesis, invalid_pre_state.state_root), invalid_pre_state) + imported = [] + + async def record_import(block, produce=False): + imported.append(block.header.hash) + + monkeypatch.setattr(app, "state_transition", record_import) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert "Pre-state root mismatch" in result.output + assert imported == [] + + +def test_replay_post_state_root_mismatch_is_an_error(tmp_path, replay_app): + _, state = replay_app + genesis = write_genesis(tmp_path, state) + invalid_post_state = StateDump(b"!" * 32, state.keyvals) + write_trace(tmp_path, "001.bin", header_at(7, genesis, state.state_root), state, invalid_post_state) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert "1 trace state-root mismatch" in result.output + + +def test_replay_pre_state_validation_does_not_reuse_cached_state(tmp_path, replay_app, monkeypatch): + app, state = replay_app + genesis = write_genesis(tmp_path, state) + first = header_at(7, genesis, state.state_root) + child = header_at(20, first, state.state_root) + write_trace(tmp_path, "001.bin", first, state) + # The claimed root matches the previously loaded state, but these keyvals + # do not. The new dump must be checked against its own trie. + corrupt_state = StateDump(state.state_root, state.keyvals + [(b"\xfe" * 31, b"unexpected")]) + write_trace(tmp_path, "002.bin", child, corrupt_state) + imported = [] + + async def record_import(block, produce=False): + imported.append(block.header.hash) + + monkeypatch.setattr(app, "state_transition", record_import) + + result = replay(tmp_path) + + assert result.exit_code != 0 + assert "Pre-state root mismatch" in result.output + assert "002.bin" in result.output + assert imported == [first.hash] + + +@pytest.mark.parametrize("error_type,error_code", [ + (BlockValidationError, BlockValidationErrorCode.invalid_seal_key), + (StateTransitionError, SafroleErrorCode.bad_ticket_attempt), +]) +def test_replay_expected_rejection_uses_restored_state(tmp_path, replay_app, monkeypatch, error_type, error_code): + app, state = replay_app + genesis = write_genesis(tmp_path, state) + rejected = header_at(7, genesis, state.state_root) + write_trace(tmp_path, "001.bin", rejected, state) + rejected_imports = [] + + async def reject_after_write(block, produce=False): + rejected_imports.append(block.header.hash) + app.working_state.timeslot.number = block.header.timeslot + await app.components.timeslot.store_state(app.working_state.timeslot) + raise error_type(error_code) + + monkeypatch.setattr(app, "state_transition", reject_after_write) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert rejected_imports == [rejected.hash] + assert app.working_state.timeslot.number == 0 + assert app.working_state.state_root == state.state_root + assert app.state_storage.state_root() == state.state_root + assert app.state_storage.transaction == {} + assert rejected.hash not in app.state_storage.change_sets + + +def test_replay_rejects_earlier_candidate_slot_and_continues(tmp_path, replay_app, monkeypatch): + app, state = replay_app + genesis = write_genesis(tmp_path, state) + parent = header_at(7, genesis, state.state_root) + rejected = header_at(6, parent, state.state_root) + sibling = header_at(8, parent, state.state_root) + for name, header in [('001.bin', parent), ('002.bin', rejected), ('003.bin', sibling)]: + write_trace(tmp_path, name, header, state) + imported = [] + + async def validate(block, produce=False): + imported.append(block.header.timeslot) + if block.header.timeslot == 6: + raise BlockValidationError(BlockValidationErrorCode.bad_slot) + + monkeypatch.setattr(app, 'state_transition', validate) + + result = replay(tmp_path) + + assert result.exit_code == 0, result.output + assert imported == [7, 6, 8] + assert app.working_state.state_root == state.state_root diff --git a/test/test_trie_hash_cache.py b/test/test_trie_hash_cache.py new file mode 100644 index 00000000..733baccf --- /dev/null +++ b/test/test_trie_hash_cache.py @@ -0,0 +1,319 @@ +from hashlib import blake2b + +import pytest + +from pyjamaz import merkle +from pyjamaz.merkle import PatriciaMerkleTrie + + +def digest(data): + return blake2b(data, digest_size=32).digest() + + +def reference_root(entries, index=0, hash_function=digest): + """Uncached reference that does not call the production node encoders.""" + if not entries: + return bytes(32) + if len(entries) == 1: + key, value = entries[0] + if len(value) <= 32: + encoded = bytes([0x80 | len(value)]) + key + value.ljust(32, b"\0") + else: + encoded = b"\xc0" + key + hash_function(value) + else: + left, right = [], [] + for key, value in entries: + side = right if key[index // 8] & (0x80 >> (index % 8)) else left + side.append((key, value)) + left_hash = reference_root(left, index + 1, hash_function) + right_hash = reference_root(right, index + 1, hash_function) + encoded = bytes([left_hash[0] & 0x7F]) + left_hash[1:] + right_hash + return hash_function(encoded) + + +KEYS = [blake2b(bytes([i]), digest_size=31).digest() for i in range(8)] + + +@pytest.fixture(autouse=True) +def clear_trie_hash_caches(): + merkle._cached_trie_leaf_hash.cache_clear() + merkle._cached_trie_large_leaf_hash.cache_clear() + merkle._cached_trie_branch_hash.cache_clear() + yield + merkle._cached_trie_leaf_hash.cache_clear() + merkle._cached_trie_large_leaf_hash.cache_clear() + merkle._cached_trie_branch_hash.cache_clear() + + +@pytest.mark.parametrize("length", [0, 1, 31, 32, 33, 4096]) +def test_leaf_hash_matches_reference_at_value_boundaries(length): + entries = [(KEYS[0], bytes(range(256)) * (length // 256) + bytes(range(length % 256)))] + + assert PatriciaMerkleTrie(entries).root() == reference_root(entries) + assert PatriciaMerkleTrie(entries).root() == reference_root(entries) + + +def test_roots_follow_changed_entries_and_forks_in_any_order(): + base = list(zip(KEYS, [b"", b"a", b"b" * 31, b"c" * 32, b"d" * 33, + b"e" * 256, b"f", b"g"])) + changed_value = [(key, b"changed" if key == KEYS[2] else value) for key, value in base] + changed_key = [(blake2b(b"replacement", digest_size=31).digest(), base[0][1]), *base[1:]] + removed = base[1:] + + for entries in (base, changed_value, changed_key, removed, base, changed_value, base): + expected = reference_root(entries) + assert PatriciaMerkleTrie(entries).root() == expected + assert PatriciaMerkleTrie(list(reversed(entries))).root() == expected + + +@pytest.mark.parametrize("index", [0, 1, 8, 17]) +def test_root_respects_starting_bit_index(index): + entries = list(zip(KEYS, [bytes([i]) * (i + 31) for i in range(len(KEYS))])) + + assert PatriciaMerkleTrie(entries).root(index=index) == reference_root(entries, index=index) + + +def test_mutating_source_entries_does_not_return_a_stale_root(): + entries = [(KEYS[0], b"initial"), (KEYS[1], b"unchanged" * 8)] + trie = PatriciaMerkleTrie(entries) + original = trie.root() + + entries[0] = (KEYS[0], b"changed") + assert trie.root() == reference_root(entries) + assert trie.root() != original + + entries.append((KEYS[2], b"added")) + assert trie.root() == reference_root(entries) + entries.pop() + entries[0] = (KEYS[0], b"initial") + assert trie.root() == original + + +@pytest.mark.parametrize("length", [32, 33, 8192]) +def test_mutating_input_buffers_does_not_return_a_stale_hash(length): + key = bytearray(KEYS[0]) + value = bytearray(b"v" * length) + entries = [(key, value)] + trie = PatriciaMerkleTrie(entries) + original = trie.root() + + value[0] = ord("w") + assert trie.root() == reference_root(entries) + assert trie.root() != original + key[0] ^= 0x80 + assert trie.root() == reference_root(entries) + + # Earlier cache entries must retain their original content if the cache + # accepts mutable buffers, rather than retaining references to the buffers. + assert PatriciaMerkleTrie([(KEYS[0], b"v" * length)]).root() == original + + +def test_empty_root_remains_zero(): + assert PatriciaMerkleTrie([]).root() == bytes(32) + + +def test_repeated_roots_reuse_hashes_across_instances_and_input_order(): + entries = list(zip(KEYS, [bytes([i]) * (i + 31) for i in range(len(KEYS))])) + expected = reference_root(entries) + assert PatriciaMerkleTrie(entries).root() == expected + initial_leaf = merkle._cached_trie_leaf_hash.cache_info() + initial_branch = merkle._cached_trie_branch_hash.cache_info() + + assert PatriciaMerkleTrie(list(reversed(entries))).root() == expected + leaf = merkle._cached_trie_leaf_hash.cache_info() + branch = merkle._cached_trie_branch_hash.cache_info() + assert leaf.misses == initial_leaf.misses + assert branch.misses == initial_branch.misses + assert leaf.hits > initial_leaf.hits + assert branch.hits > initial_branch.hits + + +def test_small_leaf_cache_routes_larger_inputs_to_the_large_cache(): + limit = merkle._TRIE_LEAF_CACHE_MAX_INPUT_BYTES + key = KEYS[0] + accepted = [(key, b"a" * (limit - len(key)))] + oversized = [(key, b"b" * (limit - len(key) + 1))] + + for _ in range(2): + assert PatriciaMerkleTrie(accepted).root() == reference_root(accepted) + cached = merkle._cached_trie_leaf_hash.cache_info() + assert cached.currsize == 1 + assert cached.hits == 1 + + for _ in range(2): + assert PatriciaMerkleTrie(oversized).root() == reference_root(oversized) + assert merkle._cached_trie_leaf_hash.cache_info() == cached + large = merkle._cached_trie_large_leaf_hash.cache_info() + assert large.currsize == 1 + assert large.hits == 1 + + +def test_large_leaf_cache_admits_only_inputs_within_its_byte_limit(): + limit = merkle._TRIE_LARGE_LEAF_CACHE_MAX_INPUT_BYTES + key = KEYS[0] + accepted = [(key, b"a" * (limit - len(key)))] + oversized = [(key, b"b" * (limit - len(key) + 1))] + + for _ in range(2): + assert PatriciaMerkleTrie(accepted).root() == reference_root(accepted) + cached = merkle._cached_trie_large_leaf_hash.cache_info() + assert cached.currsize == 1 + assert cached.hits == 1 + + for _ in range(2): + assert PatriciaMerkleTrie(oversized).root() == reference_root(oversized) + assert merkle._cached_trie_large_leaf_hash.cache_info() == cached + assert merkle._cached_trie_leaf_hash.cache_info().currsize == 0 + + +def test_large_leaf_reuse_depends_on_content_across_independent_buffers(): + key = KEYS[0] + value = b"program" * 20000 + expected = reference_root([(key, value)]) + assert PatriciaMerkleTrie([(key, value)]).root() == expected + copied_value = bytes(bytearray(value)) + assert copied_value is not value + + assert PatriciaMerkleTrie([(key, copied_value)]).root() == expected + cached = merkle._cached_trie_large_leaf_hash.cache_info() + assert cached.currsize == 1 + assert cached.misses == 1 + assert cached.hits == 1 + + +def test_mutable_inputs_bypass_the_leaf_cache(): + for key, value in ( + (bytearray(KEYS[0]), b"a"), + (KEYS[0], bytearray(b"a" * 33)), + (KEYS[0], bytearray(b"a" * 8192)), + ): + entries = [(key, value)] + assert PatriciaMerkleTrie(entries).root() == reference_root(entries) + assert PatriciaMerkleTrie(entries).root() == reference_root(entries) + assert merkle._cached_trie_leaf_hash.cache_info().currsize == 0 + assert merkle._cached_trie_large_leaf_hash.cache_info().currsize == 0 + + +def test_leaf_cache_has_bounded_retention_and_evicts_old_entries(): + cache = merkle._cached_trie_leaf_hash + limit = cache.cache_info().maxsize + assert limit == 4096 + for index in range(limit + 1): + key = index.to_bytes(31, "little") + assert cache(key, b"value") == reference_root([(key, b"value")]) + assert cache.cache_info().currsize == limit + + before = cache.cache_info() + cache(bytes(31), b"value") + assert cache.cache_info().misses == before.misses + 1 + assert cache.cache_info().currsize == limit + + +def test_large_leaf_cache_has_bounded_retention_and_evicts_old_entries(): + cache = merkle._cached_trie_large_leaf_hash + limit = cache.cache_info().maxsize + assert limit == 32 + value = b"v" * 8192 + for index in range(limit + 1): + key = index.to_bytes(31, "little") + assert cache(key, value) == reference_root([(key, value)]) + assert cache.cache_info().currsize == limit + + before = cache.cache_info() + cache(bytes(31), value) + assert cache.cache_info().misses == before.misses + 1 + assert cache.cache_info().currsize == limit + + +def test_branch_cache_has_bounded_retention_and_evicts_old_entries(): + cache = merkle._cached_trie_branch_hash + limit = cache.cache_info().maxsize + assert limit == 8192 + right = bytes(32) + for index in range(limit + 1): + left = index.to_bytes(32, "little") + encoded = bytes([left[0] & 0x7F]) + left[1:] + right + assert cache(left, right) == digest(encoded) + assert cache.cache_info().currsize == limit + + before = cache.cache_info() + cache(bytes(32), right) + assert cache.cache_info().misses == before.misses + 1 + assert cache.cache_info().currsize == limit + + +def test_subclass_leaf_encoder_is_preserved(): + class TaggedLeafTrie(PatriciaMerkleTrie): + @staticmethod + def _leaf(key, value): + return b"custom" + PatriciaMerkleTrie._leaf(key, value) + + key, value = KEYS[0], b"value" + PatriciaMerkleTrie([(key, value)]).root() + expected = digest(b"custom" + bytes([0x80 | len(value)]) + key + value.ljust(32, b"\0")) + before = merkle._cached_trie_leaf_hash.cache_info() + assert TaggedLeafTrie([(key, value)]).root() == expected + assert merkle._cached_trie_leaf_hash.cache_info() == before + + +def test_subclass_branch_encoder_is_preserved(): + class TaggedBranchTrie(PatriciaMerkleTrie): + @staticmethod + def _branch(left, right): + return b"custom" + PatriciaMerkleTrie._branch(left, right) + + entries = [(bytes(31), b"left"), (b"\x80" + bytes(30), b"right")] + PatriciaMerkleTrie(entries).root() + left, right = (reference_root([entry]) for entry in entries) + expected = digest(b"custom" + bytes([left[0] & 0x7F]) + left[1:] + right) + before = merkle._cached_trie_branch_hash.cache_info() + assert TaggedBranchTrie(entries).root() == expected + assert merkle._cached_trie_branch_hash.cache_info() == before + + +def test_mutable_child_hashes_bypass_the_branch_cache(): + class MutableChildHashTrie(PatriciaMerkleTrie): + def merkle(self, data, index=0): + result = super().merkle(data, index) + return bytearray(result) if len(data) == 1 else result + + entries = [(bytes(31), b"left"), (b"\x80" + bytes(30), b"right")] + PatriciaMerkleTrie(entries).root() + before = merkle._cached_trie_branch_hash.cache_info() + + assert MutableChildHashTrie(entries).root() == reference_root(entries) + assert merkle._cached_trie_branch_hash.cache_info() == before + + +def test_oversized_child_hashes_preserve_validation_without_cache_admission(): + class OversizedChildHashTrie(PatriciaMerkleTrie): + def merkle(self, data, index=0): + if len(data) == 1: + return b"x" * 33 + return super().merkle(data, index) + + entries = [(bytes(31), b"left"), (b"\x80" + bytes(30), b"right")] + PatriciaMerkleTrie(entries).root() + before = merkle._cached_trie_branch_hash.cache_info() + + with pytest.raises(AssertionError, match="Branch inputs must be 32 bytes each"): + OversizedChildHashTrie(entries).root() + assert merkle._cached_trie_branch_hash.cache_info() == before + + +@pytest.mark.parametrize("length", [80, 8192]) +def test_overridden_hash_function_is_preserved_after_cache_warmup(monkeypatch, length): + entries = [(KEYS[0], b"v" * length), (KEYS[1], b"short")] + PatriciaMerkleTrie(entries).root() + before_leaf = merkle._cached_trie_leaf_hash.cache_info() + before_large_leaf = merkle._cached_trie_large_leaf_hash.cache_info() + before_branch = merkle._cached_trie_branch_hash.cache_info() + + def custom_hash(data): + return digest(b"custom" + data) + + monkeypatch.setattr(merkle, "blake2b_256_hash", custom_hash) + assert PatriciaMerkleTrie(entries).root() == reference_root(entries, hash_function=custom_hash) + assert merkle._cached_trie_leaf_hash.cache_info() == before_leaf + assert merkle._cached_trie_large_leaf_hash.cache_info() == before_large_leaf + assert merkle._cached_trie_branch_hash.cache_info() == before_branch diff --git a/test/test_work_package_gas_limits.py b/test/test_work_package_gas_limits.py new file mode 100644 index 00000000..2d1cd386 --- /dev/null +++ b/test/test_work_package_gas_limits.py @@ -0,0 +1,58 @@ +from unittest.mock import Mock + +import pytest + +import pyjamaz.refinement as refinement_module +import pyjamaz.graypaper_constants as gp_const +from pyjamaz.availability import BundleData +from pyjamaz.exceptions import ProcessWorkpackageError +from pyjamaz.hostcalls.models import PvmIsAuthorizedOutput, PvmRefineOutput +from pyjamaz.models.common import RefinementContext, WorkExecResult, WorkItem, WorkPackage +from pyjamaz.models.state import ServicesState +from pyjamaz.refinement import Refinement + + +@pytest.mark.parametrize('field,limit', [ + ('refine_gas_limit', gp_const.GAS_REFINE), + ('accumulate_gas_limit', gp_const.GAS_ACCUMULATION), +]) +@pytest.mark.parametrize('split,offset,rejected', [ + (False, -1, False), + (False, 0, False), + (False, 1, True), + (True, -1, False), + (True, 0, False), + (True, 1, True), +]) +def test_declared_package_gas_limits(monkeypatch, field, limit, split, offset, rejected): + budgets = [limit // 2, limit - limit // 2 + offset] if split else [limit + offset] + items = [] + for budget in budgets: + item = WorkItem(service=42, code_hash=bytes(32), refine_gas_limit=1, accumulate_gas_limit=1, + export_count=0, payload=b'', import_segments=[], extrinsic=[]) + setattr(item, field, budget) + items.append(item) + context = RefinementContext(anchor=bytes(32), anchor_slot=0, state_root=bytes(32), + beefy_root=bytes(32), lookup_anchor=bytes(32), lookup_anchor_slot=0, + lookup_anchor_state_root=bytes(32), prerequisites=[]) + package = WorkPackage(auth_code_host=42, auth_code_hash=bytes(32), context=context, + authorization=b'', authorizer_config=b'', items=items) + authorize = Mock(return_value=PvmIsAuthorizedOutput(WorkExecResult(ok=b''), 0)) + refine = Mock(return_value=PvmRefineOutput(WorkExecResult(ok=b''), [], 0)) + monkeypatch.setattr(WorkPackage, 'set_authorization_code', lambda *_: None) + monkeypatch.setattr(refinement_module, 'pvm_invoke_is_authorized', authorize) + monkeypatch.setattr(refinement_module, 'pvm_invoke_refine', refine) + execution = Refinement(ServicesState(), BundleData()) + + if rejected: + with pytest.raises(ProcessWorkpackageError, match='work-package gas limits exceed core limits'): + execution.compute_work_report(package, 0, {}, gp_const.VALIDATOR_COUNT) + authorize.assert_not_called() + refine.assert_not_called() + assert execution.bundle == b'' + assert execution.exported_segments == [] + else: + report = execution.compute_work_report(package, 0, {}, gp_const.VALIDATOR_COUNT) + assert len(report.results) == len(items) + authorize.assert_called_once_with(package, 0) + assert refine.call_count == len(items)