-
Notifications
You must be signed in to change notification settings - Fork 205
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
haskell ledger bindings, support uploadDarFile #2146
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.
Nice, thank you!
|
||
|
||
-- Would be nice if the underlying service returned the pid on successful upload. | ||
uploadDarFileGetPid :: LedgerId -> BS.ByteString -> LedgerService (Either String PackageId) |
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 looks like a race condition. What if someone else uploads something in the meantime? Given that we have the package it seems like we can do better even without an API change in the underlying service.
A more important issue: Is this guaranteed to always return a single package id? What if I upload a DAR with multiple packages (e.g. one that has several dependencies). Will they not show up in listPackages
?
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.
You are probably right on both points.
I'll move this function into Test.hs & say it's ok because the caller knows.
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.
Thanks! Having this in the tests is totally reasonable.
import DA.Ledger.LedgerService | ||
import Network.GRPC.HighLevel.Generated | ||
|
||
uploadDarFile :: ByteString -> LedgerService (Either String ()) -- Unlike other services, no LedgerId is needed. (why?!) |
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 we get a haddock comment here that explains when you will get back Left
?
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.
ok
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.
Great work 👍
Haskell ledger bindings:
UploadDarFile
RPC ofpackage_management_service
Pull Request Checklist
NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.