Skip to content

Commit 099030b

Browse files
fix: Increase Snap interface context size limit slightly (#3246)
Increase `MAX_CONTEXT_SIZE` to 5 MB, letting Snap developers store somewhat large objects in the interface context. This is useful for caching images for rendering for instance.
1 parent 1382f6b commit 099030b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/snaps-controllers/src/interface/SnapInterfaceController.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@ describe('SnapInterfaceController', () => {
354354
'SnapInterfaceController:createInterface',
355355
MOCK_SNAP_ID,
356356
element,
357-
{ foo: 'a'.repeat(1_000_000) },
357+
{ foo: 'a'.repeat(5_000_000) },
358358
),
359-
).rejects.toThrow('A Snap interface context may not be larger than 1 MB');
359+
).rejects.toThrow('A Snap interface context may not be larger than 5 MB');
360360
});
361361

362362
it('throws if a link is on the phishing list', async () => {

packages/snaps-controllers/src/interface/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ export function constructState(
396396
return newState;
397397
}
398398

399-
const MAX_CONTEXT_SIZE = 1_000_000; // 1 mb
399+
const MAX_CONTEXT_SIZE = 5_000_000; // 5 mb
400400

401401
/**
402402
* Validate a JSON blob to be used as the interface context.

0 commit comments

Comments
 (0)