refactor(runtime)!: remove v2 processor service + fix latent eth numeric coercion#70
Merged
Conversation
…to v3 Remove the V2 processor runtime now that v4 only serves ProcessorV3: - delete ProcessorServiceImpl (service.ts) and its V2 tests - drop FullProcessorServiceImpl and the V2 route registration in processor-runner.ts - move recordRuntimeInfo and the BigInt.toJSON patch into utils.ts so service-v3 no longer imports from the deleted service.ts - re-point runtime index to export service-v3 Migrate TestProcessorServer/MemoryDatabase onto ProcessorServiceImplV3, keeping the public processBindings/processBinding API by driving the V3 stream internally. Two behavior gaps from the streaming model are restored to match the old unary path: - resolve direct store reads: TestStoreContext.result now also calls super.result so a request issued from the context itself (e.g. service.store.get in a test) is resolved instead of hanging - surface handler failures: reject when the result carries states.error (V3 reports errors as a result rather than erroring the stream) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The lazy-getter refactor in #1411 dropped the getNumber coercion on number-typed fields of FormattedLog/FormattedTransactionReceipt/ FormattedTransactionResponse, so raw RPC hex strings (e.g. "0xf3") were returned for fields declared as `number`. protobuf-es create() does not validate scalars, so this stayed latent — but cloning/serializing the resulting ProcessResult (e.g. ProcessorV3's clone) throws FieldValueInvalidError on the int32 RecordMetaData fields these feed. Restore getNumber / allowNull(getNumber[, default]) on transactionIndex, logIndex, blockNumber, index, type, status and nonce, matching the pre-#1411 formatter spec. transactionIndex on a tx is null-safe (allowNull(..., 0)) since pending/partial txs omit it. Also coerce trace.transactionPosition at the RecordMetaData boundary, since traces are used as a raw cast with no Formatted wrapper. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Removes the V2 processor runtime (v4 only serves
ProcessorV3) and migrates the SDK test framework ontoProcessorServiceImplV3. Doing so exposed a latent eth data bug that the V2 path had been masking, which is fixed here as well.1. Remove V2 processor service (
refactor(runtime)!)ProcessorServiceImpl(service.ts) and its V2 tests (service.test.ts,seq-mode.test.ts).FullProcessorServiceImpland the V2 route registration inprocessor-runner.ts.recordRuntimeInfo+ theBigInt.toJSONpatch intoutils.tssoservice-v3no longer imports from the deletedservice.ts; re-point runtimeindextoservice-v3.TestProcessorServer/MemoryDatabaseontoProcessorServiceImplV3, preserving the publicprocessBindings/processBindingAPI by driving the V3 stream internally. Two behavior gaps vs. the old unary path are restored:service.store.get(...)):TestStoreContext.resultnow also callssuper.result, so a request issued from the context itself is resolved instead of hanging.states.error(V3 reports errors as a result rather than erroring the stream).2. Coerce numeric eth fields (
fix(eth))The lazy-getter refactor in #1411 dropped
getNumbercoercion onnumber-typed getters ofFormattedLog/FormattedTransactionReceipt/FormattedTransactionResponse, so raw RPC hex strings (e.g."0xf3") were returned for fields declarednumber.protobuf-escreate()doesn't validate scalars, so it stayed latent — butProcessorV3clones/serializes theProcessResult, andclone()throwsFieldValueInvalidErroron the int32RecordMetaDatafields these feed.getNumber/allowNull(getNumber[, default])ontransactionIndex,logIndex,blockNumber,index,type,status,nonce(matching the pre-#1411 spec).tx.indexis null-safe since pending/partial txs omittransactionIndex.trace.transactionPositionat theRecordMetaDataboundary incontext.ts, since traces are used as a raw cast with noFormattedwrapper.Testing
tsc(sdk + runtime) and ESLint clean.🤖 Generated with Claude Code