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

Register Stake requires redeemer for scripts on PlutusV3 #270

Open
MicroProofs opened this issue Jan 30, 2025 · 7 comments
Open

Register Stake requires redeemer for scripts on PlutusV3 #270

MicroProofs opened this issue Jan 30, 2025 · 7 comments

Comments

@MicroProofs
Copy link

No description provided.

@alessandrokonrad
Copy link
Contributor

alessandrokonrad commented Jan 30, 2025

Hey @MicroProofs! Thanks for the hint, I was about to change the code, but then noticed I was able to submit a tx without redeemer, and uplc even fails with "redeemer points to an unsupported certificate type" if I use a redeemer for registerStake. Here the tx: https://preview.cardanoscan.io/transaction/a5debf5fa7491a950c7da0206601a7debe8405954e0f317bea1c448b58f949e3?tab=stakecertificates
this was the script:

{
  type: "PlutusV3",
  script:
    "586001010029800aba2aba1aab9eaab9dab9a4888896600264646644b30013370e900318031baa002899199119b8748028dd698058031bad30090013009300a00130073754005164014600c600e002600c004600c00260066ea801a29344d9590011",
}

Am I missing something?

Edit:
Seems like it's only the case for DRep stake registration?

@MicroProofs
Copy link
Author

Ahh that confused me I thought they changed the behavior in V3 but I guess not?

@MicroProofs
Copy link
Author

MicroProofs commented Jan 31, 2025

Thanks for checking I saw it as an update I thought in the Cardano-ledger but maybe it was reverted?

Edit: nvm I think I mistook it for the drep registration like you pointed out

@MicroProofs
Copy link
Author

Image Image Image Image

Found it in Cardano ledger. The register certificate simply does not return a script credential for the Phase 1 validation that gathers executable scripts to prepare for phase 2

@MicroProofs
Copy link
Author

But also there is this comment

-- For both of the functions getScriptWitnessConwayTxCert and
-- getVKeyWitnessConwayTxCert we preserve the old behavior of not requiring a witness
-- for staking credential registration, but only during the transitional period of Conway
-- era and only for staking credential registration certificates without a deposit. Future
-- eras will require a witness for registration certificates, because the one without a
-- deposit will be removed.

@hadelive
Copy link

hadelive commented Feb 1, 2025

StakeRegistration will be deprecated in the next era. Use RegCert instead which takes an explicit deposit amount, as that can change.

@alessandrokonrad
Copy link
Contributor

alessandrokonrad commented Feb 1, 2025

Okay I see there are two new certificate types reg_cert and unreg_cert. So if stake_registration and stake_deregistration will be deprecated next era, then how are you supposed to use those new certs in a PlutusV1/V2 context? I currently get this error: unexpected certificate type in V1/V2 script context: UnReg. Is this a uplc bug? @MicroProofs

Seems like a transformation is necessary for V1V2 context, where you extract the credential and leave out the deposit

transTxCertV1V2 ::
  ( ConwayEraTxCert era
  , Inject (ConwayContextError era) (ContextError era)
  ) =>
  TxCert era ->
  Either (ContextError era) PV1.DCert
transTxCertV1V2 = \case
  RegDepositTxCert stakeCred _deposit ->
    Right $ PV1.DCertDelegRegKey (PV1.StakingHash (transCred stakeCred))
  UnRegDepositTxCert stakeCred _refund ->
    Right $ PV1.DCertDelegDeRegKey (PV1.StakingHash (transCred stakeCred))
  txCert
    | Just dCert <- Alonzo.transTxCertCommon txCert -> Right dCert
    | otherwise -> Left $ inject $ CertificateNotSupported txCert

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

3 participants