Repository navigation
Make master the trunk: merge build/reproducible-1518 - #15
Merged
Merged
Conversation
The executor no longer builds from source as published: - sc-api-internal 2.2 (smart-contract-api), general 1.3 and executor_client 1.4 (thrift-api-client) were never published to the maven branches the poms point at; - org.eclipse.jdt.core and the Eclipse platform bundles declare open version ranges, which now resolve to jars built for Java 17. Pin the Eclipse dependencies to the exact versions bundled in build 1518 (node release mainnet-4.2.532.0), matched class by class, and add a workflow that builds the unpublished dependencies from their repositories, builds the executor on Java 11 and compares every class with the executor shipped in the release. Branch based on ca2b28b, the commit of build 1518. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sc-api-support's jar-with-dependencies becomes the main artifact (appendAssemblyId=false) and merges the module-info.class of sc-api-internal with its own. With the assembly plugin a current Maven selects, the executor module no longer finds com.credits.sc.api.support; pin the version Maven 3.6.1, the one the README names, uses by default. Also print the module descriptor of every built jar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a current JDK 11 the built executor matches build 1518 except for the string concatenation code javac generates in a few toString() methods (MethodResult, ExecuteByteCodeSession and the sc-api-internal pojo classes). Build 1518 was compiled with JDK 11.0.3, so use that version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Thrift server bound to every interface, so anyone who could reach port 9080 could deploy and run bytecode in the executor. Bind it to contract.executor.host, 127.0.0.1 unless configured, which is where the node's default executor_ip=localhost connects. A node using an executor on another host sets contract.executor.host=0.0.0.0 (or the interface address). Contract execution and results are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
SmartContractConstants kept the per-thread constants in a WeakHashMap keyed by the boxed thread id, which nothing else references. A garbage collection between initSmartContractConstants and the contract constructor cleared the entry, and the deploy failed with "contract constants is null" on that node only. Use a ConcurrentHashMap, and remove the entry when the limited-time call ends: only a deploy's constructor takes it, so the weak map was also what discarded the entries of ordinary calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
callThrift returned the pooled connection only when the call succeeded or threw a TException, so any other exception, or a Thread.stop of the calling contract, leaked it. Return it on every outcome, as broken unless the call succeeded. A pooled connection to the node is never validated, so after a node restart the first callback of a contract failed on that node only. Retry the read-only callbacks (seed, contract binary, wallet id, balance, date) once on a new connection after a transport error. SendTransaction is not retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deploySmartContract and executeContractMethod confined the contract's root class (or the deserialized instance's class) with the contract permission set. When the contract's byte code names a class that already exists, the contract class loader returns that class, one of the executor's own or the JDK's, and it was confined for the whole process and every later call. Confine it only when its loader is a contract loader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit skipped confinement when the root class (or the deserialized instance's class) came from outside the contract loader, which would run that class's code for the contract with the executor's own permissions. A valid contract's root class is always defined by its contract loader, so refuse the deploy or call instead: fail closed. 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)
sc-api-support: do not attach the jar-with-dependencies assembly
executor: listen on 127.0.0.1 by default
executor: confine every class a contract defines
executor: keep contract constants in a strong map until the call ends
executor: always return node connections to the pool, retry reads once
executor: refuse a root class the contract did not define
…SCOM The only artifacts the build downloaded from the creditscom mvn-repo branches declared in the poms were com.credits.client:general:1.2 and com.credits.client:node_client:1.4 (jar and pom each, from the thrift-api-client branch). Copy them byte for byte, with their checksums, into third-party/mvn-repo, and mirror every repository except Maven Central to that directory with third-party/maven-settings.xml, which the workflow passes to every mvn call. The poms are unchanged. The workflow checks out smart-contract-api 677c567f from the EnzinoBB fork (branch build/reproducible-1518) instead of CREDITSCOM, uses a new Maven cache key so the first run resolves everything through the mirror, and fails if the Maven log mentions a creditscom or raw.github URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tag executor-<name> now also creates a release with the jar with dependencies as contract-executor.jar and the sc-api-support assembly as sc-api-support.jar, the names the node release uses, plus SHA256SUMS and the build number a node must accept in executor_commit_max. The community node packages take the executor from these releases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
build: vendor the CREDITSCOM maven artifacts and build without CREDITSCOM
ci: publish the executor jars on executor-* tags
defineTokenStandard compared only the interfaces the contract class declares with the v0/v1 standards, so a token implementing the v2 interfaces of sc-api-support, or a standard through its own superinterface, was reported as not a token (0) and the node's token cache ignored it. A declared v0/v1 standard keeps the id build 1518 gives; otherwise the most specific standard the class implements is reported. The token standard is read only by the API (getContractMethods), never by contract execution.
The reserved token name check calls the contract's getName()/getSymbol() at deploy, and the state is deserialized and serialized around every call (the readObject/writeObject/ hashCode of the contract's classes), all on the Thrift thread and with no limit. Contract code that never returns there keeps a CPU busy for the life of the executor, once per transaction that reaches it. That code now runs on a thread of its own. What it returns or throws is passed on unchanged, so a call that ends gets the answer build 1518 gives. Code still running after max(execution time, 120 s) is stopped and the answer is held back 10 min before a failure is returned: the node has stopped waiting long before (executor_receive_timeout, 4 s by default), as it does with build 1518, which never answers such a call.
executor: report v2 and inherited token standards to the API
executor: stop contract code that runs outside a method's time limit
…or-*-rc tags are pre-releases compare-results runs the token scenarios of EnzinoBB/node (ci/contracts/executor_harness.py) on the release executor and on the jars just built, through their Thrift interface with a stub of the node: deploys, calls and getters of v0/v1/v2 tokens, payable, emitted transactions, failing calls, contract code that never returns. Any answer that differs fails the job, and the release job needs it: nodes running different executors must agree on every result. A tag executor-<name>-rc<N> publishes a pre-release, which the set-up of the node packages (it downloads the latest release) does not pick.
The node waits executor_receive_timeout (4 s by default) for an answer, records the call as timed out and closes the connection; the executor gives the method the execution time the node sends (60 s). A method that runs past the node's wait went on, holding a CPU, for an answer nobody could read, and a node sends its next calls meanwhile. While a method runs, the Thrift thread now looks every 250 ms whether the node closed the connection of the request (end of stream on it, peeked without consuming anything) and stops the method as at its limit. An answer on a closed connection cannot be delivered, so what the node records does not change; with the connection open everything is as before.
ci: compare the contract results of the build with build 1518; executor-*-rc tags are pre-releases
…x/stop-orphan-calls
executor: stop a contract method once its node has closed the connection
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
executor: return the compiler errors of compileSourceCode
… the trunk Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…leases tagged on it Co-Authored-By: Claude Opus 5.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.
Makes
master, the default branch, the trunk of the repository.Until now the community work (reproducible build of 1518, CI, release workflow, compatible fixes #1-#13, releases
executor-community-1..3) lived onbuild/reproducible-1518, whilemasterwas the upstream CREDITSCOM history (build 1518 + a README commit) plus AGENTS.md (#14), with no CI.What this PR does
build/reproducible-1518intomasterwith a merge commit.git merge-baseisca2b28bb(build 1518):masterhad only 3 commits of its own (README, AGENTS.md/CLAUDE.md), touching only docs, so the merge has no conflicts. The code, poms,third-party/and.github/workflows/build.ymlare byte-identical tobuild/reproducible-1518(git diff origin/build/reproducible-1518shows onlyREADME.md,AGENTS.md,CLAUDE.md).master;build/reproducible-1518is kept.What does not change
build/reproducible-1518is not modified. Its tags (executor-community-1,-2,-2-rc1,-3) and releases stay as they are.build.ymltriggers on every push, pull request and tag, so it now also runs onmaster; thereleasejob still runs onexecutor-*tags, wherever they are.masteris the build number (git commit count): the merge brings the count to 1564 after this PR, against 1558 onbuild/reproducible-1518. A node accepts such a build only withexecutor_commit_max>= that number, as for every new community build (the release notes print it).🤖 Generated with Claude Code