Skip to content

Commit

Permalink
op-service/eth: Optimize ssz decoding (#10362)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianst committed May 1, 2024
1 parent 8fe7796 commit e87e5ef
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions op-service/eth/ssz.go
Expand Up @@ -319,6 +319,9 @@ func (payload *ExecutionPayload) UnmarshalSSZ(version BlockVersion, scope uint32
if withdrawalsOffset < transactionsOffset {
return ErrBadWithdrawalsOffset
}
if withdrawalsOffset > scope {
return fmt.Errorf("withdrawals offset is too large: %d", withdrawalsOffset)
}
}

if version == BlockV3 {
Expand All @@ -345,10 +348,6 @@ func (payload *ExecutionPayload) UnmarshalSSZ(version BlockVersion, scope uint32
payload.Transactions = txs

if version.HasWithdrawals() {
if withdrawalsOffset > scope {
return fmt.Errorf("withdrawals offset is too large: %d", withdrawalsOffset)
}

withdrawals, err := unmarshalWithdrawals(buf[withdrawalsOffset:])
if err != nil {
return fmt.Errorf("failed to unmarshal withdrawals list: %w", err)
Expand Down

0 comments on commit e87e5ef

Please sign in to comment.