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

[block] deprecate some code in block.go and body.go #3453

Merged
merged 3 commits into from
Jun 16, 2022

Conversation

dustinxie
Copy link
Member

Description

as title

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@dustinxie dustinxie requested a review from a team as a code owner June 14, 2022 06:57
require.NoError(t, err)
require.Equal(t, blk, newblk)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

this test is same as TestBlockDeserializer in above

"github.com/iotexproject/iotex-core/test/identityset"
)

func TestPutBlockToParentChain(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this test is no longer valid after subchain feature/code was removed

},
},
}
require.NoError(t, blk.ConvertFromBlockPb(blkpb, 0))
Copy link
Member Author

Choose a reason for hiding this comment

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

here only tests block conversion from protobuf, which exist in test code under /blockchain/block/

@codecov
Copy link

codecov bot commented Jun 14, 2022

Codecov Report

Merging #3453 (199fe0c) into master (963f1f8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 199fe0c differs from pull request most recent head 373d877. Consider uploading reports for the commit 373d877 to get more accurate results

@@           Coverage Diff           @@
##           master    #3453   +/-   ##
=======================================
  Coverage   75.20%   75.20%           
=======================================
  Files         236      236           
  Lines       22006    21991   -15     
=======================================
- Hits        16549    16538   -11     
+ Misses       4572     4568    -4     
  Partials      885      885           
Impacted Files Coverage Δ
blockchain/block/block.go 72.97% <ø> (-6.62%) ⬇️
blockchain/block/body.go 100.00% <ø> (ø)
blockchain/block/block_deserializer.go 100.00% <100.00%> (+16.00%) ⬆️
pkg/util/httputil/httputil.go 70.00% <0.00%> (ø)

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 963f1f8...373d877. Read the comment docs.

return nil, errors.Wrap(err, "failed to deserialize block header")
}
if err := b.Body.LoadProto(pbBlock.GetBody(), bd.evmNetworkID); err != nil {
if b.Body, err = bd.fromBodyProto(pbBlock.GetBody()); err != nil {
return nil, errors.Wrap(err, "failed to deserialize block body")
}
if err := b.ConvertFromBlockFooterPb(pbBlock.GetFooter()); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

err = xxx

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -77,5 +86,6 @@ func (bd *Deserializer) DeserializeBody(buf []byte) (*Body, error) {
if err := proto.Unmarshal(buf, &pb); err != nil {
return nil, errors.Wrap(err, "failed to unmarshal block body")
}
return bd.FromBodyProto(&pb)
b, err := bd.fromBodyProto(&pb)
Copy link
Member

Choose a reason for hiding this comment

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

b, err := balabala
if err != nil {
return nil, err
}
return &b, nil

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@dustinxie dustinxie merged commit ba24a74 into iotexproject:master Jun 16, 2022
pocockn added a commit to pocockn/iotex-core that referenced this pull request Jun 16, 2022
…re into task/build-node-command

* 'task/build-node-command' of github.com:pocockn/iotex-core:
  [block] deprecate some code in block.go and body.go (iotexproject#3453)
  [httputil] return error from keep alive methods within httputil pkg (iotexproject#3439)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants