Conversation
|
| log.Error("Failed to open storage trie", "address", s.address, "err", err) | ||
| return 0, false | ||
| } | ||
| it, err := tr.NodeIterator(nil) |
There was a problem hiding this comment.
This might be extremely expensive. The largest contract on mainnet is ~92G.
There was a problem hiding this comment.
Thanks for comment, its just PoC exploration. We will most likely have background task or we will sync from genesis and calculating state size growth only via SetState.
There was a problem hiding this comment.
With utility I made just for this, I managed to iterate the whole db for like 48 hours.
There was a problem hiding this comment.
Curious how would it be possible to calculate the trie state diff on the fly per SSTORE?
There was a problem hiding this comment.
Not exactly state diff but for example if you sync from genesis you can use https://github.com/0xPolygon/bor/blob/master/core/state/state_object.go#L222 to track the state growth per account in which case heavy function like storageTrieSize wont be needed at all. Ofcourse storageTrieSize accounts for some metadata generated on disk, which we can account for with some formula too.
|



Description
Charge gas based on contract trie size when executing SSTORE and SLOAD opcodes.