Skip to content

Add method to check the end of a term - #1544

Closed
foriequal0 wants to merge 1 commit into
CodeChain-io:masterfrom
foriequal0:feature/last-term-id
Closed

foriequal0 wants to merge 1 commit into
CodeChain-io:masterfrom
foriequal0:feature/last-term-id

Conversation

@foriequal0

@foriequal0 foriequal0 commented May 17, 2019 •

Copy link
Copy Markdown
Contributor

Depends on: #1537

@foriequal0
foriequal0 requested review from majecty and sgkim126 May 17, 2019 03:15
@foriequal0 foriequal0 changed the title Save last_term_end [WIP] Save last_term_end May 17, 2019
Comment thread core/src/client/mod.rs Outdated
@foriequal0
foriequal0 force-pushed the feature/last-term-id branch 2 times, most recently from 135d20c to a4cf28e Compare May 17, 2019 05:32
@foriequal0 foriequal0 changed the title [WIP] Save last_term_end Save last_term_end May 17, 2019
client.db().write_buffered(batch);
chain.commit();

self.check_term_end(block.header(), &chain, client);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This could make a problem.
In Tendermint Consensus, there will be proposal blocks which are executed but not finalized. Since the proposal blocks' timestamp will be different, some of it cause term end, and others do not cause term end. So the code, saving the "last term" to DB should not be called here. The code should be called when a block is finalized. And the finalization time would be "chain_notify".

@sgkim126 is handling a similar problem while implementing changing common params. Please check his work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, it can be a problem when the block is a proposal block or there is a reorganization.
https://github.com/CodeChain-io/codechain/blob/master/core/src/client/client.rs#L150
To handle it, I extracted new_blocks method on the client.
I'm considering this method to check the params.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

However, you need to change Importer::import_verified_blocks to stop when the current block is the end of a term.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I should change how the solo closes term. I think the solo should closes term still controllable manner (not non-deterministic time-based manner) but it is easily determined by just looking the header. Solo should closes term by block number base. The current manual trigger causes some problems. When the solo is configured with multiple nodes, they cannot agree when the term ends. and the differences between solo and the corgi make the problem harder such as how we deal with reorganization, when do we stop at on import_verified_blocks.

@foriequal0 foriequal0 changed the title Save last_term_end [WIP] Save last_term_end May 17, 2019
@foriequal0
foriequal0 force-pushed the feature/last-term-id branch from a4cf28e to 95ad0ef Compare May 21, 2019 03:15
@sgkim126 sgkim126 changed the title [WIP] Save last_term_end Add method to check the end of a term May 21, 2019
@sgkim126 sgkim126 added the wontfix This will not be worked on label Jun 4, 2019
@sgkim126

sgkim126 commented Jun 4, 2019

Copy link
Copy Markdown
Contributor

Let me close it. It's implemented in the other way.

@sgkim126 sgkim126 closed this Jun 4, 2019
@foriequal0
foriequal0 deleted the feature/last-term-id branch June 24, 2019 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consensus wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants