harmony-one / bounties

Bounty program is to help the community take part in the development of the Harmony blockchain. It covers from core feature to validator tooling, from dApp development to DeFi integration.
MIT License
59 stars 23 forks source link

Create AWS Cloudwatch Synthetics Canary scripts for testing RPC endpoints #57

Closed givp closed 3 years ago

givp commented 3 years ago

Description

Create AWS Cloudwatch Synthetics Canary scripts for every RPC method and workflow. See UI example here. This bounty only requires the creation of the syn-nodejs-puppeteer scripts.

Context

To continuously monitor the health of the Harmony API endpoints, we need a set of syn-nodejs-puppeteer synthetics scripts to issue requests to the endpoints and analyze the response to ensure the data and schema structure is correct. As well as creating individual tests for individual methods, some endpoints will require multiple requests. Such as creating a transaction, then looking up that new transaction info through a subsequent request.

Acceptance Criteria

Reward

$500 in ONE tokens

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 8182.7617 ONE (503.96 USD @ $0.06/ONE) attached to it.

Zerquix18 commented 3 years ago

Hello, I did some research on this and I feel confident that I can do it. I'd like to confirm that my approach is the right one:

I had a first successful test deploying the Canary with the AWS CDK and the nodejs script. I'm thinking about generating all the templates from an array that specifies the method, params, and result, ​this would be a CDK stack, easy to deploy, change and destroy.

I'm asking because the notes only ask for the final scripts, which I can ultimately provide, but I think this approach could be faster and easier to modify later.


With regards to the bounty, it seems like the price of the ONE token has dropped since the issue was posted. Is this still 8182.7617 ONE? Or will it be adjusted?

Thanks in advance!

quantum-guy7 commented 3 years ago

@givp Can I take it up? I hv experience in both AWS & Nodejs

givp commented 3 years ago

@Zerquix18 you can go ahead and start the bounty via gitcoin. AWS CDK could be a nice way to manage the canary tests! Regarding reward amount. This value will be adjusted based on current ONE market price.

givp commented 3 years ago

@quantum-guy7 absolutely. But multiple folks can start working on the same bounty. A winner will be selected based on the quality of delivery.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 3 weeks, 4 days from now. Please review their action plans below:

1) zheli has started work.

AWS Cloudwatch Synthetics Canary scripts for every RPC method and workflow.

Learn more on the Gitcoin Issue Details page.

zheli commented 3 years ago

Question regarding the bounty:

  1. Can I use Terraform to create the CloudWatch canaries?
  2. Should I create one canary for each method call or one canary for all methods call? Not sure how will that affect the integration with the status page and that's why I am asking. :slightly_smiling_face:
givp commented 3 years ago

@zheli yes you can use Terraform. We need a separate canary for each method so we can monitor the status of each endpoint. But like I mentioned above, some canaries could contain multiple requests to test transactions.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 8182.7617 ONE (474.21 USD @ $0.05/ONE) has been submitted by:


Zerquix18 commented 3 years ago

Just submitted my work :) Thought I would explain a little bit of what I did:

This file contains all the RCP methods to be tested: https://github.com/Zerquix18/harmony-cloudwatch/blob/master/lib/methods.ts Includes their params, host and what the result should be.

The CDK then builds all canaries for all methods, including a bucket for the logs and alarms: https://github.com/Zerquix18/harmony-cloudwatch/blob/master/lib/harmony-cloudwatch-stack.ts

Each canary gets the method item (from the original file) as an env bar and runs it: https://github.com/Zerquix18/harmony-cloudwatch/blob/master/canary/index.ts

3 of the endpoints were not working: 2 were not working (including the cURL example) and one had a warning of being WIP.

As a plus, I added all types for Synthethics, which don't seem to be anywhere online! I'll probably submit that to DefinitelyTyped. https://github.com/Zerquix18/harmony-cloudwatch/blob/master/models/synthetics.ts

Thanks to that, the entire project uses Typescript, including the Canary script.{

To make everything work just set up the CDK locally or with an action and you're ready!

Had a lot of fun! Thanks for the opportunity. Best of luck to everybody.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 8182.7617 ONE (509.28 USD @ $0.06/ONE) has been submitted by:

  1. @zerquix18

@papiofficial please take a look at the submitted work:


zheli commented 3 years ago

Just submitted my work as well. It's doesn't have the alert or S3 bucket creation part, but that can be added easier later.

Some implementation details are written here: https://github.com/zheli/harmony-cloudwatch-synthetic-canary-scripts/blob/main/README.md

I will improve some of the test scripts some time today.

Update: Fix the issue with hmyv2_sendRawTransaction, now I am sending a pre-signed rawTransaction.

givp commented 3 years ago

Thank you. I will review shortly.

zheli commented 3 years ago

Fixed some mistakes in my README to make it more clear.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 8182.7617 ONE (660.14 USD @ $0.09/ONE) attached to this issue has been approved & issued to @zheli.