Code Monkey home page Code Monkey logo

renpool's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

renpool's Issues

Tidy up `.gitignore` `.env.*` entries

The following entries in .gitignore reference difference network settings

renpool/.gitignore

Lines 2 to 6 in d5514f4

.env.kovan
.env.kovan2
.env.rinkeby
.env.mainnet
.env.mainnet_fork

Are they being used? I guess the only value we might need in the PRIVATE_KEY, which changes across networks. But for now we only use it on Kovan.

Fix reentrancy issue reported by Slither

One of the issue reported by Slither is about reentrancy on the deposit method.

Reentrancy in RenPool.deposit(uint256) (contracts/RenPool.sol#133-149):
        External calls:
        - require(bool,string)(renToken.transferFrom(sender,address(this),_amount),RenPool: Deposit failed) (contracts/RenPool.sol#143)
        State variables written after the call(s):
        - _lockPool() (contracts/RenPool.sol#147)
                - isLocked = true (contracts/RenPool.sol#115)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-1

Verify that this is an actual issue, and remove the warning from Slither.

Create HardHat project to compile and test the `RenPool` contract

With this issue, we start the migration to HardHat, from Brownie.

The HardHat project should be able to compile the RenPool contract properly. This means, it should be configured with a suitable compiler and OpenZeppelin dependencies.

The HardHat project should use yarn to manage its dependencies.

Tests passing when running in local computer but fail on CI

Here are the logs when running github actions:

tests/conftest.py:32: in <module>
Brownie v1.14.6 - Python development framework for Ethereum
    network.connect(net)

Compiling contracts...
  Solc version: 0.8.7
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
Generating build data...
 - AccessControl
 - IAccessControl
 - MerkleProof
 - EIP712
 - ConditionalEscrow
 - Escrow
 - RefundEscrow
 - ERC165
 - ERC165Checker
 - ERC165Storage
 - ERC1820Implementer
 - IERC165
 - IERC1820Implementer
 - IERC1820Registry
 - Math
 - SafeCast
 - SafeMath
 - SignedSafeMath
 - EnumerableMap
 - EnumerableSet

New compatible vyper version available: 0.2.12
Compiling contracts...
  Vyper version: 0.2.12
Generating build data...
 - RenPool_old

Compiling contracts...
  Solc version: 0.8.7
  Optimizer: Enabled  Runs: 200
  EVM Version: Istanbul
Generating build data...
 - OpenZeppelin/[email protected]/ERC20
 - OpenZeppelin/[email protected]/IERC20
 - OpenZeppelin/[email protected]/Context
 - RenPool
 - RenToken
 - IDarknodeRegistry

Generating interface ABIs...

Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie --fork https://mainnet.infura.io/v3/*** --chainId 1'...
Error: Process completed with exit code 4.

Add Slither to GitHub actions

Slither is a static analyzer for Solidity smart contracts. It detects potential errors, vulnerabilities and promote best practices.

Integrate Slither into our CI.

Convert project backlog cards into issues

Under the Ren Pool project, there are several cards. Convert any actionable, i.e., something needs to be implemented, card into an issue. We should delete the remaining cards to have a clean backlog.

Clean up Brownie leftovers

After successful migration to Hardhat has been completed, some Brownie related files still remain in the repo. Remove this files as they are no longer needed.

Convert base58 to hex

We need to implement the base58 to hex conversion in order to process the node ID given by the darknode CLI.

For instance, when running the darknode cli you get the following output:

Congratulations! Your Darknode is deployed.
Join the network by registering your Darknode at https://mainnet.renproject.io/darknode/8MGTMfNPeekDnSrJDqmf5oSVZaK3Vx?action=register&public_key=0x000000077373682d727361000000030100010000010100d0feba4ae65ea9ad771d153419bcc21189d954b6bf75fd5488055cd2641231014f190c0e059a452d301c535e931df33590ec0e18c59341a2766cc885d1dc6e66f5cc65b94522ec944ae4200bd56a30223328b258d50b507dd94b4c4742768f3fec2b815c9c4b0fe26727e82865f6a064fa3ff2443d135d9788095a1c17487fd5c389a491c16b73385d516a303debc3bcccae337a7ec0d89d51ce05262a0c4c1f2178466c85379b8cd4e5cbe1c90a05fb0c1ed3eee2134774b450e7b0b70c792abad55beef919e21a03cb9de4e963a820c2f84421a4559d0b67cfd17c1686ff6f2d1bb07ac2c82cede1cf5f16a57e125a29fef65891715b061606bca1a0eb026b&name=darknode-kovan

If I understand correctly the 8MGTMfNPeekDnSrJDqmf5oSVZaK3Vx is the nodeID which is required when registering the node (together with the publicKey). Now, in order for the register function to work the nodeID needs to be an address. Therefore we should convert from base58ToHex.

See how the conversion is done in the command center:
https://github.com/renproject/command-center/blob/9aa947a6fd1ec3459c06809e4fb82915032805a6/src/lib/darknode/darknodeID.ts#L7

Here's the register function of the DarknodeRegistry:
https://github.com/Ethernautas/darknode-sol/blob/master/contracts/DarknodeRegistry/DarknodeRegistry.sol#L232

And here where we should use the encoding:
https://github.com/Ethernautas/renpool/blob/master/tests/ren_pool/test_darknode_registration.py#L6

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.