Skip to content

feat: add ledger fields to contract-info.json#248

Open
RomarQ wants to merge 7 commits intoLFDT-Minokawa:mainfrom
RomarQ:feat/ledger-in-contract-info
Open

feat: add ledger fields to contract-info.json#248
RomarQ wants to merge 7 commits intoLFDT-Minokawa:mainfrom
RomarQ:feat/ledger-in-contract-info

Conversation

@RomarQ
Copy link
Copy Markdown
Contributor

@RomarQ RomarQ commented Mar 23, 2026

Implements LFDT-Minokawa/compact#237

Adds a "ledger" key to contract-info.json containing an array of ledger field descriptors with name, path index, export status, storage kind, and fully-resolved type trees.

{
  "ledger": [
    {
      "name": "authority",
      "index": 0,
      "exported": false,
      "storage": "Cell",
      "type": {
        "type-name": "Bytes",
        "length": 32
      }
    },
    {
      "name": "state",
      "index": 2,
      "exported": false,
      "storage": "Cell",
      "type": {
        "type-name": "Enum",
        "name": "STATE",
        "elements": [
          "unset",
          "set"
        ]
      }
    }
  ]
}

This enables language-agnostic tooling to discover a contract's ledger layout from the compiler output alone. One use case for this can be found in midnight-rust-bindgen, which uses the contract-info.json to generate rRust bindings for interacting with the contract from rust projects.

@RomarQ RomarQ requested review from a team as code owners March 23, 2026 23:52
RomarQ added 2 commits March 23, 2026 23:56
Serialize all ledger fields with name, index, export status, storage
kind and type parameters. Uses PascalCase ADT names for storage field.
Handles B-tree path indices for contracts with >15 ledger fields.

Signed-off-by: Rodrigo Quelhas <rodrigo_quelhas@outlook.pt>
Cover all ledger types (Cell, Counter, Map, Set, List, MerkleTree,
HistoricMerkleTree), nested ADTs (Map<Field, Map<Field, Counter>>),
and B-tree multi-element indices for >15 fields.

Signed-off-by: Rodrigo Quelhas <rodrigo_quelhas@outlook.pt>
@RomarQ RomarQ force-pushed the feat/ledger-in-contract-info branch from f8082c2 to b5a1a98 Compare March 23, 2026 23:56
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

Compactc E2E Tests Results

  1 files  ±     0   48 suites  +47   2m 33s ⏱️ - 27m 26s
467 tests  - 14 533  461 ✅  - 14 539  6 💤 +6  0 ❌ ±0 
478 runs   - 14 522  472 ✅  - 14 528  6 💤 +6  0 ❌ ±0 

Results for commit 645549e. ± Comparison against base commit fd5310c.

This pull request removes 15000 and adds 467 tests. Note that renamed tests count towards both.
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_0.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_1.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_10.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_100.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_101.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_102.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_103.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_104.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_105.compact'
src/tests/fuzzer.e2e.test.ts ‑ [E2E] Fuzzer tests for compiler > should be able to compile synthetic contract: 'assert_contract_106.compact'
…
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[MFG-413] should compile and not thro…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-12371] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-15405] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-15733] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-15826] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-16040] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-16059] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-16447] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-16853] should compile and not thr…'
src/tests/bugs/compiler.bugs.e2e.test.ts ‑ [Bugs] Compiler > '[PM-16999] should return an error if …'
…

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

Plugin Test Summary

 1 files   3 suites   1s ⏱️
21 tests 21 ✅ 0 💤 0 ❌
23 runs  23 ✅ 0 💤 0 ❌

Results for commit e8c1fff.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

Compactc E2E Test Summary

  1 files  ±0   48 suites  ±0   2m 28s ⏱️ ±0s
481 tests ±0  475 ✅ ±0  6 💤 ±0  0 ❌ ±0 
492 runs  ±0  486 ✅ ±0  6 💤 ±0  0 ❌ ±0 

Results for commit e8c1fff. ± Comparison against base commit 1db6cba.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant