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

[BUG] - ledger and cardano-api transaction sizes are different #590

Open
CarlosLopezDeLara opened this issue Jul 18, 2024 · 4 comments
Open

Comments

@CarlosLopezDeLara
Copy link
Contributor

Issue originally created here; reposting here for better visibility.
Not sure how big of a problem this discrepancy between ledger api is, but its worth investigating.

cardano-api ==9.0.0.0

Issue description: For all types of transaction, size reported by cardano-api is 1-byte more compared to the size reported by ledger.

Code used to report the transactions:

reportFee:: Tx ConwayEra -> IO () 
reportFee = case tx of
  ShelleyTx era ledgerTx -> let 
    txWitnesses = ledgerTx ^. L.witsTxL 
    sizeLedger = ledgerTx ^. L.sizeTxF
    sizeCapi = fromIntegral $  BS.length  $ serialiseToCBOR tx
    txFee=L.unCoin $ ledgerTx ^. L.bodyTxL ^. L.feeTxBodyL 
    in do 
      putStrLn $  "Fee      :   " ++ show txFee
      if sizeLedger /= sizeCapi
        then do 
          putStrLn $  "Tx Bytes (ledger):   " ++ show sizeLedger
          putStrLn $  "Tx Bytes (api)   :   " ++ show sizeCapi
        else
          putStrLn $  "Tx Bytes  :   " ++ show sizeCapi

Output log

1.1 SimpleMarketV2 Flow : "Mint Native Asset"
Fee      :   897
Tx Bytes (ledger):   796
Tx Bytes (api)   :   797

1.2 SimpleMarketV2 Flow : "Create reference script UTxO"
Fee      :   4944
Tx Bytes (ledger):   4843
Tx Bytes (api)   :   4844

1.3 SimpleMarketV2 Flow : "Place on Sell"
Fee      :   903
Tx Bytes (ledger):   802
Tx Bytes (api)   :   803

1.4 SimpleMarketV2 Flow : "Withdraw"
ExUnits     :  memory = 1085202 cpu = 293558927
Fee      :   88861
Tx Bytes (ledger):   4978
Tx Bytes (api)   :   4979

1.5 SimpleMarketV2 Flow : "Buy"
ExUnits     :  memory = 1750602 cpu = 465219918
Fee      :   139670
Tx Bytes (ledger):   5016
Tx Bytes (api)   :   5017
@CarlosLopezDeLara CarlosLopezDeLara changed the title [BUG] - [BUG] - ledger and cardano-api transaction sizes are different Jul 18, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

This comment was marked as off-topic.

@carbolymer
Copy link
Contributor

This is potentially fixed. To be confirmed: cardanoapi/hardfork-testing#43 (comment)

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants