-
Notifications
You must be signed in to change notification settings - Fork 157
Change origin hash to 32 bytes #3120
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
base: main
Are you sure you want to change the base?
Changes from all commits
5a88177
97b0542
55e0c36
0adf86c
eae895c
ab2641b
100b74a
f892d24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,7 +163,9 @@ const REGISTRATION_CURRENT_RATE_MEMORY_INDEX: u8 = 6u8; | |
const LOOKUP_ANCHOR_WITH_DEVICE_CREDENTIAL_MEMORY_INDEX: u8 = 9u8; | ||
const STABLE_ACCOUNT_MEMORY_INDEX: u8 = 10u8; | ||
const STABLE_APPLICATION_MEMORY_INDEX: u8 = 11u8; | ||
const LOOKUP_APPLICATION_WITH_ORIGIN_MEMORY_INDEX: u8 = 12u8; | ||
// This memory index has been abandoned, do not use it | ||
// const LOOKUP_APPLICATION_WITH_ORIGIN_MEMORY_INDEX: u8 = 12u8; | ||
const LOOKUP_APPLICATION_WITH_ORIGIN_MEMORY_INDEX: u8 = 19u8; | ||
const STABLE_ACCOUNT_REFERENCE_LIST_MEMORY_INDEX: u8 = 13u8; | ||
const STABLE_ANCHOR_ACCOUNT_COUNTER_MEMORY_INDEX: u8 = 14u8; | ||
const STABLE_ACCOUNT_COUNTER_MEMORY_INDEX: u8 = 15u8; | ||
|
@@ -749,6 +751,16 @@ impl<M: Memory + Clone> Storage<M> { | |
.and_then(|application_number| self.stable_application_memory.get(&application_number)) | ||
} | ||
|
||
/// Used for migrating from 8-byte to 32-byte origin hash | ||
pub fn rebuild_lookup_application_with_origin_memory(&mut self) { | ||
self.stable_application_memory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this be pointing to the new stable memory with index 19? We need to keep both accessible until we finish the migration, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
.iter() | ||
.for_each(|(app_num, app)| { | ||
self.lookup_application_with_origin_memory | ||
.insert(StorableOriginHash::from_origin(&app.origin), app_num); | ||
}) | ||
} | ||
|
||
fn lookup_account_references( | ||
&self, | ||
anchor_number: AnchorNumber, | ||
|
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 we have this after the
STABLE_ACCOUNT_COUNTER_DISCREPANCY_COUNTER_MEMORY_INDEX
which is the 18 index?Otherwise I can see ourselves adding the 19 again...
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.
Sure, why not.