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

new block with producer address #249

Merged

Conversation

CoderZhi
Copy link
Collaborator

No description provided.

@CoderZhi CoderZhi requested a review from a team as a code owner October 30, 2018 02:15
@@ -707,7 +707,7 @@ func (bc *blockchain) MintNewSecretBlock(
bc.mu.RLock()
defer bc.mu.RUnlock()

blk := NewSecretBlock(bc.config.Chain.ID, bc.tipHeight+1, bc.tipHash, bc.now(), secretProposals, secretWitness)
blk := NewSecretBlock(bc.config.Chain.ID, bc.tipHeight+1, bc.tipHash, bc.now(), producer.PublicKey, secretProposals, secretWitness)

Choose a reason for hiding this comment

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

line is 132 characters

@@ -250,7 +251,7 @@ func TestWrongNonce(t *testing.T) {
require.NoError(err)
require.NoError(action.Sign(tsf1, ta.Addrinfo["producer"].PrivateKey))
hash := tsf1.Hash()
blk := NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), []action.Action{coinbaseTsf, tsf1})
blk := NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, []action.Action{coinbaseTsf, tsf1})

Choose a reason for hiding this comment

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

line is 135 characters

@@ -265,7 +266,7 @@ func TestWrongNonce(t *testing.T) {
require.NoError(err)
require.NoError(action.Sign(tsf2, ta.Addrinfo["producer"].PrivateKey))
hash = tsf1.Hash()
blk = NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), []action.Action{coinbaseTsf, tsf1, tsf2})
blk = NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, []action.Action{coinbaseTsf, tsf1, tsf2})

Choose a reason for hiding this comment

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

line is 140 characters

@@ -275,7 +276,7 @@ func TestWrongNonce(t *testing.T) {
require.NoError(err)
require.NoError(action.Sign(vote, ta.Addrinfo["producer"].PrivateKey))
hash = tsf1.Hash()
blk = NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), []action.Action{coinbaseTsf, vote})
blk = NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, []action.Action{coinbaseTsf, vote})

Choose a reason for hiding this comment

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

line is 134 characters

@@ -290,7 +291,7 @@ func TestWrongNonce(t *testing.T) {
require.NoError(err)
require.NoError(action.Sign(tsf4, ta.Addrinfo["producer"].PrivateKey))
hash = tsf1.Hash()
blk = NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), []action.Action{coinbaseTsf, tsf3, tsf4})
blk = NewBlock(cfg.Chain.ID, 3, hash, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, []action.Action{coinbaseTsf, tsf3, tsf4})

Choose a reason for hiding this comment

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

line is 140 characters

moved, re = b.Flush(blk)
assert.Equal(false, moved)
assert.Equal(bCheckinLower, re)

blk = blockchain.NewBlock(uint32(123), uint64(5), hash.Hash32B{}, testutil.TimestampNow(), nil)
blk = blockchain.NewBlock(uint32(123), uint64(5), hash.Hash32B{}, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, nil)

Choose a reason for hiding this comment

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

line is 131 characters

moved, re = b.Flush(blk)
assert.Equal(false, moved)
assert.Equal(bCheckinValid, re)

blk = blockchain.NewBlock(uint32(123), uint64(5), hash.Hash32B{}, testutil.TimestampNow(), nil)
blk = blockchain.NewBlock(uint32(123), uint64(5), hash.Hash32B{}, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, nil)

Choose a reason for hiding this comment

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

line is 131 characters

moved, re = b.Flush(blk)
assert.Equal(false, moved)
assert.Equal(bCheckinExisting, re)

blk = blockchain.NewBlock(uint32(123), uint64(500), hash.Hash32B{}, testutil.TimestampNow(), nil)
blk = blockchain.NewBlock(uint32(123), uint64(500), hash.Hash32B{}, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, nil)

Choose a reason for hiding this comment

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

line is 133 characters

@@ -118,19 +118,19 @@ func TestBlockBufferGetBlocksIntervalsToSync(t *testing.T) {
require.Equal(uint64(1), out[0].Start)
require.Equal(uint64(10), out[0].End)

blk := blockchain.NewBlock(uint32(123), uint64(2), hash.Hash32B{}, testutil.TimestampNow(), nil)
blk := blockchain.NewBlock(uint32(123), uint64(2), hash.Hash32B{}, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, nil)

Choose a reason for hiding this comment

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

line is 132 characters

b.Flush(blk)
blk = blockchain.NewBlock(uint32(123), uint64(14), hash.Hash32B{}, testutil.TimestampNow(), nil)
blk = blockchain.NewBlock(uint32(123), uint64(14), hash.Hash32B{}, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, nil)

Choose a reason for hiding this comment

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

line is 132 characters

@CoderZhi CoderZhi force-pushed the new_block_with_producer_address branch from f082a2c to 5e16e59 Compare October 30, 2018 05:03
@@ -91,7 +91,7 @@ func TestNewBlockSyncer(t *testing.T) {
// TipHeight return ERROR
mBc.EXPECT().TipHeight().AnyTimes().Return(uint64(0))
mBc.EXPECT().ChainID().AnyTimes().Return(config.Default.Chain.ID)
blk := bc.NewBlock(uint32(123), uint64(0), hash.Hash32B{}, testutil.TimestampNow(), nil)
blk := bc.NewBlock(uint32(123), uint64(0), hash.Hash32B{}, testutil.TimestampNow(), ta.Addrinfo["producer"].PublicKey, nil)

Choose a reason for hiding this comment

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

line is 124 characters

@codecov
Copy link

codecov bot commented Oct 30, 2018

Codecov Report

Merging #249 into master will decrease coverage by 0.23%.
The diff coverage is 17.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #249      +/-   ##
==========================================
- Coverage   67.01%   66.78%   -0.24%     
==========================================
  Files         100      100              
  Lines        9640     9648       +8     
==========================================
- Hits         6460     6443      -17     
- Misses       2365     2388      +23     
- Partials      815      817       +2
Impacted Files Coverage Δ
blockchain/blockchain.go 56% <10%> (-1.1%) ⬇️
blockchain/block.go 74.35% <28.57%> (+0.51%) ⬆️
network/pinger.go 12.5% <0%> (-37.5%) ⬇️
network/healthchecker.go 50% <0%> (-16.67%) ⬇️
blockchain/evmstatedbadapter.go 68.21% <0%> (-4.64%) ⬇️

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 ae176a7...ef8d7cc. Read the comment docs.

@CoderZhi CoderZhi force-pushed the new_block_with_producer_address branch 2 times, most recently from 2dc535f to e92f3bd Compare October 30, 2018 05:14
Copy link
Contributor

@zjshen14 zjshen14 left a comment

Choose a reason for hiding this comment

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

Do you think it's better to use builder pattern for those structs that have a long list of params?

@CoderZhi CoderZhi force-pushed the new_block_with_producer_address branch from e92f3bd to ef8d7cc Compare October 30, 2018 18:41
@CoderZhi CoderZhi merged commit fa612ff into iotexproject:master Oct 30, 2018
@CoderZhi CoderZhi deleted the new_block_with_producer_address branch October 30, 2018 18:48
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