This repository has been archived by the owner on May 26, 2023. It is now read-only.
Bahurum - Incorrect contractAddress
in tx receipt
#176
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Reward
A payout will be made for this issue
Specification
An issue related to the specification (low severity)
Bahurum
medium
Incorrect
contractAddress
in tx receiptSummary
In
state_processor.go
functionapplyTransaction
theContractAddress
is generated usingtx.Nonce()
, which is always 0 for deposit tx. This causes thecontractAddress
in the tx recipe to be always the same for successive deposit tx from the same sender.Vulnerability Detail
In
state_processor.go
tx.Nonce()
is used for generating theContractAddress
to be put in the tx receipt if the tx creates a contract. For deposit tx the nonce is always zero, so thecontractAddress
in the recipe will always be the same for the deposits from the same sender.The same issue is present in
execution.go
Impact
The tx recipe is incorrect as it shows the same contract being created multiple times, while contracts are created without their address being included in the receipts. This will cause issues to external applications querying the receipts to track contract creations. As an example, this already causes issues in the block exporer.
Code Snippet
https://github.com/sherlock-audit/2023-01-optimism/blob/main/op-geth/core/state_processor.go#L129
https://github.com/sherlock-audit/2023-01-optimism/blob/main/op-geth/cmd/evm/internal/t8ntool/execution.go#L218
Tool used
Manual Review
Recommendation
Use the sender account nonce from the state instead of the tx nonce.
Duplicate of #204
The text was updated successfully, but these errors were encountered: