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

[BUG] swap_remove index (is 4) should be < len (is 3) while running offchain workers #69

Closed
shekohex opened this issue Jan 12, 2022 · 0 comments · Fixed by #123
Closed
Assignees
Labels
bug 🪲 Something isn't working

Comments

@shekohex
Copy link
Contributor

Full stack-trace:

2022-01-12 16:30:42 Error running offchain workers at BlockId::Hash(0xb7e91242bc8f6114720f9f3eaaf2cb007103f86f33bd7e88ac855355d1bc9e0f): Application(Execution(RuntimePanicked("swap_remove index (is 4) should be < len (is 3)")))

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

Version: 3.0.0-0eba6c4-x86_64-macos

   0: backtrace::backtrace::trace
   1: backtrace::capture::Backtrace::new
   2: sp_panic_handler::set::{{closure}}
   3: std::panicking::rust_panic_with_hook
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/std/src/panicking.rs:610:17
   4: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/std/src/panicking.rs:502:13
   5: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/std/src/sys_common/backtrace.rs:139:18
   6: rust_begin_unwind
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/std/src/panicking.rs:498:5
   7: core::panicking::panic_fmt
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/core/src/panicking.rs:107:14
   8: alloc::vec::Vec<T,A>::swap_remove::assert_failed
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/alloc/src/vec/mod.rs:1300:13
   9: sp_runtime::offchain::storage::StorageValueRef::mutate
  10: pallet_dkg_proposal_handler::<impl pallet_dkg_proposal_handler::pallet::Pallet<T>>::get_next_offchain_signed_proposal
  11: pallet_dkg_proposal_handler::<impl pallet_dkg_proposal_handler::pallet::Pallet<T>>::submit_signed_proposal_onchain
  12: <(TupleElement0,TupleElement1) as frame_support::traits::misc::OffchainWorker<BlockNumber>>::offchain_worker
  13: frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::offchain_worker
  14: sp_offchain::runtime_decl_for_OffchainWorkerApi::offchain_worker_native_call_generator::{{closure}}
  15: std::thread::local::LocalKey<T>::with
  16: sc_executor::native_executor::WasmExecutor<H>::with_instance::{{closure}}
  17: sc_executor::wasm_runtime::RuntimeCache::with_instance
  18: <sc_executor::native_executor::NativeElseWasmExecutor<D> as sp_core::traits::CodeExecutor>::call
  19: sp_state_machine::execution::StateMachine<B,H,Exec>::execute_aux
  20: sp_state_machine::execution::StateMachine<B,H,Exec>::execute_using_consensus_failure_handler
  21: <sc_service::client::call_executor::LocalCallExecutor<Block,B,E> as sc_client_api::call_executor::CallExecutor<Block>>::contextual_call
  22: <sc_service::client::client::Client<B,E,Block,RA> as sp_api::CallApiAt<Block>>::call_api_at
  23: sp_offchain::runtime_decl_for_OffchainWorkerApi::offchain_worker_call_api_at
  24: <dkg_standalone_runtime::RuntimeApiImpl<__SR_API_BLOCK__,RuntimeApiImplCall> as sp_offchain::OffchainWorkerApi<__SR_API_BLOCK__>>::OffchainWorkerApi_offchain_worker_runtime_api_impl
  25: sp_offchain::OffchainWorkerApi::offchain_worker_with_context
  26: <F as threadpool::FnBox>::call_box
  27: std::sys_common::backtrace::__rust_begin_short_backtrace
  28: core::ops::function::FnOnce::call_once{{vtable.shim}}
  29: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/alloc/src/boxed.rs:1694:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/alloc/src/boxed.rs:1694:9
      std::sys::unix::thread::Thread::new::thread_start
             at /rustc/a77da2d454e6caa227a85b16410b95f93495e7e0/library/std/src/sys/unix/thread.rs:106:17
  30: __pthread_start


Thread 'offchain-worker' panicked at 'swap_remove index (is 4) should be < len (is 3)', library/alloc/src/vec/mod.rs:1300

This is a bug. Please report it at:

	support.anonymous.an

Full Debug data:

offchain-worker dkg_proposal_handler: Offchain signed proposals: [([AnchorUpdateSigned { data: [0, 0, 0, 0, 0, 0, 0, 0, 211, 12, 136, 57, 193, 20, 86, 9, 229, 100, 185, 134, 246, 103, 178, 115, 221, 203, 132, 150, 0, 0, 19, 138, 68, 52, 123, 169, 0, 0, 0, 0, 0, 0, 19, 137, 0, 0, 0, 0, 41, 14, 28, 191, 232, 139, 89, 149, 194, 218, 185, 239, 57, 237, 238, 49, 152, 128, 199, 203, 40, 43, 36, 29, 153, 110, 255, 232, 87, 51, 106, 67], signature: [208, 249, 87, 79, 26, 192, 146, 117, 91, 64, 201, 113, 170, 229, 206, 219, 177, 11, 243, 219, 86, 255, 112, 10, 121, 31, 128, 116, 16, 178, 44, 6, 89, 131, 151, 108, 140, 253, 93, 61, 43, 74, 214, 117, 58, 3, 135, 133, 34, 201, 156, 245, 111, 58, 169, 27, 40, 45, 140, 198, 245, 141, 225, 131, 1] }], 31), ([AnchorUpdateSigned { data: [0, 0, 0, 0, 0, 0, 0, 0, 211, 12, 136, 57, 193, 20, 86, 9, 229, 100, 185, 134, 246, 103, 178, 115, 221, 203, 132, 150, 0, 0, 19, 138, 68, 52, 123, 169, 0, 0, 0, 1, 0, 0, 19, 137, 0, 0, 0, 1, 41, 14, 28, 191, 232, 139, 89, 149, 194, 218, 185, 239, 57, 237, 238, 49, 152, 128, 199, 203, 40, 43, 36, 29, 153, 110, 255, 232, 87, 51, 106, 67], signature: [208, 249, 87, 79, 26, 192, 146, 117, 91, 64, 201, 113, 170, 229, 206, 219, 177, 11, 243, 219, 86, 255, 112, 10, 121, 31, 128, 116, 16, 178, 44, 6, 62, 153, 26, 30, 93, 18, 141, 211, 34, 198, 168, 121, 131, 232, 171, 39, 9, 78, 195, 170, 98, 160, 204, 197, 58, 172, 44, 215, 41, 154, 108, 191, 0] }], 31), ([AnchorUpdateSigned { data: [0, 0, 0, 0, 0, 0, 0, 0, 211, 12, 136, 57, 193, 20, 86, 9, 229, 100, 185, 134, 246, 103, 178, 115, 221, 203, 132, 150, 0, 0, 19, 138, 68, 52, 123, 169, 0, 0, 0, 0, 0, 0, 19, 137, 0, 0, 0, 0, 41, 14, 28, 191, 232, 139, 89, 149, 194, 218, 185, 239, 57, 237, 238, 49, 152, 128, 199, 203, 40, 43, 36, 29, 153, 110, 255, 232, 87, 51, 106, 67], signature: [208, 249, 87, 79, 26, 192, 146, 117, 91, 64, 201, 113, 170, 229, 206, 219, 177, 11, 243, 219, 86, 255, 112, 10, 121, 31, 128, 116, 16, 178, 44, 6, 89, 131, 151, 108, 140, 253, 93, 61, 43, 74, 214, 117, 58, 3, 135, 133, 34, 201, 156, 245, 111, 58, 169, 27, 40, 45, 140, 198, 245, 141, 225, 131, 1] }], 42), ([AnchorUpdateSigned { data: [0, 0, 0, 0, 0, 0, 0, 0, 211, 12, 136, 57, 193, 20, 86, 9, 229, 100, 185, 134, 246, 103, 178, 115, 221, 203, 132, 150, 0, 0, 19, 138, 68, 52, 123, 169, 0, 0, 0, 1, 0, 0, 19, 137, 0, 0, 0, 1, 41, 14, 28, 191, 232, 139, 89, 149, 194, 218, 185, 239, 57, 237, 238, 49, 152, 128, 199, 203, 40, 43, 36, 29, 153, 110, 255, 232, 87, 51, 106, 67], signature: [208, 249, 87, 79, 26, 192, 146, 117, 91, 64, 201, 113, 170, 229, 206, 219, 177, 11, 243, 219, 86, 255, 112, 10, 121, 31, 128, 116, 16, 178, 44, 6, 62, 153, 26, 30, 93, 18, 141, 211, 34, 198, 168, 121, 131, 232, 171, 39, 9, 78, 195, 170, 98, 160, 204, 197, 58, 172, 44, 215, 41, 154, 108, 191, 0] }], 42), ([AnchorUpdateSigned { data: [0, 0, 0, 0, 0, 0, 0, 0, 211, 12, 136, 57, 193, 20, 86, 9, 229, 100, 185, 134, 246, 103, 178, 115, 221, 203, 132, 150, 0, 0, 19, 138, 68, 52, 123, 169, 0, 0, 0, 0, 0, 0, 19, 137, 0, 0, 0, 0, 41, 14, 28, 191, 232, 139, 89, 149, 194, 218, 185, 239, 57, 237, 238, 49, 152, 128, 199, 203, 40, 43, 36, 29, 153, 110, 255, 232, 87, 51, 106, 67], signature: [208, 249, 87, 79, 26, 192, 146, 117, 91, 64, 201, 113, 170, 229, 206, 219, 177, 11, 243, 219, 86, 255, 112, 10, 121, 31, 128, 116, 16, 178, 44, 6, 89, 131, 151, 108, 140, 253, 93, 61, 43, 74, 214, 117, 58, 3, 135, 133, 34, 201, 156, 245, 111, 58, 169, 27, 40, 45, 140, 198, 245, 141, 225, 131, 1] }], 53), ([AnchorUpdateSigned { data: [0, 0, 0, 0, 0, 0, 0, 0, 211, 12, 136, 57, 193, 20, 86, 9, 229, 100, 185, 134, 246, 103, 178, 115, 221, 203, 132, 150, 0, 0, 19, 138, 68, 52, 123, 169, 0, 0, 0, 0, 0, 0, 19, 137, 0, 0, 0, 0, 41, 14, 28, 191, 232, 139, 89, 149, 194, 218, 185, 239, 57, 237, 238, 49, 152, 128, 199, 203, 40, 43, 36, 29, 153, 110, 255, 232, 87, 51, 106, 67], signature: [208, 249, 87, 79, 26, 192, 146, 117, 91, 64, 201, 113, 170, 229, 206, 219, 177, 11, 243, 219, 86, 255, 112, 10, 121, 31, 128, 116, 16, 178, 44, 6, 89, 131, 151, 108, 140, 253, 93, 61, 43, 74, 214, 117, 58, 3, 135, 133, 34, 201, 156, 245, 111, 58, 169, 27, 40, 45, 140, 198, 245, 141, 225, 131, 1] }], 64), ([AnchorUpdateSigned { data: [0, 0, 0, 0, 0, 0, 0, 0, 211, 12, 136, 57, 193, 20, 86, 9, 229, 100, 185, 134, 246, 103, 178, 115, 221, 203, 132, 150, 0, 0, 19, 138, 68, 52, 123, 169, 0, 0, 0, 0, 0, 0, 19, 137, 0, 0, 0, 0, 41, 14, 28, 191, 232, 139, 89, 149, 194, 218, 185, 239, 57, 237, 238, 49, 152, 128, 199, 203, 40, 43, 36, 29, 153, 110, 255, 232, 87, 51, 106, 67], signature: [208, 249, 87, 79, 26, 192, 146, 117, 91, 64, 201, 113, 170, 229, 206, 219, 177, 11, 243, 219, 86, 255, 112, 10, 121, 31, 128, 116, 16, 178, 44, 6, 89, 131, 151, 108, 140, 253, 93, 61, 43, 74, 214, 117, 58, 3, 135, 133, 34, 201, 156, 245, 111, 58, 169, 27, 40, 45, 140, 198, 245, 141, 225, 131, 1] }], 75)]
2022-01-12 16:30:42.107 DEBUG      offchain-worker dkg_proposal_handler: Offchain signed proposals left: 7

To trigger this bug, I guess you have to add a lot of unsigned proposals really quickly to the dkg system, and it triggers this error when it try to submit the signed proposals back on-chain.

@shekohex shekohex added the bug 🪲 Something isn't working label Jan 27, 2022
@shekohex shekohex self-assigned this Jan 27, 2022
shekohex pushed a commit that referenced this issue Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
No open projects
Status: Done
1 participant