Skip to content

refactor(stdlib): consolidate find-function-by-selector helpers#23008

Merged
dbanks12 merged 1 commit into
merge-train/fairiesfrom
db/consolidate-find-fn-helpers
May 8, 2026
Merged

refactor(stdlib): consolidate find-function-by-selector helpers#23008
dbanks12 merged 1 commit into
merge-train/fairiesfrom
db/consolidate-find-fn-helpers

Conversation

@dbanks12
Copy link
Copy Markdown
Contributor

@dbanks12 dbanks12 commented May 6, 2026

Summary

Addresses comment #22957 (comment)

The same artifact-lookup loop was duplicated three times. Puts two helper fns in stdlib/abi:

  • findFunctionArtifactBySelector(artifact, selector) — searches artifact.functions, returns FunctionArtifact | undefined.
  • findFunctionAbiBySelector(artifact, selector) — searches artifact.functions ∪ nonDispatchPublicFunctions via getAllFunctionAbis, returns FunctionAbi | undefined.

Both ContractStore and ProxiedContractStoreFactory now call the same stdlib primitive. The existing throwing getFunctionArtifact helper also reuses findFunctionArtifactBySelector.

Test plan

  • yarn workspace @aztec/pxe test src/storage/contract_store/contract_store.test.ts
  • yarn workspace @aztec/stdlib test src/abi/abi.test.ts
  • yarn lint pxe, yarn lint stdlib

@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from bd45d90 to 761b425 Compare May 7, 2026 01:51
@dbanks12 dbanks12 force-pushed the db/private-sim-contract-overrides branch from 0b5052d to 50fe709 Compare May 7, 2026 01:51
@dbanks12 dbanks12 changed the base branch from db/private-sim-contract-overrides to graphite-base/23008 May 7, 2026 02:30
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from 761b425 to dc6a7b5 Compare May 7, 2026 02:30
@dbanks12 dbanks12 force-pushed the graphite-base/23008 branch from 50fe709 to cf63e74 Compare May 7, 2026 02:30
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from dc6a7b5 to ee3005d Compare May 7, 2026 02:43
@dbanks12 dbanks12 force-pushed the graphite-base/23008 branch from cf63e74 to 721ca99 Compare May 7, 2026 02:43
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from ee3005d to 52a8355 Compare May 7, 2026 03:01
@dbanks12 dbanks12 changed the base branch from graphite-base/23008 to db/fastforward-contract-update May 7, 2026 03:01
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from 52a8355 to 875d840 Compare May 7, 2026 04:03
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch from 721ca99 to 7b2bf7e Compare May 7, 2026 04:03
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch from 7b2bf7e to f752939 Compare May 7, 2026 14:41
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch 2 times, most recently from 952c942 to 9ea80fe Compare May 7, 2026 14:44
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch from f752939 to 5eab42b Compare May 7, 2026 14:44
@dbanks12 dbanks12 marked this pull request as ready for review May 7, 2026 14:44
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from 9ea80fe to d93eec1 Compare May 7, 2026 17:39
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch from 5eab42b to bad11ee Compare May 7, 2026 17:39
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from d93eec1 to 7cdc4d6 Compare May 7, 2026 18:43
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch 2 times, most recently from 6ee0009 to bc31ce0 Compare May 8, 2026 00:55
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch 2 times, most recently from 61dc935 to 48179ec Compare May 8, 2026 00:55
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch 2 times, most recently from 1f320fd to c05adb8 Compare May 8, 2026 01:19
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from 48179ec to 7f6ff8d Compare May 8, 2026 01:19
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch from c05adb8 to e7a14dc Compare May 8, 2026 01:19
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from 7f6ff8d to 9204319 Compare May 8, 2026 01:19
@dbanks12 dbanks12 marked this pull request as draft May 8, 2026 01:20
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch from e7a14dc to aef8c87 Compare May 8, 2026 01:25
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from 9204319 to 191de66 Compare May 8, 2026 01:25
@dbanks12 dbanks12 marked this pull request as ready for review May 8, 2026 01:28
@dbanks12 dbanks12 requested a review from Thunkar May 8, 2026 01:29
@dbanks12 dbanks12 force-pushed the db/fastforward-contract-update branch from aef8c87 to 85ac33c Compare May 8, 2026 13:30
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from 191de66 to ed33fbc Compare May 8, 2026 13:30
Base automatically changed from db/fastforward-contract-update to merge-train/fairies May 8, 2026 14:04
The same artifact lookup loop was duplicated three times — as
ContractStore's private #findFunctionArtifactBySelector and
#findFunctionAbiBySelector, and as a local helper inside
ProxiedContractStoreFactory. Hoist the two variants into stdlib/abi as
findFunctionArtifactBySelector and findFunctionAbiBySelector so both
ContractStore and the proxied store call the same primitive.

Also have the existing throwing getFunctionArtifact helper reuse
findFunctionArtifactBySelector for its selector branch.
@dbanks12 dbanks12 force-pushed the db/consolidate-find-fn-helpers branch from ed33fbc to f223560 Compare May 8, 2026 14:04
@dbanks12 dbanks12 merged commit b6e2d69 into merge-train/fairies May 8, 2026
15 checks passed
@dbanks12 dbanks12 deleted the db/consolidate-find-fn-helpers branch May 8, 2026 14:25
github-merge-queue Bot pushed a commit that referenced this pull request May 10, 2026
BEGIN_COMMIT_OVERRIDE
fix: include sqlite binary in its npm package (#23039)
fix: add sendMessagesAs to wallet api schemas (#23041)
refactor(pxe): deduplicate tx hash lookups in MessageContextService
(#23075)
refactor(pxe): batch tagged private log queries across all secrets
(#23048)
refactor(pxe): batch log RPC calls in LogService.fetchLogsByTag (#23088)
feat(pxe,nr): flesh out account stubs and don't exclude syncing for
overrides (#23054)
feat: deploy method refactor 2 (#23033)
feat: fastForwardContractUpdate cheatcode for simulating contract
updates (#22905)
refactor(stdlib): consolidate find-function-by-selector helpers (#23008)
feat(ci): Snapshots for aztec-nr contract compilation failures and nargo
expand (#23061)
chore: kv store test fully on vitest (#23096)
refactor(pxe): skip redundant getBlock RPC when querying at anchor block
(#23100)
chore(playground): bump main chunk size limit 1750 → 1800 KB (#23107)
feat(txe): allow authorizing cross-contract utility calls in nr tests
(#23064)
chore: bench public fns with emit repro (#23105)
END_COMMIT_OVERRIDE
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