Skip to content

Implement Foundry's Forge as an environment #125

Description

@mojtaba-eshghie

We would like to have Forge as an environment as it provides the execution. This environment doesn't require tests/exploit integration as it is done by Forge itself.

We need to investigate if we can use advanced forge test -vv with advanced logging such as vm.record() to capture all transactions/events real-time and pass it to the monitor.

According to Foundry's documentation, it is possible to use advanced vm tracing capabilities:

// Enhanced test example using cheatcodes
function testTransactionLogging() public {
    vm.record();  // Start recording transactions
    hello.updateGreeting("New Greeting");

    // Fetch the recorded data
    (bytes32[] memory reads, bytes32[] memory writes) = vm.accesses(address(hello));
    for (uint i = 0; i < writes.length; i++) {
        emit log_named_bytes32("Write Access", writes[i]);
    }

    // Optionally, you can also log the actual transaction data
    // using events, logs, or by interacting with external logging mechanisms.
}

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions