Skip to content

Commit 7b9f33d

Browse files
authored
Merge pull request #198 from tqtezos/krendelhoff/chore-add-kathmandu
[Chore] Add kathmandu protocol support for CI
2 parents bc167c9 + ede94c5 commit 7b9f33d

33 files changed

+2464
-1679
lines changed

.buildkite/pipeline.yml

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,36 @@ env:
1010
&& cp "./nix/sources.json" "./haskell/test/resources/"
1111
TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER: "Y"
1212

13+
.local-chain-env: &local-chain-env
14+
TASTY_CLEVELAND_NODE_ENDPOINT: "http://localhost:8733"
15+
CHAIN_TEST_MONEYBAG_SECRET_KEY: "unencrypted:edsk3AvAoPS5jFov49aWBQ9oVtCPwNSne2CriHvkFxfeCg4Srr5bak"
16+
# this key is defined in local-chain bootstrap accounts list in
17+
# https://github.com/serokell/aquarius-infra/blob/master/servers/albali/chain.nix
18+
19+
.kathmandunet-env: &kathmandunet-env
20+
TASTY_CLEVELAND_NODE_ENDPOINT: "https://kathmandu.testnet.tezos.serokell.team"
21+
CHAIN_TEST_MONEYBAG_SECRET_KEY: "$TESTNET_MONEYBAG"
22+
CHAIN_TEST_MONEYBAG_PASSWORD: "$TESTNET_MONEYBAG_PASSWORD"
23+
24+
.network-tests: &network-tests
25+
commands:
26+
- eval "$FETCH_CONTRACT"
27+
- cd haskell/
28+
- export PATH=$(nix-build ../ -A stablecoin-client)/bin:$PATH
29+
- nix build -L -f .. test
30+
# Note that 'refill-balance' below is the initial 'TASTY_CLEVELAND_MONEYBAG_SECRET_KEY' balance
31+
# which may need to be adjusted in case of insufficient balance errors
32+
- $(nix-build ../ -A run-chain-tests
33+
--argstr refill-balance 1100
34+
--argstr node-endpoint "$$TASTY_CLEVELAND_NODE_ENDPOINT"
35+
--argstr step-moneybag "$$CHAIN_TEST_MONEYBAG_SECRET_KEY"
36+
--argstr step-moneybag-password "$$CHAIN_TEST_MONEYBAG_PASSWORD"
37+
--no-out-link
38+
--argstr scenario './result/bin/stablecoin-test --cleveland-mode=only-network')
39+
retry:
40+
automatic:
41+
limit: 1
42+
1343
steps:
1444
- label: hlint
1545
if: &not_scheduled
@@ -71,47 +101,25 @@ steps:
71101
- nix build -L -f .. test
72102
- ./result/bin/stablecoin-test --cleveland-mode=disable-network
73103

74-
- label: nettest-local-chain-013
75-
key: nettest-local-chain-013
104+
- label: nettest-local-chain-014
105+
key: nettest-local-chain-014
76106
if: *not_scheduled
77107
depends_on: build_library
108+
<<: *network-tests
78109
env:
79-
TASTY_CLEVELAND_NODE_ENDPOINT: "http://localhost:8734"
80-
# this key is defined in local-chain bootstrap accounts list in
81-
# https://github.com/serokell/aquarius-infra/blob/master/servers/albali/chain.nix
82-
CHAIN_TEST_MONEYBAG_SECRET_KEY: "unencrypted:edsk3GjD83F7oj2LrnRGYQer99Fj69U2QLyjWGiJ4UoBZNQwS38J4v"
83-
commands: &run-nettest
84-
- eval "$FETCH_CONTRACT"
85-
- cd haskell/
86-
- export PATH=$(nix-build ../ -A stablecoin-client)/bin:$PATH
87-
- nix build -L -f .. test
88-
# Note that 'refill-balance' below is the initial 'TASTY_CLEVELAND_MONEYBAG_SECRET_KEY' balance
89-
# which may need to be adjusted in case of insufficient balance errors
90-
- $(nix-build ../ -A run-chain-tests
91-
--argstr refill-balance 1100
92-
--argstr node-endpoint "$$TASTY_CLEVELAND_NODE_ENDPOINT"
93-
--argstr step-moneybag "$$CHAIN_TEST_MONEYBAG_SECRET_KEY"
94-
--argstr step-moneybag-password "$$CHAIN_TEST_MONEYBAG_PASSWORD"
95-
--no-out-link
96-
--argstr scenario './result/bin/stablecoin-test --cleveland-mode=only-network')
97-
retry: &retry-nettest
98-
automatic:
99-
limit: 1
100-
101-
- label: nettest-scheduled-jakartanet
102-
key: nettest-scheduled-jakartanet
110+
<<: *local-chain-env
111+
112+
- label: nettest-scheduled-kathmandunet
113+
key: nettest-scheduled-kathmandunet
103114
if: build.source == "schedule"
104115
depends_on:
105116
- build_library
106117
- LIGO-contract
118+
<<: *network-tests
107119
env:
108-
TASTY_CLEVELAND_NODE_ENDPOINT: "https://jakarta.testnet.tezos.serokell.team"
109-
CHAIN_TEST_MONEYBAG_SECRET_KEY: "$JAKARTANET_MONEYBAG"
110-
CHAIN_TEST_MONEYBAG_PASSWORD: "$JAKARTANET_MONEYBAG_PASSWORD"
120+
<<: *kathmandunet-env
111121
# Running all of the tests on network will end up draining the moneybag; for now, only FA1.2 tests are run
112122
TASTY_PATTERN: '/Test.FA1_2/||/Lorentz.Contracts.Nettest/'
113-
commands: *run-nettest
114-
retry: *retry-nettest
115123
timeout_in_minutes: 360
116124

117125
- label: weeder
@@ -130,8 +138,8 @@ steps:
130138
if: *not_scheduled
131139
depends_on:
132140
- test
133-
- nettest-local-chain-013
134-
- nettest-scheduled-jakartanet
141+
- nettest-local-chain-014
142+
- nettest-scheduled-kathmandunet
135143
- weeder
136144
commands:
137145
- eval "$FETCH_CONTRACT"

.github/pull_request_template.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,26 @@ you must be able to justify that.
3636

3737
- Documentation
3838
- [ ] I checked whether I should update the docs and did so if necessary:
39-
- [README](../tree/master/README.md)
39+
- [README](https://github.com/tqtezos/stablecoin/tree/master/README.md)
4040
- Haddock
41-
- [ ] I updated [changelog](../tree/master/ChangeLog.md) unless I am sure my changes are
41+
- [ ] I updated [changelog](https://github.com/tqtezos/stablecoin/tree/master/ChangeLog.md) unless I am sure my changes are
4242
not essential.
4343

4444
#### Stylistic guide (mandatory)
4545

4646
- [ ] My commits comply with [the policy used in Serokell](https://www.notion.so/serokell/Where-and-how-to-commit-your-work-58f8973a4b3142c8abbd2e6fd5b3a08e).
47-
- [ ] My code complies with the [style guide](../tree/master/docs/code-style.md).
47+
- [ ] My code complies with the [style guide](https://github.com/tqtezos/stablecoin/tree/master/docs/code-style.md).
48+
49+
#### ✓ Release Checklist
50+
51+
- [ ] I updated the [Gas / Transaction costs](https://github.com/tqtezos/stablecoin/tree/master/README.md#gas--transaction-costs) table in the README.
52+
- [ ] I updated the version number in `package.yaml`.
53+
- [ ] I updated the [changelog](https://github.com/tqtezos/stablecoin/tree/master/ChangeLog.md) and moved everything
54+
under the "Unreleased" section to a new section for this release version.
55+
- [ ] (After merging) I created a new entry in the [releases](https://github.com/tqtezos/stablecoin/releases) page,
56+
with a summary of all user-facing changes.
57+
* I made sure a tag was created using the format `vX.Y.Z`
58+
* I attached the following artifacts from [buildkite](https://buildkite.com/serokell/stablecoin)
59+
* `stablecoin-client`
60+
* `stablecoin.fa1.2.tz`
61+
* `stablecoin.tz`

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ SPDX-License-Identifier: MIT
99
<!-- Don't forget to update the gas/transaction costs tables in the
1010
README when a new version is released. -->
1111

12+
## 1.7.4
13+
14+
* [#198](https://github.com/tqtezos/stablecoin/pull/198)
15+
* Add support for the kathmandu protocol.
16+
1217
## 1.7.3
1318

1419
* [#196](https://github.com/tqtezos/stablecoin/pull/196)

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,33 @@ Please refer to the [`haskell/`](/haskell/) directory for details.
5050
## Gas / Transaction costs
5151

5252
The tables below show the gas and transaction costs of both versions (FA1.2 and FA2) of
53-
the stablecoin contract [v1.7.3](https://github.com/tqtezos/stablecoin/releases/tag/v1.7.3) in jakartanet.
53+
the stablecoin contract [v1.7.4](https://github.com/tqtezos/stablecoin/releases/tag/v1.7.4) in kathmandunet.
5454

55-
### jakartanet
55+
### kathmandunet
5656

57-
* [FA1.2 operations](https://better-call.dev/jakartanet/KT1ASuzkJzZ2pCqYVKeV48p5yxunynrjmdGE/operations)
58-
* [FA2 operations](https://better-call.dev/jakartanet/KT19mksNfM9XjWqapR2iMywM1ic5kbVQwpjB/operations)
57+
* [FA1.2 operations](https://better-call.dev/kathmandunet/KT19nHidwLXgGCEPgm2ZVMsmgzowsqEGFyKG/operations)
58+
* [FA2 operations](https://better-call.dev/kathmandunet/KT1RxTmLHfCRfvCP7WFSSCftxLNQNfKPqDTo/operations)
5959

6060
| | FA1.2 Gas cost | FA2 Gas cost | FA1.2 Tx cost | FA2 Tx cost |
6161
| ----------- | -------------- | ------------ | ------------- | ----------- |
62-
| origination | 5743 | 5809 | 2.381299| 2.414438|
63-
| transfer | 6659 | 7003 | 0.001001| 0.001053|
62+
| origination | 7,131 | 7,052 | 2.381438| 2.414563|
63+
| transfer | 8,047 | 8,246 | 0.00114 | 0.001177|
6464

6565
### Measuring
6666

6767
To measure and collect these numbers:
6868
1. Pick a testnet:
6969
```
70-
export STABLECOIN_TESTNET=https://jakarta.testnet.tezos.serokell.team/
70+
export STABLECOIN_TESTNET=https://kathmandu.testnet.tezos.serokell.team/
7171
```
72-
1. Use a [testnet faucet](https://teztnets.xyz/) to create a test account with enough funds.
73-
1. Activate the account:
72+
1. Create a test account and grab its hash:
7473
```
75-
tezos-client -E $STABLECOIN_TESTNET activate account stablecoin-moneybag with <activation_file.json>
74+
$ tezos-client gen keys stablecoin-moneybag --force
75+
$ tezos-client -E $STABLECOIN_TESTNET show address stablecoin-moneybag
76+
Hash: tz1Shin6pHETKn7EroLGyG2afTenW2zT2K6w
77+
Public Key: edpktpFQUaRZRHPMBgk66W4jQoYK2hzZ95o9ZJrPmH38zqSzfH5Zor
7678
```
79+
1. Use a [testnet faucet](https://teztnets.xyz/) to add funds to your account.
7780
1. Run:
7881
```bash
7982
cd haskell

haskell/hpack/definitions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ _definitions:
5252
- RecursiveDo
5353
- ScopedTypeVariables
5454
- StandaloneDeriving
55+
- StandaloneKindSignatures
5556
- TemplateHaskell
5657
- TupleSections
5758
- TypeApplications

haskell/package.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<<: !include "./hpack/module.yaml"
55

66
name: stablecoin
7-
version: 1.7.3
7+
version: 1.7.4
88

99
extra-source-files:
1010
- README.md
@@ -28,13 +28,16 @@ library:
2828
- aeson-casing
2929
- bytestring
3030
- cleveland
31+
- colourista
32+
- constraints
3133
- containers
3234
- directory
3335
- fmt
3436
- indigo
3537
- lens
3638
- lorentz
3739
- megaparsec
40+
- memory
3841
- morley
3942
- morley-client
4043
- morley-ledgers
@@ -43,6 +46,7 @@ library:
4346
- optparse-applicative
4447
- process
4548
- servant-client
49+
- singletons
4650
- template-haskell
4751
- text
4852
- uncaught-exception

haskell/src/Lorentz/Contracts/Stablecoin/Metadata.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module Lorentz.Contracts.Stablecoin.Metadata
1313

1414
import Data.Aeson qualified as J
1515
import Data.ByteString.Lazy qualified as BSL
16-
import Data.Map qualified as Map
1716
import Data.Version (showVersion)
1817
import Fmt (pretty)
1918
import Text.Megaparsec qualified as P
@@ -27,7 +26,7 @@ import Lorentz.Contracts.Spec.TZIP16Interface qualified as TZ
2726
import Morley.Metadata
2827
(ViewCode(..), compileViewCodeTH, mkMichelsonStorageView, unsafeCompileViewCode)
2928
import Morley.Micheline (ToExpression(toExpression))
30-
import Morley.Tezos.Address (formatAddress, parseAddress)
29+
import Morley.Tezos.Address (ContractAddress, formatAddress, parseKindedAddress)
3130

3231
import Lorentz.Contracts.Stablecoin.Types
3332
import Paths_stablecoin (version)
@@ -67,7 +66,7 @@ metadataMap mdata = mkBigMap $
6766
-- Result after parsing the metadata uri from a TZIP-16 metadata bigmap.
6867
data ParsedMetadataUri
6968
= InCurrentContractUnderKey Text
70-
| InRemoteContractUnderKey Address Text
69+
| InRemoteContractUnderKey ContractAddress Text
7170
| RawUri Text
7271
deriving stock (Eq, Show)
7372

@@ -85,7 +84,7 @@ remoteContractUriParser = do
8584
_ <- string' (TZ.tezosStorageScheme <> "://")
8685
addr <- P.manyTill P.anySingle (string' "/")
8786
key <- P.many P.anySingle
88-
case parseAddress (toText addr) of
87+
case parseKindedAddress (toText addr) of
8988
Right paddr -> pure $ InRemoteContractUnderKey paddr (toText key)
9089
Left err -> fail $ pretty err
9190

@@ -100,7 +99,7 @@ currentContractUriParser = do
10099

101100
data MetadataUri metadata
102101
= CurrentContract metadata Bool -- ^ Metadata and a flag to denote if URI should be included
103-
| RemoteContract Address
102+
| RemoteContract ContractAddress
104103
| Raw Text
105104

106105
-- | Make the TZIP-16 metadata. We accept a @Maybe@ @FA2.TokenMetadata@
@@ -269,7 +268,7 @@ mkTokenMetadataView md =
269268
, vPure = Just True
270269
, vImplementations = one $
271270
VIMichelsonStorageView $
272-
mkMichelsonStorageView @Storage @(Natural, Map.Map MText ByteString) Nothing [] vc
271+
mkMichelsonStorageView @Storage @(Natural, FA2.TokenMetadata) Nothing [] vc
273272
}
274273

275274
getDefaultExpiryView :: TZ.View (ToT Storage)

haskell/src/Lorentz/Contracts/Stablecoin/Types.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ import Lorentz.Contracts.Spec.TZIP16Interface (MetadataMap)
4242
import Morley.AsRPC (HasRPCRepr(..), deriveRPCWithStrategy)
4343
import Morley.Michelson.Typed (Notes(..))
4444
import Morley.Michelson.Untyped (noAnn)
45-
import Morley.Tezos.Address.Alias (AddressOrAlias(..))
4645
import Morley.Tezos.Crypto qualified as Hash
46+
import Stablecoin.Client.L1AddressOrAlias (L1AddressOrAlias)
4747

4848
------------------------------------------------------------------
4949
-- Parameter
5050

5151
-- | Data needed to add or remove an operator.
5252
data UpdateOperatorData
53-
= AddOperator AddressOrAlias
54-
| RemoveOperator AddressOrAlias
53+
= AddOperator L1AddressOrAlias
54+
| RemoveOperator L1AddressOrAlias
5555
deriving stock Show
5656

5757
data ConfigureMinterParam = ConfigureMinterParam

haskell/src/Stablecoin/Client.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module Stablecoin.Client
55
( module Stablecoin.Client.Impl
6-
, InitialStorageData(..)
6+
, InitialStorageOptions(..)
77
, Alias
88
) where
99

0 commit comments

Comments
 (0)