Skip to content

fix(pipeline): accept literal address in ethtx from field#23222

Open
PrazwalR wants to merge 1 commit into
smartcontractkit:developfrom
PrazwalR:fix/ethtx-from-literal-address
Open

fix(pipeline): accept literal address in ethtx from field#23222
PrazwalR wants to merge 1 commit into
smartcontractkit:developfrom
PrazwalR:fix/ethtx-from-literal-address

Conversation

@PrazwalR

Copy link
Copy Markdown

Motivation

Fixes #21768. An ethtx pipeline task with a literal Ethereum address in the
from field — from="0x8829..." — always fails with:
from: AddressSliceParam: cannot convert int64: bad input for task

Every address starts with 0x, so no literal from address works. Only the
JSON-array form (from="[ \"0x..\" ]") and var-expr form ($(fromAddr)) work
today.

Root cause

from is resolved by this getter chain (core/services/pipeline/task.eth_tx.go):

From(VarExpr(t.From, vars), JSONWithVarExprs(t.From, vars, false), NonemptyString(t.From), nil)
ResolveParam only continues to the next getter on ErrParameterEmpty.

In JSONWithVarExprs, json.Decoder.Decode reads a single JSON value and
silently ignores trailing bytes (unlike json.Unmarshal). Fed 0x8829..., it
reads the leading 0 as a complete JSON number, succeeds, and drops the rest;
ReinterpretJSONNumbers turns it into int64(0). The getter "succeeds" with
int64(0), the chain stops before NonemptyString, and AddressSliceParam
hits its default branch, returning cannot convert int64.

Fix
JSONWithVarExprsreject input the decoder only partially consumed,
returning ErrParameterEmpty (not ErrBadInput) so ResolveParam falls
through to NonemptyString.
AddressSliceParamaccept a single literal address in addition to a
JSON array, since a bare 0x... is not valid JSON on its own.
Both changes are needed: (1) alone still fails, because NonemptyString then
passes a bare address string that (2) is required to parse.

Tests
TestGetters_JSONWithVarExprs: added partial-consumption cases (literal
address, 123abc, {} extra, [1,2] junk, etc.)
TestAddressSliceParam_UnmarshalPipelineParam: added single-literal
(string/[]byte) and garbage-string cases
TestAddressSliceParam_ResolveFromGetterChain_Issue21768: new DB-free test
driving the exact production from resolver chain end-to-end
TestETHTxTask: added a literal-from end-to-end case
Verified with a negative control: reverting the fix makes the new tests fail
with the original cannot convert int64 error; restoring it makes them pass.
go vet ./core/services/pipeline/ is clean.

Test plan
done
go test ./core/services/pipeline/ -run 'TestGetters|Param_UnmarshalPipelineParam|ResolveFromGetterChain_Issue21768' -v
done
go vet ./core/services/pipeline/
not done
TestETHTxTask full suite (requires CL_DATABASE_URL, run in CI)

@PrazwalR
PrazwalR requested review from a team as code owners July 23, 2026 19:27
Copilot AI review requested due to automatic review settings July 23, 2026 19:27
@PrazwalR
PrazwalR requested a review from a team as a code owner July 23, 2026 19:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

[NODE] ethtx task with from (field) address always fails with "cannot convert int64"

2 participants