From 71dc48b07e7f0cb5df7713876bbcf77bc1cfd31c Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 6 May 2024 10:21:59 +0800 Subject: [PATCH 1/3] check chain id --- miner/taiko_worker.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/miner/taiko_worker.go b/miner/taiko_worker.go index 393f1c1d90b2..e79477279413 100644 --- a/miner/taiko_worker.go +++ b/miner/taiko_worker.go @@ -172,6 +172,15 @@ func (w *worker) sealBlockWith( env.gasPool = new(core.GasPool).AddGas(gasLimit) for i, tx := range txs { + if tx.ChainId().Cmp(w.chainConfig.ChainID) != 0 { + if i == 0 { + return nil, fmt.Errorf("anchor tx invalid chain id, expected: %v, actual: %v", w.chainConfig.ChainID, tx.ChainId()) + } else { + log.Debug("Skip an invalid chain id", "hash", tx.Hash(), "expect", w.chainConfig.ChainID, "actual", tx.ChainId()) + continue + } + } + if i == 0 { if err := tx.MarkAsAnchor(); err != nil { return nil, err From a8cc3562929441e9b5ccde0d42606c1c2314ccee Mon Sep 17 00:00:00 2001 From: David Date: Mon, 6 May 2024 12:03:22 +0800 Subject: [PATCH 2/3] Update miner/taiko_worker.go --- miner/taiko_worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miner/taiko_worker.go b/miner/taiko_worker.go index e79477279413..30af78ac16d5 100644 --- a/miner/taiko_worker.go +++ b/miner/taiko_worker.go @@ -176,7 +176,7 @@ func (w *worker) sealBlockWith( if i == 0 { return nil, fmt.Errorf("anchor tx invalid chain id, expected: %v, actual: %v", w.chainConfig.ChainID, tx.ChainId()) } else { - log.Debug("Skip an invalid chain id", "hash", tx.Hash(), "expect", w.chainConfig.ChainID, "actual", tx.ChainId()) + log.Debug("Skip an proposed transaction with invalid chain id", "hash", tx.Hash(), "expect", w.chainConfig.ChainID, "actual", tx.ChainId()) continue } } From f3bbdec612b0c0c0f222819946ba14d893524381 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 6 May 2024 12:13:40 +0800 Subject: [PATCH 3/3] Update miner/taiko_worker.go --- miner/taiko_worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miner/taiko_worker.go b/miner/taiko_worker.go index 30af78ac16d5..2aa04923a7bd 100644 --- a/miner/taiko_worker.go +++ b/miner/taiko_worker.go @@ -174,7 +174,7 @@ func (w *worker) sealBlockWith( for i, tx := range txs { if tx.ChainId().Cmp(w.chainConfig.ChainID) != 0 { if i == 0 { - return nil, fmt.Errorf("anchor tx invalid chain id, expected: %v, actual: %v", w.chainConfig.ChainID, tx.ChainId()) + return nil, fmt.Errorf("anchor tx with invalid chain id, expected: %v, actual: %v", w.chainConfig.ChainID, tx.ChainId()) } else { log.Debug("Skip an proposed transaction with invalid chain id", "hash", tx.Hash(), "expect", w.chainConfig.ChainID, "actual", tx.ChainId()) continue