Skip to content

Commit e769737

Browse files
authored
Merge pull request #242 from thirdweb-dev/07-23-do_not_validate_zk_chain_transactions
do not validate zk chain transactions
2 parents b7ead65 + d1d74b5 commit e769737

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/orchestrator/validator.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (v *Validator) ValidateBlocks(blocks []common.BlockData) (validBlocks []com
4848
invalidBlocks = make([]common.BlockData, 0)
4949
validBlocks = make([]common.BlockData, 0)
5050
for _, blockData := range blocks {
51-
valid, err := ValidateBlock(blockData)
51+
valid, err := v.ValidateBlock(blockData)
5252
if err != nil {
5353
log.Error().Err(err).Msgf("Block verification failed for block %s", blockData.Block.Number)
5454
return nil, nil, err
@@ -62,7 +62,7 @@ func (v *Validator) ValidateBlocks(blocks []common.BlockData) (validBlocks []com
6262
return validBlocks, invalidBlocks, nil
6363
}
6464

65-
func ValidateBlock(blockData common.BlockData) (valid bool, err error) {
65+
func (v *Validator) ValidateBlock(blockData common.BlockData) (valid bool, err error) {
6666
if blockData.Block.TransactionCount != uint64(len(blockData.Transactions)) {
6767
log.Error().Msgf("Block verification failed for block %s: transaction count mismatch: expected=%d, fetched from DB=%d", blockData.Block.Number, blockData.Block.TransactionCount, len(blockData.Transactions))
6868
return false, nil
@@ -76,6 +76,12 @@ func ValidateBlock(blockData common.BlockData) (valid bool, err error) {
7676
return false, nil
7777
}
7878

79+
// Check transactionsRoot
80+
if blockData.Block.TransactionsRoot == "0x0000000000000000000000000000000000000000000000000000000000000000" {
81+
// likely a zk chain and does not support tx root
82+
return true, nil
83+
}
84+
7985
// TODO: remove this once we know how to validate all tx types
8086
for _, tx := range blockData.Transactions {
8187
if tx.TransactionType > 4 { // Currently supported types are 0-4

0 commit comments

Comments
 (0)