diff --git a/ts/src/header-validator/trigger.test.ts b/ts/src/header-validator/trigger.test.ts index ee727ae740..8c1f70d49f 100644 --- a/ts/src/header-validator/trigger.test.ts +++ b/ts/src/header-validator/trigger.test.ts @@ -169,6 +169,18 @@ const testCases: jsontest.TestCase[] = [ ] }`, }, + { + name: 'missing-optional-filtering-id', + json: `{ + "aggregatable_trigger_data": [{ + "key_piece": "0x1", + "source_keys": ["a"] + }], + "aggregatable_values": { + "a": { "value": 3 } + } + }`, + }, { name: 'or-filters', json: `{ diff --git a/ts/src/header-validator/validate-json.ts b/ts/src/header-validator/validate-json.ts index 9cfc5164f8..12ce80dedc 100644 --- a/ts/src/header-validator/validate-json.ts +++ b/ts/src/header-validator/validate-json.ts @@ -1226,8 +1226,10 @@ function aggregatableKeyValue( object: (j) => struct(j, ctx, { value: field('value', aggregatableKeyValueValue), - filteringId: field('filtering_id', (j) => - aggregatableKeyValueFilteringId(j, ctx, maxBytes) + filteringId: field( + 'filtering_id', + (j) => aggregatableKeyValueFilteringId(j, ctx, maxBytes), + 0n ), }), })