Code Monkey home page Code Monkey logo

openzeppelin-contracts's Issues

Add Versioning mechanism

Pulling zeppelin-solidity into a project does not support any visibility into which version of zeppelin-solidity is actually being used

Malicious adversary contracts for stress-testing

It might be helpful to provide a set of "adversarial" contracts that would help people write tests for common bugs and vulnerabilities. Some ideas:

  • A contract that pushes the call stack down to 1023 frames before calling some other function
  • A contract that responds in weird/nonstandard ways to being sent a transaction
  • A contract that uses reentrancy to try to break things?

Not sure how easy it would be to implement these flexibly and reusably. It might require first-class functions.

Vault contract

The idea is to create a contract for fund management that is separate from other contract/business logic. In this way, we can define clear interfaces for dealing with funds and reduce the attack surface on contracts managing funds.

Condition Oriented Programming?

Do you all have any thoughts on Condition Oriented Programming? I've seen a couple places where branching logic is in the methods, most often something like if (foo) throw;. Which still seems like it could be pulled out into modifiers. Does Zeppelin have any stance on this pattern?

It definitely requires more code, and could be more expensive. But on the positive side, there is cleaner separation of concerns, limited complexity, and I think the expressiveness that comes with naming modifiers is very valuable.

Implement 2 line separation between top level declarations

The Solidity style guide recommends a 2 line separation between top level declarations, so we should format files like this:

pragma solidity ^0.4.4;


import "../MyImport.sol";


/*
 * MyContract
 * Here goes the contract description
 */
contract MyContract {
  ...
}

Timed/Periodic payments helpers

Contracts want to send periodic or timed payments. E.g: "send x ether to this address every week for 5 weeks". Or "Send x ether to this address in 10 days".

We should write a contract that does that securely

Better code reuse tools

Current Solidity code reuse is based on copy-pasting or downloading existing code from other repositories. Mature ecosystems have good code repository management systems such as NodeJS’ npm or Ruby’s gems.
An interesting variation in Ethereum is the possibility of reusing code already deployed to the blockchain. Let's build tools that allow to easily link your contracts to deployed libraries.

does not install on my windows 10

$ npm i zeppelin-solidity

[email protected] install C:\projects\truffle-dapps\coinmaker\node_modul es\zeppelin-solidity
scripts/install.sh

'scripts' is not recognized as an internal or external command,
operable program or batch file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\projects\truffle-dap ps\coinmaker\package.json'
npm WARN coinmaker No description
npm WARN coinmaker No repository field.
npm WARN coinmaker No README data
npm WARN coinmaker No license field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\Rocky\AppData\ Roaming\npm\node_modules\npm\bin\npm-cli.js" "i" "zeppelin-solidity"
npm ERR! node v6.7.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: scripts/install.sh
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'scripts/install.s h'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the zeppelin-solidity pac kage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! scripts/install.sh
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs zeppelin-solidity
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls zeppelin-solidity
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\projects\truffle-dapps\coinmaker\npm-debug.log

Rocky@ASUS MINGW64 /c/projects/truffle-dapps/coinmaker
$ node --version
v6.7.0

Rocky@ASUS MINGW64 /c/projects/truffle-dapps/coinmaker
$ npm --version
3.10.8

Better oracle interfaces

An important part of smart contract development is how to interact with off-blockchain data sources.

An interesting idea to explore is to do inversion of control, where oracles call contracts (to communicate outside truths) through a common interface method, and can implement their oracle logic as wanted: trusted expert, closed voting, open voting, API wrapper.
Instead of contracts requesting data from oracles, oracles inform contracts of data changes.

Superuser: Upgradeable security for Smart Contracts

Scenario: you create a small crowdsale for your widget and it becomes really popular very quickly. Now there is a million dollar price tag on the poorly secured private key you used to deploy your contract and you start sleeping badly at night. Nobody worth their salt would secure a million dollars in a hot wallet.

Luckily, you remember that your contract inherits from Superuser, so next morning you generate a key in cold storage and take note of its address. You then use your owner account to configureSuperuser(address) and your sleep improves again because any sensitive method is using the requireSuperuser modifier. This modifier ensures that msg.sender is the superuser or (in case no superuser is configured, the owner). BOOM! Upgradeable security and peace of mind.

I will have a working implementation later today. Feel free to leave any feedback.

UPDATE: As was pointed out in the Slack channel, this is not a good example, as you can just transfer the ownership of the contract. A better example is when you want to keep a hot key for performing managerial actions but have a cold storage key as superuser in case the hot key is compromised.

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.