-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLessons.txt
31 lines (27 loc) · 1.54 KB
/
Lessons.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
+============+
| Lessons |
+============+
1) The compiler error 'invalid op code' is usually the result of throw e.g. modifiers
whose require() statements failed.
2) Don't use tx.origin. Just don't do it.
3) Don't give methods and variables the same name. Just don't do it.
4) Don't shadow parent variables in a child class. Just don't do it.
5) Don't shadow builtin symbols as methods (i.e. make your own selfdestruct method).
6) Let large contracts migrate from their own file. Otherwise you risk running out of gas.
7) Be very careful when creating and maintaining interfaces. Make sure your contract methods match.
If you're not careful, you run the risk of attempting (and failing) to migrate an abstract contract.
8) Write validation functions to ensure the state of your contracts are stable. These are particular
important to call after calling a function on a contract you did not write!
9) Using 'var' at the top of a for loop is probably not what you want to do.
10) Using a for loop is probably not what you want to do (at least very often).
11) If you have no peers on your geth node and you explicitly told geth about your peers,
it's probably a wifi issue. Try switching networks.
+============+
| JULIA |
| Lessons |
+============+
1) Constructor Parameters are stored sequentially in memory and start at 0x80
2) Return a variable: mstore(0, v) //store parameter
return(0, 0x20) //return 32 bytes of memory
3) we shift over 28 bytes which is 56 zeros to put signature at the upper bytes of the word
4)