Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TheoXD
Copy link

@TheoXD TheoXD commented Aug 19, 2022

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.

@@ -68,6 +73,42 @@ const mainCtrl = (st, effects) => {
st.update(s => ({...s, nets, sel, devMode: enabled}))
}

const FetchNextValidator = async () => {
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

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.

@tgrospic tgrospic added the enhancement New feature or request label Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants