Giter VIP home page Giter VIP logo

iroha's Introduction

Welcome!

What is Hyperledger Iroha?

License CII Best Practices Build Status Throughput Graph

Iroha is a straightforward distributed ledger technology (DLT), inspired by Japanese Kaizen principle — eliminate excessiveness (muri). Iroha has essential functionality for your asset, information and identity management needs, at the same time being an efficient and trustworthy byzantine fault-tolerant tool for your enterprise needs.

Check the overview page of our documentation. Here is a YouTube channel where we upload meetings and explanatory videos - check them out!

Iroha logo

Iroha has the following features:

  1. Creation and management of custom fungible assets, such as currencies, kilos of gold, etc.
  2. Management of user accounts
  3. Taxonomy of accounts based on domains in the system
  4. The system of rights and verification of user permissions for the execution of transactions and queries in the system
  5. Validation of business rules for transactions and queries in the system
  6. Multisignature transactions

Iroha is Byzantine Fault Tolerant and has its own consensus algorithm - YAC

Documentation

Our documentation is hosted at ReadTheDocs service here: http://iroha.readthedocs.io. We have documentation in several languages available and you are welcome to contribute on POEditor website!

How to explore Iroha really fast?

Check getting started section in your version of localized docs to start exploring the system.

How to build Iroha?

Use build guide, which might be helpful if you want to modify the code and contribute.

Is there SDK available?

Yes, in Java, Python, Javascript and iOS.

Are there any example applications?

Android point app and JavaScript wallet.

Want to help us develop Iroha?

That's great! Check out this document

Need help?

  • Join Telegram chat or Hyperledger RocketChat where the maintainers, contributors and fellow users are ready to help you. You can also discuss your concerns and proposals and simply chat about Iroha there or in Gitter Join the chat at https://gitter.im/hyperledger-iroha/Lobby
  • Submit issues and improvement suggestions via Hyperledger Jira
  • Subscribe to our mailing list to receive the latest and most important news and spread your word within Iroha community

License

Iroha codebase is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Iroha documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/

iroha's People

Contributors

a-r-g-v avatar akvinikym avatar alexey-n-chernyshov avatar bakhtin avatar bulatsaif avatar cimadai avatar grimadas avatar igor-egorov avatar kamilsa avatar l4l avatar lasintez avatar lebdron avatar liralemur avatar luckychess avatar mboldyrev avatar mitsutaka-takeda avatar mizukisonoko avatar motxx avatar muratovv avatar neewy avatar nickaleks avatar satellitex avatar solonets avatar stayer avatar takemiyamakoto avatar tkyonezu avatar tyvision avatar vdrobnyi avatar warchant avatar x3medima17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iroha's Issues

Iroha cpu usage issue

I am trying to run iroha using the following config:

{
  "me":{
    "ip":"127.0.0.1",
    "name":"iroha1",
    "publicKey":"jDQTiJ1dnTSdGH+yuOaPPZIepUj1Xt3hYOvLQTME3V0=",
    "privateKey":"iJy2wzgM0Ffmur2xDNlnhYK7CiAYZoup/045JXJTbUzuE9c6HeUIf7hoqtppEsZQncC1EEw+gGhboLcbMNKadw=="
  },
  "group":[
    {
    "ip":"127.0.0.1",
    "name":"iroha1",
    "publicKey":"jDQTiJ1dnTSdGH+yuOaPPZIepUj1Xt3hYOvLQTME3V0=",
    "privateKey":"iJy2wzgM0Ffmur2xDNlnhYK7CiAYZoup/045JXJTbUzuE9c6HeUIf7hoqtppEsZQncC1EEw+gGhboLcbMNKadw=="
  }
  ]
}

but whenever I start iroha using ./iroha-main it start consuming 100% cpu. I tried to look into the code and it seems that sumeragi is running in an infinite loop .

Any help on how to resolve this ?

Cannot load shared libraries libleveldb.so.1 via JNI in CircleCI

In feature/api branch, I created test file java_vm_test, which calls java function of test/smart_contract/Test/Test.java. Test.java loads libDomainRepository.so and calls C++ function by using JNI. Then, it accesses leveldb database. In my local environment, java_vm_test worked correctly, but in docker in CircleCI, an error such as the following occurred:

/usr/local/iroha/test_bin/java_vm_test: error while loading shared libraries: libleveldb.so.1: cannot open shared object file: No such file or directory

Do you have any good solutions?

Tests segfaults

cmake 3.7.2, clang 3.9.1, libprotoc 3.0.0 (old version from AUR), archlinux
build command:

$ cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DTESTING=ON && make -j12
$ ctest
Test project /home/kitsu/dev/Work/iroha/build
      Start  1: hash_test
 1/18 Test  #1: hash_test ...........................   Passed    0.99 sec
      Start  2: base64_test
 2/18 Test  #2: base64_test .........................   Passed    0.01 sec
      Start  3: signature_test
 3/18 Test  #3: signature_test ......................   Passed    0.01 sec
      Start  4: java_query_repo_invocation_test
 4/18 Test  #4: java_query_repo_invocation_test .....   Passed    0.07 sec
      Start  5: java_query_repo_account_test
 5/18 Test  #5: java_query_repo_account_test ........   Passed    0.08 sec
      Start  6: java_query_repo_asset_test
 6/18 Test  #6: java_query_repo_asset_test ..........   Passed    0.11 sec
      Start  7: java_query_repo_simple_asset_test
 7/18 Test  #7: java_query_repo_simple_asset_test ...   Passed    0.09 sec
      Start  8: java_query_repo_domain_test
 8/18 Test  #8: java_query_repo_domain_test .........   Passed    0.07 sec
      Start  9: java_query_repo_peer_test
 9/18 Test  #9: java_query_repo_peer_test ...........   Passed    0.09 sec
      Start 10: config_test
10/18 Test #10: config_test .........................   Passed    0.01 sec
      Start 11: http_client_test
11/18 Test #11: http_client_test ....................   Passed    0.01 sec
      Start 12: ensure_sumeragi_json_format_test
12/18 Test #12: ensure_sumeragi_json_format_test ....   Passed    0.08 sec
      Start 13: peer_service_with_json_test
13/18 Test #13: peer_service_with_json_test .........***Exception: SegFault  0.04 sec
      Start 14: java_data_structure_test
14/18 Test #14: java_data_structure_test ............   Passed    0.06 sec
      Start 15: thread_pool_test
15/18 Test #15: thread_pool_test ....................   Passed    1.10 sec
      Start 16: json_test
16/18 Test #16: json_test ...........................   Passed    0.00 sec
      Start 17: connection_grpc_test
17/18 Test #17: connection_grpc_test ................***Exception: SegFault  0.06 sec
      Start 18: transaction_builder_test
18/18 Test #18: transaction_builder_test ............   Passed    0.01 sec

89% tests passed, 2 tests failed out of 18

Total Test time (real) =   2.91 sec

The following tests FAILED:
         13 - peer_service_with_json_test (SEGFAULT)
         17 - connection_grpc_test (SEGFAULT)
Errors while running CTest

valgrind log # 1
valgrind log # 2

docker run mode problem

when I run iroha in docker mode, encounter followed problems:
1、
[root@bwsvr04 iroha]# docker-compose up
Creating configdiscovery
Creating iroha_iroha3_1
Creating iroha_iroha2_1
Creating iroha_iroha4_1
Creating iroha_iroha1_1
Attaching to configdiscovery, iroha_iroha3_1, iroha_iroha2_1, iroha_iroha4_1, iroha_iroha1_1
iroha3_1 | /configure.sh: line 3: /usr/local/iroha/bin/make_sumeragi: No such file or directory
iroha2_1 | /configure.sh: line 3: /usr/local/iroha/bin/make_sumeragi: No such file or directory
iroha3_1 | [FAILED][configure.sh]
iroha2_1 | [FAILED][configure.sh]
iroha3_1 | env: '/usr/local/iroha/bin/iroha-main': No such file or directory
iroha2_1 | env: '/usr/local/iroha/bin/iroha-main': No such file or directory
iroha4_1 | /configure.sh: line 3: /usr/local/iroha/bin/make_sumeragi: No such file or directory
iroha4_1 | [FAILED][configure.sh]
iroha1_1 | /configure.sh: line 3: /usr/local/iroha/bin/make_sumeragi: No such file or directory
iroha4_1 | env: '/usr/local/iroha/bin/iroha-main': No such file or directory
iroha_iroha2_1 exited with code 127
iroha1_1 | [FAILED][configure.sh]
iroha1_1 | env: '/usr/local/iroha/bin/iroha-main': No such file or directory
iroha_iroha4_1 exited with code 127
iroha_iroha3_1 exited with code 127
iroha_iroha1_1 exited with code 127

2、I unzip the docker/build/iroha.tar, the directories as followes:
total 32
drwxr-xr-x 2 root root 4096 Jan 11 00:16 bin
drwxr-xr-x 2 root root 4096 Dec 14 04:23 etc
drwxr-xr-x 2 root root 4096 Dec 14 04:23 games
drwxr-xr-x 4 root root 4096 Jan 11 00:16 include
drwxr-xr-x 5 root root 4096 Jan 11 00:16 lib
lrwxrwxrwx 1 root root 9 Dec 14 04:23 man -> share/man
drwxr-xr-x 2 root root 4096 Dec 14 04:23 sbin
drwxr-xr-x 8 root root 4096 Jan 11 00:16 share
drwxr-xr-x 2 root root 4096 Dec 14 04:23 src

Create docker image

It would be good to have docker images to make it easier for devs who use that for their environment.

If we use grpc, flatbuffer protocol

namespace iroha;

attribute "priority";

table BaseObject{
   text: string;
   integer: int;
   boolean: bool;
   list: [BaseObject];
   key: string (required);
}

table SimpleAsset{
  name:   string;
  domain: Domain (required);

  object: BaseObject;

  smartContractName: string;
}
table Asset{
  name:   string;
  domain: Domain (required);

  objects: [BaseObject];

  smartContractName: string;
}

table Domain{
  ownerPublicKey: string;
  name: string;
}
table Account{
  publicKey: string;
  Assets: [Asset];
}
table Peer{
  publicKey: string;
  address: string;
}
union Object  { SimpleAsset, Asset, Domain, Account, Peer }

union Command { Add, Transfer, Update, Remove, Batch, Unbatch, Contract }

table Add{
  object: Object (required);
}
table Transfer{
  receiver: string (required);
  object:   Object (required);
}
table Update{
  object: Object (required);
}
table Remove{
  object: Object (required);
}
table Batch{
  alias: string (required);
  // This is bad... and I should write it, because
  // vector of union types not supported (wrap in table first).
  // I want to write commands: [Command];
  commands: [string];
}
table Unbatch{
  alias: string (required);
}
table Contract{
  object:        Object (required);
  command:       string;
  contractName:  string (required);
}

table TxSignature {
  publicKey: string (required);
  signature: string (required);
}
table Transaction {
  sender:   string (required);
  command: Command (required);
  txSignatures: [TxSignature] (required);
  hash:                string (required);
}

enum State : byte { Undetermined, Commited }
table EventSignature {
  publicKey: string (required);
  signature: string (required);
}
table ConsensusEvent{
  transaction: [Transaction] (required);
  eventSignatures: [EventSignature];
  state: State;
}

table Response{
  status: int;
  message: string;
}
rpc_service Iroha {
  Torii(ConsensusEvent): Response (streaming: "none");
}

root_type ConsensusEvent;

undefined reference to `SHA3_512(unsigned char*, unsigned char const*, unsigned long)'

g++  -L/usr/lib   -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded  -std=c++11 -L../vendor/KeccakCodePackage/bin/generic64 -Wl,-ukeccak -lkeccak -I../vendor/KeccakCodePackage/bin/generic64/libkeccak.a.headers ../vendor/KeccakCodePackage/bin/.build/generic64/libkeccak.a/KeccakP-1600-opt64.o  hash.cpp unit.cpp
/tmp/cc6PSSyS.o: In function `hash::sha3_256_hex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
hash.cpp:(.text+0x9b): undefined reference to `SHA3_256(unsigned char*, unsigned char const*, unsigned long)'
/tmp/cc6PSSyS.o: In function `hash::sha3_512_hex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
hash.cpp:(.text+0x26f): undefined reference to `SHA3_512(unsigned char*, unsigned char const*, unsigned long)'
collect2: error: ld returned 1 exit status

SEGFAULT in processTransaction

Commit: 6103029

I started a single iroha-main node, sent this request:

bogdan@private ~ $ curl -X POST http://127.0.0.1:1204/account/register -d '{"publicKey":"WdvM/DPabapmtA7ISbTYPywbHxk8gWu2221LzmcmAgw=","alias":"yonezu","timestamp":1482053586}'
{"message":"successful","status":200,"uuid":"1b3cafcf870b43c74f5d918a180b27c896e9f08a29b73911d402d1dae6e90b6e"}
bogdan@private ~ $

Output of iroha:

1483681475 INFO [main] process is :32173
1483681475 INFO [peer with json] load json is {
  "me":{
    "ip":"127.0.0.1",
    "name":"bogdan",
    "publicKey":"Sht5opDIxbyK+oNuEnXUs5rLbrvVgb2GjSPfqIYGFdU=",
    "privateKey":"aGIuSZRhnGfFyeoKNm/NbTylnAvRfMu3KumOEfyT2HPf36jSF22m2JXWrdCmKiDoshVqjFtZPX3WXaNuo9L8WA=="
  },
  "group":[
    {
      "ip":"127.0.0.1",
      "name":"bogdan",
      "publicKey":"Sht5opDIxbyK+oNuEnXUs5rLbrvVgb2GjSPfqIYGFdU="
    }
  ]
}

1483681475[sumeragi] +==ーーーーーーーーー==+
1483681475[sumeragi] |+-ーーーーーーーーー-+|
1483681475[sumeragi] ||           ||
1483681475[sumeragi] || いろは合意形成機構 ||
1483681475[sumeragi] ||    すめらぎ   ||
1483681475[sumeragi] ||           ||
1483681475[sumeragi] |+-ーーーーーーーーー-+|
1483681475[sumeragi] +==ーーーーーーーーー==+
1483681475[sumeragi] - 起動/setup
1483681475[sumeragi] - 初期設定/initialize
1483681475 INFO [sumeragi] My key is 127.0.0.1
1483681475 INFO [sumeragi] Sumeragi setted
1483681475 INFO [sumeragi] set number of validatingPeer
1483681475 INFO [sumeragi] initialize numValidatingPeers :1
1483681475 INFO [sumeragi] initialize maxFaulty :0
1483681475 INFO [sumeragi] initialize proxyTailNdx :0
1483681475 INFO [sumeragi] initialize panicCount :0
1483681475 INFO [sumeragi] initialize myPublicKey :Sht5opDIxbyK+oNuEnXUs5rLbrvVgb2GjSPfqIYGFdU=
1483681475 INFO [sumeragi] initialize is sumeragi :1
1483681475 INFO [sumeragi] initialize.....  complete!
1483681475 INFO [server] initialize server!
1483681475 INFO [server] start server!
1483681479 INFO [WorldStateRepositoryWithLeveldb] NotFound: 
1483681479 INFO [WorldStateRepositoryWithLeveldb] NotFound: 
1483681479 DEBUG [AccountRepository]  data:
1483681479 INFO [connection] start send
1483681479 INFO [connection] create client
1483681479 INFO [connection] invoke client Operation
1483681479 INFO [connection] size 0
1483681479 INFO [connection] Operation
1483681479 INFO [connection] size: 0
1483681479 INFO [connection] name: 
1483681479 INFO [connection] size: 0
1483681479 INFO [sumeragi] receive!
1483681479 INFO [sumeragi] received message! sig:[0]
1483681479 INFO [connection] response:OK
1483681644 INFO [sumeragi] processTransaction
1483681644 INFO [sumeragi] valied
1483681645 INFO [sumeragi] Add my signature...

Fails on this line: https://github.com/hyperledger/iroha/blob/master/core/consensus/sumeragi.cpp#L272 with segmentation fault.

Debugging says:

event.transaction() = Couldn't find method Event::ConsensusEvent::transaction

questions for in using iroha

1、when run : docker-compose up, result follow
[root@bwsvr04 iroha]# docker-compose up
Creating configdiscovery
Creating iroha_iroha2_1
Creating iroha_iroha4_1
Creating iroha_iroha1_1
Creating iroha_iroha3_1
Attaching to configdiscovery, iroha_iroha2_1, iroha_iroha4_1, iroha_iroha1_1, iroha_iroha3_1
configdiscovery |
configdiscovery | Use this script to generate configs for any number of nodes.
configdiscovery |
configdiscovery | It creates a TCP server with N threads (you must explicitly specify N),
configdiscovery | each receives output of make_sumeragi program and after receiving of N
configdiscovery | configs, it generates and sends sumeragi.json for each node separately.
configdiscovery |
configdiscovery | On server (assume it has IP 192.168.48.10):
configdiscovery | python3 config-server.py 4
configdiscovery |
configdiscovery | On each node:
configdiscovery | make_sumeragi -i eth0 -n name -o out.txt
configdiscovery | cat out.txt | nc 192.168.48.10 8000 > sumeragi.json
configdiscovery |
configdiscovery | [+] Waiting for 4 configs
configdiscovery | [+] Got connection from ('192.168.48.3', 54630)
configdiscovery | [+] Got connection from ('192.168.48.4', 34734)
configdiscovery | [+] Got connection from ('192.168.48.5', 58770)
configdiscovery | [+] Got connection from ('192.168.48.6', 55344)
iroha4_1 | set peer name: 722fe545c9ae
iroha4_1 | IP: 192.168.48.4
iroha2_1 | set peer name: 6903cf2ec637
iroha2_1 | IP: 192.168.48.3
iroha4_1 | {
iroha1_1 | set peer name: 3856d9411a96
iroha4_1 | "ip": "192.168.48.4",
iroha1_1 | IP: 192.168.48.5
iroha2_1 | {
iroha2_1 | "ip": "192.168.48.3",
iroha4_1 | "name": "722fe545c9ae",
iroha4_1 | "privateKey": "+ODIVspUEWzHU7oIKcD+8ImHuMSyx8OcZhfjAhhmw3zDCQI5Bxe7gKImRcOEfRBlGInH87ck65l8BnRd73hpjw==",
iroha4_1 | "publicKey": "SGxkkfiD/SlEJ21nCghlQviLhs19jMyF8yXFcpYsq2c="
iroha4_1 | }
iroha1_1 | {
iroha1_1 | "ip": "192.168.48.5",
iroha1_1 | "name": "3856d9411a96",
iroha1_1 | "privateKey": "MPbMgL45GIm92umnUHGcIKTP/vIKeig5Ah7XG6WtMUAMGuruZn8LmkBPpSEb9Dc+JWw6DDeiIqC8NS9Jc8l2zA==",
iroha1_1 | "publicKey": "PlbUSr9dJpj78umugI9yhXXoM456IoJSRG3uPM5OsFE="
iroha1_1 | }
iroha4_1 | ============
iroha1_1 | ============
iroha1_1 | output: /tmp/me.json
iroha4_1 | output: /tmp/me.json
iroha3_1 | set peer name: 4586b134e576
iroha3_1 | IP: 192.168.48.6
iroha3_1 | {
iroha3_1 | "ip": "192.168.48.6",
iroha3_1 | "name": "4586b134e576",
iroha3_1 | "privateKey": "oGJLzcppzY6x3y9FLSlSpP6aBcWBej2nUHsMzC1I/lskCy2xiSAXGB7EU2xYsQU8V6w6400e1xr7M+zdeSbkrw==",
iroha3_1 | "publicKey": "/0H/nO+6ocX4LH0DtXzo5on+LGOHbWzXymyRaY6adpo="
iroha3_1 | }
iroha3_1 | ============
iroha3_1 | output: /tmp/me.json
iroha2_1 | "name": "6903cf2ec637",
iroha2_1 | "privateKey": "2GmiZzG/XFdXFTG0qUhC48/YL6jU/0p/GhXW3yk3QEx1nvwNhj+1JmjZl5V52Pmag2g3+A2+ptJ8UUROfvVeIQ==",
iroha2_1 | "publicKey": "GaYztYBESiaFp3uGs8tpJYMywYKszkBRAwGZX9KF2tw="
iroha2_1 | }
iroha2_1 | ============
iroha2_1 | output: /tmp/me.json
iroha2_1 | 1484269086 INFO [main] process is :15
iroha2_1 | 1484269086 INFO [peer with json] load json is {"me": {"ip": "192.168.48.3", "name": "6903cf2ec637", "privateKey": "2GmiZzG/XFdXFTG0qUhC48/YL6jU/0p/GhXW3yk3QEx1nvwNhj+1JmjZl5V52Pmag2g3+A2+ptJ8UUROfvVeIQ==", "publicKey": "GaYztYBESiaFp3uGs8tpJYMywYKszkBRAwGZX9KF2tw="}, "group": [{"ip": "192.168.48.3", "name": "6903cf2ec637", "publicKey": "GaYztYBESiaFp3uGs8tpJYMywYKszkBRAwGZX9KF2tw="}, {"ip": "192.168.48.4", "name": "722fe545c9ae", "publicKey": "SGxkkfiD/SlEJ21nCghlQviLhs19jMyF8yXFcpYsq2c="}, {"ip": "192.168.48.5", "name": "3856d9411a96", "publicKey": "PlbUSr9dJpj78umugI9yhXXoM456IoJSRG3uPM5OsFE="}, {"ip": "192.168.48.6", "name": "4586b134e576", "publicKey": "/0H/nO+6ocX4LH0DtXzo5on+LGOHbWzXymyRaY6adpo="}]}
iroha2_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha2_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha2_1 | 1484269086[sumeragi] ||           ||
iroha2_1 | 1484269086[sumeragi] || いろは合意形成機構 ||
iroha2_1 | 1484269086[sumeragi] ||    すめらぎ   ||
iroha2_1 | 1484269086[sumeragi] ||           ||
iroha2_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha2_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha2_1 | 1484269086[sumeragi] - 起動/setup
iroha2_1 | 1484269086[sumeragi] - 初期設定/initialize
iroha2_1 | 1484269086 INFO [sumeragi] My key is 192.168.48.3
iroha2_1 | 1484269086 INFO [sumeragi] Sumeragi setted
iroha2_1 | 1484269086 INFO [sumeragi] set number of validatingPeer
iroha2_1 | 1484269086 INFO [sumeragi] initialize numValidatingPeers :4
iroha2_1 | 1484269086 INFO [sumeragi] initialize maxFaulty :1
iroha2_1 | 1484269086 INFO [sumeragi] initialize proxyTailNdx :3
iroha2_1 | 1484269086 INFO [sumeragi] initialize panicCount :0
iroha2_1 | 1484269086 INFO [sumeragi] initialize myPublicKey :GaYztYBESiaFp3uGs8tpJYMywYKszkBRAwGZX9KF2tw=
iroha2_1 | 1484269086 INFO [sumeragi] initialize is sumeragi :1
iroha2_1 | 1484269086 INFO [sumeragi] initialize..... complete!
iroha2_1 | 1484269086 INFO [server] initialize server!
iroha2_1 | 1484269086 INFO [server] start server!
iroha1_1 | 1484269086 INFO [main] process is :14
iroha1_1 | 1484269086 INFO [peer with json] load json is {"me": {"ip": "192.168.48.5", "name": "3856d9411a96", "privateKey": "MPbMgL45GIm92umnUHGcIKTP/vIKeig5Ah7XG6WtMUAMGuruZn8LmkBPpSEb9Dc+JWw6DDeiIqC8NS9Jc8l2zA==", "publicKey": "PlbUSr9dJpj78umugI9yhXXoM456IoJSRG3uPM5OsFE="}, "group": [{"ip": "192.168.48.5", "name": "3856d9411a96", "publicKey": "PlbUSr9dJpj78umugI9yhXXoM456IoJSRG3uPM5OsFE="}, {"ip": "192.168.48.3", "name": "6903cf2ec637", "publicKey": "GaYztYBESiaFp3uGs8tpJYMywYKszkBRAwGZX9KF2tw="}, {"ip": "192.168.48.4", "name": "722fe545c9ae", "publicKey": "SGxkkfiD/SlEJ21nCghlQviLhs19jMyF8yXFcpYsq2c="}, {"ip": "192.168.48.6", "name": "4586b134e576", "publicKey": "/0H/nO+6ocX4LH0DtXzo5on+LGOHbWzXymyRaY6adpo="}]}
iroha1_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha1_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha1_1 | 1484269086[sumeragi] ||           ||
iroha1_1 | 1484269086[sumeragi] || いろは合意形成機構 ||
iroha1_1 | 1484269086[sumeragi] ||    すめらぎ   ||
iroha1_1 | 1484269086[sumeragi] ||           ||
iroha1_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha1_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha1_1 | 1484269086[sumeragi] - 起動/setup
iroha1_1 | 1484269086[sumeragi] - 初期設定/initialize
iroha1_1 | 1484269086 INFO [sumeragi] My key is 192.168.48.5
iroha1_1 | 1484269086 INFO [sumeragi] Sumeragi setted
iroha1_1 | 1484269086 INFO [sumeragi] set number of validatingPeer
iroha1_1 | 1484269086 INFO [sumeragi] initialize numValidatingPeers :4
iroha1_1 | 1484269086 INFO [sumeragi] initialize maxFaulty :1
iroha1_1 | 1484269086 INFO [sumeragi] initialize proxyTailNdx :3
iroha1_1 | 1484269086 INFO [sumeragi] initialize panicCount :0
iroha1_1 | 1484269086 INFO [sumeragi] initialize myPublicKey :PlbUSr9dJpj78umugI9yhXXoM456IoJSRG3uPM5OsFE=
iroha1_1 | 1484269086 INFO [sumeragi] initialize is sumeragi :1
iroha1_1 | 1484269086 INFO [sumeragi] initialize..... complete!
iroha1_1 | 1484269086 INFO [server] initialize server!
iroha1_1 | 1484269086 INFO [server] start server!
iroha4_1 | 1484269086 INFO [main] process is :14
iroha4_1 | 1484269086 INFO [peer with json] load json is {"me": {"ip": "192.168.48.4", "name": "722fe545c9ae", "privateKey": "+ODIVspUEWzHU7oIKcD+8ImHuMSyx8OcZhfjAhhmw3zDCQI5Bxe7gKImRcOEfRBlGInH87ck65l8BnRd73hpjw==", "publicKey": "SGxkkfiD/SlEJ21nCghlQviLhs19jMyF8yXFcpYsq2c="}, "group": [{"ip": "192.168.48.4", "name": "722fe545c9ae", "publicKey": "SGxkkfiD/SlEJ21nCghlQviLhs19jMyF8yXFcpYsq2c="}, {"ip": "192.168.48.3", "name": "6903cf2ec637", "publicKey": "GaYztYBESiaFp3uGs8tpJYMywYKszkBRAwGZX9KF2tw="}, {"ip": "192.168.48.5", "name": "3856d9411a96", "publicKey": "PlbUSr9dJpj78umugI9yhXXoM456IoJSRG3uPM5OsFE="}, {"ip": "192.168.48.6", "name": "4586b134e576", "publicKey": "/0H/nO+6ocX4LH0DtXzo5on+LGOHbWzXymyRaY6adpo="}]}
iroha4_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha4_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha4_1 | 1484269086[sumeragi] ||           ||
iroha4_1 | 1484269086[sumeragi] || いろは合意形成機構 ||
iroha4_1 | 1484269086[sumeragi] ||    すめらぎ   ||
iroha4_1 | 1484269086[sumeragi] ||           ||
iroha4_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha4_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha4_1 | 1484269086[sumeragi] - 起動/setup
iroha4_1 | 1484269086[sumeragi] - 初期設定/initialize
iroha4_1 | 1484269086 INFO [sumeragi] My key is 192.168.48.4
iroha4_1 | 1484269086 INFO [sumeragi] Sumeragi setted
iroha4_1 | 1484269086 INFO [sumeragi] set number of validatingPeer
iroha4_1 | 1484269086 INFO [sumeragi] initialize numValidatingPeers :4
iroha4_1 | 1484269086 INFO [sumeragi] initialize maxFaulty :1
iroha4_1 | 1484269086 INFO [sumeragi] initialize proxyTailNdx :3
iroha4_1 | 1484269086 INFO [sumeragi] initialize panicCount :0
iroha4_1 | 1484269086 INFO [sumeragi] initialize myPublicKey :SGxkkfiD/SlEJ21nCghlQviLhs19jMyF8yXFcpYsq2c=
iroha4_1 | 1484269086 INFO [sumeragi] initialize is sumeragi :1
iroha4_1 | 1484269086 INFO [sumeragi] initialize..... complete!
iroha4_1 | 1484269086 INFO [server] initialize server!
iroha4_1 | 1484269086 INFO [server] start server!
iroha3_1 | 1484269086 INFO [main] process is :15
iroha3_1 | 1484269086 INFO [peer with json] load json is {"me": {"ip": "192.168.48.6", "name": "4586b134e576", "privateKey": "oGJLzcppzY6x3y9FLSlSpP6aBcWBej2nUHsMzC1I/lskCy2xiSAXGB7EU2xYsQU8V6w6400e1xr7M+zdeSbkrw==", "publicKey": "/0H/nO+6ocX4LH0DtXzo5on+LGOHbWzXymyRaY6adpo="}, "group": [{"ip": "192.168.48.6", "name": "4586b134e576", "publicKey": "/0H/nO+6ocX4LH0DtXzo5on+LGOHbWzXymyRaY6adpo="}, {"ip": "192.168.48.3", "name": "6903cf2ec637", "publicKey": "GaYztYBESiaFp3uGs8tpJYMywYKszkBRAwGZX9KF2tw="}, {"ip": "192.168.48.4", "name": "722fe545c9ae", "publicKey": "SGxkkfiD/SlEJ21nCghlQviLhs19jMyF8yXFcpYsq2c="}, {"ip": "192.168.48.5", "name": "3856d9411a96", "publicKey": "PlbUSr9dJpj78umugI9yhXXoM456IoJSRG3uPM5OsFE="}]}
iroha3_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha3_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha3_1 | 1484269086[sumeragi] ||           ||
iroha3_1 | 1484269086[sumeragi] || いろは合意形成機構 ||
iroha3_1 | 1484269086[sumeragi] ||    すめらぎ   ||
iroha3_1 | 1484269086[sumeragi] ||           ||
iroha3_1 | 1484269086[sumeragi] |+-ーーーーーーーーー-+|
iroha3_1 | 1484269086[sumeragi] +==ーーーーーーーーー==+
iroha3_1 | 1484269086[sumeragi] - 起動/setup
iroha3_1 | 1484269086[sumeragi] - 初期設定/initialize
iroha3_1 | 1484269086 INFO [sumeragi] My key is 192.168.48.6
iroha3_1 | 1484269086 INFO [sumeragi] Sumeragi setted
iroha3_1 | 1484269086 INFO [sumeragi] set number of validatingPeer
iroha3_1 | 1484269086 INFO [sumeragi] initialize numValidatingPeers :4
iroha3_1 | 1484269086 INFO [sumeragi] initialize maxFaulty :1
iroha3_1 | 1484269086 INFO [sumeragi] initialize proxyTailNdx :3
iroha3_1 | 1484269086 INFO [sumeragi] initialize panicCount :0
iroha3_1 | 1484269086 INFO [sumeragi] initialize myPublicKey :/0H/nO+6ocX4LH0DtXzo5on+LGOHbWzXymyRaY6adpo=
iroha3_1 | 1484269086 INFO [sumeragi] initialize is sumeragi :1
iroha3_1 | 1484269086 INFO [sumeragi] initialize..... complete!
iroha3_1 | 1484269086 INFO [server] initialize server!
iroha3_1 | 1484269086 INFO [server] start server!
configdiscovery exited with code 0

//////////
and dcoker ps : (the configdiscovery contanner is not in runing )
[root@bwsvr04 iroha]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4586b134e576 hyperledger/iroha "/configure-then-run." 24 minutes ago Up 24 minutes 1204/tcp iroha_iroha3_1
3856d9411a96 hyperledger/iroha "/configure-then-run." 24 minutes ago Up 24 minutes 1204/tcp iroha_iroha1_1
722fe545c9ae hyperledger/iroha "/configure-then-run." 24 minutes ago Up 24 minutes 1204/tcp iroha_iroha4_1
6903cf2ec637 hyperledger/iroha "/configure-then-run." 24 minutes ago Up 24 minutes 1204/tcp iroha_iroha2_1

and run docker-compose scale iroha=4 :
[root@bwsvr04 iroha]# docker-compose scale iroha=4
ERROR: No such service: iroha

and run the test bash as follows:
[root@bwsvr04 iroha]# ./run-curl.sh
POST "192.168.48.4:1204" "/asset/operation"
REQUEST {"command":"add","domain":"iroha","name":"iroha_iroha4_1"}
REPLY {"message":"Invalied json type or value","status":400}

Can you tell me , what happened , Thanks !

Want to add this test to CircleCI

I want to add following test to CircleCI.
develop branch merged task/test-peer-service.

How to

pre

$ $IROHA_HOME/docker/build.sh

do

$ docker network create --subnet=172.20.0.0/16 iroha-network
$ docker run -dit \
--net=iroha-network \
--ip=172.20.0.2 \
--name iroha1 \
-v $IROHA_HOME/config/sumeragi1.json:/usr/local/iroha/config/sumeragi.json \
hyperledger/iroha-docker
$ docker run -dit \
--net=iroha-network \
--ip=172.20.0.3 \
--name iroha2 \
-v $IROHA_HOME/config/sumeragi2.json:/usr/local/iroha/config/sumeragi.json \
hyperledger/iroha-docker
$ docker exec -it iroha1 sh -c '/usr/local/iroha/bin/issue_transaction add peer yUAFTYNh6qkhBMiNgNdg45Wk/XHOGYanuIroY9skfPQ= 172.20.0.3 1.0 true'

after

$ docker log iroha1
$ docker log iroha2

Synchronize Ledger

TODO: Synchronize Ledger

All peers must have the same Transactions in the same order.

Add CORS support for rest API

This issue is related to soramitsu/iroha-demo-javascript#2

Currently http_server_with_cappuccino.cpp does not offer any CORS support. This means that access from a browser fails because of the CORS preflight check.

prelight 1

The necessary HTTP header flow:
client:OPTIONS --> Origin --> server
server --> Access-Control-Allow-origin --> client
client:POST -> Origin --> server
server --> Access-Control-Allow-origin --> client

Now I thought I could easily fix this by adding the following:

Cappuccino::route<Cappuccino::Method::OPTIONS>("/account/register", [](std::shared_ptr<Request> request) -> Response {
            auto res = Response(request);
            res.header("Access-Control-Allow-Methods","POST");
            res.header("Access-Control-Allow-Headers","Content-Type");
            res.header("Access-Control-Allow-origin","*");
            res.header("Access-Control-Max-Age","86400");
            res.status(200);
            return res;
        });

and add this to the POST handler

res.header("Access-Control-Allow-origin","*");

The problem is that there is a bug in the cappuccino web server code:

if(context.routes.find(*request->path) != context.routes.end()){
			auto f = context.routes[*request->path].first;
			if(
				context.routes[*request->path].second.find(method_of(*request->method)) !=
				context.routes[*request->path].second.end()
				||
				method_of(*request->method) == Method::HEAD
			){
				return f(move(request));
			}else{
				return Response( 405, "Method Not Allowed", *request->protocol, *request->method, "<h1>Method Not Allowed!</h1>", *request->path);
			}
		}

The following code assumes there is only one Method assigned per path thus making it impossible to fix it. Either OPTIONS passes or POST passes depending on the order you assigned them.

Now I can fix this as well but if the rest api is going to be canned, then I guess it is not really worth fixing anymore.

Base64のたまにバグ

Description

落ちる

Test

TEST(Base64, EncodeAndDecodeJapaneseTextWithNL){
    unsigned char* text = (unsigned char*)("ソラミツ株式会社\
                                            以呂波耳本へ止\
                                            千利奴流乎和加\
                                            餘多連曽津祢那\
                                            良牟有為能於久\
                                            耶万計不己衣天\
                                            阿佐伎喩女美之\
                                            恵比毛勢須");
    ASSERT_STREQ( (char*)text, (char*)base64::decode(base64::encode(text)));
}

stdout

[ RUN      ] Base64.EncodeAndDecodeJapaneseTextWithNL
/Users/mizuki/Kaisa/test/crypto/base64_test.cpp:20: Failure
      Expected: (char*)text
      Which is: "\xE3\x82\xBD\xE3\x83\xA9\xE3\x83\x9F\xE3\x83\x84\xE6\xA0\xAA\xE5\xBC\x8F\xE4\xBC\x9A\xE7\xA4\xBE                                            \xE4\xBB\xA5\xE5\x91\x82\xE6\xB3\xA2\xE8\x80\xB3\xE6\x9C\xAC\xE3\x81\xB8\xE6\xAD\xA2                                            \xE5\x8D\x83\xE5\x88\xA9\xE5\xA5\xB4\xE6\xB5\x81\xE4\xB9\x8E\xE5\x92\x8C\xE5\x8A\xA0                                            \xE9\xA4\x98\xE5\xA4\x9A\xE9\x80\xA3\xE6\x9B\xBD\xE6\xB4\xA5\xE7\xA5\xA2\xE9\x82\xA3                                            \xE8\x89\xAF\xE7\x89\x9F\xE6\x9C\x89\xE7\x82\xBA\xE8\x83\xBD\xE6\x96\xBC\xE4\xB9\x85                                            \xE8\x80\xB6\xE4\xB8\x87\xE8\xA8\x88\xE4\xB8\x8D\xE5\xB7\xB1\xE8\xA1\xA3\xE5\xA4\xA9                                            \xE9\x98\xBF\xE4\xBD\x90\xE4\xBC\x8E\xE5\x96\xA9\xE5\xA5\xB3\xE7\xBE\x8E\xE4\xB9\x8B                                            \xE6\x81\xB5\xE6\xAF\x94\xE6\xAF\x9B\xE5\x8B\xA2\xE9\xA0\x88"
To be equal to: (char*)base64::decode(base64::encode(text))
      Which is: ""

想定

  • base64のライブラリで改行周りがおかしい?

Future work

  • base64のライブラリ入れ替え?

Comment

  • ユースケース的に使わないけど怖いなぁ......

Segfault in iroha-main

Version: latest develop branch

I tried to run iroha-main as single node with the following sumeragi.json:

{
  "group": [
    {
      "ip": "127.0.0.1",
      "name": "da77880a3da4",
      "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
    }
  ],
  "me": {
    "ip": "127.0.0.1",
    "name": "da77880a3da4",
    "privateKey": "cPY84e0BXGUHBjT4QdlPI0LI3BPIfUfSZjB8jdWURkNQ+pEagT/ysrewbt2YUo/Qbfd5vczW5oDooGSNUBTj9g==",
    "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
  }
}

I sent this POST request:

curl -X POST http://127.0.0.1:1204/account/register -d '{"publicKey":"e3IrRuiebs78YDdxrve6ZSp3rFbGvJB5fnGcRdVKTrw=","alias":"bogdan","timestamp":1485182435}'

As answer received this:

{"message":"successful","status":200,"uuid":""}

Immediately after answer the process iroha-main dies:

bogdan@st1:/tmp/iroha/bin$ ./iroha-main 
1488726252 DEBUG [config] load json is {
    "database_path": "/tmp/iroha_ledger",
    "concurrency": 0,
    "max_faulty_peers": 1,
    "pool_worker_queue_size": 1024,
    "http_port": 1204,
    "grpc_port": 50051
}
1488726252 INFO [main] process is :28006
1488726252[sumeragi] +==ーーーーーーーーー==+
1488726252[sumeragi] |+-ーーーーーーーーー-+|
1488726252[sumeragi] ||           ||
1488726252[sumeragi] || いろは合意形成機構 ||
1488726252[sumeragi] ||    すめらぎ   ||
1488726252[sumeragi] ||           ||
1488726252[sumeragi] |+-ーーーーーーーーー-+|
1488726252[sumeragi] +==ーーーーーーーーー==+
1488726252[sumeragi] - 起動/setup
1488726252[sumeragi] - 初期設定/initialize
1488726252 DEBUG [config] load json is {
  "group": [
    {
      "ip": "127.0.0.1",
      "name": "da77880a3da4",
      "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
    }
  ],
  "me": {
    "ip": "127.0.0.1",
    "name": "da77880a3da4",
    "privateKey": "cPY84e0BXGUHBjT4QdlPI0LI3BPIfUfSZjB8jdWURkNQ+pEagT/ysrewbt2YUo/Qbfd5vczW5oDooGSNUBTj9g==",
    "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
  }
}
1488726252 INFO [sumeragi] My key is 127.0.0.1
1488726252 INFO [sumeragi] Sumeragi setted
1488726252 INFO [sumeragi] set number of validatingPeer
1488726252 INFO [sumeragi] initialize numValidatingPeers :1
1488726252 INFO [sumeragi] initialize maxFaulty :1
1488726252 INFO [sumeragi] initialize proxyTailNdx :0
1488726252 INFO [sumeragi] initialize panicCount :0
1488726252 INFO [sumeragi] initialize myPublicKey :u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1488726252 INFO [sumeragi] initialize is sumeragi :1
1488726252 INFO [sumeragi] initialize.....  complete!
1488726252 INFO [server] initialize server!
1488726252 INFO [server] start server!
1488726255 INFO [sumeragi] receive!
1488726255 INFO [connection] response: OK
1488726255 INFO [sumeragi] processTransaction
1488726255 INFO [sumeragi] valid
1488726255 INFO [sumeragi] Add my signature...
1488726255 INFO [sumeragi] hash:958857657e077431b5914f3d4b9ebf55d5233161ddc4d3a9bd5e815fb64443ad
1488726255 INFO [sumeragi] pub: u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1488726255 INFO [sumeragi] priv:cPY84e0BXGUHBjT4QdlPI0LI3BPIfUfSZjB8jdWURkNQ+pEagT/ysrewbt2YUo/Qbfd5vczW5oDooGSNUBTj9g==
1488726255 INFO [sumeragi] sig: V1hOWB5ASXv/9ajn+mOyj5AXPrfNMo5h8s0LBGkw7HtxFbNkVnNy16JjjCDY7BNgm+Qjh9QWRoaC0vkYZeMfDA==
1488726255 INFO [sumeragi] tail public key is u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1488726255 INFO [sumeragi] tail is 0
1488726255 INFO [sumeragi] my public key is u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1488726255 INFO [sumeragi] I will send event to 127.0.0.1
1488726255 INFO [connection] Operation
1488726255 INFO [connection] size: 2
1488726255 INFO [connection] name: 
1488726255 INFO [connection] size: 2
1488726255 INFO [sumeragi] receive!
1488726255 INFO [sumeragi] received message! sig:[2]
1488726255 INFO [sumeragi] received message! status:[uncommit]
1488726255 INFO [sumeragi] processTransaction
1488726255 INFO [sumeragi] valid
14887262551488726255 INFO [sumeragi] Add my signature...
 INFO [connection] response: OK
1488726255 INFO [sumeragi] hash:958857657e077431b5914f3d4b9ebf55d5233161ddc4d3a9bd5e815fb64443ad
1488726255 INFO [sumeragi] pub: u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1488726255 INFO [sumeragi] priv:cPY84e0BXGUHBjT4QdlPI0LI3BPIfUfSZjB8jdWURkNQ+pEagT/ysrewbt2YUo/Qbfd5vczW5oDooGSNUBTj9g==
terminate called without an active exception
Aborted (core dumped)

It looks like there is some unhandled exception.

connection_with_grpc requires arguments, but test.sh runs tests without args

Look at this build: https://circleci.com/gh/hyperledger/iroha/1083 at test phase:

$ docker run -p 1204:1204 hyperledger/iroha-docker /test.sh

Tests exits with code 0 (success), but some tests failed.

It is because of presence of exit 0 in tests.sh. I fixed this in this commit but tests started to fail even with SUCCESS code on each test.

Look at this line.
Test connection_with_grpc requires 2 arguments, otherwise it returns exit code 1.

test.sh runs each test without arguments, this is why I temporarily commented test connection_with_grpc in this commit: 8823eba.

Please, add default arguments to connection_with_grpc test or exclude it from test_bin folder.

fatal error: infra/protobuf/api.pb.h: No such file or directory

I build iroha in local environment, but have a issue:
[ 48%] Building CXX object core/validation/CMakeFiles/validator.dir/transaction_validator.cpp.o /home/ubuntu/iroha/core/validation/transaction_validator.cpp:20:35: fatal error: infra/protobuf/api.pb.h: No such file or directory compilation terminated. core/validation/CMakeFiles/validator.dir/build.make:62: recipe for target 'core/validation/CMakeFiles/validator.dir/transaction_validator.cpp.o' failed make[2]: *** [core/validation/CMakeFiles/validator.dir/transaction_validator.cpp.o] Error 1 CMakeFiles/Makefile2:1821: recipe for target 'core/validation/CMakeFiles/validator.dir/all' failed make[1]: *** [core/validation/CMakeFiles/validator.dir/all] Error 2 Makefile:94: recipe for target 'all' failed make: *** [all] Error 2

CMakeLists improvements

  • (?) Use proper calls here like this
  • Make timestamps of the api.proto so half of the project won't be recompiled every build
  • (?) remove generated files (core/infra/protobuf/*) from the repo
  • Move out smart_contract directory from the root (as well as other possible cleanings of the proj src dir)

Peer suspicion is needed

Given 4 servers in the following validation chain:

A --- B --- C --- D

{A,B,C} will be the validators (with C as the proxy tail).

If an error occurs in validation it is important to be able to assert blame, for example, if B receives a transaction and then doesn't validate it, then B has a fault and should be moved to the end of the validation chain.

This can be accomplished by signing transactions when they are received, sending cryptographic proof of receipt back to the sender.

For example, if A sends a transaction to B, then B signs the hash of the transaction with its private key, sending just the signature back to A. If B never sends the transaction to C or lies and says that A never sent it, A can use the signed receipt from B to prove to the other peers that B is the faulty server and then they can execute a view change that reorders the peers.

Issue with IPv6

Cappuccino and GRPC may listen on IPv6 address!

tcp        0      0 0.0.0.0:1204            0.0.0.0:*               LISTEN      3560/iroha-main
tcp6       0      0 :::50051                :::*                    LISTEN      3560/iroha-main

Looking for a solution.

## WIP

WIP

  • controller/transaction.hpp manages some domain.
    RestAPIから受け取った値を理解しtransactionをPublishする or
    Domainを操作する。
  • core/domain -> core/model
  • sumeragi.hppにNodeを定義。repositoryをつくろう
  • core/service/peer_serive.hpp
    yamlから5代のサーバー情報を得る
  • architecture picture.
  • ......

Future work

  • core/infra/crypto/ 内 cmakeができない

Discuss

  • domain has

ld: library not found for -lhash

Trying to build Iroha on Mac OS X, I'm running into the following error:

[ 76%] Linking CXX executable ../bin/iroha-main
ld: warning: directory not found for option '-L/Users/e11778/work/_BLOCKCHAIN/iroha/core/vendor/ed25519/lib'
ld: warning: directory not found for option '-L/Users/e11778/work/_BLOCKCHAIN/iroha/core/vendor/KeccakCodePackage/bin/generic64'
ld: warning: directory not found for option '-L/Users/e11778/work/_BLOCKCHAIN/iroha/core/vendor/Aeron/cppbuild/Release/lib'
ld: warning: directory not found for option '-L/Users/e11778/work/_BLOCKCHAIN/iroha/core/vendor/leveldb/out-static'
ld: library not found for -lhash
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/iroha-main] Error 1
make[1]: *** [peer/CMakeFiles/iroha-main.dir/all] Error 2
make: *** [all] Error 2

Front_API_draft.md

This is draft
I think blow api ( If use REST API)

Transaction API

Find account's transaction history by account-uuid

/history/transaction

Params

  • account-uuid (Reason for account-uuid is url param can not use base64 in default, And accout-uuid is sha3-256(publicKey) )
  • limit

Return

{
  "status": 200,
  "history" : [
    {
      "domainName" : "hyperledger", 
      "assetName":  "iroha",
      "assetUuid" : "f806c37c88c6d099d1b342cc5e5783c4f6a11e7b63a5103f3799ce2a7468105e",
      "params" : {
        "type": "transfer",
        "value": "39",
        "sender" : "base64_public_key",
        "receiver" : "base64_public_key"
      },
      "signature" : "b64encoded_signature",
      "timestamp" : 1234567
    }
    ]
}

Find account's transaction history by domain and asset

/history/:domain/:asset/transaction

Params

  • account-uuid (This is optional If asset has permission function)

Return

{
  "status": 200,
  "history" : [
    {
      "domainName" : "hyperledger", 
      "assetName":  "iroha",
      "assetUuid" : "f806c37c88c6d099d1b342cc5e5783c4f6a11e7b63a5103f3799ce2a7468105e",
      "params" : {
        "type": "transfer",
        "value": "39",
        "sender" : "base64_public_key",
        "receiver" : "base64_public_key"
      },
      "signature" : "b64encoded_signature",
      "timestamp" : 1234567
    }
    ]
}

Asset API

Get asset information

/:domain/:asset

Params

  • account-uuid

Return

{
      "assetUuid" : "sha3",
      "name" : "iroha",
      "domain" : "hyperledger",
      "creator" : "base64_public_key",
      "signature" : "b64encoded?_signature",
      "timestamp" : 12345
}

Account API

Get account information

/account

Params

  • account-uuid

Return

{
   "accountUuid": "sha3hash",
   "publicKey":"b64encoded",
   "alias":"mizuki_sonoko",
   "timestamp": 1234567,
   "assets": [
       {
         "domain": "hyperledger",
         "belong" : {
            "assetName":"iroha",
            "assetUuid" :"f806c37c88c6d099d1b342cc5e5783c4f6a11e7b63a5103f3799ce2a7468105e"
           }
        }
     ]
}

Relation

+--------------+  has  +---------+
|    Domain    |<------| Account |
+--------------+       +---------+
    |       | belong        |         
    v       v               | has
+------+ +------+           |
|Asset1| |Asset2|<----------+
+------+ +------+

iroha_docs_draft

Sorry... currently, It's written by Japanese only.

  • Asset in Iroha
  • Operation
  • Architecture

Asset in Iroha

Object

irohaで扱うデータの事。種類としてAsset,Domain,Account,Message,Peerがある。
AssetにはSmartContractを紐つけることができる。

Asset

最も基本的なObject,文字列をvalueとして持つ。

要素

  • domain (Domain) // 属しているDomain (uuidだけでいい?)
  • name (string)
  • value (string)

Currency

Assetのvalueを整数値にしたもの。Use-Caseが多いので分離した。
必要か用検討

要素

  • domain (Domain) // 属しているDomain (uuidだけでいい?)
  • name (string)
  • value (int)

Domain

Assetの集合体。

要素

  • ownerPublicKey (string) // 配列の方が良い?
  • name (string)

Account

irohaを操作できるユーザ。publicKey,name,操作可能なAssetを情報として持つ.

要素

  • ownerPublicKey (string)
  • name (string)
  • assets ([Asset]) // domainのとの関係性は?

Peer

sumeragiを構成するpeerの情報を持つ

要素

  • publicKey (string)
  • ip (string) // IPv4,v6はどう区別する?
  • some value // 信頼度とか

関係性

+--------------+  has  +---------+
|    Domain    |<------| Account |
+--------------+       +---------+
    |       | belong
    v       v
+------+ +------+
|Asset1| |Asset2|
+------+ +------+
    |       |
====================    
    |       |       +-----------------+
    |       └─------| smart contract2 |
    |               +-----------------+
+-----------------+
| smart contract1 |
+-----------------+

イメージとしては現行のURLシステムのようなものです。
それぞれのAssetは特定のDomainに属します。Domainの管理者がAssetを自由に操作することができます。
ex

domain:soramitsu 
asset: mizuki
asset: iori

mizuki.soramitsu
iori.soramitsu
toyama.soramitsu

Operation

Command

Add

追加をする

要素

  • object

Transfer

転送をする

要素

  • receiver
  • object

Update

更新をする

要素

  • object

Remove

削除をする

要素

  • object

Contract

Smart contractを実行する

要素

  • smart contract name
  • command
  • object

Transaction Command

              |
              |
     ┌--------+-------┐
     |                |
     |       ┌--------|-------┐
     |       | Smart Contract |
     |       └----------------┘                   // Alias まわり(提案)                     // ReadアクセスもTxにする?
     +-----------+-----------+-----------+        
┌----|-----┐┌----|-----┐┌----|-----┐┌----|-----┐  ┌----|-----┐┌----|-----┐┌----|-----┐    ┌----|-----┐┌----|-----┐      
|  Update  ||   Add    || Transfer ||  Remove  |  |  Alias   ||  UnAlias ||  Split   |    |   Find   ||   Get    | 
└----------┘└----------┘└----------┘└----------┘  └----------┘└----------┘└----------┘    └----------┘└----------┘

(WIP UTXO対応)多分
Transferをうまく使ってownerを移行する形で

Transfer<OwnerOf<Asset>>

Event

irohaのDBを更新するときは基本的にConsensusEventを発行し、Sumeragiに送る。
// WIP transactionを発行したほうが良いのでは
Sumeragiはそれを合意形成する。

+-----------------+
|      Object     | <- Asset, Domain, Account and Peer
+-----------------+ 
|     command     | <- Add, Transfer, Update, Remove and Contract
+-----------------+
|   transaction   | <- sender, timestamp, signatures and hash
+-----------------+
| consensus event | <- sumeragi's signatues, state( Undetermined, Commited)
+-----------------+

発行方法の例(C++)

auto event = ConsensusEvent<Transaction<Add<Account>>>(
    issuerPublicKey,   // Transaction 発行者
    accountPublicKey,  
    alias
);
auto event = ConsensusEvent<Transaction<Transfer<Asset>>>(
    issuerPublicKey, // Transaction 発行者
    senderPublicKey, // Asset送り主
    receiverPublicKey,
    assetName,
    value
);

コレはC++上での話でしか無いので他のFrontから叩く場合flatbuf(protobuf)を直接叩き皇に合意要求をした方が良いです。

Architecture

Iroha Architecture (currently)

 front API
   |(1)
┌-------------┐
+ Cappuccino  +------------------------
└--+----------┘
   |                
   |                                   
┌--┼----------┐         ┌---------------┐
|  V sumeragi |(3)      |  Command exec |
|             ----------+>              |
└--|-------A--┘         └----+----------┘
   |(2)    | valdation       |
   |       └-----------------┼------┐
   |                         |      |
   |consensus building       |(4)   |
┌------------┐             ┌-V------+------┐     ┌-------┐
| connection |             |   repository  |------ model |
└------------┘             └---------------┘     └-------┘
      |                             |
Infra=|=============================|===========
      |implement                    |implement
   ┌------┐                       ┌-----┐
   | grpc |                       | D B |
   └------┘                       └-----┘

Iroha Architecture (future)

 Input (using flat buffer)     Input(http server)
   |(1)                         |
---+----------------+-+---------V----+--
   |----------------┼-┼  Cappuccino  | Cappuccino is option. for http server
   |                | └--------------┘        
┌--┼----------┐     |   
|  | sumeragi |     |   * User programable     
|┌-V---------┐|(2)  | ┌-------------┐   
|| stateless ┼┼-----┼-┼->           |
|├-----------┤|(3)  | | chain code  |  
|| stateful <┼┼-----┼-┼-            |  
|└-|-------|-┘|     | └-┼----┼------┘
└--┼-------┼--┘     └---┼----┼-----------------   
   |       |            |    |
   |       └------------┼----┼------┐
   |                    |    |      |
   |consensus building  |    |      |(4)
┌--┼---------┐          |  ┌-┼------V------┐     ┌-------┐
| connection |          |  |   repository  |------ model |
└-----┼------┘          |  └--------┼------┘     └-------┘
      |                 |           |
Infra=┼=================┼===========┼===========
      |implement        |implement  |implement
   ┌--┼---┐          ┌--┼---┐    ┌--┼--┐
   | grpc |          | JAVA |    | D B |
   └------┘          └------┘    └-----┘

membership_service

Add initial peer. modify save data method. ( 2016/02/14 20:16 )

membership_service

problem : どちらの peer class を使いますか?(現在どちらも使っている)

  • objects::Peer?
  • peer::Node?

add

  1. ip と publicKey を指定して新しい peer を定義。
  2. 現在稼働している他の peer からデータを正しいデータを持ってくる。(合意差分データ収集機構:後述)
  3. peer を評価しTrustRateを定義。
  4. peerList に 新しい peer を追加。
  5. DB に新しい peer の情報を追加。

remove

  1. 削除する ip と publicKey を定義。
  2. peerList からそのpeerを削除。
  3. DB を全削除

update

  • ip の変更
  • TrustRate の変更
  • update< 旧Peer, To< 新Peer > > execution() で実行 or
  • update< 旧peer >::execution( 新Peer ) で実行

initial

  • 新規ピアが最初に行う処理を記す

question

  • peerList の中身は全ての peer が同じ順序で同じ peer を保持している?(その必要があるか?)
  • 合意差分データ収集機構とは?
  • peer_service_with_json.hpp にpeerListを保持していますが、sumeragi.jsonがなくなる予定であるならファイル名が不適切になりそうです。
  • initial が必要では?

合意差分データ収集機構について

  • 最も優先度の高いピアからデータを受け取る。
  • 最も優先度の高いピアは add された node にデータをわたす

↓ English ver

problem : Which does use peer class? ( now Iroha uses both class. )

  • objects::Peer?
  • peer::Node?

add

  1. Define new peer from ip and publicKey ip.
  2. Bring the correct data from other peers that are currently data running. ( 合意差分データ収集機構 [ recruitment cool name ] )
  3. Evaluate peer that calc TrustRate.
  4. Add peerList from new peer.
  5. Add DB from new peer infomation.

remove

  1. Define new peer from ip and publicKey.
  2. Delete peerList to peer.
  3. Delete DB.

update

  • Change ip.
  • Change TrustRate.
  • update< old Peer, To< new Peer > > execution() or
  • update< old Peer >::execution( new Peer )

initial

  • Write the process that the new peer first performs.

question

  • Is peerList contents all peers holding the same peer in the same order?
  • What is "合意差分データ収集機構"?
  • peer_service_with_json.hpp has peerList. But sumeragi.json will be erase. So filename is inappropriate.
  • It need to initial method.

About 合意差分データ収集機構( I recruitments cool name )

  1. new peer receive data from the highest priority peer.
  2. The highest priority peer send data to added peer.

Consider using the Hashgraph consensus algorithm

There is a quite new algorithm providing all the needed features a distributed consensus algorithm must have. It's called Hashgraph. The paper states it's very efficient and the first implementations on GitHub seem to confirm that. There is an ongoing effort to test this algorithm under extreme conditions (very low bandwidth, big round trip time, etc.).

It's definitely worth checking out whether it could serve as a replacement for the current BHash.

Build fails

Pulled latest changes and now build fails:

[  9%] Built target googletest
[ 11%] Built target exception
[ 17%] Built target objects
[ 20%] Built target datetime
[ 22%] Built target logger
[ 25%] Built target world_state_repo_with_level_db
[ 28%] Built target event_with_grpc
[ 32%] Built target domain_repository
[ 36%] Built target commands
[ 40%] Built target event_repository
[ 42%] Built target base64
[ 45%] Built target signature
[ 47%] Built target connection_with_grpc
[ 50%] Built target peer_service_with_json
[ 52%] Built target sumeragi
[ 54%] Built target transaction
[ 57%] Built target validator
[ 59%] Built target consensus_event
[ 61%] Built target java_virtual_machine
[ 64%] Built target smart_contract_with_java
[ 69%] Built target convertor
[ 70%] Building CXX object core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/http_server_with_cappuccino.cpp.o
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp: In function ‘void http::server()’:
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:78:39: error: ‘Cappuccino::Method’ has not been declared
         Cappuccino::route<Cappuccino::Method::POST>( "/account/register",[](std::shared_ptr<Request> request) -> Response{
                                       ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp: In lambda function:
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:87:26: warning: unused variable ‘timestamp’ [-Wunused-variable]
                     auto timestamp = data["timestamp"].get<int>();
                          ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp: In function ‘void http::server()’:
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:133:9: warning: left operand of comma operator has no effect [-Wunused-value]
         });
         ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:135:39: error: ‘Cappuccino::Method’ has not been declared
         Cappuccino::route<Cappuccino::Method::GET>( "/account",[](std::shared_ptr<Request> request) -> Response{
                                       ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:160:9: warning: left operand of comma operator has no effect [-Wunused-value]
         });
         ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:162:39: error: ‘Cappuccino::Method’ has not been declared
         Cappuccino::route<Cappuccino::Method::POST>( "/asset/operation",[](std::shared_ptr<Request> request) -> Response{
                                       ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp: In lambda function:
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:168:26: warning: unused variable ‘timestamp’ [-Wunused-variable]
                     auto timestamp = data["timestamp"].get<int>();
                          ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp: In function ‘void http::server()’:
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:210:9: warning: left operand of comma operator has no effect [-Wunused-value]
         });
         ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:212:39: error: ‘Cappuccino::Method’ has not been declared
         Cappuccino::route<Cappuccino::Method::GET>( "/history/transaction",[](std::shared_ptr<Request> request) -> Response{
                                       ^
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:263:9: warning: left operand of comma operator has no effect [-Wunused-value]
         });
         ^
In file included from /home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/../../consensus/consensus_event.hpp:32:0,
                 from /home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/convertor.hpp:8,
                 from /home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:23:
/home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/../../consensus/../model/commands/transfer.hpp: In instantiation of ‘constexpr command::Transfer<T>::Transfer(std::__cxx11::string&&, std::__cxx11::string&&, Args&& ...) [with Args = {const char* const&, int}; T = object::Asset; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
/home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/../../consensus/../model/transaction.hpp:54:37:   required from ‘transaction::Transaction<T>::Transaction(std::__cxx11::string&&, Args&& ...) [with Args = {const char*, const char*, const char* const&, int}; T = command::Transfer<object::Asset>; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/../../consensus/consensus_event.hpp:67:38:   required from ‘event::ConsensusEvent<T>::ConsensusEvent(Args&& ...) [with Args = {const char*, const char*, const char*, const char* const&, int}; T = transaction::Transaction<command::Transfer<object::Asset> >]’
/home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:181:21:   required from here
/home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/../../consensus/../model/commands/transfer.hpp:36:21: warning: ‘command::Transfer<object::Asset>::receiverPublicKey’ will be initialized after [-Wreorder]
         std::string receiverPublicKey;
                     ^
/home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/../../consensus/../model/commands/transfer.hpp:46:46: warning:   base ‘object::Asset’ [-Wreorder]
                 T(std::forward<Args>(args)...)
                                              ^
/home/bogdan/tools/iroha/core/infra/server/../../infra/protobuf/../../consensus/../model/commands/transfer.hpp:39:28: warning:   when initialized here [-Wreorder]
         constexpr explicit Transfer(
                            ^
In file included from /home/bogdan/tools/iroha/core/infra/server/http_server_with_cappuccino.cpp:20:0:
/home/bogdan/tools/iroha/core/infra/server/../../vendor/Cappuccino/cappuccino.hpp: At global scope:
/home/bogdan/tools/iroha/core/infra/server/../../vendor/Cappuccino/cappuccino.hpp:73:15: warning: ‘void Cappuccino::Log::info(std::__cxx11::string)’ defined but not used [-Wunused-function]
   static void info(std::string msg){
               ^
core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/build.make:62: recipe for target 'core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/http_server_with_cappuccino.cpp.o' failed
make[2]: *** [core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/http_server_with_cappuccino.cpp.o] Error 1
CMakeFiles/Makefile2:930: recipe for target 'core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/all' failed
make[1]: *** [core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

Any ideas?

my_test_bin/sumeragi_test linking failed

build environment:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

build iroha by https://github.com/hyperledger/iroha/blob/master/docs/how_to_build.rst step by step.

and make failed because of a test unit linking failure, failed info as following:

[ 91%] Linking CXX executable ../../my_test_bin/sumeragi_test
/usr/bin/ld: cannot find -lleveldb
collect2: error: ld returned 1 exit status
test/consensus/CMakeFiles/sumeragi_test.dir/build.make:115: recipe for target 'my_test_bin/sumeragi_test' failed
make[2]: *** [my_test_bin/sumeragi_test] Error 1
CMakeFiles/Makefile2:1698: recipe for target 'test/consensus/CMakeFiles/sumeragi_test.dir/all' failed
make[1]: *** [test/consensus/CMakeFiles/sumeragi_test.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2]

I tried to add link_directry of leveldb for sumeragi_test, it doesn't working since another linking lib named snappy is missing, which is specified by the CMakeLists.txt

did you guys meet this problem before? How can I fix it?

Config bugs

This is how iroha reacts to absense of configs:

1488934134 ERROR (-A-) [config] Not found: /iroha/config/config.json
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)
1488934136 ERROR (-A-) [config] Not found: /iroha/config/sumeragi.json
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)

And, when I create empty config.json and sumeragi.json I can run iroha:

1488934263 DEBUG [config] load json is 
1488934263 ERROR (-A-) [config] Can't parse json: config/config.json
1488934263 DEBUG [config] load json is 
1488934263 ERROR (-A-) [config] Can't parse json: config/config.json
1488934263 DEBUG [config] load json is 
1488934263 ERROR (-A-) [config] Can't parse json: config/config.json
1488934263 DEBUG [config] load json is 
1488934263 ERROR (-A-) [config] Can't parse json: config/config.json
1488934263 INFO [main] process is :332
1488934263 DEBUG [config] load json is 
1488934263 ERROR (-A-) [config] Can't parse json: config/config.json

As a user I want to run iroha without config.json at all. I want to get only warning "there is no config, we will use default values" (something like this).

http server segfault

Just send SIGINT to iroha-main and this will cause:

#0  0x00007ff6d93b4304 in free () from /usr/lib/libc.so.6
#1  0x00000000005aa210 in __gnu_cxx::new_allocator<grpc::ServerCompletionQueue*>::deallocate (this=0x926e70 <connection::builder+80>, __p=0x100000001)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../include/c++/6.3.1/ext/new_allocator.h:110
#2  0x00000000005aa1e0 in std::allocator_traits<std::allocator<grpc::ServerCompletionQueue*> >::deallocate (__a=..., __p=0x100000001, __n=0xffffffffdfffffff)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../include/c++/6.3.1/bits/alloc_traits.h:442
#3  0x00000000005aa17b in std::_Vector_base<grpc::ServerCompletionQueue*, std::allocator<grpc::ServerCompletionQueue*> >::_M_deallocate (this=0x926e70 <connection::builder+80>, __p=0x100000001, __n=0xffffffffdfffffff)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../include/c++/6.3.1/bits/stl_vector.h:178
#4  0x00000000005aa0c9 in std::_Vector_base<grpc::ServerCompletionQueue*, std::allocator<grpc::ServerCompletionQueue*> >::~_Vector_base (this=0x926e70 <connection::builder+80>)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../include/c++/6.3.1/bits/stl_vector.h:160
#5  0x00000000005a9ab8 in std::vector<grpc::ServerCompletionQueue*, std::allocator<grpc::ServerCompletionQueue*> >::~vector (this=0x926e70 <connection::builder+80>)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../include/c++/6.3.1/bits/stl_vector.h:427
#6  0x00000000005a7a13 in grpc::ServerBuilder::~ServerBuilder (this=0x926e20 <connection::builder>) at /usr/local/include/grpc++/server_builder.h:61
#7  0x00007ff6d936e990 in __run_exit_handlers () from /usr/lib/libc.so.6
#8  0x00007ff6d936e9ea in exit () from /usr/lib/libc.so.6
#9  0x0000000000578f4e in Cappuccino::signal_utils::signal_handler (signal=0x2) at /home/kitsu/dev/Work/iroha/external/src/mizukisonoko_cappuccino/cappuccino.hpp:123
#10 <signal handler called>
#11 0x00007ff6da43f10d in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#12 0x00007ff6d9ca74cc in __gthread_cond_wait (__mutex=<optimized out>, __cond=<optimized out>) at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:864
#13 std::condition_variable::wait (this=<optimized out>, __lock=...) at /build/gcc-multilib/src/gcc/libstdc++-v3/src/c++11/condition_variable.cc:53
#14 0x00007ff6d9fa9501 in grpc::Server::Wait() () from /usr/lib/libgrpc++.so.2
#15 0x00000000005a5df0 in connection::run () at /home/kitsu/dev/Work/iroha/core/infra/connection/connection_with_grpc.cpp:392
#16 0x000000000055cca5 in main () at /home/kitsu/dev/Work/iroha/peer/main.cpp:59
#17 0x00007ff6d9359291 in __libc_start_main () from /usr/lib/libc.so.6
#18 0x000000000055c89a in _start ()

I guess it can be due to the same reason as #190's grpc test

Convert Aeron media driver to c++

It would help the build process a lot to only use C++ for everything. A lot of the libs in Aeron require maven. Maven blocks the IPs of a lot of vultr servers, so it is hard to use their cloud service.

Huge memory and CPU leak in iroha-main

Branch: hyperledger/iroha#209

Steps to reproduce:

  1. run single node with default config

    docker run -it --name iroha hyperledger/iroha-docker
    
  2. get IP of running node:

    docker inspect iroha | grep IPAddress
    

    (assume 172.17.0.2)

  3. send 4 or 5 different queries on registration (different public key and alias)

curl -X POST http://172.17.0.2:1204/account/register -d '{"publicKey":"53IrRuiebs78YDdxrve6ZSp3rFbGvJB5fnGcRdVKTrw=","alias":"bogdan1","timestamp":1485182435}'
curl -X POST http://172.17.0.2:1204/account/register -d '{"publicKey":"43IrRuiebs78YDdxrve6ZSp3rFbGvJB5fnGcRdVKTrw=","alias":"bogdan2","timestamp":1485182435}'
curl -X POST http://172.17.0.2:1204/account/register -d '{"publicKey":"33IrRuiebs78YDdxrve6ZSp3rFbGvJB5fnGcRdVKTrw=","alias":"bogdan3","timestamp":1485182435}'
curl -X POST http://172.17.0.2:1204/account/register -d '{"publicKey":"23IrRuiebs78YDdxrve6ZSp3rFbGvJB5fnGcRdVKTrw=","alias":"bogdan4","timestamp":1485182435}'
curl -X POST http://172.17.0.2:1204/account/register -d '{"publicKey":"13IrRuiebs78YDdxrve6ZSp3rFbGvJB5fnGcRdVKTrw=","alias":"bogdan5","timestamp":1485182435}'

iroha will consume 100% CPU and 100% RAM in few seconds.

UPD: you can limit memory for docker by passing -m 2G to docker run, if you want to

Memory leak in iroha-main

==4782== Memcheck, a memory error detector
==4782== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==4782== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==4782== Command: ./iroha-main
==4782== 
1489438010 DEBUG [config] load json is { 
  "database_path":"/tmp/iroha_ledger",
  "java_class_path":"java_tests",
  "java_class_path_local":"smart_contract/java_tests",
  "java_library_path":"lib",
  "java_library_path_local":"build/lib",
  "java_policy_path":"jvm/java.policy.txt",
  "concurrency": 0,
  "max_faulty_peers" : 1,
  "pool_worker_queue_size": 1024,
  "http_port": 1204,
  "grpc_port": 50051,
  "active_start": false
}

1489438010 INFO [main] process is :4782
1489438010[sumeragi] �[95m+==ーーーーーーーーー==+�[0m
1489438010[sumeragi] �[95m|+-ーーーーーーーーー-+|�[0m
1489438010[sumeragi] �[95m||           ||�[0m
1489438010[sumeragi] �[95m|| いろは合意形成機構 ||�[0m
1489438010[sumeragi] �[95m||    �[1mすめらぎ�[0m�[95m   ||�[0m
1489438010[sumeragi] �[95m||           ||�[0m
1489438010[sumeragi] �[95m|+-ーーーーーーーーー-+|�[0m
1489438010[sumeragi] �[95m+==ーーーーーーーーー==+�[0m
1489438010[sumeragi] - 起動/setup
1489438010[sumeragi] - 初期設定/initialize
1489438010 DEBUG [config] load json is {
  "group": [
    {
      "ip": "127.0.0.1",
      "name": "da77880a3da4",
      "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
    }
  ],
  "me": {
    "ip": "127.0.0.1",
    "name": "da77880a3da4",
    "privateKey": "cPY84e0BXGUHBjT4QdlPI0LI3BPIfUfSZjB8jdWURkNQ+pEagT/ysrewbt2YUo/Qbfd5vczW5oDooGSNUBTj9g==",
    "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
  }
}
1489438011 INFO [sumeragi] My key is 127.0.0.1
1489438011 INFO [sumeragi] Sumeragi setted
1489438011 INFO [sumeragi] set number of validatingPeer
1489438011 DEBUG [sumeragi] Context update!
1489438011 DEBUG [getPeerList] 1
1489438011 DEBUG [getPeerList] 127.0.0.1 u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1489438011 DEBUG [getPeerList] 1
1489438011 DEBUG [getPeerList] 127.0.0.1 u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1489438011 INFO [sumeragi] initialize numValidatingPeers :1
1489438011 INFO [sumeragi] initialize maxFaulty :0
1489438011 INFO [sumeragi] initialize proxyTailNdx :0
1489438011 INFO [sumeragi] initialize panicCount :0
1489438011 INFO [sumeragi] initialize myPublicKey :u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1489438011 INFO [sumeragi] initialize is sumeragi :1
1489438011 INFO [sumeragi] initialize.....  complete!
1489438011[izanami] startIzanami
1489438011[izanami] �[95m+==ーーーーーーーーーー==+�[0m
1489438011[izanami] �[95m|+-ーーーーーーーーーー-+|�[0m
1489438011[izanami] �[95m||            ||�[0m
1489438011[izanami] �[95m||初回取引履歴構築機構 ||�[0m
1489438011[izanami] �[95m||   イザナミ    ||�[0m
1489438011[izanami] �[95m||            ||�[0m
1489438011[izanami] �[95m|+-ーーーーーーーーーー-+|�[0m
1489438011[izanami] �[95m+==ーーーーーーーーーー==+�[0m
1489438011[izanami] - 起動/setup
1489438011 INFO [izanami] My PublicKey is u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1489438011 INFO [izanami] My key is 127.0.0.1
1489438011 INFO [server] initialize server!
1489438011 INFO [server] start server!
==4782== Thread 10:
==4782== Invalid read of size 1
==4782==    at 0x6606A1: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > Cappuccino::AsioServer::buf_to_string<char*, char*>(char*, char*) (cappuccino.hpp:556)
==4782==    by 0x65B29F: Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}::operator()(std::error_code, unsigned long) const (cappuccino.hpp:572)
==4782==    by 0x681319: asio::detail::binder2<Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}, std::error_code, unsigned long>::operator()() (bind_handler.hpp:163)
==4782==    by 0x67FE3B: void asio::asio_handler_invoke<asio::detail::binder2<Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}, std::error_code, unsigned long> >(asio::detail::binder2<Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}, std::error_code, unsigned long>&, ...) (handler_invoke_hook.hpp:68)
==4782==    by 0x67D9C1: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}, std::error_code, unsigned long>, {lambda(std::error_code)#1}>(asio::detail::binder2<Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}, std::error_code, unsigned long>&, {lambda(std::error_code)#1}&) (handler_invoke_helpers.hpp:37)
==4782==    by 0x679F8A: void asio::detail::handler_work<Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}, asio::system_executor>::complete<asio::detail::binder2<{lambda(std::error_code)#1}, std::error_code, unsigned long> >(asio::detail::binder2<{lambda(std::error_code)#1}, std::error_code, unsigned long>&, {lambda(std::error_code)#1}&) (handler_work.hpp:81)
==4782==    by 0x674C7F: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, Cappuccino::AsioServer::do_accept()::{lambda(std::error_code)#1}::operator()(std::error_code) const::{lambda(std::error_code, unsigned long)#1}>::do_complete(void*, asio::detail::scheduler_operation*, std::error_code const&, unsigned long) (reactive_socket_recv_op.hpp:121)
==4782==    by 0x6512ED: asio::detail::scheduler_operation::complete(void*, std::error_code const&, unsigned long) (scheduler_operation.hpp:39)
==4782==    by 0x65451D: asio::detail::scheduler::do_run_one(asio::detail::conditionally_enabled_mutex::scoped_lock&, asio::detail::scheduler_thread_info&, std::error_code const&) (scheduler.ipp:398)
==4782==    by 0x653E1E: asio::detail::scheduler::run(std::error_code&) (scheduler.ipp:151)
==4782==    by 0x654E0D: asio::io_context::run() (io_context.ipp:61)
==4782==    by 0x65B68D: Cappuccino::AsioServer::run() (cappuccino.hpp:605)
==4782==  Address 0xbf144a0 is on thread 10's stack
==4782==  7984 bytes below stack pointer
==4782== 
1489438013 INFO [sumeragi] receive! Torii
1489438013 DEBUG [sumeragi] Context update!
1489438013 DEBUG [getPeerList] 1
1489438013 DEBUG [getPeerList] 127.0.0.1 u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1489438013 DEBUG [getPeerList] 1
1489438013 DEBUG [getPeerList] 127.0.0.1 u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1489438014 INFO [sumeragi] processTransaction
1489438014 INFO [sumeragi] valid
1489438014 INFO [sumeragi] Add my signature...
1489438014 INFO [sumeragi] hash:958857657e077431b5914f3d4b9ebf55d5233161ddc4d3a9bd5e815fb64443ad
1489438014 INFO [sumeragi] pub: u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8=
1489438014 INFO [sumeragi] priv:cPY84e0BXGUHBjT4QdlPI0LI3BPIfUfSZjB8jdWURkNQ+pEagT/ysrewbt2YUo/Qbfd5vczW5oDooGSNUBTj9g==
==4782== Thread 11:
==4782== Invalid read of size 8
==4782==    at 0x7606EF: sha3_Update (in /home/bogdan/tools/iroha/build/bin/iroha-main)
==4782==    by 0x75EFFE: ed25519_sign (in /home/bogdan/tools/iroha/build/bin/iroha-main)
==4782==    by 0x6D944E: signature::sign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (signature.cpp:100)
==4782==    by 0x683F97: connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (connection_with_grpc.cpp:80)
==4782==    by 0x685221: std::_Function_handler<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}>::_M_invoke(std::_Any_data const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (functional:1857)
==4782==    by 0x689DCB: std::function<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (functional:2267)
==4782==    by 0x688AC2: connection::SumeragiConnectionServiceImpl::Torii(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) (connection_with_grpc.cpp:286)
==4782==    by 0x73062A: grpc::Status std::_Mem_fn_base<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), true>::operator()<grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*, void>(Api::Sumeragi::Service*, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) const (in /home/bogdan/tools/iroha/build/bin/iroha-main)
==4782==    by 0x72EA80: std::_Function_handler<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), std::_Mem_fn<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)> >::_M_invoke(std::_Any_data const&, Api::Sumeragi::Service*&&, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) (functional:1857)
==4782==    by 0x73895E: std::function<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)>::operator()(Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) const (functional:2267)
==4782==    by 0x734B40: grpc::RpcMethodHandler<Api::Sumeragi::Service, Api::Transaction, Api::StatusResponse>::RunHandler(grpc::MethodHandler::HandlerParameter const&) (method_handler_impl.h:59)
==4782==    by 0x5297BD8: grpc::Server::RunRpc() (in /usr/local/lib/libgrpc++.so.1.0.0)
==4782==  Address 0x76edb08 is 7 bytes after a block of size 1 alloc'd
==4782==    at 0x4C2E80F: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4782==    by 0x6D98DC: std::unique_ptr<unsigned char [], std::default_delete<unsigned char []> > signature::vector2UnsignedCharPointer<unsigned char>(std::vector<unsigned char, std::allocator<unsigned char> > const&) (signature.cpp:36)
==4782==    by 0x6D93F5: signature::sign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (signature.cpp:94)
==4782==    by 0x683F97: connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (connection_with_grpc.cpp:80)
==4782==    by 0x685221: std::_Function_handler<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}>::_M_invoke(std::_Any_data const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (functional:1857)
==4782==    by 0x689DCB: std::function<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (functional:2267)
==4782==    by 0x688AC2: connection::SumeragiConnectionServiceImpl::Torii(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) (connection_with_grpc.cpp:286)
==4782==    by 0x73062A: grpc::Status std::_Mem_fn_base<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), true>::operator()<grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*, void>(Api::Sumeragi::Service*, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) const (in /home/bogdan/tools/iroha/build/bin/iroha-main)
==4782==    by 0x72EA80: std::_Function_handler<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), std::_Mem_fn<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)> >::_M_invoke(std::_Any_data const&, Api::Sumeragi::Service*&&, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) (functional:1857)
==4782==    by 0x73895E: std::function<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)>::operator()(Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) const (functional:2267)
==4782==    by 0x734B40: grpc::RpcMethodHandler<Api::Sumeragi::Service, Api::Transaction, Api::StatusResponse>::RunHandler(grpc::MethodHandler::HandlerParameter const&) (method_handler_impl.h:59)
==4782==    by 0x5297BD8: grpc::Server::RunRpc() (in /usr/local/lib/libgrpc++.so.1.0.0)
==4782== 
==4782== Use of uninitialised value of size 8
==4782==    at 0x6DAEC2: base64::vendor::base64_encode[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int) (base64.cpp:74)
==4782==    by 0x6DB47A: base64::encode[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&) (base64.cpp:167)
==4782==    by 0x6D94C0: signature::sign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (signature.cpp:103)
==4782==    by 0x683F97: connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (connection_with_grpc.cpp:80)
==4782==    by 0x685221: std::_Function_handler<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}>::_M_invoke(std::_Any_data const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (functional:1857)
==4782==    by 0x689DCB: std::function<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (functional:2267)
==4782==    by 0x688AC2: connection::SumeragiConnectionServiceImpl::Torii(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) (connection_with_grpc.cpp:286)
==4782==    by 0x73062A: grpc::Status std::_Mem_fn_base<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), true>::operator()<grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*, void>(Api::Sumeragi::Service*, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) const (in /home/bogdan/tools/iroha/build/bin/iroha-main)
==4782==    by 0x72EA80: std::_Function_handler<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), std::_Mem_fn<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)> >::_M_invoke(std::_Any_data const&, Api::Sumeragi::Service*&&, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) (functional:1857)
==4782==    by 0x73895E: std::function<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)>::operator()(Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) const (functional:2267)
==4782==    by 0x734B40: grpc::RpcMethodHandler<Api::Sumeragi::Service, Api::Transaction, Api::StatusResponse>::RunHandler(grpc::MethodHandler::HandlerParameter const&) (method_handler_impl.h:59)
==4782==    by 0x5297BD8: grpc::Server::RunRpc() (in /usr/local/lib/libgrpc++.so.1.0.0)
==4782== 
==4782== Use of uninitialised value of size 8
==4782==    at 0x6DAF8A: base64::vendor::base64_encode[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int) (base64.cpp:92)
==4782==    by 0x6DB47A: base64::encode[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&) (base64.cpp:167)
==4782==    by 0x6D94C0: signature::sign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (signature.cpp:103)
==4782==    by 0x683F97: connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (connection_with_grpc.cpp:80)
==4782==    by 0x685221: std::_Function_handler<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), connection::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}>::_M_invoke(std::_Any_data const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (functional:1857)
==4782==    by 0x689DCB: std::function<Api::RecieverConfirmation (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (functional:2267)
==4782==    by 0x688AC2: connection::SumeragiConnectionServiceImpl::Torii(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) (connection_with_grpc.cpp:286)
==4782==    by 0x73062A: grpc::Status std::_Mem_fn_base<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), true>::operator()<grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*, void>(Api::Sumeragi::Service*, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) const (in /home/bogdan/tools/iroha/build/bin/iroha-main)
==4782==    by 0x72EA80: std::_Function_handler<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*), std::_Mem_fn<grpc::Status (Api::Sumeragi::Service::*)(grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)> >::_M_invoke(std::_Any_data const&, Api::Sumeragi::Service*&&, grpc::ServerContext*&&, Api::Transaction const*&&, Api::StatusResponse*&&) (functional:1857)
==4782==    by 0x73895E: std::function<grpc::Status (Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*)>::operator()(Api::Sumeragi::Service*, grpc::ServerContext*, Api::Transaction const*, Api::StatusResponse*) const (functional:2267)
==4782==    by 0x734B40: grpc::RpcMethodHandler<Api::Sumeragi::Service, Api::Transaction, Api::StatusResponse>::RunHandler(grpc::MethodHandler::HandlerParameter const&) (method_handler_impl.h:59)
==4782==    by 0x5297BD8: grpc::Server::RunRpc() (in /usr/local/lib/libgrpc++.so.1.0.0)
==4782== 
1489438014 INFO [sumeragi] sig: V1hOWB5ASXv/9ajn+mOyj5AXPrfNMo5h8s0LBGkw7HtxFbNkVnNy16JjjCDY7BNgm+Qjh9QWRoaC0vkYZeMfDA==

Use junit for java tests

Current java tests at smart_contract/instances/test just use err stream and don't called in ctest

make[2]: *** [core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/http_server_with_cappuccino.cpp.o] Error 1

Yesterday and this morning (JST), Iroha can't build and show below messages.

[ 70%] Building CXX object core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/http_server_with_cappuccino.cpp.o
/opt/iroha/core/infra/server/http_server_with_cappuccino.cpp: In function 'void http::server(std::map<std::__cxx11::basic_string, std::function<int(json_parse::Object)> >)':
/opt/iroha/core/infra/server/http_server_with_cappuccino.cpp:89:10: error: no matching function for call to 'route(const std::__cxx11::basic_string&, http::server(std::map<std::__cxx11::basic_string, std::function<int(json_parse::Object)> >)::<lambda(std::shared_ptrCappuccino::Request)>)'
});
^
In file included from /opt/iroha/core/infra/server/http_server_with_cappuccino.cpp:20:0:
/opt/iroha/core/infra/server/../../vendor/Cappuccino/cappuccino.hpp:551:7: note: candidate: template<Cappuccino::Method m> void Cappuccino::route(const string&, std::function<Cappuccino::Response(std::shared_ptrCappuccino::Request)>)
void route(const string& path,std::function<Response(std::shared_ptr)> F){
^
/opt/iroha/core/infra/server/../../vendor/Cappuccino/cappuccino.hpp:551:7: note: template argument deduction/substitution failed:
/opt/iroha/core/infra/server/http_server_with_cappuccino.cpp:89:10: note: couldn't deduce template parameter 'm'
});
^
In file included from /opt/iroha/core/infra/server/http_server_with_cappuccino.cpp:20:0:
/opt/iroha/core/infra/server/../../vendor/Cappuccino/cappuccino.hpp: At global scope:
/opt/iroha/core/infra/server/../../vendor/Cappuccino/cappuccino.hpp:110:15: warning: 'void Cappuccino::Log::info(const string&)' defined but not used [-Wunused-function]
static void info(const string& msg){
^
core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/build.make:62: recipe for target 'core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/http_server_with_cappuccino.cpp.o' failed
make[2]: *** [core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/http_server_with_cappuccino.cpp.o] Error 1
CMakeFiles/Makefile2:857: recipe for target 'core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/all' failed
make[1]: *** [core/infra/server/CMakeFiles/http_server_with_cappuccino.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c make' returned a non-zero code: 2

View change is needed

Given 4 servers in the following validation chain:

A --- B --- C --- D

{A,B,C} will be the validators (with A as the スメラギ and C as the proxy tail).

As A is the スメラギ (leader), if A fails or exhibits any kind of Byzantine faulty behavior, it needs to be moved to the end of the validation chain and a new スメラギ is needed. Changing the order of the validating peers is called a view change.

If the スメラギ is faulty, there are the following possibilities:

  1. スメラギ will not reply to the client
  2. スメラギ will reply to the client, but not forward the transaction

Given that スメラギ will send cryptographic receipt of a transaction to the client, for 1., above, スメラギ can be proved to be faulty by the client, if the client provides the cryptographic proof from the スメラギ to any of the other servers (for example, B and/or C), but the other servers did not receive the transaction, then A is provably faulty and a view change is needed.

The view change algorithm is as follows:

  • If a server suspects the leader or receives 2f+1 view change messages, it sends a view change message to every server, saying the new node order. Proof of faulty behavior is used to get others to suspect the head. There are 2 types of proof: 1) no reply from the スメラギ when pinged, or 2) signed receipt of a transaction from スメラギ, though the スメラギ never sent the transaction to other servers.

  • When the new スメラギ server receives 2f+1 view change messages, it issues a new view message to all servers, stating the new node order.

test "connection with grps" fails

I am working on #177, the latest commit should repair circle ci and build process. But grpc test fails.

https://circleci.com/gh/hyperledger/iroha/1387

[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from ConnectionWithGrpc
[ RUN      ] ConnectionWithGrpc.Transaction_Add_Domain
1488296986 DEBUG [config] load json is {
    "database_path": "/tmp/iroha_ledger",
    "concurrency": 0,
    "max_faulty_peers": 1,
    "pool_worker_queue_size": 1024,
    "http_port": 1204,
    "grpc_port": 50051
}
1488296986 DEBUG [config] load json is {
  "group": [
    {
      "ip": "127.0.0.1",
      "name": "da77880a3da4",
      "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
    }
  ],
  "me": {
    "ip": "127.0.0.1",
    "name": "da77880a3da4",
    "privateKey": "cPY84e0BXGUHBjT4QdlPI0LI3BPIfUfSZjB8jdWURkNQ+pEagT/ysrewbt2YUo/Qbfd5vczW5oDooGSNUBTj9g==",
    "publicKey": "u7X/zQ/Dq21WW7YH4rbkpiCYJXjPxk5t3qNDKiVwBx8="
  }
}
1488296986 INFO [connection] Operation
1488296986 INFO [connection] size: 0
1488296986 INFO [connection] name: 
1488296986 INFO [connection] size: 0
1488296986 INFO [connection] response: OK
[       OK ] ConnectionWithGrpc.Transaction_Add_Domain (10 ms)
[ RUN      ] ConnectionWithGrpc.Transaction_Add_Asset
1488296986 INFO [connection] Operation
1488296986 INFO [connection] size: 0
1488296986 INFO [connection] name: nao
1488296986 INFO [connection] size: 0
/opt/iroha/test/connection/connection_with_grpc_test.cpp:50: Failure
      Expected: event.transaction().domain().name().c_str()
      Which is: ""
To be equal to: "name"
1488296986 INFO [connection] response: OK
[  FAILED  ] ConnectionWithGrpc.Transaction_Add_Asset (3 ms)
[----------] 2 tests from ConnectionWithGrpc (14 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (15 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] ConnectionWithGrpc.Transaction_Add_Asset

 1 FAILED TEST

Inter-ledger transactions between Sawtooth Lake and Iroha

We would like to realize inter-ledger transactions between Sawtooth Lake and Iroha. To do this we need to:

① Define a protocol for inter-ledger transactions

and then

② implement the protocol in Sawtooth Lake and Iroha.

Related to ①, we should probably consider the following:

  • 2 phase commit
  • multi-signature transaction

I have a feeling that multi-signature transactions might be a good way to realize this protocol, but I need to think more about this. Does anyone have any ideas?

Sawtooth Lake transaction documentation is here:

http://intelledger.github.io/0.8/architecture/transactions_and_batches.html

Detect a lot of memory leaks when invoking JVM

Valgrind detects a lot of memory leak errors in all programs invoking JVM. I don't know whether it comes from Java or C++ native code. If it comes from Java, is it a correct behavior? Is it needed to force garbage collection in Java?
Following result comes from valgrind --leak-check=full ./test_bin/java_data_structure_test.
Memory leaks are detected in all tests (java_query_repo_*) using JVM.

==12719==
==12719== LEAK SUMMARY:
==12719==    definitely lost: 570 bytes in 4 blocks
==12719==    indirectly lost: 0 bytes in 0 blocks
==12719==      possibly lost: 3,353,842 bytes in 174 blocks
==12719==    still reachable: 8,977,521 bytes in 2,037 blocks
==12719==                       of which reachable via heuristic:
==12719==                         newarray           : 22,536 bytes in 1 blocks
==12719==         suppressed: 0 bytes in 0 blocks
==12719== Reachable blocks (those to which a pointer was found) are not shown.
==12719== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==12719==
==12719== For counts of detected and suppressed errors, rerun with: -v
==12719== Use --track-origins=yes to see where uninitialised values come from
==12719== ERROR SUMMARY: 292370 errors from 763 contexts (suppressed: 0 from 0)

Inter-ledger transactions between Fabric and Iroha

We would like to realize inter-ledger transactions between Fabric and Iroha. To do this we need to:

① Define a protocol for inter-ledger transactions

and then

② implement the protocol in Fabric and Iroha.

Related to ①, we should probably consider the following:

  • 2 phase commit
  • multi-signature transaction

I have a feeling that multi-signature transactions might be a good way to realize this protocol, but I need to think more about this. Does anyone have any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.