Skip to content

Commit

Permalink
Merge pull request #165 from tqtezos/rvem/tm523-morley-lts-17-3
Browse files Browse the repository at this point in the history
[TM-523] Bump morley and other deps
  • Loading branch information
rvem authored Sep 2, 2021
2 parents 552f2b1 + ec80683 commit 631eac3
Show file tree
Hide file tree
Showing 28 changed files with 502 additions and 467 deletions.
47 changes: 11 additions & 36 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,64 +68,39 @@ steps:
- eval "$FETCH_CONTRACT"
- cd haskell
- nix build -L -f .. test
- ./result/bin/stablecoin-test
- ./result/bin/stablecoin-test --nettest-mode=disable-network

- label: nettest-local-chain-009
key: nettest-local-chain-009
- label: nettest-local-chain-010
key: nettest-local-chain-010
if: *not_scheduled
depends_on: build_library
env:
NETTEST_NODE_ENDPOINT: "http://localhost:8734"
TASTY_NETTEST_NODE_ENDPOINT: "http://localhost:8733"
# this key is defined in local-chain bootstrap accounts list in
# https://github.com/serokell/aquarius-infra/blob/master/servers/albali/chain.nix
MONEYBAG: "unencrypted:edsk3GjD83F7oj2LrnRGYQer99Fj69U2QLyjWGiJ4UoBZNQwS38J4v"
TASTY_NETTEST_MONEYBAG_SECRET_KEY: "unencrypted:edsk3GjD83F7oj2LrnRGYQer99Fj69U2QLyjWGiJ4UoBZNQwS38J4v"
commands: &run-nettest
- eval "$FETCH_CONTRACT"
- cd haskell/
- nix build -L -f ../ nettest
- nix run -f ../ tezos-client stablecoin-client -c ../scripts/ci/run-local-chain-nettest.sh ./result/bin/stablecoin-nettest
- nix build -L -f .. test
- nix run -f ../ tezos-client -c ./result/bin/stablecoin-test --nettest-mode=only-network
retry: &retry-nettest
automatic:
limit: 1

- label: nettest-local-chain-010
key: nettest-local-chain-010
if: *not_scheduled
depends_on: build_library
env:
NETTEST_NODE_ENDPOINT: "http://localhost:8733"
# this key is defined in local-chain bootstrap accounts list in
# https://github.com/serokell/aquarius-infra/blob/master/servers/albali/chain.nix
MONEYBAG: "unencrypted:edsk3GjD83F7oj2LrnRGYQer99Fj69U2QLyjWGiJ4UoBZNQwS38J4v"
commands: *run-nettest
retry: *retry-nettest

- label: nettest-scheduled-florencenet
key: nettest-scheduled-florencenet
if: build.source == "schedule"
depends_on:
- build_library
- LIGO-contract
env:
NETTEST_NODE_ENDPOINT: "http://florence.testnet.tezos.serokell.team:8732"
# Note that testnet moneybag can run out of tz. If this happened, someone should transfer it some
# more tz, its address: tz1ij8gUYbMRUXa4xX3mNvKguhaWG9GGbURn
MONEYBAG: "unencrypted:edsk4EYgVvKVKppJXAyeoqxJrNeyoktNqmcx5op1CFht9P1p8pPxp7"
commands: *run-nettest
retry: *retry-nettest
timeout_in_minutes: 360

- label: nettest-scheduled-granadanet
key: nettest-scheduled-granadanet
if: build.source == "schedule"
depends_on:
- build_library
- LIGO-contract
env:
NETTEST_NODE_ENDPOINT: "http://granada.testnet.tezos.serokell.team:8732"
TASTY_NETTEST_NODE_ENDPOINT: "http://granada.testnet.tezos.serokell.team:8732"
# Note that testnet moneybag can run out of tz. If this happened, someone should transfer it some
# more tz, its address: tz1ij8gUYbMRUXa4xX3mNvKguhaWG9GGbURn
MONEYBAG: "unencrypted:edsk4EYgVvKVKppJXAyeoqxJrNeyoktNqmcx5op1CFht9P1p8pPxp7"
TASTY_NETTEST_MONEYBAG_SECRET_KEY: "unencrypted:edsk4EYgVvKVKppJXAyeoqxJrNeyoktNqmcx5op1CFht9P1p8pPxp7"
commands: *run-nettest
retry: *retry-nettest
timeout_in_minutes: 360
Expand All @@ -146,8 +121,8 @@ steps:
if: *not_scheduled
depends_on:
- test
- nettest-local-chain-009
- nettest-scheduled-florencenet
- nettest-local-chain-010
- nettest-scheduled-granadanet
- weeder
commands:
- eval "$FETCH_CONTRACT"
Expand Down
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ SPDX-License-Identifier: MIT
# Changelog for stablecoin

## Unreleased changes
* [#165](https://github.com/tqtezos/stablecoin/pull/165)
* Bump `morley`, `lorentz` and other dependencies.
<!-- Prepend new entries here -->
<!-- Don't forget to update the gas/transaction costs tables in the
README when a new version is released. -->
Expand Down
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,7 @@ Please refer to the [`haskell/`](/haskell/) directory for details.
## Gas / Transaction costs

The tables below show the gas and transaction costs of both versions (FA1.2 and FA2) of
the stablecoin contract [v1.7.1](https://github.com/tqtezos/stablecoin/releases/tag/v1.7.1) in Delphinet.

### Delphinet

* [FA1.2 operations](https://delphi.tzstats.com/KT1JoPqNTPwdxgvu4dtykSPuj9qECRpWfxuF)
* [FA2 operations](https://delphi.tzstats.com/KT1AokQQnJxNyi4FbUHN7evkfYvaEnmTy6Ry)

| | FA1.2 Gas cost | FA2 Gas cost | FA1.2 Tx cost | FA2 Tx cost |
| ----------- | -------------- | ------------ | ------------- | ----------- |
| origination | 63003 | 61250 | 2.794888 ꜩ | 2.778397 ꜩ |
| transfer | 65006 | 63661 | 0.006836 ꜩ | 0.006716 ꜩ |
the stablecoin contract [v1.7.1](https://github.com/tqtezos/stablecoin/releases/tag/v1.7.1) in Edonet.

### Edonet

Expand All @@ -75,7 +65,7 @@ the stablecoin contract [v1.7.1](https://github.com/tqtezos/stablecoin/releases/
### Measuring

To measure and collect these numbers:
1. Configure your `tezos-client` to use a delphinet node
1. Configure your `tezos-client` to use a current testnet node
1. Make sure `tezos-client` has a `nettest` alias with enough ꜩ
```
tezos-client get balance for nettest
Expand Down
4 changes: 4 additions & 0 deletions haskell/hpack/definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ _definitions:
- -Wno-missing-local-signatures
- -Wno-monomorphism-restriction
- -Wno-implicit-prelude
- -Wno-prepositive-qualified-module
- -Wno-missing-safe-haskell-mode
- -Wno-unused-packages


_utils:
# Additional options, they will be merged with the ones above when both
Expand Down
23 changes: 12 additions & 11 deletions haskell/nettest/FA1_2Comparison.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ module FA1_2Comparison
import qualified Data.Map as Map
import Fmt (build)

import Lorentz (BigMap(..), EntrypointRef(Call), TAddress(..), toVal)
import Michelson.Typed (convertContract, untypeValue)
import Lorentz (TAddress(..), toVal)
import Michelson.Typed (convertContract, mkBigMap, untypeValue)
import Morley.Nettest.Abstract (nettestAddressAlias)
import Morley.Nettest
import Util.Named ((.!))

Expand All @@ -34,12 +35,12 @@ fa1_2ComparisonScenario = uncapsNettest $ do
comment "-- FA1.2 vs FA2 comparison tests --"

comment "Creating accounts"
nettest <- resolveNettestAddress
owner1 <- newAddress "Steve"
owner2 <- newAddress "Megan"
nettest <- resolveAddress nettestAddressAlias
owner1 <- newAddress auto
owner2 <- newAddress auto

comment "Originating Stablecoin FA1.2 contract"
let balances = Map.fromList
let balances =
[ (owner1, 10)
, (owner2, 10)
]
Expand All @@ -55,14 +56,14 @@ fa1_2ComparisonScenario = uncapsNettest $ do
cmrFA1_2Address <- nettestOriginateContractMetadataContract metadata
let fa1_2Storage = SFA1_2.Storage
{ sDefaultExpiry = 1000
, sLedger = BigMap balances
, sLedger = mkBigMap balances
, sMintingAllowances = mempty
, sPaused = False
, sPermitCounter = 0
, sPermits = mempty
, sRoles = roles
, sTransferlistContract = Nothing
, sTotalSupply = sum balances
, sTotalSupply = sum $ Map.fromList balances
, sSpenderAllowances = mempty
, sMetadata = metadataMap @(()) (RemoteContract cmrFA1_2Address)
}
Expand All @@ -71,13 +72,13 @@ fa1_2ComparisonScenario = uncapsNettest $ do
originateUntypedSimple "Stablecoin FA1.2" (untypeValue $ toVal fa1_2Storage) stablecoinFA1_2Contract

comment "Calling transfer"
withSender (AddressResolved owner1) $
withSender owner1 $
call fa1_2ContractAddr (Call @"Transfer") (#from .! owner1, #to .! owner2, #value .! 2)

cmrAddress <- nettestOriginateContractMetadataContract metadata
let fa2Storage = SFA2.Storage
{ sDefaultExpiry = 1000
, sLedger = BigMap balances
, sLedger = mkBigMap balances
, sMintingAllowances = mempty
, sPaused = False
, sPermitCounter = 0
Expand All @@ -94,7 +95,7 @@ fa1_2ComparisonScenario = uncapsNettest $ do
originateUntypedSimple "Stablecoin FA2" (untypeValue $ toVal fa2Storage) (convertContract stablecoinContract)

comment "Calling transfer"
withSender (AddressResolved owner1) $ call fa2ContractAddr (Call @"Transfer") [FA2.TransferItem
withSender owner1 $ call fa2ContractAddr (Call @"Transfer") [FA2.TransferItem
{ tiFrom = owner1
, tiTxs =
[ TransferDestination
Expand Down
29 changes: 15 additions & 14 deletions haskell/nettest/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import Options.Applicative (execParser)
import qualified Data.Text.IO.Utf8 as Utf8
import qualified Indigo.Contracts.Transferlist.External as External
import qualified Indigo.Contracts.Transferlist.Internal as Internal
import Lorentz (ToT, compileLorentzContract, toVal)
import Lorentz (ToT, toVal)
import Lorentz.Contracts.Test.Common
import Michelson.Runtime (parseExpandContract)
import Michelson.Typed (untypeValue)
import Michelson.Typed.Convert (convertContract)
import Morley.Client (parserInfo)
import Morley.Nettest
import Morley.Nettest.Parser (NettestConfig(..), mkNettestEnv, nettestConfigParser)
import Morley.Nettest.Abstract (NettestMiscImpl(..))
import Morley.Nettest.Parser (mkNettestEnv, nettestConfigParser)
import Morley.Nettest.Pure (scenarioToIO)
import Tezos.Address
import Util.Named
Expand Down Expand Up @@ -46,11 +46,11 @@ main = do
externalTransferlistContract <- either (error "cannot parse transferlist contract") pure $
parseExpandContract (Just externalTransferlistContractPath) externalTransferlistFile
let
originateTransferlistInternal transfers receivers =
originateUntypedSimple
originateTransferlistInternal transfers receivers = chAddress <$>
originateSimple
"nettest.transferlist_internal"
(untypeValue . toVal $ Internal.Storage transfers receivers)
(convertContract $ compileLorentzContract Internal.transferlistContract)
(Internal.Storage transfers receivers)
(Internal.transferlistContract)

originateTransferlistExternal :: forall m capsM. (Monad m, capsM ~ NettestT m) => Set (Address, Address) -> Set Address -> capsM Address
originateTransferlistExternal transfers receivers =
Expand All @@ -65,20 +65,22 @@ main = do
externalTransferlistContract

scenarioWithInternalTransferlist :: NettestScenario m
scenarioWithInternalTransferlist impl = do
niComment impl "Stablecoin contract nettest scenarioWithInternalTransferlist"
scenarioWithInternalTransferlist impl moneybag = do
nmiComment (niMiscImpl impl) $ "Stablecoin contract nettest scenarioWithInternalTransferlist"
scNettestScenario
originateTransferlistInternal
Internal
impl
moneybag

scenarioWithExternalTransferlist :: forall m capsM. (Monad m, capsM ~ NettestT m) => NettestImpl m -> m ()
scenarioWithExternalTransferlist impl = do
niComment impl "Stablecoin contract nettest scenarioWithExternalTransferlist"
scenarioWithExternalTransferlist :: forall m capsM. (capsM ~ NettestT m) => NettestScenario m
scenarioWithExternalTransferlist impl moneybag = do
nmiComment (niMiscImpl impl) $ "Stablecoin contract nettest scenarioWithExternalTransferlist"
scNettestScenario
(originateTransferlistExternal @m @capsM)
External
impl
moneybag

env <- mkNettestEnv parsedConfig
scenarioToIO scenarioWithInternalTransferlist
Expand All @@ -90,8 +92,7 @@ main = do
runNettestClient env permitScenario

runStablecoinClient
(ncMorleyClientConfig parsedConfig)
(neMorleyClientEnv env)
env
stablecoinClientScenario

-- Compare the gas/transaction costs of the FA1.2 vs the FA2 versions of stablecoin
Expand Down
Loading

0 comments on commit 631eac3

Please sign in to comment.