feat: add --standard-json I/O mode to edgec#33
Merged
Conversation
✅ Deploy Preview for edgelang ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
This implements issue #27. The
edgec standard-jsonsubcommand now implements the Foundry/solc standard JSON IPC protocol, makingedgeca drop-in compiler backend forfoundry-compilers.The subcommand reads a JSON compilation request from stdin, compiles each source file listed in the
sourcesmap, and writes a JSON response to stdout. The response follows solc's standard JSON output schema with a top-levelcontractsmap keyed by source path and contract name, each entry containing the ABI as a JSON array and the EVM bytecode as a raw hex string without a0xprefix. All errors — parse failures, type errors, codegen failures — are encoded as structured objects in theerrorsarray rather than signaled through the exit code, which always stays 0.The implementation lives in a new
crates/driver/src/standard_json.rsmodule that definesStandardJsonInput,StandardJsonOutput, and thecompile_standard_jsonfunction. This function iterates over the input sources, callsCompiler::from_sourcefor each, and assembles the output. As a side fix, the full bytecode path incompiler.rswas corrected to populateabionCompileOutput— previously it was alwaysNoneoutside of--emit abimode.Four integration tests in
crates/driver/tests/standard_json.rscover successful compilation of counter.edge, structured error output on invalid source, JSON schema correctness, and the no-0x-prefix invariant on bytecode output. All workspace tests pass.Closes #27.