Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix calculate-min-utxo cli command and add round trip JSON test for
ProtocolParameters
- Loading branch information
Showing
8 changed files
with
182 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module Test.Cardano.Api.Typed.JSON | ||
( tests | ||
) where | ||
|
||
import Cardano.Api | ||
import Cardano.Prelude | ||
|
||
import Data.Aeson | ||
|
||
import Hedgehog (Gen, Property, discover, forAll, tripping) | ||
import qualified Hedgehog as H | ||
import qualified Hedgehog.Gen as Gen | ||
import Test.Tasty (TestTree) | ||
import Test.Tasty.Hedgehog.Group (fromGroup) | ||
|
||
import Test.Cardano.Api.Typed.Gen | ||
|
||
|
||
{- HLINT ignore "Use camelCase" -} | ||
|
||
prop_roundtrip_praos_nonce_JSON :: Property | ||
prop_roundtrip_praos_nonce_JSON = H.property $ do | ||
pNonce <- forAll $ Gen.just genMaybePraosNonce | ||
tripping pNonce encode eitherDecode | ||
|
||
prop_roundtrip_protocol_parameters_JSON :: Property | ||
prop_roundtrip_protocol_parameters_JSON = H.property $ do | ||
pp <- forAll genProtocolParameters | ||
tripping pp encode eitherDecode | ||
|
||
|
||
-- ----------------------------------------------------------------------------- | ||
|
||
roundtrip_CBOR | ||
:: (SerialiseAsCBOR a, Eq a, Show a) | ||
=> AsType a -> Gen a -> Property | ||
roundtrip_CBOR typeProxy gen = | ||
H.property $ do | ||
val <- H.forAll gen | ||
H.tripping val serialiseToCBOR (deserialiseFromCBOR typeProxy) | ||
|
||
|
||
|
||
-- ----------------------------------------------------------------------------- | ||
|
||
tests :: TestTree | ||
tests = fromGroup $$discover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 31 additions & 21 deletions
52
cardano-cli/test/data/golden/shelley/transaction-calculate-min-fee/protocol-params.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
{ | ||
"poolDeposit": 0, | ||
"protocolVersion": { | ||
"minor": 0, | ||
"major": 0 | ||
"extraPraosEntropy": null, | ||
"stakePoolTargetNum": 100, | ||
"poolRetireMaxEpoch": 18, | ||
"decentralization": { | ||
"denominator": 10, | ||
"numerator": 7 | ||
}, | ||
"decentralisationParam": 0.99, | ||
"maxTxSize": 2048, | ||
"minFeeA": 500, | ||
"maxBlockBodySize": 2097152, | ||
"minFeeB": 2, | ||
"minUTxOValue": 1, | ||
"minPoolCost": 100, | ||
"eMax": 0, | ||
"extraEntropy": { | ||
"tag": "NeutralNonce" | ||
"stakePoolDeposit": 0, | ||
"maxBlockHeaderSize": 1100, | ||
"maxBlockBodySize": 65536, | ||
"maxTxSize": 16384, | ||
"treasuryCut": { | ||
"denominator": 1, | ||
"numerator": 0 | ||
}, | ||
"maxBlockHeaderSize": 8192, | ||
"keyDeposit": 0, | ||
"nOpt": 100, | ||
"rho": 0, | ||
"tau": 0, | ||
"a0": 0 | ||
} | ||
"minPoolCost": 0, | ||
"monetaryExpansion": { | ||
"denominator": 1, | ||
"numerator": 0 | ||
}, | ||
"stakeAddressDeposit": 0, | ||
"poolPledgeInfluence": { | ||
"denominator": 1, | ||
"numerator": 0 | ||
}, | ||
"protocolVersion": [ | ||
2, | ||
0 | ||
], | ||
"txFeeFixed": 100, | ||
"txFeePerByte": 1000, | ||
"minUTxOValue": 1234556 | ||
} |