-
Notifications
You must be signed in to change notification settings - Fork 152
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
Make illegal states of Block<T>
& Transaction<T>
unrepresentable
#1164
Comments
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
Block<T>
& Transaction<T>
: Make illegal states unrepresentable
Block<T>
& Transaction<T>
: Make illegal states unrepresentableBlock<T>
& Transaction<T>
unrepresentable
PreambleWell, this is really getting out of hand. Indeed, After a careful inspection, there seems to be two major issues:
To summarize the issues even further, in essence, the design of There are also policy level complications arising from having For everyone's sanity, and especially mine, some overview of the creation processes of a Creation of
|
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
I'm recently working on #1979, addresses #1974, and I'm roughly shaping an idea on all possible stages of transactions. It's parallel to stages on blocks drawn at #1492 in general, except that I'm trying to prefer composition over implementation inheritance this time. Their stages can be placed on a 2×2 matrix, divided by two aspects: Signed or unsigned yet? Having actions or no actions? Here's the matrix:
Note that some interfaces/classes are not implemented yet. I'm going to make a patch to complete the above matrix. For more details, here's a class diagram as well: classDiagram
ITxMetadata <|-- ISignedTxMetadata : extends
ITxMetadata <|-- ITxContent~T~ : extends
ISignedTxMetadata <|-- ITxExcerpt~T~ : extends
ITxMetadata <|-- TxMetadata : implements
ITxContent~T~ <|-- TxContent~T~ : implements
ITxContent~T~ <|-- Transaction~T~ : implements
ITxExcerpt~T~ <|-- Transaction~T~ : implements
TxMetadata *-- TxContent~T~ : composition
TxContent~T~ *-- Transaction~T~ : composition
class ITxMetadata {
<<interface>>
+long Nonce
+Address Signer
+DateTimeOffset Timestamp
+PublicKey PublicKey
+BlockHash? GenesisHash
+IImmutableSet~Address~ UpdatedAddresses
}
class ISignedTxMetadata {
<<interface>>
+ImmutableArray~byte~ Signature
}
class ITxContent~T~ {
<<interface>>
+IImmutableList~T~ Actions
}
class ITxExcerpt~T~ {
<<interface>>
+TxId Id
}
class TxMetadata {
<<sealed class>>
+ToBencodex(IEnumerable~IAction~ actions, ImmutableArray~byte~? signature) Dictionary
}
class TxContent~T~ {
<<sealed class>>
-TxMetadata _metadata
+Sign() Transaction~T~
+ToBencodex(ImmutableArray~byte~? signature) Dictionary
}
class Transaction~T~ {
<<sealed class>>
-TxContent~T~ _content
+ToBencodex() Dictionary
}
FYI I'm going to let Footnotes
|
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
Related: #1146.
To be elaborated.
The text was updated successfully, but these errors were encountered: