Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions consensus/system_contract/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ func SealHash(header *types.Header) (hash common.Hash) {
// ecrecover extracts the Ethereum account address from a signed header.
func ecrecover(header *types.Header) (common.Address, error) {
signature := header.BlockSignature[0:]
// Normalize recovery ID for compatibility with Scroll's rollup node.
// Scroll's rollup node uses alloy signer which produces signatures with recovery ID (V) of 27/28,
// but go-ethereum's standard crypto.Ecrecover expects V to be 0/1.
// Convert 27/28 format to 0/1 format by subtracting 27.
if signature[64] >= 27 && signature[64] <= 28 {
signature[64] -= 27
}

// Recover the public key and the Ethereum address
pubkey, err := crypto.Ecrecover(SealHash(header).Bytes(), signature)
Expand Down
Loading