-
Notifications
You must be signed in to change notification settings - Fork 729
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
Merkle-ize X-Chain State #3732
base: master
Are you sure you want to change the base?
Merkle-ize X-Chain State #3732
Conversation
eb872ad
to
f380ef8
Compare
f380ef8
to
411ba8a
Compare
5e741a1
to
409b2fe
Compare
9545412
to
daab96b
Compare
e89db38
to
20ae963
Compare
db6f8b7
to
0505956
Compare
040debc
to
de2d05b
Compare
daab96b
to
14cb603
Compare
de2d05b
to
15ad838
Compare
@@ -38,6 +39,21 @@ func New() *Database { | |||
return NewWithSize(DefaultSize) | |||
} | |||
|
|||
// Copy returns a Database with the same key-value pairs as db | |||
func Copy(db *Database) (*Database, 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.
We need this utility to be able to copy the memdb between VM instances, since closing a database makes it so that it's unusable afterwards.
@@ -38,7 +42,7 @@ var ( | |||
timestampKey = []byte{0x01} | |||
lastAcceptedKey = []byte{0x02} |
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.
This isn't needed as part of this PR, but we could change these from bytes to plain strings (i.e "is_initialized"
, "timestamp"
, etc). I don't think the overhead is an issue + it makes it much reason about when reading it in the debugger.
parser block.Parser | ||
db *versiondb.Database | ||
|
||
modifiedUTXOs map[ids.ID]*avax.UTXO // map of modified UTXOID -> *UTXO if the UTXO is nil, it has been removed | ||
utxoDB database.Database | ||
utxoState avax.UTXOState | ||
// TODO un-export databases post-migration |
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.
Another idea is to just make the calling code use NewWithFormat
instead of exporting these dbs
c5de960
to
7537516
Compare
4b94f56
to
c555608
Compare
s.blockIDDB.Close(), | ||
s.blockDB.Close(), | ||
s.UTXODB.Close(), | ||
s.UTXOIndexDB.Close(), |
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.
Previously the avax
package owned this db but it didn't close it... so this is a behavior change.
2ccddcf
to
7fdce1a
Compare
8955b58
to
a4d93f3
Compare
9e8a483
to
ea6e1ec
Compare
a4d93f3
to
9c49042
Compare
d9fd467
to
22b8d5a
Compare
Signed-off-by: Joshua Kim <[email protected]>
22b8d5a
to
795009d
Compare
Why this should be merged
Implements a database migration from the legacy database format into a database format that supports a merkle-ized prefix of state
How this works
Changes db schema
How this was tested
Added a migration unit test + tested state migration on Fuji
Need to be documented in RELEASES.md?
Yes