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

Prevent activating an already activated loans market #1066

Closed
daniel-savu opened this issue May 23, 2023 · 1 comment · Fixed by #1095
Closed

Prevent activating an already activated loans market #1066

daniel-savu opened this issue May 23, 2023 · 1 comment · Fixed by #1095
Assignees
Labels
bug Something isn't working
Milestone

Comments

@daniel-savu
Copy link
Contributor

The activate_market extrinsic should fail if the market is already active, so as not to re-emit the ActivatedMarket event.

@daniel-savu daniel-savu added the bug Something isn't working label May 23, 2023
@daniel-savu daniel-savu added this to the Lend / Borrow milestone May 23, 2023
@nakul1010 nakul1010 self-assigned this Jun 19, 2023
@nakul1010
Copy link
Member

nakul1010 commented Jun 19, 2023

Solutions

Solution 1: Add an is_active flag when updating mutate_market

Pros:

  • Allows updating the mutate_market function to include an is_active flag.
  • Only emits an event if the flag is not set, reducing unnecessary event emissions.

Cons:

  • If additional conditions need to be checked in the future, adding more flags can cause issues and make the code more complex.

Solution 2: Add the check_market_state_before_activating function

Pros:

  • Introduces a separate function, check_market_state_before_activating, to ensure all necessary checks are performed before updating the market.

Cons:

  • Time complexity increases

Solution 3: Update mutate_market to accept result

Pros:

  • Time complexity remains the same as that of the existing solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants