Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Foundry's Forge as an environment #125

Open
mojtaba-eshghie opened this issue Jun 9, 2024 · 0 comments
Open

Implement Foundry's Forge as an environment #125

mojtaba-eshghie opened this issue Jun 9, 2024 · 0 comments
Assignees
Labels
feature A new feature

Comments

@mojtaba-eshghie
Copy link
Owner

mojtaba-eshghie commented Jun 9, 2024

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.
}
@mojtaba-eshghie mojtaba-eshghie added the feature A new feature label Jun 9, 2024
@mojtaba-eshghie mojtaba-eshghie self-assigned this Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

No branches or pull requests

1 participant