Closed zjb0807 closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
97bfc23
) 67.06% compared to head (94a04ac
) 67.09%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
currently when adding new runtime code, we need to copy and paste the same code for each of { mandala, karura, acala }
runtime definition. I am curious if there is any way to keep the code more DRY? Maybe like a shared runtime definition, and each of the network can extend it with overrides
with this https://github.com/polkadot-js/api/issues/5725, there will be no need to supply runtime API defs anymore
I mean in this PR, we need to write the following runtime codes 3 times. In substrate there is no shortcut to write "shared runtime implementation"?
// required by xtokens precompile
#[transactional]
fn account_call(
from: AccountId,
to: H160,
data: Vec<u8>,
value: Balance,
gas_limit: u64,
storage_limit: u32,
access_list: Option<Vec<AccessListItem>>,
estimate: bool,
) -> Result<CallInfo, sp_runtime::DispatchError> {
let from = EvmAddressMapping::<Runtime>::get_or_create_evm_address(&from);
Self::call(from, to, data, value, gas_limit, storage_limit, access_list, estimate)
}
fn account_create(
from: AccountId,
data: Vec<u8>,
value: Balance,
gas_limit: u64,
storage_limit: u32,
access_list: Option<Vec<AccessListItem>>,
estimate: bool,
) -> Result<CreateInfo, sp_runtime::DispatchError> {
let from = EvmAddressMapping::<Runtime>::get_or_create_evm_address(&from);
Self::create(from, data, value, gas_limit, storage_limit, access_list, estimate)
}
}
oh. right. no. but we could write some macro to help it but macro in macro is going to make things complicated and it is mostly the method signature are duplicated and implementation are shared
Closes: #2650