-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move delegation certificate declaration in a separate table #980
Conversation
This is because certificates are affected by rollbacks and need to be associate to a given slot, unlike other static metadata of a wallet
-> Hash "Tx" | ||
-> ExceptT ErrRemovePendingTx m () | ||
-- ^ Remove a pending transaction. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just moved up next to other calls related to txs.
toJSON = String . toText | ||
|
||
instance FromJSON PoolId where | ||
parseJSON = aesonFromText "PoolId" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷♂️ I still don't understand why persistent requires this for field involved in a PrimaryKey. This is non-sense.
@@ -506,7 +507,11 @@ instance Eq XPrv where | |||
|
|||
instance Arbitrary (Hash purpose) where | |||
arbitrary = do | |||
Hash . convertToBase Base16 . BS.pack <$> vectorOf 32 arbitrary | |||
Hash . convertToBase Base16 . BS.pack <$> vectorOf 16 arbitrary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generate only 16
initial bytes here since the conversion to Base16
will double the underlying size. It doesn't matter much but it gives nicer QC failures with shorter ids.
@@ -359,6 +360,9 @@ newDBLayer logConfig trace mDatabaseFile = do | |||
deleteCheckpoints wid | |||
[ CheckpointSlot >. point | |||
] | |||
deleteDelegationCertificates wid | |||
[ CertSlot >. point |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bors r+ |
975: Fix bench-db on windows r=KtorZ a=rvl Relates to #703. # Overview The database benchmark was failing with: ``` cardano-wallet-core-2019.11.6-bench-db.exe: C:\users\rodney\Temp\benf0f5.db: DeleteFile "\\\\?\\C:\\users\\rodney\\Temp\\benf0f5.db": permission denied (Sharing violation.) ``` And: ``` db.exe: <stdout>: commitBuffer: invalid argument (Invalid argument) ``` It works on windows but not under wine (encoding problem). 980: Move delegation certificate declaration in a separate table r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> #913 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have moved tracking of delegation "certificate" into a separate SQLite table - [x] I have adjusted `readWalletMetadata` to now pull the delegation status from the right table - [x] I have added a `putDelegationCertificate` function to insert a new row in the database when new certificates are discovered - [x] I have extended the state-machine tests accordingly, with proper tagging # Comments <!-- Additional comments or screenshots to attach if any --> ``` Cardano.Wallet.DB.Sqlite Sqlite State machine tests Sequential +++ OK, passed 400 tests: 65.8% UnsuccessfulReadTxHistory 57.8% SuccessfulReadCheckpoint 57.2% CreateThenList 55.0% TxUnsortedInputs 54.8% TxUnsortedOutputs 49.0% CreateWalletTwice 32.5% ReadTxHistoryAfterDelete 28.5% PutCheckpointTwice 27.8% UnsuccessfulReadCheckpoint 24.8% ReadMetaAfterPutCert 22.5% CreateThreeWallets 18.5% RemovePendingTxTwice 17.5% RolledBackOnce 14.2% SuccessfulReadPrivateKey 13.2% SuccessfulReadTxHistory 12.0% RemoveWalletTwice Parallel # PENDING: No reason given Sqlite State machine (RndState) Sequential state machine tests +++ OK, passed 400 tests: 65.8% UnsuccessfulReadTxHistory 57.8% SuccessfulReadCheckpoint 57.2% CreateThenList 55.0% TxUnsortedInputs 54.8% TxUnsortedOutputs 49.0% CreateWalletTwice 32.5% ReadTxHistoryAfterDelete 28.5% PutCheckpointTwice 27.8% UnsuccessfulReadCheckpoint 24.8% ReadMetaAfterPutCert 22.5% CreateThreeWallets 18.5% RemovePendingTxTwice 17.5% RolledBackOnce 14.2% SuccessfulReadPrivateKey 13.2% SuccessfulReadTxHistory 12.0% RemoveWalletTwice ``` <!-- 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 ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Rodney Lorrimar <[email protected]> Co-authored-by: KtorZ <[email protected]>
Build succeeded |
Issue Number
#913
Overview
readWalletMetadata
to now pull the delegation status from the right tableputDelegationCertificate
function to insert a new row in the database when new certificates are discoveredComments