Skip to content

Commit

Permalink
Replace signature with signatures (hyperledger-iroha#1203)
Browse files Browse the repository at this point in the history
Signed-off-by: Dumitru <[email protected]>
  • Loading branch information
x3medima17 authored Apr 11, 2018
1 parent 8e3944f commit ebcf06d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions irohad/model/converters/impl/pb_transaction_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace iroha {
}

for (const auto &sig_obj : tx.signatures) {
auto proto_signature = pbtx.add_signature();
auto proto_signature = pbtx.add_signatures();
proto_signature->set_pubkey(sig_obj.pubkey.to_string());
proto_signature->set_signature(sig_obj.signature.to_string());
}
Expand All @@ -60,7 +60,7 @@ namespace iroha {
tx.creator_account_id = pl.creator_account_id();
tx.created_ts = pl.created_time();

for (const auto &pb_sig : pb_tx.signature()) {
for (const auto &pb_sig : pb_tx.signatures()) {
model::Signature sig{};
sig.pubkey = pubkey_t::from_string(pb_sig.pubkey());
sig.signature = sig_t::from_string(pb_sig.signature());
Expand Down
2 changes: 1 addition & 1 deletion schema/block.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ message Header {
}

Payload payload = 1;
repeated Signature signature = 2;
repeated Signature signatures = 2;
}

message Block {
Expand Down
4 changes: 2 additions & 2 deletions shared_model/backend/protobuf/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace shared_model {
return false;
}

auto sig = proto_->add_signature();
auto sig = proto_->add_signatures();
sig->set_signature(crypto::toBinaryString(signed_blob));
sig->set_pubkey(crypto::toBinaryString(public_key));

Expand Down Expand Up @@ -119,7 +119,7 @@ namespace shared_model {
[this] { return makeBlob(payload_); }};

const Lazy<interface::SignatureSetType> signatures_{[this] {
return boost::accumulate(proto_->signature(),
return boost::accumulate(proto_->signatures(),
interface::SignatureSetType{},
[](auto &&acc, const auto &sig) {
acc.emplace(new Signature(sig));
Expand Down
4 changes: 2 additions & 2 deletions test/integration/acceptance/invalid_fields_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST_F(InvalidField, Signature) {
.signAndAddSignature(kAdminKeypair)
.getTransport();
// extend signature to invalid size
auto sig = tx.mutable_signature(0)->mutable_signature();
auto sig = tx.mutable_signatures(0)->mutable_signature();
sig->resize(sig->size() + 1, 'a');
auto check = [](auto &resp) {
ASSERT_TRUE(boost::apply_visitor(
Expand Down Expand Up @@ -82,7 +82,7 @@ TEST_F(InvalidField, Pubkey) {
.signAndAddSignature(kAdminKeypair)
.getTransport();
// extend public key to invalid size
auto pkey = tx.mutable_signature(0)->mutable_pubkey();
auto pkey = tx.mutable_signatures(0)->mutable_pubkey();
pkey->resize(pkey->size() + 1, 'a');
auto check = [](auto &resp) {
ASSERT_TRUE(boost::apply_visitor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST(ProtoTransaction, Builder) {
shared_model::crypto::Blob(proto_tx.payload().SerializeAsString()),
keypair);

auto sig = proto_tx.add_signature();
auto sig = proto_tx.add_signatures();
sig->set_pubkey(shared_model::crypto::toBinaryString(keypair.publicKey()));
sig->set_signature(shared_model::crypto::toBinaryString(signedProto));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ TEST_F(FieldValidatorTest, CommandFieldsValidation) {
*/
TEST_F(FieldValidatorTest, TransactionFieldsValidation) {
iroha::protocol::Transaction proto_tx;
proto_tx.add_signature(); // at least one signature in message
proto_tx.add_signatures(); // at least one signature in message

// iterate over all fields in transaction
iterateContainer(
Expand Down

0 comments on commit ebcf06d

Please sign in to comment.