Skip to content

Commit

Permalink
Merge branch 'develop' into hotfix/try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
motxx authored Jan 19, 2017
2 parents 5fa10ec + b86cb0d commit e6629ea
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 57 deletions.
60 changes: 27 additions & 33 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,45 @@
machine:
services:
- docker
environment:
IROHA_HOME: $(pwd)/iroha
PATH: $PATH:/opt/cmake-3.5.2-Linux-x86_64/bin
JAVA_HOME: /usr/lib/jvm/java-1.8.0-openjdk-amd64/
java:
version: 'oraclejdk8'
pre:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install g++-5
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
- g++ -v

- sudo apt-get -y install build-essential libtcmalloc-minimal4 && sudo ln -s /usr/lib/libtcmalloc_minimal.so.4 /usr/lib/libtcmalloc_minimal.so
- sudo apt-get -y install xsltproc
- sudo apt-get -y install libhdf5-serial-dev libleveldb-dev libsnappy-dev liblmdb-dev
- sudo apt-get -y install autoconf automake libtool unzip


checkout:
post:
- git submodule init
- git submodule update

- cd $IROHA_HOME
- cd $IROHA_HOME/core/vendor/leveldb; make -j 4
- cd $IROHA_HOME/core/vendor/ed25519; make -j 4
- cd $IROHA_HOME/core/vendor/Cappuccino; git pull origin master
- cd $IROHA_HOME/core/vendor/KeccakCodePackage; make; make generic64/libkeccak.a
- cd $IROHA_HOME/core/infra/crypto/; make
- git submodule sync
- git submodule update --init --recursive

dependencies:
cache_directories:
- ~/iroha/core/vendor/
- /tmp/protobuf
- /tmp/grpc
pre:
- if [[ ! -e /tmp/protobuf ]]; then git clone -b v3.0.0 https://github.com/google/protobuf.git /tmp/protobuf; cd /tmp/protobuf; (git cherry-pick 1760feb621a913189b90fe8595fffb74bce84598; echo Force continue); cd /tmp/protobuf; ./autogen.sh; ./configure --prefix=/usr; make -j 4; fi;
- cd /tmp/protobuf; sudo make install
- protoc --version
- ~/docker
override:
# one way to cache iroha-dev container is to save it to tar image. 2 mins vs 10 mins without caching.
- if [[ -e ~/docker/iroha-dev.tar ]]; then docker load -i ~/docker/iroha-dev.tar; fi
# build iroha-dev (if it is in cache, this step will be skipped) and iroha-docker (production) images
- ${IROHA_HOME}/docker/build.sh
# cache iroha-dev image. takes 30 sec to save into file
- mkdir -p ~/docker; docker save hyperledger/iroha-dev > ~/docker/iroha-dev.tar

- if [[ ! -e /tmp/grpc ]]; then git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc /tmp/grpc; cd /tmp/grpc; git submodule update --init; make -j 4; fi;
- cd /tmp/grpc; sudo make install
- which grpc_cpp_plugin

test:
pre:
- mkdir build; cd build; cmake ..; make
override:
- ./test.sh
# TESTS:
# first, run ctest inside a container
- docker run -p 1204:1204 hyperledger/iroha-docker /test.sh
# then, run iroha with dummy config (1 node) and test curl request
- docker run -d -p 1204:1204 hyperledger/iroha-docker /run.sh && sleep 5 && curl -X POST http://127.0.0.1:1204/account/register -d '{"publicKey":"WdvM/DPabapmtA7ISbTYPywbHxk8gWu2221LzmcmAgw=","alias":"yonezu","timestamp":1482053586}'


deployment:
hub:
branch: master
commands:
- docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
- docker push hyperledger/iroha-docker

8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
- 8000

iroha1:
image: hyperledger/iroha
image: hyperledger/iroha-docker
depends_on:
- configdiscovery
expose:
Expand All @@ -38,7 +38,7 @@ services:


iroha2:
image: hyperledger/iroha
image: hyperledger/iroha-docker
depends_on:
- configdiscovery
expose:
Expand All @@ -51,7 +51,7 @@ services:


iroha3:
image: hyperledger/iroha
image: hyperledger/iroha-docker
depends_on:
- configdiscovery
expose:
Expand All @@ -64,7 +64,7 @@ services:


iroha4:
image: hyperledger/iroha
image: hyperledger/iroha-docker
depends_on:
- configdiscovery
expose:
Expand Down
6 changes: 3 additions & 3 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ if [ -z ${IROHA_HOME} ]; then
fi

# build iroha-dev image
docker build -t hyperledger/iroha-dev ${IROHA_HOME}/docker/dev
docker build --rm=false -t hyperledger/iroha-dev ${IROHA_HOME}/docker/dev

# run dev container to build iroha
docker run -i --rm \
docker run -i \
-v ${IROHA_HOME}/docker/build:/build \
-v ${IROHA_HOME}:/opt/iroha \
hyperledger/iroha-dev \
Expand All @@ -24,4 +24,4 @@ docker run -i --rm \
COMMANDS

# build hyperledger/iroha container
docker build -t hyperledger/iroha ${IROHA_HOME}/docker/build
docker build --rm=false -t hyperledger/iroha-docker ${IROHA_HOME}/docker/build
13 changes: 8 additions & 5 deletions docker/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#-----------------------------------------------------------------------
# iroha-rel - IROHA container for Release
#
# build : docker build -t hyperledger/iroha .
# build : docker build -t hyperledger/iroha-docker .
#
# Copyright (c) 2016 Soramitsu,Co.,Ltd.
# All Rights Reserved.
Expand All @@ -11,8 +11,8 @@ FROM ubuntu

MAINTAINER Takeshi Yonezu <[email protected]> / Bogdan Vaneev <[email protected]>

LABEL BUILD="docker build -t hyperledger/iroha ."
LABEL RUN="docker run -d --name iroha hyperledger/iroha"
LABEL BUILD="docker build -t hyperledger/iroha-docker ."
LABEL RUN="docker run -d --name iroha hyperledger/iroha-docker"

ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
# IROHA_HOME here should be the same as IROHA_RELEASE in iroha-dev
Expand All @@ -21,17 +21,20 @@ ENV IROHA_HOME=/usr/local/iroha
# this copies iroha and unpacks its binaries
ADD ./iroha.tar /
ADD ./scripts /
ADD ./config/sumeragi.json /tmp/sumeragi.json

RUN groupadd -g 168 iroha && \
useradd -u 168 -c "IROHA Administrator" -s /bin/bash -m -d ${IROHA_HOME} -p $(perl -e "print(crypt('passw0rd', 'sa'));") -g iroha iroha && \
usermod -G adm,sudo iroha && \
echo "export IROHA_HOME=${IROHA_HOME}" >> ${IROHA_HOME}/.bashrc && \
echo "export JAVA_HOME=${JAVA_HOME}" >> ${IROHA_HOME}/.bashrc; \

apt update && apt -y upgrade && apt -y install default-jdk netcat libsnappy-dev; \

echo /usr/local/lib >>/etc/ld.so.conf && \
echo ${IROHA_HOME}/lib >>/etc/ld.so.conf && \

mkdir -p ${IROHA_HOME}/config && \
cp /tmp/sumeragi.json ${IROHA_HOME}/config/sumeragi.json && \

ldconfig

CMD ["/run.sh"]
25 changes: 24 additions & 1 deletion docker/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,28 @@ This directory will be mounted to `iroha-dev` container. After successful build,

Then, to build iroha container, run:
```
docker build -t hyperledger/iroha .
docker build -t hyperledger/iroha-docker .
```


# Default config

Default `sumeragi.json` is

```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="
}
}
```
15 changes: 15 additions & 0 deletions docker/build/config/sumeragi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"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="
}
}
8 changes: 8 additions & 0 deletions docker/build/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

total=0
for file in ${IROHA_HOME}/test_bin/*; do
./${file}
total=$((total + $?))
done
exit 0
2 changes: 2 additions & 0 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ RUN apt-get update && apt-get -y upgrade; \
curl \
git \
make \
build-essential \
cmake \
g++-5 \
gcc-5 \
default-jdk \
Expand Down
27 changes: 18 additions & 9 deletions docker/dev/scripts/build-iroha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@ fi


# build dependencies
(cd $IROHA_HOME/core/vendor/leveldb && make -j4) || error "Can't build leveldb submodule"
(cd $IROHA_HOME/core/vendor/ed25519 && make -j4) || error "Can't build ed25519 submodule"
(cd $IROHA_HOME/core/vendor/KeccakCodePackage && \
make -j4 && \
make -j4 generic64/libkeccak.a) || error "Can't build KeccakCodePackage submodule"
(cd $IROHA_HOME/core/infra/crypto && make -j4) || error "Can't build crypto submodule"
cd $IROHA_HOME/core/vendor/leveldb
make clean 2>/dev/null 1>&2
make -j4 || error "Can't build leveldb submodule"

cd $IROHA_HOME/core/vendor/ed25519
make clean 2>/dev/null 1>&2
make -j4 || error "Can't build ed25519 submodule"

cd $IROHA_HOME/core/vendor/KeccakCodePackage
make clean 2>/dev/null 1>&2
(make -j4 && make -j4 generic64/libkeccak.a) || error "Can't build KeccakCodePackage submodule"

cd $IROHA_HOME/core/infra/crypto
make clean 2>/dev/null 1>&2
make -j4 || error "Can't build crypto submodule"

# build iroha (important: build using single thread!)
(mkdir -p $IROHA_BUILD || echo "[+] build directory already exists, rebuilding") && \
cd $IROHA_BUILD && \
cmake $IROHA_HOME && \
mkdir -p $IROHA_BUILD && \
cd $IROHA_BUILD && \
cmake $IROHA_HOME && \
make || error "Can't build iroha"
3 changes: 2 additions & 1 deletion docker/dev/scripts/mktar-iroha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ if [ -z ${IROHA_RELEASE} ]; then
exit 1
fi

cd ${IROHA_RELEASE}
cd ${IROHA_RELEASE} || (echo "[-] No folder ${IROHA_RELEASE}" && exit 1)

rsync -av ${IROHA_BUILD}/bin $IROHA_RELEASE && \
rsync -av ${IROHA_BUILD}/lib $IROHA_RELEASE && \
rsync -av ${IROHA_BUILD}/my_test_bin $IROHA_RELEASE && \
Expand Down
6 changes: 5 additions & 1 deletion docs/iroha_whitepaper.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Iroha v1.0 (draft)#

The following is a specification for Iroha 1.0. Many parts are still in development and have not yet been implemented, but for the sake of design, this document is generally written in the present tense. Future revisions will annotate the development status of the various sections.
The following is a specification for Iroha 1.0. Many parts are still in development and have not yet been implemented, but for the sake of design, this document is generally written in the present tense.

---

Expand Down Expand Up @@ -31,6 +31,8 @@ Having a solid distributed ledger system is not useful if there are no applicati

### 2.1. P2P Network

***Development status: currently all peers are validating peers***

Generally, 3*f*+1 nodes are needed to tolerate *f* Byzantine nodes in the network (albeit some consensus algorithms have higher node requirements). The number of *f* that a system should be made to tolerate should be determined by the system maintainer, based on the requirements for expected use cases.

The following node types are considered:
Expand All @@ -41,6 +43,8 @@ The following node types are considered:

### 2.2. Membership service

***Development status: add/remove peer functions are currently in development. ETA: before end of February***

Membership is provided in a decentralized way, on ledger. By default 2*f*+1 signatures are needed to confirm adding or removing nodes to the network.

In future work, it is planned to add finer granularity permissions, similar to unix style permissions an membership groups.
Expand Down

0 comments on commit e6629ea

Please sign in to comment.