Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index out of bounds bug? #152

Closed
xz-cn opened this issue Mar 10, 2020 · 4 comments · Fixed by #153
Closed

Index out of bounds bug? #152

xz-cn opened this issue Mar 10, 2020 · 4 comments · Fixed by #153

Comments

@xz-cn
Copy link

xz-cn commented Mar 10, 2020

  1. Clone repo
  2. $ make init
  3. $ make build
  4. $ make run

Error message as below:

Xnip2020-03-10_17-01-20

Acala Mandala Account: 5FHCaBgXVmj4iStBArBgPKubNJGRZCjja1j1SfdaKMu5KA2X

@xlc
Copy link
Member

xlc commented Mar 10, 2020

Thanks for the report!
Can you post the full stack trace? i.e. include ~50 lines above your screenshot
cc @wangjj9219

@xz-cn
Copy link
Author

xz-cn commented Mar 10, 2020

Full stack trace here:

====================

Version: 0.3.4-22f00e9-x86_64-macos

   0: backtrace::backtrace::libunwind::trace
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.45/src/backtrace/libunwind.rs:86
      backtrace::backtrace::trace_unsynchronized
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.45/src/backtrace/mod.rs:66
   1: backtrace::backtrace::trace
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.45/src/backtrace/mod.rs:53
   2: backtrace::capture::Backtrace::create
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.45/src/capture.rs:164
   3: backtrace::capture::Backtrace::new
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.45/src/capture.rs:128
   4: sp_panic_handler::panic_hook
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-panic-handler-2.0.0-alpha.3/src/lib.rs:148
   5: sp_panic_handler::set::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-panic-handler-2.0.0-alpha.3/src/lib.rs:58
   6: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
   7: std::panicking::try::do_call
   8: std::panicking::begin_panic
   9: std::panicking::begin_panic
  10: <usize as core::slice::SliceIndex<[T]>>::index
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libcore/slice/mod.rs:2806
  11: core::slice::<impl core::ops::index::Index<I> for [T]>::index
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libcore/slice/mod.rs:2657
  12: <alloc::vec::Vec<T> as core::ops::index::Index<I>>::index
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/liballoc/vec.rs:1871
  13: module_cdp_engine::Module<T>::_offchain_worker
             at modules/cdp_engine/src/lib.rs:438
  14: <module_cdp_engine::Module<T> as sp_runtime::traits::OffchainWorker<<T as frame_system::Trait>::BlockNumber>>::offchain_worker
             at modules/cdp_engine/src/lib.rs:277
  15: <(TupleElement0, TupleElement1) as sp_runtime::traits::OffchainWorker<BlockNumber>>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-runtime-2.0.0-alpha.3/src/traits.rs:358
  16: <(TupleElement0, TupleElement1) as sp_runtime::traits::OffchainWorker<BlockNumber>>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-runtime-2.0.0-alpha.3/src/traits.rs:358
  17: <(TupleElement0, TupleElement1) as sp_runtime::traits::OffchainWorker<BlockNumber>>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-runtime-2.0.0-alpha.3/src/traits.rs:358
  18: <(TupleElement0, TupleElement1) as sp_runtime::traits::OffchainWorker<BlockNumber>>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-runtime-2.0.0-alpha.3/src/traits.rs:358
  19: <(TupleElement0, TupleElement1) as sp_runtime::traits::OffchainWorker<BlockNumber>>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-runtime-2.0.0-alpha.3/src/traits.rs:358
  20: <(TupleElement0, TupleElement1) as sp_runtime::traits::OffchainWorker<BlockNumber>>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-runtime-2.0.0-alpha.3/src/traits.rs:358
  21: <(TupleElement0, TupleElement1) as sp_runtime::traits::OffchainWorker<BlockNumber>>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-runtime-2.0.0-alpha.3/src/traits.rs:358
  22: frame_executive::Executive<System,Block,Context,UnsignedValidator,AllModules>::offchain_worker
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/frame-executive-2.0.0-alpha.3/src/lib.rs:360
  23: <acala_runtime::Runtime as sp_offchain::runtime_decl_for_OffchainWorkerApi::OffchainWorkerApi<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u32,sp_runtime::traits::BlakeTwo256>,sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic<<pallet_indices::Module<acala_runtime::Runtime> as sp_runtime::traits::StaticLookup>::Source,acala_runtime::Call,sp_runtime::MultiSignature,(frame_system::CheckVersion<acala_runtime::Runtime>, frame_system::CheckGenesis<acala_runtime::Runtime>, frame_system::CheckEra<acala_runtime::Runtime>, frame_system::CheckNonce<acala_runtime::Runtime>, frame_system::CheckWeight<acala_runtime::Runtime>, orml_oracle::CheckOperator<acala_runtime::Runtime>, module_accounts::ChargeTransactionPayment<acala_runtime::Runtime>)>>>>::offchain_worker
             at runtime/src/lib.rs:740
  24: sp_offchain::runtime_decl_for_OffchainWorkerApi::offchain_worker_native_call_generator::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-offchain-2.0.0-alpha.3/src/lib.rs:25
  25: <sc_executor::native_executor::NativeExecutor<D> as sp_core::traits::CodeExecutor>::call::{{closure}}::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-executor-0.8.0-alpha.3/src/native_executor.rs:238
  26: std::panicking::try::do_call
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/panicking.rs:292
  27: panic_unwind::dwarf::eh::read_encoded_pointer
  28: std::panicking::try
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/panicking.rs:270
  29: std::panic::catch_unwind
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/panic.rs:394
  30: sc_executor::native_executor::with_externalities_safe::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-executor-0.8.0-alpha.3/src/native_executor.rs:48
  31: environmental::using::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.1/src/lib.rs:125
  32: std::thread::local::LocalKey<T>::try_with
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/thread/local.rs:262
  33: std::thread::local::LocalKey<T>::with
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/thread/local.rs:239
  34: environmental::using
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.1/src/lib.rs:106
  35: sp_externalities::scope_limited::ext::using
             at <::environmental::environmental macros>:30
  36: sp_externalities::scope_limited::set_and_run_with_externalities
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-externalities-0.8.0-alpha.3/src/scope_limited.rs:29
  37: sc_executor::native_executor::with_externalities_safe
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-executor-0.8.0-alpha.3/src/native_executor.rs:42
  38: <sc_executor::native_executor::NativeExecutor<D> as sp_core::traits::CodeExecutor>::call::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-executor-0.8.0-alpha.3/src/native_executor.rs:238
  39: sc_executor::native_executor::NativeExecutor<D>::with_runtime::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-executor-0.8.0-alpha.3/src/native_executor.rs:151
  40: std::thread::local::LocalKey<T>::try_with
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/thread/local.rs:262
  41: std::thread::local::LocalKey<T>::with
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/thread/local.rs:239
  42: sc_executor::native_executor::NativeExecutor<D>::with_runtime
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-executor-0.8.0-alpha.3/src/native_executor.rs:139
  43: <sc_executor::native_executor::NativeExecutor<D> as sp_core::traits::CodeExecutor>::call
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-executor-0.8.0-alpha.3/src/native_executor.rs:204
  44: sp_state_machine::StateMachine<B,H,N,Exec>::execute_aux
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-state-machine-0.8.0-alpha.3/src/lib.rs:293
  45: sp_state_machine::StateMachine<B,H,N,Exec>::execute_using_consensus_failure_handler
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-state-machine-0.8.0-alpha.3/src/lib.rs:423
  46: <sc_client::call_executor::LocalCallExecutor<B,E> as sc_client_api::call_executor::CallExecutor<Block>>::contextual_call
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-client-0.8.0-alpha.3/src/call_executor.rs:168
  47: <sc_client::client::Client<B,E,Block,RA> as sp_api::CallApiAt<Block>>::call_api_at
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-client-0.8.0-alpha.3/src/client.rs:1575
  48: sp_offchain::runtime_decl_for_OffchainWorkerApi::offchain_worker_call_api_at
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-offchain-2.0.0-alpha.3/src/lib.rs:25
  49: <acala_runtime::RuntimeApiImpl<__SR_API_BLOCK__,RuntimeApiImplCall> as sp_offchain::OffchainWorkerApi<__SR_API_BLOCK__>>::OffchainWorkerApi_offchain_worker_runtime_api_impl::{{closure}}
             at runtime/src/lib.rs:682
  50: acala_runtime::RuntimeApiImpl<Block,C>::call_api_at
             at runtime/src/lib.rs:682
  51: <acala_runtime::RuntimeApiImpl<__SR_API_BLOCK__,RuntimeApiImplCall> as sp_offchain::OffchainWorkerApi<__SR_API_BLOCK__>>::OffchainWorkerApi_offchain_worker_runtime_api_impl
             at runtime/src/lib.rs:682
  52: sp_offchain::OffchainWorkerApi::offchain_worker_with_context
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-offchain-2.0.0-alpha.3/src/lib.rs:25
  53: sc_offchain::OffchainWorkers<Client,Storage,Block>::on_block_imported::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/sc-offchain-2.0.0-alpha.3/src/lib.rs:134
  54: <F as threadpool::FnBox>::call_box
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/threadpool-1.7.1/src/lib.rs:95
  55: threadpool::spawn_in_pool::{{closure}}
             at /Users/xzhang/.cargo/registry/src/github.com-1ecc6299db9ec823/threadpool-1.7.1/src/lib.rs:767
  56: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/sys_common/backtrace.rs:136
  57: std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/thread/mod.rs:469
  58: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/panic.rs:318
  59: std::panicking::try::do_call
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/panicking.rs:292
  60: panic_unwind::dwarf::eh::read_encoded_pointer
  61: std::panicking::try
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/panicking.rs:270
  62: std::panic::catch_unwind
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/panic.rs:394
  63: std::thread::Builder::spawn_unchecked::{{closure}}
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libstd/thread/mod.rs:468
  64: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libcore/ops/function.rs:232
  65: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
  66: std::sys::unix::thread::Thread::new::thread_start
  67: <unknown>
  68: <unknown>


Thread '<unnamed>' panicked at 'index out of bounds: the len is 2 but the index is 2', /rustc/f3e1a954d2ead4e2fc197c7da7d71e6c61bad196/src/libcore/slice/mod.rs:2806

This is a bug. Please report it at:

	https://github.com/AcalaNetwork/Acala/issues

2020-03-10 16:58:09.511  ERROR sc_offchain  Error running offchain workers at BlockId::Hash(0x3ece5df2200c1c7842b58d9ed289c1ee28d50f614917915b49c2117b38100961): Execution(RuntimePanicked("index out of bounds: the len is 2 but the index is 2"))
2020-03-10 16:58:10.987 main-tokio- INFO substrate  Idle (0 peers), best: #2 (0x64fe…16cf), finalized #0 (0x385b…374d), ⬇ 0 ⬆ 0
2020-03-10 16:58:12.740 main-tokio- INFO sc_basic_authorship::basic_authorship  Starting consensus session on top of parent 0x64fe87e6a00291120d65151bf53ea0cf30f2b3335c28bf430bae992bdba816cf
2020-03-10 16:58:12.749 tokio-blocking-driver INFO sc_basic_authorship::basic_authorship  Prepared block for proposing at 3 [hash: 0xa2e53c14516d7cbb7bad79e0a8b75c6da708893b413eb9849a214c04d0041ea1; parent_hash: 0x64fe…16cf; extrinsics (1): [0x200e…6f6e]]
2020-03-10 16:58:12.752 main-tokio- INFO sc_consensus_slots  Pre-sealed block for proposal at 3. Hash now 0xea4e4ebabc18d6c380ce5acb4eabc058787fa83449f1d0d1513e82ae266c8beb, previously 0xa2e53c14516d7cbb7bad79e0a8b75c6da708893b413eb9849a214c04d0041ea1.
2020-03-10 16:58:12.753 main-tokio- INFO substrate  Imported #3 (0xea4e…8beb)
2020-03-10 16:58:13.654  INFO cdp-engine offchain worker  cannot run offchain worker at 2: Liquidator lock is still in locked
2020-03-10 16:58:15.989 main-tokio- INFO substrate  Idle (0 peers), best: #3 (0xea4e…8beb), finalized #1 (0x3ece…0961), ⬇ 0 ⬆ 0

@0xthreebody
Copy link
Collaborator

@xz-cn Already rewarded.

@wangjj9219
Copy link
Member

fixed by #153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants