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

Support properties of the form must always emit an event when storage is updated #294

Open
karmacoma-eth opened this issue May 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@karmacoma-eth
Copy link
Collaborator

Example here with Certora:

https://github.com/Cyfrin/3-gas-bad-nft-marketplace-audit/blob/main/certora/spec/GasBadNft.spec

@karmacoma-eth karmacoma-eth added the enhancement New feature or request label May 22, 2024
@ByungHeonLEE
Copy link

I cannot find the eventLog being called in the Storage.store function.
Does this issue mean need to implement the event logging using the EventLog class and apply the rules as shown in the example?

@karmacoma-eth
Copy link
Collaborator Author

karmacoma-eth commented Jul 25, 2024

I cannot find the eventLog being called in the Storage.store function. Does this issue mean need to implement the event logging using the EventLog class and apply the rules as shown in the example?

the idea is that we want to check contracts like this:

event Log(uint256 oldValue, uint256 newValue);

contract Foo {
    uint256 value;

    // good
    function logsAndStores(uint256 newValue) external {
        emit Log(value, newValue);
        value = newValue;
    }

    // bad
    function justStores(uint256 newValue) external {
        value = newValue;
    }
}

Right now there is no way to express in halmos that logsAndStores is good and justStores is bad (because of the missing log).

Certora supports it with hooks on log and store events, and incrementing a counter when a hook is triggered is a way to check that they match.

@ByungHeonLEE
Copy link

@karmacoma-eth Ok, will do after implementing TLOAD/TSTORE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants