-
Notifications
You must be signed in to change notification settings - Fork 217
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
add verification key endpoint #2229
add verification key endpoint #2229
Conversation
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.
Looking good
instance FromHttpApiData ApiRelativeAddressIndex where | ||
parseUrlPiece = bimap (T.pack . getTextDecodingError) ApiRelativeAddressIndex . fromText | ||
|
||
instance FromText Word31 where |
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 could go into the text-class package I think, and perhaps it could be defined in terms of another typeclass like Integral.
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.
done, although now it is Word32. After the rebase many things need to change
1f8047a
to
e89fc36
Compare
89f06ba
to
e064518
Compare
bors try |
tryBuild failed: |
a4fa67d
to
4991183
Compare
lib/core/src/Cardano/Wallet/Api.hs
Outdated
type GetWalletKey = "wallets" | ||
:> Capture "walletId" (ApiT WalletId) | ||
:> "keys" | ||
:> "script" |
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.
What about capturing the full role here, so that we get better re-usability for this endpoint.
let (KeyHash bytes) = | ||
hashKey $ deriveMultisigPublicKey | ||
(liftXPub $ Shelley.getKey accPub) | ||
(toEnum $ fromInteger $ toInteger index) |
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.
That logic would better be located in Cardano.Wallet.hs
. What about defining a function along those lines:
getWalletKeyHash
:: ctx
-> WalletId
-> AccountingStyle
-> Index 'Soft AddressK
-> KeyHash
and re-use it in this layer?
@@ -711,6 +712,10 @@ data ApiWalletMigrationInfo = ApiWalletMigrationInfo | |||
newtype ApiWithdrawRewards = ApiWithdrawRewards Bool | |||
deriving (Eq, Generic, Show) | |||
|
|||
newtype ApiVerificationKeyHash = ApiVerificationKeyHash | |||
{ verificationKeyHash :: ApiT (Hash "ScriptKey") | |||
} deriving (Eq, Generic, Show) |
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.
Alternatively, we could have the API return a plain bech32-encoded string on success?
@@ -116,6 +118,19 @@ instance FromText Natural where | |||
instance ToText Natural where | |||
toText = T.pack . show | |||
|
|||
instance FromText Word32 where | |||
fromText = | |||
validate <=< (fmap fromIntegral . fromText @Natural) |
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 will not work 😱! The fromIntegral
that transform from Natural
to Word32
needs to happen after the validation to be safe. Otherwise, this may just throw if the value can't be converted back.
Note that @hasufell is doing something similar but re-using constructor from the text
package which makes things a bit nicer: https://github.com/input-output-hk/cardano-wallet/pull/2213/files#diff-b892068f732dfe3e67cd6f7a464975ba21a3588de3e5ea74022be5dfaa18e476
I'd suggest cherry-picking this change 👍
stack.yaml
Outdated
- git: https://github.com/input-output-hk/cardano-addresses | ||
commit: e0ab4587266430a08734e1aec1c29d261a9a3b70 | ||
commit: 02fb4ec7db7c55334ab2216c94cf70b209a33885 |
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 need to use released version of cardano-addresses. There are some cleanup to be done in cardano-addresses before we can release a 3.0.0 version. Let's discuss that on Slack.
3d6f3f7
to
8115d73
Compare
And also, to keys and not key hashes. The goal of this endpoint is to expose public keys so clients can perform signature verification all by themselves.
… after wallet id)
In particular, we use in conjunction with the other endpoint to get a public key, and show that the public key can verify the signature.
7262598
to
0e10168
Compare
bors merge |
bors r- |
2229: add verification key endpoint r=KtorZ a=paweljakubas # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> https://jira.iohk.io/browse/ADP-474 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have added endpoint plus basic types and instances - [x] I have extended swagger - [x] I have updated core unit tests - [x] I have added impl and switched on impl in Shelley - [x] I have extended Api.Link and core-integration's DSL - [x] I have added illustrative integration test - [x] I have added golden tests for explicit mnemonic and picked indices based on cardano-addresses # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> 2263: Accounting Style Renaming: proper manual migration r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> ADP-523 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - 016f60c 📍 **reproduce deserialization issue with regards to account style change** I originally added a 'backward-compatible' function step to the deserialization function of value of type 'AccountingStyle'. The problem is that it only concerns objects that are being deserialized. Any 'AccountingStyle' value that is queried will inevitably fail because columns in an existing database would still be using the old serialization format. As a consequence, fetching all addresses of an existing sequential wallet returns an empty set, regardless of what is in the database. - 0a6c36c 📍 **use a proper manual database migration for renaming AccountingStyle instead of the hacky in-place adjustment in the deserializer.** # Comments <!-- Additional comments or screenshots to attach if any --> Whoops... <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> 2264: Fix error message on bad query param filtering addresses in Jormungandr tests r=piotr-iohk a=piotr-iohk # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> # Overview - 67ef8fb Fix error message on bad query param filtering addresses in Jormungandr tests # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: KtorZ <[email protected]> Co-authored-by: Pawel Jakubas <[email protected]> Co-authored-by: IOHK <[email protected]> Co-authored-by: Piotr Stachyra <[email protected]>
Canceled. |
bors merge |
2229: add verification key endpoint r=KtorZ a=paweljakubas # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> https://jira.iohk.io/browse/ADP-474 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have added endpoint plus basic types and instances - [x] I have extended swagger - [x] I have updated core unit tests - [x] I have added impl and switched on impl in Shelley - [x] I have extended Api.Link and core-integration's DSL - [x] I have added illustrative integration test - [x] I have added golden tests for explicit mnemonic and picked indices based on cardano-addresses # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> 2263: Accounting Style Renaming: proper manual migration r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> ADP-523 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - 016f60c 📍 **reproduce deserialization issue with regards to account style change** I originally added a 'backward-compatible' function step to the deserialization function of value of type 'AccountingStyle'. The problem is that it only concerns objects that are being deserialized. Any 'AccountingStyle' value that is queried will inevitably fail because columns in an existing database would still be using the old serialization format. As a consequence, fetching all addresses of an existing sequential wallet returns an empty set, regardless of what is in the database. - 0a6c36c 📍 **use a proper manual database migration for renaming AccountingStyle instead of the hacky in-place adjustment in the deserializer.** # Comments <!-- Additional comments or screenshots to attach if any --> Whoops... <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> 2264: Fix error message on bad query param filtering addresses in Jormungandr tests r=KtorZ a=piotr-iohk # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> # Overview - 67ef8fb Fix error message on bad query param filtering addresses in Jormungandr tests # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: KtorZ <[email protected]> Co-authored-by: Pawel Jakubas <[email protected]> Co-authored-by: IOHK <[email protected]> Co-authored-by: Piotr Stachyra <[email protected]>
This PR was included in a batch that timed out, it will be automatically retried |
Build succeeded: |
Issue Number
https://jira.iohk.io/browse/ADP-474
Overview
Comments