Skip to content

💡 [REQUEST] - Add block_timestamp field to the transaction context #398

@IaroslavMazur

Description

@IaroslavMazur

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions