5

I'm asking this because no one has been able to give a valid answer that applies to all cases. Also, in the EOS Devs Telegram, there are constantly people commenting that their NET/CPU hasn't come back in over 3 days. One person today said they've been waiting a week.

This leads me to believe that the recharging process is likely more complex than we realize.

Previously, we thought it might be 24 hours because of what's in the chain config file; however, that must be a metric for something else.

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;

Then we decided it was 3 days because of what EOS NY has on https://www.eosrp.io/

Please post the code where you find the logic to answer this.


https://github.com/EOSIO/eos/blob/master/libraries/chain/resource_limits.cpp https://github.com/EOSIO/eos/blob/master/libraries/chain/include/eosio/chain/resource_limits_private.hpp

2 Answers 2

10

This is what I understand after a quick walk, through the code.

Your usage status is checked and updated on the chain only when an action​ is done with your account.( This is intuitive, when I look back, because updating all the account usage statuses periodically will be a huge load on the blockchain)

So what you see when you check your usage is the status of your account at the time of your last action. But you ( or your wallet or any front-end) can calculate your current status if the window size, time of the last action etc. are known.

I guess most wallets or front-ends may not be doing this as of now. Which gives seemingly different usage update processes for different users.

Check these files

eos/libraries/chain/include/eosio/chain/resource_limits_private.hpp

eos/libraries/chain/resource_limits.cpp

The 3 day period you mentioned is, used for calculating the exponential moving average and is 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 the number of slots in 24 hours, 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 doing it before making decisions based on the code alone.

In short, 24 hours is the real repletion period, though it may not apparently​ get reflected, in the usage status received from the blockchain.

4
  • That's helpful. Can you share where some or all of that logic is at? I saw some in the chain config file.
    – Nat
    Commented Jul 11, 2018 at 20:28
  • 1
    Added the filenames in the answer
    – febinkk
    Commented Jul 11, 2018 at 21:19
  • Updated the specifics of logic
    – febinkk
    Commented Jul 12, 2018 at 13:43
  • 1
    i just confirmed this! I had 300ms of cpu used. But after 3 days my CPU didnt go down. So i just made a TX and the cpu reseted immediately Commented Dec 6, 2018 at 20:00
1
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;

It's 24 hours.

  • 1000ms = 1s
  • 1s * 60 = 1m
  • 1m * 60 = 1 hr
  • 1 hr * 24 = .. 24 hours.

Your Answer

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

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