-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recover securified entities #10
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10 +/- ##
=======================================
- Coverage 97.5% 92.8% -4.7%
=======================================
Files 45 48 +3
Lines 1093 1391 +298
=======================================
+ Hits 1066 1292 +226
- Misses 27 99 +72
|
use crate::prelude::*; | ||
|
||
impl Profile { | ||
async fn new_entity<E: IsEntity + std::fmt::Debug + std::hash::Hash + Eq>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a WEIRD impl, using gateway, which it should not, it should take a pre_derive_keys_cache
instead! and use the "next key"! but I have not implemented that....
relevant thread: https://rdxworks.slack.com/archives/C06EBEA0SGY/p1726135124592619?thread_ts=1726133029.389349&cid=C06EBEA0SGY
HierarchicalDeterministicFactorInstance, | ||
E::Address, | ||
)> = None; | ||
for index in base..(base.add_n(50)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this whole loop should go away, should just use the next factor from the pre_derive_keys_cache
(not implemented)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES review this file, but you can skip down to fn recover_entity
/// L. Return the results, which is three sets: recovered_unsecurified, recovered_securified, unrecovered | ||
/// | ||
/// [doc]: https://radixdlt.atlassian.net/wiki/spaces/AT/pages/3640655873/Yet+Another+Page+about+Derivation+Indices | ||
pub async fn recover_entity<E: IsEntity + Sync + Hash + Eq>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the big value add of this PR! a POC of recovery!
} | ||
|
||
#[cfg(test)] | ||
pub struct TestGateway { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestGateway
needed to "mock" gateway, enabling writing of POC of reovery and tests.
pub network_id: NetworkID, | ||
} | ||
|
||
pub struct NextFreeIndexAssigner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 This is MUCH simplified. A proper one would be async, and use pre_derived_keys_cache
and gateway for IEI
!
) -> Result<SecurifiedEntityControl> { | ||
let account = profile.account_by_address(address.clone())?; | ||
|
||
let keys_collector = KeysCollector::securifying( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is simplified, would actually try to first load factor instances from pre_derived_keys_cache
KeySpace::Securified => self.is_securified(), | ||
} | ||
} | ||
pub fn new_in_key_space(value: HDPathValue, key_space: KeySpace) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 HDPathComponent
gets the notion of the two different key spaces.
impl TryFrom<ScryptoAccessRule> for MatrixOfKeyHashes { | ||
type Error = CommonError; | ||
|
||
fn try_from(value: ScryptoAccessRule) -> Result<Self> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SHOULD only fail if a NON-Radix-Wallet client has implemented different ScryptoAccessRules - not adhering to our standard.
Working POC of recovery of securified entities, using
Canonical Entity Indexing
(CEI
) - strategy 1 as Derivation Entity Indexing heuristics.Can quite easily be generalized to support generic Derivation Indexing Heuristics to try
Individual Entity Indexing
(IEI
).