-
Notifications
You must be signed in to change notification settings - Fork 6
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
added remove code leaf builin func name #267
base: feat/remove-code-leaf
Are you sure you want to change the base?
Changes from all commits
9059d2b
f388af8
39b55d1
5fa7b56
9e19668
bec3579
bac3dac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ const ( | |
|
||
// AutoBalanceEnabled is used for data tries, and only after the activation of AutoBalanceDataTriesEnableEpoch flag | ||
AutoBalanceEnabled | ||
|
||
// WithoutCodeLeaf is used for account with code, it specifies that the trie code leaf has been moved to storage, | ||
// it is enabled only after the activation of MigrateCodeLeafEnableEpoch flag | ||
WithoutCodeLeaf | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all nodes with version "without code leaf" are assumed to be also with auto balance enabled right? Just to confirm, it would not be possible to move from NotSpecified directly to WithoutCodeLeaf right? Also would this version change affect the logic for auto balancing since the version will be different but auto balancing will still need to be done? (I am asking here if there are checks in the code for the specific AutoBalanceEnabled version) |
||
) | ||
|
||
const ( | ||
|
@@ -24,7 +28,11 @@ const ( | |
// AutoBalanceEnabledString is the string representation of AutoBalanceEnabled trie node version | ||
AutoBalanceEnabledString = "auto balanced" | ||
|
||
// WithoutCodeLeafString is the string representation of WithoutCodeLeaf trie node version | ||
WithoutCodeLeafString = "without code leaf" | ||
|
||
autoBalanceDataTriesFlag = EnableEpochFlag("AutoBalanceDataTriesFlag") | ||
migrateCodeLeafFlag = EnableEpochFlag("MigrateCodeLeafFlag") | ||
) | ||
|
||
func (version TrieNodeVersion) String() string { | ||
|
@@ -33,6 +41,8 @@ func (version TrieNodeVersion) String() string { | |
return NotSpecifiedString | ||
case AutoBalanceEnabled: | ||
return AutoBalanceEnabledString | ||
case WithoutCodeLeaf: | ||
return WithoutCodeLeafString | ||
default: | ||
return "unknown: " + strconv.Itoa(int(version)) | ||
} | ||
|
@@ -59,6 +69,9 @@ func NewTrieNodeVersionVerifier(enableEpochsHandler EnableEpochsHandler) (*trieN | |
|
||
// IsValidVersion returns true if the given trie node version is valid | ||
func (vv *trieNodeVersionVerifier) IsValidVersion(version TrieNodeVersion) bool { | ||
if vv.enableEpochsHandler.IsFlagEnabled(migrateCodeLeafFlag) { | ||
return version <= WithoutCodeLeaf | ||
} | ||
if vv.enableEpochsHandler.IsFlagEnabled(autoBalanceDataTriesFlag) { | ||
return version <= AutoBalanceEnabled | ||
} | ||
|
@@ -73,6 +86,9 @@ func (vv *trieNodeVersionVerifier) IsInterfaceNil() bool { | |
|
||
// GetVersionForNewData returns the trie node version that should be used for new data | ||
func GetVersionForNewData(handler EnableEpochsHandler) TrieNodeVersion { | ||
if handler.IsFlagEnabled(migrateCodeLeafFlag) { | ||
return WithoutCodeLeaf | ||
} | ||
if handler.IsFlagEnabled(autoBalanceDataTriesFlag) { | ||
return AutoBalanceEnabled | ||
} | ||
|
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.
can we target the branch towards a feat branch?
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.
done