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

Bump to cardano-api-8.20 #1075

Merged
merged 8 commits into from
Sep 21, 2023
Merged

Bump to cardano-api-8.20 #1075

merged 8 commits into from
Sep 21, 2023

Conversation

locallycompact
Copy link
Contributor

@locallycompact locallycompact commented Sep 14, 2023

cardano-api: 8.11 -> 8.20.0
plutus: 1.7 -> 1.9

Drop BundledProtocolParameters and ProtocolParameters in favour of PParams LedgerEra

@github-actions
Copy link

github-actions bot commented Sep 18, 2023

Transactions Costs

Sizes and execution budgets for Hydra protocol transactions. Note that unlisted parameters are currently using arbitrary values and results are not fully deterministic and comparable to previous runs.

Metadata
Generated at 2023-09-21 11:18:38.483584377 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial eaf589de11c6c805af24b759e7794d62661d3db4ade79594892ebaec 4106
νCommit 8dcc1fb34d1ba168dfb0b82e7d1a31956a2db5856f268146b0fd7f2a 2051
νHead e35bdf32cd3806596150c1cbab6ab5456bd957b36019ed2746bf481d 8797
μHead 386ad19467be96131379dacf57a9351a762da2dee3486a855f0409c9* 4151
  • The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per Head.

Cost of Init Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 4746 12.10 4.78 0.49
2 4947 14.42 5.66 0.53
3 5154 16.54 6.45 0.56
5 5569 21.38 8.31 0.63
10 6589 33.19 12.80 0.80
38 12329 98.95 37.83 1.76

Cost of Commit Transaction

This is using ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 599 12.64 4.97 0.31
2 787 16.26 6.61 0.36
3 972 20.11 8.33 0.42
5 1346 28.32 11.97 0.52
10 2279 51.07 21.87 0.82
18 3782 94.67 40.33 1.37

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 821 23.54 9.38 0.44
2 114 1136 37.28 14.96 0.61
3 170 1464 54.49 21.96 0.81
4 227 1775 69.17 28.16 0.99
5 282 2096 90.72 37.01 1.24

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 685 19.18 8.82 0.40
2 897 20.95 10.40 0.43
3 962 20.42 9.21 0.42
5 1533 26.06 15.08 0.54
10 2510 33.77 22.23 0.69
50 10555 97.85 81.03 1.99

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 735 22.68 10.15 0.44
2 939 24.65 11.79 0.48
3 1170 26.47 13.39 0.51
5 1574 30.20 16.49 0.58
10 2556 39.10 24.15 0.75
43 8997 96.84 74.05 1.86

Cost of Abort Transaction

Some variation because of random mixture of still initial and already committed outputs.

Parties Tx size % max Mem % max CPU Min fee ₳
1 4970 21.22 9.16 0.61
2 5407 36.15 15.76 0.79
3 5680 48.36 20.98 0.94
4 6399 74.87 32.99 1.27

Cost of FanOut Transaction

Involves spending head output and burning head tokens. Uses ada-only UTxO for better comparability.

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
5 0 0 4767 8.95 3.77 0.46
5 1 57 4800 9.73 4.35 0.47
5 5 286 4952 15.28 7.68 0.55
5 10 570 5127 21.68 11.61 0.63
5 20 1139 5482 34.51 19.49 0.81
5 30 1707 5847 47.94 27.62 0.99
5 40 2275 6205 60.78 35.51 1.17
5 50 2845 6560 73.79 43.47 1.35
5 70 3988 7284 99.99 59.46 1.71

End-To-End Benchmark Results

This page is intended to collect the latest end-to-end benchmarks results produced by Hydra's Continuous Integration system from the latest master code.

Please take those results with a grain of salt as they are currently produced from very limited cloud VMs and not controlled hardware. Instead of focusing on the absolute results, the emphasis should be on relative results, eg. how the timings for a scenario evolve as the code changes.

Generated at 2023-09-21 11:11:24.915811904 UTC

3-nodes Scenario

A rather typical setup, with 3 nodes forming a Hydra head.

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 90.214231280
P99 253.559378ms
P95 222.2172127ms
P50 61.052451000000005ms
Number of Invalid txs 0

Baseline Scenario

This scenario represents a minimal case and as such is a good baseline against which to assess the overhead introduced by more complex setups. There is a single hydra-node d with a single client submitting single input and single output transactions with a constant UTxO set of 1.

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 3.742496620
P99 11.865434ms
P95 7.542225050000002ms
P50 2.9970084999999997ms
Number of Invalid txs 0

@github-actions
Copy link

github-actions bot commented Sep 18, 2023

Test Results

346 tests   341 ✔️  15m 43s ⏱️
118 suites      5 💤
    5 files        0

Results for commit 5e38c1a.

♻️ This comment has been updated with latest results.

@ch1bo ch1bo self-assigned this Sep 18, 2023
@ch1bo ch1bo mentioned this pull request Sep 18, 2023
3 tasks
Copy link
Member

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

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

Thanks for wading through the dependency swamp!

IMO only two things MUST be done:

  • Not undo the previous fix of querying ChainTip instead from point
  • Update the CHANGELOG.md where at least the fact of new script hashes is warranted to be a **BREAKING** entry.

This PR would be even better if it would have a high-level description of the changes (see also our Contribution Guidelines)

Also, there are many imports changing from Hydra.Cardano.API (ProtocolParameters) to Cardano.Ledger.Core (PParams) just to refer to the type (which result in additional dependencies on packages). I saw that the cardano-api does re-export PParams and we could make that easily accessible through hydra-cardano-api.

@@ -110,7 +109,7 @@ import Hydra.Cardano.Api.Prelude (
LedgerEra,
Map,
StandardCrypto,
ledgerEraVersion,
ledgerEraVersion, Proposal, VotingProcedures, LedgerProtocolParameters,
Copy link
Member

Choose a reason for hiding this comment

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

Please run fourmolu to format imports.

try (newLedgerEnv defaultPParams) >>= \case
Left (err :: ProtocolParametersConversionException) ->
error $ "Failed to create ledger env from fixture: " <> show err
Right env -> pure env
Copy link
Member

Choose a reason for hiding this comment

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

It's great to see this code removed!

newLedgerEnv :: MonadThrow m => ProtocolParameters -> m (Ledger.LedgerEnv LedgerEra)
newLedgerEnv protocolParams = do
case toLedgerPParams (shelleyBasedEra @Era) protocolParams of
Left err -> throwIO $ ProtocolParametersConversionException err
Copy link
Member

Choose a reason for hiding this comment

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

Should: remove now unused ProtocolParametersConversionException
Should: update the haddock of this function to not mention any exception throwing.

@@ -86,6 +83,7 @@ import Test.QuickCheck (choose)
import Test.QuickCheck.Gen (chooseWord64)
import UntypedPlutusCore (UnrestrictedProgram (..))
import qualified UntypedPlutusCore as UPLC
import Hydra.Cardano.Api.Prelude (LedgerProtocolParameters(..))
Copy link
Member

Choose a reason for hiding this comment

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

Should: not import this from Hydra.Cardano.Api.Prelude, but from Hydra.Cardano.Api

@@ -133,6 +134,7 @@ library
, base16-bytestring
, bech32
, bytestring
, cardano-api:{internal}
Copy link
Member

Choose a reason for hiding this comment

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

We should not depend on cardano-api here, but instead only via hydra-cardano-api. Also, what are we using from the internal library?

import qualified Data.Set as Set
import Ouroboros.Consensus.HardFork.Combinator.AcrossEras (EraMismatch)
import Test.QuickCheck (oneof)
import Cardano.Api.ProtocolParameters (LedgerProtocolParameters(LedgerProtocolParameters))
Copy link
Member

Choose a reason for hiding this comment

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

Should: import this via hydra-cardano-api as this is our "anti corruption layer"

systemStart <- querySystemStart networkId nodeSocket QueryTip
walletUTxO <- Ledger.unUTxO . toLedgerUTxO <$> queryUTxO networkId nodeSocket (QueryAt point) [address]
pparams <- queryProtocolParameters networkId nodeSocket (QueryAt point)
systemStart <- querySystemStart networkId nodeSocket (QueryAt point)
Copy link
Member

Choose a reason for hiding this comment

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

Must: change this back to using QueryTip as we just fixed it.

This likely was due to a rebase conflict.

@@ -6,6 +6,7 @@ import Hydra.Prelude

import Data.Default (def)
import qualified Data.Map as Map
import Hydra.Cardano.Api.Prelude (LedgerProtocolParameters(..))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import Hydra.Cardano.Api.Prelude (LedgerProtocolParameters(..))
import Hydra.Cardano.Api (LedgerProtocolParameters(..))

pattern ReferenceScriptNone,
pattern ScriptWitness,
pattern TxInsCollateral,
pattern TxOut,
)
import Hydra.Cardano.Api.Prelude (toAlonzoExUnits, LedgerProtocolParameters (LedgerProtocolParameters))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import Hydra.Cardano.Api.Prelude (toAlonzoExUnits, LedgerProtocolParameters (LedgerProtocolParameters))
import Hydra.Cardano.Api (toLedgerExUnits, LedgerProtocolParameters (LedgerProtocolParameters))

@@ -21,6 +21,7 @@ let
# Reason: haskell.nix modules/overlays neds to be last
# https://github.com/input-output-hk/haskell.nix/issues/1954
haskellNix.overlay
iohk-nix.overlays.haskell-nix-crypto
Copy link
Member

Choose a reason for hiding this comment

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

This sounds like a duplicate to the above iohk-nix.overlays.crypto. Are both needed? If yes, a comment should explain why.

Copy link
Member

Choose a reason for hiding this comment

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

@locallycompact Note that I changed this in https://github.com/input-output-hk/hydra/tree/5e38c1ab6c6c4e3f913cfc4d7ee3b308f525b842/

I think the static muslc build would fail if we re-order the overlays this way (see comment).

I also fixed the comments. It seems that haskell-nix-crypto is just containing pkg-config reconfiguration via haskell.nix. The libs are in the crypto overlay.

@ch1bo
Copy link
Member

ch1bo commented Sep 18, 2023

The CI errors are actually interesting: https://github.com/input-output-hk/hydra/pull/1075/checks?check_run_id=16878199862

We do write a placeholder version into the binaries and it seems that the darwin build of some library resulted in another occurrence of the same placeholder! (I'm so glad I have put this check)

To fix you should update to something (still) unique here and here.

@ch1bo ch1bo assigned locallycompact and unassigned ch1bo Sep 19, 2023
@locallycompact locallycompact force-pushed the lc/cardano-api-8.20 branch 2 times, most recently from 886b770 to f35ba41 Compare September 19, 2023 12:37
@pgrange pgrange mentioned this pull request Sep 19, 2023
4 tasks
@ch1bo ch1bo self-assigned this Sep 20, 2023
@ch1bo ch1bo force-pushed the lc/cardano-api-8.20 branch from 260441c to ab2362a Compare September 21, 2023 10:40
@ch1bo ch1bo force-pushed the lc/cardano-api-8.20 branch from d0f760c to f30809a Compare September 21, 2023 10:57
Maybe not needed anymore, but this honors the comment just above in
project.nix which was put in place to fix static muslc builds.
Copy link
Member

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

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

I pushed two comments to address some nitpicks I would have had and (I think) a fix to the static muslc builds (which we would have run into after merging..)

Approved now

.~ Prices
{ prSteps = fromJust $ boundRational $ 721 % 10000000
, prMem = fromJust $ boundRational $ 577 % 10000
}
Copy link
Member

Choose a reason for hiding this comment

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

@locallycompact Note that I removed some redundant parenthesis here

@@ -21,6 +21,7 @@ let
# Reason: haskell.nix modules/overlays neds to be last
# https://github.com/input-output-hk/haskell.nix/issues/1954
haskellNix.overlay
iohk-nix.overlays.haskell-nix-crypto
Copy link
Member

Choose a reason for hiding this comment

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

@locallycompact Note that I changed this in https://github.com/input-output-hk/hydra/tree/5e38c1ab6c6c4e3f913cfc4d7ee3b308f525b842/

I think the static muslc build would fail if we re-order the overlays this way (see comment).

I also fixed the comments. It seems that haskell-nix-crypto is just containing pkg-config reconfiguration via haskell.nix. The libs are in the crypto overlay.

@locallycompact locallycompact merged commit 51a972d into master Sep 21, 2023
@locallycompact locallycompact deleted the lc/cardano-api-8.20 branch September 21, 2023 12:53
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

Successfully merging this pull request may close these issues.

2 participants