User-defined internal calls currently reject fixed-size byte struct field expressions as arguments, even though the same value is accepted once first bound to a local.
This fails:
contract Calls(byte[64] init_data) {
byte[64] data = init_data;
function f(byte[64] b) : (int) {
return(b.length);
}
function step(State prev_state) {
(int len) = f(prev_state.data); // <- fails here
require(len == 64);
}
entrypoint function main() {
step({ data: data });
}
}
with:
function argument 'b' expects byte[64]
This works:
contract Calls(byte[64] init_data) {
byte[64] data = init_data;
function f(byte[64] b) : (int) {
return(b.length);
}
function step(State prev_state) {
byte[64] local_data = prev_state.data;
(int len) = f(local_data);
require(len == 64);
}
entrypoint function main() {
step({ data: data });
}
}
As shown in the second example, the current workaround is to first bind the field to a local.
User-defined internal calls currently reject fixed-size byte struct field expressions as arguments, even though the same value is accepted once first bound to a local.
This fails:
with:
This works:
As shown in the second example, the current workaround is to first bind the field to a local.