[#516] Allow overloading operation parameters (fee, safety guards)
I thought I'd do this quickly, but it turned out a lot trickier than I imagined.
Description
The primary problem this solves is being able to override operation parameters like fee and storage/gas guard margins with Cleveland. The problem is where to carry these overrides. Obviously, those have to be carried in MorleyClientEnv
to be accessible to morley-client, but we also have to carry those in NetworkCaps
to be able to locally override them in Cleveland. I really didn't want to have this redundancy, so after spending a lot of time trying to come up with a clever way to do that without rewriting half of Cleveland, I've petty much given up.
So this does some Cleveland refactoring. The main thing this does is it flattens the monadic stack. Whereas before we had ReaderT (NetworkCaps ClientM) ClientM
(where ClientM
is itself a MonadReader
), now we simply have ClientM
, ditto for PureM
. This leads to some simplification, but we have to introduce a new class for capabilities due to the fundep on MonadReader
. Using a new class turns out to be convenient as we can use a type family instead of a fundep to get rid of caps
argument to MonadCleveland
&c. This is unfortunately a breaking change, but I didn't figure out a way to do this gracefully. Another nice thing is we can also considerably simplify isEmulation
, although I had to introduce a separate type class for it to avoid squishing a lot of modules together that I just unsquished.
Related issue(s)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.