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

Rewrite tokenBundleSizeAssessor with ledger types #4098

Merged
merged 7 commits into from
Sep 14, 2023

Conversation

Anviking
Copy link
Member

This removes the dependency on Cardano.Wallet.Shelley.Compatibility.toCardanoValue

Issue Number

ADP-3081

@Anviking Anviking self-assigned this Aug 16, 2023
@Anviking Anviking force-pushed the anviking/ADP-3081/ledger-tokenBundleSizeAssessor branch from 740ee3d to d472455 Compare September 9, 2023 00:25
This removes the dependency on
`Cardano.Wallet.Shelley.Compatibility.toCardanoValue`
@Anviking Anviking force-pushed the anviking/ADP-3081/ledger-tokenBundleSizeAssessor branch from d472455 to bf53694 Compare September 9, 2023 00:56
@Anviking Anviking marked this pull request as ready for review September 11, 2023 13:37
@Anviking
Copy link
Member Author

@jonathanknowles I noticed some remaining things, but could you please have a look? A key change here is that we now use the entire PParam era instead of some intermediate type TokenBundleMaxSize, as the latter became incomplete with the requirement for a Version. The downside is that the module-local PParam generator now needs to decide what values to leave as def and what values to set.

Copy link
Contributor

@jonathanknowles jonathanknowles left a comment

Choose a reason for hiding this comment

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

Hi @Anviking. This looks mostly good to me -- I've made some suggestions.

@@ -64,17 +88,17 @@ spec = describe "Assessing the sizes of token bundles" $ do
prop_assessTokenBundleSize_enlarge
:: Blind (VariableSize1024 TokenBundle)
-> Blind (VariableSize16 TokenBundle)
-> PParamsInRecentEra
Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, it seems this was hard-coded before, but it seems to work 🤷‍♂️

bundle
actualLengthBytes = computeTokenBundleSerializedLengthBytes bundle
actualAssessment = assessTokenBundleSize assessor bundle
v = eraProtVerLow @StandardBabbage -- FIXME!
Copy link
Member Author

Choose a reason for hiding this comment

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

👀

Copy link
Member Author

Choose a reason for hiding this comment

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

I think just dropping the FIXME is fine. Ideally we'd re-use the same version as was used by the TokenBundleSizeAssessor but 🤷‍♂️

& ppProtocolVersionL .~ (ProtVer (eraProtVerLow @StandardBabbage) 0)
& ppMaxValSizeL .~ maryTokenBundleMaxSize
where
maryTokenBundleMaxSize = 4000
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should be clear about the units here:

Suggested change
maryTokenBundleMaxSize = 4000
maryTokenBundleMaxSizeBytes = 4000

By the way, this seems to have recently changed to 5000:

Screenshot from 2023-09-14 15-11-21

Copy link
Contributor

Choose a reason for hiding this comment

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

Co-authored-by: Jonathan Knowles <[email protected]>
@Anviking Anviking force-pushed the anviking/ADP-3081/ledger-tokenBundleSizeAssessor branch from e0cfdd8 to 270b6ad Compare September 14, 2023 08:09
@jonathanknowles jonathanknowles self-requested a review September 14, 2023 08:19
@Anviking Anviking added this pull request to the merge queue Sep 14, 2023
Merged via the queue into master with commit ae6e90b Sep 14, 2023
@Anviking Anviking deleted the anviking/ADP-3081/ledger-tokenBundleSizeAssessor branch September 14, 2023 10:28
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