Skip to content

feat: reenable function selectors in txPublicSetupAllowList#20909

Merged
spalladino merged 4 commits intomerge-train/spartanfrom
mr/reenable-function-selectors-allowlist
Mar 2, 2026
Merged

feat: reenable function selectors in txPublicSetupAllowList#20909
spalladino merged 4 commits intomerge-train/spartanfrom
mr/reenable-function-selectors-allowlist

Conversation

@mrzeszutko
Copy link
Contributor

@mrzeszutko mrzeszutko commented Feb 26, 2026

Summary

Re-enables function selector checking in the transaction setup phase allow list. Previously, selector restrictions were removed with the comment "We can't restrict the selector because public functions get routed via dispatch," but the current code already correctly extracts selectors from calldata (calldata[0] contains the target selector). This fix closes a vulnerability where ANY public function on whitelisted contracts/classes was permitted during setup.

  • Made AllowedElement require selectors: Removed AllowedInstance and AllowedClass variants — all entries now require both an identifier (address or classId) and a function selector
  • Re-enabled selectors in the default allow list with the five traced setup-phase functions: AuthRegistry._set_authorized (private FPC path), AuthRegistry.set_authorized (public FPC path), FeeJuice._increase_public_balance, Token._increase_public_balance, Token.transfer_in_public
  • Removed the unnecessary FPC entry — FPC's public functions (_complete_refund, _pay_refund) are set via set_as_teardown(), not enqueued in setup
  • Changed config from override to extend: The internal config key is now txPublicSetupAllowListExtend (env var TX_PUBLIC_SETUP_ALLOWLIST unchanged). Defaults are always present; the config only adds entries on top of them
  • Added network-json support: The extend list can be distributed via txPublicSetupAllowListExtend in the network config schema
  • Replaced isOnAllowList with checkAllowList: Returns a specific rejection reason instead of a boolean. Removed dead branches for selector-less entries. Contract instance is now fetched lazily (only once, only when class-based entries exist). Unknown contracts now return TX_ERROR_SETUP_FUNCTION_UNKNOWN_CONTRACT instead of a generic validation error
  • Improved parseAllowList: Requires selectors, rejects unknown type prefixes, handles whitespace
  • Added tests: Wrong-selector rejection for both address and class matches, unknown contract rejection, lazy fetch verification, config parsing edge cases

Fixes A-463

Copy link
Contributor

@spalladino spalladino left a comment

Choose a reason for hiding this comment

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

Looks good! On the env var name, let's not rename it for now, but I'm fine keeping the txPublicSetupAllowListExtend name in the rest of the code.

Comment on lines +99 to 101
if (!contractClassId.value) {
throw new Error(`Contract not found: ${contractAddress}`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is old code, but since we're at it: let's have the validator return a TX_ERROR_SETUP_FUNCTION_UNKNOWN_CONTRACT or similar here, instead of throwing and returning a TX_ERROR_DURING_VALIDATION.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@mrzeszutko
Copy link
Contributor Author

@spalladino I reverted the env variable name change, also had to add one more selector due to the failing e2e test

@mrzeszutko mrzeszutko requested a review from spalladino March 2, 2026 16:21
@spalladino spalladino merged commit 2d3e5d6 into merge-train/spartan Mar 2, 2026
12 checks passed
@spalladino spalladino deleted the mr/reenable-function-selectors-allowlist branch March 2, 2026 17:52
github-merge-queue bot pushed a commit that referenced this pull request Mar 3, 2026
BEGIN_COMMIT_OVERRIDE
fix: track last seen nonce in case of stale fallback L1 RPC node
(#20855)
feat: Validate num txs in block proposals (#20850)
fix(archiver): enforce checkpoint boundary on rollbackTo (#20908)
fix: tps zero metrics (#20656)
fix: handle scientific notation in bigintConfigHelper (#20929)
feat(aztec): node enters standby mode on genesis root mismatch (#20938)
fix: logging of class instances (#20807)
feat(slasher): make slash grace period relative to rollup upgrade time
(#20942)
chore: add script to find PRs to backport (#20956)
chore: remove unused prover-node dep (#20955)
fix: increase minFeePadding in e2e_bot bridge resume tests and harden
GasFees.mul() (#20962)
feat(sequencer): (A-526) rotate publishers when send fails (#20888)
chore: (A-554) bump reth version 1.6.0 -> 1.11.1 for eth devnet (#20889)
chore: metric on how many epochs validator has been on committee
(#20967)
fix: set wallet minFeePadding in BotFactory constructor (#20992)
chore: deflake epoch invalidate block test (#21001)
chore(sequencer): e2e tests for invalid signature recovery in checkpoint
attestations (#20971)
chore: deflake duplicate proposals and attestations (#20990)
chore: deflake epochs mbps test (#21003)
feat: reenable function selectors in txPublicSetupAllowList (#20909)
fix: limit offenses when voting in tally slashing mode by
slashMaxPayloadSize (#20683)
fix(spartan): wire SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT env var
(#21017)
END_COMMIT_OVERRIDE
johnathan79717 pushed a commit that referenced this pull request Mar 4, 2026
## Summary

Re-enables function selector checking in the transaction setup phase
allow list. Previously, selector restrictions were removed with the
comment "We can't restrict the selector because public functions get
routed via dispatch," but the current code already correctly extracts
selectors from calldata (`calldata[0]` contains the target selector).
This fix closes a vulnerability where ANY public function on whitelisted
contracts/classes was permitted during setup.

- **Made `AllowedElement` require selectors**: Removed `AllowedInstance`
and `AllowedClass` variants — all entries now require both an identifier
(address or classId) and a function selector
- **Re-enabled selectors in the default allow list** with the five
traced setup-phase functions: `AuthRegistry._set_authorized` (private
FPC path), `AuthRegistry.set_authorized` (public FPC path),
`FeeJuice._increase_public_balance`, `Token._increase_public_balance`,
`Token.transfer_in_public`
- **Removed the unnecessary FPC entry** — FPC's public functions
(`_complete_refund`, `_pay_refund`) are set via `set_as_teardown()`, not
enqueued in setup
- **Changed config from override to extend**: The internal config key is
now `txPublicSetupAllowListExtend` (env var `TX_PUBLIC_SETUP_ALLOWLIST`
unchanged). Defaults are always present; the config only adds entries on
top of them
- **Added network-json support**: The extend list can be distributed via
`txPublicSetupAllowListExtend` in the network config schema
- **Replaced `isOnAllowList` with `checkAllowList`**: Returns a specific
rejection reason instead of a boolean. Removed dead branches for
selector-less entries. Contract instance is now fetched lazily (only
once, only when class-based entries exist). Unknown contracts now return
`TX_ERROR_SETUP_FUNCTION_UNKNOWN_CONTRACT` instead of a generic
validation error
- **Improved `parseAllowList`**: Requires selectors, rejects unknown
type prefixes, handles whitespace
- **Added tests**: Wrong-selector rejection for both address and class
matches, unknown contract rejection, lazy fetch verification, config
parsing edge cases

Fixes A-463
spalladino pushed a commit that referenced this pull request Mar 4, 2026
…etup allowlist (backport #20909, #21122) (#21129)

Combined backport of
#20909 and
#21122 to v4.

#20909 re-enables function selector checking in the setup allowlist, and
#21122 (which depends on it) adds `onlySelf` and `rejectNullMsgSender`
validation flags.

Cherry-picked in order with conflict resolution for v4 compatibility.

ClaudeBox log: http://ci.aztec-labs.com/766112c90222bb64-2
alexghr added a commit that referenced this pull request Mar 5, 2026
BEGIN_COMMIT_OVERRIDE
chore: chonk proof compression poc (#20645)
feat: Update L1 to L2 message APIs (#20913)
fix: adapt chonk proof compression for v4 Translator layout (#21067)
fix: omit bigint priceBumpPercentage from IPC config in testbench worker
(#21086)
feat: standby mode for prover broker (#21098)
fix(p2p): remove default block handler in favor of block handler
(#21105)
chore: prepare barretenberg-rs for crates.io publishing (#20496)
feat: reenable function selectors + additional validation in public
setup allowlist (backport #20909, #21122) (#21129)
chore: remove stale aes comments (#21133)
chore: remove auto-tag job (#21127)
feat: calldata length validation of public setup function allowlist
(#21139)
feat: run AVM NAPI simulations on dedicated threads instead of libuv
pool (#21138)
feat: Remove non-protocol contracts from public setup allowlist (#21154)
END_COMMIT_OVERRIDE

---------

Co-authored-by: ledwards2225 <ledwards2225@users.noreply.github.com>
Co-authored-by: PhilWindle <PhilWindle@users.noreply.github.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: mrzeszutko <mrzeszutko@users.noreply.github.com>
Co-authored-by: spalladino <spalladino@users.noreply.github.com>
Co-authored-by: johnathan79717 <johnathan79717@users.noreply.github.com>
Co-authored-by: nventuro <nventuro@users.noreply.github.com>
Co-authored-by: alexghr <alexghr@users.noreply.github.com>
Co-authored-by: AztecBot <AztecBot@users.noreply.github.com>
Co-authored-by: Martin Verzilli <martin@aztec-labs.com>
ludamad added a commit that referenced this pull request Mar 10, 2026
BEGIN_COMMIT_OVERRIDE
chore: chonk proof compression poc (#20645)
feat: Update L1 to L2 message APIs (#20913)
fix: adapt chonk proof compression for v4 Translator layout (#21067)
fix: omit bigint priceBumpPercentage from IPC config in testbench worker
(#21086)
feat: standby mode for prover broker (#21098)
fix(p2p): remove default block handler in favor of block handler
(#21105)
chore: prepare barretenberg-rs for crates.io publishing (#20496)
feat: reenable function selectors + additional validation in public
setup allowlist (backport #20909, #21122) (#21129)
chore: remove stale aes comments (#21133)
chore: remove auto-tag job (#21127)
feat: calldata length validation of public setup function allowlist
(#21139)
feat: run AVM NAPI simulations on dedicated threads instead of libuv
pool (#21138)
feat: Remove non-protocol contracts from public setup allowlist (#21154)
feat!: Expose offchain effects when simulating/sending txs (backport
#20563) (#21110)
chore: bump minor version (#21171)
chore: backport #21161 (tally slashing pruning improvements) to v4
(#21166)
chore: More updated Alpha configuration (backport #21155) (#21165)
fix(p2p): report most severe failure in runValidations (#21185)
feat: add ergonomic conversions for Noir's `Option<T>` (#21107)
docs: clarifying Noir fields vs struct fields in event metadata (#21172)
fix: bump lighthouse consensus client v7.1.0 -> v8.0.1 (#21170)
fix: update dependencies (#20997)
chore: New alpha-net environment (#20800) (#21202)
chore: code decuplication + refactor (public setup allowlist) (#21200)
feat: mask all ciphertext fields with Poseidon2-derived values (backport
#21009) (#21140)
chore: disable sponsored FPC in testnet (#21235)
feat!: exposing pub event pagination on wallet (#21197)
refactor(pxe): narrow tryGetPublicKeysAndPartialAddress return type
(backport #21208) (#21236)
feat: orchestrator enqueues via serial queue (#21247)
feat: rollup mana limit gas validation (#21219)
chore: deploy SPONSORED_FPC in test networks (#21254)
fix(sequencer): fix log when not enough txs (#21297)
END_COMMIT_OVERRIDE

---------

Co-authored-by: ledwards2225 <ledwards2225@users.noreply.github.com>
Co-authored-by: PhilWindle <PhilWindle@users.noreply.github.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: mrzeszutko <mrzeszutko@users.noreply.github.com>
Co-authored-by: spalladino <spalladino@users.noreply.github.com>
Co-authored-by: johnathan79717 <johnathan79717@users.noreply.github.com>
Co-authored-by: nventuro <nventuro@users.noreply.github.com>
Co-authored-by: alexghr <alexghr@users.noreply.github.com>
Co-authored-by: AztecBot <AztecBot@users.noreply.github.com>
Co-authored-by: Martin Verzilli <martin@aztec-labs.com>
Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: mverzilli <mverzilli@users.noreply.github.com>
Co-authored-by: benesjan <benesjan@users.noreply.github.com>
Co-authored-by: danielntmd <danielntmd@users.noreply.github.com>
Co-authored-by: deffrian <deffrian@users.noreply.github.com>
Co-authored-by: benesjan <janbenes1234@gmail.com>
ludamad added a commit that referenced this pull request Mar 11, 2026
BEGIN_COMMIT_OVERRIDE
chore: chonk proof compression poc (#20645)
feat: Update L1 to L2 message APIs (#20913)
fix: adapt chonk proof compression for v4 Translator layout (#21067)
fix: omit bigint priceBumpPercentage from IPC config in testbench worker
(#21086)
feat: standby mode for prover broker (#21098)
fix(p2p): remove default block handler in favor of block handler
(#21105)
chore: prepare barretenberg-rs for crates.io publishing (#20496)
feat: reenable function selectors + additional validation in public
setup allowlist (backport #20909, #21122) (#21129)
chore: remove stale aes comments (#21133)
chore: remove auto-tag job (#21127)
feat: calldata length validation of public setup function allowlist
(#21139)
feat: run AVM NAPI simulations on dedicated threads instead of libuv
pool (#21138)
feat: Remove non-protocol contracts from public setup allowlist (#21154)
feat!: Expose offchain effects when simulating/sending txs (backport
#20563) (#21110)
chore: bump minor version (#21171)
chore: backport #21161 (tally slashing pruning improvements) to v4
(#21166)
chore: More updated Alpha configuration (backport #21155) (#21165)
fix(p2p): report most severe failure in runValidations (#21185)
feat: add ergonomic conversions for Noir's `Option<T>` (#21107)
docs: clarifying Noir fields vs struct fields in event metadata (#21172)
fix: bump lighthouse consensus client v7.1.0 -> v8.0.1 (#21170)
fix: update dependencies (#20997)
chore: New alpha-net environment (#20800) (#21202)
chore: code decuplication + refactor (public setup allowlist) (#21200)
feat: mask all ciphertext fields with Poseidon2-derived values (backport
#21009) (#21140)
chore: disable sponsored FPC in testnet (#21235)
feat!: exposing pub event pagination on wallet (#21197)
refactor(pxe): narrow tryGetPublicKeysAndPartialAddress return type
(backport #21208) (#21236)
feat: orchestrator enqueues via serial queue (#21247)
feat: rollup mana limit gas validation (#21219)
chore: deploy SPONSORED_FPC in test networks (#21254)
fix(sequencer): fix log when not enough txs (#21297)
fix: Simulate gas in n tps test. Set min txs per block to 1 (backport
#21312) (#21329)
fix(log): do not log validation error if unregistered handler (#21111)
fix(node): fix index misalignment in findLeavesIndexes (#21327)
fix: limit parallel blocks in prover to max AVM parallel simulations
(#21320)
fix: use native sha256 to speed up proving job id generation (#21292)
fix(validator): wait for l1 sync before processing block proposals
(#21336)
fix(txpool): cap priority fee with max fees when computing priority
(#21279)
chore: reduce severity of errors due to HA node not acquiring signature
(#21311)
fix: (A-643) add buffer to maxFeePerBlobGas for gas estimation and fix
bump loop truncation (#21323)
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