-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
|
||
# Summary | ||
|
||
This feature is responsible for the creation and interpretation of transactions and bundles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'ld like the Summary
a little bit more detailed, what is actually introduced by this feature. I know that transactions and bundles are absolutely essential to IOTA, but for consistency with other RFCs could you write this section "as if" you would introduce those concepts with this proposal. I think we can expect the reader to have "some" DLT knowledge (so this summary should still remain rather short), but IMHO we should write those RFCs also for people that are fairly new to IOTA to get as many people involved as possible. The summary/abstract will be the first thing someone interested in it will read, and most of the times the last thing as well.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
IOTA is a distributed ledger that was designed for payment settlement and data transfer between machines and devices in the Internet of Things (IoT) ecosystem. | ||
The data packets that are sent through the network are called "transactions". | ||
Settlements or data transfers can be done with the help of these transactions. Payment settlements require the help of multiple transactions. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think those sentences should move into the summary as they very well provide the necessary context to understand this proposal. To not repeat yourself in this section, you could pick up from the summary and elaborate on what transactions and bundles are in more detail, and how they are useful or even indispensable for the Bee framework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Alex6323 here.
Updated the sentence how transactions can be built. Removed tx hash from Transaction struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this RFC because I understand its purpose, and because I feel like it fulfills (or is very close to fulfilling) the requirement of taking care of a specific, cleanly separated concern.
The proposal should definitely separate the Transaction
and Bundle
types into their respective RFCs, because these seem to be sufficiently different.
The RFC can mention that the Transaction
type could live in its own crate.
|
||
# Summary | ||
|
||
This feature is responsible for the creation and interpretation of transactions and bundles. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
IOTA is a distributed ledger that was designed for payment settlement and data transfer between machines and devices in the Internet of Things (IoT) ecosystem. | ||
The data packets that are sent through the network are called "transactions". | ||
Settlements or data transfers can be done with the help of these transactions. Payment settlements require the help of multiple transactions. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Alex6323 here.
|
||
# Drawbacks | ||
|
||
Without any bee-model crate, nodes can not exchange transactions. Therefore this crate seems necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drawbacks should ideally also discuss the drawbacks of this design. :)
I am thinking of the String
types, for example, which could also be done as their own types.
- The distinction between Transaction and Transaction Builder as well as Bundle and Bundle Builder makes the code cleaner | ||
and helps achieve correctness among the data objects. Properties are clearly assigned to specific data objects and not mixed up. | ||
|
||
- The proposed crate interface is intuitive. Completely different alternatives did not naturally come to mind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's intuitive is for users to decide. I agree however that it is a very natural proposition to basically treat the incoming transaction as some encoded binary blob.
@@ -0,0 +1,334 @@ | |||
+ Feature Name: `bee-model-crate` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should rename it to something like iri-transaction-model
or mainnet-transaction-model
or v1-transaction-model
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vote for versioning since mainnet-transaction-model
is not time-proof and iri-transaction-model
is not really the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you want to version it?
@@ -0,0 +1,334 @@ | |||
+ Feature Name: `bee-model-crate` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vote for versioning since mainnet-transaction-model
is not time-proof and iri-transaction-model
is not really the case.
```rust | ||
struct Transaction { | ||
|
||
signature_fragments: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like the name to reflect that it doesn't necessarily contain a signature. signature_or_message
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to even not contain this field if the instance doesn't have signature_or_message
? It would be sth like this:
signature_fragments: String, | |
signature_or_message: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option
still allocates memory for the field so it's not really helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SuperFluffy what are your thoughts regarding Option
. Semantically, it would be more correct, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it makes more sense "semantically", an empty sig_or_msg doesn't mean there is no sig_or_msg. There is always a sig_or_msg :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, so maybe Option isn't necessary. And if we use static types, we could initialize it with an empty (9's) SignatureOrMessageFragment
and could be sure the internal state of the builder object is always valid.
Co-Authored-By: Thibault Martinez <[email protected]>
Co-Authored-By: Thibault Martinez <[email protected]>
Co-Authored-By: Thibault Martinez <[email protected]>
…able, added unresolved question, removed Bundle part since its better to have it as separate RFC.
|
Co-Authored-By: Wu Yu Wei <[email protected]>
…n't needed anymore, removed it from the build() of TransactionBuilder. Changed visibility of fields in TransactionBuilder to private. Setter/getter functions will be used to set/access fields. Moved from_bytes() constructor of Transaction to TransactionBuilder. TransactionBuilder also allows to set Timestamp and Nonce manually in case they are available.
…transaction is a tuple", and fixed typo
…d info regarding the Pow:compute(&TransactionBuilder) call since it should not be overseen and reviewed.
|
||
- Introducing a fluent API to the TransactionBuilder? | ||
- Should we use Option<T> for the fields in TransactionBuilder? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some fields would need this I guess. Others like timestamp, index etc are mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build
method is responsible for ensuring that mandatory fields are set, returning Result::Err
if not. The type of the field is Option
if there is no natural (read: meaningful) way of providing a default.
| `signature_or_message_fragment` | contains the signature of the transfer | | | ||
| | or user-defined message data | 6561 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's no need to be separate line. Besides, this would become totally different row. Normal markdown display would just adjust them.
| `signature_or_message_fragment` | contains the signature of the transfer | | | |
| | or user-defined message data | 6561 | | |
| `signature_or_message_fragment` | contains the signature of the transfer or user-defined message data | 6561 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SuperFluffy I think we could ignore max chars limit during table format. We should make representation correct at least.
| `address` | receiver (output) if value > 0, | ||
| | or sender (input) if value < 0 | 243 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Yeah, I wanted to stay within the number of max chars per line we discussed.
I thought GitHub markdown supports multiline table cells, but I either
chose the wrong table format or GitHub doesn't support these kinds of raw
tables as pandoc does.
…On Mon, Oct 14, 2019, 4:30 PM Wu Yu Wei ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In text/0000-bee-model-crate/0000-bee-model-crate.md
<#3 (comment)>:
> +| `signature_or_message_fragment` | contains the signature of the transfer | |
+| | or user-defined message data | 6561 |
I think it's no need to be separate line. Besides, this would become
totally different row. Normal markdown display would just adjust them.
⬇️ Suggested change
-| | or user-defined message data | 6561 |
+| `signature_or_message_fragment` | contains the signature of the transfer or user-defined message data | 6561 |
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3?email_source=notifications&email_token=AAFLF6PY3XCAV3PIT2664J3QOR67NA5CNFSM4IUNFOQKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCH3CK2I#pullrequestreview-301344105>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFLF6PUP6JTAXDSMFLQ2N3QOR67NANCNFSM4IUNFOQA>
.
|
The `TransactionError` is not fully fleshed out yet. For the time being, it | ||
definitely contains `io::Error`: | ||
|
||
```rust | ||
pub enum TransactionError { | ||
Io(io::Error), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also start considering which error handling library to use. I saw there's another new one called thiserror. What do you think?
unimplemented!() | ||
} | ||
|
||
pub fn address(&mut self, address: Address) -> &mut Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about give a proper setter method prefix like set_address
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as RFC #344 notes it:
https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#gettersetter-apis
Incorporated into #20. While discussing the design of the |
Rendered
Based on iotaledger/bee#43