77 * - Discovers deposits from on-chain events (ERC20 or ETH)
88 * - Selects deposits with sufficient remaining balance
99 * - Supports partial deposit assignments (can combine multiple deposits)
10- * - Determines submitter vault for nonce tracking:
11- * - If inputs have `from` field: uses that vault ID
12- * - If no `from` field: queries vaults controlled by the controller
13- * - If no vaults found: uses from=0 (no nonce update)
14- * - Sets execution.from to the submitter vault ID for proper nonce tracking
10+ * - AssignDeposit is a protocol-level action: always sets execution.from = 0 (protocol vault)
11+ * - Nonces are not relevant for AssignDeposit; conflicts resolved by bundle inclusion order
1512 *
1613 * At publish time, deposits are assigned and balances are credited to destination vaults.
1714 * If a selected deposit is exhausted, the system automatically falls back to combining
@@ -45,7 +42,6 @@ type AssignDepositContext = {
4542 minAmount : string
4643 } ) => Promise < { id : number ; remaining : string } | null >
4744 validateVaultIdOnChain : ( vaultId : number ) => Promise < void >
48- getVaultsForController : ( controller : string ) => Promise < string [ ] >
4945 logger : { info : ( ...args : unknown [ ] ) => void }
5046 diagnostic : { info : ( ...args : unknown [ ] ) => void }
5147}
@@ -60,41 +56,9 @@ export async function handleAssignDeposit(params: {
6056
6157 await context . validateAssignDepositStructure ( intention )
6258
63- // Determine submitter vault for nonce tracking
64- // 1. If inputs have `from` field, use that (all inputs must have the same `from` value per validator)
65- // 2. If no `from` field, determine from controller by querying vaults
66- let submitterVaultId : number | 0 = 0
67- const inputsWithFrom = intention . inputs . filter (
68- ( input ) => input . from !== undefined
69- )
70- if ( inputsWithFrom . length > 0 ) {
71- // All inputs should have the same `from` value per validator, but double-check
72- const fromValues = new Set ( inputsWithFrom . map ( ( input ) => input . from ) )
73- if ( fromValues . size > 1 ) {
74- throw new Error (
75- 'AssignDeposit requires all inputs to have the same `from` vault ID'
76- )
77- }
78- submitterVaultId = inputsWithFrom [ 0 ] . from as number
79- } else {
80- // No `from` field in inputs, determine from controller
81- const vaults = await context . getVaultsForController ( validatedController )
82- if ( vaults . length === 1 ) {
83- submitterVaultId = parseInt ( vaults [ 0 ] )
84- } else if ( vaults . length > 1 ) {
85- // Multiple vaults controlled by this controller - use the first one
86- context . logger . info (
87- `Controller ${ validatedController } controls multiple vaults, using first vault ${ vaults [ 0 ] } for nonce tracking`
88- )
89- submitterVaultId = parseInt ( vaults [ 0 ] )
90- } else {
91- // No vaults found - cannot determine submitter vault, use 0 (no nonce update)
92- context . logger . info (
93- `Controller ${ validatedController } does not control any vaults, using from=0 (no nonce update)`
94- )
95- submitterVaultId = 0
96- }
97- }
59+ // AssignDeposit is a protocol-level action: always use from=0 (protocol vault)
60+ // Nonces are not relevant for AssignDeposit; conflicts resolved by bundle inclusion order
61+ const PROTOCOL_VAULT_ID = 0
9862
9963 const zeroAddress = '0x0000000000000000000000000000000000000000'
10064 const proof : unknown [ ] = [ ]
@@ -156,17 +120,17 @@ export async function handleAssignDeposit(params: {
156120 context . diagnostic . info ( 'AssignDeposit intention processed' , {
157121 controller : validatedController ,
158122 count : intention . inputs . length ,
159- submitterVaultId ,
123+ protocolVault : PROTOCOL_VAULT_ID ,
160124 } )
161125 context . logger . info (
162- `AssignDeposit cached with proof count: ${ proof . length } , submitter vault: ${ submitterVaultId } `
126+ `AssignDeposit cached with proof count: ${ proof . length } , protocol-level action (from=0) `
163127 )
164128
165129 return {
166130 execution : [
167131 {
168132 intention,
169- from : submitterVaultId ,
133+ from : PROTOCOL_VAULT_ID ,
170134 proof,
171135 signature : validatedSignature ,
172136 } ,
0 commit comments