Skip to content

Commit

Permalink
fix(header): fix next header hash for migrated rollapps (#1327)
Browse files Browse the repository at this point in the history
  • Loading branch information
srene authored Jan 13, 2025
1 parent ace06fc commit 4eea8f4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions types/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,15 @@ func (h *Header) FromProto(other *pb.Header) error {
if !safeCopy(h.SequencerHash[:], other.SequencerHash) {
return errors.New("invalid length of 'SequencerHash'")
}
// if NextSequencerHash is nil (2D rollapps) dont copy
if other.NextSequencerHash != nil && !safeCopy(h.NextSequencersHash[:], other.NextSequencerHash) {
// if NextSequencerHash is nil (2D rollapps) use sequencerHash
nextSequencerHash := other.NextSequencerHash
if nextSequencerHash == nil {
nextSequencerHash = other.SequencerHash
}
if !safeCopy(h.NextSequencersHash[:], nextSequencerHash) {
return errors.New("invalid length of 'NextSequencersHash'")
}

if len(other.ProposerAddress) > 0 { // TODO: why if?
h.ProposerAddress = make([]byte, len(other.ProposerAddress))
copy(h.ProposerAddress, other.ProposerAddress)
Expand Down

0 comments on commit 4eea8f4

Please sign in to comment.