kkrt-labs / cairo-vm-ts

A typescript implementation of the Cairo VM
Apache License 2.0
20 stars 13 forks source link

feat: Add div mod hint #127

Closed coxmars closed 1 month ago

coxmars commented 3 months ago

Hi @zmalatrax,

I've made significant progress on the DivMod hint implementation, including updates to the hintName.ts, hintSchema.ts, hintHandler.ts. The core logic is nearly complete, but a few final adjustments are still needed in divMod.ts. Also, the verified tag is working according with the contribution guidelines.

Status

coxmars commented 3 months ago

Update 📌

Hi @zmalatrax

image
zmalatrax commented 3 months ago

@coxmars Looks like your typescript files aren't well formatted, we're using Trunk, I'd recommend you installing their extension if you're on VSCode or Neovim

Otherwise, you can add their CLI and run trunk fmt.

coxmars commented 3 months ago

@coxmars Looks like your typescript files aren't well formatted, we're using Trunk, I'd recommend you installing their extension if you're on VSCode or Neovim

Otherwise, you can add their CLI and run trunk fmt.

Thanks for the feedback, I will apply the requested changes asap 🫡

zmalatrax commented 3 months ago

About the integration test, you need to add a Cairo program divmod.cairo in the cairo_programs/cairo/hints folder that makes use of the DivMod hint.

It should be a simple program focused on this hint, such as

fn main() {
    let _ = 17_u32 / 12_u32;
    let _ = 17_u32 % 12_u32;
}
coxmars commented 3 months ago

Hi @zmalatrax I was able to solve some problems running the integration test haha, it took me a while but I got it done, unit test and integration test ready plus the feedback given, as you can see below it is working so I will open this draft PR to "Ready for review" 🫡

image
coxmars commented 3 months ago

Hi @zmalatrax I already changed the condition as you said and @enitrat I added a new edge case test, if you need something else to be improved just tell me, thanks 🫡

image
coxmars commented 3 months ago

Hi @zmalatrax I applied the changes and add a few more tests ✅

image image
coxmars commented 2 months ago

Hi @zmalatrax, I already applied the improvement, thanks 🫡