-
Notifications
You must be signed in to change notification settings - Fork 250
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
Add account_call and account_create in EVM Runtime RPC #2698
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2698 +/- ##
==========================================
+ Coverage 67.06% 67.09% +0.02%
==========================================
Files 67 68 +1
Lines 8608 8983 +375
==========================================
+ Hits 5773 6027 +254
- Misses 2835 2956 +121 ☔ View full report in Codecov by Sentry. |
currently when adding new runtime code, we need to copy and paste the same code for each of |
with this polkadot-js/api#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