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?

  • 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. – Evandro Lorenzoni Jul 5 '18 at 5:05
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?

| improve this answer | |
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.

| improve this answer | |
  • super cool! I thought it was 3 days! nice! – Leo Ribeiro Jun 17 '18 at 3:41
  • What's the "l" at the end for? 1000l << – Nat Jun 21 '18 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. – John Haager Jun 28 '18 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 '18 at 20:49
  • im 100% sure it is not not correct. My CPU has been stuck for more than 60hours. – João Nunes Dec 6 '18 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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