-
Notifications
You must be signed in to change notification settings - Fork 23
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
Isolation of Byron era 1/n #362
Conversation
@@ -2010,8 +2009,11 @@ createAndValidateTransactionBody :: () | |||
=> CardanoEra era | |||
-> TxBodyContent BuildTx era | |||
-> Either TxBodyError (TxBody era) | |||
createAndValidateTransactionBody = | |||
caseByronOrShelleyBasedEra makeByronTransactionBody makeShelleyTransactionBody | |||
createAndValidateTransactionBody era txBodyContent = |
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.
This is just a stop gap. We would have a separate function for Byron basic txs and parameterize createAndValidateTransactionBody
on ShelleyBasedEra era
instead.
@@ -69,8 +69,7 @@ data TxInMode where | |||
-- delegation certs. | |||
-- | |||
TxInByronSpecial | |||
:: ByronEraOnly era | |||
-> Consensus.GenTx Consensus.ByronBlock | |||
:: Consensus.GenTx Consensus.ByronBlock |
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.
The evidence is no longer necessary. We are already constructing Consensus.GenTx Consensus.ByronBlock
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 it was necessary in the first place, but it was a matter of convenience. Before you could write
eon <- forEraMaybeEon
pure $ TxInByronSpecial eon foo
and after the change:
_ :: ByronEraOnly <- forEarMaybeEon
pure $ TxInByronSpecial foo
so now you need to say twice that you're in byron.
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 you show me where you now have to say twice that we are in Byron? This is only called in Byron specific code in the cli.
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.
In the current usages you don't have to, because byron was hardcoded everywhere. My remark was about general usage, where you could create an era-specific value, mentioning era just once: in the value constructor.
If we're going to isolate and hardcode byron code, I guess it won't matter much.
@@ -27,27 +27,27 @@ prop_json_roundtrip_alonzo_genesis = H.property $ do | |||
|
|||
prop_json_roundtrip_utxo :: Property | |||
prop_json_roundtrip_utxo = H.property $ do |
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.
We are only calling Babbage.
c18a2bf
to
f649544
Compare
a81c5f9
to
6492b07
Compare
Update FromJSON (TxOutValue era) to be constrained by IsShelleyBasedEra era Parameterize lovelaceToTxOutValue on ShelleyBasedEra era instead of CardanoEra era
…lly makeTransactionBodyAutoBalance Note makeTransactionBodyAutoBalance accepts ShelleyBasedEra era and not CardanoEra era
74d05e6
to
dd496b2
Compare
@@ -711,12 +710,46 @@ genTxTotalCollateral = | |||
genTxFee :: CardanoEra era -> Gen (TxFee era) | |||
genTxFee = | |||
caseByronOrShelleyBasedEra | |||
(pure . TxFeeImplicit) | |||
undefined -- (pure . TxFeeImplicit) |
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.
a comment explaining why someone sees an exception from here would be nice
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.
or maybe something like error "not supported"
would be better here?
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.
This was a mistake
@@ -30,21 +30,21 @@ import Test.Tasty.Hedgehog (testProperty) | |||
|
|||
prop_roundtrip_txbody_CBOR :: Property | |||
prop_roundtrip_txbody_CBOR = H.property $ do | |||
AnyCardanoEra era <- H.forAll $ Gen.element [minBound..AnyCardanoEra BabbageEra] | |||
AnyShelleyBasedEra era <- H.forAll $ Gen.element [minBound..maxBound] |
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.
Nice! I wonder why it was only until babbage before
Notice the tests were only calling the Babbage era
removed once we have specific functionality to create "basic" transactions in any era.
dd496b2
to
26114c9
Compare
@@ -838,8 +840,7 @@ deriving instance Show (TxInsReference build era) | |||
data TxOutValue era where | |||
|
|||
TxOutValueByron | |||
:: ByronEraOnly era | |||
-> Lovelace | |||
:: Lovelace |
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.
If we're going the path of pushing Byron to legacy status and have it separate we should move this constructor to its own type and then to a Byron-specific legacy module so users of our API never have to see/worry/handle it.
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.
Definitely. This is my eventual goal but I'm doing it in small chunks.
Add anchor to vote-create command
Changelog
Context
Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.
How to trust this PR
Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.
Checklist