Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

SynchronizationEvent: removed blocks observable #2212

Merged
merged 12 commits into from
Apr 11, 2019

Conversation

MBoldyrev
Copy link
Contributor

Description of the Change

It is not needed anymore.

Benefits

Performance. Deduplication.

Possible Drawbacks

Less ways to see the blocks.

Usage Examples or Tests [optional]

Alternate Designs [optional]

@MBoldyrev MBoldyrev added the needs-review pr awaits review from maintainers label Apr 5, 2019
@MBoldyrev MBoldyrev self-assigned this Apr 5, 2019
@MBoldyrev MBoldyrev requested a review from muratovv April 9, 2019 04:46
@@ -70,6 +72,7 @@ namespace iroha {
block->height(),
block->hash().hex());

// TODO add height check to predicate
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls, leave a task number for the TODO.

: ledger_peers(std::move(peers)) {}
LedgerState(std::shared_ptr<PeerList> peers,
shared_model::interface::types::HeightType height)
: ledger_peers(std::move(peers)), height(height) {}
LedgerState() = default;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest removing default ctor because it doesn't have a case in irohad.

Copy link
Contributor

@igor-egorov igor-egorov left a comment

Choose a reason for hiding this comment

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

Looks good.
I tested synchronization on rejects - works.
Nothing seems to be broken.

🤞 🌐 👉 👷

Igor Egorov and others added 2 commits April 9, 2019 14:28
@MBoldyrev MBoldyrev force-pushed the feature/sync-event-without-blocks branch from a7e6167 to b5d51e4 Compare April 9, 2019 11:58
Signed-off-by: Mikhail Boldyrev <[email protected]>
@MBoldyrev MBoldyrev force-pushed the feature/sync-event-without-blocks branch from b5d51e4 to 61b925c Compare April 9, 2019 12:10
if (ledger_state) {
new_height = (*ledger_state)->height;
} else {
const auto opt_new_height = getTopBlockHeight();
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be simpler to assume that a missing ledger state is a fatal error at the moment.

: alternative_outcome,
higher_than_expected ? consensus::Round{new_height, 0} : msg.round,
ledger_state ? std::move(*ledger_state)
: std::unique_ptr<LedgerState>{}});
Copy link
Contributor

Choose a reason for hiding this comment

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

And to ensure that this pointer is never nullptr.


namespace iroha {
using PeerList = std::vector<std::shared_ptr<shared_model::interface::Peer>>;

struct LedgerState {
std::shared_ptr<PeerList> ledger_peers;
shared_model::interface::types::HeightType height;
Copy link
Contributor

Choose a reason for hiding this comment

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

Top hash can be added here.

@@ -79,6 +82,7 @@ namespace iroha {
block_index_->index(*block);

top_hash_ = block->hash();
top_height_ = block->height();
Copy link
Contributor

Choose a reason for hiding this comment

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

Top ledger peers can be added here, and used in chainvalidator instead of peerquery.

return boost::optional<std::unique_ptr<LedgerState>>(
std::make_unique<LedgerState>(
std::make_shared<PeerList>(std::move(peers))));
std::make_shared<PeerList>(std::move(peers)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Top peers list from mutablestorage can be queried here.

…eature/sync-event-without-blocks

Signed-off-by: Mikhail Boldyrev <[email protected]>
…into feature/sync-event-without-blocks

Signed-off-by: Mikhail Boldyrev <[email protected]>
@MBoldyrev MBoldyrev force-pushed the feature/sync-event-without-blocks branch from 3aef52d to 463e09e Compare April 11, 2019 13:53
@MBoldyrev MBoldyrev merged commit 718fafa into develop Apr 11, 2019
@MBoldyrev MBoldyrev deleted the feature/sync-event-without-blocks branch April 11, 2019 16:45
@lebdron lebdron removed the needs-review pr awaits review from maintainers label Apr 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants