near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.31k stars 619 forks source link

Introduce business model - database layer #2348

Open MaksymZavershynskyi opened 4 years ago

MaksymZavershynskyi commented 4 years ago

Currently we have the following issues:

The proposed solution is to have an explicit layer that every component in our system would use to interface with the storage. The advantages:

For the record, this was already proposed one year ago: https://github.com/nearprotocol/nearcore/issues/575#issuecomment-463841872 .

      1. Patterns to consider
      1. Examples of when it could benefit us
MaksymZavershynskyi commented 4 years ago

For the record. @evgenykuzyakov reported the following error:

Apr 01 22:40:16.205 ERROR sync: Cannot build sync header (get_state_response_header): DB Not Found Error: BLOCK: sWLzUyRwQeXiASrgZbSTvPaULCauqJBoZCX61aVGaVQ
 Cause: Unknown
 Backtrace: stack backtrace:
   0: failure::backtrace::Backtrace::new
   1: <near_chain::store::ChainStore as near_chain::store::ChainStoreAccess>::get_block
   2: <near_client::view_client::ViewClientActor as actix::handler::Handler<near_network::types::NetworkViewClientMessages>>::handle
   3: <actix::address::envelope::SyncEnvelopeProxy<A,M> as actix::address::envelope::EnvelopeProxy>::handle
   4: <actix::contextimpl::ContextFut<A,C> as core::future::future::Future>::poll
   5: tokio::task::raw::poll
   6: <std::future::GenFuture<T> as core::future::future::Future>::poll
   7: actix_rt::runtime::Runtime::block_on
   8: near::main
   9: std::rt::lang_start_internal::{{closure}}::{{closure}}
             at src/libstd/rt.rs:52
      std::sys_common::backtrace::__rust_begin_short_backtrace
             at src/libstd/sys_common/backtrace.rs:130
  10: main
  11: __libc_start_main
  12: _start

With this layer we would've been able to track what invariant was broken relatively easy.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.