Giter Club home page Giter Club logo

contracts.demo's People

Contributors

dependabot[bot] avatar haoyuathz avatar lightsing avatar lispc avatar noel2004 avatar

Watchers

 avatar  avatar  avatar

contracts.demo's Issues

Using “origin" parameter may be a vulnerability

Currently some function (addToken and depositETH) in FluidexDemo contract has induced a "origin" parameter for being called from delegator contract. When called inside the delegator contract, the msg.sender of delegator contract it passed and being considered as the "original caller" of such an action. Such a practice may become problematic because:

  1. The method which accepts origin argument has no ability to check if it was passed by expected: in case a malicious contract or address has been assigned with delegator role, they can forge any address which can pass the privilege checking of origin argument inside these methods.

  2. The msg.sender is not the real tx caller if the delegator contract is called from another contract or proxy. In this case, the privilege checking is failed even a user with required privilege really call them.

There is tx.origin in solidity which indicate the sender of the transaction for the full calling chain. Maybe we should use the variant rather an additional "origin" parameter?

contracts call error


eth_estimateGas
  Contract call:           FluidexDemo#submitBlock
  From:                    0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
  To:                      0x5fbdb2315678afecb367f032d93f642f64180aa3
  Value:                   0 ETH

  Error: VM Exception while processing transaction: invalid opcode
      at FluidexDemo.submitBlock (contracts/Fluidex.sol:38)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at EthModule._estimateGasAction (/home/chris/gitfiles/fluidex/fluidex-backend/contracts/node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:421:9)
      at HardhatNetworkProvider._sendWithLogging (/home/chris/gitfiles/fluidex/fluidex-backend/contracts/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:126:22)
      at HardhatNetworkProvider.request (/home/chris/gitfiles/fluidex/fluidex-backend/contracts/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:103:18)
      at JsonRpcHandler._handleRequest (/home/chris/gitfiles/fluidex/fluidex-backend/contracts/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:188:20)
      at JsonRpcHandler._handleSingleRequest (/home/chris/gitfiles/fluidex/fluidex-backend/contracts/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:167:17)
      at Server.JsonRpcHandler.handleHttp (/home/chris/gitfiles/fluidex/fluidex-backend/contracts/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:52:21)

when using c36e354

get deployed_address

npx hardhat run scripts/deploy.js --network localhost | grep "Fluidex deployed to:" | awk '{print $4}'

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.