zksync-era: insert or update on table "factory_deps" violates foreign key constraint error

when run external node, it show below errors:

2023-06-01T14:58:27.060483Z  INFO zksync_external_node: Started the external node
2023-06-01T14:58:27.060500Z  INFO zksync_external_node: Main node URL is: https://zksync2-mainnet.zksync.io:443
2023-06-01T14:58:27.078888Z  INFO zksync_core::genesis: running regenesis
2023-06-01T14:58:28.689813Z  INFO zksync_core::genesis: chain_schema_genesis is complete
2023-06-01T14:58:28.743148Z  INFO zksync_core::genesis: operations_schema_genesis is complete
CONTRACTS_GENESIS_ROOT=0xbc59c242d551e3939b9b2939b8b686efa77ba3833183045d548aa5f53357ba95
CONTRACTS_GENESIS_BLOCK_COMMITMENT=0x37d58c849a0eaf7c8b842ec04a5cfeb854f547e0a040d6717cfeb778bfc072fa
CONTRACTS_GENESIS_ROLLUP_LEAF_INDEX=21
CHAIN_STATE_KEEPER_BOOTLOADER_HASH=0x010007794e73f682ad6d27e86b6f71bbee875fc26f5708d1713e7cfd476098d3
CHAIN_STATE_KEEPER_DEFAULT_AA_HASH=0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc
2023-06-01T14:58:29.028072Z  INFO zksync_core::sync_layer::external_io: Initialized the ExternalIO: current L1 batch number 1, current miniblock number 1
2023-06-01T14:58:29.109201Z  INFO zksync_core::sync_layer::fetcher: Starting the fetcher routine. Initial miniblock: 1, initial l1 batch: 0
2023-06-01T14:58:29.109554Z  INFO zksync_core::state_keeper::keeper: Starting state keeper. Next l1 batch to seal: 1, Next miniblock to seal: 1
2023-06-01T14:58:29.111344Z  INFO zksync_core::consistency_checker: Starting consistency checker from batch 1
2023-06-01T14:58:29.114647Z  INFO zksync_core::metadata_calculator::updater: Initialized metadata calculator with new tree implementation. Current RocksDB block: 1. Current Postgres block: 1
2023-06-01T14:58:29.114906Z  INFO zksync_core::state_keeper::keeper: There is no open pending batch, starting a new empty batch
2023-06-01T14:58:29.114918Z DEBUG zksync_core::sync_layer::external_io: Waiting for the new batch params
2023-06-01T14:58:29.172915Z  WARN zksync_core::data_fetchers::error: [TokenListFetcher] Parse data error: error decoding response body: expected value at line 1 column 1 file="core/bin/zksync_core/src/data_fetchers/error.rs" line=70 column=17
2023-06-01T14:58:30.115570Z DEBUG zksync_core::sync_layer::external_io: Waiting for the new batch params
2023-06-01T14:58:30.681705Z  INFO zksync_core::sync_layer::fetcher: New batch: 1. Timestamp: 1676384542
2023-06-01T14:58:30.681747Z  INFO zksync_core::sync_layer::fetcher: New miniblock: 1
2023-06-01T14:58:30.715982Z  INFO zksync_core::sync_layer::external_io: Getting previous block hash
2023-06-01T14:58:30.716785Z  INFO zksync_core::sync_layer::external_io: Previous l1_batch_hash: 85193405663032319915008731881807224107828471675661128689794724912223424592533
2023-06-01T14:58:30.716808Z  INFO zksync_core::sync_layer::external_io: Previous l1_batch_hash: 85193405663032319915008731881807224107828471675661128689794724912223424592533
2023-06-01T14:58:30.717425Z  INFO zksync_core::sync_layer::external_io: Fetching base system contract bytecode from the main node
2023-06-01T14:58:30.887785Z  INFO zksync_core::sync_layer::fetcher: Batch 1: committed
2023-06-01T14:58:30.887802Z  INFO zksync_core::sync_layer::fetcher: Batch 1: proven
2023-06-01T14:58:30.887812Z  INFO zksync_core::sync_layer::fetcher: Batch 1: executed
2023-06-01T14:58:31.094588Z  INFO zksync_core::sync_layer::fetcher: New miniblock: 2

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Database(PgDatabaseError { severity: Error, code: "23503", message: "insert or update on table \"factory_deps\" violates foreign key constraint \"factory_deps_miniblock_number_fkey\"", detail: Some("Key (miniblock_number)=(1) is not present in table \"miniblocks\"."), hint: None, position: None, where: None, schema: Some("public"), table: Some("factory_deps"), column: None, data_type: None, constraint: Some("factory_deps_miniblock_number_fkey"), file: Some("ri_triggers.c"), line: Some(2463), routine: Some("ri_ReportViolation") })', core/lib/dal/src/storage_dal.rs:44:14
stack backtrace:
   0:     0x565371e00a7a - std::backtrace_rs::backtrace::libunwind::trace::h79937bc171ada62c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x565371e00a7a - std::backtrace_rs::backtrace::trace_unsynchronized::h2292bca8571cb919
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x565371e00a7a - std::sys_common::backtrace::_print_fmt::h9c461f248e4ae90d
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x565371e00a7a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he9fe6bf1a39182e1
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x565371e2685e - core::fmt::write::h032658c119c720d7
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/fmt/mod.rs:1208:17
   5:     0x565371dfab45 - std::io::Write::write_fmt::h299fc90dfae41c0d
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/io/mod.rs:1682:15
   6:     0x565371e00845 - std::sys_common::backtrace::_print::heb70d25df9937e3f
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x565371e00845 - std::sys_common::backtrace::print::had745c0a76b8b521
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x565371e0249f - std::panicking::default_hook::{{closure}}::h1ea782cdfa2fd097
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:267:22
   9:     0x565371e021db - std::panicking::default_hook::h1cc3af63455a163c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:286:9
  10:     0x565371e02bac - std::panicking::rust_panic_with_hook::h5cafdc4b3bfd5528
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:688:13
  11:     0x565371e02949 - std::panicking::begin_panic_handler::{{closure}}::hf31c60f40775892c
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:579:13
  12:     0x565371e00f2c - std::sys_common::backtrace::__rust_end_short_backtrace::h28a5c7be595826cd
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x565371e02652 - rust_begin_unwind
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:575:5
  14:     0x565370660f63 - core::panicking::panic_fmt::h8fa27a0b37dd98b7
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/panicking.rs:64:14
  15:     0x5653706613f3 - core::result::unwrap_failed::h62abf61e411aaa08
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/result.rs:1791:5
  16:     0x565370ef4aaa - std::thread::local::LocalKey<T>::with::h2a526c24981b6747
  17:     0x56537104cfef - <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll::h77a06b9c829f316d
  18:     0x565370fc9434 - async_io::driver::block_on::h1a408de39a017c65
  19:     0x565370f11dfa - std::thread::local::LocalKey<T>::with::h8144249a518c0073
  20:     0x565370f2c493 - std::thread::local::LocalKey<T>::with::ha8e97e6d878940b3
  21:     0x565370f075e5 - std::thread::local::LocalKey<T>::with::h5e3a59a8ba023484
  22:     0x565370ecb6e1 - async_std::task::builder::Builder::blocking::h6236099b77627694
  23:     0x565370e67eb0 - zksync_dal::storage_dal::StorageDal::insert_factory_deps::h15f5e7df06276d96
  24:     0x565370bbb167 - zksync_core::sync_layer::external_io::ExternalIO::get_base_system_contract::hf62a7e0dd594674f
  25:     0x565370a75526 - zksync_core::state_keeper::io::common::poll_until::h7945bc51736b5aff
  26:     0x565370bbb7f5 - <zksync_core::sync_layer::external_io::ExternalIO as zksync_core::state_keeper::io::StateKeeperIO>::wait_for_new_batch_params::hf02a6e287b428399
  27:     0x565370adb7a7 - zksync_core::state_keeper::keeper::ZkSyncStateKeeper::wait_for_new_batch_params::h0a4be13bd0090479
  28:     0x565370ad6a50 - zksync_core::state_keeper::keeper::ZkSyncStateKeeper::run_inner::h6d161ab9ba4d6690
  29:     0x565370ad5829 - zksync_core::state_keeper::keeper::ZkSyncStateKeeper::run::hf84973cb78dcd70d
  30:     0x565370760060 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::ha31b58a84527b4cc
  31:     0x565370852617 - tokio::runtime::task::core::Core<T,S>::poll::h2e858048874d2431
  32:     0x5653707d7802 - tokio::runtime::task::harness::Harness<T,S>::poll::hed4245f88475a679
  33:     0x565371da71e8 - tokio::runtime::blocking::pool::Inner::run::h5e955592e87dac7b
  34:     0x565371da873a - std::sys_common::backtrace::__rust_begin_short_backtrace::hfab7d4e1fe9df520
  35:     0x565371dba47b - core::ops::function::FnOnce::call_once{{vtable.shim}}::h923b5256cb5f2ded
  36:     0x565371e05f83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb77d8d72ebcf79c4
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2000:9
  37:     0x565371e05f83 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc08c3353e1568487
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/alloc/src/boxed.rs:2000:9
  38:     0x565371e05f83 - std::sys::unix::thread::Thread::new::thread_start::h7168e596cd5e5ce6
                               at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/sys/unix/thread.rs:108:17
  39:     0x7fdc42c1bfa3 - start_thread
  40:     0x7fdc429c306f - clone
  41:                0x0 - <unknown>
2023-06-02T04:53:07.619909Z ERROR zksync_core: One of the tokio actors unexpectedly finished, shutting down: JoinError::Panic(Id(53), ...) file="core/bin/zksync_core/src/lib.rs" line=98 column=13
2023-06-02T04:53:07.619979Z  INFO zksync_storage::db: Waiting for all the RocksDB instances to be dropped, 1 remaining
2023-06-02T04:53:07.620101Z  INFO zksync_core::metadata_calculator::updater: Stop signal received, metadata_calculator is shutting down
2023-06-02T04:53:07.620114Z  INFO zksync_core::api_server::web3: Stop signal received, WS JSON RPC API is shutting down
2023-06-02T04:53:07.620784Z  INFO zksync_storage::db: All the RocksDB instances are dropped
2023-06-02T04:53:07.648760Z  INFO zksync_core::api_server::web3::pubsub_notifier: Stop signal received, pubsub_tx_notifier is shutting down
2023-06-02T04:53:07.648861Z  INFO zksync_core::api_server::web3::pubsub_notifier: Stop signal received, pubsub_logs_notifier is shutting down
2023-06-02T04:53:07.652091Z  INFO zksync_core::api_server::web3::pubsub_notifier: Stop signal received, pubsub_block_notifier is shutting down
2023-06-02T04:53:07.754485Z  INFO zksync_core::sync_layer::fetcher: New batch: 2. Timestamp: 1676429272
2023-06-02T04:53:07.754505Z  INFO zksync_core::sync_layer::fetcher: New miniblock: 3
2023-06-02T04:53:07.968675Z  INFO zksync_core::sync_layer::fetcher: Batch 2: committed
2023-06-02T04:53:07.968689Z  INFO zksync_core::sync_layer::fetcher: Batch 2: proven
2023-06-02T04:53:07.968696Z  INFO zksync_core::sync_layer::fetcher: Batch 2: executed
2023-06-02T04:53:07.968703Z  INFO zksync_core::sync_layer::fetcher: Stop signal received, exiting the fetcher routine
2023-06-02T04:53:10.648935Z  INFO zksync_core::consistency_checker: Stop signal received, consistency_checker is shutting down
2023-06-02T04:53:10.650241Z  INFO zksync_core::sync_layer::batch_status_updater: Stop signal receiver, exiting the batch status updater routine
2023-06-02T04:53:10.897976Z  INFO zksync_core::l1_gas_price::main_node_fetcher: Stop signal received, MainNodeGasPriceFetcher is shutting down

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Hello and thanks for trying to run our external node! The EN is an ongoing unfinished project that as of now is still buggy. Perhaps we should have been clearer in the documentation that we open sourced it because the OS reflects the code that’s currently running our systems, not because the EN is ready to be run by external people.

If you fix these issues you may run into other ones. When we update the repos next time I believe you would be able to run the EN smoothly.

Hey @dubuqingfeng and @masayil! Thanks for the issue. I want to add more context to @shahar4’s response:

The external node is indeed still in development, and currently it’s not possible to run it against the mainnet without having a database dump (as stated in the currently available docs). It got mirrored, since we’re running the private alpha phase to gather the initial feedback.

That being said, most of the work is already done, and in one of the future releases the EN would be broadly available for everone. I believe this will be officially announced.

I’m closing the issue for now.