keep-starknet-strange / shinigami

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

fix NOP 3DUP 1 #155

Closed od-hunter closed 1 month ago

od-hunter commented 1 month ago
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
shinigami ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 2:32pm
od-hunter commented 1 month ago

@b-j-roberts the test is failing because we cannot return an error inside a loop, we can only break as it was previous done in the code,

so i guess adding the check at the top of the function is the right thing to do.

b-j-roberts commented 1 month ago

@b-j-roberts the test is failing because we cannot return an error inside a loop, we can only break as it was previous done in the code,

so i guess adding the check at the top of the function is the right thing to do.

That's right you cannot return in a loop, but you can set the error just like is done here then break out : https://github.com/keep-starknet-strange/shinigami/blob/ab239b5c9a40732e7c15bce847793178512fa947/src/stack.cairo#L228

I think dup_n should have the same error handling setup as that function.

od-hunter commented 1 month ago

dup_n

shinigami/src/stack.cairo

so we remove the if check at the top, then set to errror [err = res.unwrap_err(); ] and break

b-j-roberts commented 1 month ago

Nice work, small change but fixes a lot of failing tests actually! 👍