-
Notifications
You must be signed in to change notification settings - Fork 730
tx-generator: reusable API and library #4460
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
Merged
iohk-bors
merged 18 commits into
master
from
tx-generator/4174-reusable-api-and-library
Nov 14, 2022
Merged
tx-generator: reusable API and library #4460
iohk-bors
merged 18 commits into
master
from
tx-generator/4174-reusable-api-and-library
Nov 14, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
727f7db
to
2d0f5e6
Compare
4f9de53
to
3d1700d
Compare
* hide-env Get some more privacy around the environment passed around in Action. This wraps the Env type alias in a discriminated union to generate type errors on usage, then moves direct accesses to Env and wraps the original usage in an API or moves the code to the Env module. * SetKeyVal exposes an inextricable precursor to the Generic usage in the Env DMap via a Generic in the Set case of Action. So this limits usage of the SetKeyVal type alias to the Types module momentarily to limit exposure of the Generic that packages key-value pairs for insertion into the DMap. * Hide usage of Action Set case in setConst. This moves the access to the Set case of action exposing SetKeyVal into Types.hs; the wrapper may move again, but the caller will be insulated. * Monomorphise the User case of the Store type. This splits it up into SNetworkId and SSocketPath and removes the old User constructor. A sweep is done and accessors in Env likewise changed. * Remove Tag, Setters This monomorphises Action's Set case in order to remove the last dependencies on Setters.Tag via SetKeyVal. The Setters file is removed from the tree and the cabal file as well. * Remove unSet & consumeName There are no callers outside Env. * Fold Name into Store This trades in the Named case of Store for the various cases of Name. getName & setName are bypassed in favour of get/set of the Store directly. * Remove [gs]et(NetworkId|SocketPath) accessors. They're not abstracting much as the approach is from a different direction. They don't save much typing, either. It saves a few lines & saves some module dependencies. * Remove LoggingLayer case of Store. Searching revealed no use cases of the LoggingLayer case. This reduces the number of distinct cases needed to remove from the Env DMap. * Remove ProtocolParameterMode case from Store It largely represents a sort of individual state variable, so the corresponding dmap entry in Env is replaced with an additional record field. Accessors replace the usage of the case of Store. * Remove BenchTracers case from Store A pair of get & set accessors is coupled with a record field in Env to replace the usage of the Store case in the Env DMap. * Remove Genesis case of Store This adds an Env record field to replace the Genesis DMap entry and sweeps uses of the Store case/constructor replacing with accessors. * Share Env accessor code The Env accessors were duplicating a lot of code, so this just does some lambda lifting across the minor differences. The subroutines for the shared code are likely worth using to replace the accessors outright given an audit of record field names for name clashes & renaming for more brevity. * Remove Protocol case of Store It's replaced with a record field in Env and accessors to get & set it. * Env hlint warning cleanup I inadvertently introduced hlint warnings in this branch by dint of some cut & paste of unnecessary $'s. This should hopefully dispose of them, but I'll have to find out how to run hlint in the build system to be sure. * Fix extraneous parentheses flagged by hlint * Remove SNetworkId case of Store This replaces the SNetworkId case of Store with a monomorphic NetworkId record field of Env. * Remove SSocketPath from Store This folds the socket's FilePath into a record field of Env. * Remove KeyName case from Store This replaces the KeyName case with a monomorphic Map in Env. Helpers are set up to help subsequent wallet & thread patches. Some testing will be needed to ensure there's no impact on Aeson's JSON formatting. * Remove ThreadName from Store This removes the ThreadName constructor from Store and replaces it with a monomorphic Map in the Env structure and accessors. * Remove Store altogether This removes the use of the WalletName type alias, WalletName constructor, and the entire Store module, moving its remainder to Script/Types. At the end of this, the use of the Generic DMap is also removed altogether in Env. The cabal file is updated to reflect the removal of the Store.hs source file. Co-authored-by: Michael Karg <[email protected]>
34b5a7d
to
c2e8693
Compare
bors r+ |
👎 Rejected by too few approved reviews |
deepfire
approved these changes
Nov 14, 2022
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.
Thank you @mgmeier !
This is an important first step towards the pure API.
bors r+ |
Build succeeded: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.