Skip to content
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

Added method to compute over-the-wire CBOR encoded transaction size #4521

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

crocodile-dentist
Copy link
Contributor

@crocodile-dentist crocodile-dentist commented Aug 1, 2024

Description

A method for computing the true size of cbor encoded transactions is proposed which is useful and convenient for the upcoming changes to the diffusion layer.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/tx-wire-size branch 3 times, most recently from 9b7fe28 to 5268608 Compare August 1, 2024 12:58
@crocodile-dentist crocodile-dentist added the enhancement New feature or request label Aug 1, 2024
@crocodile-dentist crocodile-dentist marked this pull request as draft August 1, 2024 13:25
@crocodile-dentist crocodile-dentist marked this pull request as ready for review August 1, 2024 14:21
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integer overflows is one of the leading causes of vulnerabilities. We should do our absolute best in preventing or guarding against overflows, even if they seem impossible, hence are my suggestions.

Other than that it looks good.

eras/babbage/impl/src/Cardano/Ledger/Babbage/Tx.hs Outdated Show resolved Hide resolved
eras/conway/impl/src/Cardano/Ledger/Conway/Tx.hs Outdated Show resolved Hide resolved
libs/cardano-ledger-core/cardano-ledger-core.cabal Outdated Show resolved Hide resolved
libs/cardano-ledger-core/CHANGELOG.md Outdated Show resolved Hide resolved
eras/shelley/impl/src/Cardano/Ledger/Shelley/Tx.hs Outdated Show resolved Hide resolved
eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Tx.hs Outdated Show resolved Hide resolved
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/tx-wire-size branch 7 times, most recently from fd31bc2 to 163c89b Compare August 5, 2024 22:09
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thank you. Couple of minor issues with changelogs. In case you are curious to learn our release and versioning process for the future you can find it here: https://github.com/IntersectMBO/cardano-ledger/blob/master/RELEASING.md

eras/alonzo/impl/CHANGELOG.md Outdated Show resolved Hide resolved
eras/shelley/impl/CHANGELOG.md Outdated Show resolved Hide resolved
libs/cardano-ledger-core/CHANGELOG.md Outdated Show resolved Hide resolved
libs/cardano-ledger-core/src/Cardano/Ledger/Core.hs Outdated Show resolved Hide resolved
Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are currently having an issue with CI, somehow started running out of disk space, so don't worry about we are working on it.

eras/allegra/impl/cardano-ledger-allegra.cabal Outdated Show resolved Hide resolved
eras/alonzo/impl/cardano-ledger-alonzo.cabal Outdated Show resolved Hide resolved
eras/alonzo/test-suite/cardano-ledger-alonzo-test.cabal Outdated Show resolved Hide resolved
eras/babbage/impl/cardano-ledger-babbage.cabal Outdated Show resolved Hide resolved
eras/conway/impl/cardano-ledger-conway.cabal Outdated Show resolved Hide resolved
eras/shelley/impl/cardano-ledger-shelley.cabal Outdated Show resolved Hide resolved
eras/shelley/test-suite/cardano-ledger-shelley-test.cabal Outdated Show resolved Hide resolved
libs/cardano-ledger-api/cardano-ledger-api.cabal Outdated Show resolved Hide resolved
libs/cardano-ledger-core/cardano-ledger-core.cabal Outdated Show resolved Hide resolved
libs/cardano-ledger-core/CHANGELOG.md Outdated Show resolved Hide resolved
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/tx-wire-size branch 2 times, most recently from 54ec1d0 to 5a20bc3 Compare August 8, 2024 07:45
@crocodile-dentist crocodile-dentist merged commit 94752aa into master Aug 8, 2024
125 of 127 checks passed
@crocodile-dentist crocodile-dentist deleted the mwojtowicz/tx-wire-size branch August 8, 2024 18:17
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 23, 2024
# 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
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 24, 2024
# 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
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 24, 2024
# 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
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 24, 2024
# 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
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 24, 2024
# 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
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 24, 2024
# 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
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 24, 2024
# 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
crocodile-dentist added a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Sep 24, 2024
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants