Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra data in block structure api and indexer #4308

Merged
merged 17 commits into from
Jul 22, 2022

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Jul 20, 2022

  • Upgrade the indexer version ( this new version will save extra fields in the block structure)
  • Extend also the API block structure

@miiu96 miiu96 changed the base branch from master to rc/2022-july July 20, 2022 11:48
@miiu96 miiu96 self-assigned this Jul 20, 2022
bogdan-rosianu
bogdan-rosianu previously approved these changes Jul 20, 2022
popenta
popenta previously approved these changes Jul 21, 2022
Copy link
Contributor

@popenta popenta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ Log scanner @@

indexer-extra-data-block-structure

================================================================================

  • Known Warnings 18
  • New Warnings 0
  • Known Errors 0
  • New Errors 3
  • Panics 26
    ================================================================================

@miiu96 miiu96 dismissed stale reviews from popenta and bogdan-rosianu via 926cce6 July 21, 2022 11:03
@miiu96 miiu96 changed the title Indexer extra data block structure Extra data in block structure api and indexer Jul 21, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 21, 2022

Codecov Report

❗ No coverage uploaded for pull request base (rc/2022-july@174d6ce). Click here to learn what that means.
The diff coverage is n/a.

@@               Coverage Diff               @@
##             rc/2022-july    #4308   +/-   ##
===============================================
  Coverage                ?   73.69%           
===============================================
  Files                   ?      663           
  Lines                   ?    86191           
  Branches                ?        0           
===============================================
  Hits                    ?    63515           
  Misses                  ?    17914           
  Partials                ?     4762           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 174d6ce...28cccec. Read the comment docs.

bogdan-rosianu
bogdan-rosianu previously approved these changes Jul 21, 2022
}

epochStartShardsData := metaBlock.EpochStart.LastFinalizedHeaders
apiBlock.EpochStartShardsData = make([]*api.EpochStartShardData, 0, len(metaBlock.EpochStart.LastFinalizedHeaders))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could have used len(epochStartShardsData)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@iulianpascalau iulianpascalau self-requested a review July 22, 2022 08:12

func addScheduledInfoInBlock(header data.HeaderHandler, apiBlock *api.Block) {
additionalData := header.GetAdditionalData()
if additionalData == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check.IfNil(additionalData) as header.GetAdditionalData() will return an interface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

node/external/blockAPI/baseBlock.go Show resolved Hide resolved
}
}

func bigIntToStr(value *big.Int) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

return apiMetaBlock, nil
}

func addStartOfEpochInfoInBlock(metaBlock *block.MetaBlock, apiBlock *api.Block) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

if len(epochStartShardData.PendingMiniBlockHeaders) == 0 {
apiBlock.EpochStartShardsData = append(apiBlock.EpochStartShardsData, shardData)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this outside the if branch and remove L222

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -418,7 +418,26 @@ func TestMetaAPIBlockProcessor_GetBlockByRound_GetBlockByNonce_EpochStartBlock(t
},
},
EpochStart: block.EpochStart{
LastFinalizedHeaders: []block.EpochStartShardData{{}},
LastFinalizedHeaders: []block.EpochStartShardData{{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do:

  • add one more finalized header
  • add one more miniblock header in each finalized header

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Contributor

@popenta popenta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ Log scanner @@

indexer-extra-data-block-structure

================================================================================

  • Known Warnings 14
  • New Warnings 0
  • Known Errors 0
  • New Errors 0
  • Panics 0
    ================================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants