Skip to content
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

[refactor] #132: refactor codegen for enum #135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
349 changes: 221 additions & 128 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ name = "iroha2"
crate-type = ["cdylib"]

[dependencies]
iroha_client = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-stable" }
iroha_crypto = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-stable" }
iroha_data_model = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-stable" }
iroha_version = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-stable" }
iroha_client = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }
iroha_config = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }
iroha_crypto = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }
iroha_data_model = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }
iroha_version = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }

color-eyre = "0.6"
parity-scale-codec = "3.1"
pyo3 = { version = "0.16.4", features = ["extension-module", "multiple-pymethods"] }
pyo3 = { version = "0.16.6", features = ["extension-module", "multiple-pymethods"] }
pythonize = "0.16.0"
serde = "1"
serde_json = "1"
24 changes: 13 additions & 11 deletions example/config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"TORII_API_URL": "http://iroha0:8080",
"ACCOUNT_ID": {
"name": "alice",
"domain_id": {
"name": "wonderland"
}
"PUBLIC_KEY": "ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0",
"PRIVATE_KEY": {
"digest_function": "ed25519",
"payload": "9ac47abf59b356e0bd7dcbbbb4dec080e302156a48ca907e47cb6aea1d32719e7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
},
"ACCOUNT_ID": "alice@wonderland",
"BASIC_AUTH": {
"web_login": "mad_hatter",
"password": "ilovetea"
},
"PUBLIC_KEY": "ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0",
"PRIVATE_KEY": {
"digest_function": "ed25519",
"payload": "9ac47abf59b356e0bd7dcbbbb4dec080e302156a48ca907e47cb6aea1d32719e7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
"TORII_API_URL": "http://127.0.0.1:8080",
"TORII_TELEMETRY_URL": "http://127.0.0.1:8180",
"TRANSACTION_TIME_TO_LIVE_MS": 100000,
"TRANSACTION_STATUS_TIMEOUT_MS": 15000,
"TRANSACTION_LIMITS": {
"max_instruction_number": 4096,
"max_wasm_size_bytes": 4194304
},
"LOGGER_CONFIGURATION": {}
"ADD_TRANSACTION_NONCE": false
}
19 changes: 9 additions & 10 deletions example/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from iroha2.data_model.domain import Domain
from iroha2.data_model.account import Account
from iroha2.data_model import asset, account
from iroha2.data_model.events import FilterBox, pipeline
from iroha2.data_model.events import FilterBox, pipeline, Event
from iroha2.crypto import KeyPair


def wait_for_tx(cl: Client, hash: str):
filter = FilterBox.Pipeline(
filter = FilterBox(
pipeline.EventFilter(
entity_kind=pipeline.EntityKind.Transaction(),
status_kind=None,
Expand All @@ -22,14 +22,13 @@ def wait_for_tx(cl: Client, hash: str):
listener = cl.listen(filter)

for event in listener:
if event.variant is event.Type.Pipeline:
if event.value.hash == hash:
if event.value.status.variant is pipeline.Status.Type.Committed:
return
elif event.value.status.variant is pipeline.Status.Type.Validating:
pass
else:
raise RuntimeError(f"Tx rejected: {event.value.status}")
if isinstance(event, Event.Pipeline) and event.hash == hash:
if isinstance(event.status, pipeline.Status.Committed):
return
elif isinstance(event.status, pipeline.Status.Validating):
pass
else:
raise RuntimeError(f"Tx rejected: {event.value.status}")


cfg = json.loads(open("./config.json").read())
Expand Down
9 changes: 5 additions & 4 deletions generate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ license-file = "../../LICENSE"
typing = []

[dependencies]
iroha_schema = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-stable" }
iroha_schema_gen = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-stable" }
iroha_data_model = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-stable" }
iroha_schema = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }
iroha_schema_gen = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }
iroha_data_model = { git = "https://github.com/hyperledger/iroha", branch = "iroha2-dev" }

color-eyre = "0.5"
color-eyre = "0.6.2"
serde_json = "1"
either = "1.6"
syn = { version = "1", features = ["full"] }
topological-sort = "0.2.2"
14 changes: 12 additions & 2 deletions generate/src/as_py.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,23 @@ impl fmt::Display for UnnamedStructClass {

impl fmt::Display for EnumClass {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let typespec = self
.variants
.iter()
.map(|(_, pytype)| format!("get_class({pytype})"))
.collect::<Vec<_>>()
.join(", ");
let variants = self
.variants
.iter()
.map(|(name, ty)| format!("(\"{}\", {})", name, ty))
.map(|(name, pytype)| format!("(\"{name}\", get_class({pytype}))"))
.collect::<Vec<_>>()
.join(", ");
write!(f, "{} = Enum[{}] ", self.name, variants)
writeln!(
f,
"{} = make_enum(\"{}\", [{variants}], typing.Union[{typespec}])",
self.name, self.name
)
}
}

Expand Down
7 changes: 6 additions & 1 deletion generate/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ impl Module {
}
writeln!(
f,
"from .{}rust import Enum, make_struct, make_tuple, Dict",
r#"
from .{}rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing
"#,
".".repeat(r#in.mods.len())
)?;

Expand All @@ -108,6 +111,8 @@ impl Module {
Self::write_meta(&mut f, name.clone(), ty.clone())
.wrap_err_with(|| eyre!("Failed to write metadata for type {}", name))?;
}

writeln!(f, "SelfResolvingTypeVar.resolve_all()")?;
drop(f);

for (name, either_module) in modules {
Expand Down
2 changes: 1 addition & 1 deletion iroha2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def submit_tx(self, tx: list):
return self.cl.submit_all_with_metadata(tx, {})

def submit_isi(self, isi):
return self.submit_tx([_Instruction(isi)])
return self.submit_tx([])

def submit_tx_blocking(self, tx: list):
tx = [i.to_rust() for i in tx]
Expand Down
3 changes: 2 additions & 1 deletion iroha2/data_model/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def __init__(self, id: Union[Id, str], logo: Optional[str] = None):
logo=logo,
accounts={},
asset_definitions={},
metadata={})
metadata={},
asset_total_quantities={})

def registrable(self):
return _NewDomain(id=self.id, logo=self.logo, metadata={})
6 changes: 5 additions & 1 deletion iroha2/sys/AtomicU32Wrapper/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/Compact/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/Duration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

Duration = make_tuple("Duration", [int, int])
SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/FixedPoint/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/Map/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/Option/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/String/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/Vec/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from ..iroha2 import *
from .rust import Enum, make_struct, make_tuple, Dict

from .rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/bool/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/i64/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
16 changes: 11 additions & 5 deletions iroha2/sys/iroha_core/block/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from ...rust import Enum, make_struct, make_tuple, Dict
BlockHeader = make_struct("BlockHeader", [("timestamp", int), ("consensus_estimation", int), ("height", int), ("previous_block_hash", "iroha_crypto.hash.HashOf"), ("transactions_hash", "iroha_crypto.hash.HashOf"), ("rejected_transactions_hash", "iroha_crypto.hash.HashOf"), ("view_change_proofs", "iroha_core.sumeragi.view_change.ProofChain"), ("invalidated_blocks_hashes", list), ("genesis_topology", "iroha_core.sumeragi.network_topology.Topology")])

from ...rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

BlockHeader = make_struct("BlockHeader", [("timestamp", int), ("consensus_estimation", int), ("height", int), ("view_change_index", int), ("previous_block_hash", "iroha_crypto.hash.HashOf"), ("transactions_hash", "iroha_crypto.hash.HashOf"), ("rejected_transactions_hash", "iroha_crypto.hash.HashOf"), ("genesis_topology", "iroha_core.sumeragi.network_topology.Topology")])

CandidateBlock = make_struct("CandidateBlock", [("header", "iroha_core.block.BlockHeader"), ("rejected_transactions", list), ("transactions", list), ("signatures", "iroha_crypto.signature.SignaturesOf"), ("event_recommendations", list)])

CommittedBlock = make_struct("CommittedBlock", [("header", "iroha_core.block.BlockHeader"), ("rejected_transactions", list), ("transactions", list), ("event_recommendations", list), ("signatures", "iroha_crypto.signature.SignaturesOf")])

ValidBlock = make_struct("ValidBlock", [("header", "iroha_core.block.BlockHeader"), ("rejected_transactions", list), ("transactions", list), ("signatures", list), ("event_recommendations", list)])
VersionedCandidateBlock = make_enum("VersionedCandidateBlock", [("V1", get_class("iroha_core.block.CandidateBlock"))], typing.Union[get_class("iroha_core.block.CandidateBlock")])

VersionedCommittedBlock = make_enum("VersionedCommittedBlock", [("V1", get_class("iroha_core.block.CommittedBlock"))], typing.Union[get_class("iroha_core.block.CommittedBlock")])

VersionedCommittedBlock = Enum[("V1", "iroha_core.block.CommittedBlock")]
VersionedValidBlock = Enum[("V1", "iroha_core.block.ValidBlock")]
SelfResolvingTypeVar.resolve_all()
16 changes: 11 additions & 5 deletions iroha2/sys/iroha_core/block/stream/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from ....rust import Enum, make_struct, make_tuple, Dict
BlockPublisherMessage = Enum[("SubscriptionAccepted", type(None)), ("Block", "iroha_core.block.VersionedCommittedBlock")]
BlockSubscriberMessage = Enum[("SubscriptionRequest", int), ("BlockReceived", type(None))]
VersionedBlockPublisherMessage = Enum[("V1", "iroha_core.block.stream.BlockPublisherMessage")]
VersionedBlockSubscriberMessage = Enum[("V1", "iroha_core.block.stream.BlockSubscriberMessage")]

from ....rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

BlockMessage = make_tuple("BlockMessage", ["iroha_core.block.VersionedCommittedBlock"])
BlockSubscriptionRequest = make_tuple("BlockSubscriptionRequest", [int])
VersionedBlockMessage = make_enum("VersionedBlockMessage", [("V1", get_class("iroha_core.block.stream.BlockMessage"))], typing.Union[get_class("iroha_core.block.stream.BlockMessage")])

VersionedBlockSubscriptionRequest = make_enum("VersionedBlockSubscriptionRequest", [("V1", get_class("iroha_core.block.stream.BlockSubscriptionRequest"))], typing.Union[get_class("iroha_core.block.stream.BlockSubscriptionRequest")])

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_core/genesis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from ...rust import Enum, make_struct, make_tuple, Dict

from ...rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

GenesisTransaction = make_struct("GenesisTransaction", [("isi", list)])

RawGenesisBlock = make_struct("RawGenesisBlock", [("transactions", list)])

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_core/smartcontracts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ...rust import Enum, make_struct, make_tuple, Dict

from ...rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_core/smartcontracts/isi/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ....rust import Enum, make_struct, make_tuple, Dict

from ....rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
9 changes: 7 additions & 2 deletions iroha2/sys/iroha_core/smartcontracts/isi/error/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .....rust import Enum, make_struct, make_tuple, Dict
FindError = Enum[("Asset", "iroha_data_model.asset.Id"), ("AssetDefinition", "iroha_data_model.asset.DefinitionId"), ("Account", "iroha_data_model.account.Id"), ("Domain", "iroha_data_model.domain.Id"), ("MetadataKey", "iroha_data_model.name.Name"), ("Block", "iroha_crypto.hash.HashOf"), ("Transaction", "iroha_crypto.hash.HashOf"), ("Context", str), ("Peer", "iroha_data_model.peer.Id"), ("Trigger", "iroha_data_model.trigger.Id"), ("Role", "iroha_data_model.role.Id"), ("PermissionTokenDefinition", "iroha_data_model.permissions.Id")]

from .....rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

FindError = make_enum("FindError", [("Asset", get_class("iroha_data_model.asset.Id")), ("AssetDefinition", get_class("iroha_data_model.asset.DefinitionId")), ("Account", get_class("iroha_data_model.account.Id")), ("Domain", get_class("iroha_data_model.domain.Id")), ("MetadataKey", get_class("iroha_data_model.name.Name")), ("Block", get_class("iroha_crypto.hash.HashOf")), ("Transaction", get_class("iroha_crypto.hash.HashOf")), ("Context", get_class(str)), ("Peer", get_class("iroha_data_model.peer.Id")), ("Trigger", get_class("iroha_data_model.trigger.Id")), ("Role", get_class("iroha_data_model.role.Id")), ("PermissionTokenDefinition", get_class("iroha_data_model.permission.token.Id")), ("Validator", get_class("iroha_data_model.permission.validator.Id"))], typing.Union[get_class("iroha_data_model.asset.Id"), get_class("iroha_data_model.asset.DefinitionId"), get_class("iroha_data_model.account.Id"), get_class("iroha_data_model.domain.Id"), get_class("iroha_data_model.name.Name"), get_class("iroha_crypto.hash.HashOf"), get_class("iroha_crypto.hash.HashOf"), get_class(str), get_class("iroha_data_model.peer.Id"), get_class("iroha_data_model.trigger.Id"), get_class("iroha_data_model.role.Id"), get_class("iroha_data_model.permission.token.Id"), get_class("iroha_data_model.permission.validator.Id")])

SelfResolvingTypeVar.resolve_all()
9 changes: 7 additions & 2 deletions iroha2/sys/iroha_core/smartcontracts/isi/query/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .....rust import Enum, make_struct, make_tuple, Dict
Error = Enum[("Decode", "iroha_version.error.Error"), ("Signature", str), ("Permission", str), ("Evaluate", str), ("Find", "iroha_core.smartcontracts.isi.error.FindError"), ("Conversion", str), ("Unauthorized", type(None))]

from .....rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

Error = make_enum("Error", [("Decode", get_class("iroha_version.error.Error")), ("Signature", get_class(str)), ("Permission", get_class(str)), ("Evaluate", get_class(str)), ("Find", get_class("iroha_core.smartcontracts.isi.error.FindError")), ("Conversion", get_class(str)), ("Unauthorized", get_class(type(None)))], typing.Union[get_class("iroha_version.error.Error"), get_class(str), get_class(str), get_class(str), get_class("iroha_core.smartcontracts.isi.error.FindError"), get_class(str), get_class(type(None))])

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_core/sumeragi/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ...rust import Enum, make_struct, make_tuple, Dict

from ...rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
8 changes: 6 additions & 2 deletions iroha2/sys/iroha_core/sumeragi/network_topology/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from ....rust import Enum, make_struct, make_tuple, Dict
Topology = make_struct("Topology", [("sorted_peers", list), ("at_block", "iroha_crypto.hash.HashOf"), ("view_change_proofs", "iroha_core.sumeragi.view_change.ProofChain")])

from ....rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

Topology = make_struct("Topology", [("sorted_peers", list), ("at_block", "iroha_crypto.hash.HashOf")])

SelfResolvingTypeVar.resolve_all()
7 changes: 5 additions & 2 deletions iroha2/sys/iroha_core/sumeragi/view_change/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from ....rust import Enum, make_struct, make_tuple, Dict

from ....rust import make_enum, make_struct, make_tuple, Dict, get_class
import typing

BlockCreationTimeout = make_tuple("BlockCreationTimeout")
CommitTimeout = make_struct("CommitTimeout", [("hash", "iroha_crypto.hash.HashOf")])

Expand All @@ -9,4 +12,4 @@

ProofPayload = make_struct("ProofPayload", [("previous_proof", "iroha_crypto.hash.HashOf"), ("latest_block", "iroha_crypto.hash.HashOf"), ("reason", "iroha_core.sumeragi.view_change.Reason")])

Reason = Enum[("CommitTimeout", "iroha_core.sumeragi.view_change.CommitTimeout"), ("NoTransactionReceiptReceived", "iroha_core.sumeragi.view_change.NoTransactionReceiptReceived"), ("BlockCreationTimeout", "iroha_core.sumeragi.view_change.BlockCreationTimeout")]
Reason = make_enum("Reason", [("CommitTimeout", get_class("iroha_core.sumeragi.view_change.CommitTimeout")), ("NoTransactionReceiptReceived", get_class("iroha_core.sumeragi.view_change.NoTransactionReceiptReceived")), ("BlockCreationTimeout", get_class("iroha_core.sumeragi.view_change.BlockCreationTimeout"))], typing.Union[get_class("iroha_core.sumeragi.view_change.CommitTimeout"), get_class("iroha_core.sumeragi.view_change.NoTransactionReceiptReceived"), get_class("iroha_core.sumeragi.view_change.BlockCreationTimeout")])
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_crypto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from ..rust import Enum, make_struct, make_tuple, Dict

from ..rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

PublicKey = make_struct("PublicKey", [("digest_function", str), ("payload", list)])

SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_crypto/hash/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from ...rust import Enum, make_struct, make_tuple, Dict

from ...rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

Hash = make_tuple("Hash", [list])
HashOf = make_tuple("HashOf", ["iroha_crypto.hash.Hash"])
SelfResolvingTypeVar.resolve_all()
6 changes: 5 additions & 1 deletion iroha2/sys/iroha_crypto/merkle/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from ...rust import Enum, make_struct, make_tuple, Dict

from ...rust import make_enum, make_struct, make_tuple, get_class, SelfResolvingTypeVar, Dict
import typing

SelfResolvingTypeVar.resolve_all()
Loading