wemixarchive / go-wemix

Go implementation of the Wemix project.
https://www.wemix.com/
GNU Lesser General Public License v3.0
28 stars 25 forks source link

Non-miner cannot filter tx in `estimate_gas` based on the current pending state. #110

Closed egonspace closed 4 months ago

egonspace commented 4 months ago

System information

All non-miner nodes.

Expected behaviour

Sample contract:

contract Sample {
    uint256 public val;
    function setValue(uint256 newVal) external {
        require(val % 2 == 0, "val is odd");
        val = newVal;
    }
    function increase() external {
        val++;
    }
}

current: val = 0

Now, we send following two txs continuously to a node to be included in a block.

tx1: sample.increase() tx2: sample.setValue(2)

tx2 should be failed in estimate_gas because the processing estimate_gas should be done on the pending state that includes the result of tx1.

Actual behaviour

tx1, tx2 are all included in the block and tx2 failed in the block consuming gas.

This occurs in wemix mining mode, and not in POW mode.

egonspace commented 4 months ago

My misunderstanding. This is not a bug. A non-miner node has no pending state, it has just a latest block state.