Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

(Feature) Safe owners not loaded#1710

Merged
dasanra merged 13 commits intodevelopmentfrom
feature/safe-owners-not-loaded
Dec 12, 2020
Merged

(Feature) Safe owners not loaded#1710
dasanra merged 13 commits intodevelopmentfrom
feature/safe-owners-not-loaded

Conversation

@Agupane
Copy link
Contributor

@Agupane Agupane commented Dec 10, 2020

Closes #1685 by:

  • Returning a boolean from useLoadSafe to know if the safe was loaded or not and using that to avoid scheduling safe update before it is loaded, that caused a race condition between useSafeScheduledUpdates and useLoadSafe that "removed" the owners

@Agupane Agupane self-assigned this Dec 10, 2020
@Agupane Agupane requested a review from fernandomg December 10, 2020 14:17
@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Dec 10, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

Copy link
Contributor

@fernandomg fernandomg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the exhaustive-deps warning?

dispatch(fetchTransactions(safeAddress))
return dispatch(addViewedSafe(safeAddress))
dispatch(addViewedSafe(safeAddress))
setSafeLoaded(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Agupane, help me understand this.

How I see it is:

dispatch(fetchLatestsMasterContractVersion())
  // here we're waiting for `fetchLatestsMasterContractVersion` to resolve
  .then(() => {
     // after the previous promise resolution we dispatch two different actions
     dispatch(fetchSafe(safeAddress)) // !!! - I understand this as the most important
     return dispatch(fetchSafeTokens(safeAddress))
  })
  // we wait for `fetchSafeTokens` action to resolve
  .then(() => {
    /*
      ...
    */
    setSafeLoaded(true) // !!! - basically, we're waiting for `fetchSafeTokens` to resolve to switch the flag
    return
  })

How I see it (and how I understand it), we may face a race condition if fetchSafe takes too long to resolve.

Isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I investigated yes but it's not always simple to get that status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the code to be sure that fetchSafe is executed in order to update the flag, seems that the problem is with multiple redux actions executing at the same time, at least at know, is the best solution I found

@Agupane
Copy link
Contributor Author

Agupane commented Dec 10, 2020

Can you fix the exhaustive-deps warning?

fixed thanks

@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

@fernandomg fernandomg self-requested a review December 10, 2020 20:20
@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Dec 10, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

@ghost
Copy link

ghost commented Dec 11, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Dec 11, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

@francovenica
Copy link
Contributor

Tried to load a few different safes and check the "read only" mode doesn't stay for long
Checked that the owners would list properly every time
Checked that the policies show "X out of Y" owners properly. (Sometimes X could be a NaN or 0)

Looks good to me. I'll recheck this with the regression

@ghost
Copy link

ghost commented Dec 11, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Dec 11, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

@ghost
Copy link

ghost commented Dec 11, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/rinkeby/app

@ghost
Copy link

ghost commented Dec 11, 2020

Travis automatic deployment:
https://pr1710--safereact.review.gnosisdev.com/volta/app

@dasanra dasanra merged commit 0f59211 into development Dec 12, 2020
@dasanra dasanra deleted the feature/safe-owners-not-loaded branch December 12, 2020 13:39
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Safe in read-only mode even though correct owner is connected

5 participants