-
Notifications
You must be signed in to change notification settings - Fork 175
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
[EVM] Cannot call subnet precompile methods from another smart contract #1111
Comments
I tried it on I modified the contract to call a getter for simplicity, as for setters there are additional checks. To run the MPR, you need Alith account (
|
thanks. let me try your test code. |
For ref, here is where I put my "I'm ok" log: fn dispatch(
handle: &mut impl PrecompileHandle,
call: RuntimeCall,
smart_contract_address: &str,
) -> PrecompileResult {
let account_id =
<HashedAddressMapping<BlakeTwo256> as AddressMapping<AccountId32>>::into_account_id(
handle.context().caller,
);
log::error!("I'm ok!");
// Transfer the amount back to the caller before executing the staking operation
// let caller = handle.context().caller;
let amount = handle.context().apparent_value;
if !amount.is_zero() {
transfer_back_to_caller(smart_contract_address, &account_id, amount)?;
}
let result = call.dispatch(RawOrigin::Signed(account_id.clone()).into());
match &result {
Ok(post_info) => log::info!("Dispatch succeeded. Post info: {:?}", post_info),
Err(dispatch_error) => log::error!("Dispatch failed. Error: {:?}", dispatch_error),
}
match result {
Ok(_) => Ok(PrecompileOutput {
exit_status: ExitSucceed::Returned,
output: vec![],
}),
Err(_) => Err(PrecompileFailure::Error {
exit_status: ExitError::Other("Subtensor call failed".into()),
}),
}
} |
The example smart contract gets error "Error(InvalidCode(Opcode(94)))", when calling
setHyperParameter
:The text was updated successfully, but these errors were encountered: