Summary
Use Case
Time-based Solana programs (token streaming, vesting, staking, lockups) fundamentally rely on block timestamps for their core logic. In the post_transaction hook, we need to assert that the program executed correctly by comparing the actual state changes against the expected values calculated based on the block timestamp.
The challenge
We need to know the exact block timestamp at which the transaction executed to calculate what the correct state should be for our assertions.
Basic Example
fn post_transaction(&self, client: &mut impl FuzzClient) {
// Get the block timestamp to calculate the expected state changes
let block_time = self.block_timestamp;
// Determine the expected state changes based on the tx timestamp
...
// Assert the program executed correctly
...
}
Drawbacks
None
Summary
Use Case
Time-based Solana programs (token streaming, vesting, staking, lockups) fundamentally rely on block timestamps for their core logic. In the
post_transactionhook, we need to assert that the program executed correctly by comparing the actual state changes against the expected values calculated based on the block timestamp.The challenge
We need to know the exact block timestamp at which the transaction executed to calculate what the correct state should be for our assertions.
Basic Example
Drawbacks
None