fungible-systems / micro-stacks

Tiny libraries for building the next generation of Stacks apps.
https://micro-stacks.dev
MIT License
82 stars 15 forks source link

`createSTXPostCondition` and `createFungiblePostCondition` allows to create invalid post conditions. #154

Open LNow opened 1 year ago

LNow commented 1 year ago

Both createSTXPostCondition and createFungiblePostCondition accepts values higher than 18446744073709551615 (max value of u64) and as a result they produce invalid post-conditions.

From https://github.com/stacksgov/sips/blob/main/sips/sip-005/sip-005-blocks-and-transactions.md

A STX post condition body is encoded as follows:

... An 8-byte value encoding the literal number of microSTX

A Fungible token post-condition body is encoded as follows:

... An 8-byte value encoding the literal number of token units

8-byte value (u64) not 16-byte value (u128)