Stateless: Add multiproof function and use when building witnesses #3556
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a multiproof function to the aristo proofs module which returns all the proof trie nodes for an entire block (account and storage trie nodes) together in a single list. Doing so enables sharing the node cache with all the account proof and storage proof calls in order to further improve performance.
By using the table parameter which maps account paths (address hash) to a list of storage paths (slot hashes), when building the witness, only a single loop through is needed (linear time with respect to the number of witness keys) instead of a double loop (quadratic time) which results in rather bad performance when building the witnesses during the DOS block ranges where some blocks generate more than 50K witness keys.