Open jafri opened 2 years ago
The following code may help measuring ram usage:
test_account = 'hello'
args = {
'payer': test_account,
'receiver': test_account,
'bytes': 1024*1024*2,
}
chain.push_action('eosio', 'buyrambytes', args, {test_account: 'active'})
info = chain.api.get_account('hello')
before = info['ram_usage']
args = dict()
r = chain.push_action('hello', 'testmi2', args, {'hello': 'active'})
info = chain.api.get_account('hello')
after = info['ram_usage']
logger.error('ram usage by action: %s', after - before)
Right, I mean measuring how much RAM a table row would take inside the contract itself, to automatically buy that much RAM
The ram costs by store a value in a table the first time is much more than other times.
So it need a test I think.
The first time extra cost is because of the scope creation I believe
Would be interesting to be able to estimate on-chain RAM bytes size from Packer+Table