Git Product home page Git Product logo

fortune's People

Contributors

dzeranov avatar foufrix avatar human-protocol avatar jalal-1 avatar portuu3 avatar posix4e avatar vkomodey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fortune's Issues

Making Fortune App work with another Network (Polygon here)

I'm trying to make the fortune app work on a network other than the one deployed on AWS or locally.

I've deployed the Escrow Factory here on polygon Mumbai : https://mumbai.polygonscan.com/address/0x5D65C42cF4a140863744889BAd07f246C0211754

It's currently setup to work with the USDC contract (easier to get for testing with faucet already in place): https://mumbai.polygonscan.com/address/0xe11a86849d99f524cac3e7a0ec1241828e332c62

I've changed constants.js to work with those contracts :

export const HMT_ADDRESS = "0xe11A86849d99F524cAC3E7A0Ec1241828e332C62";
export const ESCROW_FACTORY_ADDRESS = "0x5D65C42cF4a140863744889BAd07f246C0211754";
export const REC_ORACLE_ADDRESS = "0x61F9F0B31eacB420553da8BCC59DC617279731Ac";
export const REP_ORACLE_ADDRESS = "0xD979105297fB0eee83F7433fC09279cb5B94fFC6";
export const EXCHANGE_ORACLE_ADDRESS = "0x6b7E3C31F34cF38d1DFC1D9A8A59482028395809";

Those steps works ok :

  1. Creation of Escrow
  2. Funding and providing manifest.json
{
  "job_title": "Requesting fortunes from the fortunes teller",
  "job_type": "fortune",
  "fortunes_requested": 2,
  "recording_oracle_address": "0x61F9F0B31eacB420553da8BCC59DC617279731Ac",
  "reputation_oracle_address": "0xD979105297fB0eee83F7433fC09279cb5B94fFC6",
  "echange_oracle_address": "0x6b7E3C31F34cF38d1DFC1D9A8A59482028395809",
  "recording_oracle_url": "http://localhost:3005/job/results",
  "reputation_oracle_url": "http://reputation-oracle:3006/job/results",
  "exchange_oracle_url": "http://localhost:3001"
}

3.Sending message with the exchange app => Not working
Front :
image
Back :
image

I have an ABI error. Is this possible because ABI provided is for HMT and not USDC? Or am I missing something else?
image

Fortune app not working locally

Step :

  1. clone repo
  2. docker-compose up
  3. Check that all docker instance are running
    image
  4. Deploy contract on the chain (cd contracts && truffle migrate development)
  5. Connect to network with metamask (http://localhost:8547 and id 1337)
  6. Import HMT token (0x444c45937D2202118a0FF9c48d491cef527b59dF)
  7. Go to launcher on localhost 3000
  8. Create Escrow with first account (28e516f1e2f99e96a48a23cea1f94ee5f073403a1c68e818263f0eb898f1c8e5)
  9. Fund Escrow with HMT
  10. Add manifest.json :
{
"job_title": "Requesting fortunes from the fortunes teller",
"job_type": "fortune",
"fortunes_requested": 2,
"recording_oracle_address": "0x61F9F0B31eacB420553da8BCC59DC617279731Ac",
"reputation_oracle_address": "0xD979105297fB0eee83F7433fC09279cb5B94fFC6",
"echange_oracle_address": "0x6b7E3C31F34cF38d1DFC1D9A8A59482028395809",
"recording_oracle_url": "http://localhost:3005/job/results",
"reputation_oracle_url": "http://localhost:3006/job/results",
"exchange_oracle_url": "http://localhost:3001/"
}
  1. Go to localhost:9001, log with dev and devdevdev, create a bucket job-results (does not exist when first deploy)
  2. Go to exchange, send first message with account 2 (9e531b326f8c09437ab2af7a768e5e25422b43075169714f1790b6b036f73b00)
  3. Send 2nd message with account 3 (9da0d3721774843193737244a0f3355191f66ff7321e83eae83f7f746eb34350)

Get an error :
From exchange
image

From Backend
image

[Bug]: Manifest file is absent when deploying the local testnet version

Describe the bug

When running the app using the Local Testnet (https://github.com/humanprotocol/fortune#creating-a-job-local-testnet), the manifest file is not generated in minio. This prevents me from being able to complete the job creation process, the manifest url is required to create the job.

Steps to reproduce

1.Ensure that you are connected to Fortune Ganache (or whatever you named it above) under Networks in Metamask.
2. Navigate to http://localhost:3000/ to access the Job Launcher
3. Click on connect to connect your metamask wallet
4. To begin deploying a new job click on 'Create Escrow', Metamask will ask you to sign this transaction
5. Assuming the above transaction was successful you will now have a new Escrow address under the "Escrow created" field, this address represents the job, copy it down. Next we must fund the escrow.
6. Enter the Escrow address in to the search box and click the 'Search Escrow' button. You should now be presented with information about the Escrow, such as the status etc. Enter any amount into the box titled 'Fund the escrow' and click the 'Fund' button.
7. To complete the job creation process we must add the manifest URL. This URL points to the manifest.json file, which contains job specific data. For this example the data has already been created for you and stored in a local datastore (minio) which can be accessed at http://localhost:9001/ (To login you must use the default username: 'dev' and password 'devdevdev')
8. Once you are logged into the minio dashboard, click on the 'Manage' button, you will be taken to a Summary page for the manifest bucket. From this screen change the 'Access Policy' to 'public' and click 'Set' to confirm changes. We can now exit the minio dashboard and return to the Job creation process.
9. Navigate back to the job launcher (http://localhost:3000/), enter the manifest URL (http://localhost:9000/manifests/manifest.json) into the form and hit 'Setup Escrow'.

The manifest.json file is missing see below:

Error messages or log output

When navigating to the manifest url (http://localhost:9000/manifests/manifest.json):

<Error>
<script/>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>manifest.json</Key>
<BucketName>manifests</BucketName>
<Resource>/manifests/manifest.json</Resource>
<RequestId>170897B736E0A39D</RequestId>
<HostId>125690c9-785f-42cd-aba5-9a71d1e46496</HostId>
</Error>

Browser

Chrome

Additional context

This example was working previously, I think this could be related to recent changes in the deployment (CI/CD)

E2E backend tests

Need to add a docker-compose test setup which should include all services that are currently represented in the docker-compose.yml

Add test run for every pull request using the GA

Test cases:
TC 1.
Positive flow

  1. Should create and fund job for a given Escrow factory(manifest with 3-5 required fortunes)
  2. Should be able to make a call to the recording oracle
  3. Recording oracle should record and send results to the reputation oracle
  4. Reputation oracle should filter fortunes and make payments for all workers
  5. Check balances of the Escrow, workers, and oracles

TC 2.
Positive flow + adding the same fortunes. Make sure that only one unique fortune teller got paid

TC 3.
Test the cancel Escrow flow. Check balances of the Escrow and canceler accounts

TC 4.
Check that oracles don't work with invalid Escrows or with Escrows in an invalid state

Add validation phase

Add a new oracle for validation purposes. Validator is responsible for initial data validation
In the case of the Fortune App - it may be a simple manifest JSON validation

  • Manifest is accessible
  • Manifest is a valid JSON file
  • Manifest has all required fields. Like fortunes_amount, recording_oracle_url, reputation_oracle_url and etc.

In case the input data(manifest) is not valid, the validator should initiate the cancel logic for the job, which will lead to transferring all funds back to the job requester

For this purpose, the initial Escrow.sol contract should be changed and include new statuses and logic for supporting the validators work

Batch processing

Currently, oracles are supposed to shift the job status only when all work is done. This might not be a good case when the job is massive. Oracles should send batches instead of all required fortunes

This will improve the overall experience of the protocol usage from everyone perspective

[Bug]: Cannot create an Escrow contract for the deployed playground version

Describe the bug

When trying to use the deployed playground version of the application, I cannot create an Escrow contract as there is no test ETH in the pre-configured Ganache wallets.

MetaMask Notification 10_05_2022 11_42_46

Steps to reproduce

  1. Configure your Metamask Wallet as per the deployed playground instructions in the README.
  2. Navigate to the Job Launcher
  3. Attempt to create a new Escrow contract

At this stage we require a very small amount of ETH for gas fee's. The pre-configured wallets have 0 ETH and hence we receive the error above. I would suggest funding the wallets with some test ETH.

Error messages or log output

No response

Browser

Chrome

Additional context

No response

Make the oracle work on polygon network (or other network)

I deployed the Factory Escrow contract here: https://mumbai.polygonscan.com/address/0x2dd72db2bBA65cE663e476bA8b84A1aAF802A8e3
And I deployed it to work with USDC (for easy testing): https://mumbai.polygonscan.com/address/0xe11a86849d99f524cac3e7a0ec1241828e332c62

In constants.js I changed the value to make it work :

export const HMT_ADDRESS = "0xe11A86849d99F524cAC3E7A0Ec1241828e332C62";
export const ESCROW_FACTORY_ADDRESS = "0x2dd72db2bBA65cE663e476bA8b84A1aAF802A8e3";

I started the fortune exchange and launcher docker image locally. Creation of Escrow worked ok. Funding the Escrow (with USDC) and providing manifest.json worked ok.

image

Here is the manifest I provide :

{
"job_title": "Requesting fortunes from the fortunes teller",
"job_type": "fortune",
"fortunes_requested": 2,
"recording_oracle_address": "0x61F9F0B31eacB420553da8BCC59DC617279731Ac",
"reputation_oracle_address": "0xD979105297fB0eee83F7433fC09279cb5B94fFC6",
"echange_oracle_address": "0x6b7E3C31F34cF38d1DFC1D9A8A59482028395809",
"recording_oracle_url": "http://ec2-3-15-230-238.us-east-2.compute.amazonaws.com:3005/job/results",
"reputation_oracle_url": "http://ec2-3-15-230-238.us-east-2.compute.amazonaws.com:3006/job/results",
"exchange_oracle_url": "http://ec2-3-15-230-238.us-east-2.compute.amazonaws.com:3001/"
}

I get the exchange URL, I can go to it, but when I want to send the fortune message from Agent 2 and 3 accounts, I get this error :
image

From my understanding, the oracles are running on this RPC http://ec2-3-15-230-238.us-east-2.compute.amazonaws.com:8545/ hosted on Amazon AWS.

Can the polygon Escrow contract created on Polygon Mumbai interact with the oracles hosted on AWS? If yes, what do I need to change?

Because on the AWS chain, the fortune app works ok.

Metamask transaction comfirmation doesn't want to pass[Bug]:

Describe the bug

IMG-20220803-WA0002
IMG-20220803-WA0003

Steps to reproduce

Followed all the steps in the readme , everything was working perfectly but, still Metamask is not allowing the transaction and doesn't make the confirmations. keeps showing transaction failed.

Error messages or log output

Failed to comfirm the transaction (Metamask)

Browser

Chrome, Firefox, Microsoft Edge

Additional context

No response

Refactoring UIs and oracles

The current version is not stable and some situations are not handled properly:

  1. Display errors in the dashboard and exchange
  2. Add Cancel button to the Job Dashboard
  3. Exchange should show an error if the address is not a valid escrow or not from the specified factory
  4. Exchange should not work with Escrows, not in PENDING statuses
  5. Oracles should consider balances and statuses of the Escrow and not allow any additional work to Paid or Cancelled Escrows

Add architecture document

This project has a variety of different components and a complex interaction with the blockchain. Document it out and create a drawing in the repo. Consider a c4 or equivalent model to capture the blockchain interactions. Please use this as a reference for the dapp architecture doc, and feel free to enhance and add wherever needed.
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.