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

added BlockDataGet #14

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions internal/storage/mock/address.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/balance.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/block.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/block_stats.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/constant.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/denom_metadata.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/event.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/generic.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/message.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/namespace.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/state.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/stats.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/tx.go

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

3 changes: 0 additions & 3 deletions internal/storage/mock/validator.go

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

3 changes: 0 additions & 3 deletions internal/storage/types/event_type_enum.go

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

3 changes: 0 additions & 3 deletions internal/storage/types/module_enum.go

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

3 changes: 0 additions & 3 deletions internal/storage/types/msg_address_type_enum.go

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

3 changes: 0 additions & 3 deletions internal/storage/types/msg_type_enum.go

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

3 changes: 0 additions & 3 deletions internal/storage/types/status_enum.go

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

3 changes: 2 additions & 1 deletion pkg/indexer/receiver/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ func (s *ModuleTestSuite) TestModule_SyncReadsBlocks() {

for i := types.Level(1); i <= blockCount; i++ {
s.api.EXPECT().
BlockData(gomock.Any(), i).
// BlockData(gomock.Any(), i).
BlockDataGet(gomock.Any(), i).
Return(types.BlockData{
ResultBlock: getResultBlock(i),
ResultBlockResults: getResultBlockResults(i),
Expand Down
2 changes: 1 addition & 1 deletion pkg/indexer/receiver/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (r *Module) worker(ctx context.Context, level types.Level) {
default:
}

block, err := r.api.BlockData(ctx, level)
block, err := r.api.BlockDataGet(ctx, level)
if err != nil {
if errors.Is(err, context.Canceled) {
return
Expand Down
1 change: 1 addition & 0 deletions pkg/node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Api interface {
BlockResults(ctx context.Context, level pkgTypes.Level) (pkgTypes.ResultBlockResults, error)
Genesis(ctx context.Context) (types.Genesis, error)
BlockData(ctx context.Context, level pkgTypes.Level) (pkgTypes.BlockData, error)
BlockDataGet(ctx context.Context, level pkgTypes.Level) (pkgTypes.BlockData, error)
}

//go:generate mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock -typed
Expand Down
42 changes: 39 additions & 3 deletions pkg/node/mock/api.go

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

18 changes: 18 additions & 0 deletions pkg/node/rpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,21 @@ func (api *API) BlockData(ctx context.Context, level pkgTypes.Level) (pkgTypes.B
blockData.ResultBlockResults = results.Result
return blockData, nil
}

func (api *API) BlockDataGet(ctx context.Context, level pkgTypes.Level) (pkgTypes.BlockData, error) {
var blockData pkgTypes.BlockData

block, err := api.Block(ctx, level)
if err != nil {
return blockData, errors.Wrapf(types.ErrRequest, "request error: %s", err.Error())
}

results, err := api.BlockResults(ctx, level)
if err != nil {
return blockData, errors.Wrapf(types.ErrRequest, "request error: %s", err.Error())
}

blockData.ResultBlock = block
blockData.ResultBlockResults = results
return blockData, nil
}
Loading