Skip to content

Commit ca96c43

Browse files
iohk-bors[bot]rvlKtorZ
authored
1912: Add shelley package to nightly windows tests r=rvl a=rvl ### Overview - Github actions steps need to be coded in yaml. - Shelley tests were not in the list of steps. - Fix local cluster setup for windows. 1973: do not migrate hardfork column as non-null r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> N/A # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [ ] I have adjusted the migration of the hardfork countdown column. # Comments <!-- Additional comments or screenshots to attach if any --> ``` 'hardfork_epoch'. Adding this field with a default value of NULL. SQLite3 returned ErrorError while attempting to perform prepare "ALTER TABLE protocol_parameters ADD COLUMN hardfork_epoch INTEGER NOT NULL DEFAULT NULL ;": Cannot add a NOT NULL column with default value NULL ``` <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> 1976: use dummy time interpreter in database benchmarks. r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> N/A # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [ ] I have used dummy time interpreter in database benchmarks. # Comments <!-- Additional comments or screenshots to attach if any --> Database benchmarks are now running fine for me locally. <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io> Co-authored-by: KtorZ <matthias.benkort@gmail.com>
4 parents a86120d + 70f7012 + 58bc883 + 4f32499 commit ca96c43

File tree

6 files changed

+40
-12
lines changed

6 files changed

+40
-12
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,21 @@ jobs:
2626
run: '.\\cardano-wallet-core-test-unit.exe --color'
2727
- name: 'cardano-wallet-byron:unit'
2828
run: '.\\cardano-wallet-byron-test-unit.exe --color'
29-
- name: 'cardano-wallet-byron:integration'
30-
run: '.\\cardano-wallet-byron-test-integration.exe --color'
31-
timeout-minutes: 60
29+
- name: 'cardano-wallet-shelley:unit'
30+
run: '.\\cardano-wallet-shelley-test-unit.exe --color'
3231
- name: 'cardano-wallet-cli:unit'
3332
run: '.\\cardano-wallet-cli-test-unit.exe --color'
3433
- name: 'text-class:unit'
3534
run: '.\\text-class-test-unit.exe --color'
3635
- name: 'cardano-wallet-launcher:unit'
3736
run: '.\\cardano-wallet-launcher-test-unit.exe --color'
3837
continue-on-error: true
38+
- name: 'cardano-wallet-shelley:integration'
39+
run: '.\\cardano-wallet-shelley-test-integration.exe --color'
40+
timeout-minutes: 60
41+
- name: 'cardano-wallet-byron:integration'
42+
run: '.\\cardano-wallet-byron-test-integration.exe --color'
43+
timeout-minutes: 60
3944
- name: 'cardano-wallet-jormungandr:unit'
4045
run: '.\\cardano-wallet-jormungandr-test-unit.exe --color'
4146
- name: 'cardano-wallet-jormungandr:integration'

lib/core/src/Cardano/Wallet/DB/Sqlite.hs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ migrateManually tr defaultFieldValues =
436436
--
437437
addActiveSlotCoefficientIfMissing :: Sqlite.Connection -> IO ()
438438
addActiveSlotCoefficientIfMissing conn =
439-
addColumn conn (DBField CheckpointActiveSlotCoeff) value
439+
addColumn conn True (DBField CheckpointActiveSlotCoeff) value
440440
where
441441
value = toText
442442
$ W.unActiveSlotCoefficient
@@ -447,7 +447,7 @@ migrateManually tr defaultFieldValues =
447447
--
448448
addDesiredPoolNumberIfMissing :: Sqlite.Connection -> IO ()
449449
addDesiredPoolNumberIfMissing conn = do
450-
addColumn conn (DBField ProtocolParametersDesiredNumberOfPools) value
450+
addColumn conn True (DBField ProtocolParametersDesiredNumberOfPools) value
451451
where
452452
value = T.pack $ show $ defaultDesiredNumberOfPool defaultFieldValues
453453

@@ -456,7 +456,7 @@ migrateManually tr defaultFieldValues =
456456
--
457457
addMinimumUTxOValueIfMissing :: Sqlite.Connection -> IO ()
458458
addMinimumUTxOValueIfMissing conn = do
459-
addColumn conn (DBField ProtocolParametersMinimumUtxoValue) value
459+
addColumn conn True (DBField ProtocolParametersMinimumUtxoValue) value
460460
where
461461
value = T.pack $ show $ W.getCoin $ defaultMinimumUTxOValue defaultFieldValues
462462

@@ -465,7 +465,7 @@ migrateManually tr defaultFieldValues =
465465
--
466466
addHardforkEpochIfMissing :: Sqlite.Connection -> IO ()
467467
addHardforkEpochIfMissing conn = do
468-
addColumn conn (DBField ProtocolParametersHardforkEpoch) value
468+
addColumn conn False (DBField ProtocolParametersHardforkEpoch) value
469469
where
470470
value = case defaultHardforkEpoch defaultFieldValues of
471471
Nothing -> "NULL"
@@ -499,10 +499,11 @@ migrateManually tr defaultFieldValues =
499499
-- it's a common use-case.
500500
addColumn
501501
:: Sqlite.Connection
502+
-> Bool
502503
-> DBField
503504
-> Text
504505
-> IO ()
505-
addColumn conn field value = do
506+
addColumn conn notNull field value = do
506507
isFieldPresent conn field >>= \case
507508
TableMissing ->
508509
traceWith tr $ MsgManualMigrationNotNeeded field
@@ -511,7 +512,8 @@ migrateManually tr defaultFieldValues =
511512
query <- Sqlite.prepare conn $ T.unwords
512513
[ "ALTER TABLE", tableName field
513514
, "ADD COLUMN", fieldName field
514-
, fieldType field, "NOT NULL", "DEFAULT", value
515+
, fieldType field, if notNull then "NOT NULL" else ""
516+
, "DEFAULT", value
515517
, ";"
516518
]
517519
_ <- Sqlite.step query

lib/core/test/bench/db/Main.hs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,23 @@ import Cardano.Wallet.Primitive.AddressDiscovery.Sequential
7373
)
7474
import Cardano.Wallet.Primitive.Model
7575
( Wallet, initWallet, unsafeInitWallet )
76+
import Cardano.Wallet.Primitive.Slotting
77+
( singleEraInterpreter )
7678
import Cardano.Wallet.Primitive.Types
7779
( ActiveSlotCoefficient (..)
80+
, ActiveSlotCoefficient (..)
7881
, Address (..)
7982
, BlockHeader (..)
8083
, Coin (..)
8184
, Direction (..)
85+
, EpochLength (..)
86+
, GenesisParameters (..)
8287
, Hash (..)
8388
, Range (..)
89+
, SlotLength (..)
8490
, SlotNo (..)
8591
, SortOrder (..)
92+
, StartTime (..)
8693
, TransactionInfo
8794
, Tx (..)
8895
, TxIn (..)
@@ -119,12 +126,16 @@ import Data.ByteString
119126
( ByteString )
120127
import Data.Functor
121128
( ($>) )
129+
import Data.Functor.Identity
130+
( Identity (..) )
122131
import Data.Maybe
123132
( fromMaybe )
124133
import Data.Proxy
125134
( Proxy (..) )
126135
import Data.Quantity
127136
( Quantity (..) )
137+
import Data.Time.Clock.POSIX
138+
( posixSecondsToUTCTime )
128139
import Data.Time.Clock.System
129140
( SystemTime (..), systemToUTCTime )
130141
import Data.Typeable
@@ -146,6 +157,7 @@ import System.IO.Unsafe
146157
import System.Random
147158
( mkStdGen, randoms )
148159

160+
import qualified Data.ByteString as BS
149161
import qualified Data.ByteString.Char8 as B8
150162
import qualified Data.Map.Strict as Map
151163

@@ -337,7 +349,14 @@ setupDB = do
337349
(ctx, db) <- newDBLayer nullTracer defaultFieldValues (Just f) ti
338350
pure (f, ctx, db)
339351
where
340-
ti = error "timeInterpreter" -- EpochLength 500 was used here.
352+
ti = pure . runIdentity . singleEraInterpreter (GenesisParameters
353+
{ getGenesisBlockHash = Hash $ BS.replicate 32 0
354+
, getGenesisBlockDate = StartTime $ posixSecondsToUTCTime 0
355+
, getSlotLength = SlotLength 1
356+
, getEpochLength = EpochLength 21600
357+
, getEpochStability = Quantity 108
358+
, getActiveSlotCoefficient = ActiveSlotCoefficient 1
359+
})
341360

342361
defaultFieldValues :: DefaultFieldValues
343362
defaultFieldValues = DefaultFieldValues

lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ withCluster
420420
withCluster tr severity poolConfigs dir onByron onFork onClusterStart =
421421
bracketTracer' tr "withCluster" $ do
422422
let poolCount = length poolConfigs
423-
systemStart <- addUTCTime 1 <$> getCurrentTime
424423
(port0:ports) <- randomUnusedTCPPorts (poolCount + 2)
424+
systemStart <- addUTCTime 1 <$> getCurrentTime
425425
let bftCfg = NodeParams severity systemStart (head $ rotate ports)
426426
withBFTNode tr dir bftCfg $ \bftSocket block0 params -> do
427427
let runningBftNode = RunningNode bftSocket block0 params

nix/windows-testing-bundle.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
, cardano-wallet-byron
1414
, cardano-wallet-shelley
1515
, cardano-node
16+
, cardano-cli
1617
, tests ? []
1718
, benchmarks ? []
1819
}:
@@ -44,7 +45,7 @@ in pkgs.runCommand name {
4445
cd jm
4546
4647
# Copy in wallet and node EXEs and DLLs.
47-
for pkg in ${cardano-wallet-jormungandr} ${cardano-wallet-byron} ${cardano-wallet-shelley}; do
48+
for pkg in ${cardano-wallet-jormungandr} ${cardano-wallet-byron} ${cardano-wallet-shelley} ${cardano-cli}; do
4849
cp -vf $pkg/bin/* .
4950
done
5051

release.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ let
237237
cardano-wallet-byron = winJobs.cardano-wallet-byron.x86_64-linux;
238238
cardano-wallet-shelley = winJobs.cardano-wallet-shelley.x86_64-linux;
239239
cardano-node = winJobs.cardano-node.x86_64-linux;
240+
cardano-cli = winJobs.cardano-cli.x86_64-linux;
240241
tests = collectTests winJobs.tests;
241242
benchmarks = collectTests winJobs.benchmarks;
242243
};

0 commit comments

Comments
 (0)