Skip to main content
Version: dev

Data Bus

Experimental Feature

This feature is experimental. The documentation may be incomplete or out of date, which means it could change in future versions, potentially causing unexpected behavior or not working as expected.

Contributions Welcome: If you notice any inaccuracies or potential improvements, please consider contributing. Visit our GitHub repository to make your contributions: Contribute Here.

The data bus is an optimization that the backend can use to make recursion more efficient. In order to use it, you must define some inputs of the program entry points (usually the main() function) with the call_data modifier, and the return values with the return_data modifier. These modifiers are incompatible with pub and mut modifiers.

Example

fn main(mut x: u32, y: call_data u32, z: call_data [u32;4] ) -> return_data u32 {
let a = z[x];
a+y
}

As a result, both call_data and return_data will be treated as private inputs and encapsulated into a read-only array each, for the backend to process.