-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conformance testing for CERT. Rework TestRep.
- Loading branch information
Showing
20 changed files
with
568 additions
and
182 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
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
61 changes: 61 additions & 0 deletions
61
eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/DelegSpec.hs
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,61 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE PatternSynonyms #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
|
||
module Test.Cardano.Ledger.Conway.Imp.DelegSpec (spec) where | ||
|
||
import Cardano.Ledger.Coin (Coin (..)) | ||
import Cardano.Ledger.Conway.Core ( | ||
EraTx (..), | ||
EraTxBody (..), | ||
EraTxCert (..), | ||
InjectRuleFailure (..), | ||
ppKeyDepositL, | ||
) | ||
import Cardano.Ledger.Conway.Rules (ConwayDelegPredFailure (..)) | ||
import Cardano.Ledger.Conway.TxCert ( | ||
ConwayEraTxCert, | ||
Delegatee (DelegStake), | ||
pattern RegDepositDelegTxCert, | ||
) | ||
import Cardano.Ledger.Credential (Credential (..)) | ||
import Cardano.Ledger.Val (Val (..)) | ||
import qualified Data.List.NonEmpty as NE | ||
import qualified Data.Sequence.Strict as SSeq | ||
import Lens.Micro ((&), (.~)) | ||
import Test.Cardano.Ledger.Conway.ImpTest | ||
import Test.Cardano.Ledger.Imp.Common | ||
|
||
spec :: | ||
forall era. | ||
( ShelleyEraImp era | ||
, ConwayEraTxCert era | ||
, InjectRuleFailure "LEDGER" ConwayDelegPredFailure era | ||
, ToExpr (TxCert era) | ||
) => | ||
SpecWith (ImpTestState era) | ||
spec = describe "DELEG" $ do | ||
it "Deposit can't be zero if the delegator is not yet registered" $ do | ||
modifyPParams $ \pp -> | ||
pp | ||
& ppKeyDepositL .~ Coin 100 | ||
delegatorCred <- KeyHashObj <$> freshKeyHash | ||
delegatee <- freshKeyHash | ||
let | ||
cert = | ||
RegDepositDelegTxCert | ||
delegatorCred | ||
(DelegStake delegatee) | ||
zero | ||
logToExpr cert | ||
let | ||
tx = | ||
mkBasicTx mkBasicTxBody | ||
& bodyTxL . certsTxBodyL .~ SSeq.singleton cert | ||
submitFailingTx | ||
tx | ||
(injectFailure (IncorrectDepositDELEG zero) NE.:| []) |
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
Oops, something went wrong.