Stream .asts.json to fix autosetup OOM (SIGKILL) on larger trees - #75
Merged
Conversation
naftali-g
reviewed
Jul 15, 2026
Comment on lines
+1150
to
+1155
| contract_defs.append({ | ||
| "id": node.get("id"), | ||
| "name": node.get("name"), | ||
| "abstract": node.get("abstract", False), | ||
| "contractKind": node.get("contractKind", "contract"), | ||
| "linearizedBaseContracts": node.get("linearizedBaseContracts", []), |
Contributor
There was a problem hiding this comment.
do we want to make this a dataclass?
Contributor
There was a problem hiding this comment.
if we had a pydantic model of the solc ast a lot of our work would be a lot easier... I wonder if such exists
Contributor
There was a problem hiding this comment.
there might be one for typescript https://github.com/OpenZeppelin/solidity-ast
Contributor
Author
There was a problem hiding this comment.
Perhaps I leave that for a follow-up PR? and in this one I add a dataclass for this local change
shellygr
approved these changes
Jul 15, 2026
shellygr
added a commit
that referenced
this pull request
Jul 16, 2026
…solidity_ast stream_ast_files's four call sites collapse into the typed layer: new AstDump.stream_units() (per-compilation-unit typed streaming with unit_filter and solc_version gates) and stream_raw_units() (raw pairs for the byte-compat parent-graph pass, which now accepts streamed units). All three consumers stream instead of whole-file loading; load_cached is gone (the memory win outweighs the shared parse), stream_ast_files removed with its purpose. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Autosetup
json.loaded the whole.asts.json(~2.5GB on a mid-size project) at four sites on the compilation-analysis path, each ballooning to 8-12GB of Python objects and getting OOM-killed.New
stream_ast_files()(utils/file_utils.py) streams the file one source file at a time viaijson; all four loaders (generate_ast_graph,_build_declared_contracts_by_file,_extract_inheritance_and_abstract_from_ast,auto_munges.detect_and_apply_code_access_patches) route through it. Addsijson.