Skip to content

Releases: geniusyield/atlas

v0.9.0

15 Jan 12:50
b642648
Compare
Choose a tag to compare

What's Changed

See CHANGELOG.

All involved pull requests

Full Changelog: v0.8.1...v0.9.0

v0.8.1

14 Jan 13:20
d0f64e8
Compare
Choose a tag to compare

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

14 Jan 11:01
89f1962
Compare
Choose a tag to compare

What's Changed

See CHANGELOG.

All involved pull requests

Full Changelog: v0.7.0...v0.8.0

v0.7.0

24 Dec 15:17
dc2884e
Compare
Choose a tag to compare

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 to PlutusV2.

Full Changelog: v0.6.3...v0.7.0

v0.6.3

11 Dec 12:39
5dd9279
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.6.2...v0.6.3

v0.6.2

15 Nov 05:07
233122f
Compare
Choose a tag to compare

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

05 Oct 14:42
6efc2b1
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.6.0...v0.6.1

v0.6.0

29 Aug 12:42
b05a986
Compare
Choose a tag to compare

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 of runGYTxQueryMonadNode. I'll use runGYTxQueryMonadNode -> runGYTxQueryMonadIO to denote such a change.

    • GYTxQueryMonadNode -> GYTxQueryMonadIO.

    • GYTxMonadNode -> GYTxBuilderMonadIO.

    • GYTxBuildResult Identity -> GYTxBuildResult.

    • GYTxMonad can likely be replaced with GYTxUserQueryMonad 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 and GYTxBuilderMonadIO do not have MonadIO 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 inside GYUTxO is updated to Maybe GYAnyScript where GYAnyScript 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 only Setup 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 of withSetup setup info, now withSetup info setup is required but you can use withSetupOld instead.

  • Use userChangeAddress (or first element of userAddresses) instead of userAddr. Note that there is pattern synonym User' defined to access old fields such as userAddr.

  • submitTx is removed, can use above submitTxCtx function.

  • In case you were catching of BuildTxException (now renamed to GYBuildTxError and it no longer has instance for Exception), since now these are made part of GYBuildTxException constructor inside GYTxMonadException 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, use User 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 had

    myTrace :: SomeParameters -> Wallets -> GYTxMonadClb ()
    

    You should instead do

    myTrace :: GYTxGameMonad m => SomeParameters -> Wallets -> m ()
    

    Note that GYTxGameMonad constraint should be added if you are employing asUser in your trace, otherwise make use of GYTxMonad etc.

  • Use ownChangeAddress instead of ownAddress.

  • Instead of fail ... use throwAppError $ someBackendError $ ....

  • sendSkeleton and sendSkeleton' 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 queries

    Instance: 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. If TxBuilderStrategy is set to GYCoinSelectionStrategy (default), the implementation defaults to the pre-existing transaction building methods. Therefore, simply anyclass deriving this class will be enough to use the transaction bu...

Read more

v0.5.0

23 May 04:21
7d0536b
Compare
Choose a tag to compare

What's Changed

  • Handle all balancing errors failure in parallel tx build logic by @sourabhxyz in #269.
    Earlier only BalancingErrorInsufficientFunds was returned for in BuildTxBalancingError but now all of BalancingError are accounted for in it.
  • Support for GYStakeAddressBech32 + upstreamed few types, instances & utilities by @sourabhxyz in #273.
  • Ability to use Maestro's turbo tx submission by @sourabhxyz in #274.
    Now an optional turboSubmit field can be included when specifying Maestro provider configuration as explained in this section of the documentation.
  • Add support for stake signing keys by @sourabhxyz in #280.
    This adds support in Atlas for stake keys. In particular, support is provided to load private stake signing keys from file and ability to require stake key hash in transaction skeleton. Attempt has been made to keep breaking changes at minimal, in particular two changes are breaking:
    • newTempUserCtx now accepts a configuration instead of a boolean.
    • Fields of User type have been updated.
    • GYPaymentCredentialByKey now requires GYPaymentKeyHash instead of GYPubKeyHash.
  • Adds functions into Wallet module, improves api interface... by @sourabhxyz in #284.
  • Improve swagger instances, provide helper utilities... by @sourabhxyz in #288.
  • Add improvements to tx metadata api by @sourabhxyz in #293.
  • Add provider support to query utxos at multiple payment credent… by @sourabhxyz in #291.
  • Add a way to add transaction metadata by @ajuggler in #285.
  • Add support of stake validators by @sourabhxyz in #295.
    This also added support of stake key related certificates, such as it's registration, delegation and deregistration. Support of withdrawal is also added. Head over to this section of the documentation for more information on it.

New Contributors

Full Changelog: v0.4.0...v0.5.0

v0.4.0

20 Dec 08:51
887633f
Compare
Choose a tag to compare

What's Changed

Dependencies Bump: Please note the commit of dependencies used in cabal.project file as some of them have been updated b/w v0.3.0 & v0.4.0.

Full Changelog: v0.3.0...v0.4.0