fix: add nesting depth guard for ledger ADT types#255
Open
RomarQ wants to merge 4 commits intoLFDT-Minokawa:mainfrom
Open
fix: add nesting depth guard for ledger ADT types#255RomarQ wants to merge 4 commits intoLFDT-Minokawa:mainfrom
RomarQ wants to merge 4 commits intoLFDT-Minokawa:mainfrom
Conversation
Add a compile-time check that rejects ledger types nested deeper than max-adt-nesting-depth (4). This prevents the compiler from crashing with OOM on deeply nested Map types like Map<K, Map<K, Map<...>>>. The guard checks the structural depth of already-resolved type arguments in apply-ledger-ADT before expansion, following the same pattern as the existing MerkleTree depth check. Signed-off-by: Rodrigo Quelhas <rodrigo_quelhas@outlook.pt>
05a6505 to
2817546
Compare
Compactc E2E Tests Results 1 files ± 0 48 suites +47 2m 31s ⏱️ - 27m 28s Results for commit 8f5581c. ± Comparison against base commit fd5310c. This pull request removes 15000 and adds 467 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
type-adt-depth did not handle talias nodes wrapping tadt, returning 0 for any aliased Map type. This allowed bypassing the nesting depth guard via type aliases (e.g. type MyMap = Map<Field, Boolean>). Add a talias clause that recurses through the alias before checking depth, consistent with how public-adt? uses de-alias. Signed-off-by: Rodrigo Quelhas <rodrigo_quelhas@outlook.pt>
Plugin Test Summary 1 files 3 suites 1s ⏱️ Results for commit 10f0bb4. |
Compactc E2E Test Summary 1 files ± 0 1 suites - 47 5m 51s ⏱️ + 3m 16s Results for commit 10f0bb4. ± Comparison against base commit b2a2f08. This pull request removes 467 and adds 2827 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a compile-time check that rejects ledger types nested deeper than max-adt-nesting-depth (4). This prevents the compiler from crashing with OOM on deeply nested Map types like
Map<K, Map<K, Map<...>>>.The guard checks the structural depth of already-resolved type arguments in apply-ledger-ADT before expansion, following the same pattern as the existing MerkleTree depth check.