Skip to content

Commit

Permalink
fix: update buffer max size to correct 1MB limit (#1665)
Browse files Browse the repository at this point in the history
* fix: update buffer max size to correc 1MB limit

* chore: fix lint

---------

Co-authored-by: janniks <[email protected]>
  • Loading branch information
janniks and janniks authored Apr 4, 2024
1 parent 0c9ea02 commit 91b5dab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/transactions/src/clarity/types/bufferCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ interface BufferCV {
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const bufferCV = (buffer: Uint8Array): BufferCV => {
if (buffer.length > 1_000_000) {
// max size 1024 * 1024 = 1MB; https://github.com/stacks-network/stacks-core/blob/c50a93088d7c0261f1dbe31ab24b95028a038447/clarity/src/vm/types/mod.rs#L47
if (buffer.byteLength > 1_048_576) {
throw new Error('Cannot construct clarity buffer that is greater than 1MB');
}

Expand Down

0 comments on commit 91b5dab

Please sign in to comment.