Skip to content

Conversation

@rustopian
Copy link
Contributor

[WIP] more docs etc. incoming shortly, plus an evaluation of any overlap with #161

Problem

Callers can have some difficulty retrieving all information about a processed mollusk instruction or instruction chain. In particular, updating tests to compare CUs, account states, and results can be a bit tedious.

Solution

Allow an observer to be passed in to the new with_observer wrapper functions. This observer is handed all the relevant information so that the caller's testing setup can easily process it.

Context

This is part of a simple solution to provide developers an easy #[compare_programs] attribute, which makes a test compare CUs and check byte-for-byte parity of accounts, data, and instruction results, across any arbitrary number of versions of a program.

Copy link
Collaborator

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, does this do something different than the InvocationInspectCallback?

mollusk/harness/src/lib.rs

Lines 494 to 498 in 88d56ab

/// The callback which can be used to inspect invoke_context
/// and extract low-level information such as bpf traces, transaction
/// context, detailed timings, etc.
#[cfg(feature = "invocation-inspect-callback")]
pub invocation_inspect_callback: Box<dyn InvocationInspectCallback>,

mollusk/harness/src/lib.rs

Lines 748 to 750 in 88d56ab

#[cfg(feature = "invocation-inspect-callback")]
self.invocation_inspect_callback
.after_invocation(&invoke_context);

@rustopian rustopian closed this Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants