Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): fix bug about miner.Pending call #357

Closed
wants to merge 10 commits into from
14 changes: 8 additions & 6 deletions consensus/taiko/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,14 @@ func (t *Taiko) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *t

// Verify anchor transaction
if len(body.Transactions) != 0 { // Transactions list might be empty when building empty payload.
isAnchor, err := t.ValidateAnchorTx(body.Transactions[0], header)
RogerLamTd marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return nil, err
}
if !isAnchor {
return nil, ErrAnchorTxNotFound
if body.Transactions[0].IsAnchor() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remembered that the function IsAnchor() seems always to return false?
And I think using ValidateAnchorTx is enough.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok if the first tx is anchor tx.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't happen that the first tx in the block to be finalised is not an anchor tx, can it?

Copy link
Author

@mask-pp mask-pp Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new modification in this commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first tx in a L2 block must be an anchor tx, so no need to check this?

Copy link
Author

@mask-pp mask-pp Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new modification in this commit.

isAnchor, err := t.ValidateAnchorTx(body.Transactions[0], header)
if err != nil {
return nil, err
}
if !isAnchor {
return nil, ErrAnchorTxNotFound
}
}
}

Expand Down