smartcontractkit / smartcontractkit/cre-sdk-typescript
TestTeeRuntime is unreachable: not exported from @chainlink/cre-sdk/test, and newTestTEERuntime does not exist
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6
- Forks
- 9
- Avg merge
- 5h 23m
- Merged PRs (30d)
- 6
Description
Summary
TestTeeRuntime ships, is documented, and cannot be imported. It is missing from the only public test
entrypoint, and the factory its own doc comment names does not exist.
Detail
packages/cre-sdk/src/sdk/testutils/test-runtime.ts defines:
/**
* TestTeeRuntime is a TeeRuntime implementation for unit tests. Extends TeeRuntimeImpl; construct via newTestTEERuntime.
* Adds getLogs() and setTimeProvider(). ...
*/
export class TestTeeRuntime<T> extends TeeRuntimeImpl<T> { ... }
newTestTEERuntimedoes not exist.grep -rn newTestTEERuntimeacross the repo and the
published tarball matches only that comment.TestTeeRuntimeis not exported frompackages/cre-sdk/src/sdk/test/index.ts, which is the
only test path in the package'sexportsmap ("./test").src/sdk/testutils/index.tsexports it,
but./testutilsis not an export path, so it is unreachable from an installed package.- Its constructor takes
RuntimeHelpers,TestWriterandTestRuntimeState, none of which are
publicly exported either, so a user cannot construct it directly even reaching past the export map.
Draft PR #247 ("Rtinianov tee runtime") is where the class came from; it is still open, while the
class itself shipped. That is what makes this look like an oversight rather than a deliberate
exclusion — happy to be told otherwise.
Why it matters
Every workflow using cre.handlerInTee has to hand-roll a TeeRuntime double. The
hello-confidential-workflows-ts template does this itself, and says so:
The public test surface does not yet ship a TEE runtime factory (
newTestRuntimereturns a DON
Runtime), so we stand up the small slice ofTeeRuntimethe handler actually uses.
Getting that double right requires reading compiled internals rather than docs. Two that cost us time:
.result()returns the protobuf message, not its JSON form, so a fakeheaderByNumbermust
returnBigInt.absValas aUint8Array. Passing the base64 string the JSON type documents throws
SyntaxError: Failed to parse String to BigIntfrom insidebytesToBigint.evmClient.writeReportcallsreport.x_generatedCodeOnly_unwrap(), so aReportdouble has to
carry that generated-code-only method.
The practical cost is that determinism — the property confidential workflows are sold on — is the
hardest thing in the SDK to unit test, which is backwards.
Fix
PR opened: adds newTestTEERuntime mirroring newTestRuntime, exports it and TestTeeRuntime from
the public test surface, and extracts the shared registry/writer/state setup so the two factories
cannot drift apart. Four tests added; bun test, biome ci and typecheck are clean.
Versions
@chainlink/cre-sdk 1.20.0 and 1.18.0; verified against main at ec3158f.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/cre-sdk/src/sdk/testutils/test-runtime.ts and packages/cre-sdk/src/sdk/test/index.ts, then compare the existing newTestRuntime path. Check the four tests described in the issue and verify the public factory and TestTeeRuntime exports work from @chainlink/cre-sdk/test. Run bun test, biome ci, and typecheck to confirm completion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100