Skip to content

Commit

Permalink
Merge pull request #81 from ElrondNetwork/extend-block-structure
Browse files Browse the repository at this point in the history
Extend block structure
  • Loading branch information
iulianpascalau authored Jul 21, 2022
2 parents 05de257 + e1edc16 commit b8560d6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Tests

on:
push:
branches: [ main, development, feat/* ]
branches: [ main, development, feat/*, rc/* ]
pull_request:
branches: [ main, development, feat/* ]
branches: [ main, development, feat/*, rc/* ]

jobs:
test:
Expand Down
59 changes: 43 additions & 16 deletions data/api/apiBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,35 @@ import (

// Block represents the structure for block that is returned by api routes
type Block struct {
Nonce uint64 `json:"nonce"`
Round uint64 `json:"round"`
Hash string `json:"hash"`
PrevBlockHash string `json:"prevBlockHash"`
Epoch uint32 `json:"epoch"`
Shard uint32 `json:"shard"`
NumTxs uint32 `json:"numTxs"`
NotarizedBlocks []*NotarizedBlock `json:"notarizedBlocks,omitempty"`
MiniBlocks []*MiniBlock `json:"miniBlocks,omitempty"`
Timestamp time.Duration `json:"timestamp,omitempty"`
AccumulatedFees string `json:"accumulatedFees,omitempty"`
DeveloperFees string `json:"developerFees,omitempty"`
AccumulatedFeesInEpoch string `json:"accumulatedFeesInEpoch,omitempty"`
DeveloperFeesInEpoch string `json:"developerFeesInEpoch,omitempty"`
Status string `json:"status,omitempty"`
EpochStartInfo *EpochStartInfo `json:"epochStartInfo,omitempty"`
Nonce uint64 `json:"nonce"`
Round uint64 `json:"round"`
Epoch uint32 `json:"epoch"`
Shard uint32 `json:"shard"`
NumTxs uint32 `json:"numTxs"`
Hash string `json:"hash"`
PrevBlockHash string `json:"prevBlockHash"`
StateRootHash string `json:"stateRootHash"`
AccumulatedFees string `json:"accumulatedFees,omitempty"`
DeveloperFees string `json:"developerFees,omitempty"`
AccumulatedFeesInEpoch string `json:"accumulatedFeesInEpoch,omitempty"`
DeveloperFeesInEpoch string `json:"developerFeesInEpoch,omitempty"`
Status string `json:"status,omitempty"`
Timestamp time.Duration `json:"timestamp,omitempty"`
NotarizedBlocks []*NotarizedBlock `json:"notarizedBlocks,omitempty"`
MiniBlocks []*MiniBlock `json:"miniBlocks,omitempty"`
EpochStartInfo *EpochStartInfo `json:"epochStartInfo,omitempty"`
EpochStartShardsData []*EpochStartShardData `json:"epochStartShardsData,omitempty"`
ScheduledData *ScheduledData `json:"scheduledData,omitempty"`
}

// ScheduledData is a structure that hold information about scheduled events
type ScheduledData struct {
ScheduledRootHash string `json:"rootHash,omitempty"`
ScheduledAccumulatedFees string `json:"accumulatedFees,omitempty"`
ScheduledDeveloperFees string `json:"developerFees,omitempty"`
ScheduledGasProvided uint64 `json:"gasProvided,omitempty"`
ScheduledGasPenalized uint64 `json:"penalized,omitempty"`
ScheduledGasRefunded uint64 `json:"gasRefunded,omitempty"`
}

// EpochStartInfo is a structure that holds information about epoch start meta block
Expand All @@ -47,6 +60,20 @@ type NotarizedBlock struct {
Shard uint32 `json:"shard"`
}

// EpochStartShardData is a structure that holds data about the epoch start shard data
type EpochStartShardData struct {
ShardID uint32 `json:"shardID,omitempty"`
Epoch uint32 `json:"epoch,omitempty"`
Round uint64 `json:"round,omitempty"`
Nonce uint64 `json:"nonce,omitempty"`
HeaderHash string `json:"headerHash,omitempty"`
RootHash string `json:"rootHash,omitempty"`
ScheduledRootHash string `json:"scheduledRootHash,omitempty"`
FirstPendingMetaBlock string `json:"firstPendingMetaBlock,omitempty"`
LastFinishedMetaBlock string `json:"lastFinishedMetaBlock,omitempty"`
PendingMiniBlockHeaders []*MiniBlock `json:"pendingMiniBlockHeaders,omitempty"`
}

// MiniBlock represents the structure for a miniblock
type MiniBlock struct {
Hash string `json:"hash"`
Expand Down

0 comments on commit b8560d6

Please sign in to comment.