Skip to content

Commit c257661

Browse files
committedAug 11, 2022
Merge branch 'master' into gergely/vasil
2 parents 9ff1ed9 + f93927c commit c257661

35 files changed

+1807
-380
lines changed
 

‎.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ geth-node/chaindata/geth/*
5959
geth-node/chaindata/history
6060
*.ipc
6161
.direnv
62+
63+
# emacs stuff
64+
*.~undo-tree~
65+
66+
# debug configs
67+
examples/debug/
68+
69+
visualization/

‎STANDARDS.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ Haskell is a language that is older than some of the people currently writing
6060
it; parts of its ecosystem are not exempt from it. With age comes legacy, and
6161
much of it is based on historical decisions which we now know to be problematic
6262
or wrong. We can't avoid our history, but we can minimize its impact on our
63-
current work.
63+
current work.
6464

6565
Thus, we aim to codify good practices in this document _as seen today_. We also
6666
try to avoid obvious 'sharp edges' by proscribing them away in a principled,
67-
consistent and justifiable manner.
67+
consistent and justifiable manner.
6868

6969
## Automate away drudgery
7070

@@ -155,7 +155,7 @@ difficult to read even without a split screen. We don't _enforce_ a maximum of
155155
## Naming
156156

157157
camelCase MUST be used for all non-type, non-data-constructor names; otherwise,
158-
TitleCase MUST be used. Acronyms used as part of a naming identifier (such as
158+
TitleCase MUST be used. Acronyms used as part of a naming identifier (such as
159159
'JSON', 'API', etc) SHOULD be downcased; thus ``repairJson`` and
160160
``fromHttpService`` are correct. Exceptions are allowed for external libraries
161161
(Aeson's ``parseJSON`` for example).
@@ -315,11 +315,11 @@ wrappers around monadic stacks:
315315
```haskell
316316
newtype FooM a = FooM (ReaderT Int (StateT Text IO) a)
317317
deriving newtype (
318-
Functor,
319-
Applicative,
320-
Monad,
321-
MonadReader Int,
322-
MonadState Text,
318+
Functor,
319+
Applicative,
320+
Monad,
321+
MonadReader Int,
322+
MonadState Text,
323323
MonadIO
324324
)
325325
```
@@ -341,8 +341,8 @@ Thus, even for popularity and compatibility reasons, these should be on by
341341
default.
342342

343343
``InstanceSigs`` are harmless by default, and introduce no complications. Their
344-
not being default is strange. ``ImportQualifiedPost`` is already a convention
345-
of this project, and helps with formatting of imports.
344+
not being default is strange. ``ImportQualifiedPost`` is already a convention
345+
of this project, and helps with formatting of imports.
346346

347347
``LambdaCase`` reduces a lot of code in the common case of analysis of sum
348348
types. Without it, we are forced to either write a dummy ``case`` argument:
@@ -383,7 +383,7 @@ instead of the one from ``base``.
383383
``OverloadedStrings`` deals with the problem that ``String`` is a suboptimal
384384
choice of string representation for basically _any_ problem, with the general
385385
recommendation being to use ``Text`` instead. It is not, however, without its
386-
problems:
386+
problems:
387387

388388
* ``ByteString``s are treated as ASCII strings by their ``IsString`` instance;
389389
* Overly polymorphic behaviour of many functions (especially in the presence of
@@ -438,8 +438,8 @@ alternatives. This means that, when a non-``base`` ``Prelude`` is in scope, it
438438
often requires familiarity with its specific decisions, in addition to whatever
439439
cognitive load the current module and its other imports impose. Given that we
440440
already use an alternative prelude (in tandem with the one from ``base``),
441-
additional alternatives present an unnecessary cognitive load. Lastly, the
442-
dependency footprint of many alternative ``Prelude``s is _highly_ non-trivial;
441+
additional alternatives present an unnecessary cognitive load. Lastly, the
442+
dependency footprint of many alternative ``Prelude``s is _highly_ non-trivial;
443443
it isn't clear if we need all of this in our dependency tree.
444444

445445
For all of the above reasons, the best choice is 'default to Plutus, with local
@@ -470,7 +470,7 @@ Every publically-exported definition MUST have a Haddock comment, detailing its
470470
purpose. If a definition is a function, it SHOULD also have examples of use
471471
using [Bird tracks][bird-tracks]. The Haddock for a publically-exported
472472
definition SHOULD also provide an explanation of any caveats, complexities of
473-
its use, or common issues a user is likely to encounter.
473+
its use, or common issues a user is likely to encounter.
474474

475475
If the code project is a library, these Haddock comments SHOULD carry an
476476
[``@since``][haddock-since] annotation, stating what version of the library they
@@ -502,15 +502,15 @@ also the expected behaviour of its instances.
502502
## Other
503503

504504
Lists SHOULD NOT be field values of types; this extends to ``String``s. Instead,
505-
``Vector``s (``Text``s) SHOULD be used, unless a more appropriate structure exists.
505+
``Vector``s (``Text``s) SHOULD be used, unless a more appropriate structure exists.
506506
On-chain code, due to a lack of alternatives, is one place lists can be used as
507507
field values of types.
508508

509509
Partial functions MUST NOT be defined. Partial functions SHOULD NOT be used
510510
except to ensure that another function is total (and the type system cannot be
511-
used to prove it).
511+
used to prove it).
512512

513-
Derivations MUST use an explicit [strategy][deriving-strategies]. Thus, the
513+
Derivations MUST use an explicit [strategy][deriving-strategies]. Thus, the
514514
following is wrong:
515515

516516
```haskell

‎bot-plutus-interface.cabal

+11-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ source-repository head
2525
common common-lang
2626
ghc-options:
2727
-Wall -Wcompat -Wincomplete-record-updates
28-
-Wincomplete-uni-patterns -Wredundant-constraints -Werror
29-
-fobject-code -fno-ignore-interface-pragmas
30-
-fno-omit-interface-pragmas -fplugin=RecordDotPreprocessor
28+
-Wincomplete-uni-patterns -Wredundant-constraints -fobject-code
29+
-fno-ignore-interface-pragmas -fno-omit-interface-pragmas
30+
-fplugin=RecordDotPreprocessor
31+
32+
-- -Werror
3133

3234
build-depends:
3335
, base
@@ -80,6 +82,8 @@ library
8082
BotPlutusInterface.BodyBuilder
8183
BotPlutusInterface.CardanoCLI
8284
BotPlutusInterface.ChainIndex
85+
BotPlutusInterface.CoinSelection
86+
BotPlutusInterface.Collateral
8387
BotPlutusInterface.Config
8488
BotPlutusInterface.Contract
8589
BotPlutusInterface.Effects
@@ -176,13 +180,16 @@ test-suite bot-plutus-interface-test
176180
other-modules:
177181
Spec.BotPlutusInterface.AdjustUnbalanced
178182
Spec.BotPlutusInterface.Balance
183+
Spec.BotPlutusInterface.CoinSelection
184+
Spec.BotPlutusInterface.Collateral
179185
Spec.BotPlutusInterface.Config
180186
Spec.BotPlutusInterface.Contract
181187
Spec.BotPlutusInterface.ContractStats
182188
Spec.BotPlutusInterface.Server
183189
Spec.BotPlutusInterface.TxStatusChange
184190
Spec.BotPlutusInterface.UtxoParser
185191
Spec.MockContract
192+
Spec.RandomLedger
186193

187194
build-depends:
188195
, aeson
@@ -236,6 +243,7 @@ test-suite bot-plutus-interface-test
236243
, text ^>=1.2.4.0
237244
, utf8-string
238245
, uuid
246+
, vector
239247
, warp
240248

241249
hs-source-dirs: test

‎cabal.project

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ packages: ./bot-plutus-interface.cabal
77

88
tests: true
99
benchmarks: true
10+
test-show-details: direct

‎examples/plutus-game/cabal.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
index-state: 2022-05-18T00:00:00Z
33

44
packages:
5-
./.
5+
./.
66
../../.
77

88
-- You never, ever, want this.

‎examples/plutus-game/guess.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ CONTRACT_INST_ID=$(curl --location --request POST 'localhost:9080/api/contract/a
1515
echo $CONTRACT_INST_ID
1616

1717

18-
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
18+
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
1919

‎examples/plutus-game/lock.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ CONTRACT_INST_ID=$(curl --location --request POST 'localhost:9080/api/contract/a
1616
echo $CONTRACT_INST_ID
1717

1818

19-
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
19+
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
2020

‎examples/plutus-nft/cabal.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
index-state: 2022-05-18T00:00:00Z
33

44
packages:
5-
./.
5+
./.
66
../../.
77

88
-- You never, ever, want this.

‎examples/plutus-nft/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ CONTRACT_INST_ID=$(curl --location --request POST 'localhost:9080/api/contract/a
1111
echo $CONTRACT_INST_ID
1212

1313

14-
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
14+
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
1515

‎examples/plutus-transfer/ada-transfer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ CONTRACT_INST_ID=$(curl --location --request POST 'localhost:9080/api/contract/a
1515
echo $CONTRACT_INST_ID
1616

1717

18-
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
18+
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
1919

‎examples/plutus-transfer/cabal.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
index-state: 2022-05-18T00:00:00Z
33

44
packages:
5-
./.
5+
./.
66
../../.
77

88
-- You never, ever, want this.

‎examples/plutus-transfer/token-transfer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ CONTRACT_INST_ID=$(curl --location --request POST 'localhost:9080/api/contract/a
2121
echo $CONTRACT_INST_ID
2222

2323

24-
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
24+
echo "{ \"tag\": \"Subscribe\", \"contents\": { \"Left\": { \"unContractInstanceId\":\"$CONTRACT_INST_ID\" } } }" | websocat -n ws://localhost:9080/ws
2525

‎flake.nix

-2
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,5 @@
474474
checks = perSystem (system: self.flake.${system}.checks // {
475475
formatCheck = formatCheckFor system;
476476
});
477-
478-
herculesCI.ciSystems = [ "x86_64-linux" ];
479477
};
480478
}

0 commit comments

Comments
 (0)
Please sign in to comment.