ProvableHQ / leo

🦁 The Leo Programming Language. A Programming Language for Formally Verified, Zero-Knowledge Applications
https://leo-lang.org/
GNU General Public License v3.0
4.77k stars 655 forks source link

[Bug] [feat/stubs] panic compiling aleo opcodes #26266

Open arosboro opened 9 months ago

arosboro commented 9 months ago

Attempting to build https://github.com/zkCohort/zk_texas_holdem/tree/feat/stubs/zk_texas_holdem

% leo build
       Leo ⚠️  Attention - This command is deprecated. Use the 'run' command.

       Leo ✅ Compiled 'main.leo' into Aleo instructions
thread `main` panicked at compiler/passes/src/code_generation/visit_expressions.rs:546:29:
internal error: entered unreachable code: Type checking guarantees that imported and stub programs are well defined.
stack backtrace: 
   0: backtrace::capture::Backtrace::create
   1: backtrace::capture::Backtrace::new
   2: leo::set_panic_hook::{{closure}}
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_handler::{{closure}}
   5: std::sys_common::backtrace::__rust_end_short_backtrace
   6: _rust_begin_unwind
   7: core::panicking::panic_fmt
   8: leo_passes::code_generation::visit_expressions::<impl leo_passes::code_generation::generator::CodeGenerator>::visit_call
   9: leo_passes::code_generation::visit_expressions::<impl leo_passes::code_generation::generator::CodeGenerator>::visit_expression
  10: leo_passes::code_generation::visit_statements::<impl leo_passes::code_generation::generator::CodeGenerator>::visit_statement
  11: itertools::Itertools::join
  12: leo_passes::code_generation::visit_program::<impl leo_passes::code_generation::generator::CodeGenerator>::visit_function
  13: itertools::Itertools::join
  14: leo_passes::code_generation::<impl leo_passes::pass::Pass for leo_passes::code_generation::generator::CodeGenerator>::do_pass
  15: leo_compiler::compiler::Compiler::compile
  16: <leo_lang::cli::commands::build::Build as leo_lang::cli::commands::Command>::apply
  17: leo_lang::cli::commands::Command::execute
  18: leo_lang::cli::commands::Command::try_execute
  19: leo_lang::cli::cli::run_with_args
  20: scoped_tls::ScopedKey<T>::set
  21: leo::main
  22: std::sys_common::backtrace::__rust_begin_short_backtrace
  23: std::rt::lang_start::{{closure}}
  24: std::rt::lang_start_internal
  25: std::rt::lang_start

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/AleoHQ/leo/issues/new?labels=bug,panic&template=bug.md&title=[Bug]

note: leo-lang 1.10.0 running on Darwin 21.6.0

note: compiler args: leo build

note: compiler flags: CLI { debug: false, quiet: false, command: Build { command: Build { options: BuildOptions { offline: false, enable_symbol_table_spans: false, enable_initial_symbol_table_snapshot: false, enable_type_checked_symbol_table_snapshot: false, enable_unrolled_symbol_table_snapshot: false, enable_ast_spans: false, enable_dce: false, enable_all_ast_snapshots: false, enable_initial_input_ast_snapshot: false, enable_initial_ast_snapshot: false, enable_unrolled_ast_snapshot: false, enable_ssa_ast_snapshot: false, enable_flattened_ast_snapshot: false, enable_destructured_ast_snapshot: false, enable_inlined_ast_snapshot: false, enable_dce_ast_snapshot: false } } }, path: None, home: None }
arosboro commented 9 months ago

The error was caused by calling zk_deck_shuffle.aleo/shuffle_deck while the import name was zk_deck_shuffle_v0_0_1.aleo/shuffle_deck