Skip to main content

collect_view_values

Function collect_view_values 

Source
fn collect_view_values<FEN: FoundryEvmNetwork>(
    invariant_test: &InvariantTest,
    executor: &Executor<FEN>,
    state_changeset: &AddressMap<Account>,
    tx: &BasicTxDetails,
    run_depth: u32,
    view_cursor: &mut usize,
)
Expand description

Calls the view functions of targeted contracts that the successful call accessed (read or written), and adds their decoded results to the fuzz dictionary, whole structs included.

Eligible views take no inputs or only addresses, which are bound to the call’s sender, so values such as balanceOf(sender) or a getter’s struct describe the state the next calls act on. Calls run against the committed state without changing it; reverted calls are ignored.

At most MAX_VIEW_CALLS_PER_TX views are called. When more are eligible, view_cursor starts each call’s window where the previous one ended, so views past the first window are reached too; with a stable set of eligible views, every one is called in turn.