bug: Unknown Hint: Core(Core(EvalCircuit
Opened this issue · 3 comments
Current behavior:
Hint fails with:
Unknown Hint: Core(Core(EvalCircuit { n_add_mods: Deref(CellRef { register: AP, offset: -6 }), add_mod_builtin: Deref(CellRef { register: FP, offset: -6 }), n_mul_mods: Deref(CellRef { register: AP, offset: -4 }), mul_mod_builtin: Deref(CellRef { register: FP, offset: -5 }) }))
This happens presumably any time mul_mod
is called. The problem is that this is not handled in cairo-vm
.
Expected behavior:
Hint should succeed.
Steps to reproduce:
Run prove_block
against affected blocks such as 160035, 160045, 160068, 160074, 160084, or 160093
I started by handling the hint in cairo-vm
: Moonsong-Labs/cairo-vm#44
But this led to an error shortly later: Unknown memory cell at address 13:6
It turns out there is some logic missing from cairo-vm
's fill_memory
as compared to cairo-lang
's. This comment (although unclear no me) suggests what is wrong:
# Note that we can't read 'n' here because sierra expects this function to compute it.
A naive attempt to avoid reading n
, as suggested in the comment mentioned above, isn't sufficient. It turns out there is a lot of extra code to calculate this value instead of reading it.
I began implementing this, but it turned into quite a rabbit hole, as there seems to be a lot more code omitted in the cairo-vm
implementation. Even worse, a lot of the code that is omitted is actually dead code, so it's not obvious what exactly actually needed among the missing code.
The implementation from cairo
seems to work 🎉 We're now passing the following blocks:
160035, 160045, 160068, 160074, 160084