-
Couldn't load subscription status.
- Fork 159
Move atomic state #709
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 atomic state #709
Conversation
Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Quentin McGaw <[email protected]> Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Quentin McGaw <[email protected]> Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Quentin McGaw <[email protected]> Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Quentin McGaw <[email protected]> Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Quentin McGaw <[email protected]> Signed-off-by: Ceyhun Onur <[email protected]>
…move-atomic-gossip
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.
mostly looks good, some minor comments
plugin/evm/vm.go
Outdated
| return tx, nil | ||
| } | ||
|
|
||
| func (vm *VM) PutLastAcceptedID(ID []byte) error { |
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.
👍
plugin/evm/syncervm_client.go
Outdated
|
|
||
| var stateSyncSummaryKey = []byte("stateSyncSummary") | ||
| type BlockAcceptor interface { | ||
| PutLastAcceptedID([]byte) error |
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.
nit: seems this interface should take ids.ID
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 did not want to convert it to ID from hash and then to byte for the updateVMMarkers, but yea this sounds weird as it is.
| // Prefixes for atomic trie | ||
| atomicTrieDBPrefix = []byte("atomicTrieDB") | ||
| atomicTrieMetaDBPrefix = []byte("atomicTrieMetaDB") |
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.
IMO it's somewhat more flexible to let the vm make the prefix and pass the prefixed DB to both the atomic backend and the syncer. We don't need to retain them as fields on the VM.
If you feel strongly that the prefixes should be moved it's fine, but so far the caller has been defining the prefixes.
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 think state files/packages should contain prefixes and create prefixdb. Or really the whoever going to use it can create the prefixdb. I can't deny having them in a single place helps to look up, inspect DBs but from the modularity POV it feels like they should be belong to whoever using. In this case we should definetly move them to atomic pkg as we plan to wrap the plugin/vm.go with atomic/vm.go (so no atomic stuff should be in plugin/vm.go)
Co-authored-by: Darioush Jalali <[email protected]> Signed-off-by: Ceyhun Onur <[email protected]>
Co-authored-by: Darioush Jalali <[email protected]> Signed-off-by: Ceyhun Onur <[email protected]>
|
|
||
| ## [v0.14.1](https://github.com/ava-labs/coreth/releases/tag/v0.14.1) | ||
| - Remove API eth_getAssetBalance that was used to query ANT balances (deprecated since v0.10.0) | ||
| - Remove legacy gossip handler and metrics (deprecated since v0.10.0) |
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.
Shouldn't this change be in its own PR (maybe before that PR)?
go.mod
Outdated
| require ( | ||
| github.com/VictoriaMetrics/fastcache v1.12.1 | ||
| github.com/ava-labs/avalanchego v1.12.1-0.20241209214115-1dc4192013aa | ||
| github.com/ava-labs/avalanchego v1.12.2-0.20241224181600-fade5be3051d |
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.
Why the bump?
plugin/evm/atomic/atomic_backend.go
Outdated
| // Prefixes for atomic trie | ||
| atomicTrieDBPrefix = []byte("atomicTrieDB") | ||
| atomicTrieMetaDBPrefix = []byte("atomicTrieMetaDB") |
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.
nit unneeded comment
| // Prefixes for atomic trie | |
| atomicTrieDBPrefix = []byte("atomicTrieDB") | |
| atomicTrieMetaDBPrefix = []byte("atomicTrieMetaDB") | |
| atomicTrieDBPrefix = []byte("atomicTrieDB") | |
| atomicTrieMetaDBPrefix = []byte("atomicTrieMetaDB") |
| commitInterval uint64 // commit interval, same as commitHeightInterval by default | ||
| metadataDB avalanchedatabase.Database // Underlying database containing the atomic trie metadata | ||
| trieDB *triedb.Database // Trie database | ||
| lastCommittedRoot common.Hash // trie root of the most recent commit | ||
| lastCommittedHeight uint64 // index height of the most recent commit | ||
| lastAcceptedRoot common.Hash // most recent trie root passed to accept trie or the root of the atomic trie on intialization. |
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.
Note for the future/new code (to myself as well 😄) - we should write comments above fields and not to the the right, otherwise gofmt causes unneeded git diffs on other fields as soon as a field name or type gets longer/shorter than the longest/smallest.
| @@ -1,7 +1,7 @@ | |||
| // (c) 2020-2021, Ava Labs, Inc. All rights reserved. | |||
| // (c) 2020-2025, Ava Labs, Inc. All rights reserved. | |||
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.
Should this be updated on other files? 🤔
I'm looking into copyright thingies in ava-labs/libevm#100 because right now it's a bit of headache to keep track of those years 😕
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 nits
Why this should be merged
Moves atomic state (repo, trie backend) to atomic pkg.
How this works
This pull request involves renaming files and updating package references to improve the organization and clarity of the codebase. The changes primarily focus on renaming the
plugin/evmpackage toplugin/atomicand updating relevant imports and type references accordingly.File Renaming and Package Updates:
plugin/evm/atomic_backend.gotoplugin/atomic/atomic_backend.goand updated the package declaration fromevmtoatomic.plugin/evm/atomic_state.gotoplugin/atomic/atomic_state.goand updated the package declaration fromevmtoatomic.plugin/evm/atomic_syncer.gotoplugin/atomic/atomic_syncer.goand updated the package declaration fromevmtoatomic.plugin/evm/atomic_syncer_test.gotoplugin/atomic/atomic_syncer_test.goand updated the package declaration fromevmtoatomic.plugin/evm/atomic_trie.gotoplugin/atomic/atomic_trie.goand updated the package declaration fromevmtoatomic.Import and Type Reference Updates:
evm/atomictoatomicinplugin/atomic/atomic_backend.go.atomic.TxtoTxinplugin/atomic/atomic_backend.go.atomic.TxtoTxinplugin/atomic/atomic_state.go.evm/atomictoatomicinplugin/atomic/atomic_trie.go[1] [2].evm/atomictoatomicinplugin/atomic/atomic_trie_iterator_test.go[1] [2].These changes ensure that the codebase is more organized and maintainable by clearly separating the
atomicfunctionality from theevmpackage.How this was tested
Existing tests should cover his
Need to be documented?
No
Need to update RELEASES.md?
No