Skip to content

Commit

Permalink
feat(consensus): update ValidateAnchorTx (#289)
Browse files Browse the repository at this point in the history
* feat(consensus): update `ValidateAnchorTx`

* feat(consensus): update `ValidateAnchorTx`
  • Loading branch information
davidtaikocha committed Jul 28, 2024
1 parent a748b91 commit 8ff161f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions consensus/taiko/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
GoldenTouchAccount = common.HexToAddress("0x0000777735367b36bC9B61C50022d9D0700dB4Ec")
TaikoL2AddressSuffix = "10001"
AnchorSelector = crypto.Keccak256([]byte("anchor(bytes32,bytes32,uint64,uint32)"))[:4]
AnchorV2Selector = crypto.Keccak256([]byte("anchorV2(uint64,bytes32,uint32,uint32,uint8)"))[:4]
AnchorGasLimit = uint64(250_000)
)

Expand Down Expand Up @@ -274,7 +275,7 @@ func (t *Taiko) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, p
return common.Big0
}

// ValidateAnchorTx checks if the given transaction is a valid TaikoL2.anchor transaction.
// ValidateAnchorTx checks if the given transaction is a valid TaikoL2.anchor or TaikoL2.anchorV2 transaction.
func (t *Taiko) ValidateAnchorTx(tx *types.Transaction, header *types.Header) (bool, error) {
if tx.Type() != types.DynamicFeeTxType {
return false, nil
Expand All @@ -284,7 +285,7 @@ func (t *Taiko) ValidateAnchorTx(tx *types.Transaction, header *types.Header) (b
return false, nil
}

if !bytes.HasPrefix(tx.Data(), AnchorSelector) {
if !bytes.HasPrefix(tx.Data(), AnchorSelector) && !bytes.HasPrefix(tx.Data(), AnchorV2Selector) {
return false, nil
}

Expand Down

0 comments on commit 8ff161f

Please sign in to comment.