feat(erc4626): exit amount intent validation (ENG-3751, ENG-3752) - #33
Conversation
| const to = txTo.toLowerCase(); | ||
| if (vaultInfo.allocatorVaults?.includes(to)) return true; | ||
| return ( | ||
| context?.feeConfiguration?.some( |
There was a problem hiding this comment.
if I'm not wrong, context.feeConfiguration appears to let the base vault self classify as an allocator, widening redeem margin from 10 to the decimal-gap margin on 6/18 vaults...that seems to bypass the intended underlying vault margin policy 🤔
There was a problem hiding this comment.
Great catch!!!
Since context cannot whitelist an unknown OAV yet, this branch currently provides no legitimate benefit and can widen the base-vault policy if the base address appears in context. I shipped it as a preparation for the OAV hot path feature but thanks for catching this.
I’ll restrict allocator classification to the registry’s allocatorVaults for this PR and handle runtime OAV provenance alongside the whitelist hot-path.
| ? args.amount | ||
| : undefined; | ||
|
|
||
| const declaredShareAmount = isNonEmptyString(args?.shareAmount) |
There was a problem hiding this comment.
args.shareAmount is ignored outside redeem, so approval/wrap/supply can still validate structurally with a share-denominated intent present, that seems to weaken the intended fail-closed method-swap behaviour
There was a problem hiding this comment.
Agreed. I’ll reject shareAmount for APPROVAL, WRAP, and SUPPLY before routing so a redeem intent cannot be replaced with those methods. I’ll retain UNWRAP as an explicit exception because WETH share exits produce a legitimate follow-up unwrap using the same action args.
jdomingos
left a comment
There was a problem hiding this comment.
Couldn't find any issue with this, looks mint! Great 👏
Summary
withdraw: opt-in match of calldata assets vsargs.amountwithin 10 wei (ENG-3752 / DFNS withdraw-on-amount path).redeem: opt-in match of calldata shares vsargs.shareAmountwith bounded margin (ENG-3751)."10"by default; decimal-gap widen whentx.tois an allocator (allocatorVaults). Kiln-set OAVs force"10"for monorepo parity. Noargs.feeConfigurationIdfor margin.amount/shareAmountunchanged (structural only).vault-registry.jsonwithinputTokenDecimals/vaultTokenDecimals.Test plan
pnpm test --testPathIgnorePatterns=tron(6089 passed)amount.test.ts,erc4626.validator.test.ts,handler.test.ts,vault-registry.test.tsshareAmount; absent args; allocator wide vs underlying tight@yieldxyz/shieldand passesargs.amounton withdrawshareAmountclients: within margin / block outsideNotes for reviewers
args.amountorargs.shareAmountis set.context.feeConfigurationcan classify an address for redeem margin but does not whitelist unknown OAVs yet (still need registry re-export).VAULTS_REQUIRING_INPUT_TOKEN_DECIMALS); margin force only, no amount scaling.