LF-Decentralized-Trust-labs / paladin

Programmable privacy for EVM
https://lf-decentralized-trust-labs.github.io/paladin
Apache License 2.0
16 stars 6 forks source link

pente: Handle methods that emit events but do not mutate storage #252

Open awrichar opened 1 month ago

awrichar commented 1 month ago

If a private smart contract deployed on Pente happens to have a method that emits events only (and does not modify contract storage), then the contract address shows up in getUpdatedAccounts(), but has no changes (that is, none of the 4 core account fields address, nonce, balance, code has changed). This means that Pente computes the exact same state hash as both an input state and an output state of the transition, which is not allowed.

Simple contract that reproduces the problem when calling set():

pragma solidity ^0.8.0;

contract SimpleGuard {
    event Changed(uint256 x);

    function set(uint256 value) external {
        emit Changed(value);
    }
}

The symptom is that Paladin finds a conflicting "new state confirmed" event for a state that was already confirmed previously:

[2024-10-01T13:15:33.240-04:00] ERROR PD010121: Pending confirmation for transaction 9592b2a4-34fd-4328-a573-d9f86f61505b found when attempting to confirm from transaction 810535d4-5447-4328-88eb-83c0878ca32b (attempt=1) eventstream=b18f254e-cf52-4387-9c50-294c28e441c7 pid=80759

Therefore it gets in a retry loop while trying to make sense of the transaction, and cannot move forward.

matthew1001 commented 3 weeks ago

I think this is actually a bug. I've raised https://github.com/hyperledger/besu/pull/7845 to fix it @awrichar

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity.