-
Notifications
You must be signed in to change notification settings - Fork 88
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
Expose transaction size to tx submission #4926
Conversation
4c167f7
to
6bade12
Compare
4430a29
to
c82ba98
Compare
c82ba98
to
1658b24
Compare
-> (tx -> SizeInBytes) -- ^ get size of CBOR encoded transaction | ||
-> NodeToNodeVersion | ||
-> ControlMessageSTM m | ||
-> TxSubmissionClient txid tx m () | ||
txSubmissionOutbound tracer maxUnacked TxSubmissionMempoolReader{..} _version controlMessageSTM = | ||
txSubmissionOutbound tracer maxUnacked TxSubmissionMempoolReader{..} _txSize _version controlMessageSTM = |
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.
Does the outbound side need the callback, or can we use the sizes from the mempool?
Maybe we should change the mempool interface, to give us just [txid]
s rather than [(txid, SizeInBytes)]
- so we don't have multiple ways of getting that information, possibly in a non-compatible way.
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've removed the callback from the outbound side. We can keep the interface as-is for now, and if/when the annotated codec gets integrated we can remove SizeInBytes
from the mempool API.
txSubmissionInbound tracer (NumTxIdsToAck maxUnacked) mpReader mpWriter _version = | ||
txSubmissionInbound tracer (NumTxIdsToAck maxUnacked) mpReader mpWriter _txSize _version = |
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.
Can we verify the tx sizes using an assert
-ion? I'd expect that production nodes run without assertions, and this would give us a chance to verify that this works well.
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.
Good idea - @karknu commented on slack I think that this maybe should be in an #ifdef.
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 don't think we need CPP for it, assert
-tions are only enforced if one compiled the node with -fno-ignore-asserts
flag.
e0a9467
to
7500a79
Compare
bcf6575
to
0cc240c
Compare
0cc240c
to
0cfe8ae
Compare
* Added callback providing tx size to txSubmissionInbound * changelog update
* Added callback providing tx size to txSubmissionInbound * changelog update
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
# Description This change introduces a new method wireSizeTx for the LedgerSupportsMempool class. It provides actual CBOR encoded transaction size as it is when transmitted over the network, which the difffusion layer could exploit. Also note that: - New code should be properly tested (even if it does not add new features). - The fix for a regression should include a test that reproduces said regression. IntersectMBO/cardano-ledger#4521 IntersectMBO/ouroboros-network#4926
Description
A callback, exposing CBOR-encoded transaction size as it is when transmitted over the network, is provided to
tx submission inbound and outbound handlers. The size returned by this function does not take into account some additional wrapping that happens when a transaction is sent across the network. Namely, it does not include header data for CBOR-in-CBOR encoding (a tag + it's value to indicate a blob payload, and an encodeBytes tag ~ so roughly 3 words) neither the top level header which consists of EncodeListLen tag + it's value, era word tag + era index word, so ~4 words).
IntersectMBO/cardano-ledger#4521
IntersectMBO/ouroboros-consensus#1211
Checklist
Quality
Maintenance
ouroboros-network
project.