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

[#1951] Handle script based DReps #2182

Merged
merged 5 commits into from
Oct 21, 2024
Merged

Conversation

jdyczka
Copy link
Contributor

@jdyczka jdyczka commented Oct 18, 2024

List of changes

  • Handle script based DReps

Checklist

  • related issue
  • My changes generate no new warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the changelog
  • I have added tests that prove my fix is effective or that my feature works

@jdyczka jdyczka marked this pull request as draft October 18, 2024 09:27
Copy link

✅ All checks succeeded

2 similar comments
Copy link

✅ All checks succeeded

Copy link

✅ All checks succeeded

Copy link

✅ All checks succeeded

2 similar comments
Copy link

✅ All checks succeeded

Copy link

✅ All checks succeeded

@@ -758,7 +759,8 @@ instance ToSchema DRepType where

data DRep
= DRep
{ dRepDrepId :: DRepHash
{ dRepIsScriptBased :: Bool
, dRepDrepId :: DRepHash
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
, dRepDrepId :: DRepHash
, dRepID :: DRepHash

Copy link
Contributor

Choose a reason for hiding this comment

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

We are returning drepId not just id

Copy link
Contributor

@MSzalowski MSzalowski left a comment

Choose a reason for hiding this comment

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

If that is easier to depend on the drep_hash.has_script that is ok, but still for the script based Drep delegation certificate we need a script hash for such DRep, meaning, that we need to take this value.

So, having the scriptHash in a DRep should be just enough to establish that such DRep is script based

targetDRep = DRep.new_key_hash(Ed25519KeyHash.from_bech32(target));
} else if (target.includes("drep_script1")) {
targetDRep = DRep.new_script_hash(Ed25519KeyHash.from_bech32(target));
Copy link
Contributor

Choose a reason for hiding this comment

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

target should be:

Suggested change
targetDRep = DRep.new_script_hash(Ed25519KeyHash.from_bech32(target));
targetDRep = DRep.new_script_hash(ScriptHash.from_hex(target));

where target is the scriptHash of the script based DRep that is missing in the SQL.

I'll make the reference implementation of this and share you soon

@MSzalowski
Copy link
Contributor

If that is easier to depend on the drep_hash.has_script that is ok, but still for the script based Drep delegation certificate we need a script hash for such DRep, meaning, that we need to take this value.

So, having the scriptHash in a DRep should be just enough to establish that such DRep is script based

I figured out that dRepId in our backend is already the scriptHash, so there is no need to update the SQL query - all good, just update pls that small change in wallet.tsx 🫡

Copy link

✅ All checks succeeded

@jdyczka jdyczka marked this pull request as ready for review October 21, 2024 11:40
Copy link

✅ All checks succeeded

1 similar comment
Copy link

✅ All checks succeeded

@jdyczka jdyczka merged commit c627813 into develop Oct 21, 2024
10 checks passed
@jdyczka jdyczka deleted the fix/1951-script-based-dreps branch October 21, 2024 12:01
Copy link

@jdyczka
This PR is in the tag: develop-c62781323ba8ea2d02485fddaba72b42707f7121 , for govtool-frontend service

Copy link

@jdyczka
This PR is in the tag: develop-c62781323ba8ea2d02485fddaba72b42707f7121 , for govtool-backend service

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.

4 participants