EspressoSystems / EspressoSystems/espresso-rollup-node-proxy

Unnecessary block serialized byte comparison

Open Beginner friendly
#76 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Everything after the hash comparison is unnecessary because the hash is constructed by rlp encoding the block.

```
func ensureBlocksMatch(espresso, fullNode *types.Block) error {
if espresso.Hash() != fullNode.Hash() {
return fmt.Errorf("block hash mismatch: espresso %s, full node %s", espresso.Hash(), fullNode.Hash())
}

espressoRLP, err := rlp.EncodeToBytes(espresso)
if err != nil {
return fmt.Errorf("failed to RLP-encode espresso block: %w", err)
}
fullNodeRLP, err := rlp.EncodeToBytes(fullNode)
if err != nil {
return fmt.Errorf("failed to RLP-encode full node block: %w", err)
}
if !bytes.Equal(espressoRLP, fullNodeRLP) {
return fmt.Errorf("block mismatch at number %d: espresso and full node blocks differ", espresso.NumberU64())
}
return nil
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Search for the ensureBlocksMatch function and read its callers to confirm the hash comparison is the relevant validation entry point. Remove the redundant serialized-byte comparison while preserving the existing hash-mismatch error behavior, then verify the project tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Refactor
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.