From e2d163faf538aac941cd78fdfe45e295bd0fbddf Mon Sep 17 00:00:00 2001 From: Abdulrahim Al Methiab <31316147+abdulmth@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:33:24 +0200 Subject: [PATCH] Remove pow/nonce - python (#1113) * remove pow and nonce * remove unused import --------- Co-authored-by: Thibault Martinez --- bindings/python/iota_sdk/client/client.py | 45 +------------------ bindings/python/iota_sdk/types/block.py | 2 - .../python/iota_sdk/types/client_options.py | 18 -------- .../python/iota_sdk/types/network_info.py | 4 +- bindings/python/iota_sdk/types/node_info.py | 2 - bindings/python/tests/test_block.py | 10 ++--- bindings/python/tests/test_offline.py | 2 +- 7 files changed, 9 insertions(+), 74 deletions(-) diff --git a/bindings/python/iota_sdk/client/client.py b/bindings/python/iota_sdk/client/client.py index a98d47f350..c077fc1b90 100644 --- a/bindings/python/iota_sdk/client/client.py +++ b/bindings/python/iota_sdk/client/client.py @@ -9,7 +9,7 @@ from iota_sdk.client._utils import ClientUtils from iota_sdk.secret_manager.secret_manager import LedgerNanoSecretManager, MnemonicSecretManager, StrongholdSecretManager, SeedSecretManager from iota_sdk.types.block import Block -from iota_sdk.types.common import HexStr, Node, AddressAndAmount +from iota_sdk.types.common import HexStr, Node from iota_sdk.types.feature import Feature from iota_sdk.types.native_token import NativeToken from iota_sdk.types.network_info import NetworkInfo @@ -41,20 +41,14 @@ def __init__( self, nodes: Optional[str | List[str]] = None, primary_node: Optional[str] = None, - primary_pow_node: Optional[str] = None, permanode: Optional[str] = None, ignore_node_health: Optional[bool] = None, api_timeout: Optional[timedelta] = None, node_sync_interval: Optional[timedelta] = None, - remote_pow_timeout: Optional[timedelta] = None, - tips_interval: Optional[int] = None, quorum: Optional[bool] = None, min_quorum_size: Optional[int] = None, quorum_threshold: Optional[int] = None, user_agent: Optional[str] = None, - local_pow: Optional[bool] = None, - fallback_to_local_pow: Optional[bool] = None, - pow_worker_count: Optional[int] = None, client_handle=None ): """Initialize the IOTA Client. @@ -64,8 +58,6 @@ def __init__( A single Node URL or an array of URLs. primary_node : Node which will be tried first for all requests. - primary_pow_node : - Node which will be tried first when using remote PoW, even before the primary_node. permanode : Permanode URL. ignore_node_health : @@ -74,10 +66,6 @@ def __init__( Timeout for API requests. node_sync_interval : Interval in which nodes will be checked for their sync status and the [NetworkInfo](crate::NetworkInfo) gets updated. - remote_pow_timeout : - Timeout when sending a block that requires remote proof of work. - tips_interval : - Tips request interval during PoW in seconds. quorum : If node quorum is enabled. Will compare the responses from multiple nodes and only returns the response if 'quorum_threshold'% of the nodes return the same one. min_quorum_size : @@ -86,12 +74,6 @@ def __init__( % of nodes that have to return the same response so it gets accepted. user_agent : The User-Agent header for requests. - local_pow : - Local proof of work. - fallback_to_local_pow : - Fallback to local proof of work if the node doesn't support remote PoW. - pow_worker_count : - The amount of threads to be used for proof of work. client_handle : An instance of a node client. """ @@ -126,9 +108,6 @@ def get_remaining_nano_seconds(duration: timedelta): if 'node_sync_interval' in client_config: client_config['node_sync_interval'] = {'secs': int(client_config['node_sync_interval'].total_seconds( )), 'nanos': get_remaining_nano_seconds(client_config['node_sync_interval'])} - if 'remote_pow_timeout' in client_config: - client_config['remote_pow_timeout'] = {'secs': int(client_config['remote_pow_timeout'].total_seconds( - )), 'nanos': get_remaining_nano_seconds(client_config['remote_pow_timeout'])} client_config = humps.camelize(client_config) client_config_str = dumps(client_config) @@ -364,7 +343,7 @@ def get_node(self) -> Dict[str, Any]: return self._call_method('getNode') def get_network_info(self) -> NetworkInfo: - """Gets the network related information such as network_id and min_pow_score. + """Gets the network related information such as network_id. """ return from_dict(NetworkInfo, self._call_method('getNetworkInfo')) @@ -378,26 +357,6 @@ def get_bech32_hrp(self) -> str: """ return self._call_method('getBech32Hrp') - def get_min_pow_score(self) -> int: - """Returns the min pow score. - """ - return int(self._call_method('getMinPowScore')) - - def get_tips_interval(self) -> int: - """Returns the tips interval. - """ - return int(self._call_method('getTipsInterval')) - - def get_local_pow(self) -> bool: - """Returns if local pow should be used or not. - """ - return self._call_method('getLocalPow') - - def get_fallback_to_local_pow(self) -> bool: - """Get fallback to local proof of work timeout. - """ - return self._call_method('getFallbackToLocalPow') - def unhealthy_nodes(self) -> List[Dict[str, Any]]: """Returns the unhealthy nodes. """ diff --git a/bindings/python/iota_sdk/types/block.py b/bindings/python/iota_sdk/types/block.py index 7e969e51dc..4b5ede9844 100644 --- a/bindings/python/iota_sdk/types/block.py +++ b/bindings/python/iota_sdk/types/block.py @@ -18,13 +18,11 @@ class Block: Attributes: protocolVersion: The protocol version with which this block was issued. parents: The parents of this block. - nonce: The nonce of this block. payload: The optional payload of this block. """ protocolVersion: int parents: List[HexStr] - nonce: str payload: Optional[TaggedDataPayload | TransactionPayload | MilestonePayload] = None diff --git a/bindings/python/iota_sdk/types/client_options.py b/bindings/python/iota_sdk/types/client_options.py index dcbe0d71b6..c732eb6a9c 100644 --- a/bindings/python/iota_sdk/types/client_options.py +++ b/bindings/python/iota_sdk/types/client_options.py @@ -49,8 +49,6 @@ class ClientOptions: Attributes: primary_node (str): Node which will be tried first for all requests. - primary_pow_node (str): - Node which will be tried first when using remote PoW, even before the primary_node. nodes (List[str]): Array of Node URLs. permanode (str): @@ -72,21 +70,10 @@ class ClientOptions: Options for the MQTT broker. protocolParameters (NodeInfoProtocol): Protocol parameters. - localPow (bool): - Local proof of work. - fallbackToLocalPow (bool): - Fallback to local proof of work if the node doesn't support remote PoW. - tipsInterval (int): - Tips request interval during PoW in seconds. apiTimeout (Duration): Timeout for API requests. - remotePowTimeout (Duration): - Timeout when sending a block that requires remote proof of work. - powWorkerCount (int): - The amount of threads to be used for proof of work. """ primaryNode: Optional[str] = None - primaryPowNode: Optional[str] = None nodes: Optional[List[str]] = None permanodes: Optional[List[str]] = None ignoreNodeHealth: Optional[bool] = None @@ -97,12 +84,7 @@ class ClientOptions: userAgent: Optional[str] = None brokerOptions: Optional[MqttBrokerOptions] = None protocolParameters: Optional[NodeInfoProtocol] = None - localPow: Optional[bool] = None - fallbackToLocalPow: Optional[bool] = None - tipsInterval: Optional[int] = None apiTimeout: Optional[Duration] = None - remotePowTimeout: Optional[Duration] = None - powWorkerCount: Optional[int] = None def as_dict(self): config = {k: v for k, v in self.__dict__.items() if v is not None} diff --git a/bindings/python/iota_sdk/types/network_info.py b/bindings/python/iota_sdk/types/network_info.py index 86cb84d9a6..3d5e4ea0c1 100644 --- a/bindings/python/iota_sdk/types/network_info.py +++ b/bindings/python/iota_sdk/types/network_info.py @@ -8,9 +8,7 @@ @dataclass class NetworkInfo: - """Network and PoW related information. + """Network related information. """ protocolParameters: NodeInfoProtocol - localPow: bool - tipsInterval: int diff --git a/bindings/python/iota_sdk/types/node_info.py b/bindings/python/iota_sdk/types/node_info.py index c83cb86efc..16d036eadc 100644 --- a/bindings/python/iota_sdk/types/node_info.py +++ b/bindings/python/iota_sdk/types/node_info.py @@ -74,14 +74,12 @@ class NodeInfoProtocol: bech32Hrp: The HRP prefix used for Bech32 addresses in the network. tokenSupply: TokenSupply defines the current token supply on the network. version: The version of the protocol running. - minPowScore: The minimum pow score of the network. rentStructure: The rent structure used by given node/network. """ networkName: str bech32Hrp: str tokenSupply: str version: int - minPowScore: float rentStructure: RentStructure diff --git a/bindings/python/tests/test_block.py b/bindings/python/tests/test_block.py index 4c76d98d49..bab35d2dc2 100644 --- a/bindings/python/tests/test_block.py +++ b/bindings/python/tests/test_block.py @@ -7,7 +7,7 @@ def test_block(): # with tx payload block_dict = {"protocolVersion": 2, "parents": ["0x27532565d4c8cc886dfc6a2238e8d2a72369672bb1d1d762c33b72d41b0b07b8", "0x604e6996bd1ec110642fec5b9c980d4b126eba5683e80a6e2cb905ded0cebd98", "0x6a14368f99e875aee0e7078d9e2ec2ba6c4fff6a3cd63c73a9b2c296d4a8e697", "0xc3f20eb06ce8be091579e2fbe6c109d108983fb0eff2c768e98c61e6fe71b4b7"], "payload": {"type": 6, "essence": {"type": 1, "networkId": "1856588631910923207", "inputs": [{"type": 0, "transactionId": "0xc6765035e75e319e9cd55ab16e7619f6cd658e7f421c71d9fe276c77fdf3f5b3", "transactionOutputIndex": 1}], "inputsCommitment": "0x2468f946993ac949c890d7f895797c6b86075dc1e1556f04f3772903eaf51932", "outputs": [ - {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xa119005b26d46fc74cf9188b3cef8d01623e68146741ee698cabefd425dc01be"}}]}, {"type": 3, "amount": "995000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xa119005b26d46fc74cf9188b3cef8d01623e68146741ee698cabefd425dc01be"}}]}]}, "unlocks": [{"type": 0, "signature": {"type": 0, "publicKey": "0xa7af600976f440ec97d7bddbf17eacf0bfbf710e8cfb4ae3eae475d4ae8e1b16", "signature": "0x6bbe2eed95300a3d707af1bb17e04f83087fe31261256020fd00c24a54543c084079bed29c6d1479ee5acfd1e2fa32316e88c4c1577b4fbea3fe247f71114500"}}]}, "nonce": "185496"} + {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xa119005b26d46fc74cf9188b3cef8d01623e68146741ee698cabefd425dc01be"}}]}, {"type": 3, "amount": "995000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xa119005b26d46fc74cf9188b3cef8d01623e68146741ee698cabefd425dc01be"}}]}]}, "unlocks": [{"type": 0, "signature": {"type": 0, "publicKey": "0xa7af600976f440ec97d7bddbf17eacf0bfbf710e8cfb4ae3eae475d4ae8e1b16", "signature": "0x6bbe2eed95300a3d707af1bb17e04f83087fe31261256020fd00c24a54543c084079bed29c6d1479ee5acfd1e2fa32316e88c4c1577b4fbea3fe247f71114500"}}]}} block = Block.from_dict(block_dict) assert block.as_dict() == block_dict assert isinstance(block.payload, Payload) @@ -15,7 +15,7 @@ def test_block(): # with tx payload, all output types block_dict = {"protocolVersion": 2, "parents": ["0x053296e7434e8a4d602f8db30a5aaf16c01140212fe79d8132137cda1c38a60a", "0x559ec1d9a31c55bd27588ada2ade70fb5b13764ddd600e29c3b018761ba30e15", "0xe78e8cdbbeda89e3408eed51b77e0db5ba035f5f3bf79a8365435bba40697693", "0xee9d6e45dbc080694e6c827fecbc31ad9f654cf57404bc98f4cbca033f8e3139"], "payload": {"type": 6, "essence": {"type": 1, "networkId": "1856588631910923207", "inputs": [{"type": 0, "transactionId": "0xa49f5a764c3fe22f702b5b238a75a648faae1863f61c14fac51ba58d26acb823", "transactionOutputIndex": 9}, {"type": 0, "transactionId": "0x6f23b39ebe433f8b522d2e4360186cd3e6b21baf46c0a591c801161e505330b4", "transactionOutputIndex": 0}, {"type": 0, "transactionId": "0x6f23b39ebe433f8b522d2e4360186cd3e6b21baf46c0a591c801161e505330b4", "transactionOutputIndex": 1}, {"type": 0, "transactionId": "0x6f23b39ebe433f8b522d2e4360186cd3e6b21baf46c0a591c801161e505330b4", "transactionOutputIndex": 2}], "inputsCommitment": "0xb6913235037feeeb74ea54ca0354bd7daee95e5a4fc65b67c960e5f0df6a339f", "outputs": [{"type": 4, "amount": "1000000", "aliasId": "0xf90a577f1bae4587fdb00752a847b3a2a9d623743993e9e7abdd0440a004caee", "stateIndex": 2, "foundryCounter": 1, "unlockConditions": [{"type": 4, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}, {"type": 5, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}], "features": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}, {"type": 2, "data": "0x010203"}], "immutableFeatures": [{"type": 1, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]}, {"type": 5, "amount": "1000000", "serialNumber": 1, "tokenScheme": {"type": 0, "mintedTokens": "0x32", "meltedTokens": "0x0", "maximumSupply": "0x64"}, "unlockConditions": [{"type": 6, "address": {"type": 8, "aliasId": "0xf90a577f1bae4587fdb00752a847b3a2a9d623743993e9e7abdd0440a004caee"}}]}, {"type": 6, "amount": "1000000", "nftId": "0xbe01be2aa284eb07d1ec4ab8099c86c6cac38d8207d440dafa9560feeac49c62", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]}, {"type": 3, "amount": "1000000", "nativeTokens": [{"id": "0x08f90a577f1bae4587fdb00752a847b3a2a9d623743993e9e7abdd0440a004caee0100000000", "amount": "0x32"}], "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]}, {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]}, {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}], "features": [{"type": 2, "data": "0x0d25"}]}, {"type": 3, "amount": "234100", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}, {"type": 1, "returnAddress": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}, "amount": "234000"}]}, {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}, {"type": 3, "returnAddress": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}, "unixTime": 1}]}, {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}, {"type": 2, "unixTime": 1}]}, {"type": 3, "amount": "5578452198", "nativeTokens": [{"id": "0x080021bcfa2252a500348f73c939722d65c0354eab33b753ab09bc80a7f592c9a40100000000", "amount": "0x41"}, {"id": "0x0808fb702d67fdb320b5959f152c0f962630515d904c71ed09447c341a6cc171de0100000000", "amount": "0x50"}, {"id": "0x0808fb702d67fdb320b5959f152c0f962630515d904c71ed09447c341a6cc171de0200000000", "amount": "0x64"}, {"id": "0x0808fb702d67fdb320b5959f152c0f962630515d904c71ed09447c341a6cc171de0300000000", "amount": "0x64"}, {"id": "0x080906d8ff0afdcb941cd3867186c8f23d5c889c7a1a8842a001871c8f76bcaf890100000000", "amount": "0xa"}, {"id": "0x08179dc4b298721f8bb60a591d5a00edc6e62ed941c133c4a4415b1ccc7d3804d90100000000", "amount": "0x42"}, {"id": "0x081d30f89a8655ce7514b5724ebae8c8f2160a223a6d8c91edca72de5e1477337b0100000000", "amount": "0x1a"}, {"id": "0x0822ceb3166ad125d310e6660f5fc292356f87f2f9566e982ea22154cec3847b3f0100000000", "amount": "0x64"}, {"id": "0x0822ceb3166ad125d310e6660f5fc292356f87f2f9566e982ea22154cec3847b3f0200000000", "amount": "0x3e8"}, {"id": "0x08261d3aa7f731a9ff784d6f239bfdc505bbe9902d8eace89c91c8e58429c200cb0100000000", "amount": "0x42"}, {"id": "0x082a1d58d3d725f9d3af50699c2cfa022274b199a9f4060b2331bf059e285bd2730100000000", "amount": "0x313030"}, {"id": "0x082ae3fdb7c757dbaae9d9463b63e7e3897f145c8c4a149bfe0ce4d316dc78f2500100000000", "amount": "0x1a"}, { - "id": "0x082ae3fdb7c757dbaae9d9463b63e7e3897f145c8c4a149bfe0ce4d316dc78f2500200000000", "amount": "0x3d2"}, {"id": "0x082cdf4c519401df914bf8ab3ebd1a1bb18da5babe7be82188f586a9c9a7bbdc160100000000", "amount": "0x64"}, {"id": "0x083156fbacf47e0b3ccaa5f4ffcbb9ae333fefcb4016261edfb302668eae242b050100000000", "amount": "0x64"}, {"id": "0x0833b41872b4ef228c10a99456fb08088a52a71f3ff23330287f6c8978bc5dd6df0100000000", "amount": "0x64"}, {"id": "0x083637f9940377b8e461d66e09f73e61b4186dd63deca2ed518b8ea87c410492e80100000000", "amount": "0x3c"}, {"id": "0x083c39ef7bd9a2eb640df6a36319a7fd51d4ca190ffd5d14572c9ebb54bdc6ecab0100000000", "amount": "0x64"}, {"id": "0x083c39ef7bd9a2eb640df6a36319a7fd51d4ca190ffd5d14572c9ebb54bdc6ecab0200000000", "amount": "0x45"}, {"id": "0x08475073881df12705fc6f18f228385ac3d499d21e5e36333c78f3c7e124c4b1e60100000000", "amount": "0x64"}, {"id": "0x084bd1dbdfecb771b4c56aa196cf90ca722ef489f5c12f2e11adb0fad4da8020060100000000", "amount": "0x5a"}, {"id": "0x084bd1dbdfecb771b4c56aa196cf90ca722ef489f5c12f2e11adb0fad4da8020060200000000", "amount": "0x64"}, {"id": "0x084bd1dbdfecb771b4c56aa196cf90ca722ef489f5c12f2e11adb0fad4da8020060300000000", "amount": "0x64"}, {"id": "0x0856ed1d7e6c86cf41c2978a700db8fe2686500f7d6e35f7ef15aecdb799833e5c0100000000", "amount": "0x64"}, {"id": "0x085c6b799750bdf7e5a5c81144465a0676bc11dab74b997444ca369949341720e80100000000", "amount": "0x64"}, {"id": "0x085fbfe07b06a54fda8ab7b6c72c49a34c4dcafaf1e5ba1f145fb06da1bba72a8d0100000000", "amount": "0xa"}, {"id": "0x086a62922fd743b541c987020d2cb2942cf789bcefe41572854119180cb8e037a90100000000", "amount": "0x46"}, {"id": "0x086f7011adb53642e8ed7db230c2307fe980f4aff2685c22f7c84a61ec558f691b0100000000", "amount": "0x3c"}, {"id": "0x086f7011adb53642e8ed7db230c2307fe980f4aff2685c22f7c84a61ec558f691b0200000000", "amount": "0x3de"}, {"id": "0x0871493f8559908cf5825e1a0334fa184f0e8b42136e472ec7e2e8127bc14202f70100000000", "amount": "0x46"}, {"id": "0x08722b1bf4f0295866c8bc75590d83b7422e47739e4b0048126fae45d0b5d330f90100000000", "amount": "0x64"}, {"id": "0x08722b1bf4f0295866c8bc75590d83b7422e47739e4b0048126fae45d0b5d330f90200000000", "amount": "0x3e8"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10100000000", "amount": "0x14"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10200000000", "amount": "0x64"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10300000000", "amount": "0x3e8"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10400000000", "amount": "0x64"}, {"id": "0x089786a7641d1268cb3b1cc7b514828f1511e3ae0b885835d284d3af85e1c3d3950100000000", "amount": "0x3e8"}, {"id": "0x0897e215b1e3ccb05c63842dc38db5007241cca966f341d674db2d9e886dc0ed410100000000", "amount": "0x64"}, {"id": "0x089ad7373abf3a4dda4a8a2e64b112ac25dca24efcf51346f8b2d0212961234d0b0100000000", "amount": "0x64"}, {"id": "0x089c130fa264a23492f5876e4c2673154689fa8e30945c7b60c59050b20336d2b70100000000", "amount": "0x32"}, {"id": "0x089c130fa264a23492f5876e4c2673154689fa8e30945c7b60c59050b20336d2b70200000000", "amount": "0x64"}, {"id": "0x089cfeccd4b71fc3d425755d972c1671346903dab3fda81ee54b807b752487d8250100000000", "amount": "0x3e8"}, {"id": "0x08aa2f74dc19d68bd3eb44f5b6648548b42b55f88c62374993301fd15c9ccf21270100000000", "amount": "0x32"}, {"id": "0x08aa2f74dc19d68bd3eb44f5b6648548b42b55f88c62374993301fd15c9ccf21270200000000", "amount": "0x31303030"}, {"id": "0x08ac83d1ce645b025a4a412f22e573973aadb50de1f8407d87b3cca4ed3e779a360100000000", "amount": "0x28"}, {"id": "0x08d1bcfd507246eac6d93fee125e36e5eb8f62afc25bfff09785b6bcc560cf5dc00100000000", "amount": "0x3e8"}, {"id": "0x08dc44610c24f32f26330440f3f0d4afb562a8dfd81afe7c2f79024f8f1b9e21940100000000", "amount": "0x63"}, {"id": "0x08dda479a9d366af826f1a8e3f3290a6c230c39b8d2d1ba165bf737c71856e92640100000000", "amount": "0x14"}, {"id": "0x08ea1cab7a1ba4ae5bdca654fdfe618fc92337030ecbae1d1f6b2b1fe4c6b569940200000000", "amount": "0x64"}, {"id": "0x08ec6d781c5bdb7faebfa66dc529dc46e82a26fb90c5a5de07ee77d357d62529360100000000", "amount": "0x32"}, {"id": "0x08f1802858831220b282ccc4c557676d61f79833869de378ce9a81f736976ce39f0100000000", "amount": "0x32"}, {"id": "0x08f708a29e9619e847916de76c2e167e87a704c235dcbd7cda018865be7f561b5a0100000000", "amount": "0x4c"}, {"id": "0x08f708a29e9619e847916de76c2e167e87a704c235dcbd7cda018865be7f561b5a0200000000", "amount": "0x20"}, {"id": "0x08fb64703098e00d81c5962f28d8504eae5998cf99ab4e37af0d3ea99180b2f6580100000000", "amount": "0x14"}, {"id": "0x08fe4090ca7623deffc5a570898d0844fe9f4763175af2c88a00958b26525b2b420100000000", "amount": "0x22"}], "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]}]}, "unlocks": [{"type": 0, "signature": {"type": 0, "publicKey": "0x67b7fc3f78763c9394fc4fcdb52cf3a973b6e064bdc3defb40a6cb2c880e6f5c", "signature": "0xc9ec7eba19c11b7a76f33a7781415a2f28fc3cf077fff4627f8c49604c77a5c6b4b4688a56bbe6e35a38bd97f1d03f5589050bd1f3372fc0ad57f8cb26f0da0e"}}, {"type": 1, "reference": 0}, {"type": 2, "reference": 1}, {"type": 1, "reference": 0}]}, "nonce": "4611686018427611393"} + "id": "0x082ae3fdb7c757dbaae9d9463b63e7e3897f145c8c4a149bfe0ce4d316dc78f2500200000000", "amount": "0x3d2"}, {"id": "0x082cdf4c519401df914bf8ab3ebd1a1bb18da5babe7be82188f586a9c9a7bbdc160100000000", "amount": "0x64"}, {"id": "0x083156fbacf47e0b3ccaa5f4ffcbb9ae333fefcb4016261edfb302668eae242b050100000000", "amount": "0x64"}, {"id": "0x0833b41872b4ef228c10a99456fb08088a52a71f3ff23330287f6c8978bc5dd6df0100000000", "amount": "0x64"}, {"id": "0x083637f9940377b8e461d66e09f73e61b4186dd63deca2ed518b8ea87c410492e80100000000", "amount": "0x3c"}, {"id": "0x083c39ef7bd9a2eb640df6a36319a7fd51d4ca190ffd5d14572c9ebb54bdc6ecab0100000000", "amount": "0x64"}, {"id": "0x083c39ef7bd9a2eb640df6a36319a7fd51d4ca190ffd5d14572c9ebb54bdc6ecab0200000000", "amount": "0x45"}, {"id": "0x08475073881df12705fc6f18f228385ac3d499d21e5e36333c78f3c7e124c4b1e60100000000", "amount": "0x64"}, {"id": "0x084bd1dbdfecb771b4c56aa196cf90ca722ef489f5c12f2e11adb0fad4da8020060100000000", "amount": "0x5a"}, {"id": "0x084bd1dbdfecb771b4c56aa196cf90ca722ef489f5c12f2e11adb0fad4da8020060200000000", "amount": "0x64"}, {"id": "0x084bd1dbdfecb771b4c56aa196cf90ca722ef489f5c12f2e11adb0fad4da8020060300000000", "amount": "0x64"}, {"id": "0x0856ed1d7e6c86cf41c2978a700db8fe2686500f7d6e35f7ef15aecdb799833e5c0100000000", "amount": "0x64"}, {"id": "0x085c6b799750bdf7e5a5c81144465a0676bc11dab74b997444ca369949341720e80100000000", "amount": "0x64"}, {"id": "0x085fbfe07b06a54fda8ab7b6c72c49a34c4dcafaf1e5ba1f145fb06da1bba72a8d0100000000", "amount": "0xa"}, {"id": "0x086a62922fd743b541c987020d2cb2942cf789bcefe41572854119180cb8e037a90100000000", "amount": "0x46"}, {"id": "0x086f7011adb53642e8ed7db230c2307fe980f4aff2685c22f7c84a61ec558f691b0100000000", "amount": "0x3c"}, {"id": "0x086f7011adb53642e8ed7db230c2307fe980f4aff2685c22f7c84a61ec558f691b0200000000", "amount": "0x3de"}, {"id": "0x0871493f8559908cf5825e1a0334fa184f0e8b42136e472ec7e2e8127bc14202f70100000000", "amount": "0x46"}, {"id": "0x08722b1bf4f0295866c8bc75590d83b7422e47739e4b0048126fae45d0b5d330f90100000000", "amount": "0x64"}, {"id": "0x08722b1bf4f0295866c8bc75590d83b7422e47739e4b0048126fae45d0b5d330f90200000000", "amount": "0x3e8"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10100000000", "amount": "0x14"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10200000000", "amount": "0x64"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10300000000", "amount": "0x3e8"}, {"id": "0x089694cbf1a422b1262d3b34810b7b0a53f49b6b0856388f8121b5d681b23c38e10400000000", "amount": "0x64"}, {"id": "0x089786a7641d1268cb3b1cc7b514828f1511e3ae0b885835d284d3af85e1c3d3950100000000", "amount": "0x3e8"}, {"id": "0x0897e215b1e3ccb05c63842dc38db5007241cca966f341d674db2d9e886dc0ed410100000000", "amount": "0x64"}, {"id": "0x089ad7373abf3a4dda4a8a2e64b112ac25dca24efcf51346f8b2d0212961234d0b0100000000", "amount": "0x64"}, {"id": "0x089c130fa264a23492f5876e4c2673154689fa8e30945c7b60c59050b20336d2b70100000000", "amount": "0x32"}, {"id": "0x089c130fa264a23492f5876e4c2673154689fa8e30945c7b60c59050b20336d2b70200000000", "amount": "0x64"}, {"id": "0x089cfeccd4b71fc3d425755d972c1671346903dab3fda81ee54b807b752487d8250100000000", "amount": "0x3e8"}, {"id": "0x08aa2f74dc19d68bd3eb44f5b6648548b42b55f88c62374993301fd15c9ccf21270100000000", "amount": "0x32"}, {"id": "0x08aa2f74dc19d68bd3eb44f5b6648548b42b55f88c62374993301fd15c9ccf21270200000000", "amount": "0x31303030"}, {"id": "0x08ac83d1ce645b025a4a412f22e573973aadb50de1f8407d87b3cca4ed3e779a360100000000", "amount": "0x28"}, {"id": "0x08d1bcfd507246eac6d93fee125e36e5eb8f62afc25bfff09785b6bcc560cf5dc00100000000", "amount": "0x3e8"}, {"id": "0x08dc44610c24f32f26330440f3f0d4afb562a8dfd81afe7c2f79024f8f1b9e21940100000000", "amount": "0x63"}, {"id": "0x08dda479a9d366af826f1a8e3f3290a6c230c39b8d2d1ba165bf737c71856e92640100000000", "amount": "0x14"}, {"id": "0x08ea1cab7a1ba4ae5bdca654fdfe618fc92337030ecbae1d1f6b2b1fe4c6b569940200000000", "amount": "0x64"}, {"id": "0x08ec6d781c5bdb7faebfa66dc529dc46e82a26fb90c5a5de07ee77d357d62529360100000000", "amount": "0x32"}, {"id": "0x08f1802858831220b282ccc4c557676d61f79833869de378ce9a81f736976ce39f0100000000", "amount": "0x32"}, {"id": "0x08f708a29e9619e847916de76c2e167e87a704c235dcbd7cda018865be7f561b5a0100000000", "amount": "0x4c"}, {"id": "0x08f708a29e9619e847916de76c2e167e87a704c235dcbd7cda018865be7f561b5a0200000000", "amount": "0x20"}, {"id": "0x08fb64703098e00d81c5962f28d8504eae5998cf99ab4e37af0d3ea99180b2f6580100000000", "amount": "0x14"}, {"id": "0x08fe4090ca7623deffc5a570898d0844fe9f4763175af2c88a00958b26525b2b420100000000", "amount": "0x22"}], "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"}}]}]}, "unlocks": [{"type": 0, "signature": {"type": 0, "publicKey": "0x67b7fc3f78763c9394fc4fcdb52cf3a973b6e064bdc3defb40a6cb2c880e6f5c", "signature": "0xc9ec7eba19c11b7a76f33a7781415a2f28fc3cf077fff4627f8c49604c77a5c6b4b4688a56bbe6e35a38bd97f1d03f5589050bd1f3372fc0ad57f8cb26f0da0e"}}, {"type": 1, "reference": 0}, {"type": 2, "reference": 1}, {"type": 1, "reference": 0}]}} block = Block.from_dict(block_dict) assert block.as_dict() == block_dict assert isinstance(block.payload, Payload) @@ -23,7 +23,7 @@ def test_block(): # with tx payload that has a tagged data payload block_dict = {"protocolVersion": 2, "parents": ["0x4bbba1f1fbfa58d8e65c018d0518da1c3ab57f05ffdd9c2e20565a99b42948df", "0x9962a18f0161f6b883cb1e36b936684793867d97dc9ac226a929d8e434385e96", "0xe532853c4a1e03e00a37c78a42afebf3570b1bb4a756c5ad651c0f0377548348", "0xedbd8bd428bcff342de0656e368a881022dd353b51f272ed40c604c86915d97d"], "payload": {"type": 6, "essence": {"type": 1, "networkId": "1856588631910923207", "inputs": [{"type": 0, "transactionId": "0xeccfbdb73c0a4c9c0301b53a17e5aa301fbf0b079db9e88ff0e32e9e64214b28", "transactionOutputIndex": 5}, {"type": 0, "transactionId": "0xf8052938858750c9c69b92b615a685fa2bb5833912b264142fc724e9510b0d0e", "transactionOutputIndex": 0}], "inputsCommitment": "0x9702f2a625db14db2f67289828a9fdbe342477393572b9165b19964b2449061a", "outputs": [ - {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x60200bad8137a704216e84f8f9acfe65b972d9f4155becb4815282b03cef99fe"}}]}, {"type": 3, "amount": "50600", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x74e8b1f10396eb5e8aeb16d666416802722436a88b5dd1a88e59c170b724c9cc"}}]}], "payload": {"type": 5, "tag": "0x746167", "data": "0x64617461"}}, "unlocks": [{"type": 0, "signature": {"type": 0, "publicKey": "0x67b7fc3f78763c9394fc4fcdb52cf3a973b6e064bdc3defb40a6cb2c880e6f5c", "signature": "0x30cb012af3402be1b4b2ed18e2aba86839da06ba38ff3277c481e17c003f0199ba26f5613199e0d24035628bb2b69a6ea2a7682e41c30244996baf3a2adc1c00"}}, {"type": 1, "reference": 0}]}, "nonce": "13835058055282192901"} + {"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x60200bad8137a704216e84f8f9acfe65b972d9f4155becb4815282b03cef99fe"}}]}, {"type": 3, "amount": "50600", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0x74e8b1f10396eb5e8aeb16d666416802722436a88b5dd1a88e59c170b724c9cc"}}]}], "payload": {"type": 5, "tag": "0x746167", "data": "0x64617461"}}, "unlocks": [{"type": 0, "signature": {"type": 0, "publicKey": "0x67b7fc3f78763c9394fc4fcdb52cf3a973b6e064bdc3defb40a6cb2c880e6f5c", "signature": "0x30cb012af3402be1b4b2ed18e2aba86839da06ba38ff3277c481e17c003f0199ba26f5613199e0d24035628bb2b69a6ea2a7682e41c30244996baf3a2adc1c00"}}, {"type": 1, "reference": 0}]}} block = Block.from_dict(block_dict) assert block.as_dict() == block_dict assert isinstance(block.payload, Payload) @@ -31,7 +31,7 @@ def test_block(): # with tagged data payload block_dict = {"protocolVersion": 2, "parents": ["0x17c297a273facf4047e244a65eb34ee33b1f1698e1fff28679466fa2ad81c0e8", "0x9858e80fa0b37b6d9397e23d1f58ce53955a9be1aa8020c0d0e11672996c6db9"], "payload": { - "type": 5, "tag": "0x484f524e4554205370616d6d6572", "data": "0x57652061726520616c6c206d616465206f662073746172647573742e0a436f756e743a20353436333730330a54696d657374616d703a20323032332d30372d31395430373a32323a32385a0a54697073656c656374696f6e3a20343732c2b573"}, "nonce": "235112"} + "type": 5, "tag": "0x484f524e4554205370616d6d6572", "data": "0x57652061726520616c6c206d616465206f662073746172647573742e0a436f756e743a20353436333730330a54696d657374616d703a20323032332d30372d31395430373a32323a32385a0a54697073656c656374696f6e3a20343732c2b573"}} block = Block.from_dict(block_dict) assert block.as_dict() == block_dict assert isinstance(block.payload, Payload) @@ -39,7 +39,7 @@ def test_block(): # with milestone payload block_dict = {"protocolVersion": 2, "parents": ["0x019481a2e03604a11c89bd9c57fae7acd76227064903f186268cd2edf9133d9e", "0xb5888bc050893833f8f04790aabcdee4f628420ae254edfc46cd1b824b03390f"], "payload": {"type": 7, "index": 6242784, "timestamp": 1689751322, "protocolVersion": 2, "previousMilestoneId": "0x949ebcf2df7bf2562c175a05660bc7ef831f832ad502489ef89a08220bca17ec", "parents": ["0x019481a2e03604a11c89bd9c57fae7acd76227064903f186268cd2edf9133d9e", "0xb5888bc050893833f8f04790aabcdee4f628420ae254edfc46cd1b824b03390f"], "inclusionMerkleRoot": "0xe453eafa10b2abebb9208ae95c59e991f7baa6fa889ef9e65375a1ea925abfdb", "appliedMerkleRoot": "0x0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8", "metadata": "0x9af38b0000000000019481a2e03604a11c89bd9c57fae7acd76227064903f186268cd2edf9133d9e", "signatures": [{"type": 0, "publicKey": "0x13ccdc2f5d3d9a3ebe06074c6b49b49090dd79ca72e04abf20f10f871ad8293b", "signature": "0x9211f021347621b06d36e0528ab43a153c7ab1383c5ebfafd3034a61bcfa805e35bcbb7b3570611d3d1c1093b5ffdadd73156f2221d5118b7a0562440a8bb80d"}, {"type": 0, "publicKey": "0x4587040de05907b70806c8725bdae1f7370785993b2a139208e247885d4ed1f8", "signature": "0xa9ba6b1ab386cf97149c8b4299b051b574af9faf28716007545545504635c8564422a168043a3a0475ebc5875c2fc9b7e35c21e2e09dce901c8b40e9ed704303"}, {"type": 0, "publicKey": "0x488ac3fb1b8df5ef8c4acb4ef1f3e3d039c5d7197db87094a61af66320722313", "signature": "0x45fa78feb635a81ca63b67ade0d4f0463610fb280a2f17f77b8e7c98f2341b2e4451a3a5b3d7a61f7fdf7a631101da23420551432b3c4cebaaaaf84b7163ea0f"}, {"type": 0, "publicKey": "0x61f95fed30b6e9bf0b2d03938f56d35789ff7f0ea122d01c5c1b7e869525e218", - "signature": "0xd959fd1cc152df1e330be98cf86ccc88c18d6a4947304ea1554495c8a6142ca7bed84ff5f920217c0b062a57dcb10a2cb964c6902faf631ba5d42ce4137b8902"}, {"type": 0, "publicKey": "0x98d1f907caa99f9320f0e0eb64a5cf208751c2171c7938da5659328061e82a8e", "signature": "0x613bf699c419e4222c6436fec7033bd2152f859dc61fa6e624eaac2a3b7e6c4b3213fac10f54e9dfccca1892dd56d66c580460894af7fa31bb5b0bb11791000d"}, {"type": 0, "publicKey": "0xaa6b36116206cc7d6c8f688e22113aa46f0de88d51aa7acf881ec2bd9d015f62", "signature": "0x0d8eb9ae528782f7d160acb44b4157e7cd36417f8903f24b842e1f5af24dbfde5493b726f4d5283ea4b0ac0e5e9e1bc238b417bdf637bee94eaf6cd9e25dfb0b"}, {"type": 0, "publicKey": "0xb3b4c920909720ba5f7c30dddc0f9169bf8243b529b601fc4776b8cb0a8ca253", "signature": "0x4bb23de95686993d5b2ac633ba1caed18b6fd2d92918251479e7c0698a313a66c5c7b0de032380cc11e6c80dd2097a10a03e4ba11a6f2d6742aa724f9eecf60e"}, {"type": 0, "publicKey": "0xbded01e93adf7a623118fd375fd93dc7d7ddf222324239cae33e4e4c47ec3b0e", "signature": "0x25d081ecf4d1f9f1cc355575766e9a12e4a0abbe4f2f69be8e7971606d5f53e38d2cbf46ef4c897bcba51429470e114ac0a02fea030277ac860b87062f847e0a"}, {"type": 0, "publicKey": "0xede9760c7f2aaa4618a58a1357705cdc1874962ad369309543230394bb77548b", "signature": "0xc35e0a5440cecd7d15f1c46597a1dc0c3ca36295738c986de61bc2f06a2573e16cae335452a0741f73e2e849b9e4e29d751566bf6639a15aecf5877b05d10f02"}, {"type": 0, "publicKey": "0xf18f3f6a2d940b9bacd3084713f6877db22064ada4335cb53ae1da75044f978d", "signature": "0x8252066947a8480560e3cdbf94ca31d72813898c5937f2fc3a1160861ae72ca77f604a6997fcdf7be5a51bfc3933abb21ed2e0590a011481c5575a5a5890fb00"}]}, "nonce": "0"} + "signature": "0xd959fd1cc152df1e330be98cf86ccc88c18d6a4947304ea1554495c8a6142ca7bed84ff5f920217c0b062a57dcb10a2cb964c6902faf631ba5d42ce4137b8902"}, {"type": 0, "publicKey": "0x98d1f907caa99f9320f0e0eb64a5cf208751c2171c7938da5659328061e82a8e", "signature": "0x613bf699c419e4222c6436fec7033bd2152f859dc61fa6e624eaac2a3b7e6c4b3213fac10f54e9dfccca1892dd56d66c580460894af7fa31bb5b0bb11791000d"}, {"type": 0, "publicKey": "0xaa6b36116206cc7d6c8f688e22113aa46f0de88d51aa7acf881ec2bd9d015f62", "signature": "0x0d8eb9ae528782f7d160acb44b4157e7cd36417f8903f24b842e1f5af24dbfde5493b726f4d5283ea4b0ac0e5e9e1bc238b417bdf637bee94eaf6cd9e25dfb0b"}, {"type": 0, "publicKey": "0xb3b4c920909720ba5f7c30dddc0f9169bf8243b529b601fc4776b8cb0a8ca253", "signature": "0x4bb23de95686993d5b2ac633ba1caed18b6fd2d92918251479e7c0698a313a66c5c7b0de032380cc11e6c80dd2097a10a03e4ba11a6f2d6742aa724f9eecf60e"}, {"type": 0, "publicKey": "0xbded01e93adf7a623118fd375fd93dc7d7ddf222324239cae33e4e4c47ec3b0e", "signature": "0x25d081ecf4d1f9f1cc355575766e9a12e4a0abbe4f2f69be8e7971606d5f53e38d2cbf46ef4c897bcba51429470e114ac0a02fea030277ac860b87062f847e0a"}, {"type": 0, "publicKey": "0xede9760c7f2aaa4618a58a1357705cdc1874962ad369309543230394bb77548b", "signature": "0xc35e0a5440cecd7d15f1c46597a1dc0c3ca36295738c986de61bc2f06a2573e16cae335452a0741f73e2e849b9e4e29d751566bf6639a15aecf5877b05d10f02"}, {"type": 0, "publicKey": "0xf18f3f6a2d940b9bacd3084713f6877db22064ada4335cb53ae1da75044f978d", "signature": "0x8252066947a8480560e3cdbf94ca31d72813898c5937f2fc3a1160861ae72ca77f604a6997fcdf7be5a51bfc3933abb21ed2e0590a011481c5575a5a5890fb00"}]}} block = Block.from_dict(block_dict) assert block.as_dict() == block_dict assert isinstance(block.payload, Payload) diff --git a/bindings/python/tests/test_offline.py b/bindings/python/tests/test_offline.py index 9cb35d1ac7..c0f5f9931f 100644 --- a/bindings/python/tests/test_offline.py +++ b/bindings/python/tests/test_offline.py @@ -99,6 +99,6 @@ def test_hex_utf8(): def test_block(): block_dict = {"protocolVersion": 2, "parents": ["0x28dbf8f5005c0de388cbbf23d14645a579fc0cb8278ad9cdc5a4252c7e8f0ed3", "0x440dbc33bf05c334c6d49f06514526d7f3e3c758028a2e87636e19f886290900", - "0xd76cdb7acf228ecdad590a42b91acc077c1518c1a271411229e33e050fc19b44", "0xecef38d3af7e63da78a5e70128efe371f2191088b31879f7b0e81da657fa21c6"], "payload": {"type": 5, "tag": "0x68656c6c6f", "data": "0x68656c6c6f"}, "nonce": "6917529027641139843"} + "0xd76cdb7acf228ecdad590a42b91acc077c1518c1a271411229e33e050fc19b44", "0xecef38d3af7e63da78a5e70128efe371f2191088b31879f7b0e81da657fa21c6"], "payload": {"type": 5, "tag": "0x68656c6c6f", "data": "0x68656c6c6f"}} block = Block.from_dict(block_dict) assert block.id() == "0x7ce5ad074d4162e57f83cfa01cd2303ef5356567027ce0bcee0c9f57bc11656e"