Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feature/itf-get-pendin…
Browse files Browse the repository at this point in the history
…g-txs

Signed-off-by: Igor Egorov <igor@soramitsu.co.jp>
  • Loading branch information
Igor Egorov committed Sep 1, 2018
2 parents eb2436e + a194db8 commit 719d6d4
Show file tree
Hide file tree
Showing 145 changed files with 859 additions and 1,061 deletions.
2 changes: 1 addition & 1 deletion .jenkinsci/debug-build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def doDebugBuild(coverageEnabled=false) {
['PARALLELISM': parallelism])
// push Docker image in case the current branch is develop,
// or it is a commit into PR which base branch is develop (usually develop -> master)
if ((GIT_LOCAL_BRANCH == 'develop' || CHANGE_BRANCH_LOCAL == 'develop') && manifest.manifestSupportEnabled()) {
if ((GIT_LOCAL_BRANCH == 'develop' || CHANGE_BRANCH_LOCAL == 'develop' || GIT_LOCAL_BRANCH == 'dev' || CHANGE_BRANCH_LOCAL == 'dev') && manifest.manifestSupportEnabled()) {
manifest.manifestCreate("${DOCKER_REGISTRY_BASENAME}:develop-build",
["${DOCKER_REGISTRY_BASENAME}:x86_64-develop-build",
"${DOCKER_REGISTRY_BASENAME}:armv7l-develop-build",
Expand Down
2 changes: 1 addition & 1 deletion .jenkinsci/docker-pull-or-build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def dockerPullOrUpdate(imageName, currentDockerfileURL, previousDockerfileURL, r
}
}
}
if (GIT_LOCAL_BRANCH ==~ /develop|master/ || CHANGE_BRANCH_LOCAL == 'develop') {
if (GIT_LOCAL_BRANCH ==~ /develop|master|dev/ || CHANGE_BRANCH_LOCAL == 'develop' || CHANGE_BRANCH_LOCAL == 'dev') {
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
iC.push(imageName)
}
Expand Down
3 changes: 3 additions & 0 deletions .jenkinsci/doxygen.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env groovy

def doDoxygen() {
// TODO: Remove this comment once dev branch will return to develop
// I will not be changing branches here. It requires some rewriting
// Hope dev branch situation will be resolved soon
if (env.GIT_LOCAL_BRANCH in ["master","develop"] || env.CHANGE_BRANCH_LOCAL == 'develop') {
def branch = env.CHANGE_BRANCH_LOCAL == 'develop' ? env.CHANGE_BRANCH_LOCAL : env.GIT_LOCAL_BRANCH
sh "doxygen Doxyfile"
Expand Down
2 changes: 1 addition & 1 deletion .jenkinsci/linux-post-step.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def linuxPostStep() {
timeout(time: 600, unit: "SECONDS") {
try {
if (currentBuild.currentResult == "SUCCESS" && GIT_LOCAL_BRANCH ==~ /(master|develop)/) {
if (currentBuild.currentResult == "SUCCESS" && GIT_LOCAL_BRANCH ==~ /(master|develop|dev)/) {
def artifacts = load ".jenkinsci/artifacts.groovy"
def commit = env.GIT_COMMIT
def platform = sh(script: 'uname -m', returnStdout: true).trim()
Expand Down
2 changes: 1 addition & 1 deletion .jenkinsci/release-build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def doReleaseBuild() {

// push Docker image in case the current branch is develop,
// or it is a commit into PR which base branch is develop (usually develop -> master)
if (GIT_LOCAL_BRANCH == 'develop' || CHANGE_BRANCH_LOCAL == 'develop') {
if (GIT_LOCAL_BRANCH == 'develop' || CHANGE_BRANCH_LOCAL == 'develop' || GIT_LOCAL_BRANCH == 'dev' || CHANGE_BRANCH_LOCAL == 'dev') {
iCRelease.push("${platform}-develop")
if (manifest.manifestSupportEnabled()) {
manifest.manifestCreate("${DOCKER_REGISTRY_BASENAME}:develop",
Expand Down
22 changes: 11 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pipeline {
CHANGE_BRANCH_LOCAL = env.CHANGE_BRANCH
}
catch(MissingPropertyException e) { }
if (GIT_LOCAL_BRANCH != "develop" && CHANGE_BRANCH_LOCAL != "develop") {
if (GIT_LOCAL_BRANCH != "develop" && CHANGE_BRANCH_LOCAL != "develop" && GIT_LOCAL_BRANCH != "dev" && CHANGE_BRANCH_LOCAL != "dev") {
def builds = load ".jenkinsci/cancel-builds-same-job.groovy"
builds.cancelSameJobBuilds()
}
Expand All @@ -80,13 +80,13 @@ pipeline {
script {
debugBuild = load ".jenkinsci/debug-build.groovy"
coverage = load ".jenkinsci/selected-branches-coverage.groovy"
if (coverage.selectedBranchesCoverage(['develop', 'master'])) {
if (coverage.selectedBranchesCoverage(['develop', 'master', 'dev'])) {
debugBuild.doDebugBuild(true)
}
else {
debugBuild.doDebugBuild()
}
if (GIT_LOCAL_BRANCH ==~ /(master|develop)/) {
if (GIT_LOCAL_BRANCH ==~ /(master|develop|dev)/) {
releaseBuild = load ".jenkinsci/release-build.groovy"
releaseBuild.doReleaseBuild()
}
Expand All @@ -111,13 +111,13 @@ pipeline {
script {
debugBuild = load ".jenkinsci/debug-build.groovy"
coverage = load ".jenkinsci/selected-branches-coverage.groovy"
if (!params.x86_64_linux && !params.armv8_linux && !params.x86_64_macos && (coverage.selectedBranchesCoverage(['develop', 'master']))) {
if (!params.x86_64_linux && !params.armv8_linux && !params.x86_64_macos && (coverage.selectedBranchesCoverage(['develop', 'master', 'dev']))) {
debugBuild.doDebugBuild(true)
}
else {
debugBuild.doDebugBuild()
}
if (GIT_LOCAL_BRANCH ==~ /(master|develop)/) {
if (GIT_LOCAL_BRANCH ==~ /(master|develop|dev)/) {
releaseBuild = load ".jenkinsci/release-build.groovy"
releaseBuild.doReleaseBuild()
}
Expand All @@ -142,13 +142,13 @@ pipeline {
script {
debugBuild = load ".jenkinsci/debug-build.groovy"
coverage = load ".jenkinsci/selected-branches-coverage.groovy"
if (!params.x86_64_linux && !params.x86_64_macos && (coverage.selectedBranchesCoverage(['develop', 'master']))) {
if (!params.x86_64_linux && !params.x86_64_macos && (coverage.selectedBranchesCoverage(['develop', 'master', 'dev']))) {
debugBuild.doDebugBuild(true)
}
else {
debugBuild.doDebugBuild()
}
if (GIT_LOCAL_BRANCH ==~ /(master|develop)/) {
if (GIT_LOCAL_BRANCH ==~ /(master|develop|dev)/) {
releaseBuild = load ".jenkinsci/release-build.groovy"
releaseBuild.doReleaseBuild()
}
Expand All @@ -174,7 +174,7 @@ pipeline {
def coverageEnabled = false
def cmakeOptions = ""
coverage = load ".jenkinsci/selected-branches-coverage.groovy"
if (!params.x86_64_linux && (coverage.selectedBranchesCoverage(['develop', 'master']))) {
if (!params.x86_64_linux && (coverage.selectedBranchesCoverage(['develop', 'master', 'dev']))) {
coverageEnabled = true
cmakeOptions = " -DCOVERAGE=ON "
}
Expand Down Expand Up @@ -233,7 +233,7 @@ pipeline {
sh "python /usr/local/bin/lcov_cobertura.py build/reports/coverage.info -o build/reports/coverage.xml"
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/build/reports/coverage.xml', conditionalCoverageTargets: '75, 50, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '75, 50, 0', maxNumberOfBuilds: 50, methodCoverageTargets: '75, 50, 0', onlyStable: false, zoomCoverageChart: false
}
if (GIT_LOCAL_BRANCH ==~ /(master|develop)/) {
if (GIT_LOCAL_BRANCH ==~ /(master|develop|dev)/) {
releaseBuild = load ".jenkinsci/mac-release-build.groovy"
releaseBuild.doReleaseBuild()
}
Expand All @@ -244,7 +244,7 @@ pipeline {
script {
timeout(time: 600, unit: "SECONDS") {
try {
if (currentBuild.currentResult == "SUCCESS" && GIT_LOCAL_BRANCH ==~ /(master|develop)/) {
if (currentBuild.currentResult == "SUCCESS" && GIT_LOCAL_BRANCH ==~ /(master|develop|dev)/) {
def artifacts = load ".jenkinsci/artifacts.groovy"
def commit = env.GIT_COMMIT
filePaths = [ '\$(pwd)/build/*.tar.gz' ]
Expand Down Expand Up @@ -351,7 +351,7 @@ pipeline {
script {
timeout(time: 600, unit: "SECONDS") {
try {
if (currentBuild.currentResult == "SUCCESS" && GIT_LOCAL_BRANCH ==~ /(master|develop)/) {
if (currentBuild.currentResult == "SUCCESS" && GIT_LOCAL_BRANCH ==~ /(master|develop|dev)/) {
def artifacts = load ".jenkinsci/artifacts.groovy"
def commit = env.GIT_COMMIT
filePaths = [ '\$(pwd)/build/*.tar.gz' ]
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Schema
message CreateAccount {
string account_name = 1;
string domain_id = 2;
bytes main_pubkey = 3;
bytes public_key = 3;
}
Structure
Expand All @@ -197,7 +197,7 @@ Structure

"Account name", "domain-unique name for account", "`[a-z_0-9]{1,32}`", "morgan_stanley"
"Domain ID", "target domain to make relation with", "should be created before the account", "america"
"Main pubkey", "first public key to add to the account", "ed25519 public key", "407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83"
"Public key", "first public key to add to the account", "ed25519 public key", "407e57f50ca48969b08ba948171bb2435e035d82cec417e18e4a38f5fb113f83"

Validation
^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions example/genesis.block
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
"createAccount":{
"accountName":"admin",
"domainId":"test",
"mainPubkey":"MToH5jhHdu2VRHcQ0V5ZFIRzzPwFKmgTF6cqafKkmRA="
"publicKey":"MToH5jhHdu2VRHcQ0V5ZFIRzzPwFKmgTF6cqafKkmRA="
}
},
{
"createAccount":{
"accountName":"test",
"domainId":"test",
"mainPubkey":"cW/lBfafGFEaGwg5Faqf9z7zbmaIGZ85WXUNs4uPS/w="
"publicKey":"cW/lBfafGFEaGwg5Faqf9z7zbmaIGZ85WXUNs4uPS/w="
}
},
{
Expand Down
22 changes: 12 additions & 10 deletions example/python/tx-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

user1_kp = crypto.generateKeypair()

current_time = int(round(time.time() * 1000)) - 10**5
def current_time():
return int(round(time.time() * 1000))

creator = "admin@test"

query_counter = 1
Expand Down Expand Up @@ -121,7 +123,7 @@ def create_asset_coin():
Create domain "domain" and asset "coin#domain" with precision 2
"""
tx = tx_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.createDomain("domain", "user") \
.createAsset("coin", "domain", 2).build()

Expand All @@ -134,7 +136,7 @@ def add_coin_to_admin():
Add 1000.00 asset quantity of asset coin to admin
"""
tx = tx_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.addAssetQuantity("coin#domain", "1000.00").build()

send_tx(tx, key_pair)
Expand All @@ -146,7 +148,7 @@ def create_account_userone():
Create account "userone@domain"
"""
tx = tx_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.createAccount("userone", "domain", user1_kp.publicKey()).build()

send_tx(tx, key_pair)
Expand All @@ -157,7 +159,7 @@ def transfer_coin_from_admin_to_userone():
Transfer 2.00 of coin from admin@test to userone@domain
"""
tx = tx_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.transferAsset("admin@test", "userone@domain", "coin#domain", "Some message", "2.00").build()

send_tx(tx, key_pair)
Expand All @@ -168,7 +170,7 @@ def grant_admin_to_add_detail_to_userone():
Grant admin@test to be able to set details information to userone@domain
"""
tx = tx_builder.creatorAccountId("userone@domain") \
.createdTime(current_time) \
.createdTime(current_time()) \
.grantPermission(creator, iroha.Grantable_kSetMyAccountDetail) \
.build()

Expand All @@ -180,7 +182,7 @@ def set_age_to_userone_by_admin():
Set age to userone@domain by admin@test
"""
tx = tx_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.setAccountDetail("userone@domain", "age", "18") \
.build()

Expand All @@ -194,7 +196,7 @@ def get_coin_info():
global query_counter
query_counter += 1
query = query_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.queryCounter(query_counter) \
.getAssetInfo("coin#domain") \
.build()
Expand All @@ -219,7 +221,7 @@ def get_account_asset():
global query_counter
query_counter += 1
query = query_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.queryCounter(query_counter) \
.getAccountAssets("userone@domain") \
.build()
Expand All @@ -235,7 +237,7 @@ def get_userone_info():
global query_counter
query_counter += 1
query = query_builder.creatorAccountId(creator) \
.createdTime(current_time) \
.createdTime(current_time()) \
.queryCounter(query_counter) \
.getAccountDetail("userone@domain") \
.build()
Expand Down
7 changes: 4 additions & 3 deletions irohad/ametsuchi/impl/peer_query_wsv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
* limitations under the License.
*/

#include "ametsuchi/impl/peer_query_wsv.hpp"

#include <numeric>

#include "ametsuchi/impl/peer_query_wsv.hpp"
#include "ametsuchi/wsv_query.hpp"
#include "builders/protobuf/common_objects/proto_peer_builder.hpp"

namespace iroha {
namespace ametsuchi {

PeerQueryWsv::PeerQueryWsv(std::shared_ptr<WsvQuery> wsv)
: wsv_(std::move(wsv)) {}

boost::optional<std::vector<PeerQuery::wPeer>> PeerQueryWsv::getLedgerPeers() {
boost::optional<std::vector<PeerQuery::wPeer>>
PeerQueryWsv::getLedgerPeers() {
auto peers = wsv_->getPeers();
if (peers) {
return boost::make_optional(peers.value());
Expand Down
32 changes: 17 additions & 15 deletions irohad/consensus/yac/impl/yac_crypto_provider_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ namespace iroha {
namespace consensus {
namespace yac {
CryptoProviderImpl::CryptoProviderImpl(
const shared_model::crypto::Keypair &keypair)
: keypair_(keypair) {}
const shared_model::crypto::Keypair &keypair,
std::shared_ptr<shared_model::interface::CommonObjectsFactory>
factory)
: keypair_(keypair), factory_(std::move(factory)) {}

bool CryptoProviderImpl::verify(CommitMessage msg) {
return std::all_of(
Expand Down Expand Up @@ -61,19 +63,19 @@ namespace iroha {
auto signature = shared_model::crypto::CryptoSigner<>::sign(
blob, shared_model::crypto::Keypair(pubkey, privkey));

shared_model::builder::DefaultSignatureBuilder()
.publicKey(pubkey)
.signedData(signature)
.build()
.match([&vote](iroha::expected::Value<
std::shared_ptr<shared_model::interface::Signature>>
&sig) { vote.signature = sig.value; },
[](iroha::expected::Error<std::shared_ptr<std::string>>
&reason) {
logger::log("YacCryptoProvider::getVote")
->error("Cannot build vote signature: {}",
*reason.error);
});
// TODO 30.08.2018 andrei: IR-1670 Remove optional from YAC
// CryptoProviderImpl::getVote
factory_->createSignature(pubkey, signature)
.match(
[&](iroha::expected::Value<
std::unique_ptr<shared_model::interface::Signature>> &sig) {
vote.signature = std::move(sig.value);
},
[](iroha::expected::Error<std::string> &reason) {
logger::log("YacCryptoProvider::getVote")
->error("Cannot build vote signature: {}", reason.error);
});

return vote;
}

Expand Down
25 changes: 9 additions & 16 deletions irohad/consensus/yac/impl/yac_crypto_provider_impl.hpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
/**
* Copyright Soramitsu Co., Ltd. 2018 All Rights Reserved.
* http://soramitsu.co.jp
*
* 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.
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef IROHA_YAC_CRYPTO_PROVIDER_IMPL_HPP
#define IROHA_YAC_CRYPTO_PROVIDER_IMPL_HPP

#include "consensus/yac/yac_crypto_provider.hpp"

#include "cryptography/keypair.hpp"
#include "interfaces/common_objects/common_objects_factory.hpp"

namespace iroha {
namespace consensus {
namespace yac {
class CryptoProviderImpl : public YacCryptoProvider {
public:
explicit CryptoProviderImpl(
const shared_model::crypto::Keypair &keypair);
CryptoProviderImpl(
const shared_model::crypto::Keypair &keypair,
std::shared_ptr<shared_model::interface::CommonObjectsFactory>
factory);

bool verify(CommitMessage msg) override;

Expand All @@ -39,6 +31,7 @@ namespace iroha {

private:
shared_model::crypto::Keypair keypair_;
std::shared_ptr<shared_model::interface::CommonObjectsFactory> factory_;
};
} // namespace yac
} // namespace consensus
Expand Down
1 change: 0 additions & 1 deletion irohad/consensus/yac/impl/yac_gate_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "consensus/yac/impl/yac_gate_impl.hpp"

#include "backend/protobuf/block.hpp"
#include "builders/protobuf/common_objects/proto_signature_builder.hpp"
#include "common/visitor.hpp"
#include "consensus/yac/cluster_order.hpp"
#include "consensus/yac/messages.hpp"
Expand Down
Loading

0 comments on commit 719d6d4

Please sign in to comment.