Skip to content

Validate ChainStore tip on load#600

Merged
quantumagi merged 5 commits intostratisproject:masterfrom
quantumagi:fixchainstore
Jul 23, 2021
Merged

Validate ChainStore tip on load#600
quantumagi merged 5 commits intostratisproject:masterfrom
quantumagi:fixchainstore

Conversation

@quantumagi
Copy link
Contributor

@quantumagi quantumagi commented Jul 5, 2021

See https://app.clickup.com/t/46vgx6.

The ChainStore consists of two tables which could conceivably go out of whack due to the fact that these tables are individually updated (i.e. non-atomically). This PR adds a check to LoadAsync to ensure that the tip of the chain table corresponds to an available header in the headers table.

@quantumagi quantumagi requested a review from fassadlr July 5, 2021 07:54
@quantumagi
Copy link
Contributor Author

quantumagi commented Jul 5, 2021

@francois, (1) during LoadAsync we're only loading the chain, I assume with the assumption that the headers table would be aligned with it. This PR is verifying that assumption due to the mentioned "atomicity" concerns. (2) whenever we create a ChainedHeader we are adding the corresponding block header to the chain store's headers table. However there is one constructor that is not doing that and that is the one used by (1).

After this PR we should be able to claim that the header "should" always be present in the database after the ChainedHeader constructor had been called, as there would be no way to construct a ChainedHeader without the block header also being present or recorded in the database.

This is not necessarily a solution to the observed issue but it will eliminate or help identify a possible point of failure.

@fassadlr
Copy link
Contributor

fassadlr commented Jul 5, 2021

@fassadlr
Copy link
Contributor

@quantumagi please comfirm whether you have at least done a full sync with StraxMain and partially synced CirrusMain?

@quantumagi
Copy link
Contributor Author

quantumagi commented Jul 22, 2021

StraxMain synced:

image

@quantumagi quantumagi merged commit 5ee29e6 into stratisproject:master Jul 23, 2021
fassadlr pushed a commit that referenced this pull request Aug 23, 2021
* Validate ChainStore tip on load

* Change comment

* Update tests

* Dispose IChainStore

* Bump version
fassadlr added a commit that referenced this pull request Aug 31, 2021
* Better collateral address checking (#670)

* Add collateral address check to GetModifiedFederation (#671)

* Remove logging from federation build logic

* Update all versions to 1.0.9.3

* Add null check in IdleMemberKicker (#673)

* Add null check in IdleMemberKicker

* Update IdleFederationMembersKicker.cs

* Bump version

* Add null check in IdleMemberKicker (#673) (#674)

* Add null check in IdleMemberKicker

* Update IdleFederationMembersKicker.cs

* Update all project versions to 1.0.9.4

* Bump SC versions

* Validate ChainStore tip on load (#600)

* Validate ChainStore tip on load

* Change comment

* Update tests

* Dispose IChainStore

* Bump version

* CirrusMain checkpoint 2_827_550 (#680)

* Bump version to 1.0.9.5

* Merge Disable signature rule in IBD #579 from release/1.1.0.0

Co-authored-by: quantumagi <someguy.fromafrica@gmail.com>
fassadlr added a commit that referenced this pull request Aug 31, 2021
* Better collateral address checking (#670)

* Add collateral address check to GetModifiedFederation (#671)

* Remove logging from federation build logic

* Update all versions to 1.0.9.3

* Add null check in IdleMemberKicker (#673)

* Add null check in IdleMemberKicker

* Update IdleFederationMembersKicker.cs

* Bump version

* Add null check in IdleMemberKicker (#673) (#674)

* Add null check in IdleMemberKicker

* Update IdleFederationMembersKicker.cs

* Update all project versions to 1.0.9.4

* Bump SC versions

* Validate ChainStore tip on load (#600)

* Validate ChainStore tip on load

* Change comment

* Update tests

* Dispose IChainStore

* Bump version

* CirrusMain checkpoint 2_827_550 (#680)

* Bump version to 1.0.9.5

* Merge Disable signature rule in IBD #579 from release/1.1.0.0

* UI SignalR improvements / Move UI notification outside of loop blocks (#686)

Co-authored-by: quantumagi <someguy.fromafrica@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants