stampchain-io / btc_stamps

Bitcoin Stamps Indexer
https://stampchain.io
GNU Affero General Public License v3.0
14 stars 5 forks source link

fix: ensure sci notation strings incoming in the json get rejected. #404

Closed reinamora137 closed 2 months ago

reinamora137 commented 2 months ago

This was also part of the reason for problems prior to commit: 94194a766fce8210e35ae31d3db8f39a793221f9

which now should keep that from receiving a sci notation value.

this ensures tx_hash "3e5960feb9bf662d922eb3f5d02577d8e741499b964a878ea0690430f596c7e3" is included:

94194a766fce8210e35ae31d3db8f39a793221f9 was also a fix for this, however this is a little more robust ensuring that a sci notation value doesn't make it past check_format. prior to the mentioned commit when an amount like 0.000000000000000001 hit check_format the json loads was converting this to sci notation and had mixed results with the decimal type throughout src-20 validation.

Encrypted data: 9d42850b5c9e8c9cdb02bff2569f2653156de412344c97fb21b884732cf67f2d1cb9efb4bb592bd337319db73d07053c241d2861763718984fb84be47fc42add53fad58aa8f4dbc6c4409deeb06204a40eb878f18ff3798d35ba7403f1f868ef2a23f22ae289b633e14458868b27ffc95bc990cf198258bc748b487c
Decryption key: 62a63f528082732c1df739874d68239d361a8939aa42b0dd7fa6f9a451ea9d2a
Decrypted data (hex): 004a7374616d703a7b2270223a227372632d3230222c226f70223a227472616e73666572222c227469636b223a2230222c22616d74223a302e3030303030303030303030303030303030317d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Chunk length: 74
Chunk (hex): 7374616d703a7b2270223a227372632d3230222c226f70223a227472616e73666572222c227469636b223a2230222c22616d74223a302e3030303030303030303030303030303030317d
Detected prefix: stamp:
Data without prefix (hex): 7b2270223a227372632d3230222c226f70223a227472616e73666572222c227469636b223a2230222c22616d74223a302e3030303030303030303030303030303030317d
Uncompressed data (hex): 7b2270223a227372632d3230222c226f70223a227472616e73666572222c227469636b223a2230222c22616d74223a302e3030303030303030303030303030303030317d
Failed to decompress data, raw text output
Decoded SRC-20 Data: {"p":"src-20","op":"transfer","tick":"0","amt":0.000000000000000001}