Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ledger): backward merkle root chaining bugs (#347)
## bug fixes Previously, backwards merkle root chaining checks were: - ignoring the actual result of the check - always marked it as a duplicate (as if the check failed) - always returned true (as if the check succeeded) - comparing chained root to chained root, which is wrong. it should be chained to actual root ## refactoring consolidate common chaining logic into single function "checkAndReportChaining" Improve dependency management by: - organizing merkle root check functions into a struct since they all share some common dependencies. this simplifies the function signatures and keeps things standardized and consistent - utilizing working stores. - this is better than passing down the granular transitive dependencies (database and hashmap) separately because it clarifies what this code actually needs. all it really needs is some kind of store for erasure metas. it's not actually important in this context that it's managed through a negotiation between database and hashmap calls. this is the whole point of the pending state, to abstract away that negotiation. passing down all the transitive dependencies makes the function parameters a mess, and it becomes unclear why the code actually needs any of the dependencies. - this is better than passing down the whole pending state struct because it reduces the number of dependencies and it clarifies what is actually needed, rather than pretending the entire state is needed. ## change in behavior merkle root checks now return an error if the merkle root is missing, instead of ignoring it, because that means there is a severe bug in the validator and it needs to be shutdown and patched immediately.
- Loading branch information