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

Define the interfaces for all the functions in Facilitator. #3

Closed
8 tasks
deepesh-kn opened this issue May 29, 2019 · 0 comments
Closed
8 tasks

Define the interfaces for all the functions in Facilitator. #3

deepesh-kn opened this issue May 29, 2019 · 0 comments

Comments

@deepesh-kn
Copy link
Contributor

deepesh-kn commented May 29, 2019

Facilitator.ts is the main file that is responsible for the facilitation

  • This creates new child-process like block scanner, worker, etc
  • This reads the callback from all the child-process and performs required actions.
  • For details check the epic Facilitator  #1

This ticket is about defining the interfaces of all the functions in the Facilitator.

The proposed functions are provided for reference.
The implementer can think this in detail and can add/remove functions.

  • constructor

    • Accepts mosaic-config and facilitator-config as params.
    • Creates Config object. (store in variable)
    • Creates DB object. (store in variable)
    • Call function to start event scanner child-process. (store in variable)
    • Call function to resume facilitation.
  • function to validate gateways.

    • Once an event is received, check if the gateway contract address is suported by the facilitator.
    • Get the gateway contract address from the config to validate it.
  • function to start the event scanner child-process.

    • Start a new child-process for Scanner.ts (store in a variable)
    • Implement the call backs
  • function to resume facilitation.

    • Get any pending or failed facilitation from DB.
    • loop through the items and call function to start the worker child-process (Store in a variable).
  • function to start the worker child-process.

    • This will get an identifier as a param. This identifier is the primary id in DB.
    • Start a new child-process for Worker.ts (store in a variable)
    • Implement the callbacks
    • Get worker addresses for both chains
    • If worker addresses are available then update the entity in the DB with the process id and worker addresses, send the params to child-process to start facilitation, else log error.
  • function to select worker address for chains.

    • Get the last worker address used for the chain from the DB.
    • Get all the workers from the Config.
    • Select the next worker in round-robin
    • Validate if the worker addresses have Eth/Base token to perform transactions.
    • If validated then return the worker address else select other worker address.
    • If no worker available throw exception. (or return undefined)
  • function to determine if gasPrice / gasLimit is sufficient to perform facilitations.

  • function to handle SIGTERM

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

1 participant