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

optimize and security audit the market health function #5

Closed
2 tasks done
Ivshti opened this issue Mar 13, 2019 · 2 comments
Closed
2 tasks done

optimize and security audit the market health function #5

Ivshti opened this issue Mar 13, 2019 · 2 comments
Assignees
Milestone

Comments

@Ivshti
Copy link
Member

Ivshti commented Mar 13, 2019

  1. perform a detailed (security focused) review on the market health functions and it's tests - @samparsky and @elpiel - you should each do that
  2. rewrite it in rust in a more efficient way and use that in the Supermarket - @elpiel you should do that

it can be optimized by:

  • not querying the validators if not needed (e.g. channel is expired)
  • by using the heartbeats returned in last-approved
  • only retrieving latest NewState/RejectState individually when the ones in last-approved are not recent (to distinct between Invalid and just not having a new New/Approve pair)

In terms of types, this can be represented much more cleanly as an enum of:

  • Initializing
  • Waiting
  • Active
  • Finalized - should contain another enum containing { Expired, Exhausted }
  • Unsound - should contain another enum with a struct { disconnected, offline, rejectedState, unhealthy } - where all of those are booleans

This will be implemented in the supermarket first, then the logic should be backported to the JS implementation - we'll figure out how to translate the type considering JS does not have sum types

@Ivshti Ivshti pinned this issue May 25, 2019
@Ivshti Ivshti added this to the v1.0 milestone May 26, 2019
@simzzz simzzz unpinned this issue Jul 3, 2019
@simzzz simzzz pinned this issue Jul 3, 2019
@Ivshti Ivshti self-assigned this Oct 23, 2019
@Ivshti Ivshti changed the title review and security audit the market health function optimize and security audit the market health function Oct 23, 2019
@Ivshti Ivshti modified the milestones: v1.0, v1.1 Oct 23, 2019
@Ivshti Ivshti assigned elpiel and samparsky and unassigned Ivshti and ivopaunov Mar 30, 2020
@elpiel
Copy link
Member

elpiel commented Apr 7, 2020

As we've discussed with @Ivshti some of the missing statuses, we now have:

#[derive(Debug)]
pub enum Status {
    // Active and Ready combined
    Active,
    Pending,
    Initializing,
    Waiting,
    Finalized(Finalized),
    Unsound {
        disconnected: bool,
        offline: bool,
        rejected_state: bool,
        unhealthy: bool,
    },
}

#[derive(Debug)]
pub enum Finalized {
    Expired,
    Exhausted,
    Withdraw,
}

@elpiel
Copy link
Member

elpiel commented Jul 14, 2020

get_status in Supermarket (https://github.com/AdExNetwork/adex-supermarket/blob/d323869806f1705e92fe46e173e5a13e8e8c73c4/src/status.rs#L234-L290) was implemented and tested, while secure auditing the JS impl in the process

@Ivshti Ivshti unpinned this issue Mar 10, 2021
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

No branches or pull requests

4 participants