Releases: geniusyield/atlas
v0.11.0
What's Changed
See CHANGELOG
.
All involved pull requests
- fix: allow reference scripts to be of version greater than the minimu… by @sourabhxyz in #405
Full Changelog: v0.10.0...v0.11.0
v0.10.0
What's Changed
See CHANGELOG
.
All involved pull requests
- Support for extended keys in
runGYTxMonadIO
by @euonymos in #397 - chore: update nix setup by @euonymos in #396
- fix: don't throw error for drep state query in case of remote providers by @sourabhxyz in #398
Full Changelog: v0.9.0...v0.10.0
v0.9.0
What's Changed
See CHANGELOG
.
All involved pull requests
- feat(#391 & #306): make datum as optional when spending an input in c… by @sourabhxyz in #395
Full Changelog: v0.8.1...v0.9.0
v0.8.1
What's Changed
See CHANGELOG
.
All involved pull requests
- feat: add combined stake address registration and delegation certificate by @sourabhxyz in #393
Full Changelog: v0.8.0...v0.8.1
v0.8.0
What's Changed
See CHANGELOG
.
All involved pull requests
- feat(#277): add keyrole, key hash & credential family by @sourabhxyz in #378
- feat(#379): create generalise signing key & verification key type by @sourabhxyz in #380
- feat(#383, #384): add more certificates and node update to v10.1.3 by @sourabhxyz in #382
- feat(#385): stake pool related certificates by @sourabhxyz in #386
- feat(#387): add committee related certificates by @sourabhxyz in #388
- feat: governance voting & proposal procedures, refactor transaction build sc… by @sourabhxyz in #392
Full Changelog: v0.7.0...v0.8.0
v0.7.0
What's Changed
0.7.0
- Era histories are now cached through entire run of the program whereas protocol parameters are fetched once per epoch. In case you were utilising era summary given by Atlas, note that era end of last era is now set to being unbounded.
- Bug fix for our caching mechanism, see PR #370 for more details.
- We no longer fetch registered stake pools as it is not required.
- Added utility functions to do slot to epoch related conversations.
addRefScript
now accepts for scripts that has version greater than or equal toPlutusV2
.
Full Changelog: v0.6.3...v0.7.0
v0.6.3
What's Changed
- feat(#368): avoid dependency upon
cardano-balance-tx:internal
by @sourabhxyz in #369
Full Changelog: v0.6.2...v0.6.3
v0.6.2
What's Changed
- feat(#365): add
valueAlter
and some typeclass instances for `GYTxWi… by @sourabhxyz in #367
Full Changelog: v0.6.1...v0.6.2
v0.6.1
What's Changed
- Add ability to create users within
GYTxGameMonad
by @TotallyNotChase in #335 - chore: clean up unified tests by @euonymos in #337
- fix: update Nix setup by @euonymos in #347
- Make feetracker track unexpected gains from inputs by @TotallyNotChase in #344
- feat(#350): remove hardcoded protocol parameters for Maestro & Blockfrost provider by @sourabhxyz in #351
- feat(#355): add support of CIP-57 by @sourabhxyz in #356
New Contributors
- @dependabot made their first contribution in #346
- @euonymos made their first contribution in #337
Full Changelog: v0.6.0...v0.6.1
v0.6.0
Migration guide
The changes introduced by v0.6.0 are huge and we attempt our best to describe a migration guide in this section, which should also introduce some of the new features that have been added.
General changes
- Atlas'
GYTxMonad
has been revamped, with details in this PR (please visit the linked PR as it describes the design of new monads! Same is also provided in the appendix of this release document). In particular, to handle these changes, you might need to do following changes in your codebase:-
Use
runGYTxQueryMonadIO
in place ofrunGYTxQueryMonadNode
. I'll userunGYTxQueryMonadNode
->runGYTxQueryMonadIO
to denote such a change. -
GYTxQueryMonadNode
->GYTxQueryMonadIO
. -
GYTxMonadNode
->GYTxBuilderMonadIO
. -
GYTxBuildResult Identity
->GYTxBuildResult
. -
GYTxMonad
can likely be replaced withGYTxUserQueryMonad
in your code. -
Some of the old functions such as
runGYTxMonadNode
are removed but these can be defined like so:runGYTxMonadNode :: GYNetworkId -> GYProviders -> [GYAddress] -> GYAddress -> Maybe (GYTxOutRef, Bool) -> GYTxBuilderMonadIO (GYTxSkeleton v) -> IO GYTxBody runGYTxMonadNode nid providers addrs change collateral act = runGYTxBuilderMonadIO nid providers addrs change collateral $ act >>= buildTxBody runGYTxMonadNodeF :: forall t v. Traversable t => GYCoinSelectionStrategy -> GYNetworkId -> GYProviders -> [GYAddress] -> GYAddress -> Maybe (GYTxOutRef, Bool) -> GYTxBuilderMonadIO (t (GYTxSkeleton v)) -> IO (t GYTxBody) runGYTxMonadNodeF strat nid providers addrs change collateral act = runGYTxBuilderMonadIO nid providers addrs change collateral $ act >>= traverse (buildTxBodyWithStrategy strat) runGYTxMonadNodeParallel :: GYNetworkId -> GYProviders -> [GYAddress] -> GYAddress -> Maybe (GYTxOutRef, Bool) -> GYTxBuilderMonadIO [GYTxSkeleton v] -> IO GYTxBuildResult runGYTxMonadNodeParallel nid providers addrs change collateral act = runGYTxBuilderMonadIO nid providers addrs change collateral $ act >>= buildTxBodyParallel runGYTxMonadNodeParallelWithStrategy :: GYCoinSelectionStrategy -> GYNetworkId -> GYProviders -> [GYAddress] -> GYAddress -> Maybe (GYTxOutRef, Bool) -> GYTxBuilderMonadIO [GYTxSkeleton v] -> IO GYTxBuildResult runGYTxMonadNodeParallelWithStrategy strat nid providers addrs change collateral act = runGYTxBuilderMonadIO nid providers addrs change collateral $ act >>= buildTxBodyParallelWithStrategy strat
-
GYTxQueryMonadIO
andGYTxBuilderMonadIO
do not haveMonadIO
instance, but these can be defined as shown:import GeniusYield.Unsafe (unsafeIOToQueryMonad, unsafeIOToTxBuilderMonad) instance MonadIO GYTxQueryMonadIO where liftIO = unsafeIOToQueryMonad instance MonadIO GYTxBuilderMonadIO where liftIO = unsafeIOToTxBuilderMonad
-
utxoRefScript
field insideGYUTxO
is updated toMaybe GYAnyScript
whereGYAnyScript
encapsulates both simple (native) scripts and plutus scripts (Atlas now supports simple scripts, yay!).
-
As an example, you can see how we migrated our dex-contracts-api
codebase here.
Privnet
How to run?
To run the privnet tests, first one needs to install cardano-node & cardano-cli like so:
cabal install --package-env=$(pwd) --overwrite-policy=always cardano-cli cardano-node
Then the tests can be ran, like for Atlas: cabal run atlas-privnet-tests -- -j1 --hide-successes
How to structure?
- Due to redesign of monads related to transaction building & query, functions such as
ctxRunI
are no longer present, but they (and some of the related utilities) can be implemented like so:
ctxRunI :: Ctx -> User -> GYTxBuilderMonadIO (GYTxSkeleton v) -> IO GYTxBody
ctxRunI ctx user act = ctxRunBuilder ctx user $ act >>= buildTxBody
ctxRunC :: Ctx -> User -> GYTxBuilderMonadIO a -> IO a
ctxRunC = ctxRunBuilder
ctxRunF :: Traversable t => Ctx -> User -> GYTxBuilderMonadIO (t (GYTxSkeleton v)) -> IO (t GYTxBody)
ctxRunF ctx user act = ctxRunBuilder ctx user $ act >>= traverse buildTxBody
submitTxCtx :: Ctx -> User -> GYTxBody -> IO GYTxId
submitTxCtx ctx user txBody = ctxRun ctx user $ signAndSubmitConfirmed txBody
submitTxCtx' :: Ctx -> User -> GYTx -> IO GYTxId
submitTxCtx' ctx user tx = ctxRun ctx user $ submitTxConfirmed tx
addRefScriptCtx :: Ctx -> User -> GYScript PlutusV2 -> IO GYTxOutRef
addRefScriptCtx ctx user script = ctxRun ctx user $ addRefScriptToLimbo script
-
Earlier the tests might expect the argument
IO Setup
but now onlySetup
is required which can be generated with following continuation:withPrivnet cardanoDefaultTestnetOptionsConway $ \setup
. Please see privnet tests structured inside Atlas here for examples. -
Arguments of
withSetup
are flipped, so instead ofwithSetup setup info
, nowwithSetup info setup
is required but you can usewithSetupOld
instead. -
Use
userChangeAddress
(or first element ofuserAddresses
) instead ofuserAddr
. Note that there is pattern synonymUser'
defined to access old fields such asuserAddr
. -
submitTx
is removed, can use abovesubmitTxCtx
function. -
In case you were catching of
BuildTxException
(now renamed toGYBuildTxError
and it no longer has instance forException
), since now these are made part ofGYBuildTxException
constructor insideGYTxMonadException
type, catch for those instead. For example:- isTxBodyScriptExecutionError :: BuildTxException -> Bool - isTxBodyScriptExecutionError (BuildTxBodyErrorAutoBalance (Api.TxBodyScriptExecutionError _)) = True - isTxBodyScriptExecutionError _ = False + isTxBodyScriptExecutionError :: GYTxMonadException -> Bool + isTxBodyScriptExecutionError (GYBuildTxException (GYBuildTxBodyErrorAutoBalance (Api.TxBodyScriptExecutionError _))) = True + isTxBodyScriptExecutionError _ = False
-
GYPrivnet
now has an additional field to store of the network information used internally, you can largely ignore those. -
Note that these privnet run against Conway era and protocol parameters can be check like so:
pp <- ctxRunQuery ctx protocolParams info $ printf "Protocol parameters: %s" (show pp)
Let us know if you think some of these should be changed!
CLB (cardano-ledger-backend, replacement of plutus-simple-model employed earlier) & new testing mechanism
Note that we now have unified testing in place, i.e., same test file can be ran against multiple backend interpreters, i.e., either utilising CLB, private testnet machinery or any of cardano network (testnet/mainnet).
It is best to see tests-unified
directory to see how to structure these. In particular you don't need to write privnet tests separately!
-
There is no longer
Wallet
type, useUser
instead. -
If you earlier had
runWallet w1 $ withWalletBalancesCheckSimple walletDiffList $ do ...
You should instead do
withWalletBalancesCheckSimple walletDiffList $ asUser w1 $ do ...
-
Note that since the testing mechanism is unified, you should no longer require to import types such as
GYTxMonadClb
in your backend code. I.e., if you hadmyTrace :: SomeParameters -> Wallets -> GYTxMonadClb ()
You should instead do
myTrace :: GYTxGameMonad m => SomeParameters -> Wallets -> m ()
Note that
GYTxGameMonad
constraint should be added if you are employingasUser
in your trace, otherwise make use ofGYTxMonad
etc. -
Use
ownChangeAddress
instead ofownAddress
. -
Instead of
fail ...
usethrowAppError $ someBackendError $ ...
. -
sendSkeleton
andsendSkeleton'
can be defined like so:-- | This is simply defined as @buildTxBody skeleton >>= signAndSubmitConfirmed@. sendSkeleton :: GYTxMonad m => GYTxSkeleton v -> m GYTxId sendSkeleton skeleton = snd <$> sendSkeleton' skeleton sendSkeleton' :: GYTxMonad m => GYTxSkeleton v -> m (GYTxBody, GYTxId) sendSkeleton' skeleton = buildTxBody skeleton >>= \tx -> signAndSubmitConfirmed tx >>= \txId -> pure (tx, txId)
Appendix
Monad redesign summary
This is a long overdue redesign of GYTxMonad
. It adds the ability to submit transactions to the monad and splits it into a more lawful hierarchy. In particular:
-
GYTxQueryMonad
- For common utxo and similar queriesInstance:
GYTxQueryMonadIO
-
GYTxQueryMonad => GYTxSpecialQueryMonad
- For uncommon queries such as protocol parameters, era history etc. (this could potentially be removed, see note below)Instance:
GYTxQueryMonadIO
-
GYTxQueryMonad => GYTxUserQueryMonad
- For queries while acting as a user (having access to own wallet for querying purposes not signing purposes)Instance:
GYTxBuilderMonadIO
- see below. -
(GYTxSpecialQueryMonad, GYTxUserQueryMonad, Default (TxBuilderStrategy)) => GYTxBuilderMonad
- For building transactions while acting as a user. This allows different instances to choose their own transaction building method. IfTxBuilderStrategy
is set toGYCoinSelectionStrategy
(default), the implementation defaults to the pre-existing transaction building methods. Therefore, simplyanyclass
deriving this class will be enough to use the transaction bu...