b9labs-eth20-proj1's People
b9labs-eth20-proj1's Issues
Use gasUsed correctly
You are comparing apples and oranges gas and weis. .gasUsed * tx.gasPrice, yes, that gives you weis.
need to wait for block to be mined for web3.eth.getTransactionReceipt(tx) to work
Make it work against net42
Avoid .toNumber(), prefer .toString(10). Javascript numbers are small.
optimize costs
- add memory/storage keywords to internal function parameters
- use memory when invoking functions, where possible
- measure impact of these changes on execution cost
- use memory for temp vars
- to avoid internal transaction
- compiler optimization
Implement withdraw pattern
xavierlepretre 4 hours ago:
Talking to 2 untrusted addresses in 1 tx is an anti-pattern.
Non-only can the other sabotage the whole tx by calling revert(), but more importantly, by handing over the execution, it is possible for the other address to call back on your contract, aka reenter, and possibly do things.
So it is better to find a way to not break the pattern of 1 tx - talk to 1 or fewer untrusted addresses.
How?
Use assert.strictEqual when testing
use beforeEach() when testing
Actually, you should not use the deployed instance, which is meant for Ropsten, say. Yes, you can check that it was deployed according to your specs, i.e. the migration file is correct. But for the other tests, you should do beforeEach(... Splitter.new and use that instance. Otherwise your its depend on the previous one passing.
make test helpers more expressive
Figure out sync/async question about sendTransaction
cover potentially bad input data
- _authorizeWithdraw
Add event
Fix bugs in async code
add test case for splitting 1 Wei - confirm fail if contract misbehaves
better implementation of kill
can bump gas for reentry attack?
transfer() has gas limit to mitigate reentry attack.
but attacker can bump up gas, right? xxx.value(123).gas(100000)(args);
Use Math.floor() when splitting
add tests for emitted events
better getTransactionReceiptMined?
Assume contract creator is Alice
Transform web3.eth.getBalance into async?
Make the contract a splitting utility
Make the contract a utility that can be used by David, Emma and anybody with an address to split Ether between any 2 other addresses of their own choice.
add a kill switch to the whole contract
drop payment to fallback function together with alice-bob-carol use case, make everyone to use split()
publish
Deployed on rinkeby: 0x8849cddf20779c0bf0e65ef3aab4bee070299d29
Test accounts:
- TEST 0xe2DBC1817A18d345d051a348ceF998f3c14C2033
- Alice 0xdFb73a488f8a9A45E9ac2B433E061ee60AB2fEde
- Bob 0xdDDCd59331363191a2e9788212962A7EA7D9b4e1
- Carol 0x1028CCbE83dCebb568152f747AEfD4f3fe29b046
Do not allow split transactions from non-Alice
use expectedExceptionPromise
rebuild the Splitter instance state only based on events
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.