dojoengine / dojo

Dojo is a toolchain for building provable games and applications
https://dojoengine.org
Apache License 2.0
413 stars 168 forks source link

[BUG] running sozo migrate on example project causes panic in katana #716

Closed lambda-0x closed 1 year ago

lambda-0x commented 1 year ago

Describe the bug Trying to run migrate on ecs example causes a panic in katana

To Reproduce

Start katana with:

./target/debug/katana --seed 0

Build the project first

../../target/debug/sozo build

Run sozo migrate in ecs example:

../../target/debug/sozo migrate --name test

panic message in katana with`RUST_BACKTRACE=1`

``` thread 'tokio-runtime-worker' panicked at 'attempt to subtract with overflow', /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/lu.rs:284:9 stack backtrace: 0: rust_begin_unwind at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5 1: core::panicking::panic_fmt at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14 2: core::panicking::panic at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:117:5 3: minilp::lu::lu_factorize at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/lu.rs:284:9 4: minilp::solver::BasisSolver::reset at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/solver.rs:1290:27 5: minilp::solver::Solver::pivot at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/solver.rs:1101:13 6: minilp::solver::Solver::restore_feasibility at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/solver.rs:533:17 7: minilp::solver::Solver::initial_solve at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/solver.rs:472:13 8: minilp::Problem::solve at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/lib.rs:298:9 9: ::solve at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/good_lp-1.4.1/src/solvers/minilp.rs:76:28 10: cairo_lang_eq_solver::try_solve_equations_iteration at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-eq-solver-2.1.0-rc4/src/lib.rs:97:20 11: cairo_lang_eq_solver::try_solve_equations at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-eq-solver-2.1.0-rc4/src/lib.rs:28:30 12: cairo_lang_sierra_gas::calc_gas_info_inner at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-sierra-gas-2.1.0-rc4/src/lib.rs:234:13 13: cairo_lang_sierra_gas::calc_gas_postcost_info at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-sierra-gas-2.1.0-rc4/src/lib.rs:132:5 14: cairo_lang_sierra_to_casm::metadata::calc_metadata at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-sierra-to-casm-2.1.0-rc4/src/metadata.rs:75:9 15: cairo_lang_starknet::casm_contract_class::CasmContractClass::from_contract_class at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-starknet-2.1.0-rc4/src/casm_contract_class.rs:277:24 16: katana_core::utils::contract::rpc_to_inner_class at ./crates/katana/core/src/utils/contract.rs:67:25 17: as katana_rpc::api::starknet::StarknetApiServer>::estimate_fee::{{closure}} at ./crates/katana/rpc/src/starknet.rs:428:56 18: as core::future::future::Future>::poll at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9 19: katana_rpc::api::starknet::StarknetApiServer::into_rpc::{{closure}}::{{closure}} at ./crates/katana/rpc/src/api/starknet.rs:66:1 20: jsonrpsee_core::server::rpc_module::RpcModule::register_async_method::{{closure}}::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-core-0.16.2/src/server/rpc_module.rs:590:46 21: as core::future::future::Future>::poll at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9 22: jsonrpsee_server::transport::http::execute_call::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/transport/http.rs:260:84 23: jsonrpsee_server::transport::http::execute_call_with_tracing::{{closure}}::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/transport/http.rs:220:25 24: jsonrpsee_server::transport::http::execute_call_with_tracing::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/transport/http.rs:215:1 25: jsonrpsee_server::transport::http::process_single_request::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/transport/http.rs:206:39 26: jsonrpsee_server::transport::http::process_validated_request::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/transport/http.rs:101:52 27: jsonrpsee_server::transport::http::handle_request::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/transport/http.rs:333:4 28: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.28/src/future/future/map.rs:55:37 29: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.28/src/lib.rs:91:13 30: as core::future::future::Future>::poll at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9 31: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/timeout/future.rs:42:15 32: as tower_service::Service>>::call::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/middleware/proxy_get_request.rs:125:17 33: as core::future::future::Future>::poll at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9 34: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-http-0.4.3/src/cors/mod.rs:697:56 35: as hyper::proto::h1::dispatch::Dispatch>::poll_msg at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/proto/h1/dispatch.rs:500:35 36: hyper::proto::h1::dispatch::Dispatcher::poll_write at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/proto/h1/dispatch.rs:301:43 37: hyper::proto::h1::dispatch::Dispatcher::poll_loop at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/proto/h1/dispatch.rs:165:21 38: hyper::proto::h1::dispatch::Dispatcher::poll_inner at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/proto/h1/dispatch.rs:141:16 39: hyper::proto::h1::dispatch::Dispatcher::poll_catch at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/proto/h1/dispatch.rs:120:28 40: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/proto/h1/dispatch.rs:433:9 41: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/server/conn.rs:986:47 42: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/server/conn.rs:1046:30 43: as core::future::future::Future>::poll at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9 44: <&mut F as core::future::future::Future>::poll at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:113:9 45: jsonrpsee_server::server::try_accept_connection::{{closure}}::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/macros/select.rs:524:49 46: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/future/poll_fn.rs:58:9 47: jsonrpsee_server::server::try_accept_connection::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/server.rs:854:2 48: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.37/src/instrument.rs:272:9 49: as core::future::future::Future>::poll at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9 50: futures_util::future::future::FutureExt::poll_unpin at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.28/src/future/future/mod.rs:562:9 51: jsonrpsee_server::future::FutureDriver::drive at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/future.rs:84:7 52: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/future.rs:142:3 53: jsonrpsee_server::future::FutureDriver::select_with::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/future.rs:77:42 54: jsonrpsee_server::server::Server::start_inner::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.16.2/src/server.rs:140:48 55: tokio::runtime::task::core::Core::poll::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/core.rs:311:17 56: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/loom/std/unsafe_cell.rs:14:9 57: tokio::runtime::task::core::Core::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/core.rs:300:13 58: tokio::runtime::task::harness::poll_future::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/harness.rs:476:19 59: as core::ops::function::FnOnce<()>>::call_once at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panic/unwind_safe.rs:271:9 60: std::panicking::try::do_call at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40 61: __rust_try 62: std::panicking::try at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19 63: std::panic::catch_unwind at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14 64: tokio::runtime::task::harness::poll_future at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/harness.rs:464:18 65: tokio::runtime::task::harness::Harness::poll_inner at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/harness.rs:198:27 66: tokio::runtime::task::harness::Harness::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/harness.rs:152:15 67: tokio::runtime::task::raw::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/raw.rs:276:5 68: tokio::runtime::task::raw::RawTask::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/raw.rs:200:18 69: tokio::runtime::task::LocalNotified::run at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/mod.rs:400:9 70: tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/worker.rs:576:13 71: tokio::runtime::coop::with_budget at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:107:5 72: tokio::runtime::coop::budget at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:73:5 73: tokio::runtime::scheduler::multi_thread::worker::Context::run_task at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/worker.rs:575:9 74: tokio::runtime::scheduler::multi_thread::worker::Context::run at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/worker.rs:526:24 75: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/worker.rs:491:21 76: tokio::runtime::context::scoped::Scoped::set at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/scoped.rs:40:9 77: tokio::runtime::context::set_scheduler::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context.rs:176:26 78: std::thread::local::LocalKey::try_with at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:252:16 79: std::thread::local::LocalKey::with at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:228:9 80: tokio::runtime::context::set_scheduler at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context.rs:176:9 81: tokio::runtime::scheduler::multi_thread::worker::run::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/worker.rs:486:9 82: tokio::runtime::context::runtime::enter_runtime at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/runtime.rs:65:16 83: tokio::runtime::scheduler::multi_thread::worker::run at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/worker.rs:478:5 84: tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/worker.rs:447:45 85: as core::future::future::Future>::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/blocking/task.rs:42:21 86: tokio::runtime::task::core::Core::poll::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/core.rs:311:17 87: tokio::loom::std::unsafe_cell::UnsafeCell::with_mut at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/loom/std/unsafe_cell.rs:14:9 88: tokio::runtime::task::core::Core::poll at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/core.rs:300:13 89: tokio::runtime::task::harness::poll_future::{{closure}} at /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/task/harness.rs:476:19 90: as core::ops::function::FnOnce<()>>::call_once at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panic/unwind_safe.rs:271:9 91: std::panicking::try::do_call at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40 92: __rust_try 93: std::panicking::try at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ```

Expected behavior Migration should happen successfully

Additional context

works on commit 2f5c06dc3adfe999a791b18b73824c800eec4669 but fails on 7893eed69b05887e924cd2dc56c806d529f5db3f

lambda-0x commented 1 year ago

looks like a upstream issue

tarrencev commented 1 year ago

This seems like it might be an issue with the Cairo 2.1.0 compiled artifacts. Are you using the same of both sozo and katana? The integration tests are working which deploy ecs example to katana

lambda-0x commented 1 year ago

yes:

  • checked out main
  • run cargo build
  • run katana using (from root of repo):

    ./target/debug/katana --seed 0

  • delete examples/ecs/target folder
  • run sozo build (directly running sozo migrate gives some other error which we can ignore for now)
  • run migrate using from examples/ecs folder

    ../../target/debug/sozo migrate --name test -vvv

Stdout of sozo:

``` Migration account: 0x3ee9e18edc71a6df30ac3aca2e0b02a198fbce19b7480a63a0d71cbd76652e0 [1] 🌎 Building World state.... > No remote World found [2] 🧰 Evaluating Worlds diff.... > Total diffs found: 7 [3] πŸ“¦ Preparing for migration.... > Total items to be migrated (7): New 7 Update 0 # Executor > Declare transaction: 0x23195bd57e15ef9e79b328277005efdc065a7dc6f27e4b1923c9f9ed51c6356 > Deploy transaction: 0x5c1cbea34f1293d49b6c200e41a96357bd679bd3921e9794017433bebea3eaa > Contract address: 0x58af0717568de38d09bd142c20e68ddab9a9a025e6352354abebbc90b235c9e # World > Declare transaction: 0x5503d73690be7850fa9f6330e878799e0e30ea0e447b69a49c03415a62e752a > Deploy transaction: 0x6bae658f98a94f939193050ef9f34e73f97a80200231bfc90d4051120b3b11a > Contract address: 0x2540d1bcb57fc39bf4521b7611f5a52a78e54338e144f0b1841028810bb92ed # Components (2) Moves error: Problem trying to migrate. Caused by: Failed to declare component Moves: error sending request for url (http://localhost:5050/): connection closed before message completed ```

Stdout of katana:

``` β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β•β•šβ•β• β•šβ•β• PREFUNDED ACCOUNTS ================== | Account address | 0x03ee9e18edc71a6df30ac3aca2e0b02a198fbce19b7480a63a0d71cbd76652e0 | Private key | 0x0300001800000000300000180000000000030000000000003006001800006600 | Public key | 0x01b7b37a580d91bc3ad4f9933ed61f3a395e0e51c9dd5553323b8ca3942bb44e | Account address | 0x033c627a3e5213790e246a917770ce23d7e562baa5b4d2917c23b1be6d91961c | Private key | 0x0333803103001800039980190300d206608b0070db0012135bd1fb5f6282170b | Public key | 0x04486e2308ef3513531042acb8ead377b887af16bd4cdd8149812dfef1ba924d | Account address | 0x01d98d835e43b032254ffbef0f150c5606fa9c5c9310b1fae370ab956a7919f5 | Private key | 0x07ca856005bee0329def368d34a6711b2d95b09ef9740ebf2c7c7e3b16c1ca9c | Public key | 0x07006c42b1cfc8bd45710646a0bb3534b182e83c313c7bc88ecf33b53ba4bcbc | Account address | 0x0697aaeb6fb12665ced647f7efa57c8f466dc3048556dd265e4774c546caa059 | Private key | 0x009f6d7a28c0aec0bb42b11600b2fdc4f20042ab6adeac0ca9e6696aabc5bc95 | Public key | 0x076e247c83b961e3ac33082406498a8629a51c1c9e465f4302018565ec1841ff | Account address | 0x021b8eb1d455d5a1ef836a8dae16bfa61fbf7aaa252384ab4732603d12d684d2 | Private key | 0x05d4184feb2ba1aa1274885dd88c8a670a806066dda7684aa562390441224483 | Public key | 0x04e8b088e35962a3912054065682b0546921a96f0b63418484c824ed67729ba3 | Account address | 0x018e623c4ee9f3cf93b06784606f5bc1e86070e8ee6459308c9482554e265367 | Private key | 0x01c62fa406d5cac0f365e20ae9c365548f793196e40536c8c118130255a0ac54 | Public key | 0x04796fb56fc9e44bf543c56625527c04e0a6c51b76b00fc95d8b18749f051077 | Account address | 0x01a0a8e7c3a71a44d2e43fec473d7517fd4f20c6ea054e33be3f98ef82e449df | Private key | 0x07813a0576f69d6e2e90d6d5d861f029fa34e528ba418ebb8e335dbc1ed18505 | Public key | 0x04fa2c2e826b04cdf46625c4e80a6e24c8c1e629ccedcbed7dcbe2cf2dd0a6da | Account address | 0x006a933941976911cbf6917010aae47ef7a54bb32846a3d890c1985d879807aa | Private key | 0x0092f44f50c2fe38cdd00c59a8ab796238982426341f0ee9ebcaa7fd8b1ac939 | Public key | 0x03aa57dec32a26b97ab2542da41ca2512cfc5e3ffc3feca2d21664e2eeeb3836 | Account address | 0x03c00d7cda80f89cb59c147d897acb1647f9e33228579674afeea08f6f57e418 | Private key | 0x04f5adc57e9025a7c5d1424972354fd83ace8b60ff7d46251512b3ea69b81434 | Public key | 0x03839dd0e4e8e664f659b580a9d04de2984914a86e055f46ad2abd687bf4225d | Account address | 0x04514dd4ce4762369fc108297f45771f5160aeb7c864d5209e5047a48ab90b52 | Private key | 0x04929b5202c17d1bf1329e0f3b1deac313252a007cfd925d703e716f790c5726 | Public key | 0x0250a4e65d6d55cbb2a643585a92891b3950c841f30c79ab8b3ee5ee2c3f4194 ACCOUNTS SEED ============= 0 πŸš€ JSON-RPC server started: http://0.0.0.0:5050 [2023-08-06T11:48:49Z DEBUG katana_rpc] method="starknet_chainId" [2023-08-06T11:48:49Z DEBUG katana_rpc] method="starknet_getClassHashAt" [2023-08-06T11:48:49Z DEBUG katana_rpc] method="starknet_getClass" [2023-08-06T11:48:49Z DEBUG katana_rpc] method="starknet_getNonce" [2023-08-06T11:48:49Z DEBUG katana_rpc] method="starknet_estimateFee" [2023-08-06T11:48:50Z DEBUG katana_rpc] method="starknet_addDeclareTransaction" [2023-08-06T11:48:50Z INFO katana_core::backend] Transaction received | Hash: 0x023195bd57e15ef9e79b328277005efdc065a7dc6f27e4b1923c9f9ed51c6356 [2023-08-06T11:48:50Z TRACE katana_core::backend::executor] Transaction resource usage: Steps: 2854 | ECDSA: 1 | L1 Gas: 3672 | Pedersen: 15 | Range Checks: 63 [2023-08-06T11:48:50Z TRACE katana_core::backend::executor] Event emitted keys=[0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9] [2023-08-06T11:48:50Z INFO katana_core::backend] ⛏️ New block generated | Hash: 0x2b89607715e11f93ccee460545f17c197f931f397804512b77bfd20d4674e17 | Number: 1 [2023-08-06T11:48:51Z DEBUG katana_rpc] method="starknet_getTransactionReceipt" [2023-08-06T11:48:51Z DEBUG katana_rpc] method="starknet_getClassHashAt" [2023-08-06T11:48:51Z DEBUG katana_rpc] method="starknet_getNonce" [2023-08-06T11:48:51Z DEBUG katana_rpc] method="starknet_estimateFee" [2023-08-06T11:48:51Z DEBUG katana_rpc] method="starknet_addInvokeTransaction" [2023-08-06T11:48:51Z INFO katana_core::backend] Transaction received | Hash: 0x05c1cbea34f1293d49b6c200e41a96357bd679bd3921e9794017433bebea3eaa [2023-08-06T11:48:51Z TRACE katana_core::backend::executor] Transaction resource usage: Steps: 5624 | ECDSA: 1 | L1 Gas: 4284 | Pedersen: 23 | Range Checks: 128 [2023-08-06T11:48:51Z TRACE katana_core::backend::executor] Event emitted keys=[0x26b160f10156dea0639bec90696772c640b9706a47f5b8c52ea1abe5858b34d] [2023-08-06T11:48:51Z TRACE katana_core::backend::executor] Event emitted keys=[0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9] [2023-08-06T11:48:51Z INFO katana_core::backend] ⛏️ New block generated | Hash: 0x11775e03a28af5cd05cff82e0537e1751465b77d486f08b4e03964c8f4620c9 | Number: 2 [2023-08-06T11:48:51Z DEBUG katana_rpc] method="starknet_getTransactionReceipt" [2023-08-06T11:48:59Z DEBUG katana_rpc] method="starknet_getClass" [2023-08-06T11:48:59Z DEBUG katana_rpc] method="starknet_getNonce" [2023-08-06T11:49:00Z DEBUG katana_rpc] method="starknet_estimateFee" [2023-08-06T11:49:06Z DEBUG katana_rpc] method="starknet_addDeclareTransaction" [2023-08-06T11:49:11Z INFO katana_core::backend] Transaction received | Hash: 0x05503d73690be7850fa9f6330e878799e0e30ea0e447b69a49c03415a62e752a [2023-08-06T11:49:11Z TRACE katana_core::backend::executor] Transaction resource usage: Steps: 2854 | ECDSA: 1 | L1 Gas: 3672 | Pedersen: 15 | Range Checks: 63 [2023-08-06T11:49:11Z TRACE katana_core::backend::executor] Event emitted keys=[0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9] [2023-08-06T11:49:11Z INFO katana_core::backend] ⛏️ New block generated | Hash: 0x7dcf6600d86f968a7117052765de5b8aeabd380966917932e8e7cf3c5acd207 | Number: 3 [2023-08-06T11:49:11Z DEBUG katana_rpc] method="starknet_getTransactionReceipt" [2023-08-06T11:49:11Z DEBUG katana_rpc] method="starknet_getClassHashAt" [2023-08-06T11:49:11Z DEBUG katana_rpc] method="starknet_getNonce" [2023-08-06T11:49:11Z DEBUG katana_rpc] method="starknet_estimateFee" [2023-08-06T11:49:11Z DEBUG katana_rpc] method="starknet_addInvokeTransaction" [2023-08-06T11:49:11Z INFO katana_core::backend] Transaction received | Hash: 0x06bae658f98a94f939193050ef9f34e73f97a80200231bfc90d4051120b3b11a [2023-08-06T11:49:11Z TRACE katana_core::backend::executor] Transaction resource usage: Steps: 6269 | ECDSA: 1 | L1 Gas: 6732 | Pedersen: 25 | Range Checks: 136 [2023-08-06T11:49:11Z TRACE katana_core::backend::executor] Event emitted keys=[0x26b160f10156dea0639bec90696772c640b9706a47f5b8c52ea1abe5858b34d] [2023-08-06T11:49:11Z TRACE katana_core::backend::executor] Event emitted keys=[0x20f4a9eb90c382f623710b9c287e5c670ffc7e969860c063aa3ea54cf7325e7] [2023-08-06T11:49:11Z TRACE katana_core::backend::executor] Event emitted keys=[0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9] [2023-08-06T11:49:12Z INFO katana_core::backend] ⛏️ New block generated | Hash: 0xfe58a49f4dd2fd380a9f0317ca2c2537b9457bf450e7020d4c77f222378ffe | Number: 4 [2023-08-06T11:49:12Z DEBUG katana_rpc] method="starknet_getTransactionReceipt" [2023-08-06T11:49:12Z DEBUG katana_rpc] method="starknet_getClass" [2023-08-06T11:49:12Z DEBUG katana_rpc] method="starknet_getNonce" [2023-08-06T11:49:12Z DEBUG katana_rpc] method="starknet_estimateFee" thread 'tokio-runtime-worker' panicked at 'attempt to subtract with overflow', /home/lambda-0x/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/minilp-0.2.2/src/lu.rs:284:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```

tarrencev commented 1 year ago

Hmm that's quite interesting since we have an integration test that exercises the same code path and passes in ci

lambda-0x commented 1 year ago

can you link me this integration test

tarrencev commented 1 year ago

can you link me this integration test

sure, there are actually a few tests that deploy the example ecs, here is one: https://github.com/dojoengine/dojo/blob/5861daecd6c0e1a246166ecf281dceea87b403b8/crates/dojo-client/src/contract/system_test.rs#L13

lambda-0x commented 1 year ago

are you able to reproduce panic locally?

tarrencev commented 1 year ago

I haven't had a chance to try. I'll be back on my computer tomorrow and can give it a shot

kariy commented 1 year ago

hmmmm its interesting that local cargo test and ci works... even here we deploy the example twice

https://github.com/dojoengine/dojo/blob/main/crates/sozo/src/ops/migration/migration_test.rs

im able to reproduce the error

kariy commented 1 year ago

it doesnt seem to panic when i run katana on release mode

update:

the issue appears to come from the Cairo crate itself, which caused by subtraction overflow. I assume it doesn't panic when i run it on release because

When you’re compiling in release mode with the --release flag, Rust does not include checks for integer overflow that cause panics.

taken from the Rust book

lambda-0x commented 1 year ago

@kariy yup thats exactly why :).

this is an upstream issue but due to complexity of dojo project, i don't think its appropriate to report using dojo project example as it would be alot of friction for them to install and debug.

But before trying to find a minimal reproductible example lets ping someone from core cairo team if the issue is something obvious. will report back if I get more info.

lambda-0x commented 1 year ago

updates:

oh - it is probably just a too large system of equations for mini lp to handle it - so it reaches some bounds it didn't expect

Simply switching to one of the heavier lp solvers solved the overflow itself, so it seems the error itself is simply the minilp solver not being strong enough for the problem size. Will either switch the algorithm to require less of the solver or switch the solver