Add recorded_keys function to get recorded keys from the proof recorder (#2561)

# Description

- What does this PR do?
This PR adds function to get recorded keys from proof recorder instance
- Why are these changes needed?
This change is required to get the keys accessed by the trie backend
during the runtime execution. The keys are already tracked by proof
recorder, just aren't exposed publicly.
- How were these changes implemented and what do they affect?
The changes are implemented by adding a public function in proof
recorder that simply clones the `recorded_keys` field. It is pure
addition of function and AFAIK does not affect anything.


# Checklist

- [x] My PR includes a detailed description as outlined in the
"Description" section above
- [ ] My PR follows the [labeling requirements](CONTRIBUTING.md#Process)
of this project (at minimum one label for `T`
  required)
- [ ] I have made corresponding changes to the documentation (if
applicable)
- [ ] I have added tests that prove my fix is effective or that my
feature works (if applicable)

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Parth
2023-12-01 04:31:02 +04:00
committed by GitHub
parent 1f2ccaea05
commit 52132636d9
@@ -107,6 +107,13 @@ impl<H: Hasher> Clone for Recorder<H> {
}
impl<H: Hasher> Recorder<H> {
/// Returns [`RecordedForKey`] per recorded key per trie.
///
/// There are multiple tries when working with e.g. child tries.
pub fn recorded_keys(&self) -> HashMap<<H as Hasher>::Out, HashMap<Arc<[u8]>, RecordedForKey>> {
self.inner.lock().recorded_keys.clone()
}
/// Returns the recorder as [`TrieRecorder`](trie_db::TrieRecorder) compatible type.
///
/// - `storage_root`: The storage root of the trie for which accesses are recorded. This is