Skip to content

executor: return the compiler errors of compileSourceCode - #13

Merged
EnzinoBB merged 2 commits into
build/reproducible-1518from
fix/compile-errors
Nov 3, 2026
Merged

EnzinoBB merged 2 commits into
build/reproducible-1518from
fix/compile-errors

Conversation

@EnzinoBB

@EnzinoBB EnzinoBB commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

ContractExecutorHandler.compileSourceCode leaves result.byteCodeObjects null when the compiler throws a CompilationException, then logs result.byteCodeObjects.size() (the arguments are evaluated whatever the log level). The NullPointerException escapes the handler, Thrift answers "Internal error processing compileSourceCode", and the compiler's error list never reaches the node or its API clients (SmartContractCompile).

Change

  • The debug log counts a null list as 0. The CompilationException branch is otherwise unchanged: it returns status FAILURE with defineFailureCode(e), whose message is the root-cause stack trace, starting with CompilationException: compilation errors in class <Name> : followed by one <line>:<message> line per error. byteCodeObjects stays unset (the node's SmartContractCompile returns on a non-zero status before reading it).
  • Unit test compileSourceCodeReturnsCompilationErrors in ContractExecutorHandlerTest (fails with the NPE before the fix, passes after; checked locally on JDK 17, the whole class 11/11).
  • The Build workflow now runs ContractExecutorHandlerTest after the jars are uploaded (it ran no tests before; -DskipTests stays on the package step so the jars and the comparison with build 1518 are unchanged).

What the errors contain

InMemoryCompiler (vendored com.credits.client:general:1.2) builds each CompilationException.Error from Diagnostic.getLineNumber() and getMessage(null) only: column numbers are dropped there, and the message carries no source position beyond the line. Adding columns would need a change to that vendored library (or the executor's own compiler wrapper), not done here.

Behaviour of a successful compile, and of every contract execution, is unchanged.

🤖 Generated with Claude Code

After a CompilationException the result has no byteCodeObjects (null), and the
debug log called .size() on it: the NullPointerException turned the answer into
"Internal error processing compileSourceCode" and the compiler's error list
(line numbers and messages) never reached the node or its API clients. The log
now counts a null list as 0, so the FAILURE status with the errors is returned.

A unit test of the handler checks it, and the Build workflow now runs the
handler tests (after the jars are uploaded).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB added a commit to CreditsCommunity/node that referenced this pull request Nov 3, 2026
With executor_ref (mixed executors), contracts.py compiles a source with two
errors on the even nodes and prints what SmartContractCompile returns: the
compiler's errors with their line numbers once the executor has
CreditsCommunity/contract-executor#13. Reported only; nodes running the release
executor are left out, as its failure makes the node reopen its executor
connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EnzinoBB
EnzinoBB merged commit 880ebbb into build/reproducible-1518 Nov 3, 2026
6 checks passed
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