Skip to content

Master #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
653d8fc
Reduced connection retry timeouts in test_node_data_chaged.py
Apr 2, 2018
96af74f
[FIX TESTS] Fix consistency proof query test
Apr 2, 2018
21283cb
Merge pull request #608 from anikitinDSR/fix-tests
Apr 3, 2018
677d8ed
Merge pull request #606 from skhoroshavin/fix-tests
Apr 3, 2018
e4e9829
add min, max length support to iterables (#612)
lovesh Apr 3, 2018
4b1f80e
Fix for Base58key test (#611)
ArtObr Apr 4, 2018
9a1ddbe
Fixed memory leak in monitoring (#613)
skhoroshavin Apr 4, 2018
159a987
[INDY-1225] Implemented compression, increased log rotation interval …
skhoroshavin Apr 5, 2018
305cb33
Log processor: improvements in request tracking and statistics (#601)
skhoroshavin Apr 5, 2018
626183d
[Increment sdk] Increment libindy and python wrappers version
Apr 6, 2018
fad0cc8
INDY-1259: fix typo. (#615)
sergey-shilov Apr 6, 2018
6603f52
Fixed log rotation config (#614)
skhoroshavin Apr 6, 2018
6f614be
[Increment sdk] Increment sdk
Apr 6, 2018
099a536
[Increment sdk] ReRefreshPool 4 times if raise PoolLedgerTerminated
Apr 6, 2018
9c45d53
[Incremet sdk] Add rust log
Apr 6, 2018
c4281f7
[Increment sdk] add -s option to pytest run
Apr 6, 2018
ed84852
[Increment sdk] skip test_quorum_f_plus_2_nodes_but_not_primary_off_a…
Apr 6, 2018
37f3c14
[Increment sdk] run test runner with RUST logs
Apr 9, 2018
40c316f
[Increment sdk] Fix timeout logic for sdk_get_reply
Apr 9, 2018
2851865
[Increment sdk] rid of TimeoutException errors
Apr 9, 2018
045c33f
[Increment sdk] Remove rust log
Apr 9, 2018
8427737
[Increment sdk] remove -s from pytest run cmd
Apr 9, 2018
5d7f9fc
[Increment sdk] Increment sdk version to 452
Apr 9, 2018
d7155f9
Merge pull request #616 from anikitinDSR/increment-sdk
Apr 9, 2018
e5d90f7
[pool-refresh-fix] Handle CommonIOError (#621)
Apr 11, 2018
d19fd30
Changed log levels of receive messages
Apr 9, 2018
0ba562b
Warning and callback on unordered requests
Apr 9, 2018
bb5ec6c
Log processor: include identifier into reqId, refactor
Apr 6, 2018
55232e1
Public/indy 1265 (#622)
Apr 11, 2018
9994f0c
Merge remote-tracking branch 'upstream/master' into track-req
Apr 12, 2018
cab0b20
Merge remote-tracking branch 'upstream/master' into indy-465
Apr 12, 2018
a19beaa
New libindy 454 (#628)
Apr 12, 2018
0a2a41a
Merge remote-tracking branch 'upstream/master' into track-req
Apr 12, 2018
9a118e0
Merge remote-tracking branch 'upstream/master' into indy-465
Apr 12, 2018
954a79e
Merge pull request #619 from skhoroshavin/indy-465
ashcherbakov Apr 16, 2018
909ea6b
Merge pull request #617 from skhoroshavin/track-req
ashcherbakov Apr 16, 2018
d62c53c
[Increment libindy-crypto] Bumped libindy-crypto version to 0.4.0
Apr 13, 2018
d51d964
[Increment-crypto] Increment libindy version with new indy-crypto
Apr 16, 2018
348d794
[Increment crypto] Disable "pip3 install pip"
Apr 16, 2018
841db79
[Increment crypto] Added pip version
Apr 16, 2018
e527b14
Log processor: don't crash on unexpected EOF
Apr 17, 2018
1561d24
Log processor: added support for xz archives
Apr 17, 2018
e44f7e9
[Freeze pip] Pip version < 10.0.0
Apr 17, 2018
904012a
Merge pull request #632 from sergey-shilov/fix/increment-sdk
ashcherbakov Apr 17, 2018
d84ef42
Log processor: improve processing speed when filtering by timestamp
Apr 17, 2018
080e773
Log processor: update documentation
Apr 17, 2018
6a0e31e
Merge pull request #634 from skhoroshavin/log-time-filter
ashcherbakov Apr 17, 2018
0a996ba
[INDY-1237] Get rid of RegistryPoolManager (#595)
ArtObr Apr 17, 2018
851ad6f
[INDY-1173] add POOL_RESTART handling (#582)
Toktar Apr 17, 2018
4e65996
Log processor: minor fixes
Apr 18, 2018
ce485f7
[Fixed failed tests] Decrease reconnect timeout and ensure the same data
Apr 18, 2018
6090d21
Merge pull request #637 from anikitinDSR/failed-test
ashcherbakov Apr 19, 2018
058c32d
Merge pull request #636 from skhoroshavin/log-processor
ashcherbakov Apr 19, 2018
2b18b68
* Added Copyright to plenum license
Apr 19, 2018
bf23128
INDY-1251: change math of spikes detection.
Apr 19, 2018
902906e
Merge pull request #639 from vimmerru/master
ashcherbakov Apr 19, 2018
199d930
Merge pull request #640 from sergey-shilov/fix/INDY-1251
ashcherbakov Apr 19, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test(options=[:]) {

try {
if (options.useRunner) {
sh "PYTHONASYNCIODEBUG='0' $options.python runner.py --pytest \"$options.python -m pytest\" --dir $options.testDir --output \"$options.resFile\" --test-only-slice \"$options.testOnlySlice\""
sh "RUSTPYTHONASYNCIODEBUG='0' $options.python runner.py --pytest \"$options.python -m pytest\" --dir $options.testDir --output \"$options.resFile\" --test-only-slice \"$options.testOnlySlice\""
} else {
sh "$options.python -m pytest --junitxml=$options.resFile $options.testDir"
}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright 2016 Sovrin Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions ci/code-validation.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ RUN apt-get update -y && apt-get install -y \
python3-pip \
python-setuptools \
python3-nacl
RUN pip3 install -U \
pip \
RUN pip3 install -U \
setuptools \
pep8 \
pep8-naming \
Expand Down
4 changes: 2 additions & 2 deletions ci/ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ RUN echo "To invalidate cache"

RUN apt-get update -y && apt-get install -y \
python3-nacl \
libindy-crypto=0.2.0 \
libindy=1.3.1~403 \
libindy-crypto=0.4.0 \
libindy=1.3.1~469 \
# rocksdb python wrapper
libbz2-dev \
zlib1g-dev \
Expand Down
4 changes: 0 additions & 4 deletions plenum/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,14 +927,10 @@ def newNode(self, nodeName: str):
nodes = []
for name in names:
try:
nodeRegistry = None if self.nodeRegLoadedFromFile \
else self.nodeRegistry

config_helper = PNodeConfigHelper(name, self.config, chroot=self.nodes_chroot)
learnKeysFromOthers(config_helper.keys_dir, name,
self.nodes.values())
node = self.NodeClass(name,
nodeRegistry=nodeRegistry,
config_helper=config_helper,
pluginPaths=self.pluginPaths,
config=self.config)
Expand Down
8 changes: 4 additions & 4 deletions plenum/common/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def discardTxns(self, count: int):
self.uncommittedTree = self.treeWithAppliedTxns(
self.uncommittedTxns)
self.uncommittedRootHash = self.uncommittedTree.root_hash
logger.debug('Discarding {} txns and root hash {} and new root hash '
'is {}. {} are still uncommitted'.
format(count, old_hash, self.uncommittedRootHash,
len(self.uncommittedTxns)))
logger.info('Discarding {} txns and root hash {} and new root hash '
'is {}. {} are still uncommitted'.
format(count, old_hash, self.uncommittedRootHash,
len(self.uncommittedTxns)))

def treeWithAppliedTxns(self, txns: List, currentTree=None):
"""
Expand Down
10 changes: 6 additions & 4 deletions plenum/common/ledger_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def request_CPs_if_needed(self, ledgerId):

quorum = Quorums(self.owner.totalNodes)
groupedProofs, null_proofs_count = self._groupConsistencyProofs(proofs)
if quorum.same_consistency_proof.is_reached(null_proofs_count):
if quorum.same_consistency_proof.is_reached(null_proofs_count)\
or len(groupedProofs) == 0:
return
result = self._latestReliableProof(groupedProofs, ledgerInfo.ledger)
if not result:
Expand Down Expand Up @@ -723,6 +724,7 @@ def canStartCatchUpProcess(self, ledgerId: int):
# from other nodes, see `request_CPs_if_needed`

ledgerInfo.consistencyProofsTimer = time.perf_counter()
# TODO: find appropriate moment to unschedule this event!
self._schedule(partial(self.request_CPs_if_needed, ledgerId),
self.config.ConsistencyProofsTimeout * (
self.owner.totalNodes - 1))
Expand Down Expand Up @@ -1017,7 +1019,7 @@ def _buildConsistencyProof(self, ledgerId, seqNoStart, seqNoEnd):
.format(self, seqNoEnd, ledgerSize))
return
if seqNoEnd < seqNoStart:
self.error(
logger.error(
'{} cannot build consistency proof since end {} is '
'lesser than start {}'.format(
self, seqNoEnd, seqNoStart))
Expand Down Expand Up @@ -1090,8 +1092,8 @@ def appendToLedger(self, ledgerId: int, txn: Any) -> Dict:
return ledgerInfo.ledger.append(txn)

def stashLedgerStatus(self, ledgerId: int, status, frm: str):
logger.debug("{} stashing ledger status {} from {}".
format(self, status, frm))
logger.info("{} stashing ledger status {} from {}".
format(self, status, frm))
ledgerInfo = self.getLedgerInfoByType(ledgerId)
ledgerInfo.stashedLedgerStatuses.append((status, frm))

Expand Down
16 changes: 15 additions & 1 deletion plenum/common/messages/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,28 @@ def _specific_validation(self, val):
class IterableField(FieldBase):
_base_types = (list, tuple)

def __init__(self, inner_field_type: FieldValidator, **kwargs):
def __init__(self, inner_field_type: FieldValidator, min_length=None,
max_length=None, **kwargs):
assert inner_field_type
assert isinstance(inner_field_type, FieldValidator)
for m in (min_length, max_length):
if m is not None:
assert isinstance(m, int)
assert m > 0

self.inner_field_type = inner_field_type
self.min_length = min_length
self.max_length = max_length
super().__init__(**kwargs)

def _specific_validation(self, val):
if self.min_length is not None:
if len(val) < self.min_length:
return 'length should be at least {}'.format(self.min_length)
if self.max_length is not None:
if len(val) > self.max_length:
return 'length should be at most {}'.format(self.max_length)

for v in val:
check_er = self.inner_field_type.validate(v)
if check_er:
Expand Down
9 changes: 6 additions & 3 deletions plenum/common/messages/node_messages.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from typing import TypeVar, NamedTuple

from plenum.common.constants import NOMINATE, BATCH, REELECTION, PRIMARY, BLACKLIST, REQACK, REQNACK, REJECT, \
POOL_LEDGER_TXNS, ORDERED, PROPAGATE, PREPREPARE, PREPARE, COMMIT, CHECKPOINT, THREE_PC_STATE, CHECKPOINT_STATE, \
REPLY, INSTANCE_CHANGE, LEDGER_STATUS, CONSISTENCY_PROOF, CATCHUP_REQ, CATCHUP_REP, VIEW_CHANGE_DONE, CURRENT_STATE, \
from plenum.common.constants import NOMINATE, BATCH, REELECTION, PRIMARY, \
BLACKLIST, REQACK, REQNACK, REJECT, \
POOL_LEDGER_TXNS, ORDERED, PROPAGATE, PREPREPARE, PREPARE, COMMIT, \
CHECKPOINT, THREE_PC_STATE, CHECKPOINT_STATE, \
REPLY, INSTANCE_CHANGE, LEDGER_STATUS, CONSISTENCY_PROOF, CATCHUP_REQ, \
CATCHUP_REP, VIEW_CHANGE_DONE, CURRENT_STATE, \
MESSAGE_REQUEST, MESSAGE_RESPONSE, OBSERVED_DATA, BATCH_COMMITTED
from plenum.common.messages.client_request import ClientMessageValidator
from plenum.common.messages.fields import NonNegativeNumberField, IterableField, \
Expand Down
1 change: 1 addition & 0 deletions plenum/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class f: # provides a namespace for reusable field constants
ELECTION_DATA = Field('electionData', Any)
TXN_ID = Field('txnId', str)
REASON = Field('reason', Any)
IS_SUCCESS = Field('isSuccess', Any)
SENDER_CLIENT = Field('senderClient', str)
PP_TIME = Field("ppTime", float)
REQ_IDR = Field("reqIdr", List[Tuple[str, int]])
Expand Down
20 changes: 12 additions & 8 deletions plenum/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@

# Monitoring configuration
PerfCheckFreq = 10
UnorderedCheckFreq = 60

# Temporarily reducing DELTA till the calculations for extra work are not
# incorporated
Expand All @@ -100,17 +101,19 @@
LatencyGraphDuration = 240
notifierEventTriggeringConfig = {
'clusterThroughputSpike': {
'coefficient': 3,
'minCnt': 100,
'borders_coeff': 10,
'min_cnt': 15,
'freq': 60,
'minActivityThreshold': 2,
'min_activity_threshold': 10,
'use_weighted_borders_coeff': True,
'enabled': True
},
'nodeRequestSpike': {
'coefficient': 3,
'minCnt': 100,
'borders_coeff': 10,
'min_cnt': 15,
'freq': 60,
'minActivityThreshold': 2,
'min_activity_threshold': 10,
'use_weighted_borders_coeff': True,
'enabled': True
}
}
Expand Down Expand Up @@ -149,10 +152,11 @@


# Log configuration
logRotationWhen = 'D'
logRotationWhen = 'W6'
logRotationInterval = 1
logRotationBackupCount = 10
logRotationBackupCount = 50
logRotationMaxBytes = 100 * 1024 * 1024
logRotationCompress = True
logFormat = '{asctime:s} | {levelname:8s} | {filename:20s} ({lineno: >4}) | {funcName:s} | {message:s}'
logFormatStyle = '{'
logLevel = logging.NOTSET
Expand Down
16 changes: 16 additions & 0 deletions plenum/server/action_req_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from plenum.common.request import Request
from plenum.server.req_handler import RequestHandler


class ActionReqHandler(RequestHandler):
def __init__(self):
super().__init__()

def doStaticValidation(self, request: Request):
pass

def validate(self, req: Request):
pass

def apply(self, req: Request, cons_time: int):
pass
6 changes: 6 additions & 0 deletions plenum/server/client_authn.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
InsufficientSignatures, InsufficientCorrectSignatures
from plenum.common.types import f
from plenum.common.verifier import DidVerifier, Verifier
from plenum.server.action_req_handler import ActionReqHandler
from plenum.server.domain_req_handler import DomainRequestHandler
from plenum.server.pool_req_handler import PoolRequestHandler
from stp_core.common.log import getlogger
Expand Down Expand Up @@ -179,13 +180,18 @@ class CoreAuthMixin:
).union(
DomainRequestHandler.query_types
)
action_types = ActionReqHandler.operation_types

def is_query(self, typ):
return typ in self.query_types

def is_write(self, typ):
return typ in self.write_types

@classmethod
def is_action(cls, typ):
return typ in cls.action_types

@staticmethod
def _extract_signature(msg):
if f.SIG.nm not in msg:
Expand Down
17 changes: 15 additions & 2 deletions plenum/server/config_req_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
from plenum.server.req_handler import RequestHandler
from plenum.common.request import Request
from plenum.server.ledger_req_handler import LedgerRequestHandler


class ConfigReqHandler(RequestHandler):
class ConfigReqHandler(LedgerRequestHandler):
def __init__(self, ledger, state):
super().__init__(ledger, state)

def doStaticValidation(self, request: Request):
pass

def get_query_response(self, request):
pass

def validate(self, req: Request):
pass

def apply(self, req: Request, cons_time: int):
pass
3 changes: 2 additions & 1 deletion plenum/server/domain_req_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
from plenum.common.txn_util import reqToTxn
from plenum.common.types import f
from plenum.persistence.util import txnsWithSeqNo
from plenum.server.ledger_req_handler import LedgerRequestHandler
from plenum.server.req_handler import RequestHandler
from stp_core.common.log import getlogger

logger = getlogger()


class DomainRequestHandler(RequestHandler):
class DomainRequestHandler(LedgerRequestHandler):
stateSerializer = domain_state_serializer
write_types = {NYM, }

Expand Down
78 changes: 78 additions & 0 deletions plenum/server/ledger_req_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
from abc import ABCMeta, abstractmethod
from typing import List

import base58

from plenum.common.ledger import Ledger
from plenum.common.request import Request
from plenum.persistence.util import txnsWithSeqNo
from plenum.server.req_handler import RequestHandler
from stp_core.common.log import getlogger

from state.state import State

logger = getlogger()


class LedgerRequestHandler(RequestHandler, metaclass=ABCMeta):
"""
Base class for request handlers
Declares methods for validation, application of requests and
state control
"""

query_types = set()
write_types = set()

def __init__(self, ledger: Ledger, state: State):
self.state = state
self.ledger = ledger

def updateState(self, txns, isCommitted=False):
"""
Updates current state with a number of committed or
not committed transactions
"""

def commit(self, txnCount, stateRoot, txnRoot, ppTime) -> List:
"""
:param txnCount: The number of requests to commit (The actual requests
are picked up from the uncommitted list from the ledger)
:param stateRoot: The state trie root after the txns are committed
:param txnRoot: The txn merkle root after the txns are committed

:return: list of committed transactions
"""

(seqNoStart, seqNoEnd), committedTxns = \
self.ledger.commitTxns(txnCount)
stateRoot = base58.b58decode(stateRoot.encode())
# Probably the following assertion fail should trigger catchup
assert self.ledger.root_hash == txnRoot, '{} {}'.format(
self.ledger.root_hash, txnRoot)
self.state.commit(rootHash=stateRoot)
return txnsWithSeqNo(seqNoStart, seqNoEnd, committedTxns)

def onBatchCreated(self, state_root):
pass

def onBatchRejected(self):
pass

@abstractmethod
def doStaticValidation(self, request: Request):
pass

def is_query(self, txn_type):
return txn_type in self.query_types

def get_query_response(self, request):
raise NotImplementedError

@staticmethod
def transform_txn_for_ledger(txn):
return txn

@property
def operation_types(self) -> set:
return self.write_types.union(self.query_types)
Loading