-
Notifications
You must be signed in to change notification settings - Fork 19
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
Automatically choose next validator from propose queue #40
base: master
Are you sure you want to change the base?
Conversation
@@ -68,6 +73,42 @@ const mainCtrl = (st, effects) => { | |||
st.update(s => ({...s, nets, sel, devMode: enabled})) | |||
} | |||
|
|||
const FetchNextValidator = async () => { |
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.
UI controls should not have direct dependency to http requests so this functions should be in rnode-web.js
file and imported together with other effects.
@@ -13,6 +13,8 @@ export const selectorCtrl = (st, {nets, onDevMode}) => { | |||
const onSelIdx = ev => { | |||
const sel = findValidatorByIndex(ev.target.selectedIndex) | |||
const read = sel.name === valNode.name ? readNode : findReadOnlyByIndex(0, sel.name) | |||
const isMainnet = sel.name === 'mainnet' | |||
sel.name !== valNode.name ? onAutoSelectToggle({disabled: !isMainnet}) : undefined |
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 is not assignment so no need to explicitly set undefined value.
sel.name !== valNode.name && onAutoSelectToggle({disabled: !isMainnet})
@@ -146,6 +188,7 @@ const initialState = { | |||
wallet: [], // [{name: 'My REV account', ...newRevAddress()}], | |||
// Dev mode (show local networks) | |||
devMode, | |||
autoSelectDisabled: autoSelectDisabled |
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.
Please use autoSelect
as a positive meaning of the boolean field with the default false
as disabled.
This PR makes it so that deploys get into a block faster (within 1 minutes rather than 15 minutes) by automatically choosing one of the next two validators from the propose queue by using this API https://status.rchain.coop/api/validators. Finalization still takes quite a bit of time so improvement may not be significant.
All that is required from the user is to switch to mainnet. Switching back to any other network pauses the autoselector.
When mainnet is enabled, Transfer and Deploy buttons are disabled during the first fetch, so that user doesn't use a manually selected node.
For convenience there is a checkbox to manually disable this behavior too.