tokamak-network / tokamak-thanos

MIT License
7 stars 3 forks source link

The _value value is not used when creating a contract using OptimismPortal.depositTransaction #242

Closed Zena-park closed 2 weeks ago

Zena-park commented 2 weeks ago

Describe the bug It seems that the _value data is not used when the contract is created using OptimismPortal.depositTransaction (_sender address is address(0) and _isCreation is true).

Configuration

Severity:

Impact misunderstanding

Recommendation I expected it to be sent to the contract that created it, but it doesn't seem to work that way. If you modify the created contract to send value, this is not necessary.

In that case, it should be allowed to be only 0 as _value to avoid misunderstanding. https://github.com/tokamak-network/tokamak-thanos/blob/5ad9baac98217a0c1533969b00076d9a4443edba/packages/tokamak/contracts-bedrock/src/L1/OptimismPortal.sol#L442-L444

if (_isCreation) {
   require(_to == address(0) && _value == 0, "OptimismPortal: must send to address(0) and _value is zero when creating a contract");
}
nguyenzung commented 2 weeks ago

I think your suggestion will make deposit transaction failed when deploying smart contract with payable constructor and the constructor receive msg.value > 0

Zena-park commented 2 weeks ago

I think your suggestion will make deposit transaction failed when deploying smart contract with payable constructor and the constructor receive msg.value > 0

I understand your answer. Thank you for your answer.

I will close the issue.