Skip to content

Commit

Permalink
Add minor fixes:
Browse files Browse the repository at this point in the history
 - Add comments

 - Remove todo

Signed-off-by: grimadas <[email protected]>
  • Loading branch information
grimadas authored and lebdron committed Dec 19, 2017
1 parent 5ac8e15 commit f002975
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
5 changes: 2 additions & 3 deletions shared_model/interfaces/commands/add_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ namespace shared_model {
std::string toString() const override {
return detail::PrettyStringBuilder()
.init("AddPeer")
.append("peer_key", peerKey().toString())
.append(peerKey().toString())
.append("peer_address", peerAddress())
.finalize();
}

OldModelType *makeOldModel() const override {
auto oldModel = new iroha::model::AddPeer;
oldModel->address = peerAddress();
// TODO: check if this is right
oldModel->peer_key.from_string(peerKey().blob());
oldModel->peer_key.from_string(peerKey().makeOldModel()->blob());
return oldModel;
}
};
Expand Down
3 changes: 1 addition & 2 deletions shared_model/interfaces/commands/add_signatory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ namespace shared_model {

OldModelType *makeOldModel() const override {
auto oldModel = new iroha::model::AddSignatory;
// TODO: check if this is right
oldModel->pubkey.from_string(pubkey().blob());
oldModel->pubkey.from_string(pubkey().makeOldModel()->blob());
oldModel->account_id = accountId();
return oldModel;
}
Expand Down
5 changes: 2 additions & 3 deletions shared_model/interfaces/commands/create_account.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ namespace shared_model {
.init("CreateAccount")
.append("account_name", accountName())
.append("domain_id", domainId())
.append("pubkey", pubkey().toString())
.append(pubkey().toString())
.finalize();
}

OldModelType *makeOldModel() const override {
auto oldModel = new iroha::model::CreateAccount;
oldModel->account_name = accountName();
oldModel->domain_id = domainId();
// TODO: check if this is right
oldModel->pubkey.from_string(pubkey().blob());
oldModel->pubkey.from_string(pubkey().makeOldModel()->blob());
return oldModel;
}
};
Expand Down
13 changes: 4 additions & 9 deletions shared_model/interfaces/commands/create_role.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace shared_model {
* @return Id of the domain to create
*/
virtual const types::RoleIdType &roleName() const = 0;
/// Set of Permissions
/// Set of Permissions to insure the order for consistent hash
using PermissionsType = std::set<std::string>;
/**
* @return permissions associated with the role
Expand All @@ -44,17 +44,12 @@ namespace shared_model {

std::string toString() const override {
auto roles_set = rolePermissions();
std::string roles_accum =
std::accumulate(std::begin(roles_set),
std::end(roles_set),
std::string{},
[](const std::string &a, const std::string &b) {
return a.empty() ? b : a + ", " + b;
});
return detail::PrettyStringBuilder()
.init("CreateRole")
.append("role_name", roleName())
.append("Role_permissions", roles_accum)
.appendAll(roles_set, [](auto& role){
return role;
})
.finalize();
}

Expand Down
5 changes: 2 additions & 3 deletions shared_model/interfaces/commands/remove_signatory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ namespace shared_model {
return detail::PrettyStringBuilder()
.init("RemoveSignatory")
.append("account_id", accountId())
.append("pubkey", pubkey().toString())
.append(pubkey().toString())
.finalize();
}

OldModelType *makeOldModel() const override {
auto oldModel = new iroha::model::RemoveSignatory;
oldModel->account_id = accountId();
// TODO: check if this is right
oldModel->pubkey.from_string(pubkey().blob());
oldModel->pubkey.from_string(pubkey().makeOldModel()->blob());
return oldModel;
}
};
Expand Down

0 comments on commit f002975

Please sign in to comment.