You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
}
i need to open and close the transaction receipt as the builder of SendTransaction won't let me use the receipt and forces a creation and copy of another builder.
Sending the response to the client requires re-encoding of the data in the client SDK format. Accidentally, we use here the same format as our internal one, but we will probably support other formats as well.
We are aware of the performance hit of the copy but decided it's ok. It's a very small copy (not entire blocks, just a single receipt). If our format was accidentally JSON, paying this encoding and copy cost would have been very natural.
From API perspective, this copy is cumbersome on Membuffers on purpose, so every time you have a copy you'll feel it's a smell (which it is) and open an issue exactly like this one so we can examine if the copy is necessary or not :)
btw - if we decided this copy is too much to handle and we would have wanted to eliminate it at all cost, this is possible but complicates the client response format a little
this is what we do in gossip (where the copies are expensive since it's entire blocks)
The solution in this case would be to provide the publicAPI the response in multiple chunks (a separate membuffer for the receipt for example). And then the publicAPI would write it on socket to the client in multiple write operations.
This would be truly zero copies (like the rest of the system), but I think it's overkill for now from a complexity perspective.
Code from Public-API
func prepareResponse(transactionOutput *services.AddNewTransactionOutput) *services.SendTransactionOutput {
var receiptForClient *protocol.TransactionReceiptBuilder = nil
}
i need to open and close the transaction receipt as the builder of SendTransaction won't let me use the receipt and forces a creation and copy of another builder.
opened during code review by shai ...
@erankirsh @electricmonk
The text was updated successfully, but these errors were encountered: