Skip to content

Commit

Permalink
Fix rebase issues.
Browse files Browse the repository at this point in the history
Signed-off-by: luckychess <[email protected]>
  • Loading branch information
luckychess authored and lebdron committed Dec 19, 2017
1 parent adbf4a6 commit 6754267
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
5 changes: 3 additions & 2 deletions shared_model/backend/protobuf/queries/proto_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ namespace shared_model {
return *signatures_;
}

bool addSignature(const SignatureType &signature) override {
bool addSignature(
const interface::types::SignatureType &signature) override {
if (proto_->has_signature()) return false;

auto sig = proto_->mutable_signature();
Expand All @@ -119,7 +120,7 @@ namespace shared_model {
return true;
}

TimestampType createdTime() const override {
interface::types::TimestampType createdTime() const override {
return proto_->payload().created_time();
}

Expand Down
2 changes: 1 addition & 1 deletion shared_model/bindings/bindings.i
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
%include "cryptography/keypair.hpp"
%include "cryptography/signed.hpp"
%include "backend/protobuf/transaction.hpp"
%include "builders/protobuf/proto_transaction_builder.hpp"
%include "builders/protobuf/transaction.hpp"
%include "builders/protobuf/unsigned_proto.hpp"
%include "bindings/model_builder.hpp"
%include "bindings/model_crypto.hpp"
Expand Down
2 changes: 1 addition & 1 deletion shared_model/bindings/model_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace shared_model {
const interface::types::AccountIdType &account_id,
const interface::types::AssetIdType &asset_id,
const std::string &amount) {
return builder_.addAssetQuantity(account_id, asset_id, amount);
return builder_.assetQuantity(account_id, asset_id, amount);
}

proto::UnsignedWrapper<proto::Transaction> SimpleBuilder::build() {
Expand Down
2 changes: 1 addition & 1 deletion shared_model/bindings/model_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef IROHA_SIMPLE_BUILDER_HPP
#define IROHA_SIMPLE_BUILDER_HPP

#include "builders/protobuf/proto_transaction_builder.hpp"
#include "builders/protobuf/transaction.hpp"
#include "builders/protobuf/unsigned_proto.hpp"

namespace shared_model {
Expand Down
2 changes: 1 addition & 1 deletion shared_model/bindings/model_transaction_proto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef IROHA_SIMPLE_TRANSACTION_PROTO_HPP
#define IROHA_SIMPLE_TRANSACTION_PROTO_HPP

#include "builders/protobuf/proto_transaction_builder.hpp"
#include "builders/protobuf/transaction.hpp"
#include "builders/protobuf/unsigned_proto.hpp"
#include "cryptography/blob.hpp"

Expand Down
Empty file.
10 changes: 7 additions & 3 deletions shared_model/builders/protobuf/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "amount/amount.hpp"
#include "builders/protobuf/helpers.hpp"
#include "builders/protobuf/unsigned_proto.hpp"
#include "interfaces/common_objects/types.hpp"

namespace shared_model {
Expand Down Expand Up @@ -163,14 +164,17 @@ namespace shared_model {
return *this;
}

Transaction build() {
UnsignedWrapper<Transaction> build() {
static_assert(S == (1 << TOTAL) - 1, "Required fields are not set");

return Transaction(iroha::protocol::Transaction(transaction_));
return UnsignedWrapper<Transaction>(
Transaction(std::move(transaction_)));
}

static const int total = RequiredFields::TOTAL;

private:
auto proto_command() {
iroha::protocol::Command *proto_command() {
return transaction_.mutable_payload()->add_commands();
}
};
Expand Down
1 change: 1 addition & 0 deletions shared_model/builders/protobuf/unsigned_proto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "backend/protobuf/common_objects/signature.hpp"
#include "cryptography/crypto_provider/crypto_signer.hpp"
#include "cryptography/keypair.hpp"
#include "interfaces/polymorphic_wrapper.hpp"

namespace shared_model {
namespace proto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
*/

#include "backend/protobuf/transaction.hpp"
#include "builders/protobuf/proto_transaction_builder.hpp"
#include "builders/protobuf/transaction.hpp"
#include "cryptography/crypto_provider/crypto_signer.hpp"
#include "cryptography/ed25519_sha3_impl/crypto_provider.hpp"
#include "interfaces/polymorphic_wrapper.hpp"
#include "builders/protobuf/transaction.hpp"

#include <gtest/gtest.h>

Expand Down Expand Up @@ -75,7 +74,7 @@ TEST(ProtoTransaction, Builder) {
.build();

auto signedTx = tx.signAndAddSignature(keypair);
auto &proto = tx.getTransport();
auto &proto = signedTx.getTransport();

ASSERT_EQ(proto_tx.SerializeAsString(), proto.SerializeAsString());
}

0 comments on commit 6754267

Please sign in to comment.