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

Attempt to Divide by Zero in Inflation #336

Closed
AurevoirXavier opened this issue Mar 12, 2020 · 3 comments · Fixed by #337
Closed

Attempt to Divide by Zero in Inflation #336

AurevoirXavier opened this issue Mar 12, 2020 · 3 comments · Fixed by #337
Assignees

Comments

@AurevoirXavier
Copy link
Member

AurevoirXavier commented Mar 12, 2020

Thread 'import-queue-worker-0' panicked at 'attempt to divide by zero', /Users/xavier/Documents/program/darwinia-network/darwinia/frame/staking/src/inflation.rs:36
@AurevoirXavier AurevoirXavier self-assigned this Mar 12, 2020
@hackfisher hackfisher added this to the Darwinia Crab Network milestone Mar 12, 2020
@AurevoirXavier
Copy link
Member Author

AurevoirXavier commented Mar 12, 2020

#129

#171

@AurevoirXavier
Copy link
Member Author

AurevoirXavier commented Mar 12, 2020

2020-03-12 16:05:06.752 import-queue-worker-0 DEBUG inflation
era_duration: 534000,
living_time: 18446744073709228891,
total_left: 799997999000000000,
payout_fraction: Perbill(
    500000000,
)
maximum: 13537117254354
year: 584542047

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

Version: 0.5.0-6155b46-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
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::panicking::panic
   7: darwinia_staking::inflation::compute_total_payout
   8: <darwinia_staking::Module<T> as pallet_session::SessionManager<<T as frame_system::Trait>::AccountId>>::new_session
   9: <(TupleElement0, TupleElement1) as sp_runtime::traits::OnInitialize<BlockNumber>>::on_initialize
  10: <(TupleElement0, TupleElement1) as sp_runtime::traits::OnInitialize<BlockNumber>>::on_initialize
  11: <(TupleElement0, TupleElement1) as sp_runtime::traits::OnInitialize<BlockNumber>>::on_initialize
  12: <(TupleElement0, TupleElement1) as sp_runtime::traits::OnInitialize<BlockNumber>>::on_initialize
  13: <(TupleElement0, TupleElement1) as sp_runtime::traits::OnInitialize<BlockNumber>>::on_initialize
  14: <(TupleElement0, TupleElement1) as sp_runtime::traits::OnInitialize<BlockNumber>>::on_initialize
  15: frame_executive::Executive<System,Block,Context,UnsignedValidator,AllModules>::initialize_block
  16: frame_executive::Executive<System,Block,Context,UnsignedValidator,AllModules>::execute_block
  17: <node_runtime::Runtime as sp_api::runtime_decl_for_Core::Core<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u32,sp_runtime::traits::BlakeTwo256>,sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic<<pallet_indices::Module<node_runtime::Runtime> as sp_runtime::traits::StaticLookup>::Source,node_runtime::Call,sp_runtime::MultiSignature,(frame_system::CheckVersion<node_runtime::Runtime>, frame_system::CheckGenesis<node_runtime::Runtime>, frame_system::CheckEra<node_runtime::Runtime>, frame_system::CheckNonce<node_runtime::Runtime>, frame_system::CheckWeight<node_runtime::Runtime>, pallet_transaction_payment::ChargeTransactionPayment<node_runtime::Runtime>, pallet_contracts::CheckBlockGasLimit<node_runtime::Runtime>)>>>>::execute_block
  18: std::panicking::try::do_call
  19: __rust_maybe_catch_panic
  20: std::thread::local::LocalKey<T>::with
  21: std::thread::local::LocalKey<T>::with
  22: sp_state_machine::StateMachine<B,H,N,Exec>::execute_aux
  23: sp_state_machine::StateMachine<B,H,N,Exec>::execute_using_consensus_failure_handler
  24: <sc_client::call_executor::LocalCallExecutor<B,E> as sc_client_api::call_executor::CallExecutor<Block>>::contextual_call
  25: <sc_client::client::Client<B,E,Block,RA> as sp_api::CallApiAt<Block>>::call_api_at
  26: sp_api::runtime_decl_for_Core::execute_block_call_api_at
  27: sp_api::Core::execute_block
  28: <&sc_client::client::Client<B,E,Block,RA> as sp_consensus::block_import::BlockImport<Block>>::import_block
  29: <sc_finality_grandpa::import::GrandpaBlockImport<BE,Block,Client,SC> as sp_consensus::block_import::BlockImport<Block>>::import_block
  30: <sc_consensus_babe::BabeBlockImport<Block,Client,Inner> as sp_consensus::block_import::BlockImport<Block>>::import_block
  31: sp_consensus::import_queue::import_single_block
  32: <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
  33: futures_util::future::future::chain::Chain<Fut1,Fut2,Data>::poll
  34: <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
  35: futures_executor::thread_pool::PoolState::work
  36: std::sys_common::backtrace::__rust_begin_short_backtrace
  37: std::panicking::try::do_call
  38: __rust_maybe_catch_panic
  39: core::ops::function::FnOnce::call_once{{vtable.shim}}
  40: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
  41: std::sys::unix::thread::Thread::new::thread_start
  42: _pthread_start


Thread 'import-queue-worker-0' panicked at 'attempt to divide by zero', /Users/xavier/Documents/program/darwinia-network/darwinia/frame/staking/src/inflation.rs:53

This is a bug. Please report it at:

	https://github.com/darwinia-network/darwinia/issues/new

2020-03-12 16:05:06.787 import-queue-worker-0 WARN sc_client::client  Block prepare storage changes error:
Execution(RuntimePanicked("attempt to divide by zero"))

era_duration: 534000,
living_time: 18446744073709228891,
total_left: 799997999000000000,
payout_fraction: Perbill(
    500000000,
)
maximum: 13537117254354
year: 584542047

@AurevoirXavier AurevoirXavier linked a pull request Mar 12, 2020 that will close this issue
@AurevoirXavier
Copy link
Member Author

Move genesis time into chain spec's gensis config.

@AurevoirXavier AurevoirXavier mentioned this issue Mar 12, 2020
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.

2 participants