Skip to content

executor: confine every class a contract defines - #2

Merged
EnzinoBB merged 4 commits into
build/reproducible-1518from
fix/confine-contract-classes
Oct 13, 2026
Merged

EnzinoBB merged 4 commits into
build/reproducible-1518from
fix/confine-contract-classes

Conversation

@EnzinoBB

Copy link
Copy Markdown
Collaborator

Only the contract's root class was confined to the contract permission set, and only after its state had been deserialized. Inner and helper classes were never confined. The static helper also confined the ByteCodeObjectData pojo class instead of the class it had just defined.

Every class that the contract's own class loader defines now gets the contract permission set as soon as it is defined, on every path: deploy, execution, getContractMethods, getContractVariables and external calls.

A class that ByteCodeContractClassLoader.loadClass returns because the name is already taken is not confined. That covers the executor's own classes and the JDK's: confining one of them would confine it for the whole process. The original root-class confinement has the same weakness; it is left as it is, to be handled separately.

The permission set is the one already applied to the root class, so valid contracts behave as before.

Testing

  • Executor build on Actions (JDK 11.0.3, as build 1518): only the changed classes differ from the release executor.
  • Node testnet run 38358519896 (EnzinoBB/node, branch testnet/mixed-executor) with executor_ref=test/compatible-fixes, which holds both executor fixes: the even nodes ran this executor and the odd nodes ran the release executor. Every call to Counter (API v0) and Ledger (API v3, payable, an inner class in the state) returned the expected value before and after the restart test, and all 7 nodes ended with the same state for both contracts and the same state digests up to sequence 1100.

Deploying a build with commits on top of 1518 needs a higher executor_commit_max in the node's config.ini, see BUILDING.md.

🤖 Generated with Claude Code

EnzinoBB and others added 4 commits October 13, 2026 08:41
Only the contract's root class was confined, and only after its state had
been deserialized. Inner and helper classes were never confined, and the
static helper confined the ByteCodeObjectData pojo class instead of the class
it had just defined. Give every class loaded from contract bytecode the
contract permission set as soon as it is defined, on every path: deploy,
execution, getContractMethods, getContractVariables and external calls.

The permission set is the one already applied to the root class, so valid
contracts behave as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ByteCodeContractClassLoader.loadClass returns an already loaded class when
the name is taken, including the executor's own classes and the JDK's,
which it finds through its parent loader. A contract shipping a byte code
object under such a name would have had that executor class confined with
the contract permissions, for the whole process and every later call.
Confine a class only when the contract's loader defined it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With appendAssemblyId=false the attached assembly replaces the main
artifact file of sc-api-support, so within the reactor contract-executor
compiles against sc-api-support-<tag>-b<n>.jar instead of
sc-api-support-0.8.5.jar. That fat jar holds one module-info.class taken
either from sc-api-support or from sc-api-internal, and when it is the
latter javac fails with "module not found: com.credits.sc.api.support".
Keep the plain jar as the project artifact; the assembly is still built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 6c38193)
@EnzinoBB
EnzinoBB merged commit 5abee4c into build/reproducible-1518 Oct 13, 2026
2 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