Skip to content

Commit

Permalink
Merge #2493
Browse files Browse the repository at this point in the history
2493: Let tests and cluster run in pre-mary eras again r=Anviking a=rvl

### Issue Number

ADP-695

### Overview

Conditionally fund the assets faucet based on era.


Co-authored-by: Rodney Lorrimar <[email protected]>
  • Loading branch information
iohk-bors[bot] and rvl authored Feb 5, 2021
2 parents 2428be4 + ba585cf commit fcc8644
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
13 changes: 7 additions & 6 deletions lib/shelley/exe/local-cluster.hs
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,14 @@ main = withLocalClusterSetup $ \dir clusterLogs walletLogs ->
setupFaucet dir trCluster socketPath = do
traceWith trCluster MsgSettingUpFaucet
let trCluster' = contramap MsgCluster trCluster
let encodeAddr = T.unpack . encodeAddress @'Mainnet
let addresses = map (first encodeAddr) shelleyIntegrationTestFunds
let assetAddresses = map (first encodeAddr) maryIntegrationTestAssets
let encodeAddresses = map (first (T.unpack . encodeAddress @'Mainnet))
let accts = concatMap genRewardAccounts mirMnemonics
let rewards = (,Coin $ fromIntegral oneMillionAda) <$> accts
sendFaucetFundsTo trCluster' socketPath dir addresses
sendFaucetAssetsTo trCluster' socketPath dir assetAddresses
let rewards = (, Coin $ fromIntegral oneMillionAda) <$> accts

sendFaucetFundsTo trCluster' socketPath dir $
encodeAddresses shelleyIntegrationTestFunds
sendFaucetAssetsTo trCluster' socketPath dir $
encodeAddresses maryIntegrationTestAssets
moveInstantaneousRewardsTo trCluster' socketPath dir rewards

whenReady dir trCluster logs (RunningNode socketPath block0 (gp, vData)) =
Expand Down
6 changes: 4 additions & 2 deletions lib/shelley/src/Cardano/Wallet/Shelley/Launch/Cluster.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1239,8 +1239,10 @@ sendFaucetAssetsTo
-> FilePath
-> [(String, (TokenBundle, [(String, String)]))] -- ^ (address, assets)
-> IO ()
sendFaucetAssetsTo tr conn dir targets = batch 20 targets $
sendFaucet tr conn dir "assets"
sendFaucetAssetsTo tr conn dir targets = do
era <- getClusterEra dir
when (era >= MaryHardFork) $
batch 20 targets $ sendFaucet tr conn dir "assets"

-- | Build, sign, and send a batch of faucet funding transactions using
-- @cardano-cli@. This function is used by 'sendFaucetFundsTo' and
Expand Down
10 changes: 5 additions & 5 deletions lib/shelley/test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ specWithServer testDir (tr, tracers) = aroundAll withContext
let rewards = (,Coin $ fromIntegral oneMillionAda) <$>
concatMap genRewardAccounts mirMnemonics
moveInstantaneousRewardsTo tr' conn testDir rewards
let encodeAddr = T.unpack . encodeAddress @'Mainnet
let addresses = map (first encodeAddr) shelleyIntegrationTestFunds
let assetAddresses = map (first encodeAddr) maryIntegrationTestAssets
sendFaucetFundsTo tr' conn testDir addresses
sendFaucetAssetsTo tr' conn testDir assetAddresses
let encodeAddresses = map (first (T.unpack . encodeAddress @'Mainnet))
sendFaucetFundsTo tr' conn testDir $
encodeAddresses shelleyIntegrationTestFunds
sendFaucetAssetsTo tr' conn testDir $
encodeAddresses maryIntegrationTestAssets

onClusterStart action dbDecorator (RunningNode conn block0 (gp, vData)) = do
setupFaucet conn
Expand Down

0 comments on commit fcc8644

Please sign in to comment.