-
Notifications
You must be signed in to change notification settings - Fork 10
As patterns in offchain code #94
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
Conversation
choener
left a comment
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.
LGTM.
Locally I am still waiting on cache.iog.io, so can't yet try the changes, but they look good.
In case I see something later locally, I'll raise an issue.
| import PlutusLedgerApi.V3 (Credential) | ||
|
|
||
| data AppError era = | ||
| data ProgrammableTokensError = |
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.
Good, it looks like the main error type holds each suberror only once!
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.
Yep that is the only way to avoid issues with catch, sadly I don't think there is a way to really enforce this
| | GlobalParamsNodeNotFound -- ^ The node with the global parameters was not found | ||
| | BalancingError (CoinSelection.BalanceTxError era) | ||
| | BlockfrostErr BlockfrostError | ||
| -- TODO: The following errors are specific to the regulated stablecoin |
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.
Here one would wrap some RegulatedStablecoinError and these should in turn have AsRegulated... or maybe down in AppError.
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.
Yes I'll split up the type in another PR.
|
|
||
| makeClassyPrisms ''ProgrammableTokensError | ||
|
|
||
| data AppError era = |
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.
Each error type shows up once, good.
| deployAll = do | ||
| target <- ask | ||
| failOnError $ Env.withEnv $ asAdmin @C.ConwayEra $ do | ||
| failOnError @_ @(AppError C.ConwayEra) $ Env.withEnv $ asAdmin @C.ConwayEra $ 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.
I would consiver expanding Convex.MockChain a bit, and provide a MonadError instance.
Then it would not be necessary to call failOnError. A simple newtype for the unit tests in here would suffice.
Though it would not save on lines / characters since instead of MonadFail, we'd carry around a bunch of AsError. However, it would be clear what type of errors are being tested for.
|
FYI: I get a segmentation fault trying to build WSC via nix. |
|
The build passed so I'm going to merge this now, let me know if the segfault is persistent |
This seems to be weirdly specific. My AMD/Ryzen3 machine produces a segfault, but actually earlier than the wsc code, after checking. |
|
Hm, on my AMD machine I get an error when trying to |
No description provided.