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

add standalone dbs and configs #1354

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

add standalone dbs and configs #1354

wants to merge 16 commits into from

Conversation

ceyonur
Copy link
Collaborator

@ceyonur ceyonur commented Sep 27, 2024

This pull request introduces significant changes to the plugin/evm package to support standalone databases, update configurations, and enhance testing. The most important changes include adding new database-related configurations, updating the VM struct and initialization process, and modifying tests to accommodate the new skipStandaloneDB flag.

Database Configuration Enhancements:

  • plugin/evm/config.go: Added new database-related configurations including UseStandaloneDatabase, DatabaseConfigContent, DatabaseConfigFile, DatabaseType, DatabasePath, and DatabaseReadOnly. Also added a new type PBool to handle optional boolean values. [1] [2] [3] [4]

VM Struct and Initialization Updates:

  • plugin/evm/vm.go: Updated the VM struct to include a skipStandaloneDB flag and chainAlias. Modified the Initialize method to handle standalone database initialization and metrics setup. Added new methods useStandaloneDatabase, getDatabaseConfig, initializeDBs, and createDatabase to support the new database configurations. [1] [2] [3] [4] [5]

By default VM uses a standalone database if there is no accepted block in AvalancheGo's provided database. use-standalone-database is nil by default, and can override the default behavior by taking false/true as value.

Test Updates:

  • plugin/evm/block_test.go, plugin/evm/syncervm_test.go, plugin/evm/tx_gossip_test.go, plugin/evm/vm_test.go: Updated various test cases to set the skipStandaloneDB flag to true to ensure tests run with the intended database configuration. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

These changes enhance the flexibility and configurability of the EVM plugin, allowing for more robust database management and testing.

How this was tested

Tested with DFK

How is this documented

Need to document in docs repo.

Some metrics running the LevelDB in DFK testnet with two similar spec machines:

image
image (1)
image (2)
image (3)

@ceyonur ceyonur marked this pull request as ready for review October 14, 2024 11:48
@ceyonur ceyonur requested review from darioush and a team as code owners October 14, 2024 11:48
plugin/evm/vm.go Outdated Show resolved Hide resolved
plugin/evm/vm.go Outdated Show resolved Hide resolved
plugin/evm/vm.go Outdated Show resolved Hide resolved
plugin/evm/vm.go Outdated Show resolved Hide resolved
darioush
darioush previously approved these changes Oct 15, 2024
plugin/evm/vm.go Outdated Show resolved Hide resolved
@ceyonur ceyonur enabled auto-merge (squash) October 15, 2024 21:03
// initialize the atomic memory
atomicMemory := atomic.NewMemory(prefixdb.New([]byte{0}, baseDB))
atomicMemory := atomic.NewMemory(prefixdb.New([]byte{0}, memdb.New()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this file could be reverted if preferred

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