Skip to content

Commit

Permalink
INDY-915: Support changes in plenum (#417)
Browse files Browse the repository at this point in the history
* bump version of indy-node

Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-company.com>

* bump indy-plenum dependency

Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-company.com>

* bump indy-plenum dependency

Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-company.com>
  • Loading branch information
ashcherbakov authored Oct 24, 2017
1 parent a01647b commit a11fe11
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 39 deletions.
2 changes: 1 addition & 1 deletion indy_node/__metadata__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
indy-node package metadata
"""
__version_info__ = (1, 1)
__version_info__ = (1, 2)
__version__ = '.'.join(map(str, __version_info__))
__author__ = "Hyperledger"
__license__ = "Apache 2.0"
Expand Down
46 changes: 10 additions & 36 deletions indy_node/server/domain_req_handler.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
import json
from typing import List
from hashlib import sha256

from copy import deepcopy
from typing import List

import base58
import base64

from common.serializers.serialization import state_roots_serializer
from plenum.common.exceptions import InvalidClientRequest, \
UnauthorizedClientRequest, UnknownIdentifier
from plenum.common.constants import TXN_TYPE, TARGET_NYM, RAW, ENC, HASH, \
VERKEY, DATA, NAME, VERSION, ORIGIN, \
STATE_PROOF, ROOT_HASH, MULTI_SIGNATURE, PROOF_NODES, TXN_TIME
from plenum.common.plenum_protocol_version import PlenumProtocolVersion
TXN_TIME
from plenum.common.exceptions import InvalidClientRequest, \
UnauthorizedClientRequest, UnknownIdentifier
from plenum.common.types import f
from plenum.server.domain_req_handler import DomainRequestHandler as PHandler
from stp_core.common.log import getlogger

from indy_common.auth import Authoriser
from indy_common.constants import NYM, ROLE, ATTRIB, SCHEMA, CLAIM_DEF, REF, \
SIGNATURE_TYPE
from indy_common.roles import Roles
from indy_common.serialization import attrib_raw_data_serializer
from indy_common.state import domain
from indy_common.types import Request
from stp_core.common.log import getlogger
from indy_node.persistence.idr_cache import IdrCache
from indy_common.state import domain


logger = getlogger()


class DomainReqHandler(PHandler):

def __init__(self, ledger, state, requestProcessor,
idrCache, attributeStore, bls_store):
super().__init__(ledger, state, requestProcessor, bls_store)
Expand Down Expand Up @@ -77,10 +68,9 @@ def commit(self, txnCount, stateRoot, txnRoot) -> List:
def canNymRequestBeProcessed(self, identifier, msg) -> (bool, str):
nym = msg.get(TARGET_NYM)
if self.hasNym(nym, isCommitted=False):
if not self.idrCache.hasTrustee(
identifier, isCommitted=False) and self.idrCache.getOwnerFor(
nym, isCommitted=False) != identifier:
reason = '{} is neither Trustee nor owner of {}'\
if not self.idrCache.hasTrustee(identifier, isCommitted=False) \
and self.idrCache.getOwnerFor(nym, isCommitted=False) != identifier:
reason = '{} is neither Trustee nor owner of {}' \
.format(identifier, nym)
return False, reason
return True, ''
Expand Down Expand Up @@ -420,19 +410,3 @@ def transform_attrib_for_ledger(txn):
elif HASH in txn:
txn[HASH] = txn[HASH]
return txn

@staticmethod
def make_result(request, data, last_seq_no, update_time, proof):
result = {**request.operation, **{
DATA: data,
f.IDENTIFIER.nm: request.identifier,
f.REQ_ID.nm: request.reqId,
f.SEQ_NO.nm: last_seq_no,
TXN_TIME: update_time
}}
if request.protocolVersion and \
request.protocolVersion >= PlenumProtocolVersion.STATE_PROOF_SUPPORT.value:
result[STATE_PROOF] = proof

# Do not inline please, it makes debugging easier
return result
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def save_multi_sig(request_handler):
key = state_roots_serializer.serialize(
bytes(request_handler.state.committedHeadHash))
request_handler.bls_store.put(key, multi_sig)
return multi_sig
return multi_sig.as_dict()


def is_proof_verified(request_handler,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def run(self):
data_files=[(
(BASE_DIR, ['data/nssm_original.exe'])
)],
install_requires=['indy-plenum-dev==1.1.149',
install_requires=['indy-plenum-dev==1.2.151',
'indy-anoncreds-dev==1.0.32',
'python-dateutil',
'timeout-decorator'],
Expand Down

0 comments on commit a11fe11

Please sign in to comment.