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
112 changed files
with
1,824 additions
and
269 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
2 changes: 1 addition & 1 deletion
2
cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Alonzo/Scenarios.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
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
42 changes: 42 additions & 0 deletions
42
cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Babbage/Scenarios.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,42 @@ | ||
module Cardano.Mock.Forging.Tx.Babbage.Scenarios where | ||
|
||
import Cardano.Prelude hiding (length, (.)) | ||
|
||
import Data.List.Extra | ||
|
||
import Cardano.Ledger.Mary.Value | ||
import Cardano.Ledger.Shelley.API | ||
import Cardano.Mock.Forging.Interpreter | ||
import qualified Cardano.Mock.Forging.Tx.Babbage as Babbage | ||
import Cardano.Mock.Forging.Tx.Generic | ||
import Cardano.Mock.Forging.Types | ||
|
||
delegateAndSendBlocks :: Int -> Interpreter -> IO [CardanoBlock] | ||
delegateAndSendBlocks n interpreter = do | ||
addrFrom <- withBabbageLedgerState interpreter $ resolveAddress (UTxOIndex 0) | ||
registerBlocks <- forM (chunksOf 500 creds) $ \blockCreds -> do | ||
blockTxs <- withBabbageLedgerState interpreter $ \_st -> | ||
forM (chunksOf 10 blockCreds) $ \txCreds -> -- 10 per tx | ||
Babbage.mkDCertTx (fmap (DCertDeleg . RegKey) txCreds) (Wdrl mempty) | ||
forgeNextFindLeader interpreter (TxBabbage <$> blockTxs) | ||
|
||
delegateBlocks <- forM (chunksOf 500 creds) $ \blockCreds -> do | ||
blockTxs <- withBabbageLedgerState interpreter $ \st -> | ||
forM (chunksOf 10 blockCreds) $ \txCreds -> --do -- 10 per tx | ||
Babbage.mkDCertTx | ||
(fmap (\ (poolIx, cred) -> DCertDeleg $ Delegate $ Delegation cred (resolvePool (PoolIndex poolIx) st)) | ||
(zip (cycle [0,1,2]) txCreds)) | ||
(Wdrl mempty) | ||
forgeNextFindLeader interpreter (TxBabbage <$> blockTxs) | ||
|
||
let utxoIndex = UTxOAddress addrFrom | ||
sendBlocks <- forM (chunksOf 500 addresses) $ \blockAddresses -> do | ||
blockTxs <- withBabbageLedgerState interpreter $ \st -> | ||
forM (chunksOf 10 blockAddresses) $ \txAddresses -> | ||
Babbage.mkPaymentTx' utxoIndex (fmap (\addr -> (UTxOAddress addr, Value 1 mempty)) txAddresses) st | ||
forgeNextFindLeader interpreter (TxBabbage <$> blockTxs) | ||
pure $ registerBlocks <> delegateBlocks <> sendBlocks | ||
where | ||
creds = createStakeCredentials n | ||
pcreds = createPaymentCredentials n | ||
addresses = fmap (\(pcred, cred) -> Addr Testnet pcred (StakeRefBase cred)) (zip pcreds creds) |
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
Oops, something went wrong.