From 6c109a7354e4a9c74bd91bc14639b45e9533835e Mon Sep 17 00:00:00 2001 From: timotheyca Date: Tue, 24 May 2022 02:32:15 +0300 Subject: [PATCH] minor fixes --- .../reduction/reductionchainmetafactory.py | 12 ++--------- .../chain/reduction/reductionchainprotocol.py | 6 +----- .../hashing/reduce_nullable_reference.py | 21 ------------------- rainbowadn/storage/__init__.py | 0 rainbowadn/storage/storage.py | 2 ++ rainbowadn/testing/test_all.py | 1 + rainbowadn/v13/transaction.py | 7 +++---- 7 files changed, 9 insertions(+), 40 deletions(-) delete mode 100644 rainbowadn/hashing/reduce_nullable_reference.py create mode 100644 rainbowadn/storage/__init__.py create mode 100644 rainbowadn/storage/storage.py diff --git a/rainbowadn/chain/reduction/reductionchainmetafactory.py b/rainbowadn/chain/reduction/reductionchainmetafactory.py index 5760016..817b368 100644 --- a/rainbowadn/chain/reduction/reductionchainmetafactory.py +++ b/rainbowadn/chain/reduction/reductionchainmetafactory.py @@ -20,11 +20,7 @@ class ReductionChainMetaFactory( AbstractReductionChainMetaFactory[ Block[ ReductorType, - StateStage[ - ReductorType, - AccumulatorType, - Reduction[ReductorType, AccumulatorType] - ] + StateStage[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]] ], ReductorType, AccumulatorType @@ -39,11 +35,7 @@ class ReductionChainMetaFactory( ) -> ChainCollectionFactory[ Block[ ReductorType, - StateStage[ - ReductorType, - AccumulatorType, - Reduction[ReductorType, AccumulatorType] - ] + StateStage[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]] ], ReductorType, AccumulatorType diff --git a/rainbowadn/chain/reduction/reductionchainprotocol.py b/rainbowadn/chain/reduction/reductionchainprotocol.py index d0a66c0..d8b3ac1 100644 --- a/rainbowadn/chain/reduction/reductionchainprotocol.py +++ b/rainbowadn/chain/reduction/reductionchainprotocol.py @@ -19,11 +19,7 @@ AccumulatorType = TypeVar('AccumulatorType') class ReductionChainProtocol( BlockChainProtocol[ ReductorType, - StateStage[ - ReductorType, - AccumulatorType, - Reduction[ReductorType, AccumulatorType] - ], + StateStage[ReductorType, AccumulatorType, Reduction[ReductorType, AccumulatorType]], AccumulatorType ] ): diff --git a/rainbowadn/hashing/reduce_nullable_reference.py b/rainbowadn/hashing/reduce_nullable_reference.py deleted file mode 100644 index d6678a2..0000000 --- a/rainbowadn/hashing/reduce_nullable_reference.py +++ /dev/null @@ -1,21 +0,0 @@ -from typing import TypeVar - -from rainbowadn.hashing.hashpoint import HashPoint -from rainbowadn.hashing.hashresolver import HashResolver -from rainbowadn.hashing.nullability.nullablereference import NullableReference - -__all__ = ('reduce_nullable_reference',) - -ReReferencedType = TypeVar('ReReferencedType') - - -def reduce_nullable_reference( - reference: NullableReference[NullableReference[ReReferencedType]], - resolver: HashResolver -) -> NullableReference[ReReferencedType]: - assert isinstance(reference, NullableReference) - assert isinstance(resolver, HashResolver) - if reference.reference.null(): - return reference.factory.from_bytes(HashPoint.NULL_HASH, resolver) - else: - return reference.reference.resolve().resolve() diff --git a/rainbowadn/storage/__init__.py b/rainbowadn/storage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rainbowadn/storage/storage.py b/rainbowadn/storage/storage.py new file mode 100644 index 0000000..0a78751 --- /dev/null +++ b/rainbowadn/storage/storage.py @@ -0,0 +1,2 @@ +class Storage: + pass diff --git a/rainbowadn/testing/test_all.py b/rainbowadn/testing/test_all.py index 2eb03fd..cfce391 100644 --- a/rainbowadn/testing/test_all.py +++ b/rainbowadn/testing/test_all.py @@ -108,6 +108,7 @@ class TestAll(unittest.TestCase): assert not btree.contains(key) btree = btree.add(key) assert btree.contains(key) + print(btree.height) measure('resolve and add') def test_wrisbt_index(self): diff --git a/rainbowadn/v13/transaction.py b/rainbowadn/v13/transaction.py index f7456de..83e0887 100644 --- a/rainbowadn/v13/transaction.py +++ b/rainbowadn/v13/transaction.py @@ -159,10 +159,9 @@ class TransactionData(RecursiveMentionable, StaticMentionable): assert isinstance(owner, Subject) signature: Signature = signatures_stack.element.resolve() assert isinstance(signature, Signature) - return signature.verify( - owner, - self.hash_point - ) + assert signature.verify(owner, self.hash_point) + assert self._verify_signatures(in_coins_stack.previous, signatures_stack.previous) + return True def iter_in_coins(self) -> Iterable[HashPoint[Coin]]: in_coins: NullableReference[Stack[Coin]] = self.in_coins