Giter Site home page Giter Site logo

oracle-node's People

Contributors

adi44 avatar anshme avatar arin17bishwa avatar ashish10677 avatar f1rstmehul avatar hrishikeshio avatar omahs avatar oxhimanshu avatar patil2099 avatar rajkharvar avatar shekhar2807 avatar shrikant1212 avatar skandabhat avatar yashk767 avatar yohanelly95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

oracle-node's Issues

`import` command for importing accounts

Rationale

An import command is required to generate the Keystore file for an account if the user provides the private key.

It is inconvenient for the admins to deploy contracts from one account and then transfer ownership to another account that is created with razor-go and then create assets. Rather, they should be able to import their accounts directly into razor-go and then work with it.

Implementation

The new command would look something like this:

$ ./razor import
Enter Private Key:
Account imported successfully

This function of go-ethereum can be used to implement this feature.

Implement custom errors

Rationale

All the error messages (and probably error codes) should be kept in one file. This will help to make the code look better and be more readable. Also, in future, if we decide to change any message, we can do it in one place rather than doing it in many files.

Also, implement an interface for user-defined errors.

Implementation

An error.go file can be created which contains all the error messages and their respective error code.
An interface can be created that implements all the user defined error messages and their respective error code.

Dockerise razor-go

Rationale

There are lot of environment specific nuances that could surface problems with razor-go operation.

Implementation

Dockerise the node so that we have control over dependencies and environment.

Update README.md with `import` feature

razor-go has a new import feature that helps us to import an external address into our client and use it for all operations.

This feature has been merged to main branch but the README has not been updated yet.

Remove `pkg/bindings` folder from git

The pkg/bindings folder and its contents are anyways generated when we build the project, using make all doesn't make much sense to push it to github.

Implement `rogue` mode

Rationale

Right now all the values reported by the razor-go are correct. A rogue mode would report wrong values. This will be necessary to check how does everything behave if there is a rogue client.

Implementation

Implement a --rogue mode within the vote command, which would deliberately report bizarre values.

Check median calculation

Median calculation currently sums up the entire array data and divides the result by 2. This doesn't give the actual median value.

Implement back off algorithm while calling `giveSorted` in dispute

Rationale

Right now, we call giveSorted with 1000 values without considering the fact that the client might surpass the block gas limit while calling this function. This must be avoided.

Implementation

To avoid this, a binary backoff algorithm must be implemented, where first we estimate gas for the entire votes, and if the value is greater than the block gas limit, we go on decreasing that value by half, till the value is less than the block gas limit.

Add a link to `CONTRIBUTING.md` in README

Right now there is no contributing section in the README. There is a CONTRIBUTING.md file present though. It would be good if we have the link to that file in README.md.

'make all' to generate bindings gives error but running generate-bindings.sh works.

System information

  • OS & Version: Linux/Ubuntu 20.04.2 LTS
  • Go version: go1.16.5 linux/amd64
  • razor-go version: v1.0.0

Describe the bug

  • Able to generate bindings by just running generate-bindings.sh , but aiming the same thing to be done by make all gives an error.

Expected behaviour

-When running make all ,its expected the bindings to be generated but there's an error in pipefail and Makefile.

Actual behaviour

ERROR :
Installing contract dependencies...
generate-bindings.sh: 3: set: Illegal option -o pipefail
make: *** [Makefile:11: fetch_bindings] Error 2

-Tried to fix this by removing the set -e -o pipefail line , there's still an Makefile error which looks quiet strange.

ERROR:
Installing contract dependencies...

generate-bindings.sh: 16: Syntax error: "(" unexpected
make: *** [Makefile:11: fetch_bindings] Error 2

Delegate command example is incorrect in README

If you want to become a delegator use the delegate command. The staker whose staker_id is provided, their stake is increased.

$ ./razor delegate --address

--amount --stakerId <staker_id>

Example:

$ ./razor stake --address 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --amount 1000 --stakerId 1

Looping isn't done properly on assets.

System information

  • OS & Version: MacOS BigSur
  • Go version: go1.16.5 darwin/arm64

Describe the bug

AssetIds start from 1 to numAssets, but in asset.go the looping is done from 1 to less than numAsset.

Expected behaviour

Ideally, all the collections and jobs should be returned when GetActiveAssets is called.

Actual behaviour

The last asset is never returned.

Steps to reproduce the behaviour

  • Create 2 jobs.
  • Create a collection using those 2 jobs.
  • Start voting.
  • The collection's data isn't visible.

Buffer percent is set to 0 while we make the build

System information

  • OS & Version: MacOS Big Sur
  • Go version: go1.16.5 darwin/arm64

Describe the bug

While we run make all or npm run build-all or npm run build, we are asked about the buffer per cent, but no matter what value we enter, in razor.yaml, it is set to 0.

Expected behaviour

razor.yaml should show the buffer percent set while running the build.

Actual behaviour

razor.yaml shows buffer percent as 0.

Steps to reproduce the behaviour

  1. Run npm run build or npm run build-all
  2. Enter the buffer percent as some value when prompted.
  3. Go to home directory > .razor > razor.yaml
  4. Check the value against buffer.

Setup a testing framework by mocking a blockchain.

Rationale

Currently, to test any issue/feature, it's a very tedious process, to run ganache-cli, then deploy all contracts, create accounts, etc. It would be good if we have a testing framework that does all of this by mocking the blockchain.

Implementation

This can be an inspiration on how to approach this feature.

Getter function of list of Assets

Rationale

Assets are the jobs and collections. One command to view both jobs and collections would be a great addition to the project.
It'll be similar to #36 and #37

Implementation

Implementation would be the same as #35

Getter function for Job List

Rationale

This feature is required for the admin as well as the user to view the list of jobs and their various properties that are available in the structs contract.

Implementation

Implementation would be similar to #35

Update razor-go to support latest contracts

Rationale

razor-go is currently supporting an older version of contracts.

Implementation

  1. Bump up npm version to latest
  2. Replace SchellingCoin to RAZOR
  3. Job will now have job.active instead of job.fulfilled

`unstake` command should have a withdraw automatically flag.

Rationale

Right now, if a user wants to withdraw their fund, they have to first call the unstake command and then call the withdraw command. It would be a good feature if the unstake command itself had a flag that would call the withdraw function automatically.

Implementation

The new unstake command would look like this:

./razor unstake --address <address>  --stakerId <staker_id> --amount <amount_of_sRzr> --withdraw

The --withdraw flag would be optional and if provided, the command will exit only after unstaking and withdrawing the funds.

Getter function for Collection List

Rationale

This feature is required for the admin or user to see the list of collections and their respective info as provided by the Structs contract.

Implementation

The implementation would be the same as #35

Getter function for Staker Info.

Rationale

This feature is required to easily get any staker's info on the terminal itself. It will help us view whether a staker accepts delegation or not, how much they have staked, their address, what commission they charge, when they last committed, etc.

Implementation

A new command has to be introduced, ./razor getStakerInfo --stakerId <staker_id>
This should call a getStakerInfo method, which would get the data from the razor contracts.
A nice table look would be desirable, using different colours for different parameters.

This is the staker struct in the contract.

unstake command is missing amount flag in README

As per current documentation, unstake command is missing the amount flag which is required as per implementation.

The updated command should be:

$ ./razor unstake --address 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --stakerId 1 --amount 1000 --autoWithdraw

createJob doesn't work after onlyAdmin access in contracts

System information

  • OS & Version: Windows/Linux/OSX
  • Go version: 1.16.5
  • razor-go version: 1.0.0

Describe the bug

After onlyAdmin access in contracts, only admin can create jobs and collection. Suppose if any other account wants to create job and collection then it needs to have admin access else that particular account won't be able to create job.

Expected behaviour

If the account has admin access then it should be able to create job as well as collection.

Actual behaviour

In the current implementation even if the account has admin access, it is not able to create job.
As soon as we create job it's being getting failed with this error: failed to estimate gas needed: VM Exception while processing transaction: revert

Steps to reproduce the behaviour

  • Create an account with ./razor create
  • Fund some SCH tokens and ETH in the generated account.
  • Before deploying contracts give admin access to the generated account run this steps:
    • Now to give access to that account we can add that particular account(address) in postDeploymentSetup.js in contracts repo with this line.
    • pendingTransactions.push(await assetManager.grantRole(await parameters.getAssetModifierHash(), 'ADDRESS_WHICH_NEEDS_ACCESS'));
    • This can be added here
  • Deploy the contracts on ganache-cli
  • Stake some SCH tokens using ./razor stake --address GENERATE_ACCOUNT --amount 10000
  • Now create a job using ./razor createJob with appropriate flags. (This will fail with VM error)

Pressing enter during config setup breaks the setup

System information

  • OS & Version: OSX
  • Go version: : 1.16
  • razor-go version: latest

Describe the bug

Skipping config setup (for eg., pressing enter on set buffer) breaks the setup.

Expected behaviour

There should be defaults that should be set if config is skipped

Backtrace

Enter gas multiplier value: 
1
Enter buffer percent: 

\n
Setting initial config...
Error: flag needs an argument: 'b' in -b
Usage:
  razor setconfig [flags]

Flags:
  -h, --help   help for setconfig

Global Flags:
  -b, --buffer int32            buffer percent
  -g, --gasmultiplier float32   gas multiplier value (default -1)
  -p, --provider string         provider name

flag needs an argument: 'b' in -b
make: *** [set_config] Error 1````

<!-- When submitting logs: please submit them as text and not screenshots. -->

Set gas price as a configurable parameter

Gas Price is predicted by calling the SuggestGasPrice method. But this value is too high right now. We can let the user choose the gas price for the time being and if he/she doesn't choose a value, then the SuggestGasPrice method will be used to predict the gas price.

Figure out how to reduce RPC calls

Rationale

We ping the blockchain too many times during voting just to check whether the correct state has arrived or not. Rather than doing that, it'll be better if we calculate the timing of the next state and ping at that particular moment.

Implementation

Since we know the state length, epoch length, and approximate time to mine a block on a particular blockchain, we can calculate the approximate time when the next state will occur.

Dont propose if your iteration < last block in alt blocks if num proposed blocks = max alt blocks

Rationale

Dont know if this issue exists please verify

we have maxaltblocks parameter in contracts which is currently set at 5

lets say 5 blocks have already been proposed with following iterations
[1,12,100,1000,1232]

now current stakers iteration is 2000. The is no point proposing since the block will not be included in proposed blocks anyway since contract only stores maxaltblocks numebr of blocks.

in this case, dont propose to save on gas fees.

Set Delegation Commission sets commission * 10**18 instead of input

Describe the bug

Currently in setDelegation.go , commission that we input is considered as the amount which staker would charge for the delegators to delegate. But in actual, commission is set as a commission percent rate in razor contracts for delegation.

Expected behaviour

eg .if the commission is 5 , than 5 percent of the staked s amount would be considered as a commission when delegator withdraws

Actual behaviour

If the input is 5 , corresponding amount in wei is considered as a commission

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.