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

Feature/oneof block #1893

Merged
merged 6 commits into from
Dec 3, 2018
Merged

Feature/oneof block #1893

merged 6 commits into from
Dec 3, 2018

Conversation

kamilsa
Copy link
Contributor

@kamilsa kamilsa commented Nov 29, 2018

Description of the Change

Before it was:

message Block {
  // block_v1 fields
}

From now on it will be

message Block_v1 {
// block_v1 fields
}

message Block {
  oneof block_version {
    Block_v1 block_v1 = 1;
  }
}

Such changes would allow us to introduce Block_v2 and further versions, by simply adding them to oneof in Block message. Internally we will be able to recognize and manage different version of the blocks.

Benefits

Iroha will be able to process different versions of the blocks.

Possible Drawbacks

Format of genesis block is changing. So if you used old iroha, you will not be able to use old block store

Signed-off-by: kamilsa <[email protected]>
Signed-off-by: kamilsa <[email protected]>
@Warchant
Copy link
Contributor

Another drawback is legacy for new networks :(

@@ -27,3 +27,9 @@ message Block {
Payload payload = 1;
repeated Signature signatures = 2;
}

message Block {
oneof block_version {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe stay just version here?

@@ -17,13 +17,14 @@

#include <gflags/gflags.h>
#include <rapidjson/istreamwrapper.h>
#include <rapidjson/rapidjson.h>
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 not removing this include, even if it works without it, because we directly create and use rapidjson::Document in this file.

},
[&logger](const auto &error) {
// should not get here
logger->error("error while parsing serializing genesis block");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger->error("error while parsing serializing genesis block");
logger->error("error while parsing serialized genesis block: " + error.error);

@kamilsa kamilsa changed the base branch from dev to trunk/block-oneof December 3, 2018 09:23
@kamilsa kamilsa merged commit 13e7bc3 into trunk/block-oneof Dec 3, 2018
@kamilsa kamilsa deleted the feature/oneof_block branch December 3, 2018 09:23
@kamilsa kamilsa mentioned this pull request Dec 5, 2018
kamilsa added a commit that referenced this pull request Dec 12, 2018
* Add oneof to the block

Signed-off-by: kamilsa <[email protected]>
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