starkware-libs / stone-prover

Apache License 2.0
260 stars 76 forks source link

Can't prove program that uses `add_mod` builtin using the `all_cairo` layout #38

Open mellowcroc opened 1 month ago

mellowcroc commented 1 month ago

Reproduce steps:

Input files for prover

Expected result

Proof is successfully generated

Actual result

jason@ubuntu-32gb-ash-1:~/stone-prover$ ./cpu_air_prover mod_builtin.json --out_file proof.json --parameter_file cpu_air_params.json --prover_config_file cpu_air_prover_config.json --private_input_file mod_builtin_private_input.json --public_input_file mod_builtin_public_input.json 
terminate called after throwing an instance of 'starkware::StarkwareException'
  what():  src/starkware/air/components/trace_generation_context.cc:29: Virtual column 'add_mod/p0/addr' not found
Stack trace (most recent call last):
#15   Object "", at 0xffffffffffffffff, in 
#14   Object "/home/jason/stone-prover/cpu_air_prover", at 0x5d21ed, in _start
#13   Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7ab8be82a28a, in __libc_start_main
#12   Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7ab8be82a1c9, in 
#11   Object "/home/jason/stone-prover/cpu_air_prover", at 0x5d27d8, in main
#10   Object "/home/jason/stone-prover/cpu_air_prover", at 0x5d356a, in starkware::ProverMainHelper(starkware::Statement*, starkware::ProverVersion const&)
#9    Object "/home/jason/stone-prover/cpu_air_prover", at 0x5d6f76, in starkware::ProverMainHelperImpl(starkware::Statement*, starkware::JsonValue const&, starkware::JsonValue const&, starkware::JsonValue const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, starkware::ProverVersion const&)
#8    Object "/home/jason/stone-prover/cpu_air_prover", at 0x5eb92c, in starkware::StarkProver::ProveStark(std::unique_ptr<starkware::TraceContext, std::default_delete<starkware::TraceContext> >)
#7    Object "/home/jason/stone-prover/cpu_air_prover", at 0x7a8b62, in starkware::cpu::CpuAirTraceContext<starkware::PrimeFieldElement<252, 0>, 9>::GetTrace()
#6    Object "/home/jason/stone-prover/cpu_air_prover", at 0x7ab143, in starkware::cpu::CpuAir<starkware::PrimeFieldElement<252, 0>, 9>::GetTrace(gsl::span<starkware::cpu::TraceEntry<starkware::PrimeFieldElement<252, 0> > const>, starkware::MaybeOwnedPtr<starkware::cpu::CpuMemory<starkware::PrimeFieldElement<252, 0> > >, starkware::JsonValue const&) const
#5    Object "/home/jason/stone-prover/cpu_air_prover", at 0x7af2a0, in starkware::cpu::AddModBuiltinProverContext<starkware::PrimeFieldElement<252, 0>, 4ul>::AddModBuiltinProverContext(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, starkware::TraceGenerationContext const&, starkware::MemoryCell<starkware::PrimeFieldElement<252, 0> >*, unsigned long, unsigned long, unsigned long, unsigned long, std::map<unsigned long, starkware::cpu::ModBuiltinProverContext<starkware::PrimeFieldElement<252, 0>, 4ul>::Input, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, starkware::cpu::ModBuiltinProverContext<starkware::PrimeFieldElement<252, 0>, 4ul>::Input> > >)
#4    Object "/home/jason/stone-prover/cpu_air_prover", at 0x7b40b6, in starkware::cpu::ModBuiltinProverContext<starkware::PrimeFieldElement<252, 0>, 4ul>::ModBuiltinProverContext(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, starkware::TraceGenerationContext const&, starkware::MemoryCell<starkware::PrimeFieldElement<252, 0> >*, unsigned long, unsigned long, unsigned long, unsigned long, std::map<unsigned long, starkware::cpu::ModBuiltinProverContext<starkware::PrimeFieldElement<252, 0>, 4ul>::Input, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, starkware::cpu::ModBuiltinProverContext<starkware::PrimeFieldElement<252, 0>, 4ul>::Input> > > const&)
#3    Object "/home/jason/stone-prover/cpu_air_prover", at 0x7b5060, in starkware::cpu::ModBuiltinProverContext<starkware::PrimeFieldElement<252, 0>, 4ul>::InitValue(starkware::MemoryCell<starkware::PrimeFieldElement<252, 0> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, starkware::TraceGenerationContext const&)
#2    Object "/home/jason/stone-prover/cpu_air_prover", at 0x7687d3, in starkware::MemoryCellView<starkware::PrimeFieldElement<252, 0> >::MemoryCellView(starkware::MemoryCell<starkware::PrimeFieldElement<252, 0> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, starkware::TraceGenerationContext const&)
#1    Object "/home/jason/stone-prover/cpu_air_prover", at 0x13e126b, in starkware::TraceGenerationContext::GetVirtualColumn(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const
#0    Object "/home/jason/stone-prover/cpu_air_prover", at 0x13e194f, in starkware::ThrowStarkwareException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, unsigned long)

Aborted (core dumped)