-
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.
- Loading branch information
Showing
10 changed files
with
213 additions
and
10 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
56 changes: 56 additions & 0 deletions
56
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,56 @@ | ||
{-# 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.Conway.Core ( | ||
EraTx (..), | ||
EraTxBody (..), | ||
EraTxCert (..), | ||
InjectRuleFailure (..), | ||
) | ||
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 must be declared if the delegator is not yet registered" $ do | ||
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
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