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

bug: governance and unbonding fixes #1044

Merged
merged 4 commits into from
Aug 29, 2024

Conversation

mateuszjasiuk
Copy link
Collaborator

@mateuszjasiuk mateuszjasiuk commented Aug 23, 2024

  • fixed epoch estimations
  • fix for vote button - now disabled if address did not have active bonds before proposal stared
  • added polling for proposal view after sending vote tx
  • small changes due to using new indexer client generation library

Test it with 0.43.0 and this indexer

@mateuszjasiuk mateuszjasiuk force-pushed the bug/governance-and-unbonding-fixes branch 2 times, most recently from 68e8fa9 to f4e5002 Compare August 23, 2024 10:41
@mateuszjasiuk mateuszjasiuk changed the title Bug/governance and unbonding fixes bug: governance and unbonding fixes Aug 23, 2024
export const lastBlockHeightAtom = atom(
(get) => get(controlRoutineAtom).shouldUpdateAmount,
(get) => get(controlRoutineAtom).lastBlockHeight,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually not sure if this is correct, just seemed wrong :D

Copy link
Collaborator

@jurevans jurevans left a comment

Choose a reason for hiding this comment

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

Code LGTM! I'm having a hard time testing atm, but everything looks in order!

Copy link
Collaborator

@emccorson emccorson left a comment

Choose a reason for hiding this comment

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

Looks good to me! I am just waiting for my proposal to become active on the testnet in order to test this.

@@ -257,16 +258,16 @@ const fromIndexerStatus = (

const toIndexerStatus = (
proposalStatus: ProposalStatus
): IndexerProposalStatusEnum => {
): ApiIndexerProposalStatusEnum => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this change do? It looks we are using ProposalStatusEnum in some cases but ApiV1GovProposalGetStatusEnum in others and I'm not sure what the difference is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So there are two enums specified in swagger file. One is for status used in query params and other is used as a part of proposal response type. I think they should always be the same(kind of), but in rust we have two, because query params and response are two separate things.
FIrst:

        status:
          type: string
          enum: [pending, voting, passed, rejected]

Second:

          schema:
            type: string
            enum: [pending, votingPeriod, passed, rejected]

It's a bit confusing :D We can potentially leave two enums in rust but have only one described in swagger 🤔

queryFn: async () => {
const all_bonds = await api.apiV1PosBondAddressGet(account.data!.address);
return {
queryKey: ["can-vote"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not introduced in this PR, but queryKey is missing the dependencies (definitely account and I think possibly api too), so this doesn't react when the default account is changed in the extension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cool! I will fix that

@@ -19,4 +21,27 @@ export const useTransactionCallback = (): void => {
useTransactionEventListener("Bond.Success", onBalanceUpdate);
useTransactionEventListener("Unbond.Success", onBalanceUpdate);
useTransactionEventListener("Withdraw.Success", onBalanceUpdate);

const store = createStore();
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be better to use getDefaultStore here in case you get the same problems as in #1007.

const { refetch: refetchProposalFamily } = store.get(
proposalFamily(proposalId)
);
refetchProposalFamily();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to double check: Is this needed because setting refetchInterval on the atom will mean we need to wait 1 second before the first refetch?

Copy link
Collaborator Author

@mateuszjasiuk mateuszjasiuk Aug 27, 2024

Choose a reason for hiding this comment

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

Hmm I kind of copied it mindlessly from the example above :D but I think you are right. I think in this case we can just remove it, there is no chance we get proposal status right away. I will double check this
EDIT: removed!

Copy link
Collaborator

@emccorson emccorson left a comment

Choose a reason for hiding this comment

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

I just finished testing now that my proposal is live. The voting seems to work well and the times look good, but Namadillo seems to get stuck polling for the proposal data forever even after I refresh. I'm not sure exactly where that's happening though.

@emccorson emccorson self-requested a review August 28, 2024 12:27
@mateuszjasiuk mateuszjasiuk force-pushed the bug/governance-and-unbonding-fixes branch from 89eacfd to 7b11581 Compare August 29, 2024 08:15
@mateuszjasiuk mateuszjasiuk merged commit 976fe32 into main Aug 29, 2024
8 checks passed
@mateuszjasiuk mateuszjasiuk deleted the bug/governance-and-unbonding-fixes branch September 13, 2024 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants