hashgraph / hedera-sdk-reference

Hedera SDK specification repository.
Apache License 2.0
6 stars 1 forks source link

HIP-745: Optionally send transaction data without required transaction fields #127

Open SimiHunjan opened 1 year ago

SimiHunjan commented 1 year ago

Problem

Summary

It should be possible to serialise a transaction without freezing it and in addition, it should be possible to serialise an incomplete transaction (e.g. missing node_account_id and transaction_id as a minimum, maybe others). It should also be possible to add signatures to a transaction without freezing it.

HIP: 745

Solution

Alternatives

No response

izik1 commented 1 year ago

WRT deprecating freeze:

What happens when you call add_signature / addSignature? (https://github.com/hashgraph/hedera-sdk-java/blob/3b455fd6afb224a32eab15ef7506f1e0dbdf1212/sdk/src/main/java/com/hedera/hashgraph/sdk/Transaction.java#L895C1-L895C1 in Java land)

This and related functions (getTransactionHash and its variants come to mind) very explicitly need the transaction to be frozen because it depends on there being an internal serialized transaction with a transaction ID and a node account ID since it... adds a signature to a SignedTransaction protobuf (or for getTransactionHash+variants, hashes the TransactionBody), and from that point onwards changing the body in any way invalidates every signature added like this. There is no way to work around this requirement or I would have done so already, given the amount of headache doing everything the way I did caused.

petreze commented 1 year ago

@izik1 I've come up with the same conclusion here. For a transaction that requires a signature (except for the operator's signature which is added on execute), it needs to be complete, without any missing fields (frozen) because every other change after a signature is added will make the tx invalid. And if that happens, we would not have the signing function of the key in order to sign again the tx with the same key after the change