keep-starknet-strange / shinigami

Bitcoin Script VM in Cairo
https://shinigamibtc.dev
MIT License
56 stars 56 forks source link

fix: add check for discouraged ops #227

Closed bloomingpeach closed 1 day ago

bloomingpeach commented 3 weeks ago

fixes

scarb cairo-run --package shinigami_cmds '[[],59389374992760294021292601,11,[127663847454887939587139309636239821029460283340348563361134020274702083684],672225353062291822653026351361043029027015304412105792318784106841588044,30,[],141695097775878930382826583948656689861065920770142587191887339894720122963,31]'

["1 0x01 0xb9","HASH160 0x14 0x15727299b05b45fdaf9ac9ecf7565cfe27c3e567 EQUAL","P2SH,DISCOURAGE_UPGRADABLE_NOPS","DISCOURAGE_UPGRADABLE_NOPS","Discouraged NOP10 in redeemScript"],

vercel[bot] commented 3 weeks ago

@bloomingpeach is attempting to deploy a commit to the keep-starknet-strange Team on Vercel.

A member of the Team first needs to authorize it.

b-j-roberts commented 1 week ago

So I think this error has to do with P2SH not being fully implemented yet. So the "redeemScript" from P2SH transactions aren't being interpretted properly. ( here 0xb9 is in the redeem script )

I'd recommend reading this if you're interested. https://learnmeabitcoin.com/technical/script/p2sh/

Mainly missing the bip16 flag controls like this line in our engine : https://github.com/btcsuite/btcd/blob/67b8efd3ba53b60ff0eba5d79babe2c3d82f6c54/txscript/engine.go#L998

If you're interested you can implement these, otherwise, I'll have someone work on P2SH

bloomingpeach commented 1 week ago

Yeah I would like to have a try @b-j-roberts

b-j-roberts commented 1 day ago

Bip16 p2sh control flow is now supported from this PR, so I will go ahead and close this since it seems to have been the problem.