Skip to content

fix(e2e): await async selector() in e2e_nested_utility_calls#23656

Merged
dbanks12 merged 1 commit into
merge-train/fairiesfrom
db/fix-nested-utility-calls-await
May 29, 2026
Merged

fix(e2e): await async selector() in e2e_nested_utility_calls#23656
dbanks12 merged 1 commit into
merge-train/fairiesfrom
db/fix-nested-utility-calls-await

Conversation

@dbanks12

Copy link
Copy Markdown
Contributor

Root cause

The 4 toMatchObject assertions in the authorizeUtilityCall hook block of e2e_nested_utility_calls.test.ts compared lastRequest.functionSelector against contractB.methods.pow_utility.selector(). That method is async — it returns Promise<FunctionSelector> via FunctionSelector.fromNameAndParameters(...), which became async in #23007.

Because the expected value was an un-awaited Promise, and a Promise has no own enumerable properties, toMatchObject treated functionSelector as a vacuously-satisfied empty object and never compared the actual selector. The assertions silently passed regardless of the real value — the selector check was a no-op since #23007.

Note: this is a latent / vacuous-assertion defect, not a deterministic hard failure. The 4 subtests were passing (10/10) both before and after the change; the value of the fix is that the assertions now actually verify the selector.

Fix

Add await to the 4 assertions:

functionSelector: await contractB.methods.pow_utility.selector(),

One line each, no other changes.

Verification

Ran yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_nested_utility_calls.test.ts (node 24.12.0, full bootstrap):

  • Before fix (un-awaited): 10/10 passed — but the selector assertion was vacuous.
  • After fix (awaited): 10/10 passed.
  • Negative control: temporarily swapping in a deliberately wrong selector (set_pow_args) on the awaited assertion makes that subtest fail (1 failed / 9 passed), proving the awaited assertion is now genuinely meaningful. Reverted before commit.

The 4 `toMatchObject` assertions in the `authorizeUtilityCall hook` block
compared `lastRequest.functionSelector` against `contractB.methods.pow_utility.selector()`,
which is async (returns `Promise<FunctionSelector>` via
`FunctionSelector.fromNameAndParameters`, async since #23007). An un-awaited
Promise has no own enumerable properties, so `toMatchObject` treated the
expected `functionSelector` as a vacuously-satisfied empty object and never
actually checked the selector -- the assertions silently passed regardless of
the real value.

Awaiting `.selector()` makes the assertions compare against the resolved
`FunctionSelector`. Verified: a negative control with a deliberately wrong
selector fails only after the await is added, and the full suite passes 10/10
with the correct selector.
@dbanks12 dbanks12 requested a review from nchamo May 29, 2026 00:40
@dbanks12 dbanks12 merged commit 0f7d22a into merge-train/fairies May 29, 2026
12 of 16 checks passed
@dbanks12 dbanks12 deleted the db/fix-nested-utility-calls-await branch May 29, 2026 00:45
@dbanks12

Copy link
Copy Markdown
Contributor Author

Oops.... i did not mean to merge this.... wrong pr.... Wait how did it merge without approval?

@nchamo

nchamo commented May 29, 2026

Copy link
Copy Markdown
Contributor

So weird that the assertion actually passed 😅

Well, approved post-merge ✔️

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.

2 participants