Skip to content

Commit

Permalink
Merge pull request #308 from multiversx/MX-15590-add-epoch-start-miss…
Browse files Browse the repository at this point in the history
…ing-fields

FEAT: Add sovereign epoch start missing fields
  • Loading branch information
mariusmihaic authored Jul 16, 2024
2 parents 8bc5957 + 92f76e5 commit 3d38f8e
Show file tree
Hide file tree
Showing 7 changed files with 655 additions and 67 deletions.
16 changes: 15 additions & 1 deletion data/block/sovereignChainHeader.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,11 @@ func (sch *SovereignChainHeader) IsInterfaceNil() bool {

// IsStartOfEpochBlock returns false for the sovereign chain header
func (sch *SovereignChainHeader) IsStartOfEpochBlock() bool {
return false
if sch == nil {
return false
}

return sch.IsStartOfEpoch
}

// GetBlockBodyTypeInt32 returns the blockBody type as int32
Expand Down Expand Up @@ -583,6 +587,16 @@ func (sch *SovereignChainHeader) SetBlockBodyTypeInt32(blockBodyType int32) erro
return sch.Header.SetBlockBodyTypeInt32(blockBodyType)
}

// SetStartOfEpochHeader sets the bool flag for epoch start header
func (sch *SovereignChainHeader) SetStartOfEpochHeader() error {
if sch == nil {
return data.ErrNilPointerReceiver
}

sch.IsStartOfEpoch = true
return nil
}

// SetHash returns the hash
func (omb *OutGoingMiniBlockHeader) SetHash(hash []byte) error {
if omb == nil {
Expand Down
110 changes: 79 additions & 31 deletions data/block/sovereignChainHeader.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions data/block/sovereignChainHeader.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ message SovereignChainHeader {
bytes ValidatorStatsRootHash = 2 [(gogoproto.jsontag) = "validatorStatsRootHash"];
repeated bytes ExtendedShardHeaderHashes = 3 [(gogoproto.jsontag) = "extendedShardHeaderHashes,omitempty"];
OutGoingMiniBlockHeader OutGoingMiniBlockHeader = 4 [(gogoproto.jsontag) = "outGoingOperations,omitempty"];
bool IsStartOfEpoch = 5 [(gogoproto.jsontag) = "isStartOfEpoch,omitempty"];
}

message OutGoingMiniBlockHeader {
Expand Down
18 changes: 18 additions & 0 deletions data/block/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,21 @@ func (strV2 *ShardTriggerRegistryV2) SetEpochStartHeaderHandler(epochStartHeader
}
return nil
}

// GetEpochStartHeaderHandler returns the epoch start header handler
func (m *MetaTriggerRegistry) GetEpochStartHeaderHandler() data.HeaderHandler {
if m == nil {
return nil
}

return m.EpochStartMeta
}

// GetEpochStartHeaderHandler returns the epoch start header handler
func (m *SovereignShardTriggerRegistry) GetEpochStartHeaderHandler() data.HeaderHandler {
if m == nil {
return nil
}

return m.SovereignChainHeader
}
Loading

0 comments on commit 3d38f8e

Please sign in to comment.