-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: support switch backend binaries by height #713
feat: support switch backend binaries by height #713
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
d2d3ec7
to
f998684
Compare
Running integration testWorkflow Run Id: 2426636431 Components:
Manually running integration testPost a comment contains
Note:
Run Resultfailure Run Resultfailure |
self.backend_switches | ||
.iter() | ||
.rev() | ||
.find(|(height, _)| block_number >= *height) |
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.
Binary search could be used to improve performance if the number of switches is high.
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.
Right, but since the chain is keep growing, the later version of backend has more possibility to be selected.
This PR support upgrade backend binaries by height.
Now, instead of define
backends
in theconfig.toml
we definebackend_switch
:switch_height
means in which height we use the new version of backend. For example:To upgrade godwoken config file, we should move all the
backends
fields into a backend switch clause such as:BackendSwitchConfig {switch_height: 0, backends}
, when we need to upgrade a backend, we define a new backend switch item follows the original one such as:BackendSwitchConfig {switch_height: 1000, backends: <new SUDT backend>}
. Then when the tip block arrives the 1000 height, the new SUDT backend will be loaded instead the old one, the other backends are not change.This change affects the following API:
https://github.com/nervosnetwork/godwoken/blob/develop/docs/RPC.md#method-gw_get_node_info
Consider mostly use-case of this API is to use the
validator_script_type_hash
field of a backend, I think we can only returns backends at 0 height for now.