Skip to content
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

Ensure EVM database integrity and consistency with DVM database #2783

Merged
merged 18 commits into from
Jan 24, 2024

Conversation

sieniven
Copy link
Member

@sieniven sieniven commented Jan 17, 2024

Summary

This PR fixes issues that cause database integrity issues on the EVM side, resulting in a corrupted rocksdb.

  1. ADD EVM db flush in DVM's FlushStateToDisk pipeline to keep EVM and DVM DB flushes as consistent as possible.
  2. Expose EVM db flush on FFI.
  3. Propagate errors on EVM services shutdown pipeline correctly and do not panic the node on failed DB flush.
  4. Add pipeline in init to check for DVM and EVM database state inconsistencies. If state inconsistency is present, the startup pipeline will trigger re-indexing pipeline.
  5. Propagate errors on RPC servers shutdown pipeline correctly instead of panicking the node. Previous pipeline panics the node early which prevents rocksdb from properly flushing in-memory buffer on shutdown, causing db corruption on subsequent startups.
  6. Propagate errors from RPC servers correctly and set initialization failure instead of panicking the node on start up.

Implications

  • Storage

    • Database reindex required
    • Database reindex optional
    • Database reindex not required
    • None
  • Consensus

    • Network upgrade required
    • Includes backward compatible changes
    • Includes consensus workarounds
    • Includes consensus refactors
    • None

@sieniven sieniven changed the title EVM: Database integrity fixes EVM: Ensure Database integrity Jan 17, 2024
@sieniven sieniven changed the title EVM: Ensure Database integrity EVM: Ensure database integrity Jan 17, 2024
@sieniven sieniven changed the title EVM: Ensure database integrity Ensure EVM database integrity and consistency with DVM database Jan 17, 2024
src/init.cpp Show resolved Hide resolved
Bushstar
Bushstar previously approved these changes Jan 22, 2024
lib/ain-evm/src/evm.rs Outdated Show resolved Hide resolved
Jouzo
Jouzo previously approved these changes Jan 22, 2024
@sieniven sieniven dismissed stale reviews from Jouzo and Bushstar via c86861f January 24, 2024 07:59
@sieniven
Copy link
Member Author

EVM db flush is shifted out of every tip change on the rust side with commit c86861f. Instead, the EVM db flush is now exposed on the FFI, and is called in the same pipeline on the DVM side to keep the DVM and EVM databases consistent in FlushStateToDisk.

@Bushstar Bushstar merged commit 7954cf8 into master Jan 24, 2024
15 of 16 checks passed
@Bushstar Bushstar deleted the niven/db-integrity branch January 24, 2024 09:56
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.

3 participants