I was attempting to comprehend the workings of cross-contract calling in substrate ink contracts using this particular sample code.
If I provide u64::MAX
as the calls_count
value, it will result in a failure, what should the end user expect to receive when invoking the test_cross_contract_call function?
#[ink(message)]
pub fn test_cross_contract_call(&mut self, callee: AccountId, calls_count: u64) {
let selector: Selector = Selector::new([0x6b, 0x25, 0xcb, 0x19]);
let response: u64 = build_call::<DefaultEnvironment>()
.call_type(
Call::new()
.callee(callee)
.transferred_value(0)
.gas_limit(50000),
)
.call_flags(ink::env::CallFlags::default().set_allow_reentry(true))
.exec_input(ExecutionInput::new(selector).push_arg(calls_count))
.returns::<u64>()
.invoke();
self.value = response;
}
#[ink(message, selector = 0x6b25cb19)]
pub fn dummy_function(&mut self, value: u64) -> u64 {
return 45 * value;
}