4

I can not find reliable information regarding the CPU bandwidth reset period.

It is important for dApp developers because it affects costs for resources.

I heard some say it is 24 hours, others say it is 1 hour.

But the CPU time on my account has not reset even after 24 hours.

https://eosflare.io/account/gu3tcnrqhege

Is there any reliable information on this?

Or can anyone explain how it works?

2
  • 1
    The cpu/net value is only updated when you execute another action again. Then if it was not used in the last 24 hours is reseted and update. If was used in the last 24 hours the value is added to the previous. Jul 5, 2018 at 5:05
  • To everyone saying their CPU / NET hasn't reset, you must complete a NEW transaction for your % to show accurately again. Think that the cache of the value only clears when a transaction happens.
    – Douglas
    Sep 29, 2020 at 14:58

2 Answers 2

0

Re: Recharging CPU/NET

The 3 day period you mentioned is, used for calculating the exponential moving average and not the repletion period.

The variable account_cpu_usage_average_window_ms represents the 24 hour period in milliseconds. This when divided by the block interval (500ms) gives no of slots in 24 hour period, represented by the variable account_cpu_usage_average_window

This value is later used as the window size. So I understand the repletion period as 24 hours. I haven't checked any of these things in any wallets, so I recommend it before making decisions based on code alone.

Link | How Does NET/CPU Recharge Over Time?

5

libraries/chain/include/eosio/chain/config.hpp#L48-L49

static const uint32_t account_cpu_usage_average_window_ms = 24*60*60*1000l;

static const uint32_t account_net_usage_average_window_ms = 24*60*60*1000l;

I interpret this to be 1.000 day wall clock time.

5
  • super cool! I thought it was 3 days! nice! Jun 17, 2018 at 3:41
  • What's the "l" at the end for? 1000l <<
    – Nat
    Jun 21, 2018 at 15:16
  • 2
    @Nat that tells the compiler that the value is to be interpreted as a long type. This insures that the multiplication won't overflow if it exceeds the size of an int. Jun 28, 2018 at 19:46
  • Thank you for that. I suppose that's also why there are ll's in there as well for long longs.
    – Nat
    Jun 29, 2018 at 20:49
  • im 100% sure it is not not correct. My CPU has been stuck for more than 60hours. Dec 6, 2018 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.