-
Notifications
You must be signed in to change notification settings - Fork 106
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
refactor(core-code) Optimisation of read-write structures for code instrumentation #4274
base: master
Are you sure you want to change the base?
Conversation
…or better consistency
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.
will be refactored as discussed in dm
…harge architecture was changed to type state pattern
…n-refactoring # Conflicts: # gclient/src/api/calls.rs
…n-refactoring # Conflicts: # ethexe/runtime/common/src/lib.rs # gtest/src/manager.rs # gtest/src/manager/block_exec.rs # pallets/gear-program/src/migrations/add_section_sizes.rs # pallets/gear-program/src/migrations/v12_program_code_id_migration.rs # pallets/gear/src/tests.rs # runtime/vara/src/migrations.rs
# Conflicts: # core-processor/src/lib.rs # ethexe/runtime/common/src/lib.rs # pallets/gear-builtin/src/lib.rs # pallets/gear-program/src/migrations/add_section_sizes.rs # pallets/gear-program/src/migrations/v12_program_code_id_migration.rs
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.
Remove the migration. It was already executed on chain
|
||
log::info!("🚚 Running migration from {onchain:?} to {update_to:?}, current storage version is {current:?}."); | ||
|
||
v10::MetadataStorageNonce::<T>::kill(); |
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.
Does not exist in master
branch anymore
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.
I'd return it back into mod.rs
because file is too short
v12::CodeStorageNonce::<T>::kill(); | ||
// killing a storage: one write | ||
weight = weight.saturating_add(T::DbWeight::get().writes(1)); | ||
|
||
v12::CodeLenStorageNonce::<T>::kill(); | ||
// killing a storage: one write | ||
weight = weight.saturating_add(T::DbWeight::get().writes(1)); |
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.
I do not see these nonces in master
. The migration should be actualized
if !code_metadata.exports().contains(&dispatch_kind) { | ||
let (destination_id, dispatch, gas_counter, _) = context.into_parts(); | ||
|
||
// Load instrumented binary code from storage. | ||
let code = T::CodeStorage::get_code(code_id).unwrap_or_else(|| { | ||
// `Program` exists, so do code and code len. | ||
let err_msg = format!( | ||
"run_queue_step: failed to get code for the existing program. \ | ||
Program id -'{destination_id:?}', Code id - '{code_id:?}'." | ||
return core_processor::process_success( | ||
SuccessfulDispatchResultKind::Success, | ||
DispatchResult::success(dispatch, destination_id, gas_counter.to_amount()), | ||
); | ||
} |
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 be executed after reinstrumentation
Code structure constructor now returns 3 parameters: InstrumentedCode, OriginalCode and CodeMetadata
CodeMetadata contains all the necessary data to infer the need for code instrumentation
Rewritten precharge to type-state pattern