Compare commits
2017 Commits
v2.4.0-bet
...
v5.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
| acd4ff74de | |||
| 6c10bab3cc | |||
| 0cc8dcfb53 | |||
| f78e445551 | |||
| ab96c4871a | |||
| ac4198fcf4 | |||
| 7e014ee487 | |||
| e5e9ff72f0 | |||
| 98d28f9261 | |||
| 28aed34dc5 | |||
| 2fa4d103fe | |||
| 205f59e9b6 | |||
| 29f4059773 | |||
| c343ee3768 | |||
| bc1df46eac | |||
| c12cf86e0d | |||
| a4dc928a93 | |||
| 5bb3f3e788 | |||
| f989fff931 | |||
| 2a83a217af | |||
| 378914ceab | |||
| 0034c30224 | |||
| 3291252c86 | |||
| fe6249ec2c | |||
| bd588959ad | |||
| 72c152dc1c | |||
| 6325009675 | |||
| 2bedb02bfc | |||
| 8b591baef4 | |||
| 49cd64565a | |||
| b72e3da0ec | |||
| e3cfe1c5dd | |||
| d3ca1d1f00 | |||
| cceac54953 | |||
| ae753b7eac | |||
| 057d35a9eb | |||
| 414cb9e6fd | |||
| 4c481d6584 | |||
| f6db28630c | |||
| cc67e0eb83 | |||
| 2f0bc58946 | |||
| e866815c7d | |||
| 530179a71f | |||
| b1f6bbe69f | |||
| 8a309ab5ec | |||
| f3825ab335 | |||
| 204ffee531 | |||
| 3cfebcb5c4 | |||
| f20981528f | |||
| 3f901696f7 | |||
| 809ded806f | |||
| 37c35a1eaa | |||
| 6e224307b4 | |||
| cae60c595b | |||
| c01a0fa27f | |||
| 55d69573fc | |||
| cb7faaf4db | |||
| dfb3ec36b5 | |||
| 9e970eb9fa | |||
| 55fd53c6d2 | |||
| 373eabeca6 | |||
| 29a953954d | |||
| 83f954d8c4 | |||
| a9161aa93f | |||
| d8bbd34676 | |||
| 1e7ca3eea6 | |||
| 37619479cd | |||
| 3547cdce21 | |||
| 48c67c7de0 | |||
| 1edc2ae004 | |||
| 5fc38baea2 | |||
| eb4e8632f7 | |||
| db464dd23b | |||
| 0b58a783b9 | |||
| 4764ea5075 | |||
| c304b6710b | |||
| bcd4beb5e7 | |||
| 24a641d9c9 | |||
| aec36ddd6a | |||
| e3786e63e6 | |||
| c1d49a3259 | |||
| 9d6a0cc7e9 | |||
| 659f3063f8 | |||
| 231fae33f0 | |||
| 9e73c4b581 | |||
| e30b390d84 | |||
| 19a657bef8 | |||
| b73bcb231f | |||
| 4b33d326fa | |||
| 05f218fb66 | |||
| ccc110360f | |||
| 9af280dc4b | |||
| 01cae33130 | |||
| 483fc3f1f8 | |||
| 5480641e5c | |||
| c3f8b760ad | |||
| 442886ed5f | |||
| 83c7e45092 | |||
| 8a990e6d6a | |||
| 53b5d84212 | |||
| dc62599257 | |||
| d8e799db98 | |||
| de4154710b | |||
| 337bfd5ea4 | |||
| 8a890ffffa | |||
| 06449fe7bc | |||
| c1d6ad5a30 | |||
| dd1e8988ab | |||
| a241f09905 | |||
| faa6255b80 | |||
| 984233dcad | |||
| 52e0e3e783 | |||
| b64c90202a | |||
| 1224d197c7 | |||
| f1a69f164e | |||
| 9de916dd9c | |||
| fe68c12f9c | |||
| d947fb056d | |||
| 255e27e6d2 | |||
| ca2b85d786 | |||
| 48ce444477 | |||
| 05d4bf57ff | |||
| 52c36d412e | |||
| c80b675b8d | |||
| 60697cb09a | |||
| 4032b42694 | |||
| 60afc99053 | |||
| 11dc5e3809 | |||
| 427b8bb028 | |||
| df78791c96 | |||
| 40cfb80e4b | |||
| 5212e8eb18 | |||
| f8c2e1035e | |||
| 90fd7cc7dd | |||
| bbc6ef90b7 | |||
| b6e07917eb | |||
| 8a7a9c5857 | |||
| d6ad9db0a0 | |||
| 2d259ac346 | |||
| 6f4ebf1190 | |||
| db97666d0b | |||
| cb2aaaa04a | |||
| 5e3ba29b08 | |||
| d1f39cd00b | |||
| 6d94d00b98 | |||
| 0a5fba7a7e | |||
| 9558e546d9 | |||
| d398d68944 | |||
| ad27fb654a | |||
| 159fc11d81 | |||
| 9f123d6a84 | |||
| 976a3d5362 | |||
| e203e02523 | |||
| 0c18fac08a | |||
| 6ae2c17bfe | |||
| e682c7e5b5 | |||
| c03952acbe | |||
| 33ea1111b0 | |||
| 6b4ec6c6c6 | |||
| 8cc7f2dcbf | |||
| 92ff025622 | |||
| e83142944f | |||
| 8b2f29ceb0 | |||
| 7417c5946f | |||
| 0a3f880753 | |||
| 7a29f7df51 | |||
| c8369d483c | |||
| 105fa4e1b0 | |||
| 5705e8208b | |||
| 51b3e37d07 | |||
| 92224533b1 | |||
| 8b4b7b8d04 | |||
| 141c947921 | |||
| 3def8f9d15 | |||
| 140d66fad8 | |||
| 96e5c0830a | |||
| 4e7e6e54da | |||
| ae1bafcb48 | |||
| f8b1ddf591 | |||
| 72c0da9ae0 | |||
| 8b12f83a70 | |||
| 17a8955cd8 | |||
| 0a757ec463 | |||
| 036c3cbef2 | |||
| e73913c3c1 | |||
| 9d3b9be04f | |||
| 192e873fcb | |||
| cc431f53e0 | |||
| 7eba10dd1e | |||
| 61117c4db8 | |||
| 7439664490 | |||
| b5a7f977d8 | |||
| 6b30d2d8de | |||
| e86bb45477 | |||
| e5f02bc608 | |||
| a51f1e1354 | |||
| a5c4cd8182 | |||
| e5c63635e3 | |||
| dfae50fa5b | |||
| 72c642e13e | |||
| b27cd83eba | |||
| ec7ee76494 | |||
| 0b343abcb5 | |||
| 06eb785fcf | |||
| d7490e4f59 | |||
| d2ba1f6251 | |||
| 692dbc560f | |||
| 281ab15886 | |||
| 2fb73e5004 | |||
| efb8c1af6e | |||
| e68720efb6 | |||
| 920225a1c7 | |||
| a4b98bc79f | |||
| a80563c008 | |||
| fa87080d10 | |||
| ef68ac3ed8 | |||
| b4ceb054de | |||
| 04cb014144 | |||
| a72c9561b9 | |||
| abcf9dd8b7 | |||
| 015ef69287 | |||
| be0572a8dc | |||
| e70a0118ef | |||
| f213a10522 | |||
| f627500649 | |||
| 44965d7779 | |||
| 5bca2119ca | |||
| c3cd70811b | |||
| d155600d55 | |||
| 88211e8fba | |||
| 88512b23d2 | |||
| 6ba452dea4 | |||
| 3af62716dd | |||
| cffb2f1ddc | |||
| ef699fa6a2 | |||
| 552cffde56 | |||
| ae69142379 | |||
| c35057978f | |||
| a32077bbac | |||
| c411700572 | |||
| 74e396a967 | |||
| e3478edfe7 | |||
| e0ac73cd6e | |||
| 769071d473 | |||
| 0b1b5f89ef | |||
| 78d5708340 | |||
| 330c39b662 | |||
| e5fb718d40 | |||
| 0950532d9a | |||
| 7bd2b2aaf6 | |||
| bf75bccaea | |||
| 6a56b3b08d | |||
| 9702b67ce1 | |||
| e473bcf859 | |||
| 6bc1173c8e | |||
| 4e17c2e958 | |||
| 4e419d407c | |||
| 7294d34c17 | |||
| 7de6fd4a26 | |||
| cf6ff90b6d | |||
| cb1ef861e5 | |||
| f1f427ddaf | |||
| 248be2fab0 | |||
| 74016c376a | |||
| 94697be8a3 | |||
| 2ec2ed9695 | |||
| 7c8b7a2728 | |||
| 149e1b79fe | |||
| aed22fbc22 | |||
| 9c22fb5f33 | |||
| 16ee2e16da | |||
| 6383299d71 | |||
| b48d658228 | |||
| 3eb5cfb22a | |||
| 7ef4333301 | |||
| faa83c693a | |||
| 793d92a333 | |||
| 3e6c86392c | |||
| a754936a47 | |||
| e78628bfcf | |||
| 0f89a7e5f8 | |||
| e12511b53e | |||
| 655bd58487 | |||
| f92dce51ed | |||
| 0560576c7a | |||
| baf0e91279 | |||
| aca4030e4a | |||
| 39400b78ba | |||
| 2c6b859dd0 | |||
| 5d43060cdc | |||
| b4a9c47e9b | |||
| b849906ce4 | |||
| abba0d047a | |||
| 5ed5a86d1d | |||
| ef3e7771a7 | |||
| 58463a9823 | |||
| 970a7184ad | |||
| dee645e914 | |||
| 57865f8b20 | |||
| 2472e51e80 | |||
| 33ceb2320c | |||
| bd4169bb15 | |||
| ce7e6042a8 | |||
| da04f40e98 | |||
| 181d518609 | |||
| f0316a4cef | |||
| ae986db608 | |||
| 31aa460467 | |||
| f7db0bea31 | |||
| 64da2c10a4 | |||
| 68204769a1 | |||
| 652d0c5fb3 | |||
| 2215d9fd5e | |||
| 618304cc01 | |||
| af06fdcfd4 | |||
| d555464c53 | |||
| a714fe6dbd | |||
| 05205ab2e1 | |||
| 224c23b38f | |||
| 80b2d1df38 | |||
| 3bd9ed377e | |||
| 75eb7c2d49 | |||
| e48f8fd0d2 | |||
| 6f1685c3eb | |||
| 60e3ffe6a3 | |||
| 63851f8de5 | |||
| 36bf1e46fa | |||
| b6111faac8 | |||
| 095c8e120c | |||
| 9e09e0653a | |||
| a07f28b00c | |||
| bba33516b1 | |||
| 01659449d4 | |||
| 7ae7f3ef4b | |||
| 26c22169f0 | |||
| 6f80048ce9 | |||
| d54f4ac4b7 | |||
| a05a529049 | |||
| 25c416d01c | |||
| 5a77c9995f | |||
| e2a9353dea | |||
| 87f7a2cd42 | |||
| bb7ca7d151 | |||
| 5abbd04933 | |||
| ff9d089dad | |||
| 33cab7cd25 | |||
| 9ef69c03d1 | |||
| 1523a4f071 | |||
| e7ba2f7784 | |||
| f154bc31d4 | |||
| 9d2adccf87 | |||
| 630844ef50 | |||
| e891ec587d | |||
| 9612083826 | |||
| a503ba1a0a | |||
| c0545f741b | |||
| 98b83dfbaa | |||
| 424149a682 | |||
| b7da617d8d | |||
| 00c5da2034 | |||
| 10e00c8ef5 | |||
| 8186c07a83 | |||
| 8a0b7bed82 | |||
| 3266bca150 | |||
| cd67894914 | |||
| 812404cee8 | |||
| a5ed318634 | |||
| b2e7bab920 | |||
| 98203a72a6 | |||
| adbb8c9d27 | |||
| fab65cd08b | |||
| 9e3f4d60c5 | |||
| 8643fd45fd | |||
| cb0ffefe2f | |||
| b5a3e693e7 | |||
| 48b860124c | |||
| 736091afc4 | |||
| 70578bbb44 | |||
| 9bb8008c23 | |||
| 1169bb1e51 | |||
| 54a235f895 | |||
| b81bec4552 | |||
| f715365ec4 | |||
| 21716722ad | |||
| d39df78f6c | |||
| 5ae630684a | |||
| 48cc8a92f5 | |||
| fa680739e9 | |||
| 00cbf5a236 | |||
| d6b63a48ba | |||
| f631d8a5f0 | |||
| aed5720a01 | |||
| 02ea01765a | |||
| 9445f96223 | |||
| 7c02b5cab2 | |||
| 7222a31d54 | |||
| 28d9ac2bdb | |||
| 19293f3ecd | |||
| f347b410cf | |||
| 21bb89ef5b | |||
| 121be5dd09 | |||
| 9cf873ea14 | |||
| 84db204a41 | |||
| a55af77c75 | |||
| 4d4a509b1f | |||
| b6c5abbde5 | |||
| 0abf18f305 | |||
| 921ac49ccb | |||
| 8b72e20e32 | |||
| 24ebff5ae9 | |||
| 3d0edbecf1 | |||
| cd981f6521 | |||
| 2a4396c9dd | |||
| 4bac6fa310 | |||
| e47b53bce4 | |||
| 5229b75785 | |||
| 6d74b91388 | |||
| f5bf7233cb | |||
| 0053ee040a | |||
| 996168f1f1 | |||
| 7ccea54dc1 | |||
| 6bf68a41d1 | |||
| 3fe28e19af | |||
| 3ff9b42ff5 | |||
| 63bfab1a0c | |||
| 90163661df | |||
| e3adf91e50 | |||
| 6e21422737 | |||
| bb64458928 | |||
| 06861dce54 | |||
| 37270eb08a | |||
| 621b867b1a | |||
| 04342118dc | |||
| 874c2d3c02 | |||
| d6a8b2ccd7 | |||
| 023894deef | |||
| f29307cfe0 | |||
| 8cab922347 | |||
| cb4bf950df | |||
| c44c220254 | |||
| da89c438f1 | |||
| a7a94c7746 | |||
| 1e0e4e20bb | |||
| 6ddacdbde8 | |||
| dac2457a80 | |||
| b66c77a1fc | |||
| 9fa550c62f | |||
| 2271e2c58d | |||
| 365aca6d60 | |||
| 1d0dbcf9ab | |||
| 1f4e33fb72 | |||
| fc19a7947c | |||
| c95a445130 | |||
| 1a77a508f9 | |||
| 002a7c8812 | |||
| cd48b3eab3 | |||
| 6724873895 | |||
| c014c8f148 | |||
| ff85c7b0eb | |||
| 05ef6924ac | |||
| 2477534260 | |||
| ac5480e7ca | |||
| ef103f37e4 | |||
| 5cc1ea0a39 | |||
| 7cc2cbfeb5 | |||
| 604025400f | |||
| d6c7cee321 | |||
| fe08f58c69 | |||
| b425a72240 | |||
| 08fd777f6d | |||
| e73f90fa9d | |||
| cc04263170 | |||
| 1d5bcd04e7 | |||
| d9474327a4 | |||
| df2778f38e | |||
| 4fd2f8be33 | |||
| 85696d80ad | |||
| 6c14de4f0c | |||
| 253bfa68c2 | |||
| ffceb3cd98 | |||
| eecd5e15c7 | |||
| 2d1da295e6 | |||
| 3902a410f1 | |||
| 5cef83d2c7 | |||
| 30256fa838 | |||
| 2ee1da12c4 | |||
| 4c713f8cea | |||
| 7bb5592ad5 | |||
| 15c5c71795 | |||
| 4448c13c3c | |||
| 5420879d9b | |||
| 25edd3cd62 | |||
| 238d17cab9 | |||
| 5955d8e85b | |||
| 09329f8a18 | |||
| cbc6145f5f | |||
| 13d5e0466a | |||
| 7e814a3074 | |||
| a1d57bac50 | |||
| 11d65442b3 | |||
| dfef6a68ee | |||
| 0f10efe232 | |||
| 96b95592c3 | |||
| 8de6eba8a3 | |||
| 1642b6639b | |||
| 3ec4307c8a | |||
| f355bd3a2a | |||
| 3e1b25a5cf | |||
| f7b236dca8 | |||
| e5dbc7435e | |||
| 9a2e4cb3a7 | |||
| d095542fa4 | |||
| dff520afae | |||
| df3f1fc4db | |||
| 0ee84342b7 | |||
| 51294b7480 | |||
| 34d926dd7e | |||
| 832c352c7d | |||
| 908f78d07b | |||
| 692d8c85a4 | |||
| 72ed4ca67a | |||
| dcba9f995f | |||
| 8b2ed0f570 | |||
| 9e8b74a0e2 | |||
| a7ee03565b | |||
| 10022da83d | |||
| 538655c3c0 | |||
| 0a2a33be30 | |||
| ab2604ac5b | |||
| 6ff415de6b | |||
| d23f818a59 | |||
| 44d6053b43 | |||
| f959d7e4e6 | |||
| 8f14d52b73 | |||
| 1a079d258b | |||
| 6aac66d065 | |||
| a522187b50 | |||
| 91df66c4a9 | |||
| 8d633cb7d1 | |||
| 3b117992e1 | |||
| dd1265cb1d | |||
| 788d6a129a | |||
| 86f6eb2c9c | |||
| 661343f74c | |||
| 473d0b6884 | |||
| f2346b6749 | |||
| cf86fd9962 | |||
| 31723ed608 | |||
| 5523c1482b | |||
| ead3bcaccb | |||
| 7e7060e00e | |||
| 7f5e91062e | |||
| ca822213f2 | |||
| fa112be682 | |||
| 3f610ebc25 | |||
| 1a60b061d5 | |||
| 4f4b6ab403 | |||
| 1c8df659b9 | |||
| 75ef7b8b27 | |||
| ea2d5ad2e7 | |||
| e69248e551 | |||
| e739144cb0 | |||
| 6794c9460b | |||
| f8e3c375d1 | |||
| 58a62916de | |||
| 3214f6c256 | |||
| 5f7f660c6e | |||
| b952a82d29 | |||
| a55013e742 | |||
| aaad1f4a4f | |||
| 4fb6833e32 | |||
| de520fe25a | |||
| 7f028d6959 | |||
| eedca5d873 | |||
| e58c6d8ff4 | |||
| 8ba26f388f | |||
| 0ebc6e3529 | |||
| e1a77ab15f | |||
| dad73159df | |||
| 2c69f9f9f5 | |||
| 3f3774c5df | |||
| 8b47e96af1 | |||
| 0fbd039554 | |||
| 2c6ef8c875 | |||
| eb38c059d8 | |||
| 8a43ebac28 | |||
| b4d765b130 | |||
| d5581531de | |||
| 62dbb1b06a | |||
| 6e88df28cb | |||
| a6b8366980 | |||
| 9d06a1b64b | |||
| 7b3e7b7055 | |||
| 53235263a3 | |||
| adb861fb3b | |||
| 227473e88c | |||
| df814dd374 | |||
| 1e245aa54b | |||
| 815bfbf383 | |||
| 7ac4349710 | |||
| 08d085f2c9 | |||
| 96a2297e15 | |||
| d64d7aa5d1 | |||
| d5d9d4bd3d | |||
| 5e76b26225 | |||
| 4ff538af58 | |||
| 4e8aa43a90 | |||
| 6d18435098 | |||
| 2c711d0b05 | |||
| 5a00628ed3 | |||
| dfcc1d16c5 | |||
| 6259e13a0c | |||
| 790cc5b65a | |||
| 94cd8ef12e | |||
| 5b027e517e | |||
| d625cb45ea | |||
| 8177c4620e | |||
| 4d3e423443 | |||
| 95027565c4 | |||
| 1575cc6908 | |||
| 260e082ed1 | |||
| 3b591a48ac | |||
| d13ec90f37 | |||
| 132e5aa97b | |||
| 740ce2d440 | |||
| 91e8d0ba3c | |||
| a70ee4e3bb | |||
| 2d05db171a | |||
| 501a78e134 | |||
| 591c12d22d | |||
| 1684c57922 | |||
| bc6de21fe2 | |||
| 5e28952cbd | |||
| 0320a718e8 | |||
| d6fb3d645f | |||
| e919d96ff2 | |||
| 69c8d1010e | |||
| a284569a7c | |||
| 54c31ad98b | |||
| 5ad74c6d10 | |||
| a34dd8bb1b | |||
| c5d040beb9 | |||
| b1c2c43d6a | |||
| c404862cba | |||
| 2a62fb4a2d | |||
| afcdc58419 | |||
| dc1ffa79e7 | |||
| c8b466b7b5 | |||
| 5a0863ccf0 | |||
| 0c89a8b771 | |||
| f81e5f51c1 | |||
| 74b8ae9372 | |||
| c9bc4f8203 | |||
| 88a64a802e | |||
| 18691d1a6f | |||
| 30c3c6c16e | |||
| 147dc89054 | |||
| 785f65183c | |||
| a5af0adce4 | |||
| d89e51ac42 | |||
| 717fbc45cb | |||
| ac30219a6a | |||
| 42fab12584 | |||
| 6b17b33430 | |||
| 5dbde1a5c9 | |||
| 7c6e289782 | |||
| 86de1e8b6c | |||
| d210847e28 | |||
| a290e13099 | |||
| 97bba5adaa | |||
| d59306bd06 | |||
| a28aafdc85 | |||
| 88754d0b36 | |||
| 2fc24fc8d4 | |||
| 3a3c87b1a6 | |||
| c1d9da4052 | |||
| a81b0d0b21 | |||
| 276b32a5ec | |||
| 4fc19ddb8d | |||
| 0892f877b8 | |||
| a4596cab05 | |||
| ccc175a9ed | |||
| 2336bd3e8e | |||
| cc27aed391 | |||
| bc50d373e3 | |||
| b0db207e4e | |||
| cafe5eb985 | |||
| 8335676b0e | |||
| 96ff934ad0 | |||
| 7a6a9d1516 | |||
| f799475d93 | |||
| fbbaf3365b | |||
| 4147005b0c | |||
| 446cd9f5fb | |||
| b709eae01d | |||
| 4072e853fe | |||
| a3b9fac30e | |||
| 3f16692dad | |||
| 6b0c9f4e77 | |||
| 81dbe643a0 | |||
| 9cbe8b340c | |||
| 3c80a42866 | |||
| 3d7a93876a | |||
| 98967feeb2 | |||
| 206a239448 | |||
| 93cd2ecb73 | |||
| c30fad9955 | |||
| 88fa71ecd5 | |||
| 24d1bb668a | |||
| 4e8b2fa659 | |||
| e2d2ebc8fc | |||
| bc8f442d00 | |||
| 8f8fd84f1e | |||
| 4a9db80cb9 | |||
| 8c9a831596 | |||
| 99589794db | |||
| b2970b96e5 | |||
| 7c5f6bc2c8 | |||
| 887985413c | |||
| b18cf4ba42 | |||
| 39a752e398 | |||
| 49c0e4370d | |||
| e0137d4cbe | |||
| e708b096cf | |||
| 47d4ebb734 | |||
| 634710d795 | |||
| c7315e8779 | |||
| 0b6becd49f | |||
| 6ff283bebc | |||
| 88a3f95715 | |||
| d5ca39e9a2 | |||
| 16fa1834e5 | |||
| 7d01facdb8 | |||
| 8bfcb65924 | |||
| 8d105825e9 | |||
| 36951d5838 | |||
| f99bc4e0cf | |||
| 25fe191202 | |||
| 014ce9c6e6 | |||
| a1948250ab | |||
| 1f18fea1de | |||
| 1a41a503e0 | |||
| a71caa28e7 | |||
| 3742c16948 | |||
| 08d5e4a9b0 | |||
| 02722fcc03 | |||
| eb03304b70 | |||
| c463b8a67e | |||
| 4e18cdc186 | |||
| 8d908fe2c2 | |||
| 47003aebec | |||
| 34e5863cd5 | |||
| b7aff6363f | |||
| 9a11de924d | |||
| 7201e6707f | |||
| 561d1061fc | |||
| 50501a751e | |||
| f0de978a9e | |||
| 16408a1dcf | |||
| 0b3acb286a | |||
| c52625018b | |||
| 26dddee1c0 | |||
| 14f98dbb58 | |||
| 9938a85558 | |||
| c22db8104e | |||
| 2a45f99fc4 | |||
| fb9345814b | |||
| 72bbe63ec7 | |||
| ec88e9d6aa | |||
| ed12acfb0a | |||
| 5e8e8bb9f0 | |||
| 561d0eead3 | |||
| e2362ce74f | |||
| c08c6e1b84 | |||
| 16791134c1 | |||
| 76273ecd8e | |||
| d89a62e0a6 | |||
| 089f9b95af | |||
| 8740d8f7f3 | |||
| 09369d265c | |||
| 1bbdf2005d | |||
| c8a0639afe | |||
| 3f6c8245aa | |||
| 408055dfab | |||
| aa4b901788 | |||
| 8f0d4d4a41 | |||
| 046121e080 | |||
| 06e678d6ef | |||
| 8d3d181207 | |||
| 8769b19860 | |||
| a615329423 | |||
| 7a14f6c595 | |||
| a549ec673e | |||
| 76b538c226 | |||
| 7deed7a769 | |||
| 9416743a10 | |||
| d6975f8e07 | |||
| fac768cd2c | |||
| 5e6fd491f3 | |||
| 6a8d977d22 | |||
| 3c552e6e03 | |||
| 5d31ad0eb9 | |||
| 80ae402387 | |||
| c1d6e39aab | |||
| d857ab5702 | |||
| 42fe56031f | |||
| 171fa40bc8 | |||
| 005a35b02a | |||
| 84fafa7832 | |||
| e09ccd1449 | |||
| a60ae0f18b | |||
| 66ec91bc45 | |||
| 1c3410aa75 | |||
| 1f0e7cdf04 | |||
| 160bf1a6eb | |||
| 1eb55e2864 | |||
| 4b8b92c8bf | |||
| affe2456ea | |||
| 71aaca2d9d | |||
| 4b16e88747 | |||
| 93bc3b657b | |||
| 141130db27 | |||
| e45b49eab8 | |||
| 62bab225c1 | |||
| dc14c72e53 | |||
| 6b9bda872d | |||
| 6d8017d07e | |||
| 24fc709533 | |||
| f491e98d37 | |||
| 1cf4db9615 | |||
| 98c3a79b57 | |||
| 17bc2dabe0 | |||
| c797195f1d | |||
| 27d4293db6 | |||
| 26cf47a2be | |||
| 397c946141 | |||
| 2d4fb93087 | |||
| 54dec0cad5 | |||
| bbb9a17872 | |||
| 6729fec74a | |||
| 4ae655c368 | |||
| 324eda228c | |||
| 2dc086563f | |||
| 386848174b | |||
| d693d89d99 | |||
| ff16696c9c | |||
| ca6f95a7da | |||
| d514cdd26e | |||
| 85a9bed49e | |||
| ec825d8999 | |||
| ce0068c21e | |||
| bc14f8dc89 | |||
| 7b5ef46371 | |||
| c11acfd9d3 | |||
| ffb0ae76e3 | |||
| dc4869eb23 | |||
| 8ea1fc87c9 | |||
| 0d91b620b7 | |||
| 81336aefb5 | |||
| 7ddbfe181e | |||
| 48dd186870 | |||
| fbf235661e | |||
| d1b1e17d23 | |||
| 6e8d885ca7 | |||
| 0ccfd2dbd3 | |||
| 580b7ab816 | |||
| d3ff81b37f | |||
| 1b1dd0ca2c | |||
| e0149921b8 | |||
| 628a6e2866 | |||
| d50e608a4f | |||
| 6ab8d6a67e | |||
| 3210a8653b | |||
| 96163c87e3 | |||
| 3a1c020b7d | |||
| cfc9f840a0 | |||
| 5e7e9acfa4 | |||
| 8b778fa20d | |||
| e7397844f8 | |||
| e02c378745 | |||
| 597654db00 | |||
| 5fbf494511 | |||
| 7a8f269457 | |||
| 4a194b3a1c | |||
| 3dac7bbed7 | |||
| b159b3fee2 | |||
| e734b42fc2 | |||
| 40172c22d9 | |||
| 6f88199db9 | |||
| e8c60f92e3 | |||
| 2894059775 | |||
| 74738721dc | |||
| 450c569d78 | |||
| 4bf9ab41f8 | |||
| 83277ff916 | |||
| cb3f2ab900 | |||
| 109778c17c | |||
| ed704d82b3 | |||
| a55b7d1372 | |||
| 5a0bff465d | |||
| 4135bf9707 | |||
| 429b2242d8 | |||
| c10a097fa8 | |||
| cb7dbf8297 | |||
| 7c75b8aa89 | |||
| 08d109d877 | |||
| 3ac4add548 | |||
| 3aa7ff74b0 | |||
| 994cf9b34b | |||
| f6cd8032ba | |||
| 051cc9e446 | |||
| 54ce38c2e5 | |||
| d506e3b1a5 | |||
| 113443470c | |||
| 35090c1bf1 | |||
| 04204b8fb9 | |||
| 5e00787199 | |||
| 62f2c0531b | |||
| 4fc9fd3efe | |||
| 6d00281593 | |||
| 2b0b0bb186 | |||
| 6766b2de3b | |||
| 4942bd19e2 | |||
| 82a63f6389 | |||
| 488dd562fb | |||
| 61294a62af | |||
| f8157ac854 | |||
| 65b45726b3 | |||
| c019e7c5bb | |||
| de74c8c62c | |||
| b61faf8368 | |||
| c4f76cfa15 | |||
| 6339027a7a | |||
| 46db8a98b0 | |||
| c2077f0034 | |||
| ee4d8380d3 | |||
| 5772512058 | |||
| cd2da98d4d | |||
| e633ee9ed3 | |||
| 3bdf4bfd29 | |||
| 3b9381dfb1 | |||
| 07b1b472c0 | |||
| 4574ce45b6 | |||
| 5ed20f32cf | |||
| 14ca3aeb79 | |||
| 1d2ab4f41c | |||
| be3cfa0f90 | |||
| fcf35e5722 | |||
| a035b235b4 | |||
| 848fef5b6c | |||
| 85627ffa91 | |||
| c12076fb7e | |||
| d4e6236b2b | |||
| 5a75065659 | |||
| cb14ea3c5c | |||
| 7392d83738 | |||
| 28dd490726 | |||
| bc810db320 | |||
| dd01889434 | |||
| 731e199038 | |||
| d4d8d2ed97 | |||
| f81b80fb39 | |||
| 3fb25b604b | |||
| 742e85be7c | |||
| 69c3781043 | |||
| 0762479dd5 | |||
| 049701eacd | |||
| f85eb5b725 | |||
| 9af5af8fff | |||
| d2832ca7a9 | |||
| 2bd75a44bb | |||
| 2a4ca65404 | |||
| 3f49408fb6 | |||
| e7719ded56 | |||
| 668a648bc6 | |||
| 02fcc75bb7 | |||
| ae270b0d89 | |||
| e029096ca4 | |||
| 76eee35971 | |||
| bfff03c0d2 | |||
| 76fca3aec8 | |||
| 74c9130a59 | |||
| 15d5174139 | |||
| 05077f70f1 | |||
| faf5820f03 | |||
| 0eba5112c8 | |||
| b13bdb0249 | |||
| c028c56965 | |||
| 98716177ae | |||
| 52eeebecda | |||
| 6a5bbfc4cb | |||
| 8372b4f923 | |||
| cc1c18098c | |||
| c72281ea45 | |||
| f2a311dc4a | |||
| 8b162e39b5 | |||
| 62eb4568be | |||
| f8bfa560e9 | |||
| 212221d6ff | |||
| c239e1af8d | |||
| f590fcdfe9 | |||
| 9bded169e8 | |||
| dc739dcbe3 | |||
| fd07cc6290 | |||
| f9d9279320 | |||
| abdb20a6bd | |||
| 3e74681e77 | |||
| f6b614a7c5 | |||
| 458697be32 | |||
| af7ec04b78 | |||
| eae2384178 | |||
| 6db2d0ea39 | |||
| 3fe65ef467 | |||
| 525a672862 | |||
| aace774961 | |||
| 6fec54f17f | |||
| 58f635312a | |||
| 3dfc0a44f8 | |||
| be3c5ca504 | |||
| 4cb0926f11 | |||
| 5b6112000c | |||
| afb20119b3 | |||
| 718d0ba2a1 | |||
| 591e30b7b6 | |||
| 24f561a9a1 | |||
| 32b4eee9a3 | |||
| c5a6cae898 | |||
| 63b466901f | |||
| defcf20042 | |||
| b119b564df | |||
| 28986d2f2e | |||
| 85566faeb2 | |||
| bfd05d9646 | |||
| 574f3b89e1 | |||
| ca755ce799 | |||
| fc01c51c13 | |||
| 21c5d623d6 | |||
| 4f8af2dceb | |||
| a81b07ce91 | |||
| f55d2716a8 | |||
| ae54e6de1d | |||
| fb950c6166 | |||
| 6fb1e843cf | |||
| 78deae5a76 | |||
| e298476a90 | |||
| a5e042cedf | |||
| d57593c148 | |||
| 7c47ac7193 | |||
| 8f70c8867e | |||
| b3b83b558e | |||
| 783ac759a9 | |||
| 25eeb80b18 | |||
| 3eb2d43b06 | |||
| ecae978cb5 | |||
| e192fac276 | |||
| 3458c1e854 | |||
| dee772a55f | |||
| 1051db3802 | |||
| a8f35b6c25 | |||
| c366de3626 | |||
| 80d8da0564 | |||
| fd7c4ba8f0 | |||
| 8dd744fc18 | |||
| 828fe365ee | |||
| a65c03bc0d | |||
| 1e815f3308 | |||
| d74605641c | |||
| a9f994f063 | |||
| ef0273fde1 | |||
| da3a9ae18b | |||
| e3391cd65f | |||
| e9e177f53b | |||
| fe38eae6cd | |||
| 915ca181ba | |||
| a0a8bbb57f | |||
| 1ffcb10bd2 | |||
| 10c8fcd3b8 | |||
| cafd900ad6 | |||
| e667ec9533 | |||
| 5ac4d93ae3 | |||
| 0550d13aee | |||
| d95cdaae8e | |||
| 4a9cc8b491 | |||
| 6bd6b76d11 | |||
| 13a6ec753a | |||
| bda61cd5e5 | |||
| b42b05311b | |||
| 553c8fdec7 | |||
| 9a7e4a0112 | |||
| e141d8917a | |||
| 08840b9f8c | |||
| 0c858e2071 | |||
| 4625192940 | |||
| 2a09e50d09 | |||
| 04109f8bee | |||
| 8ef7655e7b | |||
| a05312f1b7 | |||
| abf6024faf | |||
| 6089f11c2f | |||
| 3536587665 | |||
| 7d17acfb2f | |||
| 4961a51cc7 | |||
| 94a0b8f573 | |||
| 0859c70936 | |||
| 6481b05e4f | |||
| c739d1976b | |||
| f6db5c1f30 | |||
| 2f2604d673 | |||
| 0413d58860 | |||
| 86bd4d7389 | |||
| 52d42d6e03 | |||
| 4c8642b70a | |||
| a57e638f57 | |||
| a4cee9ed37 | |||
| 6e5bf05211 | |||
| 65ef662a2b | |||
| 8b8ee57a1a | |||
| a94cf0509f | |||
| cf6e32fc54 | |||
| 3a3e643eb9 | |||
| 462d6fa2b2 | |||
| 70138680cf | |||
| e63b09c9ad | |||
| 3db4393b58 | |||
| 57630d2a64 | |||
| 2b4e023180 | |||
| b5daea6d5f | |||
| 4088540aef | |||
| 09e5888ca8 | |||
| ce51655c81 | |||
| 6dab43c3a9 | |||
| 7579828180 | |||
| 342265d290 | |||
| 5cdf2a8fdf | |||
| fbfe19d6db | |||
| ee14987721 | |||
| 5a398018ee | |||
| a73ad8cc8c | |||
| 46ce0cfa33 | |||
| a51e181e3b | |||
| db58acead1 | |||
| 2b046d79e1 | |||
| a56258945a | |||
| 0a87a4e75b | |||
| 7dcc7b372f | |||
| 9e13852135 | |||
| c9bdb1f0ae | |||
| 7fe5326c2d | |||
| b12af48a7d | |||
| 0db97c9681 | |||
| 88e4b69bfb | |||
| e6f26b46fc | |||
| 7006e4e3e6 | |||
| d244b81972 | |||
| 5b28259dac | |||
| efb5b0a28f | |||
| abeb0fbf5c | |||
| caba6b93ef | |||
| e2fa301bfb | |||
| 29eeb2828e | |||
| 75d422feca | |||
| 6f23efa970 | |||
| 1b27c13096 | |||
| f77fd4667e | |||
| 6af4ed6169 | |||
| 01f2ff1ba1 | |||
| 296223f876 | |||
| 0c4de6721d | |||
| 024cc50df4 | |||
| 6241995ad3 | |||
| d02cc020e8 | |||
| bc5c8e2c9c | |||
| 7237b1672e | |||
| 5e34a84d4a | |||
| 38448c104a | |||
| 8a5b67fb79 | |||
| aefcb3e8aa | |||
| fb36326a58 | |||
| 9b4326d91e | |||
| 6edb6dd1ca | |||
| 0ec7f4c25d | |||
| cec4f2ef57 | |||
| 52188a2127 | |||
| 83644fdb6a | |||
| 56d4063e92 | |||
| 1baa009266 | |||
| 1d2e15fbd7 | |||
| e3cbfcd44b | |||
| 4ac1070cd3 | |||
| bb2b687b46 | |||
| 38c1dd098c | |||
| 494cc6d3a5 | |||
| b174f067df | |||
| 7072b623af | |||
| 4a6d82acb9 | |||
| 9253c614d2 | |||
| 049ff9a3c7 | |||
| 73425c22d8 | |||
| 832ff3b9f9 | |||
| 635e36ff08 | |||
| 6618f9f184 | |||
| 7fcacb549b | |||
| 541e82144f | |||
| 18668870fd | |||
| 694f169832 | |||
| 7279273ebb | |||
| d89f2a4ac6 | |||
| 48375aa908 | |||
| 29957d4a47 | |||
| 4b152bd8ce | |||
| f782943099 | |||
| 3da0cf698f | |||
| e1c0f3eaef | |||
| 8bcf0ad7ab | |||
| 56b3b7a487 | |||
| bbd68b721d | |||
| 2d1e82c901 | |||
| 9a385dcb45 | |||
| 3dadd40034 | |||
| 566a774222 | |||
| 865dc9365c | |||
| 0500c9e53e | |||
| d3c5bdf4de | |||
| 7e41bf2259 | |||
| 6c1a634053 | |||
| f88e555234 | |||
| 87826f807a | |||
| b8fdc620aa | |||
| 466cf05912 | |||
| 8467143f2a | |||
| c346c09b01 | |||
| 3935b907d4 | |||
| 4e2641a915 | |||
| 973b0f883a | |||
| 6d97f09195 | |||
| 1c1ebd765d | |||
| 9eba3ef29a | |||
| e4696f7315 | |||
| 23b3807ea7 | |||
| 15b92e4097 | |||
| 922058dbc8 | |||
| b9e2c7896d | |||
| 9fbc1d71c0 | |||
| 3ae911b442 | |||
| eea376911b | |||
| 1db3037808 | |||
| 556e366ce5 | |||
| 6842518b1b | |||
| 8a775cd8d4 | |||
| 4d0f8c1da8 | |||
| 27e09007cc | |||
| 00128bd260 | |||
| f710bafae8 | |||
| 788d338c9b | |||
| 6f50f6e1ef | |||
| fd111df16d | |||
| 17958adaca | |||
| 0a05f6fa45 | |||
| 78103f3137 | |||
| f7da53cebd | |||
| 75f6dbb86c | |||
| 9d5f77db9d | |||
| b0cf6fbb7a | |||
| e3661abe84 | |||
| 1488d4f678 | |||
| adc50d465c | |||
| f6efd8aced | |||
| ad3c18eb5f | |||
| eabec630b9 | |||
| 406c83649b | |||
| 5f50b9f6e0 | |||
| 1b37c21da5 | |||
| 7144ec8db4 | |||
| f31bb101ad | |||
| 7c754d0665 | |||
| 5f7eda1f98 | |||
| f8f6d56c58 | |||
| 8ad458e955 | |||
| 8ea06b75aa | |||
| c3ae4790c7 | |||
| 5cd86f740d | |||
| aa06c9fbc1 | |||
| 100ca0b8a2 | |||
| 8669481309 | |||
| 1dc4a319ab | |||
| 08ba72afa2 | |||
| 0a905d674b | |||
| 319afebdc0 | |||
| f1e92dd184 | |||
| 9048e565d7 | |||
| 95dec684ad | |||
| 0d40f705a7 | |||
| df8a0fe8dc | |||
| 50a9b4d1e7 | |||
| 2e30b9f382 | |||
| 23869e5b2a | |||
| 3ba2a1354f | |||
| 903df56837 | |||
| 4a53ee5a13 | |||
| cfd6e7eab9 | |||
| a98814b930 | |||
| 10c763da6f | |||
| a020a55f9d | |||
| 6552adafb2 | |||
| 5756e31999 | |||
| 8ae9f0914b | |||
| 3c4a18f0df | |||
| 165e6f1948 | |||
| 750a17653d | |||
| 07b48484ff | |||
| a664fb1e45 | |||
| 2e6ef74593 | |||
| 440b65bf77 | |||
| df7996b671 | |||
| 9a698e6b7b | |||
| 915109b2c4 | |||
| 2fa86736dd | |||
| b9125001f0 | |||
| f17624194b | |||
| 7360a2532d | |||
| 72eb905c58 | |||
| ad90dbdaff | |||
| e0a2b195e4 | |||
| 1c676ac0ec | |||
| 538b6d21b1 | |||
| 3157aff844 | |||
| f4898a2e3a | |||
| 555be63c90 | |||
| 057efbfe95 | |||
| 585db1f667 | |||
| 7f6a1666fa | |||
| 0c621246d3 | |||
| 5bd798c6e1 | |||
| 5ecd2b850c | |||
| 243adff49c | |||
| 378531b709 | |||
| 9584c23594 | |||
| 64f20ec624 | |||
| 783e928ae8 | |||
| a673994de5 | |||
| 9b0e27c98c | |||
| a3712a3288 | |||
| 74e03de760 | |||
| 09e302384a | |||
| 3dc374ddcf | |||
| 90a72f9acd | |||
| 7c1625b0e0 | |||
| cd443f0d5b | |||
| d5194725b7 | |||
| 82e3ec3afe | |||
| 682def9f89 | |||
| 96aece07f3 | |||
| 508a879ef0 | |||
| 5171e46c47 | |||
| 1ee939e7c4 | |||
| 59f33c1cc1 | |||
| fb95a8b34b | |||
| d104ced953 | |||
| 1fd54698ff | |||
| 2658e01baa | |||
| 9612b891c9 | |||
| 27fc833550 | |||
| 0b3e0d74b0 | |||
| d75b4cf613 | |||
| 5aab6ff81b | |||
| f076ff5dbd | |||
| b8ab763581 | |||
| 78a9821129 | |||
| 5dbbda5435 | |||
| b1e0aa487d | |||
| 6505e28c40 | |||
| 7adf0d88a0 | |||
| fc004c0ad2 | |||
| f07c39be8a | |||
| 29ffe6f426 | |||
| ec63c604ab | |||
| 69ca2ad676 | |||
| 3d587f3043 | |||
| ae1e384a9a | |||
| 954f6110d6 | |||
| 4390b8df12 | |||
| cb88e15b33 | |||
| 1705067e65 | |||
| 618a735816 | |||
| 136de91049 | |||
| 103ff8e23d | |||
| e2bf45f262 | |||
| cdb929aada | |||
| 93d990c653 | |||
| 62af16b9f2 | |||
| 3dfd02b4b4 | |||
| 7a7bd8f6d7 | |||
| 16312fcfb9 | |||
| a81a88cca0 | |||
| 5acedf5027 | |||
| 566c601d41 | |||
| ba1d773176 | |||
| 583146f9d6 | |||
| c789941d76 | |||
| 232c355b3a | |||
| 773c7265e8 | |||
| 742c436d28 | |||
| 15214a53ce | |||
| 36b855972b | |||
| d5f4862405 | |||
| 735c03fcf3 | |||
| 4a1985f870 | |||
| 4519c237c5 | |||
| ac8279a0a5 | |||
| 7cab19a2e4 | |||
| 4ee9fd77fd | |||
| 556cdf5f1a | |||
| c760fe9a2e | |||
| 24a0bc23cf | |||
| c3178ff942 | |||
| f8cc8b844a | |||
| e341bdc1b7 | |||
| 09734e8028 | |||
| 7d20d0e2d2 | |||
| 0059b17dfc | |||
| e733b24dfe | |||
| f7c8252611 | |||
| e66e3ca523 | |||
| 24660c3e48 | |||
| ee6348a7a0 | |||
| a44303c373 | |||
| f49e9ee41b | |||
| 1ba03b164a | |||
| 9c1e703990 | |||
| f2112be4d8 | |||
| c82895fb65 | |||
| b840341a77 | |||
| ed7623273a | |||
| 9425a7e0ab | |||
| 93438eca0b | |||
| e28615628b | |||
| fa64a1ced0 | |||
| 0f553e7f9e | |||
| f4e57fd529 | |||
| a0e2bca79a | |||
| 63a0343dda | |||
| 5db7413827 | |||
| d163aeb80d | |||
| 60205944bb | |||
| 03832c130c | |||
| 9f93e25b88 | |||
| afaebc3869 | |||
| fdf57a9788 | |||
| 5609cd4c74 | |||
| a0323d446c | |||
| 0db76e98f9 | |||
| fa33fbce75 | |||
| bcc7192af7 | |||
| 0d27b7a7ff | |||
| 6d202894b6 | |||
| ff300b10e1 | |||
| 18c7efe800 | |||
| 0931062a3f | |||
| 3b4c951838 | |||
| c2c08af16d | |||
| 9e49be41b6 | |||
| dd86c97e18 | |||
| 5a8e6bda51 | |||
| c34211417c | |||
| 974c534210 | |||
| 5a58fd2de0 | |||
| faec973e09 | |||
| 65b7e515a2 | |||
| 318c4b44ea | |||
| b6e5187973 | |||
| 1e8cb4b4a4 | |||
| 9daa0d4d2f | |||
| ceb7324657 | |||
| da00d28cb7 | |||
| c23d5e0143 | |||
| d8658dbc47 | |||
| a6a4c042f5 | |||
| 6be0b410dc | |||
| 051d340171 | |||
| 0a4233f0f6 | |||
| ecc66719bd | |||
| 03d51c5677 | |||
| 268c6ab36c | |||
| 0786f31f22 | |||
| 883116e4af | |||
| 5748034cd3 | |||
| 061e7f0da7 | |||
| a138dc3970 | |||
| fa2b204535 | |||
| 73c7af102b | |||
| 18a8ae5a8a | |||
| fa65bf89be | |||
| 60c8b0e02f | |||
| acac4a7fca | |||
| 6be5ffe54f | |||
| ba843f0ad9 | |||
| 4297be6ac1 | |||
| 7d02933da3 | |||
| d2003a6fff | |||
| ef0483b4be | |||
| 9e51b2e5df | |||
| 951e946e71 | |||
| 1fccf6fa53 | |||
| 7f8fc584de | |||
| 1d1d2ba661 | |||
| 520bf7ac61 | |||
| 85f50d3e06 | |||
| e12cb97e16 | |||
| a3a7e6fa34 | |||
| 3881175d72 | |||
| ef32c04795 | |||
| 42da4d6867 | |||
| f7bb84ce4c | |||
| 5bd1c0d063 | |||
| c67d81bae1 | |||
| a5d1ac7ed0 | |||
| b8187aa529 | |||
| 877f440331 | |||
| 58892471a3 | |||
| 90ed1af972 | |||
| 21344b91ed | |||
| 3f9673c177 | |||
| fce2513827 | |||
| 3debb8820e | |||
| d3a4e31fe2 | |||
| 25ac33486c | |||
| 5803e11663 | |||
| b33372cc92 | |||
| bcb2b5d1cd | |||
| 3f2a2b5f62 | |||
| 4972bf4f23 | |||
| 3d2e5c0310 | |||
| f547b6ff27 | |||
| 5272799bdd | |||
| 1a230e3aa5 | |||
| 679b7d147c | |||
| 8effd1e02a | |||
| cb19930b83 | |||
| c6b07b33c5 | |||
| 47e37975c9 | |||
| 5472eedbad | |||
| af95fe7a93 | |||
| 705b0b0001 | |||
| 35c931126b | |||
| 6aada9d356 | |||
| da9161fc91 | |||
| 1e78adc28c | |||
| fcdf8f4618 | |||
| 8533499507 | |||
| fb4659c5d7 | |||
| a1408a3411 | |||
| f06738828b | |||
| b6b1c0130b | |||
| ea305cf32e | |||
| d41102d6c3 | |||
| 0c27ecc536 | |||
| 0f55c18595 | |||
| e5fbbda9ba | |||
| 7650210ad6 | |||
| ba125961d6 | |||
| 2bb06b1af4 | |||
| 8108f2f9b9 | |||
| 08dfaab829 | |||
| d1c121b599 | |||
| e98b187e64 | |||
| 87326f7313 | |||
| 7f3eee750a | |||
| ace35fdeda | |||
| bf4c9d700d | |||
| c7d99531a7 | |||
| ca7ee098ca | |||
| ec8efd52b4 | |||
| 9a83ced46e | |||
| 0d7bf01ac1 | |||
| 1229c28ce0 | |||
| f7ca35c9c6 | |||
| c08d1439dd | |||
| 09d437c1f9 | |||
| 492d4ac013 | |||
| 870ea2a88a | |||
| 29f4a38c0d | |||
| 1ada3b633e | |||
| 0ce14a078a | |||
| 45b81c969f | |||
| cfb7f80003 | |||
| 628dea7a08 | |||
| 22de765f3c | |||
| ae4e9845de | |||
| 95dc7525ac | |||
| f1cce7e223 | |||
| f2fb8cf23b | |||
| 9f900f6dba | |||
| 91f16a7e47 | |||
| 6bc2ae3731 | |||
| 885b76f66f | |||
| ded2b0a55c | |||
| 0f08b1d099 | |||
| aaa5ef81cf | |||
| cb791a1b21 | |||
| 0b489f4d79 | |||
| c187517395 | |||
| 89e2b7424b | |||
| 1f06fd7e66 | |||
| e5da0986bb | |||
| 0fc9578fe6 | |||
| b1ea59e814 | |||
| 7d48d79b53 | |||
| 6d5a73815d | |||
| d1f336d8fd | |||
| 48072e439d | |||
| 9700e6b4bd | |||
| 722879b32d | |||
| 943a663a31 | |||
| 2acb1abb1f | |||
| 4eb8d2bb10 | |||
| 04fc35707d | |||
| 09014f90f9 | |||
| 0c667ca32a | |||
| 7c4a2a0a29 | |||
| c801c8d2bb | |||
| 98e862e162 | |||
| b9d72d2991 | |||
| c6612871fb | |||
| b991fca341 | |||
| ef3bbbcf40 | |||
| 32f0fe5d08 | |||
| 6d987f1418 | |||
| de99bccbfd | |||
| 0cc882ef9d | |||
| 3f4420527b | |||
| 21d06999f6 | |||
| f3803d3a5d | |||
| c6da044dc5 | |||
| 02a6b05bde | |||
| 242400e9ea | |||
| 8c1daaab57 | |||
| 7f62c8e145 | |||
| e2876b947d | |||
| ed3a513f86 | |||
| b72088a90a | |||
| 8b58fc7191 | |||
| d9fa59f30a | |||
| 13e2132b69 | |||
| 298e1b5fdc | |||
| 5294f3b9b7 | |||
| b191e67552 | |||
| fac773ac99 | |||
| 82769e54c3 | |||
| 022f2bc177 | |||
| ccf79ee483 | |||
| ecf0725dd1 | |||
| d3ef93a9a5 | |||
| 47a7a575e8 | |||
| ff8fe4be7e | |||
| d7a6e7be2e | |||
| a81e948fc9 | |||
| ccfd370b89 | |||
| 91516b2318 | |||
| 52f7b6e03b | |||
| 64ab594ad6 | |||
| 394987f365 | |||
| df4b317fb3 | |||
| 142f6c3f05 | |||
| 414adb94f0 | |||
| 7ee98cf525 | |||
| d418da6b91 | |||
| 2a0f2a8ba8 | |||
| 5513dfd3cf | |||
| c18ffd7c81 | |||
| 424ab2a024 | |||
| e2b97d6712 | |||
| 217a616fde | |||
| 56de324afe | |||
| fa36244bec | |||
| 4fe31f8d4d | |||
| cfa9ad9943 | |||
| fd981ad315 | |||
| 5f9a86a8f2 | |||
| 956d6632d9 | |||
| 0c7b2ec09e | |||
| 4cbcaf35e4 | |||
| 73baf0b635 | |||
| 78dc37739f | |||
| ac0a4327a9 | |||
| c20e620a06 | |||
| 4bc45e35c2 | |||
| b362e886ec | |||
| ca38899ede | |||
| 61973af29f | |||
| 087d314daf | |||
| 6e3de4d48a | |||
| dc3f92210b | |||
| 1ff8a97d11 | |||
| dd226e1987 | |||
| d0f67f99a7 | |||
| e156b617b9 | |||
| 837828967a | |||
| 3843c9beb7 | |||
| c75b016919 | |||
| ad290e7181 | |||
| 364da52a49 | |||
| e50e496f5b | |||
| c4be4d16e8 | |||
| 6f40ed3fbf | |||
| 57551c8516 | |||
| b7452960be | |||
| 32f55009af | |||
| a4320108d5 | |||
| 05085aa605 | |||
| 528c23d679 | |||
| 715ec806f0 | |||
| 5bb8d0245b | |||
| c986dfb256 | |||
| 6d5ef3ef5f | |||
| 2663c5ee0f | |||
| 1075898b06 | |||
| c7705712ba | |||
| 13e113df81 | |||
| cca71ab709 | |||
| 8b10cb38d8 | |||
| 3e139baa50 | |||
| b6513f6ad7 | |||
| 4ca719bf8b | |||
| 3216fd9729 | |||
| b734bf3fa5 | |||
| 3b10205c8e | |||
| d2ab599bd3 | |||
| 281bcb747e | |||
| e03c05774b | |||
| 05d1618d01 | |||
| 885378e421 | |||
| 0292d793f3 | |||
| f4566aaade | |||
| d8a5ffeee9 | |||
| 9edee8a7a8 | |||
| bbb245fc43 | |||
| cd6f52997e | |||
| c4e5daff86 | |||
| 96a7113a16 | |||
| 21ceabc77c | |||
| 7c19c56844 | |||
| 63a3665a17 | |||
| 92a60b2587 | |||
| a0f6bd3926 | |||
| 402c6ab4cc | |||
| 6668a4d05c | |||
| bd0778461d | |||
| 0408e51ae6 | |||
| 5b5d91c9d4 | |||
| 1bc923b6a2 | |||
| d704b5257b | |||
| 06ae096586 | |||
| 0f9adc1749 | |||
| feb7ead005 | |||
| 7415ebe8bc | |||
| 24c37c1f9e | |||
| c8bef057f8 | |||
| 97894a140d | |||
| 4476a2d531 | |||
| 7554ea84a3 | |||
| 3118bb33ac | |||
| 7c3606a19b | |||
| d6616fdb0d | |||
| c8aab57d8c | |||
| 3ae631c81d | |||
| 0afba1fb9d | |||
| a65bcfdbe8 | |||
| 60a73c6365 | |||
| 5112b6b1b5 | |||
| 865aae0106 | |||
| 5ccecab631 | |||
| a3c6e5f088 | |||
| a8d6f13c94 | |||
| e7b22483af | |||
| 90058040f0 | |||
| 63c89c772b | |||
| 9975a1a0c2 | |||
| eb34ae67ff | |||
| f1db30955d | |||
| c173392e15 | |||
| c9630526e2 | |||
| 8176a901a9 | |||
| baaadde3c5 | |||
| 68ad1ed18f | |||
| d14007d035 | |||
| a949d4e2bf | |||
| ed2c289c2c | |||
| 7acd60d152 | |||
| 0449062126 | |||
| 65e4ffde58 | |||
| e2813df879 | |||
| ca19cea05e | |||
| 3296ca7219 | |||
| cb458f3250 | |||
| 21d2b90d74 | |||
| ab19138f1f | |||
| 970122a9d5 | |||
| 62065cf043 | |||
| 03b61e074e | |||
| 1350f49939 | |||
| 1c22c79a32 | |||
| 08cea10aa7 | |||
| 82147dc2ee | |||
| e4d2830f1d | |||
| 19417c7cd5 | |||
| 5dfe7215a9 | |||
| 04a1b21874 | |||
| f905a14f5f | |||
| 4a531fe588 | |||
| 25dec297bf | |||
| 8e58cda8c3 | |||
| e7bded655b | |||
| 5f357d85de | |||
| 58a3368215 | |||
| 941d305044 | |||
| 1b938e39a8 | |||
| 7988c044e0 | |||
| 0ac83ce289 | |||
| 8975289c6b | |||
| 6102ddf675 | |||
| 5a67a69f80 | |||
| f2512a4f7b | |||
| 06be0ab39a | |||
| d775e315cc | |||
| e4a8a5533e | |||
| 88dc1ca6fc | |||
| 1e0f07751e | |||
| 73abd54cbe | |||
| 7d7cbcad14 | |||
| e493fb3e95 | |||
| 8c40a5b275 | |||
| d6698c3bfb | |||
| b1e811430a | |||
| 06983a2075 | |||
| d037217769 | |||
| 410e4f8ab9 | |||
| 54d2aec232 | |||
| d006a750ee | |||
| 5376e5d349 | |||
| e5805c4979 | |||
| 73cbd6a38b | |||
| 7014d94108 | |||
| 62651e8147 | |||
| f9650b4cb8 | |||
| 249b5e9a4b | |||
| 67a71519d3 | |||
| ccdeca65a1 | |||
| fbddf5ba5b | |||
| cf0e71b4ed | |||
| 73a5903789 | |||
| 5d47aa85bc | |||
| 3eaf50005f | |||
| aec642c5ab | |||
| d0d5c2835e | |||
| 2593457503 | |||
| b56e00eb61 | |||
| 0c644cc470 | |||
| 5f92adc2e7 | |||
| ca6a5dc8a2 | |||
| cc0f89e331 | |||
| 28b95ef5be | |||
| 4237eea7d8 | |||
| 95e54173e9 | |||
| 8e980480aa | |||
| 49042f2b1a | |||
| 714f13df7e | |||
| 33047ffddc | |||
| f90700f3f1 | |||
| ab43553f0f | |||
| 9cac50e428 | |||
| bc84ea450c | |||
| 3608fb4ae9 | |||
| aa73460a8d | |||
| a20408a9e0 | |||
| 81b1e48107 | |||
| 207f315231 | |||
| c3f2ed8168 | |||
| f4c5ce3009 | |||
| 5b2de262fd | |||
| 21d19dccb5 | |||
| 19a6590306 | |||
| 8e3563968f | |||
| d839c24e4b | |||
| cdf655f770 | |||
| f5c95cc5cb | |||
| bddbbe99a7 | |||
| c4bb7b7bb9 | |||
| 1eb80ddb22 | |||
| feaf051fef | |||
| 4c997ea09e | |||
| 1c220e175d | |||
| ab4d43ce14 | |||
| 875f179fab | |||
| e84e191322 | |||
| a1b3de68c1 | |||
| b0dbe0fc59 | |||
| 6efbee609e | |||
| 21d014d481 | |||
| 7c31b98e6c | |||
| bfbbf4dfe7 | |||
| 86bfdfce96 | |||
| 9df4f7971e | |||
| f5fe378cc6 | |||
| 5183c6a307 | |||
| 80125a1be5 | |||
| 4f4d305784 | |||
| 8026a8ae2e | |||
| f9f0eec359 | |||
| 53edc70ab6 | |||
| f615fd1a46 | |||
| dd2094b86e | |||
| c247a21cb5 | |||
| a3603b9098 | |||
| 7d1c5eb71b | |||
| dba4d5023d | |||
| 5f1d8e19da | |||
| 89a90fda4c | |||
| a71047952d | |||
| 23dc15898f | |||
| bd51db5bf0 | |||
| 25b82b0db8 | |||
| a0e74cd756 | |||
| 99dca07f5f | |||
| 00947dee3d | |||
| 2d30415373 | |||
| 9113335cb3 | |||
| 76a1d7a3cd | |||
| d6e10ab786 | |||
| eaee98f227 | |||
| 4757f1c1c9 | |||
| c58d5cdfed | |||
| 5c8fa0f0cf | |||
| fcd77a4a37 | |||
| 5702a84429 | |||
| 91992eed0a | |||
| f6f918c64c | |||
| 8d166f3e35 | |||
| aae95db4e0 | |||
| 9e19d90cd9 | |||
| 53f1b11668 | |||
| 3e1519ac1e | |||
| 2c11ed59fa | |||
| bfca6bd379 | |||
| 85a081ff36 | |||
| 566519fd6b | |||
| 8077ae890e | |||
| 13b85c6848 | |||
| eda29e06b2 | |||
| 5d6a040fc3 | |||
| e557a54ce7 | |||
| b62c677420 | |||
| 8836fac06f | |||
| 77ae18f12f | |||
| 285ccecd66 | |||
| 59933b77ce | |||
| 2ec317ac03 | |||
| 3274d9db00 | |||
| c866522833 | |||
| 4edd0ee799 | |||
| 45befe6e95 | |||
| 40647ad04a | |||
| 38502031ae | |||
| 445d8987f3 | |||
| fa1cbc435f | |||
| 111cde942f | |||
| b8ccf8e0f1 | |||
| fba77596ce | |||
| f9a94788fb | |||
| 18473d0100 | |||
| 54182bf31c | |||
| 5ab6b99607 | |||
| b33b906b6e | |||
| 19a41980a1 | |||
| 6f8e672f3f | |||
| 52dc14c368 | |||
| 6148abb1b1 | |||
| a2ffe21aa2 | |||
| c876254457 | |||
| 681db1d330 | |||
| d9accb63fc | |||
| 72ccec4e6c | |||
| 54ee1c7ff5 | |||
| e855ca450a | |||
| 1efa9f6281 | |||
| d864228624 | |||
| 5274b3d84c | |||
| 9c733a7bf8 | |||
| 52c30edab8 | |||
| ba0fd11f52 | |||
| 635a381460 | |||
| 4e527a20a5 | |||
| 92b2e2800a | |||
| 5d183d0efe | |||
| 188a5fd700 | |||
| 2836b066c9 | |||
| d8a25d17aa | |||
| 5ec7204948 | |||
| 1e42749847 | |||
| c77181c976 | |||
| f9a306bbdf | |||
| c0042cd9d0 | |||
| 49eae91441 | |||
| 6a01da193e | |||
| 0fa5270f7e | |||
| 226c6bd8f1 | |||
| 89d07a2492 | |||
| f1c7e63923 | |||
| 79c30f96aa | |||
| 9fdc91758d | |||
| 18d7e24a2c | |||
| 29e20ff9bf | |||
| b2b31b2551 | |||
| 2b3aa0d220 | |||
| f2c3af4d0f | |||
| 5c19876fbf | |||
| 3ae589ebc5 | |||
| cab26fd046 |
12
.changeset/config.json
Normal file
12
.changeset/config.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
|
||||
"changelog": [
|
||||
"@changesets/changelog-github",
|
||||
{
|
||||
"repo": "OpenZeppelin/openzeppelin-contracts"
|
||||
}
|
||||
],
|
||||
"commit": false,
|
||||
"access": "public",
|
||||
"baseBranch": "master"
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
version: 2
|
||||
# 2.1 does not yet support local run
|
||||
# unless with workaround. For simplicity just use it.
|
||||
# https://github.com/CircleCI-Public/circleci-cli/issues/79
|
||||
|
||||
aliases:
|
||||
- &defaults
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
|
||||
- &npm_install_if_necessary
|
||||
run:
|
||||
name: Install npm dependencies
|
||||
command: |
|
||||
if [ ! -d node_modules ]; then
|
||||
npm ci
|
||||
fi
|
||||
|
||||
- &cache_key_node_modules
|
||||
key: v1-node_modules-{{ checksum "package-lock.json" }}
|
||||
|
||||
jobs:
|
||||
dependencies:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
<<: *cache_key_node_modules
|
||||
- *npm_install_if_necessary
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
<<: *cache_key_node_modules
|
||||
|
||||
lint:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
<<: *cache_key_node_modules
|
||||
- *npm_install_if_necessary
|
||||
- run:
|
||||
name: Linter
|
||||
command: npm run lint
|
||||
test:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
<<: *cache_key_node_modules
|
||||
- *npm_install_if_necessary
|
||||
- run:
|
||||
name: Unit tests
|
||||
command: npm run test
|
||||
coverage:
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
<<: *cache_key_node_modules
|
||||
- *npm_install_if_necessary
|
||||
- run:
|
||||
name: Unit tests with coverage report
|
||||
command: npm run coverage
|
||||
|
||||
# TODO(xinbenlv, #1839): run SOLC_NIGHTLY to be run but allow it to fail.
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
everything:
|
||||
jobs:
|
||||
- dependencies
|
||||
- lint:
|
||||
requires:
|
||||
- dependencies
|
||||
- test:
|
||||
requires:
|
||||
- dependencies
|
||||
- coverage:
|
||||
requires:
|
||||
- dependencies
|
||||
15
.codecov.yml
15
.codecov.yml
@ -1,3 +1,16 @@
|
||||
comment: off
|
||||
github_checks:
|
||||
annotations: false
|
||||
coverage:
|
||||
range: "100...100"
|
||||
status:
|
||||
patch:
|
||||
default:
|
||||
target: 95%
|
||||
only_pulls: true
|
||||
project:
|
||||
default:
|
||||
threshold: 1%
|
||||
ignore:
|
||||
- "test"
|
||||
- "contracts/mocks"
|
||||
- "contracts/vendor"
|
||||
|
||||
@ -6,13 +6,16 @@ root = true
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
trim_trailing_whitespace = false
|
||||
max_line_length = 120
|
||||
|
||||
[*.sol]
|
||||
indent_size = 4
|
||||
|
||||
[*.js]
|
||||
indent_size = 2
|
||||
|
||||
[*.{adoc,md}]
|
||||
max_line_length = 0
|
||||
|
||||
58
.eslintrc
58
.eslintrc
@ -1,58 +0,0 @@
|
||||
{
|
||||
"extends" : [
|
||||
"standard",
|
||||
"plugin:promise/recommended",
|
||||
],
|
||||
"plugins": [
|
||||
"mocha-no-only",
|
||||
"promise",
|
||||
],
|
||||
"env": {
|
||||
"browser" : true,
|
||||
"node" : true,
|
||||
"mocha" : true,
|
||||
"jest" : true,
|
||||
},
|
||||
"globals" : {
|
||||
"artifacts": false,
|
||||
"contract": false,
|
||||
"assert": false,
|
||||
"web3": false,
|
||||
},
|
||||
"rules": {
|
||||
|
||||
// Strict mode
|
||||
"strict": ["error", "global"],
|
||||
|
||||
// Code style
|
||||
"camelcase": ["error", {"properties": "always"}],
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"comma-spacing": ["error", {"before": false, "after": true}],
|
||||
"dot-notation": ["error", {"allowKeywords": true, "allowPattern": ""}],
|
||||
"eol-last": ["error", "always"],
|
||||
"eqeqeq": ["error", "smart"],
|
||||
"generator-star-spacing": ["error", "before"],
|
||||
"indent": ["error", 2],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"max-len": ["error", 120, 2],
|
||||
"no-debugger": "off",
|
||||
"no-dupe-args": "error",
|
||||
"no-dupe-keys": "error",
|
||||
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
|
||||
"no-redeclare": ["error", {"builtinGlobals": true}],
|
||||
"no-trailing-spaces": ["error", { "skipBlankLines": false }],
|
||||
"no-undef": "error",
|
||||
"no-use-before-define": "off",
|
||||
"no-var": "error",
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"prefer-const": "error",
|
||||
"quotes": ["error", "single"],
|
||||
"semi": ["error", "always"],
|
||||
"space-before-function-paren": ["error", "always"],
|
||||
|
||||
"mocha-no-only/mocha-no-only": ["error"],
|
||||
|
||||
"promise/always-return": "off",
|
||||
"promise/avoid-new": "off",
|
||||
}
|
||||
}
|
||||
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1 +0,0 @@
|
||||
*.sol linguist-language=Solidity
|
||||
8
.githooks/pre-push
Executable file
8
.githooks/pre-push
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "${CI:-"false"}" != "true" ]; then
|
||||
npm run test:generation
|
||||
npm run lint
|
||||
fi
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -10,7 +10,7 @@ about: Report a bug in OpenZeppelin Contracts
|
||||
|
||||
**💻 Environment**
|
||||
|
||||
<!-- Tell us what version of OpenZeppelin Contracts you're using, and how you're using it: Truffle, Remix, etc. -->
|
||||
<!-- Tell us what version of OpenZeppelin Contracts you're using, and how you're using it: Hardhat, Remix, etc. -->
|
||||
|
||||
**📝 Details**
|
||||
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
4
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
contact_links:
|
||||
- name: Questions & Support Requests
|
||||
url: https://forum.openzeppelin.com/c/support/contracts/18
|
||||
about: Ask in the OpenZeppelin Forum
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -10,5 +10,5 @@ about: Suggest an idea for OpenZeppelin Contracts
|
||||
**📝 Details**
|
||||
<!-- Please describe your feature request in detail. -->
|
||||
|
||||
<!-- Make sure that you have reviewed the OpenZeppelin Contributor Guidelines. -->
|
||||
<!-- Make sure that you have reviewed the OpenZeppelin Contracts Contributor Guidelines. -->
|
||||
<!-- https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md -->
|
||||
|
||||
32
.github/PULL_REQUEST_TEMPLATE.md
vendored
32
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,22 +1,20 @@
|
||||
<!-- 0. 🎉 Thank you for submitting a PR! -->
|
||||
<!-- Thank you for your interest in contributing to OpenZeppelin! -->
|
||||
|
||||
<!-- 1. Does this close any open issues? Please list them below. -->
|
||||
<!-- Consider opening an issue for discussion prior to submitting a PR. -->
|
||||
<!-- New features will be merged faster if they were first discussed and designed with the team. -->
|
||||
|
||||
<!-- Keep in mind that new features have a better chance of being merged fast if
|
||||
they were first discussed and designed with the maintainers. If there is no
|
||||
corresponding issue, please consider opening one for discussion first! -->
|
||||
Fixes #???? <!-- Fill in with issue number -->
|
||||
|
||||
Fixes #
|
||||
<!-- Describe the changes introduced in this pull request. -->
|
||||
<!-- Include any context necessary for understanding the PR's purpose. -->
|
||||
|
||||
<!-- 2. Describe the changes introduced in this pull request. -->
|
||||
<!-- Include any context necessary for understanding the PR's purpose. -->
|
||||
|
||||
<!-- 3. Before submitting, please make sure that you have:
|
||||
- reviewed the OpenZeppelin Contributor Guidelines
|
||||
(https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md),
|
||||
- added tests where applicable to test new functionality,
|
||||
- made sure that your contracts are well-documented,
|
||||
- run the Solidity linter (`npm run lint:sol`) and fixed any issues,
|
||||
- run the JS linter and fixed any issues (`npm run lint:fix`), and
|
||||
- updated the changelog, if applicable.
|
||||
-->
|
||||
#### PR Checklist
|
||||
|
||||
<!-- Before merging the pull request all of the following must be complete. -->
|
||||
<!-- Feel free to submit a PR or Draft PR even if some items are pending. -->
|
||||
<!-- Some of the items may not apply. -->
|
||||
|
||||
- [ ] Tests
|
||||
- [ ] Documentation
|
||||
- [ ] Changeset entry (run `npx changeset add`)
|
||||
|
||||
50
.github/actions/gas-compare/action.yml
vendored
Normal file
50
.github/actions/gas-compare/action.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
name: Compare gas costs
|
||||
description: Compare gas costs between branches
|
||||
inputs:
|
||||
token:
|
||||
description: github token
|
||||
required: true
|
||||
report:
|
||||
description: report to read from
|
||||
required: false
|
||||
default: gasReporterOutput.json
|
||||
out_report:
|
||||
description: report to read
|
||||
required: false
|
||||
default: ${{ github.ref_name }}.gasreport.json
|
||||
ref_report:
|
||||
description: report to read from
|
||||
required: false
|
||||
default: ${{ github.base_ref }}.gasreport.json
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download reference report
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'`
|
||||
gh run download ${RUN_ID} --repo ${{ github.repository }} -n gasreport
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
id: reference
|
||||
- name: Compare reports
|
||||
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
|
||||
run: |
|
||||
node scripts/checks/compareGasReports.js ${{ inputs.report }} ${{ inputs.ref_report }} >> $GITHUB_STEP_SUMMARY
|
||||
env:
|
||||
STYLE: markdown
|
||||
shell: bash
|
||||
- name: Rename report for upload
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
mv ${{ inputs.report }} ${{ inputs.out_report }}
|
||||
shell: bash
|
||||
- name: Save report
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: gasreport
|
||||
path: ${{ inputs.out_report }}
|
||||
22
.github/actions/setup/action.yml
vendored
Normal file
22
.github/actions/setup/action.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: Setup
|
||||
description: Common environment setup
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
- uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: npm-v3-${{ hashFiles('**/package-lock.json') }}
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
shell: bash
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
- name: Install Foundry
|
||||
uses: foundry-rs/foundry-toolchain@v1
|
||||
with:
|
||||
version: nightly
|
||||
56
.github/actions/storage-layout/action.yml
vendored
Normal file
56
.github/actions/storage-layout/action.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: Compare storage layouts
|
||||
description: Compare storage layouts between branches
|
||||
inputs:
|
||||
token:
|
||||
description: github token
|
||||
required: true
|
||||
buildinfo:
|
||||
description: compilation artifacts
|
||||
required: false
|
||||
default: artifacts/build-info/*.json
|
||||
layout:
|
||||
description: extracted storage layout
|
||||
required: false
|
||||
default: HEAD.layout.json
|
||||
out_layout:
|
||||
description: storage layout to upload
|
||||
required: false
|
||||
default: ${{ github.ref_name }}.layout.json
|
||||
ref_layout:
|
||||
description: storage layout for the reference branch
|
||||
required: false
|
||||
default: ${{ github.base_ref }}.layout.json
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Extract layout
|
||||
run: |
|
||||
node scripts/checks/extract-layout.js ${{ inputs.buildinfo }} > ${{ inputs.layout }}
|
||||
shell: bash
|
||||
- name: Download reference
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'`
|
||||
gh run download ${RUN_ID} --repo ${{ github.repository }} -n layout
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
id: reference
|
||||
- name: Compare layouts
|
||||
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
|
||||
run: |
|
||||
node scripts/checks/compare-layout.js --head ${{ inputs.layout }} --ref ${{ inputs.ref_layout }}
|
||||
shell: bash
|
||||
- name: Rename artifacts for upload
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
mv ${{ inputs.layout }} ${{ inputs.out_layout }}
|
||||
shell: bash
|
||||
- name: Save artifacts
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: layout
|
||||
path: ${{ inputs.out_layout }}
|
||||
66
.github/stale.yml
vendored
66
.github/stale.yml
vendored
@ -1,66 +0,0 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 15
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||
daysUntilClose: 15
|
||||
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- on hold
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: false
|
||||
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: false
|
||||
|
||||
# Set to true to ignore issues with an assignee (defaults to false)
|
||||
exemptAssignees: false
|
||||
|
||||
# Label to use when marking as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
Hi all!
|
||||
|
||||
This Pull Request has not had any recent activity, is it still relevant? If so, what is blocking it?
|
||||
Is there anything we can do to help move it forward?
|
||||
|
||||
Thanks!
|
||||
|
||||
|
||||
# Comment to post when removing the stale label.
|
||||
# unmarkComment: >
|
||||
# Your comment here.
|
||||
|
||||
# Comment to post when closing a stale Issue or Pull Request.
|
||||
closeComment: >
|
||||
Hi folks!
|
||||
|
||||
This Pull Request is being closed as there was no response to the previous prompt.
|
||||
However, please leave a comment whenever you're ready to resume, so it can be reopened.
|
||||
|
||||
Thanks again!
|
||||
|
||||
|
||||
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||
limitPerRun: 30
|
||||
|
||||
# Limit to only `issues` or `pulls`
|
||||
only: pulls
|
||||
|
||||
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
|
||||
# pulls:
|
||||
# daysUntilStale: 30
|
||||
# markComment: >
|
||||
# This pull request has been automatically marked as stale because it has not had
|
||||
# recent activity. It will be closed if no further activity occurs. Thank you
|
||||
# for your contributions.
|
||||
|
||||
# issues:
|
||||
# exemptLabels:
|
||||
# - confirmed
|
||||
18
.github/workflows/actionlint.yml
vendored
Normal file
18
.github/workflows/actionlint.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
name: lint workflows
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/**/*.ya?ml'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Add problem matchers
|
||||
run: |
|
||||
# https://github.com/rhysd/actionlint/blob/3a2f2c7/docs/usage.md#problem-matchers
|
||||
curl -LO https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json
|
||||
echo "::add-matcher::actionlint-matcher.json"
|
||||
- uses: docker://rhysd/actionlint:latest
|
||||
28
.github/workflows/changeset.yml
vendored
Normal file
28
.github/workflows/changeset.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: changeset
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- labeled
|
||||
- unlabeled
|
||||
|
||||
concurrency:
|
||||
group: changeset-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-changeset') }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Include history so Changesets finds merge-base
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Check changeset
|
||||
run: npx changeset status --since=origin/${{ github.base_ref }}
|
||||
136
.github/workflows/checks.yml
vendored
Normal file
136
.github/workflows/checks.yml
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
name: checks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- next-v*
|
||||
- release-v*
|
||||
pull_request: {}
|
||||
workflow_dispatch: {}
|
||||
|
||||
concurrency:
|
||||
group: checks-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=8192
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: npm run lint
|
||||
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
# Needed for "eth-gas-reporter" to produce a "gasReporterOutput.json" as documented in
|
||||
# https://github.com/cgewecke/eth-gas-reporter/blob/v0.2.27/docs/gasReporterOutput.md
|
||||
CI: true
|
||||
GAS: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Run tests and generate gas report
|
||||
run: npm run test
|
||||
- name: Check linearisation of the inheritance graph
|
||||
run: npm run test:inheritance
|
||||
- name: Check pragma consistency between files
|
||||
run: npm run test:pragma
|
||||
- name: Check proceduraly generated contracts are up-to-date
|
||||
run: npm run test:generation
|
||||
- name: Compare gas costs
|
||||
uses: ./.github/actions/gas-compare
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
|
||||
tests-upgradeable:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Include history so patch conflicts are resolved automatically
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Copy non-upgradeable contracts as dependency
|
||||
run: |
|
||||
mkdir -p lib/openzeppelin-contracts
|
||||
cp -rnT contracts lib/openzeppelin-contracts/contracts
|
||||
- name: Transpile to upgradeable
|
||||
run: bash scripts/upgradeable/transpile.sh
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
- name: Check linearisation of the inheritance graph
|
||||
run: npm run test:inheritance
|
||||
- name: Check pragma consistency between files
|
||||
run: npm run test:pragma
|
||||
- name: Check storage layout
|
||||
uses: ./.github/actions/storage-layout
|
||||
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change') }}
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
|
||||
tests-foundry:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Run tests
|
||||
run: forge test -vv
|
||||
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Run coverage
|
||||
run: npm run coverage
|
||||
- uses: codecov/codecov-action@v4
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
harnesses:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Compile harnesses
|
||||
run: |
|
||||
make -C certora apply
|
||||
npm run compile:harnesses
|
||||
|
||||
slither:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: rm foundry.toml
|
||||
- uses: crytic/slither-action@v0.4.0
|
||||
with:
|
||||
node-version: 18.15
|
||||
slither-version: 0.10.1
|
||||
|
||||
codespell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run CodeSpell
|
||||
uses: codespell-project/actions-codespell@v2.1
|
||||
with:
|
||||
check_hidden: true
|
||||
check_filenames: true
|
||||
skip: package-lock.json,*.pdf,vendor
|
||||
19
.github/workflows/docs.yml
vendored
Normal file
19
.github/workflows/docs.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: Build Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [release-v*]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: bash scripts/git-user-config.sh
|
||||
- run: node scripts/update-docs-branch.js
|
||||
- run: git push --all origin
|
||||
86
.github/workflows/formal-verification.yml
vendored
Normal file
86
.github/workflows/formal-verification.yml
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
name: formal verification
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
- labeled
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
PIP_VERSION: '3.11'
|
||||
JAVA_VERSION: '11'
|
||||
SOLC_VERSION: '0.8.20'
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
apply-diff:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Apply patches
|
||||
run: make -C certora apply
|
||||
|
||||
verify:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'formal-verification')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: identify specs that need to be run
|
||||
id: arguments
|
||||
run: |
|
||||
if [[ ${{ github.event_name }} = 'pull_request' ]];
|
||||
then
|
||||
RESULT=$(git diff ${{ github.event.pull_request.head.sha }}..${{ github.event.pull_request.base.sha }} --name-only certora/specs/*.spec | while IFS= read -r file; do [[ -f $file ]] && basename "${file%.spec}"; done | tr "\n" " ")
|
||||
else
|
||||
RESULT='--all'
|
||||
fi
|
||||
echo "result=$RESULT" >> "$GITHUB_OUTPUT"
|
||||
- name: Install python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PIP_VERSION }}
|
||||
cache: 'pip'
|
||||
cache-dependency-path: 'fv-requirements.txt'
|
||||
- name: Install python packages
|
||||
run: pip install -r fv-requirements.txt
|
||||
- name: Install java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
- name: Install solc
|
||||
run: |
|
||||
wget https://github.com/ethereum/solidity/releases/download/v${{ env.SOLC_VERSION }}/solc-static-linux
|
||||
sudo mv solc-static-linux /usr/local/bin/solc
|
||||
chmod +x /usr/local/bin/solc
|
||||
- name: Verify specification
|
||||
run: |
|
||||
make -C certora apply
|
||||
node certora/run.js ${{ steps.arguments.outputs.result }} >> "$GITHUB_STEP_SUMMARY"
|
||||
env:
|
||||
CERTORAKEY: ${{ secrets.CERTORAKEY }}
|
||||
|
||||
halmos:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Install python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PIP_VERSION }}
|
||||
cache: 'pip'
|
||||
cache-dependency-path: 'fv-requirements.txt'
|
||||
- name: Install python packages
|
||||
run: pip install -r fv-requirements.txt
|
||||
- name: Run Halmos
|
||||
run: halmos --match-test '^symbolic|^testSymbolic' -vv
|
||||
212
.github/workflows/release-cycle.yml
vendored
Normal file
212
.github/workflows/release-cycle.yml
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
# D: Manual Dispatch
|
||||
# M: Merge release PR
|
||||
# C: Commit
|
||||
# ┌───────────┐ ┌─────────────┐ ┌────────────────┐
|
||||
# │Development├──D──►RC-Unreleased│ ┌──►Final-Unreleased│
|
||||
# └───────────┘ └─┬─────────▲─┘ │ └─┬────────────▲─┘
|
||||
# │ │ │ │ │
|
||||
# M C D M C
|
||||
# │ │ │ │ │
|
||||
# ┌▼─────────┴┐ │ ┌▼────────────┴┐
|
||||
# │RC-Released├───┘ │Final-Released│
|
||||
# └───────────┘ └──────────────┘
|
||||
name: Release Cycle
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release-v*
|
||||
workflow_dispatch: {}
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
state:
|
||||
name: Check state
|
||||
permissions:
|
||||
pull-requests: read
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- id: state
|
||||
name: Get state
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
TRIGGERING_ACTOR: ${{ github.triggering_actor }}
|
||||
with:
|
||||
result-encoding: string
|
||||
script: await require('./scripts/release/workflow/state.js')({ github, context, core })
|
||||
outputs:
|
||||
# Job Flags
|
||||
start: ${{ steps.state.outputs.start }}
|
||||
changesets: ${{ steps.state.outputs.changesets }}
|
||||
promote: ${{ steps.state.outputs.promote }}
|
||||
publish: ${{ steps.state.outputs.publish }}
|
||||
merge: ${{ steps.state.outputs.merge }}
|
||||
|
||||
# Global variables
|
||||
is_prerelease: ${{ steps.state.outputs.is_prerelease }}
|
||||
|
||||
start:
|
||||
needs: state
|
||||
name: Start new release candidate
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
if: needs.state.outputs.start == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: bash scripts/git-user-config.sh
|
||||
- id: start
|
||||
name: Create branch with release candidate
|
||||
run: bash scripts/release/workflow/start.sh
|
||||
- name: Re-run workflow
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
REF: ${{ steps.start.outputs.branch }}
|
||||
with:
|
||||
script: await require('./scripts/release/workflow/rerun.js')({ github, context })
|
||||
|
||||
promote:
|
||||
needs: state
|
||||
name: Promote to final release
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
if: needs.state.outputs.promote == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: bash scripts/git-user-config.sh
|
||||
- name: Exit prerelease state
|
||||
if: needs.state.outputs.is_prerelease == 'true'
|
||||
run: bash scripts/release/workflow/exit-prerelease.sh
|
||||
- name: Re-run workflow
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: await require('./scripts/release/workflow/rerun.js')({ github, context })
|
||||
|
||||
changesets:
|
||||
needs: state
|
||||
name: Update PR to release
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
if: needs.state.outputs.changesets == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # To get all tags
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- name: Set release title
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
result-encoding: string
|
||||
script: await require('./scripts/release/workflow/set-changesets-pr-title.js')({ core })
|
||||
- name: Create PR
|
||||
uses: changesets/action@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
|
||||
with:
|
||||
version: npm run version
|
||||
title: ${{ env.TITLE }}
|
||||
commit: ${{ env.TITLE }}
|
||||
body: | # Wait for support on this https://github.com/changesets/action/pull/250
|
||||
This is an automated PR for releasing ${{ github.repository }}
|
||||
Check [CHANGELOG.md](${{ github.repository }}/CHANGELOG.md)
|
||||
|
||||
publish:
|
||||
needs: state
|
||||
name: Publish to npm
|
||||
environment: npm
|
||||
permissions:
|
||||
contents: write
|
||||
if: needs.state.outputs.publish == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- id: pack
|
||||
name: Pack
|
||||
run: bash scripts/release/workflow/pack.sh
|
||||
env:
|
||||
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
|
||||
- name: Upload tarball artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.ref_name }}
|
||||
path: ${{ steps.pack.outputs.tarball }}
|
||||
- name: Publish
|
||||
run: bash scripts/release/workflow/publish.sh
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
TARBALL: ${{ steps.pack.outputs.tarball }}
|
||||
TAG: ${{ steps.pack.outputs.tag }}
|
||||
- name: Create Github Release
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
|
||||
with:
|
||||
script: await require('./scripts/release/workflow/github-release.js')({ github, context })
|
||||
outputs:
|
||||
tarball_name: ${{ steps.pack.outputs.tarball_name }}
|
||||
|
||||
integrity_check:
|
||||
needs: publish
|
||||
name: Tarball Integrity Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Download tarball artifact
|
||||
id: artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ github.ref_name }}
|
||||
- name: Check integrity
|
||||
run: bash scripts/release/workflow/integrity-check.sh
|
||||
env:
|
||||
TARBALL: ${{ steps.artifact.outputs.download-path }}/${{ needs.publish.outputs.tarball_name }}
|
||||
|
||||
merge:
|
||||
needs: state
|
||||
name: Create PR back to master
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
if: needs.state.outputs.merge == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MERGE_BRANCH: merge/${{ github.ref_name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # All branches
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: bash scripts/git-user-config.sh
|
||||
- name: Create branch to merge
|
||||
run: |
|
||||
git checkout -B "$MERGE_BRANCH" "$GITHUB_REF_NAME"
|
||||
git push -f origin "$MERGE_BRANCH"
|
||||
- name: Create PR back to master
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
head: process.env.MERGE_BRANCH,
|
||||
base: 'master',
|
||||
title: '${{ format('Merge {0} branch', github.ref_name) }}'
|
||||
});
|
||||
34
.github/workflows/upgradeable.yml
vendored
Normal file
34
.github/workflows/upgradeable.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
name: transpile upgradeable
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-v*
|
||||
|
||||
jobs:
|
||||
transpile:
|
||||
environment: push-upgradeable
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: OpenZeppelin/openzeppelin-contracts-upgradeable
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GH_TOKEN_UPGRADEABLE }}
|
||||
- name: Fetch current non-upgradeable branch
|
||||
run: |
|
||||
git fetch "$REMOTE" master # Fetch default branch first for patch to apply cleanly
|
||||
git fetch "$REMOTE" "$REF"
|
||||
git checkout FETCH_HEAD
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
REMOTE: https://github.com/${{ github.repository }}.git
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
- run: bash scripts/git-user-config.sh
|
||||
- name: Transpile to upgradeable
|
||||
run: bash scripts/upgradeable/transpile-onto.sh ${{ github.ref_name }} origin/${{ github.ref_name }}
|
||||
env:
|
||||
SUBMODULE_REMOTE: https://github.com/${{ github.repository }}.git
|
||||
- run: git push origin ${{ github.ref_name }}
|
||||
30
.gitignore
vendored
30
.gitignore
vendored
@ -29,22 +29,38 @@ npm-debug.log
|
||||
# local env variables
|
||||
.env
|
||||
|
||||
# truffle build directory
|
||||
build/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# truffle
|
||||
.node-xmlhttprequest-*
|
||||
|
||||
# IntelliJ IDE
|
||||
.idea
|
||||
|
||||
# docs artifacts
|
||||
docs/modules/api
|
||||
openzeppelin-docs
|
||||
|
||||
# only used to package @openzeppelin/contracts
|
||||
contracts/build/
|
||||
contracts/README.md
|
||||
|
||||
# temporary artifact from solidity-coverage
|
||||
allFiredEvents
|
||||
.coverage_artifacts
|
||||
.coverage_cache
|
||||
.coverage_contracts
|
||||
|
||||
# hardat-exposed
|
||||
contracts-exposed
|
||||
|
||||
# Hardhat
|
||||
/cache
|
||||
/artifacts
|
||||
|
||||
# Foundry
|
||||
/out
|
||||
/cache_forge
|
||||
|
||||
# Certora
|
||||
.certora*
|
||||
.last_confs
|
||||
certora_*
|
||||
.zip-output-url.txt
|
||||
|
||||
10
.gitmodules
vendored
Normal file
10
.gitmodules
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
[submodule "lib/forge-std"]
|
||||
branch = v1
|
||||
path = lib/forge-std
|
||||
url = https://github.com/foundry-rs/forge-std
|
||||
[submodule "lib/erc4626-tests"]
|
||||
path = lib/erc4626-tests
|
||||
url = https://github.com/a16z/erc4626-tests.git
|
||||
[submodule "lib/halmos-cheatcodes"]
|
||||
path = lib/halmos-cheatcodes
|
||||
url = https://github.com/a16z/halmos-cheatcodes
|
||||
4
.mocharc.js
Normal file
4
.mocharc.js
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
require: 'hardhat/register',
|
||||
timeout: 4000,
|
||||
};
|
||||
15
.prettierrc
Normal file
15
.prettierrc
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"arrowParens": "avoid",
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.sol",
|
||||
"options": {
|
||||
"singleQuote": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"plugins": ["prettier-plugin-solidity"]
|
||||
}
|
||||
28
.solcover.js
28
.solcover.js
@ -1,9 +1,21 @@
|
||||
module.exports = {
|
||||
norpc: true,
|
||||
testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage',
|
||||
compileCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle compile --network coverage',
|
||||
skipFiles: [
|
||||
'lifecycle/Migrations.sol',
|
||||
'mocks'
|
||||
]
|
||||
}
|
||||
norpc: true,
|
||||
testCommand: 'npm test',
|
||||
compileCommand: 'npm run compile',
|
||||
skipFiles: ['mocks'],
|
||||
providerOptions: {
|
||||
default_balance_ether: '10000000000000000000000000',
|
||||
},
|
||||
mocha: {
|
||||
fgrep: '[skip-on-coverage]',
|
||||
invert: true,
|
||||
},
|
||||
// Work around stack too deep for coverage
|
||||
configureYulOptimizer: true,
|
||||
solcOptimizerDetails: {
|
||||
yul: true,
|
||||
yulDetails: {
|
||||
optimizerSteps: '',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "solhint:recommended",
|
||||
"rules": {
|
||||
"indent": ["error", 4],
|
||||
"func-order": "off",
|
||||
"bracket-align": "off",
|
||||
"compiler-fixed": "off",
|
||||
"no-simple-event-func-name": "off",
|
||||
"separate-by-one-line-in-contract": "off",
|
||||
"two-lines-top-level-separator": "off",
|
||||
"mark-callable-contracts": "off",
|
||||
"compiler-version": ["error", "^0.5.0"]
|
||||
}
|
||||
}
|
||||
1184
CHANGELOG.md
1184
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
level of experience, education, socioeconomic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at maintainers@openzeppelin.org. All
|
||||
reported by contacting the project team at contact@openzeppelin.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
# Code Style
|
||||
|
||||
We value clean code and consistency, and those are prerequisites for us to
|
||||
include new code in the repository. Before proposing a change, please read this
|
||||
document and take some time to familiarize yourself with the style of the
|
||||
existing codebase.
|
||||
|
||||
## Solidity code
|
||||
|
||||
In order to be consistent with all the other Solidity projects, we follow the
|
||||
[official recommendations documented in the Solidity style guide](http://solidity.readthedocs.io/en/latest/style-guide.html).
|
||||
|
||||
Any exception or additions specific to our project are documented below.
|
||||
|
||||
### Naming
|
||||
|
||||
* Try to avoid acronyms and abbreviations.
|
||||
|
||||
* All state variables should be private.
|
||||
|
||||
* Private state variables should have an underscore prefix.
|
||||
|
||||
```
|
||||
contract TestContract {
|
||||
uint256 private _privateVar;
|
||||
uint256 internal _internalVar;
|
||||
}
|
||||
```
|
||||
|
||||
* Parameters must not be prefixed with an underscore.
|
||||
|
||||
```
|
||||
function test(uint256 testParameter1, uint256 testParameter2) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
* Internal and private functions should have an underscore prefix.
|
||||
|
||||
```
|
||||
function _testInternal() internal {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
function _testPrivate() private {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
* Events should be emitted immediately after the state change that they
|
||||
represent, and consequently they should be named in past tense.
|
||||
|
||||
```
|
||||
function _burn(address _who, uint256 _value) internal {
|
||||
super._burn(_who, _value);
|
||||
emit TokensBurned(_who, _value);
|
||||
}
|
||||
```
|
||||
|
||||
Some standards (e.g. ERC20) use present tense, and in those cases the
|
||||
standard specification prevails.
|
||||
|
||||
* Interface names should have a capital I prefix.
|
||||
|
||||
```
|
||||
interface IERC777 {
|
||||
```
|
||||
@ -1,71 +1,36 @@
|
||||
Contributing to OpenZeppelin Contracts
|
||||
=======
|
||||
# Contributing Guidelines
|
||||
|
||||
We really appreciate and value contributions to OpenZeppelin Contracts. Please take 5' to review the items listed below to make sure that your contributions are merged as soon as possible.
|
||||
There are many ways to contribute to OpenZeppelin Contracts.
|
||||
|
||||
## Contribution guidelines
|
||||
## Troubleshooting
|
||||
|
||||
Smart contracts manage value and are highly vulnerable to errors and attacks. We have very strict [guidelines], please make sure to review them!
|
||||
You can help other users in the community to solve their smart contract issues in the [OpenZeppelin Forum].
|
||||
|
||||
## Creating Pull Requests (PRs)
|
||||
[OpenZeppelin Forum]: https://forum.openzeppelin.com/
|
||||
|
||||
As a contributor, you are expected to fork this repository, work on your own fork and then submit pull requests. The pull requests will be reviewed and eventually merged into the main repo. See ["Fork-a-Repo"](https://help.github.com/articles/fork-a-repo/) for how this works.
|
||||
## Opening an issue
|
||||
|
||||
## A typical workflow
|
||||
You can [open an issue] to suggest a feature or report a minor bug. For serious bugs please do not open an issue, instead refer to our [security policy] for appropriate steps.
|
||||
|
||||
1) Make sure your fork is up to date with the main repository:
|
||||
If you believe your issue may be due to user error and not a problem in the library, consider instead posting a question on the [OpenZeppelin Forum].
|
||||
|
||||
```
|
||||
cd openzeppelin-contracts
|
||||
git remote add upstream https://github.com/OpenZeppelin/openzeppelin-contracts.git
|
||||
git fetch upstream
|
||||
git pull --rebase upstream master
|
||||
```
|
||||
NOTE: The directory `openzeppelin-contracts` represents your fork's local copy.
|
||||
Before opening an issue, be sure to search through the existing open and closed issues, and consider posting a comment in one of those instead.
|
||||
|
||||
2) Branch out from `master` into `fix/some-bug-#123`:
|
||||
(Postfixing #123 will associate your PR with the issue #123 and make everyone's life easier =D)
|
||||
```
|
||||
git checkout -b fix/some-bug-#123
|
||||
```
|
||||
When requesting a new feature, include as many details as you can, especially around the use cases that motivate it. Features are prioritized according to the impact they may have on the ecosystem, so we appreciate information showing that the impact could be high.
|
||||
|
||||
3) Make your changes, add your files, commit, and push to your fork.
|
||||
[security policy]: https://github.com/OpenZeppelin/openzeppelin-contracts/security
|
||||
[open an issue]: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/new/choose
|
||||
|
||||
```
|
||||
git add SomeFile.js
|
||||
git commit "Fix some bug #123"
|
||||
git push origin fix/some-bug-#123
|
||||
```
|
||||
## Submitting a pull request
|
||||
|
||||
4) Run tests, linter, etc. This can be done by running local continuous integration and make sure it passes.
|
||||
If you would like to contribute code or documentation you may do so by forking the repository and submitting a pull request.
|
||||
|
||||
```bash
|
||||
npm test
|
||||
npm run lint
|
||||
```
|
||||
Any non-trivial code contribution must be first discussed with the maintainers in an issue (see [Opening an issue](#opening-an-issue)). Only very minor changes are accepted without prior discussion.
|
||||
|
||||
or you can simply run CircleCI locally
|
||||
```bash
|
||||
circleci local execute --job build
|
||||
circleci local execute --job test
|
||||
```
|
||||
*Note*: requires installing CircleCI and docker locally on your machine.
|
||||
Make sure to read and follow the [engineering guidelines](./GUIDELINES.md). Run linter and tests to make sure your pull request is good before submitting it.
|
||||
|
||||
5) Go to [github.com/OpenZeppelin/openzeppelin-contracts](https://github.com/OpenZeppelin/openzeppelin-contracts) in your web browser and issue a new pull request.
|
||||
Changelog entries should be added to each pull request by using [Changesets](https://github.com/changesets/changesets/).
|
||||
|
||||
*IMPORTANT* Read the PR template very carefully and make sure to follow all the instructions. These instructions
|
||||
refer to some very important conditions that your PR must meet in order to be accepted, such as making sure that all tests pass, JS linting tests pass, Solidity linting tests pass, etc.
|
||||
When opening the pull request you will be presented with a template and a series of instructions. Read through it carefully and follow all the steps. Expect a review and feedback from the maintainers afterwards.
|
||||
|
||||
6) Maintainers will review your code and possibly ask for changes before your code is pulled in to the main repository. We'll check that all tests pass, review the coding style, and check for general code correctness. If everything is OK, we'll merge your pull request and your code will be part of OpenZeppelin.
|
||||
|
||||
*IMPORTANT* Please pay attention to the maintainer's feedback, since its a necessary step to keep up with the standards OpenZeppelin attains to.
|
||||
|
||||
## All set!
|
||||
|
||||
If you have any questions, feel free to post them to github.com/OpenZeppelin/openzeppelin-contracts/issues.
|
||||
|
||||
Finally, if you're looking to collaborate and want to find easy tasks to start, look at the issues we marked as ["Good first issue"](https://github.com/OpenZeppelin/openzeppelin-contracts/labels/good%20first%20issue).
|
||||
|
||||
Thanks for your time and code!
|
||||
|
||||
[guidelines]: GUIDELINES.md
|
||||
If you're looking for a good place to start, look for issues labelled ["good first issue"](https://github.com/OpenZeppelin/openzeppelin-contracts/labels/good%20first%20issue)!
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
We're building an improved documentation website. It's still in development and
|
||||
contributions will be really appreciated.
|
||||
|
||||
All of the content for the site is in this repository. The guides are in the
|
||||
[docs](/docs) directory, and the API Reference is extracted from comments in
|
||||
the source code. If you want to help improve the content, this is the
|
||||
repository you should be contributing to.
|
||||
|
||||
[`solidity-docgen`](https://github.com/OpenZeppelin/solidity-docgen) is the
|
||||
program that extracts the API Reference from source code.
|
||||
|
||||
The [`openzeppelin-docsite`](https://github.com/OpenZeppelin/openzeppelin-docsite)
|
||||
repository hosts the configuration for Docusaurus, the static site generator
|
||||
that we use.
|
||||
|
||||
To run the docsite locally you should run `npm run docsite start` on this
|
||||
repository. This will live reload as the guides are edited, but not with
|
||||
changes to the source code comments, for that you need to restart the server.
|
||||
This should be improved eventually (contributions welcome!).
|
||||
7
FUNDING.json
Normal file
7
FUNDING.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"drips": {
|
||||
"ethereum": {
|
||||
"ownedBy": "0xAeb37910f93486C85A1F8F994b67E8187554d664"
|
||||
}
|
||||
}
|
||||
}
|
||||
159
GUIDELINES.md
159
GUIDELINES.md
@ -1,64 +1,155 @@
|
||||
Design Guidelines
|
||||
=======
|
||||
# Engineering Guidelines
|
||||
|
||||
These are some global design goals in OpenZeppelin.
|
||||
## Testing
|
||||
|
||||
#### D0 - Security in Depth
|
||||
We strive to provide secure, tested, audited code. To achieve this, we need to match intention with function. Thus, documentation, code clarity, community review and security discussions are fundamental.
|
||||
Code must be thoroughly tested with quality unit tests.
|
||||
|
||||
#### D1 - Simple and Modular
|
||||
Simpler code means easier audits, and better understanding of what each component does. We look for small files, small contracts, and small functions. If you can separate a contract into two independent functionalities you should probably do it.
|
||||
We defer to the [Moloch Testing Guide](https://github.com/MolochVentures/moloch/tree/master/test#readme) for specific recommendations, though not all of it is relevant here. Note the introduction:
|
||||
|
||||
#### D2 - Naming Matters
|
||||
> Tests should be written, not only to verify correctness of the target code, but to be comprehensively reviewed by other programmers. Therefore, for mission critical Solidity code, the quality of the tests are just as important (if not more so) than the code itself, and should be written with the highest standards of clarity and elegance.
|
||||
|
||||
We take our time with picking names. Code is going to be written once, and read hundreds of times. Renaming for clarity is encouraged.
|
||||
Every addition or change to the code must come with relevant and comprehensive tests.
|
||||
|
||||
#### D3 - Tests
|
||||
Refactors should avoid simultaneous changes to tests.
|
||||
|
||||
Write tests for all your code. We encourage Test Driven Development so we know when our code is right. Even though not all code in the repository is tested at the moment, we aim to test every line of code in the future.
|
||||
Flaky tests are not acceptable.
|
||||
|
||||
#### D4 - Check preconditions and post-conditions
|
||||
The test suite should run automatically for every change in the repository, and in pull requests tests must pass before merging.
|
||||
|
||||
A very important way to prevent vulnerabilities is to catch a contract’s inconsistent state as early as possible. This is why we want functions to check pre- and post-conditions for executing its logic. When writing code, ask yourself what you are expecting to be true before and after the function runs, and express it in code.
|
||||
The test suite coverage must be kept as close to 100% as possible, enforced in pull requests.
|
||||
|
||||
#### D5 - Code Consistency
|
||||
In some cases unit tests may be insufficient and complementary techniques should be used:
|
||||
|
||||
Consistency on the way classes are used is paramount to an easier understanding of the library. The codebase should be as unified as possible. Read existing code and get inspired before you write your own. Follow the style guidelines. Don’t hesitate to ask for help on how to best write a specific piece of code.
|
||||
1. Property-based tests (aka. fuzzing) for math-heavy code.
|
||||
2. Formal verification for state machines.
|
||||
|
||||
#### D6 - Regular Audits
|
||||
Following good programming practices is a way to reduce the risk of vulnerabilities, but professional code audits are still needed. We will perform regular code audits on major releases, and hire security professionals to provide independent review.
|
||||
## Code style
|
||||
|
||||
## Style Guidelines
|
||||
Solidity code should be written in a consistent format enforced by a linter, following the official [Solidity Style Guide](https://docs.soliditylang.org/en/latest/style-guide.html). See below for further [Solidity Conventions](#solidity-conventions).
|
||||
|
||||
The design guidelines have quite a high abstraction level. These style guidelines are more concrete and easier to apply, and also more opinionated.
|
||||
The code should be simple and straightforward, prioritizing readability and understandability. Consistency and predictability should be maintained across the codebase. In particular, this applies to naming, which should be systematic, clear, and concise.
|
||||
|
||||
### General
|
||||
Sometimes these guidelines may be broken if doing so brings significant efficiency gains, but explanatory comments should be added.
|
||||
|
||||
#### G0 - Default to Solidity's official style guide.
|
||||
Modularity should be pursued, but not at the cost of the above priorities.
|
||||
|
||||
Follow the official Solidity style guide: https://solidity.readthedocs.io/en/latest/style-guide.html
|
||||
## Documentation
|
||||
|
||||
#### G1 - No Magic Constants
|
||||
For contributors, project guidelines and processes must be documented publicly.
|
||||
|
||||
Avoid constants in the code as much as possible. Magic strings are also magic constants.
|
||||
For users, features must be abundantly documented. Documentation should include answers to common questions, solutions to common problems, and recommendations for critical decisions that the user may face.
|
||||
|
||||
#### G2 - Code that Fails Early
|
||||
All changes to the core codebase (excluding tests, auxiliary scripts, etc.) must be documented in a changelog, except for purely cosmetic or documentation changes.
|
||||
|
||||
We ask our code to fail as soon as possible when an unexpected input was provided or unexpected state was found.
|
||||
## Peer review
|
||||
|
||||
#### G3 - Internal Amounts Must be Signed Integers and Represent the Smallest Units.
|
||||
All changes must be submitted through pull requests and go through peer code review.
|
||||
|
||||
Avoid representation errors by always dealing with weis when handling ether. GUIs can convert to more human-friendly representations. Use Signed Integers (int) to prevent underflow problems.
|
||||
The review must be approached by the reviewer in a similar way as if it was an audit of the code in question (but importantly it is not a substitute for and should not be considered an audit).
|
||||
|
||||
Reviewers should enforce code and project guidelines.
|
||||
|
||||
### Testing
|
||||
External contributions must be reviewed separately by multiple maintainers.
|
||||
|
||||
#### T1 - Tests Must be Written Elegantly
|
||||
## Automation
|
||||
|
||||
Style guidelines are not relaxed for tests. Tests are a good way to show how to use the library, and maintaining them is extremely necessary.
|
||||
Automation should be used as much as possible to reduce the possibility of human error and forgetfulness.
|
||||
|
||||
Don't write long tests, write helper functions to make them be as short and concise as possible (they should take just a few lines each), and use good variable names.
|
||||
Automations that make use of sensitive credentials must use secure secret management, and must be strengthened against attacks such as [those on GitHub Actions workflows](https://github.com/nikitastupin/pwnhub).
|
||||
|
||||
#### T2 - Tests Must not be Random
|
||||
Some other examples of automation are:
|
||||
|
||||
Inputs for tests should not be generated randomly. Accounts used to create test contracts are an exception, those can be random. Also, the type and structure of outputs should be checked.
|
||||
- Looking for common security vulnerabilities or errors in our code (eg. reentrancy analysis).
|
||||
- Keeping dependencies up to date and monitoring for vulnerable dependencies.
|
||||
|
||||
## Pull requests
|
||||
|
||||
Pull requests are squash-merged to keep the `master` branch history clean. The title of the pull request becomes the commit message, so it should be written in a consistent format:
|
||||
|
||||
1) Begin with a capital letter.
|
||||
2) Do not end with a period.
|
||||
3) Write in the imperative: "Add feature X" and not "Adds feature X" or "Added feature X".
|
||||
|
||||
This repository does not follow conventional commits, so do not prefix the title with "fix:" or "feat:".
|
||||
|
||||
Work in progress pull requests should be submitted as Drafts and should not be prefixed with "WIP:".
|
||||
|
||||
Branch names don't matter, and commit messages within a pull request mostly don't matter either, although they can help the review process.
|
||||
|
||||
# Solidity Conventions
|
||||
|
||||
In addition to the official Solidity Style Guide we have a number of other conventions that must be followed.
|
||||
|
||||
* All state variables should be private.
|
||||
|
||||
Changes to state should be accompanied by events, and in some cases it is not correct to arbitrarily set state. Encapsulating variables as private and only allowing modification via setters enables us to ensure that events and other rules are followed reliably and prevents this kind of user error.
|
||||
|
||||
* Internal or private state variables or functions should have an underscore prefix.
|
||||
|
||||
```solidity
|
||||
contract TestContract {
|
||||
uint256 private _privateVar;
|
||||
uint256 internal _internalVar;
|
||||
function _testInternal() internal { ... }
|
||||
function _testPrivate() private { ... }
|
||||
}
|
||||
```
|
||||
|
||||
* Functions should be declared virtual, with few exceptions listed below. The
|
||||
contract logic should be written considering that these functions may be
|
||||
overridden by developers, e.g. getting a value using an internal getter rather
|
||||
than reading directly from a state variable.
|
||||
|
||||
If function A is an "alias" of function B, i.e. it invokes function B without
|
||||
significant additional logic, then function A should not be virtual so that
|
||||
any user overrides are implemented on B, preventing inconsistencies.
|
||||
|
||||
* Events should generally be emitted immediately after the state change that they
|
||||
represent, and should be named in the past tense. Some exceptions may be made for gas
|
||||
efficiency if the result doesn't affect observable ordering of events.
|
||||
|
||||
```solidity
|
||||
function _burn(address who, uint256 value) internal {
|
||||
super._burn(who, value);
|
||||
emit TokensBurned(who, value);
|
||||
}
|
||||
```
|
||||
|
||||
Some standards (e.g. ERC-20) use present tense, and in those cases the
|
||||
standard specification is used.
|
||||
|
||||
* Interface names should have a capital I prefix.
|
||||
|
||||
```solidity
|
||||
interface IERC777 {
|
||||
```
|
||||
|
||||
* Contracts not intended to be used standalone should be marked abstract
|
||||
so they are required to be inherited to other contracts.
|
||||
|
||||
```solidity
|
||||
abstract contract AccessControl is ..., {
|
||||
```
|
||||
|
||||
* Return values are generally not named, unless they are not immediately clear or there are multiple return values.
|
||||
|
||||
```solidity
|
||||
function expiration() public view returns (uint256) { // Good
|
||||
function hasRole() public view returns (bool isMember, uint32 currentDelay) { // Good
|
||||
```
|
||||
|
||||
* Unchecked arithmetic blocks should contain comments explaining why overflow is guaranteed not to happen. If the reason is immediately apparent from the line above the unchecked block, the comment may be omitted.
|
||||
|
||||
* Custom errors should be declared following the [EIP-6093](https://eips.ethereum.org/EIPS/eip-6093) rationale whenever reasonable. Also, consider the following:
|
||||
|
||||
* The domain prefix should be picked in the following order:
|
||||
1. Use `ERC<number>` if the error is a violation of an ERC specification.
|
||||
2. Use the name of the underlying component where it belongs (eg. `Governor`, `ECDSA`, or `Timelock`).
|
||||
|
||||
* The location of custom errors should be decided in the following order:
|
||||
1. Take the errors from their underlying ERCs if they're already defined.
|
||||
2. Declare the errors in the underlying interface/library if the error makes sense in its context.
|
||||
3. Declare the error in the implementation if the underlying interface/library is not suitable to do so (eg. interface/library already specified in an ERC).
|
||||
4. Declare the error in an extension if the error only happens in such extension or child contracts.
|
||||
|
||||
* Custom error names should not be declared twice along the library to avoid duplicated identifier declarations when inheriting from multiple contracts.
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2019 zOS Global Limited
|
||||
Copyright (c) 2016-2024 Zeppelin Group Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
105
README.md
105
README.md
@ -1,64 +1,107 @@
|
||||
# <img src="logo.png" alt="OpenZeppelin" height="40px">
|
||||
# <img src="logo.svg" alt="OpenZeppelin" height="40px">
|
||||
|
||||
[](https://www.npmjs.org/package/@openzeppelin/contracts)
|
||||
[](https://circleci.com/gh/OpenZeppelin/openzeppelin-contracts)
|
||||
[](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts)
|
||||
[](https://www.gitpoap.io/gh/OpenZeppelin/openzeppelin-contracts)
|
||||
[](https://docs.openzeppelin.com/contracts)
|
||||
[](https://docs.openzeppelin.com/contracts)
|
||||
|
||||
**OpenZeppelin Contracts is a library for secure smart contract development.** It provides implementations of standards like ERC20 and ERC721 which you can deploy as-is or extend to suit your needs, as well as Solidity components to build custom contracts and more complex decentralized systems.
|
||||
**A library for secure smart contract development.** Build on a solid foundation of community-vetted code.
|
||||
|
||||
## Install
|
||||
* Implementations of standards like [ERC20](https://docs.openzeppelin.com/contracts/erc20) and [ERC721](https://docs.openzeppelin.com/contracts/erc721).
|
||||
* Flexible [role-based permissioning](https://docs.openzeppelin.com/contracts/access-control) scheme.
|
||||
* Reusable [Solidity components](https://docs.openzeppelin.com/contracts/utilities) to build custom contracts and complex decentralized systems.
|
||||
|
||||
:mage: **Not sure how to get started?** Check out [Contracts Wizard](https://wizard.openzeppelin.com/) — an interactive smart contract generator.
|
||||
|
||||
:building_construction: **Want to scale your decentralized application?** Check out [OpenZeppelin Defender](https://openzeppelin.com/defender) — a mission-critical developer security platform to code, audit, deploy, monitor, and operate with confidence.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> OpenZeppelin Contracts uses semantic versioning to communicate backwards compatibility of its API and storage layout. For upgradeable contracts, the storage layout of different major versions should be assumed incompatible, for example, it is unsafe to upgrade from 4.9.3 to 5.0.0. Learn more at [Backwards Compatibility](https://docs.openzeppelin.com/contracts/backwards-compatibility).
|
||||
|
||||
## Overview
|
||||
|
||||
### Installation
|
||||
|
||||
#### Hardhat (npm)
|
||||
|
||||
```
|
||||
npm install @openzeppelin/contracts
|
||||
$ npm install @openzeppelin/contracts
|
||||
```
|
||||
|
||||
OpenZeppelin Contracts features a stable API, which means your contracts won't break unexpectedly when upgrading to a newer minor version. You can read ṫhe details in our [API Stability] document.
|
||||
#### Foundry (git)
|
||||
|
||||
## Usage
|
||||
> [!WARNING]
|
||||
> When installing via git, it is a common error to use the `master` branch. This is a development branch that should be avoided in favor of tagged releases. The release process involves security measures that the `master` branch does not guarantee.
|
||||
|
||||
To write your custom contracts, import ours and extend them through inheritance.
|
||||
> [!WARNING]
|
||||
> Foundry installs the latest version initially, but subsequent `forge update` commands will use the `master` branch.
|
||||
|
||||
```
|
||||
$ forge install OpenZeppelin/openzeppelin-contracts
|
||||
```
|
||||
|
||||
Add `@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/` in `remappings.txt.`
|
||||
|
||||
### Usage
|
||||
|
||||
Once installed, you can use the contracts in the library by importing them:
|
||||
|
||||
```solidity
|
||||
pragma solidity ^0.5.0;
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
|
||||
import "@openzeppelin/contracts/token/ERC721/ERC721Mintable.sol";
|
||||
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
|
||||
|
||||
contract MyNFT is ERC721Full, ERC721Mintable {
|
||||
constructor() ERC721Full("MyNFT", "MNFT") public {
|
||||
}
|
||||
contract MyCollectible is ERC721 {
|
||||
constructor() ERC721("MyCollectible", "MCO") {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> You need an ethereum development framework for the above import statements to work! Check out these guides for [Truffle], [Embark] or [Buidler].
|
||||
_If you're new to smart contract development, head to [Developing Smart Contracts](https://docs.openzeppelin.com/learn/developing-smart-contracts) to learn about creating a new project and compiling your contracts._
|
||||
|
||||
On our site you will find a few [guides] to learn about the different parts of OpenZeppelin, as well as [documentation for the API][API docs]. Keep in mind that the API docs are work in progress, and don’t hesitate to ask questions in [our forum][forum].
|
||||
To keep your system secure, you should **always** use the installed code as-is, and neither copy-paste it from online sources nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs.
|
||||
|
||||
## Learn More
|
||||
|
||||
The guides in the [documentation site](https://docs.openzeppelin.com/contracts) will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides:
|
||||
|
||||
* [Access Control](https://docs.openzeppelin.com/contracts/access-control): decide who can perform each of the actions on your system.
|
||||
* [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales).
|
||||
* [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools including non-overflowing math, signature verification, and trustless paying systems.
|
||||
|
||||
The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts's development in the [community forum](https://forum.openzeppelin.com).
|
||||
|
||||
Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/), which cover several common use cases and good practices. The following articles provide great background reading, though please note that some of the referenced tools have changed, as the tooling in the ecosystem continues to rapidly evolve.
|
||||
|
||||
* [The Hitchhiker’s Guide to Smart Contracts in Ethereum](https://blog.openzeppelin.com/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05) will help you get an overview of the various tools available for smart contract development, and help you set up your environment.
|
||||
* [A Gentle Introduction to Ethereum Programming, Part 1](https://blog.openzeppelin.com/a-gentle-introduction-to-ethereum-programming-part-1-783cc7796094) provides very useful information on an introductory level, including many basic concepts from the Ethereum platform.
|
||||
* For a more in-depth dive, you may read the guide [Designing the Architecture for Your Ethereum Application](https://blog.openzeppelin.com/designing-the-architecture-for-your-ethereum-application-9cec086f8317), which discusses how to better structure your application and its relationship to the real world.
|
||||
|
||||
## Security
|
||||
|
||||
This project is maintained by [OpenZeppelin], and developed following our high standards for code quality and security. OpenZeppelin is meant to provide tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problems you might experience.
|
||||
This project is maintained by [OpenZeppelin](https://openzeppelin.com) with the goal of providing a secure and reliable library of smart contract components for the ecosystem. We address security through risk management in various areas such as engineering and open source best practices, scoping and API design, multi-layered review processes, and incident response preparedness.
|
||||
|
||||
The core development principles and strategies that OpenZeppelin is based on include: security in depth, simple and modular code, clarity-driven naming conventions, comprehensive unit testing, pre-and-post-condition sanity checks, code consistency, and regular audits.
|
||||
The [OpenZeppelin Contracts Security Center](https://contracts.openzeppelin.com/security) contains more details about the secure development process.
|
||||
|
||||
The latest audit was done on October 2018 on version 2.0.0.
|
||||
The security policy is detailed in [`SECURITY.md`](./SECURITY.md) as well, and specifies how you can report security vulnerabilities, which versions will receive security patches, and how to stay informed about them. We run a [bug bounty program on Immunefi](https://immunefi.com/bounty/openzeppelin) to reward the responsible disclosure of vulnerabilities.
|
||||
|
||||
Please report any security issues you find to security@openzeppelin.org.
|
||||
The engineering guidelines we follow to promote project quality can be found in [`GUIDELINES.md`](./GUIDELINES.md).
|
||||
|
||||
Past audits can be found in [`audits/`](./audits).
|
||||
|
||||
Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. Although OpenZeppelin is well known for its security audits, using OpenZeppelin Contracts is not a substitute for a security audit.
|
||||
|
||||
OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. As set out further in the Terms, you acknowledge that you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use.
|
||||
|
||||
## Contribute
|
||||
|
||||
OpenZeppelin exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the [contribution guide]!
|
||||
OpenZeppelin Contracts exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the [contribution guide](CONTRIBUTING.md)!
|
||||
|
||||
## License
|
||||
|
||||
OpenZeppelin is released under the [MIT License](LICENSE).
|
||||
OpenZeppelin Contracts is released under the [MIT License](LICENSE).
|
||||
|
||||
## Legal
|
||||
|
||||
[API docs]: https://docs.openzeppelin.com/contracts/api/token/erc20
|
||||
[guides]: https://docs.openzeppelin.com/contracts
|
||||
[API Stability]: https://docs.openzeppelin.com/contracts/api-stability
|
||||
[forum]: https://forum.openzeppelin.com
|
||||
[OpenZeppelin]: https://openzeppelin.com
|
||||
[contribution guide]: CONTRIBUTING.md
|
||||
[Truffle]: https://truffleframework.com/docs/truffle/quickstart
|
||||
[Embark]: https://embark.status.im/docs/quick_start.html
|
||||
[Buidler]: https://buidler.dev/guides/#getting-started
|
||||
Your use of this Project is governed by the terms found at www.openzeppelin.com/tos (the "Terms").
|
||||
|
||||
124
RELEASING.md
124
RELEASING.md
@ -1,99 +1,45 @@
|
||||
# Releasing
|
||||
|
||||
This document describes our release process, and contains the steps to be followed by an OpenZeppelin maintainer at the several stages of a release.
|
||||
OpenZeppelin Contracts uses a fully automated release process that takes care of compiling, packaging, and publishing the library, all of which is carried out in a clean CI environment (GitHub Actions), implemented in the ([`release-cycle`](.github/workflows/release-cycle.yml)) workflow. This helps to reduce the potential for human error and inconsistencies, and ensures that the release process is ongoing and reliable.
|
||||
|
||||
We release a new version of OpenZeppelin monthly. Release cycles are tracked in the [issue milestones](https://github.com/OpenZeppelin/openzeppelin-contracts/milestones).
|
||||
## Changesets
|
||||
|
||||
Each release has at least one release candidate published first, intended for community review and any critical fixes that may come out of it. At the moment we leave 1 week between the first release candidate and the final release.
|
||||
[Changesets](https://github.com/changesets/changesets/) is used as part of our release process for `CHANGELOG.md` management. Each change that is relevant for the codebase is expected to include a changeset.
|
||||
|
||||
Before starting make sure to verify the following items.
|
||||
* Your local `master` branch is in sync with your `upstream` remote (it may have another name depending on your setup).
|
||||
* Your repo is clean, particularly with no untracked files in the contracts and tests directories. Verify with `git clean -n`.
|
||||
## Branching model
|
||||
|
||||
The release cycle happens on release branches called `release-vX.Y`. Each of these branches starts as a release candidate (rc) and is eventually promoted to final.
|
||||
|
||||
## Creating the release branch
|
||||
A release branch can be updated with cherry-picked patches from `master`, or may sometimes be committed to directly in the case of old releases. These commits will lead to a new release candidate or a patch increment depending on the state of the release branch.
|
||||
|
||||
We'll refer to a release `vX.Y.Z`.
|
||||
```mermaid
|
||||
%%{init: {'gitGraph': {'mainBranchName': 'master'}} }%%
|
||||
gitGraph
|
||||
commit id: "Feature A"
|
||||
commit id: "Feature B"
|
||||
branch release-vX.Y
|
||||
commit id: "Start release"
|
||||
commit id: "Release vX.Y.0-rc.0"
|
||||
|
||||
checkout master
|
||||
commit id: "Feature C"
|
||||
commit id: "Fix A"
|
||||
|
||||
checkout release-vX.Y
|
||||
cherry-pick id: "Fix A" tag: ""
|
||||
commit id: "Release vX.Y.0-rc.1"
|
||||
commit id: "Release vX.Y.0"
|
||||
|
||||
checkout master
|
||||
merge release-vX.Y
|
||||
commit id: "Feature D"
|
||||
commit id: "Patch B"
|
||||
|
||||
checkout release-vX.Y
|
||||
cherry-pick id: "Patch B" tag: ""
|
||||
commit id: "Release vX.Y.1"
|
||||
|
||||
checkout master
|
||||
merge release-vX.Y
|
||||
commit id: "Feature E"
|
||||
```
|
||||
git checkout master
|
||||
git checkout -b release-vX.Y.Z
|
||||
```
|
||||
|
||||
## Creating a release candidate
|
||||
|
||||
Once in the release branch, change the version string in `package.json`, `package-lock.json` and `ethpm.json` to `X.Y.Z-rc.R`. (This will be `X.Y.Z-rc.1` for the first release candidate.) Commit these changes and tag the commit as `vX.Y.Z-rc.R`.
|
||||
|
||||
```
|
||||
git add package.json package-lock.json ethpm.json
|
||||
git commit -m "Release candidate vX.Y.Z-rc.R"
|
||||
git tag -a vX.Y.Z-rc.R
|
||||
git push upstream release-vX.Y.Z
|
||||
git push upstream vX.Y.Z-rc.R
|
||||
```
|
||||
|
||||
Draft the release notes in our [GitHub releases](https://github.com/OpenZeppelin/openzeppelin-contracts/releases). Make sure to mark it as a pre-release! Try to be consistent with our previous release notes in the title and format of the text. Release candidates don't need a detailed changelog, but make sure to include a link to GitHub's compare page.
|
||||
|
||||
Once the CI run for the new tag is green, publish on npm under the `next` tag. You should see the contracts compile automatically.
|
||||
|
||||
```
|
||||
npm publish --tag next
|
||||
```
|
||||
|
||||
Publish the release notes on GitHub and the forum, and ask our community manager to announce the release candidate on at least Twitter.
|
||||
|
||||
## Creating the final release
|
||||
|
||||
Make sure to have the latest changes from `upstream` in your local release branch.
|
||||
|
||||
```
|
||||
git checkout release-vX.Y.Z
|
||||
git pull upstream
|
||||
```
|
||||
|
||||
Before starting the release process, make one final commit to CHANGELOG.md, including the date of the release.
|
||||
|
||||
Change the version string in `package.json`, `package-lock.json` and `ethpm.json` removing the "-rc.R" suffix. Commit these changes and tag the commit as `vX.Y.Z`.
|
||||
|
||||
```
|
||||
git add package.json package-lock.json ethpm.json
|
||||
git commit -m "Release vX.Y.Z"
|
||||
git tag -a vX.Y.Z
|
||||
git push upstream release-vX.Y.Z
|
||||
git push upstream vX.Y.Z
|
||||
```
|
||||
|
||||
Draft the release notes in GitHub releases. Try to be consistent with our previous release notes in the title and format of the text. Make sure to include a detailed changelog.
|
||||
|
||||
Once the CI run for the new tag is green, publish on npm. You should see the contracts compile automatically.
|
||||
|
||||
```
|
||||
npm publish
|
||||
```
|
||||
|
||||
Publish the release notes on GitHub and ask our community manager to announce the release!
|
||||
|
||||
Delete the `next` tag in the npm package as there is no longer a release candidate.
|
||||
|
||||
```
|
||||
npm dist-tag rm --otp $2FA_CODE @openzeppelin/contracts next
|
||||
```
|
||||
|
||||
## Merging the release branch
|
||||
|
||||
After the final release, the release branch should be merged back into `master`. This merge must not be squashed because it would lose the tagged release commit. Since the GitHub repo is set up to only allow squashed merges, the merge should be done locally and pushed.
|
||||
|
||||
Make sure to have the latest changes from `upstream` in your local release branch.
|
||||
|
||||
```
|
||||
git checkout release-vX.Y.Z
|
||||
git pull upstream
|
||||
```
|
||||
|
||||
```
|
||||
git checkout master
|
||||
git merge --no-ff release-vX.Y.Z
|
||||
git push upstream master
|
||||
```
|
||||
|
||||
The release branch can then be deleted on GitHub.
|
||||
|
||||
43
SECURITY.md
Normal file
43
SECURITY.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Security Policy
|
||||
|
||||
Security vulnerabilities should be disclosed to the project maintainers through [Immunefi], or alternatively by email to security@openzeppelin.com.
|
||||
|
||||
[Immunefi]: https://immunefi.com/bounty/openzeppelin
|
||||
|
||||
## Bug Bounty
|
||||
|
||||
Responsible disclosure of security vulnerabilities is rewarded through a bug bounty program on [Immunefi].
|
||||
|
||||
There is a bonus reward for issues introduced in release candidates that are reported before making it into a stable release. Learn more about release candidates at [`RELEASING.md`](./RELEASING.md).
|
||||
|
||||
## Security Patches
|
||||
|
||||
Security vulnerabilities will be patched as soon as responsibly possible, and published as an advisory on this repository (see [advisories]) and on the affected npm packages.
|
||||
|
||||
[advisories]: https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories
|
||||
|
||||
Projects that build on OpenZeppelin Contracts are encouraged to clearly state, in their source code and websites, how to be contacted about security issues in the event that a direct notification is considered necessary. We recommend including it in the NatSpec for the contract as `/// @custom:security-contact security@example.com`.
|
||||
|
||||
Additionally, we recommend installing the library through npm and setting up vulnerability alerts such as [Dependabot].
|
||||
|
||||
[Dependabot]: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security#what-is-dependabot
|
||||
|
||||
### Supported Versions
|
||||
|
||||
Security patches will be released for the latest minor of a given major release. For example, if an issue is found in versions >=4.6.0 and the latest is 4.8.0, the patch will be released only in version 4.8.1.
|
||||
|
||||
Only critical severity bug fixes will be backported to past major releases.
|
||||
|
||||
| Version | Critical security fixes | Other security fixes |
|
||||
| ------- | ----------------------- | -------------------- |
|
||||
| 5.x | :white_check_mark: | :white_check_mark: |
|
||||
| 4.9 | :white_check_mark: | :x: |
|
||||
| 3.4 | :white_check_mark: | :x: |
|
||||
| 2.5 | :x: | :x: |
|
||||
| < 2.0 | :x: | :x: |
|
||||
|
||||
Note as well that the Solidity language itself only guarantees security updates for the latest release.
|
||||
|
||||
## Legal
|
||||
|
||||
Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. Your use of the project is also governed by the terms found at www.openzeppelin.com/tos (the "Terms"). As set out in the Terms, you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an on-going duty by any contributor, including OpenZeppelin, to correct any flaws or alert you to all or any of the potential risks of utilizing the project.
|
||||
@ -1,5 +1,7 @@
|
||||
# OpenZeppelin Audit
|
||||
|
||||
NOTE ON 2021-07-19: This report makes reference to Zeppelin, OpenZeppelin, OpenZeppelin Contracts, the OpenZeppelin team, and OpenZeppelin library. Many of these things have since been renamed and know that this audit applies to what is currently called the OpenZeppelin Contracts which are maintained by the OpenZeppelin Contracts Community.
|
||||
|
||||
March, 2017
|
||||
Authored by Dennis Peterson and Peter Vessenes
|
||||
|
||||
@ -131,7 +133,7 @@ I presume that the goal of this contract is to allow and annotate a migration to
|
||||
|
||||
We like these pauses! Note that these allow significant griefing potential by owners, and that this might not be obvious to participants in smart contracts using the OpenZeppelin framework. We would recommend that additional sample logic be added to for instance the TokenContract showing safer use of the pause and resume functions. In particular, we would recommend a timelock after which anyone could unpause the contract.
|
||||
|
||||
The modifers use the pattern `if(bool){_;}`. This is fine for functions that return false upon failure, but could be problematic for functions expected to throw upon failure. See our comments above on standardizing on `throw` or `return(false)`.
|
||||
The modifiers use the pattern `if(bool){_;}`. This is fine for functions that return false upon failure, but could be problematic for functions expected to throw upon failure. See our comments above on standardizing on `throw` or `return(false)`.
|
||||
|
||||
## Ownership
|
||||
|
||||
BIN
audits/2022-10-Checkpoints.pdf
Normal file
BIN
audits/2022-10-Checkpoints.pdf
Normal file
Binary file not shown.
BIN
audits/2022-10-ERC4626.pdf
Normal file
BIN
audits/2022-10-ERC4626.pdf
Normal file
Binary file not shown.
BIN
audits/2023-05-v4.9.pdf
Normal file
BIN
audits/2023-05-v4.9.pdf
Normal file
Binary file not shown.
BIN
audits/2023-10-v5.0.pdf
Normal file
BIN
audits/2023-10-v5.0.pdf
Normal file
Binary file not shown.
BIN
audits/2024-10-v5.1.pdf
Normal file
BIN
audits/2024-10-v5.1.pdf
Normal file
Binary file not shown.
18
audits/README.md
Normal file
18
audits/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Audits
|
||||
|
||||
| Date | Version | Commit | Auditor | Scope | Links |
|
||||
| ------------ | ------- | --------- | ------------ | -------------------- | ----------------------------------------------------------- |
|
||||
| October 2024 | v5.1.0 | TBD | OpenZeppelin | v5.1 Changes | [🔗](./2024-10-v5.1.pdf) |
|
||||
| October 2023 | v5.0.0 | `b5a3e69` | OpenZeppelin | v5.0 Changes | [🔗](./2023-10-v5.0.pdf) |
|
||||
| May 2023 | v4.9.0 | `91df66c` | OpenZeppelin | v4.9 Changes | [🔗](./2023-05-v4.9.pdf) |
|
||||
| October 2022 | v4.8.0 | `14f98db` | OpenZeppelin | ERC4626, Checkpoints | [🔗](./2022-10-ERC4626.pdf) [🔗](./2022-10-Checkpoints.pdf) |
|
||||
| October 2018 | v2.0.0 | `dac5bcc` | LevelK | Everything | [🔗](./2018-10.pdf) |
|
||||
| March 2017 | v1.0.4 | `9c5975a` | New Alchemy | Everything | [🔗](./2017-03.md) |
|
||||
|
||||
# Formal Verification
|
||||
|
||||
| Date | Version | Commit | Tool | Scope | Links |
|
||||
| ------------ | ------- | --------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
|
||||
| May 2022 | v4.7.0 | `109778c` | Certora | Initializable, GovernorPreventLateQuorum, ERC1155Burnable, ERC1155Pausable, ERC1155Supply, ERC1155Holder, ERC1155Receiver | [🔗](../certora/reports/2022-05.pdf) |
|
||||
| March 2022 | v4.4.0 | `4088540` | Certora | ERC20Votes, ERC20FlashMint, ERC20Wrapper, TimelockController, ERC721Votes, Votes, AccessControl, ERC1155 | [🔗](../certora/reports/2022-03.pdf) |
|
||||
| October 2021 | v4.4.0 | `4088540` | Certora | Governor, GovernorCountingSimple, GovernorProposalThreshold, GovernorTimelockControl, GovernorVotes, GovernorVotesQuorumFraction | [🔗](../certora/reports/2021-10.pdf) |
|
||||
1
certora/.gitignore
vendored
Normal file
1
certora/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
patched
|
||||
54
certora/Makefile
Normal file
54
certora/Makefile
Normal file
@ -0,0 +1,54 @@
|
||||
default: help
|
||||
|
||||
SRC := ../contracts
|
||||
DST := patched
|
||||
DIFF := diff
|
||||
SRCS := $(shell find $(SRC) -type f)
|
||||
DSTS := $(shell find $(DST) -type f)
|
||||
DIFFS := $(shell find $(DIFF) -type f)
|
||||
|
||||
###############################################################################
|
||||
# Apply all patches in the $DIFF folder to the $DST folder
|
||||
apply: $(DST) $(patsubst $(DIFF)/%.patch,$(DST)/%,$(subst _,/,$(DIFFS)))
|
||||
|
||||
# Reset the $DST folder
|
||||
$(DST): FORCE
|
||||
@rm -rf $@
|
||||
@cp -r $(SRC) $@
|
||||
|
||||
# Update a solidity file in the $DST directory using the corresponding patch
|
||||
$(DST)/%.sol: FORCE | $(DST)
|
||||
@echo Applying patch to $@
|
||||
@patch -p0 -d $(DST) < $(patsubst $(DST)_%,$(DIFF)/%.patch,$(subst /,_,$@))
|
||||
|
||||
###############################################################################
|
||||
# Record all difference between $SRC and $DST in patches
|
||||
record: $(DIFF) $(patsubst %,$(DIFF)/%.patch,$(subst /,_,$(subst $(SRC)/,,$(SRCS)) $(subst $(DST)/,,$(DSTS))))
|
||||
|
||||
# Create the $DIFF folder
|
||||
$(DIFF): FORCE
|
||||
@rm -rf $@
|
||||
@mkdir $@
|
||||
|
||||
# Create the patch file by comparing the source and the destination
|
||||
$(DIFF)/%.patch: FORCE | $(DIFF)
|
||||
@echo Generating patch $@
|
||||
@diff -ruN \
|
||||
$(patsubst $(DIFF)/%.patch,$(SRC)/%,$(subst _,/,$@)) \
|
||||
$(patsubst $(DIFF)/%.patch,$(DST)/%,$(subst _,/,$@)) \
|
||||
| sed 's+$(SRC)/++g' \
|
||||
| sed 's+$(DST)/++g' \
|
||||
> $@
|
||||
@[ -s $@ ] || rm $@
|
||||
|
||||
###############################################################################
|
||||
help:
|
||||
@echo "usage:"
|
||||
@echo " make apply: create $(DST) directory by applying the patches to $(SRC)"
|
||||
@echo " make record: record the patches capturing the differences between $(SRC) and $(DST)"
|
||||
@echo " make clean: remove all generated files (those ignored by git)"
|
||||
|
||||
clean:
|
||||
git clean -fdX
|
||||
|
||||
FORCE: ;
|
||||
60
certora/README.md
Normal file
60
certora/README.md
Normal file
@ -0,0 +1,60 @@
|
||||
# Running the certora verification tool
|
||||
|
||||
These instructions detail the process for running Certora Verification Tool on OpenZeppelin Contracts.
|
||||
|
||||
Documentation for CVT and the specification language are available [here](https://certora.atlassian.net/wiki/spaces/CPD/overview).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Follow the [Certora installation guide](https://docs.certora.com/en/latest/docs/user-guide/getting-started/install.html) in order to get the Certora Prover Package and the `solc` executable folder in your path.
|
||||
|
||||
> **Note**
|
||||
> An API Key is required for local testing. Although the prover will run on a Github Actions' CI environment on selected Pull Requests.
|
||||
|
||||
## Running the verification
|
||||
|
||||
The Certora Verification Tool proves specs for contracts, which are defined by the `./specs.json` file along with their pre-configured options.
|
||||
|
||||
The verification script `./run.js` is used to submit verification jobs to the Certora Verification service.
|
||||
|
||||
You can run it from the root of the repository with the following command:
|
||||
|
||||
```bash
|
||||
node certora/run.js [[CONTRACT_NAME:]SPEC_NAME] [OPTIONS...]
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `CONTRACT_NAME` matches the `contract` key in the `./spec.json` file and may be empty. It will run all matching contracts if not provided.
|
||||
- `SPEC_NAME` refers to a `spec` key from the `./specs.json` file. It will run every spec if not provided.
|
||||
- `OPTIONS` extend the [Certora Prover CLI options](https://docs.certora.com/en/latest/docs/prover/cli/options.html#certora-prover-cli-options) and will respect the preconfigured options in the `specs.json` file.
|
||||
|
||||
> **Note**
|
||||
> A single spec may be configured to run for multiple contracts, whereas a single contract may run multiple specs.
|
||||
|
||||
Example usage:
|
||||
|
||||
```bash
|
||||
node certora/run.js AccessControl # Run the AccessControl spec against every contract implementing it
|
||||
```
|
||||
|
||||
## Adapting to changes in the contracts
|
||||
|
||||
Some of our rules require the code to be simplified in various ways. Our primary tool for performing these simplifications is to run verification on a contract that extends the original contracts and overrides some of the methods. These "harness" contracts can be found in the `certora/harness` directory.
|
||||
|
||||
This pattern does require some modifications to the original code: some methods need to be made virtual or public, for example. These changes are handled by applying a patch
|
||||
to the code before verification by running:
|
||||
|
||||
```bash
|
||||
make -C certora apply
|
||||
```
|
||||
|
||||
Before running the `certora/run.js` script, it's required to apply the corresponding patches to the `contracts` directory, placing the output in the `certora/patched` directory. Then, the contracts are verified by running the verification for the `certora/patched` directory.
|
||||
|
||||
If the original contracts change, it is possible to create a conflict with the patch. In this case, the verify scripts will report an error message and output rejected changes in the `patched` directory. After merging the changes, run `make record` in the `certora` directory; this will regenerate the patch file, which can then be checked into git.
|
||||
|
||||
For more information about the `make` scripts available, run:
|
||||
|
||||
```bash
|
||||
make -C certora help
|
||||
```
|
||||
97
certora/diff/access_manager_AccessManager.sol.patch
Normal file
97
certora/diff/access_manager_AccessManager.sol.patch
Normal file
@ -0,0 +1,97 @@
|
||||
--- access/manager/AccessManager.sol 2023-10-05 12:17:09.694051809 -0300
|
||||
+++ access/manager/AccessManager.sol 2023-10-05 12:26:18.498688718 -0300
|
||||
@@ -6,7 +6,6 @@
|
||||
import {IAccessManaged} from "./IAccessManaged.sol";
|
||||
import {Address} from "../../utils/Address.sol";
|
||||
import {Context} from "../../utils/Context.sol";
|
||||
-import {Multicall} from "../../utils/Multicall.sol";
|
||||
import {Math} from "../../utils/math/Math.sol";
|
||||
import {Time} from "../../utils/types/Time.sol";
|
||||
|
||||
@@ -57,7 +56,8 @@
|
||||
* mindful of the danger associated with functions such as {{Ownable-renounceOwnership}} or
|
||||
* {{AccessControl-renounceRole}}.
|
||||
*/
|
||||
-contract AccessManager is Context, Multicall, IAccessManager {
|
||||
+// NOTE: The FV version of this contract doesn't include Multicall because CVL HAVOCs on any `delegatecall`.
|
||||
+contract AccessManager is Context, IAccessManager {
|
||||
using Time for *;
|
||||
|
||||
// Structure that stores the details for a target contract.
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
// Used to identify operations that are currently being executed via {execute}.
|
||||
// This should be transient storage when supported by the EVM.
|
||||
- bytes32 private _executionId;
|
||||
+ bytes32 internal _executionId; // private → internal for FV
|
||||
|
||||
/**
|
||||
* @dev Check that the caller is authorized to perform the operation, following the restrictions encoded in
|
||||
@@ -253,6 +253,11 @@
|
||||
_setGrantDelay(roleId, newDelay);
|
||||
}
|
||||
|
||||
+ // Exposed for FV
|
||||
+ function _getTargetAdminDelayFull(address target) internal view virtual returns (uint32, uint32, uint48) {
|
||||
+ return _targets[target].adminDelay.getFull();
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* @dev Internal version of {grantRole} without access control. Returns true if the role was newly granted.
|
||||
*
|
||||
@@ -287,6 +292,11 @@
|
||||
return newMember;
|
||||
}
|
||||
|
||||
+ // Exposed for FV
|
||||
+ function _getRoleGrantDelayFull(uint64 roleId) internal view virtual returns (uint32, uint32, uint48) {
|
||||
+ return _roles[roleId].grantDelay.getFull();
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* @dev Internal version of {revokeRole} without access control. This logic is also used by {renounceRole}.
|
||||
* Returns true if the role was previously granted.
|
||||
@@ -586,7 +596,7 @@
|
||||
/**
|
||||
* @dev Check if the current call is authorized according to admin logic.
|
||||
*/
|
||||
- function _checkAuthorized() private {
|
||||
+ function _checkAuthorized() internal virtual { // private → internal virtual for FV
|
||||
address caller = _msgSender();
|
||||
(bool immediate, uint32 delay) = _canCallSelf(caller, _msgData());
|
||||
if (!immediate) {
|
||||
@@ -609,7 +619,7 @@
|
||||
*/
|
||||
function _getAdminRestrictions(
|
||||
bytes calldata data
|
||||
- ) private view returns (bool adminRestricted, uint64 roleAdminId, uint32 executionDelay) {
|
||||
+ ) internal view returns (bool adminRestricted, uint64 roleAdminId, uint32 executionDelay) { // private → internal for FV
|
||||
if (data.length < 4) {
|
||||
return (false, 0, 0);
|
||||
}
|
||||
@@ -662,7 +672,7 @@
|
||||
address caller,
|
||||
address target,
|
||||
bytes calldata data
|
||||
- ) private view returns (bool immediate, uint32 delay) {
|
||||
+ ) internal view returns (bool immediate, uint32 delay) { // private → internal for FV
|
||||
if (target == address(this)) {
|
||||
return _canCallSelf(caller, data);
|
||||
} else {
|
||||
@@ -716,14 +726,14 @@
|
||||
/**
|
||||
* @dev Extracts the selector from calldata. Panics if data is not at least 4 bytes
|
||||
*/
|
||||
- function _checkSelector(bytes calldata data) private pure returns (bytes4) {
|
||||
+ function _checkSelector(bytes calldata data) internal pure returns (bytes4) { // private → internal for FV
|
||||
return bytes4(data[0:4]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Hashing function for execute protection
|
||||
*/
|
||||
- function _hashExecutionId(address target, bytes4 selector) private pure returns (bytes32) {
|
||||
+ function _hashExecutionId(address target, bytes4 selector) internal pure returns (bytes32) { // private → internal for FV
|
||||
return keccak256(abi.encode(target, selector));
|
||||
}
|
||||
}
|
||||
46
certora/harnesses/AccessControlDefaultAdminRulesHarness.sol
Normal file
46
certora/harnesses/AccessControlDefaultAdminRulesHarness.sol
Normal file
@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {AccessControlDefaultAdminRules} from "../patched/access/extensions/AccessControlDefaultAdminRules.sol";
|
||||
|
||||
contract AccessControlDefaultAdminRulesHarness is AccessControlDefaultAdminRules {
|
||||
uint48 private _delayIncreaseWait;
|
||||
|
||||
constructor(
|
||||
uint48 initialDelay,
|
||||
address initialDefaultAdmin,
|
||||
uint48 delayIncreaseWait
|
||||
) AccessControlDefaultAdminRules(initialDelay, initialDefaultAdmin) {
|
||||
_delayIncreaseWait = delayIncreaseWait;
|
||||
}
|
||||
|
||||
// FV
|
||||
function pendingDefaultAdmin_() external view returns (address) {
|
||||
(address newAdmin, ) = pendingDefaultAdmin();
|
||||
return newAdmin;
|
||||
}
|
||||
|
||||
function pendingDefaultAdminSchedule_() external view returns (uint48) {
|
||||
(, uint48 schedule) = pendingDefaultAdmin();
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function pendingDelay_() external view returns (uint48) {
|
||||
(uint48 newDelay, ) = pendingDefaultAdminDelay();
|
||||
return newDelay;
|
||||
}
|
||||
|
||||
function pendingDelaySchedule_() external view returns (uint48) {
|
||||
(, uint48 schedule) = pendingDefaultAdminDelay();
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function delayChangeWait_(uint48 newDelay) external view returns (uint48) {
|
||||
return _delayChangeWait(newDelay);
|
||||
}
|
||||
|
||||
// Overrides
|
||||
function defaultAdminDelayIncreaseWait() public view override returns (uint48) {
|
||||
return _delayIncreaseWait;
|
||||
}
|
||||
}
|
||||
6
certora/harnesses/AccessControlHarness.sol
Normal file
6
certora/harnesses/AccessControlHarness.sol
Normal file
@ -0,0 +1,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {AccessControl} from "../patched/access/AccessControl.sol";
|
||||
|
||||
contract AccessControlHarness is AccessControl {}
|
||||
36
certora/harnesses/AccessManagedHarness.sol
Normal file
36
certora/harnesses/AccessManagedHarness.sol
Normal file
@ -0,0 +1,36 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "../patched/access/manager/IAccessManager.sol";
|
||||
import "../patched/access/manager/AccessManaged.sol";
|
||||
|
||||
contract AccessManagedHarness is AccessManaged {
|
||||
bytes internal SOME_FUNCTION_CALLDATA = abi.encodeCall(this.someFunction, ());
|
||||
|
||||
constructor(address initialAuthority) AccessManaged(initialAuthority) {}
|
||||
|
||||
function someFunction() public restricted() {
|
||||
// Sanity for FV: the msg.data when calling this function should be the same as the data used when checking
|
||||
// the schedule. This is a reformulation of `msg.data == SOME_FUNCTION_CALLDATA` that focuses on the operation
|
||||
// hash for this call.
|
||||
require(
|
||||
IAccessManager(authority()).hashOperation(_msgSender(), address(this), msg.data)
|
||||
==
|
||||
IAccessManager(authority()).hashOperation(_msgSender(), address(this), SOME_FUNCTION_CALLDATA)
|
||||
);
|
||||
}
|
||||
|
||||
function authority_canCall_immediate(address caller) public view returns (bool result) {
|
||||
(result,) = AuthorityUtils.canCallWithDelay(authority(), caller, address(this), this.someFunction.selector);
|
||||
}
|
||||
|
||||
function authority_canCall_delay(address caller) public view returns (uint32 result) {
|
||||
(,result) = AuthorityUtils.canCallWithDelay(authority(), caller, address(this), this.someFunction.selector);
|
||||
}
|
||||
|
||||
function authority_getSchedule(address caller) public view returns (uint48) {
|
||||
IAccessManager manager = IAccessManager(authority());
|
||||
return manager.getSchedule(manager.hashOperation(caller, address(this), SOME_FUNCTION_CALLDATA));
|
||||
}
|
||||
}
|
||||
116
certora/harnesses/AccessManagerHarness.sol
Normal file
116
certora/harnesses/AccessManagerHarness.sol
Normal file
@ -0,0 +1,116 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "../patched/access/manager/AccessManager.sol";
|
||||
|
||||
contract AccessManagerHarness is AccessManager {
|
||||
// override with a storage slot that can basically take any value.
|
||||
uint32 private _minSetback;
|
||||
|
||||
constructor(address initialAdmin) AccessManager(initialAdmin) {}
|
||||
|
||||
// FV
|
||||
function minSetback() public view override returns (uint32) {
|
||||
return _minSetback;
|
||||
}
|
||||
|
||||
function canCall_immediate(address caller, address target, bytes4 selector) external view returns (bool result) {
|
||||
(result,) = canCall(caller, target, selector);
|
||||
}
|
||||
|
||||
function canCall_delay(address caller, address target, bytes4 selector) external view returns (uint32 result) {
|
||||
(,result) = canCall(caller, target, selector);
|
||||
}
|
||||
|
||||
function canCallExtended(address caller, address target, bytes calldata data) external view returns (bool, uint32) {
|
||||
return _canCallExtended(caller, target, data);
|
||||
}
|
||||
|
||||
function canCallExtended_immediate(address caller, address target, bytes calldata data) external view returns (bool result) {
|
||||
(result,) = _canCallExtended(caller, target, data);
|
||||
}
|
||||
|
||||
function canCallExtended_delay(address caller, address target, bytes calldata data) external view returns (uint32 result) {
|
||||
(,result) = _canCallExtended(caller, target, data);
|
||||
}
|
||||
|
||||
function getAdminRestrictions_restricted(bytes calldata data) external view returns (bool result) {
|
||||
(result,,) = _getAdminRestrictions(data);
|
||||
}
|
||||
|
||||
function getAdminRestrictions_roleAdminId(bytes calldata data) external view returns (uint64 result) {
|
||||
(,result,) = _getAdminRestrictions(data);
|
||||
}
|
||||
|
||||
function getAdminRestrictions_executionDelay(bytes calldata data) external view returns (uint32 result) {
|
||||
(,,result) = _getAdminRestrictions(data);
|
||||
}
|
||||
|
||||
function hasRole_isMember(uint64 roleId, address account) external view returns (bool result) {
|
||||
(result,) = hasRole(roleId, account);
|
||||
}
|
||||
|
||||
function hasRole_executionDelay(uint64 roleId, address account) external view returns (uint32 result) {
|
||||
(,result) = hasRole(roleId, account);
|
||||
}
|
||||
|
||||
function getAccess_since(uint64 roleId, address account) external view returns (uint48 result) {
|
||||
(result,,,) = getAccess(roleId, account);
|
||||
}
|
||||
|
||||
function getAccess_currentDelay(uint64 roleId, address account) external view returns (uint32 result) {
|
||||
(,result,,) = getAccess(roleId, account);
|
||||
}
|
||||
|
||||
function getAccess_pendingDelay(uint64 roleId, address account) external view returns (uint32 result) {
|
||||
(,,result,) = getAccess(roleId, account);
|
||||
}
|
||||
|
||||
function getAccess_effect(uint64 roleId, address account) external view returns (uint48 result) {
|
||||
(,,,result) = getAccess(roleId, account);
|
||||
}
|
||||
|
||||
function getTargetAdminDelay_after(address target) public view virtual returns (uint32 result) {
|
||||
(,result,) = _getTargetAdminDelayFull(target);
|
||||
}
|
||||
|
||||
function getTargetAdminDelay_effect(address target) public view virtual returns (uint48 result) {
|
||||
(,,result) = _getTargetAdminDelayFull(target);
|
||||
}
|
||||
|
||||
function getRoleGrantDelay_after(uint64 roleId) public view virtual returns (uint32 result) {
|
||||
(,result,) = _getRoleGrantDelayFull(roleId);
|
||||
}
|
||||
|
||||
function getRoleGrantDelay_effect(uint64 roleId) public view virtual returns (uint48 result) {
|
||||
(,,result) = _getRoleGrantDelayFull(roleId);
|
||||
}
|
||||
|
||||
function hashExecutionId(address target, bytes4 selector) external pure returns (bytes32) {
|
||||
return _hashExecutionId(target, selector);
|
||||
}
|
||||
|
||||
function executionId() external view returns (bytes32) {
|
||||
return _executionId;
|
||||
}
|
||||
|
||||
// Pad with zeros (and don't revert) if data is too short.
|
||||
function getSelector(bytes calldata data) external pure returns (bytes4) {
|
||||
return bytes4(data);
|
||||
}
|
||||
|
||||
function getFirstArgumentAsAddress(bytes calldata data) external pure returns (address) {
|
||||
return abi.decode(data[0x04:0x24], (address));
|
||||
}
|
||||
|
||||
function getFirstArgumentAsUint64(bytes calldata data) external pure returns (uint64) {
|
||||
return abi.decode(data[0x04:0x24], (uint64));
|
||||
}
|
||||
|
||||
function _checkAuthorized() internal override {
|
||||
// We need this hack otherwise certora will assume _checkSelector(_msgData()) can return anything :/
|
||||
require(msg.sig == _checkSelector(_msgData()));
|
||||
super._checkAuthorized();
|
||||
}
|
||||
}
|
||||
58
certora/harnesses/DoubleEndedQueueHarness.sol
Normal file
58
certora/harnesses/DoubleEndedQueueHarness.sol
Normal file
@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {DoubleEndedQueue} from "../patched/utils/structs/DoubleEndedQueue.sol";
|
||||
|
||||
contract DoubleEndedQueueHarness {
|
||||
using DoubleEndedQueue for DoubleEndedQueue.Bytes32Deque;
|
||||
|
||||
DoubleEndedQueue.Bytes32Deque private _deque;
|
||||
|
||||
function pushFront(bytes32 value) external {
|
||||
_deque.pushFront(value);
|
||||
}
|
||||
|
||||
function pushBack(bytes32 value) external {
|
||||
_deque.pushBack(value);
|
||||
}
|
||||
|
||||
function popFront() external returns (bytes32 value) {
|
||||
return _deque.popFront();
|
||||
}
|
||||
|
||||
function popBack() external returns (bytes32 value) {
|
||||
return _deque.popBack();
|
||||
}
|
||||
|
||||
function clear() external {
|
||||
_deque.clear();
|
||||
}
|
||||
|
||||
function begin() external view returns (uint128) {
|
||||
return _deque._begin;
|
||||
}
|
||||
|
||||
function end() external view returns (uint128) {
|
||||
return _deque._end;
|
||||
}
|
||||
|
||||
function length() external view returns (uint256) {
|
||||
return _deque.length();
|
||||
}
|
||||
|
||||
function empty() external view returns (bool) {
|
||||
return _deque.empty();
|
||||
}
|
||||
|
||||
function front() external view returns (bytes32 value) {
|
||||
return _deque.front();
|
||||
}
|
||||
|
||||
function back() external view returns (bytes32 value) {
|
||||
return _deque.back();
|
||||
}
|
||||
|
||||
function at_(uint256 index) external view returns (bytes32 value) {
|
||||
return _deque.at(index);
|
||||
}
|
||||
}
|
||||
36
certora/harnesses/ERC20FlashMintHarness.sol
Normal file
36
certora/harnesses/ERC20FlashMintHarness.sol
Normal file
@ -0,0 +1,36 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "../patched/token/ERC20/ERC20.sol";
|
||||
import "../patched/token/ERC20/extensions/ERC20Permit.sol";
|
||||
import "../patched/token/ERC20/extensions/ERC20FlashMint.sol";
|
||||
|
||||
contract ERC20FlashMintHarness is ERC20, ERC20Permit, ERC20FlashMint {
|
||||
uint256 someFee;
|
||||
address someFeeReceiver;
|
||||
|
||||
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
|
||||
|
||||
function mint(address account, uint256 amount) external {
|
||||
_mint(account, amount);
|
||||
}
|
||||
|
||||
function burn(address account, uint256 amount) external {
|
||||
_burn(account, amount);
|
||||
}
|
||||
|
||||
// public accessor
|
||||
function flashFeeReceiver() public view returns (address) {
|
||||
return someFeeReceiver;
|
||||
}
|
||||
|
||||
// internal hook
|
||||
function _flashFee(address, uint256) internal view override returns (uint256) {
|
||||
return someFee;
|
||||
}
|
||||
|
||||
function _flashFeeReceiver() internal view override returns (address) {
|
||||
return someFeeReceiver;
|
||||
}
|
||||
}
|
||||
16
certora/harnesses/ERC20PermitHarness.sol
Normal file
16
certora/harnesses/ERC20PermitHarness.sol
Normal file
@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {ERC20Permit, ERC20} from "../patched/token/ERC20/extensions/ERC20Permit.sol";
|
||||
|
||||
contract ERC20PermitHarness is ERC20Permit {
|
||||
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
|
||||
|
||||
function mint(address account, uint256 amount) external {
|
||||
_mint(account, amount);
|
||||
}
|
||||
|
||||
function burn(address account, uint256 amount) external {
|
||||
_burn(account, amount);
|
||||
}
|
||||
}
|
||||
34
certora/harnesses/ERC20WrapperHarness.sol
Normal file
34
certora/harnesses/ERC20WrapperHarness.sol
Normal file
@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {ERC20Permit} from "../patched/token/ERC20/extensions/ERC20Permit.sol";
|
||||
import {ERC20Wrapper, IERC20, ERC20} from "../patched/token/ERC20/extensions/ERC20Wrapper.sol";
|
||||
|
||||
contract ERC20WrapperHarness is ERC20Permit, ERC20Wrapper {
|
||||
constructor(
|
||||
IERC20 _underlying,
|
||||
string memory _name,
|
||||
string memory _symbol
|
||||
) ERC20(_name, _symbol) ERC20Permit(_name) ERC20Wrapper(_underlying) {}
|
||||
|
||||
function underlyingTotalSupply() public view returns (uint256) {
|
||||
return underlying().totalSupply();
|
||||
}
|
||||
|
||||
function underlyingBalanceOf(address account) public view returns (uint256) {
|
||||
return underlying().balanceOf(account);
|
||||
}
|
||||
|
||||
function underlyingAllowanceToThis(address account) public view returns (uint256) {
|
||||
return underlying().allowance(account, address(this));
|
||||
}
|
||||
|
||||
function recover(address account) public returns (uint256) {
|
||||
return _recover(account);
|
||||
}
|
||||
|
||||
function decimals() public view override(ERC20Wrapper, ERC20) returns (uint8) {
|
||||
return super.decimals();
|
||||
}
|
||||
}
|
||||
13
certora/harnesses/ERC3156FlashBorrowerHarness.sol
Normal file
13
certora/harnesses/ERC3156FlashBorrowerHarness.sol
Normal file
@ -0,0 +1,13 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import {IERC3156FlashBorrower} from "../patched/interfaces/IERC3156FlashBorrower.sol";
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
contract ERC3156FlashBorrowerHarness is IERC3156FlashBorrower {
|
||||
bytes32 somethingToReturn;
|
||||
|
||||
function onFlashLoan(address, address, uint256, uint256, bytes calldata) external view override returns (bytes32) {
|
||||
return somethingToReturn;
|
||||
}
|
||||
}
|
||||
33
certora/harnesses/ERC721Harness.sol
Normal file
33
certora/harnesses/ERC721Harness.sol
Normal file
@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {ERC721} from "../patched/token/ERC721/ERC721.sol";
|
||||
|
||||
contract ERC721Harness is ERC721 {
|
||||
constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
|
||||
|
||||
function mint(address account, uint256 tokenId) external {
|
||||
_mint(account, tokenId);
|
||||
}
|
||||
|
||||
function safeMint(address to, uint256 tokenId) external {
|
||||
_safeMint(to, tokenId);
|
||||
}
|
||||
|
||||
function safeMint(address to, uint256 tokenId, bytes memory data) external {
|
||||
_safeMint(to, tokenId, data);
|
||||
}
|
||||
|
||||
function burn(uint256 tokenId) external {
|
||||
_burn(tokenId);
|
||||
}
|
||||
|
||||
function unsafeOwnerOf(uint256 tokenId) external view returns (address) {
|
||||
return _ownerOf(tokenId);
|
||||
}
|
||||
|
||||
function unsafeGetApproved(uint256 tokenId) external view returns (address) {
|
||||
return _getApproved(tokenId);
|
||||
}
|
||||
}
|
||||
11
certora/harnesses/ERC721ReceiverHarness.sol
Normal file
11
certora/harnesses/ERC721ReceiverHarness.sol
Normal file
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "../patched/interfaces/IERC721Receiver.sol";
|
||||
|
||||
contract ERC721ReceiverHarness is IERC721Receiver {
|
||||
function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {
|
||||
return this.onERC721Received.selector;
|
||||
}
|
||||
}
|
||||
55
certora/harnesses/EnumerableMapHarness.sol
Normal file
55
certora/harnesses/EnumerableMapHarness.sol
Normal file
@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {EnumerableMap} from "../patched/utils/structs/EnumerableMap.sol";
|
||||
|
||||
contract EnumerableMapHarness {
|
||||
using EnumerableMap for EnumerableMap.Bytes32ToBytes32Map;
|
||||
|
||||
EnumerableMap.Bytes32ToBytes32Map private _map;
|
||||
|
||||
function set(bytes32 key, bytes32 value) public returns (bool) {
|
||||
return _map.set(key, value);
|
||||
}
|
||||
|
||||
function remove(bytes32 key) public returns (bool) {
|
||||
return _map.remove(key);
|
||||
}
|
||||
|
||||
function contains(bytes32 key) public view returns (bool) {
|
||||
return _map.contains(key);
|
||||
}
|
||||
|
||||
function length() public view returns (uint256) {
|
||||
return _map.length();
|
||||
}
|
||||
|
||||
function key_at(uint256 index) public view returns (bytes32) {
|
||||
(bytes32 key,) = _map.at(index);
|
||||
return key;
|
||||
}
|
||||
|
||||
function value_at(uint256 index) public view returns (bytes32) {
|
||||
(,bytes32 value) = _map.at(index);
|
||||
return value;
|
||||
}
|
||||
|
||||
function tryGet_contains(bytes32 key) public view returns (bool) {
|
||||
(bool contained,) = _map.tryGet(key);
|
||||
return contained;
|
||||
}
|
||||
|
||||
function tryGet_value(bytes32 key) public view returns (bytes32) {
|
||||
(,bytes32 value) = _map.tryGet(key);
|
||||
return value;
|
||||
}
|
||||
|
||||
function get(bytes32 key) public view returns (bytes32) {
|
||||
return _map.get(key);
|
||||
}
|
||||
|
||||
function _positionOf(bytes32 key) public view returns (uint256) {
|
||||
return _map._keys._inner._positions[key];
|
||||
}
|
||||
}
|
||||
35
certora/harnesses/EnumerableSetHarness.sol
Normal file
35
certora/harnesses/EnumerableSetHarness.sol
Normal file
@ -0,0 +1,35 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {EnumerableSet} from "../patched/utils/structs/EnumerableSet.sol";
|
||||
|
||||
contract EnumerableSetHarness {
|
||||
using EnumerableSet for EnumerableSet.Bytes32Set;
|
||||
|
||||
EnumerableSet.Bytes32Set private _set;
|
||||
|
||||
function add(bytes32 value) public returns (bool) {
|
||||
return _set.add(value);
|
||||
}
|
||||
|
||||
function remove(bytes32 value) public returns (bool) {
|
||||
return _set.remove(value);
|
||||
}
|
||||
|
||||
function contains(bytes32 value) public view returns (bool) {
|
||||
return _set.contains(value);
|
||||
}
|
||||
|
||||
function length() public view returns (uint256) {
|
||||
return _set.length();
|
||||
}
|
||||
|
||||
function at_(uint256 index) public view returns (bytes32) {
|
||||
return _set.at(index);
|
||||
}
|
||||
|
||||
function _positionOf(bytes32 value) public view returns (uint256) {
|
||||
return _set._inner._positions[value];
|
||||
}
|
||||
}
|
||||
23
certora/harnesses/InitializableHarness.sol
Normal file
23
certora/harnesses/InitializableHarness.sol
Normal file
@ -0,0 +1,23 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Initializable} from "../patched/proxy/utils/Initializable.sol";
|
||||
|
||||
contract InitializableHarness is Initializable {
|
||||
function initialize() public initializer {}
|
||||
function reinitialize(uint64 n) public reinitializer(n) {}
|
||||
function disable() public { _disableInitializers(); }
|
||||
|
||||
function nested_init_init() public initializer { initialize(); }
|
||||
function nested_init_reinit(uint64 m) public initializer { reinitialize(m); }
|
||||
function nested_reinit_init(uint64 n) public reinitializer(n) { initialize(); }
|
||||
function nested_reinit_reinit(uint64 n, uint64 m) public reinitializer(n) { reinitialize(m); }
|
||||
|
||||
function version() public view returns (uint64) {
|
||||
return _getInitializedVersion();
|
||||
}
|
||||
|
||||
function initializing() public view returns (bool) {
|
||||
return _isInitializing();
|
||||
}
|
||||
}
|
||||
14
certora/harnesses/NoncesHarness.sol
Normal file
14
certora/harnesses/NoncesHarness.sol
Normal file
@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Nonces} from "../patched/utils/Nonces.sol";
|
||||
|
||||
contract NoncesHarness is Nonces {
|
||||
function useNonce(address account) external returns (uint256) {
|
||||
return _useNonce(account);
|
||||
}
|
||||
|
||||
function useCheckedNonce(address account, uint256 nonce) external {
|
||||
_useCheckedNonce(account, nonce);
|
||||
}
|
||||
}
|
||||
10
certora/harnesses/Ownable2StepHarness.sol
Normal file
10
certora/harnesses/Ownable2StepHarness.sol
Normal file
@ -0,0 +1,10 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Ownable2Step, Ownable} from "../patched/access/Ownable2Step.sol";
|
||||
|
||||
contract Ownable2StepHarness is Ownable2Step {
|
||||
constructor(address initialOwner) Ownable(initialOwner) {}
|
||||
|
||||
function restricted() external onlyOwner {}
|
||||
}
|
||||
10
certora/harnesses/OwnableHarness.sol
Normal file
10
certora/harnesses/OwnableHarness.sol
Normal file
@ -0,0 +1,10 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Ownable} from "../patched/access/Ownable.sol";
|
||||
|
||||
contract OwnableHarness is Ownable {
|
||||
constructor(address initialOwner) Ownable(initialOwner) {}
|
||||
|
||||
function restricted() external onlyOwner {}
|
||||
}
|
||||
18
certora/harnesses/PausableHarness.sol
Normal file
18
certora/harnesses/PausableHarness.sol
Normal file
@ -0,0 +1,18 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Pausable} from "../patched/utils/Pausable.sol";
|
||||
|
||||
contract PausableHarness is Pausable {
|
||||
function pause() external {
|
||||
_pause();
|
||||
}
|
||||
|
||||
function unpause() external {
|
||||
_unpause();
|
||||
}
|
||||
|
||||
function onlyWhenPaused() external whenPaused {}
|
||||
|
||||
function onlyWhenNotPaused() external whenNotPaused {}
|
||||
}
|
||||
13
certora/harnesses/TimelockControllerHarness.sol
Normal file
13
certora/harnesses/TimelockControllerHarness.sol
Normal file
@ -0,0 +1,13 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {TimelockController} from "../patched/governance/TimelockController.sol";
|
||||
|
||||
contract TimelockControllerHarness is TimelockController {
|
||||
constructor(
|
||||
uint256 minDelay,
|
||||
address[] memory proposers,
|
||||
address[] memory executors,
|
||||
address admin
|
||||
) TimelockController(minDelay, proposers, executors, admin) {}
|
||||
}
|
||||
BIN
certora/reports/2021-10.pdf
Normal file
BIN
certora/reports/2021-10.pdf
Normal file
Binary file not shown.
BIN
certora/reports/2022-03.pdf
Normal file
BIN
certora/reports/2022-03.pdf
Normal file
Binary file not shown.
BIN
certora/reports/2022-05.pdf
Normal file
BIN
certora/reports/2022-05.pdf
Normal file
Binary file not shown.
160
certora/run.js
Executable file
160
certora/run.js
Executable file
@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// USAGE:
|
||||
// node certora/run.js [[CONTRACT_NAME:]SPEC_NAME]* [--all] [--options OPTIONS...] [--specs PATH]
|
||||
// EXAMPLES:
|
||||
// node certora/run.js --all
|
||||
// node certora/run.js AccessControl
|
||||
// node certora/run.js AccessControlHarness:AccessControl
|
||||
|
||||
const proc = require('child_process');
|
||||
const { PassThrough } = require('stream');
|
||||
const events = require('events');
|
||||
|
||||
const argv = require('yargs')
|
||||
.env('')
|
||||
.options({
|
||||
all: {
|
||||
alias: 'a',
|
||||
type: 'boolean',
|
||||
},
|
||||
spec: {
|
||||
alias: 's',
|
||||
type: 'string',
|
||||
default: __dirname + '/specs.json',
|
||||
},
|
||||
parallel: {
|
||||
alias: 'p',
|
||||
type: 'number',
|
||||
default: 4,
|
||||
},
|
||||
verbose: {
|
||||
alias: 'v',
|
||||
type: 'count',
|
||||
default: 0,
|
||||
},
|
||||
options: {
|
||||
alias: 'o',
|
||||
type: 'array',
|
||||
default: [],
|
||||
},
|
||||
}).argv;
|
||||
|
||||
function match(entry, request) {
|
||||
const [reqSpec, reqContract] = request.split(':').reverse();
|
||||
return entry.spec == reqSpec && (!reqContract || entry.contract == reqContract);
|
||||
}
|
||||
|
||||
const specs = require(argv.spec).filter(s => argv.all || argv._.some(r => match(s, r)));
|
||||
const limit = require('p-limit')(argv.parallel);
|
||||
|
||||
if (argv._.length == 0 && !argv.all) {
|
||||
console.error(`Warning: No specs requested. Did you forgot to toggle '--all'?`);
|
||||
}
|
||||
|
||||
for (const r of argv._) {
|
||||
if (!specs.some(s => match(s, r))) {
|
||||
console.error(`Error: Requested spec '${r}' not found in ${argv.spec}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (process.exitCode) {
|
||||
process.exit(process.exitCode);
|
||||
}
|
||||
|
||||
for (const { spec, contract, files, options = [] } of specs) {
|
||||
limit(
|
||||
runCertora,
|
||||
spec,
|
||||
contract,
|
||||
files,
|
||||
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
|
||||
);
|
||||
}
|
||||
|
||||
// Run certora, aggregate the output and print it at the end
|
||||
async function runCertora(spec, contract, files, options = []) {
|
||||
const args = [...files, '--verify', `${contract}:certora/specs/${spec}.spec`, ...options];
|
||||
if (argv.verbose) {
|
||||
console.log('Running:', args.join(' '));
|
||||
}
|
||||
const child = proc.spawn('certoraRun', args);
|
||||
|
||||
const stream = new PassThrough();
|
||||
const output = collect(stream);
|
||||
|
||||
child.stdout.pipe(stream, { end: false });
|
||||
child.stderr.pipe(stream, { end: false });
|
||||
|
||||
// as soon as we have a job id, print the output link
|
||||
stream.on('data', function logStatusUrl(data) {
|
||||
const { '-DjobId': jobId, '-DuserId': userId } = Object.fromEntries(
|
||||
data
|
||||
.toString('utf8')
|
||||
.match(/-D\S+=\S+/g)
|
||||
?.map(s => s.split('=')) || [],
|
||||
);
|
||||
|
||||
if (jobId && userId) {
|
||||
console.error(`[${spec}] https://prover.certora.com/output/${userId}/${jobId}/`);
|
||||
stream.off('data', logStatusUrl);
|
||||
}
|
||||
});
|
||||
|
||||
// wait for process end
|
||||
const [code, signal] = await events.once(child, 'exit');
|
||||
|
||||
// error
|
||||
if (code || signal) {
|
||||
console.error(`[${spec}] Exited with code ${code || signal}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
// get all output
|
||||
stream.end();
|
||||
|
||||
// write results in markdown format
|
||||
writeEntry(spec, contract, code || signal, (await output).match(/https:\/\/prover.certora.com\/output\/\S*/)?.[0]);
|
||||
|
||||
// write all details
|
||||
console.error(`+ certoraRun ${args.join(' ')}\n` + (await output));
|
||||
}
|
||||
|
||||
// Collects stream data into a string
|
||||
async function collect(stream) {
|
||||
const buffers = [];
|
||||
for await (const data of stream) {
|
||||
const buf = Buffer.isBuffer(data) ? data : Buffer.from(data);
|
||||
buffers.push(buf);
|
||||
}
|
||||
return Buffer.concat(buffers).toString('utf8');
|
||||
}
|
||||
|
||||
// Formatting
|
||||
let hasHeader = false;
|
||||
|
||||
function formatRow(...array) {
|
||||
return ['', ...array, ''].join(' | ');
|
||||
}
|
||||
|
||||
function writeHeader() {
|
||||
console.log(formatRow('spec', 'contract', 'result', 'status', 'output'));
|
||||
console.log(formatRow('-', '-', '-', '-', '-'));
|
||||
}
|
||||
|
||||
function writeEntry(spec, contract, success, url) {
|
||||
if (!hasHeader) {
|
||||
hasHeader = true;
|
||||
writeHeader();
|
||||
}
|
||||
console.log(
|
||||
formatRow(
|
||||
spec,
|
||||
contract,
|
||||
success ? ':x:' : ':heavy_check_mark:',
|
||||
url ? `[link](${url?.replace('/output/', '/jobStatus/')})` : 'error',
|
||||
url ? `[link](${url})` : 'error',
|
||||
),
|
||||
);
|
||||
}
|
||||
110
certora/specs.json
Normal file
110
certora/specs.json
Normal file
@ -0,0 +1,110 @@
|
||||
[
|
||||
{
|
||||
"spec": "Pausable",
|
||||
"contract": "PausableHarness",
|
||||
"files": ["certora/harnesses/PausableHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "AccessControl",
|
||||
"contract": "AccessControlHarness",
|
||||
"files": ["certora/harnesses/AccessControlHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "AccessControlDefaultAdminRules",
|
||||
"contract": "AccessControlDefaultAdminRulesHarness",
|
||||
"files": ["certora/harnesses/AccessControlDefaultAdminRulesHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "AccessManager",
|
||||
"contract": "AccessManagerHarness",
|
||||
"files": ["certora/harnesses/AccessManagerHarness.sol"],
|
||||
"options": ["--optimistic_hashing", "--optimistic_loop"]
|
||||
},
|
||||
{
|
||||
"spec": "AccessManaged",
|
||||
"contract": "AccessManagedHarness",
|
||||
"files": [
|
||||
"certora/harnesses/AccessManagedHarness.sol",
|
||||
"certora/harnesses/AccessManagerHarness.sol"
|
||||
],
|
||||
"options": [
|
||||
"--optimistic_hashing",
|
||||
"--optimistic_loop",
|
||||
"--link AccessManagedHarness:_authority=AccessManagerHarness"
|
||||
]
|
||||
},
|
||||
{
|
||||
"spec": "DoubleEndedQueue",
|
||||
"contract": "DoubleEndedQueueHarness",
|
||||
"files": ["certora/harnesses/DoubleEndedQueueHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "Ownable",
|
||||
"contract": "OwnableHarness",
|
||||
"files": ["certora/harnesses/OwnableHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "Ownable2Step",
|
||||
"contract": "Ownable2StepHarness",
|
||||
"files": ["certora/harnesses/Ownable2StepHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "ERC20",
|
||||
"contract": "ERC20PermitHarness",
|
||||
"files": ["certora/harnesses/ERC20PermitHarness.sol"],
|
||||
"options": ["--optimistic_loop"]
|
||||
},
|
||||
{
|
||||
"spec": "ERC20FlashMint",
|
||||
"contract": "ERC20FlashMintHarness",
|
||||
"files": [
|
||||
"certora/harnesses/ERC20FlashMintHarness.sol",
|
||||
"certora/harnesses/ERC3156FlashBorrowerHarness.sol"
|
||||
],
|
||||
"options": ["--optimistic_loop"]
|
||||
},
|
||||
{
|
||||
"spec": "ERC20Wrapper",
|
||||
"contract": "ERC20WrapperHarness",
|
||||
"files": [
|
||||
"certora/harnesses/ERC20PermitHarness.sol",
|
||||
"certora/harnesses/ERC20WrapperHarness.sol"
|
||||
],
|
||||
"options": [
|
||||
"--link ERC20WrapperHarness:_underlying=ERC20PermitHarness",
|
||||
"--optimistic_loop"
|
||||
]
|
||||
},
|
||||
{
|
||||
"spec": "ERC721",
|
||||
"contract": "ERC721Harness",
|
||||
"files": ["certora/harnesses/ERC721Harness.sol", "certora/harnesses/ERC721ReceiverHarness.sol"],
|
||||
"options": ["--optimistic_loop"]
|
||||
},
|
||||
{
|
||||
"spec": "Initializable",
|
||||
"contract": "InitializableHarness",
|
||||
"files": ["certora/harnesses/InitializableHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "EnumerableSet",
|
||||
"contract": "EnumerableSetHarness",
|
||||
"files": ["certora/harnesses/EnumerableSetHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "EnumerableMap",
|
||||
"contract": "EnumerableMapHarness",
|
||||
"files": ["certora/harnesses/EnumerableMapHarness.sol"]
|
||||
},
|
||||
{
|
||||
"spec": "TimelockController",
|
||||
"contract": "TimelockControllerHarness",
|
||||
"files": ["certora/harnesses/TimelockControllerHarness.sol"],
|
||||
"options": ["--optimistic_hashing", "--optimistic_loop"]
|
||||
},
|
||||
{
|
||||
"spec": "Nonces",
|
||||
"contract": "NoncesHarness",
|
||||
"files": ["certora/harnesses/NoncesHarness.sol"]
|
||||
}
|
||||
]
|
||||
119
certora/specs/AccessControl.spec
Normal file
119
certora/specs/AccessControl.spec
Normal file
@ -0,0 +1,119 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IAccessControl.spec";
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Identify entrypoints: only grantRole, revokeRole and renounceRole can alter permissions │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyGrantCanGrant(env e, method f, bytes32 role, address account) {
|
||||
calldataarg args;
|
||||
|
||||
bool hasRoleBefore = hasRole(role, account);
|
||||
f(e, args);
|
||||
bool hasRoleAfter = hasRole(role, account);
|
||||
|
||||
assert (
|
||||
!hasRoleBefore &&
|
||||
hasRoleAfter
|
||||
) => (
|
||||
f.selector == sig:grantRole(bytes32, address).selector
|
||||
);
|
||||
|
||||
assert (
|
||||
hasRoleBefore &&
|
||||
!hasRoleAfter
|
||||
) => (
|
||||
f.selector == sig:revokeRole(bytes32, address).selector ||
|
||||
f.selector == sig:renounceRole(bytes32, address).selector
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: grantRole only affects the specified user/role combo │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule grantRoleEffect(env e, bytes32 role) {
|
||||
require nonpayable(e);
|
||||
|
||||
bytes32 otherRole;
|
||||
address account;
|
||||
address otherAccount;
|
||||
|
||||
bool isCallerAdmin = hasRole(getRoleAdmin(role), e.msg.sender);
|
||||
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
|
||||
|
||||
grantRole@withrevert(e, role, account);
|
||||
bool success = !lastReverted;
|
||||
|
||||
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
|
||||
|
||||
// liveness
|
||||
assert success <=> isCallerAdmin;
|
||||
|
||||
// effect
|
||||
assert success => hasRole(role, account);
|
||||
|
||||
// no side effect
|
||||
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: revokeRole only affects the specified user/role combo │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule revokeRoleEffect(env e, bytes32 role) {
|
||||
require nonpayable(e);
|
||||
|
||||
bytes32 otherRole;
|
||||
address account;
|
||||
address otherAccount;
|
||||
|
||||
bool isCallerAdmin = hasRole(getRoleAdmin(role), e.msg.sender);
|
||||
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
|
||||
|
||||
revokeRole@withrevert(e, role, account);
|
||||
bool success = !lastReverted;
|
||||
|
||||
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
|
||||
|
||||
// liveness
|
||||
assert success <=> isCallerAdmin;
|
||||
|
||||
// effect
|
||||
assert success => !hasRole(role, account);
|
||||
|
||||
// no side effect
|
||||
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: renounceRole only affects the specified user/role combo │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule renounceRoleEffect(env e, bytes32 role) {
|
||||
require nonpayable(e);
|
||||
|
||||
bytes32 otherRole;
|
||||
address account;
|
||||
address otherAccount;
|
||||
|
||||
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
|
||||
|
||||
renounceRole@withrevert(e, role, account);
|
||||
bool success = !lastReverted;
|
||||
|
||||
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
|
||||
|
||||
// liveness
|
||||
assert success <=> account == e.msg.sender;
|
||||
|
||||
// effect
|
||||
assert success => !hasRole(role, account);
|
||||
|
||||
// no side effect
|
||||
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount);
|
||||
}
|
||||
464
certora/specs/AccessControlDefaultAdminRules.spec
Normal file
464
certora/specs/AccessControlDefaultAdminRules.spec
Normal file
@ -0,0 +1,464 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IAccessControlDefaultAdminRules.spec";
|
||||
import "methods/IAccessControl.spec";
|
||||
import "AccessControl.spec";
|
||||
|
||||
use rule onlyGrantCanGrant filtered {
|
||||
f -> f.selector != sig:acceptDefaultAdminTransfer().selector
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Definitions │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
definition timeSanity(env e) returns bool =
|
||||
e.block.timestamp > 0 && e.block.timestamp + defaultAdminDelay(e) < max_uint48;
|
||||
|
||||
definition delayChangeWaitSanity(env e, uint48 newDelay) returns bool =
|
||||
e.block.timestamp + delayChangeWait_(e, newDelay) < max_uint48;
|
||||
|
||||
definition isSet(uint48 schedule) returns bool =
|
||||
schedule != 0;
|
||||
|
||||
definition hasPassed(env e, uint48 schedule) returns bool =
|
||||
assert_uint256(schedule) < e.block.timestamp;
|
||||
|
||||
definition increasingDelaySchedule(env e, uint48 newDelay) returns mathint =
|
||||
e.block.timestamp + min(newDelay, defaultAdminDelayIncreaseWait());
|
||||
|
||||
definition decreasingDelaySchedule(env e, uint48 newDelay) returns mathint =
|
||||
e.block.timestamp + defaultAdminDelay(e) - newDelay;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: defaultAdmin holds the DEFAULT_ADMIN_ROLE │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant defaultAdminConsistency(address account)
|
||||
(account == defaultAdmin() && account != 0) <=> hasRole(DEFAULT_ADMIN_ROLE(), account)
|
||||
{
|
||||
preserved with (env e) {
|
||||
require nonzerosender(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: Only one account holds the DEFAULT_ADMIN_ROLE │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant singleDefaultAdmin(address account, address another)
|
||||
hasRole(DEFAULT_ADMIN_ROLE(), account) && hasRole(DEFAULT_ADMIN_ROLE(), another) => another == account
|
||||
{
|
||||
preserved {
|
||||
requireInvariant defaultAdminConsistency(account);
|
||||
requireInvariant defaultAdminConsistency(another);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: DEFAULT_ADMIN_ROLE's admin is always DEFAULT_ADMIN_ROLE │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant defaultAdminRoleAdminConsistency()
|
||||
getRoleAdmin(DEFAULT_ADMIN_ROLE()) == DEFAULT_ADMIN_ROLE();
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: owner is the defaultAdmin │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant ownerConsistency()
|
||||
defaultAdmin() == owner();
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: revokeRole only affects the specified user/role combo │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule revokeRoleEffect(env e, bytes32 role) {
|
||||
require nonpayable(e);
|
||||
|
||||
bytes32 otherRole;
|
||||
address account;
|
||||
address otherAccount;
|
||||
|
||||
bool isCallerAdmin = hasRole(getRoleAdmin(role), e.msg.sender);
|
||||
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
|
||||
|
||||
revokeRole@withrevert(e, role, account);
|
||||
bool success = !lastReverted;
|
||||
|
||||
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
|
||||
|
||||
// liveness
|
||||
assert success <=> isCallerAdmin && role != DEFAULT_ADMIN_ROLE(),
|
||||
"roles can only be revoked by their owner except for the default admin role";
|
||||
|
||||
// effect
|
||||
assert success => !hasRole(role, account),
|
||||
"role is revoked";
|
||||
|
||||
// no side effect
|
||||
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount),
|
||||
"no other role is affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: renounceRole only affects the specified user/role combo │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule renounceRoleEffect(env e, bytes32 role) {
|
||||
require nonpayable(e);
|
||||
|
||||
bytes32 otherRole;
|
||||
address account;
|
||||
address otherAccount;
|
||||
|
||||
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
|
||||
address adminBefore = defaultAdmin();
|
||||
address pendingAdminBefore = pendingDefaultAdmin_();
|
||||
uint48 scheduleBefore = pendingDefaultAdminSchedule_();
|
||||
|
||||
renounceRole@withrevert(e, role, account);
|
||||
bool success = !lastReverted;
|
||||
|
||||
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
|
||||
address adminAfter = defaultAdmin();
|
||||
address pendingAdminAfter = pendingDefaultAdmin_();
|
||||
uint48 scheduleAfter = pendingDefaultAdminSchedule_();
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
account == e.msg.sender &&
|
||||
(
|
||||
role != DEFAULT_ADMIN_ROLE() ||
|
||||
account != adminBefore ||
|
||||
(
|
||||
pendingAdminBefore == 0 &&
|
||||
isSet(scheduleBefore) &&
|
||||
hasPassed(e, scheduleBefore)
|
||||
)
|
||||
)
|
||||
),
|
||||
"an account only can renounce by itself with a delay for the default admin role";
|
||||
|
||||
// effect
|
||||
assert success => !hasRole(role, account),
|
||||
"role is renounced";
|
||||
|
||||
assert success => (
|
||||
(
|
||||
role == DEFAULT_ADMIN_ROLE() &&
|
||||
account == adminBefore
|
||||
) ? (
|
||||
adminAfter == 0 &&
|
||||
pendingAdminAfter == 0 &&
|
||||
scheduleAfter == 0
|
||||
) : (
|
||||
adminAfter == adminBefore &&
|
||||
pendingAdminAfter == pendingAdminBefore &&
|
||||
scheduleAfter == scheduleBefore
|
||||
)
|
||||
),
|
||||
"renouncing default admin role cleans state iff called by previous admin";
|
||||
|
||||
// no side effect
|
||||
assert hasOtherRoleBefore != hasOtherRoleAfter => (
|
||||
role == otherRole &&
|
||||
account == otherAccount
|
||||
),
|
||||
"no other role is affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: defaultAdmin is only affected by accepting an admin transfer or renoucing │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noDefaultAdminChange(env e, method f, calldataarg args) {
|
||||
address adminBefore = defaultAdmin();
|
||||
f(e, args);
|
||||
address adminAfter = defaultAdmin();
|
||||
|
||||
assert adminBefore != adminAfter => (
|
||||
f.selector == sig:acceptDefaultAdminTransfer().selector ||
|
||||
f.selector == sig:renounceRole(bytes32,address).selector
|
||||
),
|
||||
"default admin is only affected by accepting an admin transfer or renoucing";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: pendingDefaultAdmin is only affected by beginning, completing (accept or renounce), or canceling an admin │
|
||||
│ transfer │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noPendingDefaultAdminChange(env e, method f, calldataarg args) {
|
||||
address pendingAdminBefore = pendingDefaultAdmin_();
|
||||
uint48 scheduleBefore = pendingDefaultAdminSchedule_();
|
||||
f(e, args);
|
||||
address pendingAdminAfter = pendingDefaultAdmin_();
|
||||
uint48 scheduleAfter = pendingDefaultAdminSchedule_();
|
||||
|
||||
assert (
|
||||
pendingAdminBefore != pendingAdminAfter ||
|
||||
scheduleBefore != scheduleAfter
|
||||
) => (
|
||||
f.selector == sig:beginDefaultAdminTransfer(address).selector ||
|
||||
f.selector == sig:acceptDefaultAdminTransfer().selector ||
|
||||
f.selector == sig:cancelDefaultAdminTransfer().selector ||
|
||||
f.selector == sig:renounceRole(bytes32,address).selector
|
||||
),
|
||||
"pending admin and its schedule is only affected by beginning, completing, or cancelling an admin transfer";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: defaultAdminDelay can't be changed atomically by any function │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noDefaultAdminDelayChange(env e, method f, calldataarg args) {
|
||||
uint48 delayBefore = defaultAdminDelay(e);
|
||||
f(e, args);
|
||||
uint48 delayAfter = defaultAdminDelay(e);
|
||||
|
||||
assert delayBefore == delayAfter,
|
||||
"delay can't be changed atomically by any function";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: pendingDefaultAdminDelay is only affected by changeDefaultAdminDelay or rollbackDefaultAdminDelay │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noPendingDefaultAdminDelayChange(env e, method f, calldataarg args) {
|
||||
uint48 pendingDelayBefore = pendingDelay_(e);
|
||||
f(e, args);
|
||||
uint48 pendingDelayAfter = pendingDelay_(e);
|
||||
|
||||
assert pendingDelayBefore != pendingDelayAfter => (
|
||||
f.selector == sig:changeDefaultAdminDelay(uint48).selector ||
|
||||
f.selector == sig:rollbackDefaultAdminDelay().selector
|
||||
),
|
||||
"pending delay is only affected by changeDefaultAdminDelay or rollbackDefaultAdminDelay";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: defaultAdminDelayIncreaseWait can't be changed atomically by any function │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noDefaultAdminDelayIncreaseWaitChange(env e, method f, calldataarg args) {
|
||||
uint48 delayIncreaseWaitBefore = defaultAdminDelayIncreaseWait();
|
||||
f(e, args);
|
||||
uint48 delayIncreaseWaitAfter = defaultAdminDelayIncreaseWait();
|
||||
|
||||
assert delayIncreaseWaitBefore == delayIncreaseWaitAfter,
|
||||
"delay increase wait can't be changed atomically by any function";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: beginDefaultAdminTransfer sets a pending default admin and its schedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule beginDefaultAdminTransfer(env e, address newAdmin) {
|
||||
require timeSanity(e);
|
||||
require nonpayable(e);
|
||||
require nonzerosender(e);
|
||||
requireInvariant defaultAdminConsistency(e.msg.sender);
|
||||
|
||||
beginDefaultAdminTransfer@withrevert(e, newAdmin);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> e.msg.sender == defaultAdmin(),
|
||||
"only the current default admin can begin a transfer";
|
||||
|
||||
// effect
|
||||
assert success => pendingDefaultAdmin_() == newAdmin,
|
||||
"pending default admin is set";
|
||||
assert success => to_mathint(pendingDefaultAdminSchedule_()) == e.block.timestamp + defaultAdminDelay(e),
|
||||
"pending default admin delay is set";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: A default admin can't change in less than the applied schedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pendingDefaultAdminDelayEnforced(env e1, env e2, method f, calldataarg args, address newAdmin) {
|
||||
require e1.block.timestamp <= e2.block.timestamp;
|
||||
|
||||
uint48 delayBefore = defaultAdminDelay(e1);
|
||||
address adminBefore = defaultAdmin();
|
||||
|
||||
// There might be a better way to generalize this without requiring `beginDefaultAdminTransfer`, but currently
|
||||
// it's the only way in which we can attest that only `delayBefore` has passed before a change.
|
||||
beginDefaultAdminTransfer(e1, newAdmin);
|
||||
f(e2, args);
|
||||
|
||||
address adminAfter = defaultAdmin();
|
||||
|
||||
// change can only happen towards the newAdmin, with the delay
|
||||
assert adminAfter != adminBefore => (
|
||||
adminAfter == newAdmin &&
|
||||
to_mathint(e2.block.timestamp) >= e1.block.timestamp + delayBefore
|
||||
),
|
||||
"The admin can only change after the enforced delay and to the previously scheduled new admin";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: acceptDefaultAdminTransfer updates defaultAdmin resetting the pending admin and its schedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule acceptDefaultAdminTransfer(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address pendingAdminBefore = pendingDefaultAdmin_();
|
||||
uint48 scheduleBefore = pendingDefaultAdminSchedule_();
|
||||
|
||||
acceptDefaultAdminTransfer@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
e.msg.sender == pendingAdminBefore &&
|
||||
isSet(scheduleBefore) &&
|
||||
hasPassed(e, scheduleBefore)
|
||||
),
|
||||
"only the pending default admin can accept the role after the schedule has been set and passed";
|
||||
|
||||
// effect
|
||||
assert success => defaultAdmin() == pendingAdminBefore,
|
||||
"Default admin is set to the previous pending default admin";
|
||||
assert success => pendingDefaultAdmin_() == 0,
|
||||
"Pending default admin is reset";
|
||||
assert success => pendingDefaultAdminSchedule_() == 0,
|
||||
"Pending default admin delay is reset";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: cancelDefaultAdminTransfer resets pending default admin and its schedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule cancelDefaultAdminTransfer(env e) {
|
||||
require nonpayable(e);
|
||||
require nonzerosender(e);
|
||||
requireInvariant defaultAdminConsistency(e.msg.sender);
|
||||
|
||||
cancelDefaultAdminTransfer@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> e.msg.sender == defaultAdmin(),
|
||||
"only the current default admin can cancel a transfer";
|
||||
|
||||
// effect
|
||||
assert success => pendingDefaultAdmin_() == 0,
|
||||
"Pending default admin is reset";
|
||||
assert success => pendingDefaultAdminSchedule_() == 0,
|
||||
"Pending default admin delay is reset";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: changeDefaultAdminDelay sets a pending default admin delay and its schedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule changeDefaultAdminDelay(env e, uint48 newDelay) {
|
||||
require timeSanity(e);
|
||||
require nonpayable(e);
|
||||
require nonzerosender(e);
|
||||
require delayChangeWaitSanity(e, newDelay);
|
||||
requireInvariant defaultAdminConsistency(e.msg.sender);
|
||||
|
||||
uint48 delayBefore = defaultAdminDelay(e);
|
||||
|
||||
changeDefaultAdminDelay@withrevert(e, newDelay);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> e.msg.sender == defaultAdmin(),
|
||||
"only the current default admin can begin a delay change";
|
||||
|
||||
// effect
|
||||
assert success => pendingDelay_(e) == newDelay,
|
||||
"pending delay is set";
|
||||
|
||||
assert success => (
|
||||
assert_uint256(pendingDelaySchedule_(e)) > e.block.timestamp ||
|
||||
delayBefore == newDelay || // Interpreted as decreasing, x - x = 0
|
||||
defaultAdminDelayIncreaseWait() == 0
|
||||
),
|
||||
"pending delay schedule is set in the future unless accepted edge cases";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: A delay can't change in less than the applied schedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pendingDelayWaitEnforced(env e1, env e2, method f, calldataarg args, uint48 newDelay) {
|
||||
require e1.block.timestamp <= e2.block.timestamp;
|
||||
|
||||
uint48 delayBefore = defaultAdminDelay(e1);
|
||||
|
||||
changeDefaultAdminDelay(e1, newDelay);
|
||||
f(e2, args);
|
||||
|
||||
uint48 delayAfter = defaultAdminDelay(e2);
|
||||
|
||||
mathint delayWait = newDelay > delayBefore ? increasingDelaySchedule(e1, newDelay) : decreasingDelaySchedule(e1, newDelay);
|
||||
|
||||
assert delayAfter != delayBefore => (
|
||||
delayAfter == newDelay &&
|
||||
to_mathint(e2.block.timestamp) >= delayWait
|
||||
),
|
||||
"A delay can only change after the applied schedule";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: pending delay wait is set depending on increasing or decreasing the delay │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pendingDelayWait(env e, uint48 newDelay) {
|
||||
uint48 oldDelay = defaultAdminDelay(e);
|
||||
changeDefaultAdminDelay(e, newDelay);
|
||||
|
||||
assert newDelay > oldDelay => to_mathint(pendingDelaySchedule_(e)) == increasingDelaySchedule(e, newDelay),
|
||||
"Delay wait is the minimum between the new delay and a threshold when the delay is increased";
|
||||
assert newDelay <= oldDelay => to_mathint(pendingDelaySchedule_(e)) == decreasingDelaySchedule(e, newDelay),
|
||||
"Delay wait is the difference between the current and the new delay when the delay is decreased";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: rollbackDefaultAdminDelay resets the delay and its schedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule rollbackDefaultAdminDelay(env e) {
|
||||
require nonpayable(e);
|
||||
require nonzerosender(e);
|
||||
requireInvariant defaultAdminConsistency(e.msg.sender);
|
||||
|
||||
rollbackDefaultAdminDelay@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> e.msg.sender == defaultAdmin(),
|
||||
"only the current default admin can rollback a delay change";
|
||||
|
||||
// effect
|
||||
assert success => pendingDelay_(e) == 0,
|
||||
"Pending default admin is reset";
|
||||
assert success => pendingDelaySchedule_(e) == 0,
|
||||
"Pending default admin delay is reset";
|
||||
}
|
||||
34
certora/specs/AccessManaged.spec
Normal file
34
certora/specs/AccessManaged.spec
Normal file
@ -0,0 +1,34 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IAccessManaged.spec";
|
||||
|
||||
methods {
|
||||
// FV
|
||||
function someFunction() external;
|
||||
function authority_canCall_immediate(address) external returns (bool);
|
||||
function authority_canCall_delay(address) external returns (uint32);
|
||||
function authority_getSchedule(address) external returns (uint48);
|
||||
}
|
||||
|
||||
invariant isConsumingScheduledOpClean()
|
||||
isConsumingScheduledOp() == to_bytes4(0);
|
||||
|
||||
rule callRestrictedFunction(env e) {
|
||||
bool immediate = authority_canCall_immediate(e, e.msg.sender);
|
||||
uint32 delay = authority_canCall_delay(e, e.msg.sender);
|
||||
uint48 scheduleBefore = authority_getSchedule(e, e.msg.sender);
|
||||
|
||||
someFunction@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
uint48 scheduleAfter = authority_getSchedule(e, e.msg.sender);
|
||||
|
||||
// can only call if immediate, or (with delay) by consuming a scheduled op
|
||||
assert success => (
|
||||
immediate ||
|
||||
(
|
||||
delay > 0 &&
|
||||
isSetAndPast(e, scheduleBefore) &&
|
||||
scheduleAfter == 0
|
||||
)
|
||||
);
|
||||
}
|
||||
826
certora/specs/AccessManager.spec
Normal file
826
certora/specs/AccessManager.spec
Normal file
@ -0,0 +1,826 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IAccessManager.spec";
|
||||
|
||||
methods {
|
||||
// FV
|
||||
function canCall_immediate(address,address,bytes4) external returns (bool);
|
||||
function canCall_delay(address,address,bytes4) external returns (uint32);
|
||||
function canCallExtended(address,address,bytes) external returns (bool,uint32);
|
||||
function canCallExtended_immediate(address,address,bytes) external returns (bool);
|
||||
function canCallExtended_delay(address,address,bytes) external returns (uint32);
|
||||
function getAdminRestrictions_restricted(bytes) external returns (bool);
|
||||
function getAdminRestrictions_roleAdminId(bytes) external returns (uint64);
|
||||
function getAdminRestrictions_executionDelay(bytes) external returns (uint32);
|
||||
function hasRole_isMember(uint64,address) external returns (bool);
|
||||
function hasRole_executionDelay(uint64,address) external returns (uint32);
|
||||
function getAccess_since(uint64,address) external returns (uint48);
|
||||
function getAccess_currentDelay(uint64,address) external returns (uint32);
|
||||
function getAccess_pendingDelay(uint64,address) external returns (uint32);
|
||||
function getAccess_effect(uint64,address) external returns (uint48);
|
||||
function getTargetAdminDelay_after(address target) external returns (uint32);
|
||||
function getTargetAdminDelay_effect(address target) external returns (uint48);
|
||||
function getRoleGrantDelay_after(uint64 roleId) external returns (uint32);
|
||||
function getRoleGrantDelay_effect(uint64 roleId) external returns (uint48);
|
||||
function hashExecutionId(address,bytes4) external returns (bytes32) envfree;
|
||||
function executionId() external returns (bytes32) envfree;
|
||||
function getSelector(bytes) external returns (bytes4) envfree;
|
||||
function getFirstArgumentAsAddress(bytes) external returns (address) envfree;
|
||||
function getFirstArgumentAsUint64(bytes) external returns (uint64) envfree;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Helpers │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
definition isOnlyAuthorized(bytes4 selector) returns bool =
|
||||
selector == to_bytes4(sig:labelRole(uint64,string).selector ) ||
|
||||
selector == to_bytes4(sig:setRoleAdmin(uint64,uint64).selector ) ||
|
||||
selector == to_bytes4(sig:setRoleGuardian(uint64,uint64).selector ) ||
|
||||
selector == to_bytes4(sig:setGrantDelay(uint64,uint32).selector ) ||
|
||||
selector == to_bytes4(sig:setTargetAdminDelay(address,uint32).selector ) ||
|
||||
selector == to_bytes4(sig:updateAuthority(address,address).selector ) ||
|
||||
selector == to_bytes4(sig:setTargetClosed(address,bool).selector ) ||
|
||||
selector == to_bytes4(sig:setTargetFunctionRole(address,bytes4[],uint64).selector) ||
|
||||
selector == to_bytes4(sig:grantRole(uint64,address,uint32).selector ) ||
|
||||
selector == to_bytes4(sig:revokeRole(uint64,address).selector );
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: executionId must be clean when not in the middle of a call │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant cleanExecutionId()
|
||||
executionId() == to_bytes32(0);
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: public role │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant publicRole(env e, address account)
|
||||
hasRole_isMember(e, PUBLIC_ROLE(), account) &&
|
||||
hasRole_executionDelay(e, PUBLIC_ROLE(), account) == 0 &&
|
||||
getAccess_since(e, PUBLIC_ROLE(), account) == 0 &&
|
||||
getAccess_currentDelay(e, PUBLIC_ROLE(), account) == 0 &&
|
||||
getAccess_pendingDelay(e, PUBLIC_ROLE(), account) == 0 &&
|
||||
getAccess_effect(e, PUBLIC_ROLE(), account) == 0;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: hasRole is consistent with getAccess │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant hasRoleGetAccessConsistency(env e, uint64 roleId, address account)
|
||||
hasRole_isMember(e, roleId, account) == (roleId == PUBLIC_ROLE() || isSetAndPast(e, getAccess_since(e, roleId, account))) &&
|
||||
hasRole_executionDelay(e, roleId, account) == getAccess_currentDelay(e, roleId, account);
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Functions: canCall, canCallExtended, getAccess, hasRole, isTargetClosed and getTargetFunctionRole do NOT revert │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noRevert(env e) {
|
||||
require nonpayable(e);
|
||||
require sanity(e);
|
||||
|
||||
address caller;
|
||||
address target;
|
||||
bytes data;
|
||||
bytes4 selector;
|
||||
uint64 roleId;
|
||||
|
||||
canCall@withrevert(e, caller, target, selector);
|
||||
assert !lastReverted;
|
||||
|
||||
// require data.length <= max_uint64;
|
||||
//
|
||||
// canCallExtended@withrevert(e, caller, target, data);
|
||||
// assert !lastReverted;
|
||||
|
||||
getAccess@withrevert(e, roleId, caller);
|
||||
assert !lastReverted;
|
||||
|
||||
hasRole@withrevert(e, roleId, caller);
|
||||
assert !lastReverted;
|
||||
|
||||
isTargetClosed@withrevert(target);
|
||||
assert !lastReverted;
|
||||
|
||||
getTargetFunctionRole@withrevert(target, selector);
|
||||
assert !lastReverted;
|
||||
|
||||
// Not covered:
|
||||
// - getAdminRestrictions (_1, _2 & _3)
|
||||
// - getSelector
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Functions: admin restrictions are correct │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getAdminRestrictions(env e, bytes data) {
|
||||
bool restricted = getAdminRestrictions_restricted(e, data);
|
||||
uint64 roleId = getAdminRestrictions_roleAdminId(e, data);
|
||||
uint32 delay = getAdminRestrictions_executionDelay(e, data);
|
||||
bytes4 selector = getSelector(data);
|
||||
|
||||
if (data.length < 4) {
|
||||
assert restricted == false;
|
||||
assert roleId == 0;
|
||||
assert delay == 0;
|
||||
} else {
|
||||
assert restricted ==
|
||||
isOnlyAuthorized(selector);
|
||||
|
||||
assert roleId == (
|
||||
(restricted && selector == to_bytes4(sig:grantRole(uint64,address,uint32).selector)) ||
|
||||
(restricted && selector == to_bytes4(sig:revokeRole(uint64,address).selector ))
|
||||
? getRoleAdmin(getFirstArgumentAsUint64(data))
|
||||
: ADMIN_ROLE()
|
||||
);
|
||||
|
||||
assert delay == (
|
||||
(restricted && selector == to_bytes4(sig:updateAuthority(address,address).selector )) ||
|
||||
(restricted && selector == to_bytes4(sig:setTargetClosed(address,bool).selector )) ||
|
||||
(restricted && selector == to_bytes4(sig:setTargetFunctionRole(address,bytes4[],uint64).selector))
|
||||
? getTargetAdminDelay(e, getFirstArgumentAsAddress(data))
|
||||
: 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Functions: canCall │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule canCall(env e) {
|
||||
address caller;
|
||||
address target;
|
||||
bytes4 selector;
|
||||
|
||||
// Get relevant values
|
||||
bool immediate = canCall_immediate(e, caller, target, selector);
|
||||
uint32 delay = canCall_delay(e, caller, target, selector);
|
||||
bool closed = isTargetClosed(target);
|
||||
uint64 roleId = getTargetFunctionRole(target, selector);
|
||||
bool isMember = hasRole_isMember(e, roleId, caller);
|
||||
uint32 currentDelay = hasRole_executionDelay(e, roleId, caller);
|
||||
|
||||
// Can only execute without delay in specific cases:
|
||||
// - target not closed
|
||||
// - if self-execution: `executionId` must match
|
||||
// - if third party execution: must be member with no delay
|
||||
assert immediate <=> (
|
||||
!closed &&
|
||||
(
|
||||
(caller == currentContract && executionId() == hashExecutionId(target, selector))
|
||||
||
|
||||
(caller != currentContract && isMember && currentDelay == 0)
|
||||
)
|
||||
);
|
||||
|
||||
// Can only execute with delay in specific cases:
|
||||
// - target not closed
|
||||
// - third party execution
|
||||
// - caller is a member and has an execution delay
|
||||
assert delay > 0 <=> (
|
||||
!closed &&
|
||||
caller != currentContract &&
|
||||
isMember &&
|
||||
currentDelay > 0
|
||||
);
|
||||
|
||||
// If there is a delay, then it must be the caller's execution delay
|
||||
assert delay > 0 => delay == currentDelay;
|
||||
|
||||
// Immediate execute means no delayed execution
|
||||
assert immediate => delay == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Functions: canCallExtended │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule canCallExtended(env e) {
|
||||
address caller;
|
||||
address target;
|
||||
bytes data;
|
||||
bytes4 selector = getSelector(data);
|
||||
|
||||
bool immediate = canCallExtended_immediate(e, caller, target, data);
|
||||
uint32 delay = canCallExtended_delay(e, caller, target, data);
|
||||
bool enabled = getAdminRestrictions_restricted(e, data);
|
||||
uint64 roleId = getAdminRestrictions_roleAdminId(e, data);
|
||||
uint32 operationDelay = getAdminRestrictions_executionDelay(e, data);
|
||||
bool inRole = hasRole_isMember(e, roleId, caller);
|
||||
uint32 executionDelay = hasRole_executionDelay(e, roleId, caller);
|
||||
|
||||
if (target == currentContract) {
|
||||
// Can only execute without delay in the specific cases:
|
||||
// - caller is the AccessManager and the executionId is set
|
||||
// or
|
||||
// - data matches an admin restricted function
|
||||
// - caller has the necessary role
|
||||
// - operation delay is not set
|
||||
// - execution delay is not set
|
||||
assert immediate <=> (
|
||||
(
|
||||
caller == currentContract &&
|
||||
data.length >= 4 &&
|
||||
executionId() == hashExecutionId(target, selector)
|
||||
) || (
|
||||
caller != currentContract &&
|
||||
enabled &&
|
||||
inRole &&
|
||||
operationDelay == 0 &&
|
||||
executionDelay == 0
|
||||
)
|
||||
);
|
||||
|
||||
// Immediate execute means no delayed execution
|
||||
// This is equivalent to "delay > 0 => !immediate"
|
||||
assert immediate => delay == 0;
|
||||
|
||||
// Can only execute with delay in specific cases:
|
||||
// - caller is a third party
|
||||
// - data matches an admin restricted function
|
||||
// - caller has the necessary role
|
||||
// -operation delay or execution delay is set
|
||||
assert delay > 0 <=> (
|
||||
caller != currentContract &&
|
||||
enabled &&
|
||||
inRole &&
|
||||
(operationDelay > 0 || executionDelay > 0)
|
||||
);
|
||||
|
||||
// If there is a delay, then it must be the maximum of caller's execution delay and the operation delay
|
||||
assert delay > 0 => to_mathint(delay) == max(operationDelay, executionDelay);
|
||||
} else if (data.length < 4) {
|
||||
assert immediate == false;
|
||||
assert delay == 0;
|
||||
} else {
|
||||
// results are equivalent when targeting third party contracts
|
||||
assert immediate == canCall_immediate(e, caller, target, selector);
|
||||
assert delay == canCall_delay(e, caller, target, selector);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: getAccess │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getAccessChangeTime(uint64 roleId, address account) {
|
||||
env e1;
|
||||
env e2;
|
||||
|
||||
// values before
|
||||
mathint getAccess1Before = getAccess_since(e1, roleId, account);
|
||||
mathint getAccess2Before = getAccess_currentDelay(e1, roleId, account);
|
||||
mathint getAccess3Before = getAccess_pendingDelay(e1, roleId, account);
|
||||
mathint getAccess4Before = getAccess_effect(e1, roleId, account);
|
||||
|
||||
// time pass: e1 → e2
|
||||
require clock(e1) <= clock(e2);
|
||||
|
||||
// values after
|
||||
mathint getAccess1After = getAccess_since(e2, roleId, account);
|
||||
mathint getAccess2After = getAccess_currentDelay(e2, roleId, account);
|
||||
mathint getAccess3After = getAccess_pendingDelay(e2, roleId, account);
|
||||
mathint getAccess4After = getAccess_effect(e2, roleId, account);
|
||||
|
||||
// member "since" cannot change as a consequence of time passing
|
||||
assert getAccess1Before == getAccess1After;
|
||||
|
||||
// any change of any other value should be a consequence of the effect timepoint being reached
|
||||
assert (
|
||||
getAccess2Before != getAccess2After ||
|
||||
getAccess3Before != getAccess3After ||
|
||||
getAccess4Before != getAccess4After
|
||||
) => (
|
||||
getAccess4Before != 0 &&
|
||||
getAccess4Before > clock(e1) &&
|
||||
getAccess4Before <= clock(e2) &&
|
||||
getAccess2After == getAccess3Before &&
|
||||
getAccess3After == 0 &&
|
||||
getAccess4After == 0
|
||||
);
|
||||
}
|
||||
|
||||
rule getAccessChangeCall(uint64 roleId, address account) {
|
||||
env e;
|
||||
|
||||
// sanity
|
||||
require sanity(e);
|
||||
|
||||
// values before
|
||||
mathint getAccess1Before = getAccess_since(e, roleId, account);
|
||||
mathint getAccess2Before = getAccess_currentDelay(e, roleId, account);
|
||||
mathint getAccess3Before = getAccess_pendingDelay(e, roleId, account);
|
||||
mathint getAccess4Before = getAccess_effect(e, roleId, account);
|
||||
|
||||
// arbitrary function call
|
||||
method f; calldataarg args; f(e, args);
|
||||
|
||||
// values before
|
||||
mathint getAccess1After = getAccess_since(e, roleId, account);
|
||||
mathint getAccess2After = getAccess_currentDelay(e, roleId, account);
|
||||
mathint getAccess3After = getAccess_pendingDelay(e, roleId, account);
|
||||
mathint getAccess4After = getAccess_effect(e, roleId, account);
|
||||
|
||||
// transitions
|
||||
assert (
|
||||
getAccess1Before != getAccess1After ||
|
||||
getAccess2Before != getAccess2After ||
|
||||
getAccess3Before != getAccess3After ||
|
||||
getAccess4Before != getAccess4After
|
||||
) => (
|
||||
(
|
||||
f.selector == sig:grantRole(uint64,address,uint32).selector &&
|
||||
getAccess1After > 0
|
||||
) || (
|
||||
(
|
||||
f.selector == sig:revokeRole(uint64,address).selector ||
|
||||
f.selector == sig:renounceRole(uint64,address).selector
|
||||
) &&
|
||||
getAccess1After == 0 &&
|
||||
getAccess2After == 0 &&
|
||||
getAccess3After == 0 &&
|
||||
getAccess4After == 0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: isTargetClosed │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule isTargetClosedChangeTime(address target) {
|
||||
env e1;
|
||||
env e2;
|
||||
|
||||
// values before
|
||||
bool isClosedBefore = isTargetClosed(e1, target);
|
||||
|
||||
// time pass: e1 → e2
|
||||
require clock(e1) <= clock(e2);
|
||||
|
||||
// values after
|
||||
bool isClosedAfter = isTargetClosed(e2, target);
|
||||
|
||||
// transitions
|
||||
assert isClosedBefore == isClosedAfter;
|
||||
}
|
||||
|
||||
rule isTargetClosedChangeCall(address target) {
|
||||
env e;
|
||||
|
||||
// values before
|
||||
bool isClosedBefore = isTargetClosed(e, target);
|
||||
|
||||
// arbitrary function call
|
||||
method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
bool isClosedAfter = isTargetClosed(e, target);
|
||||
|
||||
// transitions
|
||||
assert isClosedBefore != isClosedAfter => (
|
||||
f.selector == sig:setTargetClosed(address,bool).selector
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: getTargetFunctionRole │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getTargetFunctionRoleChangeTime(address target, bytes4 selector) {
|
||||
env e1;
|
||||
env e2;
|
||||
|
||||
// values before
|
||||
mathint roleIdBefore = getTargetFunctionRole(e1, target, selector);
|
||||
|
||||
// time pass: e1 → e2
|
||||
require clock(e1) <= clock(e2);
|
||||
|
||||
// values after
|
||||
mathint roleIdAfter = getTargetFunctionRole(e2, target, selector);
|
||||
|
||||
// transitions
|
||||
assert roleIdBefore == roleIdAfter;
|
||||
}
|
||||
|
||||
rule getTargetFunctionRoleChangeCall(address target, bytes4 selector) {
|
||||
env e;
|
||||
|
||||
// values before
|
||||
mathint roleIdBefore = getTargetFunctionRole(e, target, selector);
|
||||
|
||||
// arbitrary function call
|
||||
method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
mathint roleIdAfter = getTargetFunctionRole(e, target, selector);
|
||||
|
||||
// transitions
|
||||
assert roleIdBefore != roleIdAfter => (
|
||||
f.selector == sig:setTargetFunctionRole(address,bytes4[],uint64).selector
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: getTargetAdminDelay │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getTargetAdminDelayChangeTime(address target) {
|
||||
env e1;
|
||||
env e2;
|
||||
|
||||
// values before
|
||||
mathint delayBefore = getTargetAdminDelay(e1, target);
|
||||
mathint delayPendingBefore = getTargetAdminDelay_after(e1, target);
|
||||
mathint delayEffectBefore = getTargetAdminDelay_effect(e1, target);
|
||||
|
||||
// time pass: e1 → e2
|
||||
require clock(e1) <= clock(e2);
|
||||
|
||||
// values after
|
||||
mathint delayAfter = getTargetAdminDelay(e2, target);
|
||||
mathint delayPendingAfter = getTargetAdminDelay_after(e2, target);
|
||||
mathint delayEffectAfter = getTargetAdminDelay_effect(e2, target);
|
||||
|
||||
assert (
|
||||
delayBefore != delayAfter ||
|
||||
delayPendingBefore != delayPendingAfter ||
|
||||
delayEffectBefore != delayEffectAfter
|
||||
) => (
|
||||
delayEffectBefore > clock(e1) &&
|
||||
delayEffectBefore <= clock(e2) &&
|
||||
delayAfter == delayPendingBefore &&
|
||||
delayPendingAfter == 0 &&
|
||||
delayEffectAfter == 0
|
||||
);
|
||||
}
|
||||
|
||||
rule getTargetAdminDelayChangeCall(address target) {
|
||||
env e;
|
||||
|
||||
// values before
|
||||
mathint delayBefore = getTargetAdminDelay(e, target);
|
||||
mathint delayPendingBefore = getTargetAdminDelay_after(e, target);
|
||||
mathint delayEffectBefore = getTargetAdminDelay_effect(e, target);
|
||||
|
||||
// arbitrary function call
|
||||
method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
mathint delayAfter = getTargetAdminDelay(e, target);
|
||||
mathint delayPendingAfter = getTargetAdminDelay_after(e, target);
|
||||
mathint delayEffectAfter = getTargetAdminDelay_effect(e, target);
|
||||
|
||||
// if anything changed ...
|
||||
assert (
|
||||
delayBefore != delayAfter ||
|
||||
delayPendingBefore != delayPendingAfter ||
|
||||
delayEffectBefore != delayEffectAfter
|
||||
) => (
|
||||
(
|
||||
// ... it was the consequence of a call to setTargetAdminDelay
|
||||
f.selector == sig:setTargetAdminDelay(address,uint32).selector
|
||||
) && (
|
||||
// ... delay cannot decrease instantly
|
||||
delayAfter >= delayBefore
|
||||
) && (
|
||||
// ... if setback is not 0, value cannot change instantly
|
||||
minSetback() > 0 => (
|
||||
delayBefore == delayAfter
|
||||
)
|
||||
) && (
|
||||
// ... if the value did not change and there is a minSetback, there must be something scheduled in the future
|
||||
delayAfter == delayBefore && minSetback() > 0 => (
|
||||
delayEffectAfter >= clock(e) + minSetback()
|
||||
)
|
||||
// note: if there is no minSetback, and if the caller "confirms" the current value,
|
||||
// then this as immediate effect and nothing is scheduled
|
||||
) && (
|
||||
// ... if the value changed, then no further change should be scheduled
|
||||
delayAfter != delayBefore => (
|
||||
delayPendingAfter == 0 &&
|
||||
delayEffectAfter == 0
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: getRoleGrantDelay │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getRoleGrantDelayChangeTime(uint64 roleId) {
|
||||
env e1;
|
||||
env e2;
|
||||
|
||||
// values before
|
||||
mathint delayBefore = getRoleGrantDelay(e1, roleId);
|
||||
mathint delayPendingBefore = getRoleGrantDelay_after(e1, roleId);
|
||||
mathint delayEffectBefore = getRoleGrantDelay_effect(e1, roleId);
|
||||
|
||||
// time pass: e1 → e2
|
||||
require clock(e1) <= clock(e2);
|
||||
|
||||
// values after
|
||||
mathint delayAfter = getRoleGrantDelay(e2, roleId);
|
||||
mathint delayPendingAfter = getRoleGrantDelay_after(e2, roleId);
|
||||
mathint delayEffectAfter = getRoleGrantDelay_effect(e2, roleId);
|
||||
|
||||
assert (
|
||||
delayBefore != delayAfter ||
|
||||
delayPendingBefore != delayPendingAfter ||
|
||||
delayEffectBefore != delayEffectAfter
|
||||
) => (
|
||||
delayEffectBefore > clock(e1) &&
|
||||
delayEffectBefore <= clock(e2) &&
|
||||
delayAfter == delayPendingBefore &&
|
||||
delayPendingAfter == 0 &&
|
||||
delayEffectAfter == 0
|
||||
);
|
||||
}
|
||||
|
||||
rule getRoleGrantDelayChangeCall(uint64 roleId) {
|
||||
env e;
|
||||
|
||||
// values before
|
||||
mathint delayBefore = getRoleGrantDelay(e, roleId);
|
||||
mathint delayPendingBefore = getRoleGrantDelay_after(e, roleId);
|
||||
mathint delayEffectBefore = getRoleGrantDelay_effect(e, roleId);
|
||||
|
||||
// arbitrary function call
|
||||
method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
mathint delayAfter = getRoleGrantDelay(e, roleId);
|
||||
mathint delayPendingAfter = getRoleGrantDelay_after(e, roleId);
|
||||
mathint delayEffectAfter = getRoleGrantDelay_effect(e, roleId);
|
||||
|
||||
// if anything changed ...
|
||||
assert (
|
||||
delayBefore != delayAfter ||
|
||||
delayPendingBefore != delayPendingAfter ||
|
||||
delayEffectBefore != delayEffectAfter
|
||||
) => (
|
||||
(
|
||||
// ... it was the consequence of a call to setTargetAdminDelay
|
||||
f.selector == sig:setGrantDelay(uint64,uint32).selector
|
||||
) && (
|
||||
// ... delay cannot decrease instantly
|
||||
delayAfter >= delayBefore
|
||||
) && (
|
||||
// ... if setback is not 0, value cannot change instantly
|
||||
minSetback() > 0 => (
|
||||
delayBefore == delayAfter
|
||||
)
|
||||
) && (
|
||||
// ... if the value did not change and there is a minSetback, there must be something scheduled in the future
|
||||
delayAfter == delayBefore && minSetback() > 0 => (
|
||||
delayEffectAfter >= clock(e) + minSetback()
|
||||
)
|
||||
// note: if there is no minSetback, and if the caller "confirms" the current value,
|
||||
// then this as immediate effect and nothing is scheduled
|
||||
) && (
|
||||
// ... if the value changed, then no further change should be scheduled
|
||||
delayAfter != delayBefore => (
|
||||
delayPendingAfter == 0 &&
|
||||
delayEffectAfter == 0
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: getRoleAdmin & getRoleGuardian │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getRoleAdminChangeCall(uint64 roleId) {
|
||||
// values before
|
||||
mathint adminIdBefore = getRoleAdmin(roleId);
|
||||
|
||||
// arbitrary function call
|
||||
env e; method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
mathint adminIdAfter = getRoleAdmin(roleId);
|
||||
|
||||
// transitions
|
||||
assert adminIdBefore != adminIdAfter => f.selector == sig:setRoleAdmin(uint64,uint64).selector;
|
||||
}
|
||||
|
||||
rule getRoleGuardianChangeCall(uint64 roleId) {
|
||||
// values before
|
||||
mathint guardianIdBefore = getRoleGuardian(roleId);
|
||||
|
||||
// arbitrary function call
|
||||
env e; method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
mathint guardianIdAfter = getRoleGuardian(roleId);
|
||||
|
||||
// transitions
|
||||
assert guardianIdBefore != guardianIdAfter => (
|
||||
f.selector == sig:setRoleGuardian(uint64,uint64).selector
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: getNonce │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getNonceChangeCall(bytes32 operationId) {
|
||||
// values before
|
||||
mathint nonceBefore = getNonce(operationId);
|
||||
|
||||
// reasonable assumption
|
||||
require nonceBefore < max_uint32;
|
||||
|
||||
// arbitrary function call
|
||||
env e; method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
mathint nonceAfter = getNonce(operationId);
|
||||
|
||||
// transitions
|
||||
assert nonceBefore != nonceAfter => (
|
||||
f.selector == sig:schedule(address,bytes,uint48).selector &&
|
||||
nonceAfter == nonceBefore + 1
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ State transitions: getSchedule │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getScheduleChangeTime(bytes32 operationId) {
|
||||
env e1;
|
||||
env e2;
|
||||
|
||||
// values before
|
||||
mathint scheduleBefore = getSchedule(e1, operationId);
|
||||
|
||||
// time pass: e1 → e2
|
||||
require clock(e1) <= clock(e2);
|
||||
|
||||
// values after
|
||||
mathint scheduleAfter = getSchedule(e2, operationId);
|
||||
|
||||
// transition
|
||||
assert scheduleBefore != scheduleAfter => (
|
||||
scheduleBefore + expiration() > clock(e1) &&
|
||||
scheduleBefore + expiration() <= clock(e2) &&
|
||||
scheduleAfter == 0
|
||||
);
|
||||
}
|
||||
|
||||
rule getScheduleChangeCall(bytes32 operationId) {
|
||||
env e;
|
||||
|
||||
// values before
|
||||
mathint scheduleBefore = getSchedule(e, operationId);
|
||||
|
||||
// arbitrary function call
|
||||
method f; calldataarg args; f(e, args);
|
||||
|
||||
// values after
|
||||
mathint scheduleAfter = getSchedule(e, operationId);
|
||||
|
||||
// transitions
|
||||
assert scheduleBefore != scheduleAfter => (
|
||||
(f.selector == sig:schedule(address,bytes,uint48).selector && scheduleAfter >= clock(e)) ||
|
||||
(f.selector == sig:execute(address,bytes).selector && scheduleAfter == 0 ) ||
|
||||
(f.selector == sig:cancel(address,address,bytes).selector && scheduleAfter == 0 ) ||
|
||||
(f.selector == sig:consumeScheduledOp(address,bytes).selector && scheduleAfter == 0 ) ||
|
||||
(isOnlyAuthorized(to_bytes4(f.selector)) && scheduleAfter == 0 )
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Functions: restricted functions can only be called by owner │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule restrictedFunctions(env e) {
|
||||
require nonpayable(e);
|
||||
require sanity(e);
|
||||
|
||||
method f;
|
||||
calldataarg args;
|
||||
|
||||
f(e,args);
|
||||
|
||||
assert (
|
||||
f.selector == sig:labelRole(uint64,string).selector ||
|
||||
f.selector == sig:setRoleAdmin(uint64,uint64).selector ||
|
||||
f.selector == sig:setRoleGuardian(uint64,uint64).selector ||
|
||||
f.selector == sig:setGrantDelay(uint64,uint32).selector ||
|
||||
f.selector == sig:setTargetAdminDelay(address,uint32).selector ||
|
||||
f.selector == sig:updateAuthority(address,address).selector ||
|
||||
f.selector == sig:setTargetClosed(address,bool).selector ||
|
||||
f.selector == sig:setTargetFunctionRole(address,bytes4[],uint64).selector
|
||||
) => (
|
||||
hasRole_isMember(e, ADMIN_ROLE(), e.msg.sender) || e.msg.sender == currentContract
|
||||
);
|
||||
}
|
||||
|
||||
rule restrictedFunctionsGrantRole(env e) {
|
||||
require nonpayable(e);
|
||||
require sanity(e);
|
||||
|
||||
uint64 roleId;
|
||||
address account;
|
||||
uint32 executionDelay;
|
||||
|
||||
// We want to check that the caller has the admin role before we possibly grant it.
|
||||
bool hasAdminRoleBefore = hasRole_isMember(e, getRoleAdmin(roleId), e.msg.sender);
|
||||
|
||||
grantRole(e, roleId, account, executionDelay);
|
||||
|
||||
assert hasAdminRoleBefore || e.msg.sender == currentContract;
|
||||
}
|
||||
|
||||
rule restrictedFunctionsRevokeRole(env e) {
|
||||
require nonpayable(e);
|
||||
require sanity(e);
|
||||
|
||||
uint64 roleId;
|
||||
address account;
|
||||
|
||||
// This is needed if roleId is self-administered, the `revokeRole` call could target
|
||||
// e.msg.sender and remove the very role that is necessary for authorizing the call.
|
||||
bool hasAdminRoleBefore = hasRole_isMember(e, getRoleAdmin(roleId), e.msg.sender);
|
||||
|
||||
revokeRole(e, roleId, account);
|
||||
|
||||
assert hasAdminRoleBefore || e.msg.sender == currentContract;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Functions: canCall delay is enforced for calls to execute (only for others target) │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
// getScheduleChangeCall proves that only {schedule} can set an operation schedule to a non 0 value
|
||||
rule callDelayEnforce_scheduleInTheFuture(env e) {
|
||||
address target;
|
||||
bytes data;
|
||||
uint48 when;
|
||||
|
||||
// Condition: calling a third party with a delay
|
||||
mathint delay = canCallExtended_delay(e, e.msg.sender, target, data);
|
||||
require delay > 0;
|
||||
|
||||
// Schedule
|
||||
schedule(e, target, data, when);
|
||||
|
||||
// Get operation schedule
|
||||
mathint timepoint = getSchedule(e, hashOperation(e.msg.sender, target, data));
|
||||
|
||||
// Schedule is far enough in the future
|
||||
assert timepoint == max(clock(e) + delay, when);
|
||||
}
|
||||
|
||||
rule callDelayEnforce_executeAfterDelay(env e) {
|
||||
address target;
|
||||
bytes data;
|
||||
|
||||
// Condition: calling a third party with a delay
|
||||
mathint delay = canCallExtended_delay(e, e.msg.sender, target, data);
|
||||
|
||||
// Get operation schedule before
|
||||
mathint scheduleBefore = getSchedule(e, hashOperation(e.msg.sender, target, data));
|
||||
|
||||
// Do call
|
||||
execute@withrevert(e, target, data);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// Get operation schedule after
|
||||
mathint scheduleAfter = getSchedule(e, hashOperation(e.msg.sender, target, data));
|
||||
|
||||
// Can only execute if delay is set and has passed
|
||||
assert success => (
|
||||
delay > 0 => (
|
||||
scheduleBefore != 0 &&
|
||||
scheduleBefore <= clock(e)
|
||||
) &&
|
||||
scheduleAfter == 0
|
||||
);
|
||||
}
|
||||
300
certora/specs/DoubleEndedQueue.spec
Normal file
300
certora/specs/DoubleEndedQueue.spec
Normal file
@ -0,0 +1,300 @@
|
||||
import "helpers/helpers.spec";
|
||||
|
||||
methods {
|
||||
function pushFront(bytes32) external envfree;
|
||||
function pushBack(bytes32) external envfree;
|
||||
function popFront() external returns (bytes32) envfree;
|
||||
function popBack() external returns (bytes32) envfree;
|
||||
function clear() external envfree;
|
||||
|
||||
// exposed for FV
|
||||
function begin() external returns (uint128) envfree;
|
||||
function end() external returns (uint128) envfree;
|
||||
|
||||
// view
|
||||
function length() external returns (uint256) envfree;
|
||||
function empty() external returns (bool) envfree;
|
||||
function front() external returns (bytes32) envfree;
|
||||
function back() external returns (bytes32) envfree;
|
||||
function at_(uint256) external returns (bytes32) envfree; // at is a reserved word
|
||||
}
|
||||
|
||||
definition full() returns bool = length() == max_uint128;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: empty() is length 0 and no element exists │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant emptiness()
|
||||
empty() <=> length() == 0
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: front points to the first index and back points to the last one │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant queueFront()
|
||||
at_(0) == front()
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
invariant queueBack()
|
||||
at_(require_uint256(length() - 1)) == back()
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: pushFront adds an element at the beginning of the queue │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pushFront(bytes32 value) {
|
||||
uint256 lengthBefore = length();
|
||||
bool fullBefore = full();
|
||||
|
||||
pushFront@withrevert(value);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> !fullBefore, "never revert if not previously full";
|
||||
|
||||
// effect
|
||||
assert success => front() == value, "front set to value";
|
||||
assert success => to_mathint(length()) == lengthBefore + 1, "queue extended";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: pushFront preserves the previous values in the queue with a +1 offset │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pushFrontConsistency(uint256 index) {
|
||||
bytes32 beforeAt = at_(index);
|
||||
|
||||
bytes32 value;
|
||||
pushFront(value);
|
||||
|
||||
// try to read value
|
||||
bytes32 afterAt = at_@withrevert(require_uint256(index + 1));
|
||||
|
||||
assert !lastReverted, "value still there";
|
||||
assert afterAt == beforeAt, "data is preserved";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: pushBack adds an element at the end of the queue │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pushBack(bytes32 value) {
|
||||
uint256 lengthBefore = length();
|
||||
bool fullBefore = full();
|
||||
|
||||
pushBack@withrevert(value);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> !fullBefore, "never revert if not previously full";
|
||||
|
||||
// effect
|
||||
assert success => back() == value, "back set to value";
|
||||
assert success => to_mathint(length()) == lengthBefore + 1, "queue increased";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: pushBack preserves the previous values in the queue │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pushBackConsistency(uint256 index) {
|
||||
bytes32 beforeAt = at_(index);
|
||||
|
||||
bytes32 value;
|
||||
pushBack(value);
|
||||
|
||||
// try to read value
|
||||
bytes32 afterAt = at_@withrevert(index);
|
||||
|
||||
assert !lastReverted, "value still there";
|
||||
assert afterAt == beforeAt, "data is preserved";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: popFront removes an element from the beginning of the queue │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule popFront {
|
||||
uint256 lengthBefore = length();
|
||||
bytes32 frontBefore = front@withrevert();
|
||||
|
||||
bytes32 popped = popFront@withrevert();
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> lengthBefore != 0, "never reverts if not previously empty";
|
||||
|
||||
// effect
|
||||
assert success => frontBefore == popped, "previous front is returned";
|
||||
assert success => to_mathint(length()) == lengthBefore - 1, "queue decreased";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: at(x) is preserved and offset to at(x - 1) after calling popFront |
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule popFrontConsistency(uint256 index) {
|
||||
// Read (any) value that is not the front (this asserts the value exists / the queue is long enough)
|
||||
require index > 1;
|
||||
bytes32 before = at_(index);
|
||||
|
||||
popFront();
|
||||
|
||||
// try to read value
|
||||
bytes32 after = at_@withrevert(require_uint256(index - 1));
|
||||
|
||||
assert !lastReverted, "value still exists in the queue";
|
||||
assert before == after, "values are offset and not modified";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: popBack removes an element from the end of the queue │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule popBack {
|
||||
uint256 lengthBefore = length();
|
||||
bytes32 backBefore = back@withrevert();
|
||||
|
||||
bytes32 popped = popBack@withrevert();
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> lengthBefore != 0, "never reverts if not previously empty";
|
||||
|
||||
// effect
|
||||
assert success => backBefore == popped, "previous back is returned";
|
||||
assert success => to_mathint(length()) == lengthBefore - 1, "queue decreased";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: at(x) is preserved after calling popBack |
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule popBackConsistency(uint256 index) {
|
||||
// Read (any) value that is not the back (this asserts the value exists / the queue is long enough)
|
||||
require to_mathint(index) < length() - 1;
|
||||
bytes32 before = at_(index);
|
||||
|
||||
popBack();
|
||||
|
||||
// try to read value
|
||||
bytes32 after = at_@withrevert(index);
|
||||
|
||||
assert !lastReverted, "value still exists in the queue";
|
||||
assert before == after, "values are offset and not modified";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: clear sets length to 0 │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule clear {
|
||||
clear@withrevert();
|
||||
|
||||
// liveness
|
||||
assert !lastReverted, "never reverts";
|
||||
|
||||
// effect
|
||||
assert length() == 0, "sets length to 0";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: front/back access reverts only if the queue is empty or querying out of bounds │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyEmptyOrFullRevert(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
method f;
|
||||
calldataarg args;
|
||||
|
||||
bool emptyBefore = empty();
|
||||
bool fullBefore = full();
|
||||
|
||||
f@withrevert(e, args);
|
||||
|
||||
assert lastReverted => (
|
||||
(f.selector == sig:front().selector && emptyBefore) ||
|
||||
(f.selector == sig:back().selector && emptyBefore) ||
|
||||
(f.selector == sig:popFront().selector && emptyBefore) ||
|
||||
(f.selector == sig:popBack().selector && emptyBefore) ||
|
||||
(f.selector == sig:pushFront(bytes32).selector && fullBefore ) ||
|
||||
(f.selector == sig:pushBack(bytes32).selector && fullBefore ) ||
|
||||
f.selector == sig:at_(uint256).selector // revert conditions are verified in onlyOutOfBoundsRevert
|
||||
), "only revert if empty or out of bounds";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: at(index) only reverts if index is out of bounds |
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyOutOfBoundsRevert(uint256 index) {
|
||||
at_@withrevert(index);
|
||||
|
||||
assert lastReverted <=> index >= length(), "only reverts if index is out of bounds";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: only clear/push/pop operations can change the length of the queue │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noLengthChange(env e) {
|
||||
method f;
|
||||
calldataarg args;
|
||||
|
||||
uint256 lengthBefore = length();
|
||||
f(e, args);
|
||||
uint256 lengthAfter = length();
|
||||
|
||||
assert lengthAfter != lengthBefore => (
|
||||
(f.selector == sig:pushFront(bytes32).selector && to_mathint(lengthAfter) == lengthBefore + 1) ||
|
||||
(f.selector == sig:pushBack(bytes32).selector && to_mathint(lengthAfter) == lengthBefore + 1) ||
|
||||
(f.selector == sig:popBack().selector && to_mathint(lengthAfter) == lengthBefore - 1) ||
|
||||
(f.selector == sig:popFront().selector && to_mathint(lengthAfter) == lengthBefore - 1) ||
|
||||
(f.selector == sig:clear().selector && lengthAfter == 0)
|
||||
), "length is only affected by clear/pop/push operations";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: only push/pop can change values bounded in the queue (outside values aren't cleared) │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noDataChange(env e) {
|
||||
method f;
|
||||
calldataarg args;
|
||||
|
||||
uint256 index;
|
||||
bytes32 atBefore = at_(index);
|
||||
f(e, args);
|
||||
bytes32 atAfter = at_@withrevert(index);
|
||||
bool atAfterSuccess = !lastReverted;
|
||||
|
||||
assert !atAfterSuccess <=> (
|
||||
(f.selector == sig:clear().selector ) ||
|
||||
(f.selector == sig:popBack().selector && index == length()) ||
|
||||
(f.selector == sig:popFront().selector && index == length())
|
||||
), "indexes of the queue are only removed by clear or pop";
|
||||
|
||||
assert atAfterSuccess && atAfter != atBefore => (
|
||||
f.selector == sig:popFront().selector ||
|
||||
f.selector == sig:pushFront(bytes32).selector
|
||||
), "values of the queue are only changed by popFront or pushFront";
|
||||
}
|
||||
352
certora/specs/ERC20.spec
Normal file
352
certora/specs/ERC20.spec
Normal file
@ -0,0 +1,352 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IERC20.spec";
|
||||
import "methods/IERC2612.spec";
|
||||
|
||||
methods {
|
||||
// exposed for FV
|
||||
function mint(address,uint256) external;
|
||||
function burn(address,uint256) external;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Ghost & hooks: sum of all balances │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
ghost mathint sumOfBalances {
|
||||
init_state axiom sumOfBalances == 0;
|
||||
}
|
||||
|
||||
// Because `balance` has a uint256 type, any balance addition in CVL1 behaved as a `require_uint256()` casting,
|
||||
// leaving out the possibility of overflow. This is not the case in CVL2 where casting became more explicit.
|
||||
// A counterexample in CVL2 is having an initial state where Alice initial balance is larger than totalSupply, which
|
||||
// overflows Alice's balance when receiving a transfer. This is not possible unless the contract is deployed into an
|
||||
// already used address (or upgraded from corrupted state).
|
||||
// We restrict such behavior by making sure no balance is greater than the sum of balances.
|
||||
hook Sload uint256 balance _balances[KEY address addr] STORAGE {
|
||||
require sumOfBalances >= to_mathint(balance);
|
||||
}
|
||||
|
||||
hook Sstore _balances[KEY address addr] uint256 newValue (uint256 oldValue) STORAGE {
|
||||
sumOfBalances = sumOfBalances - oldValue + newValue;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: totalSupply is the sum of all balances │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant totalSupplyIsSumOfBalances()
|
||||
to_mathint(totalSupply()) == sumOfBalances;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: balance of address(0) is 0 │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant zeroAddressNoBalance()
|
||||
balanceOf(0) == 0;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: only mint and burn can change total supply │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noChangeTotalSupply(env e) {
|
||||
requireInvariant totalSupplyIsSumOfBalances();
|
||||
|
||||
method f;
|
||||
calldataarg args;
|
||||
|
||||
uint256 totalSupplyBefore = totalSupply();
|
||||
f(e, args);
|
||||
uint256 totalSupplyAfter = totalSupply();
|
||||
|
||||
assert totalSupplyAfter > totalSupplyBefore => f.selector == sig:mint(address,uint256).selector;
|
||||
assert totalSupplyAfter < totalSupplyBefore => f.selector == sig:burn(address,uint256).selector;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: only the token holder or an approved third party can reduce an account's balance │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyAuthorizedCanTransfer(env e) {
|
||||
requireInvariant totalSupplyIsSumOfBalances();
|
||||
|
||||
method f;
|
||||
calldataarg args;
|
||||
address account;
|
||||
|
||||
uint256 allowanceBefore = allowance(account, e.msg.sender);
|
||||
uint256 balanceBefore = balanceOf(account);
|
||||
f(e, args);
|
||||
uint256 balanceAfter = balanceOf(account);
|
||||
|
||||
assert (
|
||||
balanceAfter < balanceBefore
|
||||
) => (
|
||||
f.selector == sig:burn(address,uint256).selector ||
|
||||
e.msg.sender == account ||
|
||||
balanceBefore - balanceAfter <= to_mathint(allowanceBefore)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: only the token holder (or a permit) can increase allowance. The spender can decrease it by using it │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyHolderOfSpenderCanChangeAllowance(env e) {
|
||||
requireInvariant totalSupplyIsSumOfBalances();
|
||||
|
||||
method f;
|
||||
calldataarg args;
|
||||
address holder;
|
||||
address spender;
|
||||
|
||||
uint256 allowanceBefore = allowance(holder, spender);
|
||||
f(e, args);
|
||||
uint256 allowanceAfter = allowance(holder, spender);
|
||||
|
||||
assert (
|
||||
allowanceAfter > allowanceBefore
|
||||
) => (
|
||||
(f.selector == sig:approve(address,uint256).selector && e.msg.sender == holder) ||
|
||||
(f.selector == sig:permit(address,address,uint256,uint256,uint8,bytes32,bytes32).selector)
|
||||
);
|
||||
|
||||
assert (
|
||||
allowanceAfter < allowanceBefore
|
||||
) => (
|
||||
(f.selector == sig:transferFrom(address,address,uint256).selector && e.msg.sender == spender) ||
|
||||
(f.selector == sig:approve(address,uint256).selector && e.msg.sender == holder ) ||
|
||||
(f.selector == sig:permit(address,address,uint256,uint256,uint8,bytes32,bytes32).selector)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: mint behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule mint(env e) {
|
||||
requireInvariant totalSupplyIsSumOfBalances();
|
||||
require nonpayable(e);
|
||||
|
||||
address to;
|
||||
address other;
|
||||
uint256 amount;
|
||||
|
||||
// cache state
|
||||
uint256 toBalanceBefore = balanceOf(to);
|
||||
uint256 otherBalanceBefore = balanceOf(other);
|
||||
uint256 totalSupplyBefore = totalSupply();
|
||||
|
||||
// run transaction
|
||||
mint@withrevert(e, to, amount);
|
||||
|
||||
// check outcome
|
||||
if (lastReverted) {
|
||||
assert to == 0 || totalSupplyBefore + amount > max_uint256;
|
||||
} else {
|
||||
// updates balance and totalSupply
|
||||
assert to_mathint(balanceOf(to)) == toBalanceBefore + amount;
|
||||
assert to_mathint(totalSupply()) == totalSupplyBefore + amount;
|
||||
|
||||
// no other balance is modified
|
||||
assert balanceOf(other) != otherBalanceBefore => other == to;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: burn behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule burn(env e) {
|
||||
requireInvariant totalSupplyIsSumOfBalances();
|
||||
require nonpayable(e);
|
||||
|
||||
address from;
|
||||
address other;
|
||||
uint256 amount;
|
||||
|
||||
// cache state
|
||||
uint256 fromBalanceBefore = balanceOf(from);
|
||||
uint256 otherBalanceBefore = balanceOf(other);
|
||||
uint256 totalSupplyBefore = totalSupply();
|
||||
|
||||
// run transaction
|
||||
burn@withrevert(e, from, amount);
|
||||
|
||||
// check outcome
|
||||
if (lastReverted) {
|
||||
assert from == 0 || fromBalanceBefore < amount;
|
||||
} else {
|
||||
// updates balance and totalSupply
|
||||
assert to_mathint(balanceOf(from)) == fromBalanceBefore - amount;
|
||||
assert to_mathint(totalSupply()) == totalSupplyBefore - amount;
|
||||
|
||||
// no other balance is modified
|
||||
assert balanceOf(other) != otherBalanceBefore => other == from;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: transfer behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule transfer(env e) {
|
||||
requireInvariant totalSupplyIsSumOfBalances();
|
||||
require nonpayable(e);
|
||||
|
||||
address holder = e.msg.sender;
|
||||
address recipient;
|
||||
address other;
|
||||
uint256 amount;
|
||||
|
||||
// cache state
|
||||
uint256 holderBalanceBefore = balanceOf(holder);
|
||||
uint256 recipientBalanceBefore = balanceOf(recipient);
|
||||
uint256 otherBalanceBefore = balanceOf(other);
|
||||
|
||||
// run transaction
|
||||
transfer@withrevert(e, recipient, amount);
|
||||
|
||||
// check outcome
|
||||
if (lastReverted) {
|
||||
assert holder == 0 || recipient == 0 || amount > holderBalanceBefore;
|
||||
} else {
|
||||
// balances of holder and recipient are updated
|
||||
assert to_mathint(balanceOf(holder)) == holderBalanceBefore - (holder == recipient ? 0 : amount);
|
||||
assert to_mathint(balanceOf(recipient)) == recipientBalanceBefore + (holder == recipient ? 0 : amount);
|
||||
|
||||
// no other balance is modified
|
||||
assert balanceOf(other) != otherBalanceBefore => (other == holder || other == recipient);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: transferFrom behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule transferFrom(env e) {
|
||||
requireInvariant totalSupplyIsSumOfBalances();
|
||||
require nonpayable(e);
|
||||
|
||||
address spender = e.msg.sender;
|
||||
address holder;
|
||||
address recipient;
|
||||
address other;
|
||||
uint256 amount;
|
||||
|
||||
// cache state
|
||||
uint256 allowanceBefore = allowance(holder, spender);
|
||||
uint256 holderBalanceBefore = balanceOf(holder);
|
||||
uint256 recipientBalanceBefore = balanceOf(recipient);
|
||||
uint256 otherBalanceBefore = balanceOf(other);
|
||||
|
||||
// run transaction
|
||||
transferFrom@withrevert(e, holder, recipient, amount);
|
||||
|
||||
// check outcome
|
||||
if (lastReverted) {
|
||||
assert holder == 0 || recipient == 0 || spender == 0 || amount > holderBalanceBefore || amount > allowanceBefore;
|
||||
} else {
|
||||
// allowance is valid & updated
|
||||
assert allowanceBefore >= amount;
|
||||
assert to_mathint(allowance(holder, spender)) == (allowanceBefore == max_uint256 ? max_uint256 : allowanceBefore - amount);
|
||||
|
||||
// balances of holder and recipient are updated
|
||||
assert to_mathint(balanceOf(holder)) == holderBalanceBefore - (holder == recipient ? 0 : amount);
|
||||
assert to_mathint(balanceOf(recipient)) == recipientBalanceBefore + (holder == recipient ? 0 : amount);
|
||||
|
||||
// no other balance is modified
|
||||
assert balanceOf(other) != otherBalanceBefore => (other == holder || other == recipient);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: approve behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule approve(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address holder = e.msg.sender;
|
||||
address spender;
|
||||
address otherHolder;
|
||||
address otherSpender;
|
||||
uint256 amount;
|
||||
|
||||
// cache state
|
||||
uint256 otherAllowanceBefore = allowance(otherHolder, otherSpender);
|
||||
|
||||
// run transaction
|
||||
approve@withrevert(e, spender, amount);
|
||||
|
||||
// check outcome
|
||||
if (lastReverted) {
|
||||
assert holder == 0 || spender == 0;
|
||||
} else {
|
||||
// allowance is updated
|
||||
assert allowance(holder, spender) == amount;
|
||||
|
||||
// other allowances are untouched
|
||||
assert allowance(otherHolder, otherSpender) != otherAllowanceBefore => (otherHolder == holder && otherSpender == spender);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: permit behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule permit(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address holder;
|
||||
address spender;
|
||||
uint256 amount;
|
||||
uint256 deadline;
|
||||
uint8 v;
|
||||
bytes32 r;
|
||||
bytes32 s;
|
||||
|
||||
address account1;
|
||||
address account2;
|
||||
address account3;
|
||||
|
||||
// cache state
|
||||
uint256 nonceBefore = nonces(holder);
|
||||
uint256 otherNonceBefore = nonces(account1);
|
||||
uint256 otherAllowanceBefore = allowance(account2, account3);
|
||||
|
||||
// sanity: nonce overflow, which possible in theory, is assumed to be impossible in practice
|
||||
require nonceBefore < max_uint256;
|
||||
require otherNonceBefore < max_uint256;
|
||||
|
||||
// run transaction
|
||||
permit@withrevert(e, holder, spender, amount, deadline, v, r, s);
|
||||
|
||||
// check outcome
|
||||
if (lastReverted) {
|
||||
// Without formally checking the signature, we can't verify exactly the revert causes
|
||||
assert true;
|
||||
} else {
|
||||
// allowance and nonce are updated
|
||||
assert allowance(holder, spender) == amount;
|
||||
assert to_mathint(nonces(holder)) == nonceBefore + 1;
|
||||
|
||||
// deadline was respected
|
||||
assert deadline >= e.block.timestamp;
|
||||
|
||||
// no other allowance or nonce is modified
|
||||
assert nonces(account1) != otherNonceBefore => account1 == holder;
|
||||
assert allowance(account2, account3) != otherAllowanceBefore => (account2 == holder && account3 == spender);
|
||||
}
|
||||
}
|
||||
55
certora/specs/ERC20FlashMint.spec
Normal file
55
certora/specs/ERC20FlashMint.spec
Normal file
@ -0,0 +1,55 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IERC20.spec";
|
||||
import "methods/IERC3156FlashLender.spec";
|
||||
import "methods/IERC3156FlashBorrower.spec";
|
||||
|
||||
methods {
|
||||
// non standard ERC-3156 functions
|
||||
function flashFeeReceiver() external returns (address) envfree;
|
||||
|
||||
// function summaries below
|
||||
function _._update(address from, address to, uint256 amount) internal => specUpdate(from, to, amount) expect void ALL;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Ghost: track mint and burns in the CVL │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
ghost mapping(address => mathint) trackedMintAmount;
|
||||
ghost mapping(address => mathint) trackedBurnAmount;
|
||||
ghost mapping(address => mapping(address => mathint)) trackedTransferedAmount;
|
||||
|
||||
function specUpdate(address from, address to, uint256 amount) {
|
||||
if (from == 0 && to == 0) { assert(false); } // defensive
|
||||
|
||||
if (from == 0) {
|
||||
trackedMintAmount[to] = amount;
|
||||
} else if (to == 0) {
|
||||
trackedBurnAmount[from] = amount;
|
||||
} else {
|
||||
trackedTransferedAmount[from][to] = amount;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: When doing a flashLoan, "amount" is minted and burnt, additionally, the fee is either burnt │
|
||||
│ (if the fee recipient is 0) or transferred (if the fee recipient is not 0) │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule checkMintAndBurn(env e) {
|
||||
address receiver;
|
||||
address token;
|
||||
uint256 amount;
|
||||
bytes data;
|
||||
|
||||
uint256 fees = flashFee(token, amount);
|
||||
address recipient = flashFeeReceiver();
|
||||
|
||||
flashLoan(e, receiver, token, amount, data);
|
||||
|
||||
assert trackedMintAmount[receiver] == to_mathint(amount);
|
||||
assert trackedBurnAmount[receiver] == amount + to_mathint(recipient == 0 ? fees : 0);
|
||||
assert (fees > 0 && recipient != 0) => trackedTransferedAmount[receiver][recipient] == to_mathint(fees);
|
||||
}
|
||||
198
certora/specs/ERC20Wrapper.spec
Normal file
198
certora/specs/ERC20Wrapper.spec
Normal file
@ -0,0 +1,198 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "ERC20.spec";
|
||||
|
||||
methods {
|
||||
function underlying() external returns(address) envfree;
|
||||
function underlyingTotalSupply() external returns(uint256) envfree;
|
||||
function underlyingBalanceOf(address) external returns(uint256) envfree;
|
||||
function underlyingAllowanceToThis(address) external returns(uint256) envfree;
|
||||
|
||||
function depositFor(address, uint256) external returns(bool);
|
||||
function withdrawTo(address, uint256) external returns(bool);
|
||||
function recover(address) external returns(uint256);
|
||||
}
|
||||
|
||||
use invariant totalSupplyIsSumOfBalances;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Helper: consequence of `totalSupplyIsSumOfBalances` applied to underlying │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
definition underlyingBalancesLowerThanUnderlyingSupply(address a) returns bool =
|
||||
underlyingBalanceOf(a) <= underlyingTotalSupply();
|
||||
|
||||
definition sumOfUnderlyingBalancesLowerThanUnderlyingSupply(address a, address b) returns bool =
|
||||
a != b => underlyingBalanceOf(a) + underlyingBalanceOf(b) <= to_mathint(underlyingTotalSupply());
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: wrapped token can't be undercollateralized (solvency of the wrapper) │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant totalSupplyIsSmallerThanUnderlyingBalance()
|
||||
totalSupply() <= underlyingBalanceOf(currentContract) &&
|
||||
underlyingBalanceOf(currentContract) <= underlyingTotalSupply() &&
|
||||
underlyingTotalSupply() <= max_uint256
|
||||
{
|
||||
preserved {
|
||||
requireInvariant totalSupplyIsSumOfBalances;
|
||||
require underlyingBalancesLowerThanUnderlyingSupply(currentContract);
|
||||
}
|
||||
preserved depositFor(address account, uint256 amount) with (env e) {
|
||||
require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(e.msg.sender, currentContract);
|
||||
}
|
||||
}
|
||||
|
||||
invariant noSelfWrap()
|
||||
currentContract != underlying();
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: depositFor liveness and effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule depositFor(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address sender = e.msg.sender;
|
||||
address receiver;
|
||||
address other;
|
||||
uint256 amount;
|
||||
|
||||
// sanity
|
||||
requireInvariant noSelfWrap;
|
||||
requireInvariant totalSupplyIsSumOfBalances;
|
||||
requireInvariant totalSupplyIsSmallerThanUnderlyingBalance;
|
||||
require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(currentContract, sender);
|
||||
|
||||
uint256 balanceBefore = balanceOf(receiver);
|
||||
uint256 supplyBefore = totalSupply();
|
||||
uint256 senderUnderlyingBalanceBefore = underlyingBalanceOf(sender);
|
||||
uint256 senderUnderlyingAllowanceBefore = underlyingAllowanceToThis(sender);
|
||||
uint256 wrapperUnderlyingBalanceBefore = underlyingBalanceOf(currentContract);
|
||||
uint256 underlyingSupplyBefore = underlyingTotalSupply();
|
||||
|
||||
uint256 otherBalanceBefore = balanceOf(other);
|
||||
uint256 otherUnderlyingBalanceBefore = underlyingBalanceOf(other);
|
||||
|
||||
depositFor@withrevert(e, receiver, amount);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
sender != currentContract && // invalid sender
|
||||
sender != 0 && // invalid sender
|
||||
receiver != currentContract && // invalid receiver
|
||||
receiver != 0 && // invalid receiver
|
||||
amount <= senderUnderlyingBalanceBefore && // deposit doesn't exceed balance
|
||||
amount <= senderUnderlyingAllowanceBefore // deposit doesn't exceed allowance
|
||||
);
|
||||
|
||||
// effects
|
||||
assert success => (
|
||||
to_mathint(balanceOf(receiver)) == balanceBefore + amount &&
|
||||
to_mathint(totalSupply()) == supplyBefore + amount &&
|
||||
to_mathint(underlyingBalanceOf(currentContract)) == wrapperUnderlyingBalanceBefore + amount &&
|
||||
to_mathint(underlyingBalanceOf(sender)) == senderUnderlyingBalanceBefore - amount
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert underlyingTotalSupply() == underlyingSupplyBefore;
|
||||
assert balanceOf(other) != otherBalanceBefore => other == receiver;
|
||||
assert underlyingBalanceOf(other) != otherUnderlyingBalanceBefore => (other == sender || other == currentContract);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: withdrawTo liveness and effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule withdrawTo(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address sender = e.msg.sender;
|
||||
address receiver;
|
||||
address other;
|
||||
uint256 amount;
|
||||
|
||||
// sanity
|
||||
requireInvariant noSelfWrap;
|
||||
requireInvariant totalSupplyIsSumOfBalances;
|
||||
requireInvariant totalSupplyIsSmallerThanUnderlyingBalance;
|
||||
require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(currentContract, receiver);
|
||||
|
||||
uint256 balanceBefore = balanceOf(sender);
|
||||
uint256 supplyBefore = totalSupply();
|
||||
uint256 receiverUnderlyingBalanceBefore = underlyingBalanceOf(receiver);
|
||||
uint256 wrapperUnderlyingBalanceBefore = underlyingBalanceOf(currentContract);
|
||||
uint256 underlyingSupplyBefore = underlyingTotalSupply();
|
||||
|
||||
uint256 otherBalanceBefore = balanceOf(other);
|
||||
uint256 otherUnderlyingBalanceBefore = underlyingBalanceOf(other);
|
||||
|
||||
withdrawTo@withrevert(e, receiver, amount);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
sender != 0 && // invalid sender
|
||||
receiver != currentContract && // invalid receiver
|
||||
receiver != 0 && // invalid receiver
|
||||
amount <= balanceBefore // withdraw doesn't exceed balance
|
||||
);
|
||||
|
||||
// effects
|
||||
assert success => (
|
||||
to_mathint(balanceOf(sender)) == balanceBefore - amount &&
|
||||
to_mathint(totalSupply()) == supplyBefore - amount &&
|
||||
to_mathint(underlyingBalanceOf(currentContract)) == wrapperUnderlyingBalanceBefore - (currentContract != receiver ? amount : 0) &&
|
||||
to_mathint(underlyingBalanceOf(receiver)) == receiverUnderlyingBalanceBefore + (currentContract != receiver ? amount : 0)
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert underlyingTotalSupply() == underlyingSupplyBefore;
|
||||
assert balanceOf(other) != otherBalanceBefore => other == sender;
|
||||
assert underlyingBalanceOf(other) != otherUnderlyingBalanceBefore => (other == receiver || other == currentContract);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: recover liveness and effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule recover(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address receiver;
|
||||
address other;
|
||||
|
||||
// sanity
|
||||
requireInvariant noSelfWrap;
|
||||
requireInvariant totalSupplyIsSumOfBalances;
|
||||
requireInvariant totalSupplyIsSmallerThanUnderlyingBalance;
|
||||
|
||||
mathint value = underlyingBalanceOf(currentContract) - totalSupply();
|
||||
uint256 supplyBefore = totalSupply();
|
||||
uint256 balanceBefore = balanceOf(receiver);
|
||||
|
||||
uint256 otherBalanceBefore = balanceOf(other);
|
||||
uint256 otherUnderlyingBalanceBefore = underlyingBalanceOf(other);
|
||||
|
||||
recover@withrevert(e, receiver);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> receiver != 0;
|
||||
|
||||
// effect
|
||||
assert success => (
|
||||
to_mathint(balanceOf(receiver)) == balanceBefore + value &&
|
||||
to_mathint(totalSupply()) == supplyBefore + value &&
|
||||
totalSupply() == underlyingBalanceOf(currentContract)
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert underlyingBalanceOf(other) == otherUnderlyingBalanceBefore;
|
||||
assert balanceOf(other) != otherBalanceBefore => other == receiver;
|
||||
}
|
||||
679
certora/specs/ERC721.spec
Normal file
679
certora/specs/ERC721.spec
Normal file
@ -0,0 +1,679 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IERC721.spec";
|
||||
import "methods/IERC721Receiver.spec";
|
||||
|
||||
methods {
|
||||
// exposed for FV
|
||||
function mint(address,uint256) external;
|
||||
function safeMint(address,uint256) external;
|
||||
function safeMint(address,uint256,bytes) external;
|
||||
function burn(uint256) external;
|
||||
|
||||
function unsafeOwnerOf(uint256) external returns (address) envfree;
|
||||
function unsafeGetApproved(uint256) external returns (address) envfree;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Helpers │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
|
||||
definition authSanity(env e) returns bool = e.msg.sender != 0;
|
||||
|
||||
// Could be broken in theory, but not in practice
|
||||
definition balanceLimited(address account) returns bool = balanceOf(account) < max_uint256;
|
||||
|
||||
function helperTransferWithRevert(env e, method f, address from, address to, uint256 tokenId) {
|
||||
if (f.selector == sig:transferFrom(address,address,uint256).selector) {
|
||||
transferFrom@withrevert(e, from, to, tokenId);
|
||||
} else if (f.selector == sig:safeTransferFrom(address,address,uint256).selector) {
|
||||
safeTransferFrom@withrevert(e, from, to, tokenId);
|
||||
} else if (f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector) {
|
||||
bytes params;
|
||||
require params.length < 0xffff;
|
||||
safeTransferFrom@withrevert(e, from, to, tokenId, params);
|
||||
} else {
|
||||
calldataarg args;
|
||||
f@withrevert(e, args);
|
||||
}
|
||||
}
|
||||
|
||||
function helperMintWithRevert(env e, method f, address to, uint256 tokenId) {
|
||||
if (f.selector == sig:mint(address,uint256).selector) {
|
||||
mint@withrevert(e, to, tokenId);
|
||||
} else if (f.selector == sig:safeMint(address,uint256).selector) {
|
||||
safeMint@withrevert(e, to, tokenId);
|
||||
} else if (f.selector == sig:safeMint(address,uint256,bytes).selector) {
|
||||
bytes params;
|
||||
require params.length < 0xffff;
|
||||
safeMint@withrevert(e, to, tokenId, params);
|
||||
} else {
|
||||
require false;
|
||||
}
|
||||
}
|
||||
|
||||
function helperSoundFnCall(env e, method f) {
|
||||
if (f.selector == sig:mint(address,uint256).selector) {
|
||||
address to; uint256 tokenId;
|
||||
require balanceLimited(to);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
mint(e, to, tokenId);
|
||||
} else if (f.selector == sig:safeMint(address,uint256).selector) {
|
||||
address to; uint256 tokenId;
|
||||
require balanceLimited(to);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
safeMint(e, to, tokenId);
|
||||
} else if (f.selector == sig:safeMint(address,uint256,bytes).selector) {
|
||||
address to; uint256 tokenId; bytes data;
|
||||
require data.length < 0xffff;
|
||||
require balanceLimited(to);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
safeMint(e, to, tokenId, data);
|
||||
} else if (f.selector == sig:burn(uint256).selector) {
|
||||
uint256 tokenId;
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
burn(e, tokenId);
|
||||
} else if (f.selector == sig:transferFrom(address,address,uint256).selector) {
|
||||
address from; address to; uint256 tokenId;
|
||||
require balanceLimited(to);
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
transferFrom(e, from, to, tokenId);
|
||||
} else if (f.selector == sig:safeTransferFrom(address,address,uint256).selector) {
|
||||
address from; address to; uint256 tokenId;
|
||||
require balanceLimited(to);
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
safeTransferFrom(e, from, to, tokenId);
|
||||
} else if (f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector) {
|
||||
address from; address to; uint256 tokenId; bytes data;
|
||||
require data.length < 0xffff;
|
||||
require balanceLimited(to);
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
safeTransferFrom(e, from, to, tokenId, data);
|
||||
} else {
|
||||
calldataarg args;
|
||||
f(e, args);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Ghost & hooks: ownership count │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
ghost mathint _ownedTotal {
|
||||
init_state axiom _ownedTotal == 0;
|
||||
}
|
||||
|
||||
ghost mapping(address => mathint) _ownedByUser {
|
||||
init_state axiom forall address a. _ownedByUser[a] == 0;
|
||||
}
|
||||
|
||||
hook Sstore _owners[KEY uint256 tokenId] address newOwner (address oldOwner) STORAGE {
|
||||
_ownedByUser[newOwner] = _ownedByUser[newOwner] + to_mathint(newOwner != 0 ? 1 : 0);
|
||||
_ownedByUser[oldOwner] = _ownedByUser[oldOwner] - to_mathint(oldOwner != 0 ? 1 : 0);
|
||||
_ownedTotal = _ownedTotal + to_mathint(newOwner != 0 ? 1 : 0) - to_mathint(oldOwner != 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Ghost & hooks: sum of all balances │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
ghost mathint _supply {
|
||||
init_state axiom _supply == 0;
|
||||
}
|
||||
|
||||
ghost mapping(address => mathint) _balances {
|
||||
init_state axiom forall address a. _balances[a] == 0;
|
||||
}
|
||||
|
||||
hook Sstore _balances[KEY address addr] uint256 newValue (uint256 oldValue) STORAGE {
|
||||
_supply = _supply - oldValue + newValue;
|
||||
}
|
||||
|
||||
// TODO: This used to not be necessary. We should try to remove it. In order to do so, we will probably need to add
|
||||
// many "preserved" directive that require the "balanceOfConsistency" invariant on the accounts involved.
|
||||
hook Sload uint256 value _balances[KEY address user] STORAGE {
|
||||
require _balances[user] == to_mathint(value);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: number of owned tokens is the sum of all balances │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant ownedTotalIsSumOfBalances()
|
||||
_ownedTotal == _supply
|
||||
{
|
||||
preserved mint(address to, uint256 tokenId) with (env e) {
|
||||
require balanceLimited(to);
|
||||
}
|
||||
preserved safeMint(address to, uint256 tokenId) with (env e) {
|
||||
require balanceLimited(to);
|
||||
}
|
||||
preserved safeMint(address to, uint256 tokenId, bytes data) with (env e) {
|
||||
require balanceLimited(to);
|
||||
}
|
||||
preserved burn(uint256 tokenId) with (env e) {
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant balanceOfConsistency(ownerOf(tokenId));
|
||||
}
|
||||
preserved transferFrom(address from, address to, uint256 tokenId) with (env e) {
|
||||
require balanceLimited(to);
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant balanceOfConsistency(from);
|
||||
requireInvariant balanceOfConsistency(to);
|
||||
}
|
||||
preserved safeTransferFrom(address from, address to, uint256 tokenId) with (env e) {
|
||||
require balanceLimited(to);
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant balanceOfConsistency(from);
|
||||
requireInvariant balanceOfConsistency(to);
|
||||
}
|
||||
preserved safeTransferFrom(address from, address to, uint256 tokenId, bytes data) with (env e) {
|
||||
require balanceLimited(to);
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
requireInvariant balanceOfConsistency(from);
|
||||
requireInvariant balanceOfConsistency(to);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: balanceOf is the number of tokens owned │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant balanceOfConsistency(address user)
|
||||
to_mathint(balanceOf(user)) == _ownedByUser[user] &&
|
||||
to_mathint(balanceOf(user)) == _balances[user]
|
||||
{
|
||||
preserved {
|
||||
require balanceLimited(user);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: owner of a token must have some balance │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant ownerHasBalance(uint256 tokenId)
|
||||
balanceOf(ownerOf(tokenId)) > 0
|
||||
{
|
||||
preserved {
|
||||
requireInvariant balanceOfConsistency(ownerOf(tokenId));
|
||||
require balanceLimited(ownerOf(tokenId));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: balance of address(0) is 0 │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule zeroAddressBalanceRevert() {
|
||||
balanceOf@withrevert(0);
|
||||
assert lastReverted;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: address(0) has no authorized operator │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant zeroAddressHasNoApprovedOperator(address a)
|
||||
!isApprovedForAll(0, a)
|
||||
{
|
||||
preserved with (env e) {
|
||||
require nonzerosender(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: tokens that do not exist are not owned and not approved │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant notMintedUnset(uint256 tokenId)
|
||||
unsafeOwnerOf(tokenId) == 0 => unsafeGetApproved(tokenId) == 0;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: unsafeOwnerOf and unsafeGetApproved don't revert + ownerOf and getApproved revert if token does not exist │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule notMintedRevert(uint256 tokenId) {
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
|
||||
address _owner = unsafeOwnerOf@withrevert(tokenId);
|
||||
assert !lastReverted;
|
||||
|
||||
address _approved = unsafeGetApproved@withrevert(tokenId);
|
||||
assert !lastReverted;
|
||||
|
||||
address owner = ownerOf@withrevert(tokenId);
|
||||
assert lastReverted <=> _owner == 0;
|
||||
assert !lastReverted => _owner == owner;
|
||||
|
||||
address approved = getApproved@withrevert(tokenId);
|
||||
assert lastReverted <=> _owner == 0;
|
||||
assert !lastReverted => _approved == approved;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: total supply can only change through mint and burn │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule supplyChange(env e) {
|
||||
require nonzerosender(e);
|
||||
requireInvariant zeroAddressHasNoApprovedOperator(e.msg.sender);
|
||||
|
||||
mathint supplyBefore = _supply;
|
||||
method f; helperSoundFnCall(e, f);
|
||||
mathint supplyAfter = _supply;
|
||||
|
||||
assert supplyAfter > supplyBefore => (
|
||||
supplyAfter == supplyBefore + 1 &&
|
||||
(
|
||||
f.selector == sig:mint(address,uint256).selector ||
|
||||
f.selector == sig:safeMint(address,uint256).selector ||
|
||||
f.selector == sig:safeMint(address,uint256,bytes).selector
|
||||
)
|
||||
);
|
||||
assert supplyAfter < supplyBefore => (
|
||||
supplyAfter == supplyBefore - 1 &&
|
||||
f.selector == sig:burn(uint256).selector
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: balanceOf can only change through mint, burn or transfers. balanceOf cannot change by more than 1. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule balanceChange(env e, address account) {
|
||||
requireInvariant balanceOfConsistency(account);
|
||||
require balanceLimited(account);
|
||||
|
||||
mathint balanceBefore = balanceOf(account);
|
||||
method f; helperSoundFnCall(e, f);
|
||||
mathint balanceAfter = balanceOf(account);
|
||||
|
||||
// balance can change by at most 1
|
||||
assert balanceBefore != balanceAfter => (
|
||||
balanceAfter == balanceBefore - 1 ||
|
||||
balanceAfter == balanceBefore + 1
|
||||
);
|
||||
|
||||
// only selected function can change balances
|
||||
assert balanceBefore != balanceAfter => (
|
||||
f.selector == sig:transferFrom(address,address,uint256).selector ||
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector ||
|
||||
f.selector == sig:mint(address,uint256).selector ||
|
||||
f.selector == sig:safeMint(address,uint256).selector ||
|
||||
f.selector == sig:safeMint(address,uint256,bytes).selector ||
|
||||
f.selector == sig:burn(uint256).selector
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: ownership can only change through mint, burn or transfers. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule ownershipChange(env e, uint256 tokenId) {
|
||||
require nonzerosender(e);
|
||||
requireInvariant zeroAddressHasNoApprovedOperator(e.msg.sender);
|
||||
|
||||
address ownerBefore = unsafeOwnerOf(tokenId);
|
||||
method f; helperSoundFnCall(e, f);
|
||||
address ownerAfter = unsafeOwnerOf(tokenId);
|
||||
|
||||
assert ownerBefore == 0 && ownerAfter != 0 => (
|
||||
f.selector == sig:mint(address,uint256).selector ||
|
||||
f.selector == sig:safeMint(address,uint256).selector ||
|
||||
f.selector == sig:safeMint(address,uint256,bytes).selector
|
||||
);
|
||||
|
||||
assert ownerBefore != 0 && ownerAfter == 0 => (
|
||||
f.selector == sig:burn(uint256).selector
|
||||
);
|
||||
|
||||
assert (ownerBefore != ownerAfter && ownerBefore != 0 && ownerAfter != 0) => (
|
||||
f.selector == sig:transferFrom(address,address,uint256).selector ||
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: token approval can only change through approve or transfers (implicitly). │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule approvalChange(env e, uint256 tokenId) {
|
||||
address approvalBefore = unsafeGetApproved(tokenId);
|
||||
method f; helperSoundFnCall(e, f);
|
||||
address approvalAfter = unsafeGetApproved(tokenId);
|
||||
|
||||
// approve can set any value, other functions reset
|
||||
assert approvalBefore != approvalAfter => (
|
||||
f.selector == sig:approve(address,uint256).selector ||
|
||||
(
|
||||
(
|
||||
f.selector == sig:transferFrom(address,address,uint256).selector ||
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector ||
|
||||
f.selector == sig:burn(uint256).selector
|
||||
) && approvalAfter == 0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: approval for all tokens can only change through isApprovedForAll. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule approvedForAllChange(env e, address owner, address spender) {
|
||||
bool approvedForAllBefore = isApprovedForAll(owner, spender);
|
||||
method f; helperSoundFnCall(e, f);
|
||||
bool approvedForAllAfter = isApprovedForAll(owner, spender);
|
||||
|
||||
assert approvedForAllBefore != approvedForAllAfter => f.selector == sig:setApprovalForAll(address,bool).selector;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: transferFrom behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule transferFrom(env e, address from, address to, uint256 tokenId) {
|
||||
require nonpayable(e);
|
||||
require authSanity(e);
|
||||
|
||||
address operator = e.msg.sender;
|
||||
uint256 otherTokenId;
|
||||
address otherAccount;
|
||||
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
require balanceLimited(to);
|
||||
|
||||
uint256 balanceOfFromBefore = balanceOf(from);
|
||||
uint256 balanceOfToBefore = balanceOf(to);
|
||||
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
|
||||
address ownerBefore = unsafeOwnerOf(tokenId);
|
||||
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
|
||||
address approvalBefore = unsafeGetApproved(tokenId);
|
||||
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
|
||||
|
||||
transferFrom@withrevert(e, from, to, tokenId);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
from == ownerBefore &&
|
||||
from != 0 &&
|
||||
to != 0 &&
|
||||
(operator == from || operator == approvalBefore || isApprovedForAll(ownerBefore, operator))
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => (
|
||||
to_mathint(balanceOf(from)) == balanceOfFromBefore - assert_uint256(from != to ? 1 : 0) &&
|
||||
to_mathint(balanceOf(to)) == balanceOfToBefore + assert_uint256(from != to ? 1 : 0) &&
|
||||
unsafeOwnerOf(tokenId) == to &&
|
||||
unsafeGetApproved(tokenId) == 0
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert balanceOf(otherAccount) != balanceOfOtherBefore => (otherAccount == from || otherAccount == to);
|
||||
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
|
||||
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: safeTransferFrom behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule safeTransferFrom(env e, method f, address from, address to, uint256 tokenId) filtered { f ->
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
|
||||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector
|
||||
} {
|
||||
require nonpayable(e);
|
||||
require authSanity(e);
|
||||
|
||||
address operator = e.msg.sender;
|
||||
uint256 otherTokenId;
|
||||
address otherAccount;
|
||||
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
require balanceLimited(to);
|
||||
|
||||
uint256 balanceOfFromBefore = balanceOf(from);
|
||||
uint256 balanceOfToBefore = balanceOf(to);
|
||||
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
|
||||
address ownerBefore = unsafeOwnerOf(tokenId);
|
||||
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
|
||||
address approvalBefore = unsafeGetApproved(tokenId);
|
||||
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
|
||||
|
||||
helperTransferWithRevert(e, f, from, to, tokenId);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> (
|
||||
from == ownerBefore &&
|
||||
from != 0 &&
|
||||
to != 0 &&
|
||||
(operator == from || operator == approvalBefore || isApprovedForAll(ownerBefore, operator))
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => (
|
||||
to_mathint(balanceOf(from)) == balanceOfFromBefore - assert_uint256(from != to ? 1: 0) &&
|
||||
to_mathint(balanceOf(to)) == balanceOfToBefore + assert_uint256(from != to ? 1: 0) &&
|
||||
unsafeOwnerOf(tokenId) == to &&
|
||||
unsafeGetApproved(tokenId) == 0
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert balanceOf(otherAccount) != balanceOfOtherBefore => (otherAccount == from || otherAccount == to);
|
||||
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
|
||||
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: mint behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule mint(env e, address to, uint256 tokenId) {
|
||||
require nonpayable(e);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
|
||||
uint256 otherTokenId;
|
||||
address otherAccount;
|
||||
|
||||
require balanceLimited(to);
|
||||
|
||||
mathint supplyBefore = _supply;
|
||||
uint256 balanceOfToBefore = balanceOf(to);
|
||||
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
|
||||
address ownerBefore = unsafeOwnerOf(tokenId);
|
||||
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
|
||||
|
||||
mint@withrevert(e, to, tokenId);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
ownerBefore == 0 &&
|
||||
to != 0
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => (
|
||||
_supply == supplyBefore + 1 &&
|
||||
to_mathint(balanceOf(to)) == balanceOfToBefore + 1 &&
|
||||
unsafeOwnerOf(tokenId) == to
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert balanceOf(otherAccount) != balanceOfOtherBefore => otherAccount == to;
|
||||
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: safeMint behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule safeMint(env e, method f, address to, uint256 tokenId) filtered { f ->
|
||||
f.selector == sig:safeMint(address,uint256).selector ||
|
||||
f.selector == sig:safeMint(address,uint256,bytes).selector
|
||||
} {
|
||||
require nonpayable(e);
|
||||
requireInvariant notMintedUnset(tokenId);
|
||||
|
||||
uint256 otherTokenId;
|
||||
address otherAccount;
|
||||
|
||||
require balanceLimited(to);
|
||||
|
||||
mathint supplyBefore = _supply;
|
||||
uint256 balanceOfToBefore = balanceOf(to);
|
||||
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
|
||||
address ownerBefore = unsafeOwnerOf(tokenId);
|
||||
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
|
||||
|
||||
helperMintWithRevert(e, f, to, tokenId);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> (
|
||||
ownerBefore == 0 &&
|
||||
to != 0
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => (
|
||||
_supply == supplyBefore + 1 &&
|
||||
to_mathint(balanceOf(to)) == balanceOfToBefore + 1 &&
|
||||
unsafeOwnerOf(tokenId) == to
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert balanceOf(otherAccount) != balanceOfOtherBefore => otherAccount == to;
|
||||
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: burn behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule burn(env e, uint256 tokenId) {
|
||||
require nonpayable(e);
|
||||
|
||||
address from = unsafeOwnerOf(tokenId);
|
||||
uint256 otherTokenId;
|
||||
address otherAccount;
|
||||
|
||||
requireInvariant ownerHasBalance(tokenId);
|
||||
|
||||
mathint supplyBefore = _supply;
|
||||
uint256 balanceOfFromBefore = balanceOf(from);
|
||||
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
|
||||
address ownerBefore = unsafeOwnerOf(tokenId);
|
||||
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
|
||||
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
|
||||
|
||||
burn@withrevert(e, tokenId);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
ownerBefore != 0
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => (
|
||||
_supply == supplyBefore - 1 &&
|
||||
to_mathint(balanceOf(from)) == balanceOfFromBefore - 1 &&
|
||||
unsafeOwnerOf(tokenId) == 0 &&
|
||||
unsafeGetApproved(tokenId) == 0
|
||||
);
|
||||
|
||||
// no side effect
|
||||
assert balanceOf(otherAccount) != balanceOfOtherBefore => otherAccount == from;
|
||||
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
|
||||
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: approve behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule approve(env e, address spender, uint256 tokenId) {
|
||||
require nonpayable(e);
|
||||
require authSanity(e);
|
||||
|
||||
address caller = e.msg.sender;
|
||||
address owner = unsafeOwnerOf(tokenId);
|
||||
uint256 otherTokenId;
|
||||
|
||||
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
|
||||
|
||||
approve@withrevert(e, spender, tokenId);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
owner != 0 &&
|
||||
(owner == caller || isApprovedForAll(owner, caller))
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => unsafeGetApproved(tokenId) == spender;
|
||||
|
||||
// no side effect
|
||||
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: setApprovalForAll behavior and side effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule setApprovalForAll(env e, address operator, bool approved) {
|
||||
require nonpayable(e);
|
||||
|
||||
address owner = e.msg.sender;
|
||||
address otherOwner;
|
||||
address otherOperator;
|
||||
|
||||
bool otherIsApprovedForAllBefore = isApprovedForAll(otherOwner, otherOperator);
|
||||
|
||||
setApprovalForAll@withrevert(e, operator, approved);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> operator != 0;
|
||||
|
||||
// effect
|
||||
assert success => isApprovedForAll(owner, operator) == approved;
|
||||
|
||||
// no side effect
|
||||
assert isApprovedForAll(otherOwner, otherOperator) != otherIsApprovedForAllBefore => (
|
||||
otherOwner == owner &&
|
||||
otherOperator == operator
|
||||
);
|
||||
}
|
||||
333
certora/specs/EnumerableMap.spec
Normal file
333
certora/specs/EnumerableMap.spec
Normal file
@ -0,0 +1,333 @@
|
||||
import "helpers/helpers.spec";
|
||||
|
||||
methods {
|
||||
// library
|
||||
function set(bytes32,bytes32) external returns (bool) envfree;
|
||||
function remove(bytes32) external returns (bool) envfree;
|
||||
function contains(bytes32) external returns (bool) envfree;
|
||||
function length() external returns (uint256) envfree;
|
||||
function key_at(uint256) external returns (bytes32) envfree;
|
||||
function value_at(uint256) external returns (bytes32) envfree;
|
||||
function tryGet_contains(bytes32) external returns (bool) envfree;
|
||||
function tryGet_value(bytes32) external returns (bytes32) envfree;
|
||||
function get(bytes32) external returns (bytes32) envfree;
|
||||
|
||||
// FV
|
||||
function _positionOf(bytes32) external returns (uint256) envfree;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Helpers │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
definition sanity() returns bool =
|
||||
length() < max_uint256;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: the value mapping is empty for keys that are not in the EnumerableMap. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant noValueIfNotContained(bytes32 key)
|
||||
!contains(key) => tryGet_value(key) == to_bytes32(0)
|
||||
{
|
||||
preserved set(bytes32 otherKey, bytes32 someValue) {
|
||||
require sanity();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: All indexed keys are contained │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant indexedContained(uint256 index)
|
||||
index < length() => contains(key_at(index))
|
||||
{
|
||||
preserved {
|
||||
requireInvariant consistencyIndex(index);
|
||||
requireInvariant consistencyIndex(require_uint256(length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: A value can only be stored at a single location │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant atUniqueness(uint256 index1, uint256 index2)
|
||||
index1 == index2 <=> key_at(index1) == key_at(index2)
|
||||
{
|
||||
preserved remove(bytes32 key) {
|
||||
requireInvariant atUniqueness(index1, require_uint256(length() - 1));
|
||||
requireInvariant atUniqueness(index2, require_uint256(length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: index <> value relationship is consistent │
|
||||
│ │
|
||||
│ Note that the two consistencyXxx invariants, put together, prove that at_ and _positionOf are inverse of one │
|
||||
│ another. This proves that we have a bijection between indices (the enumerability part) and keys (the entries that │
|
||||
│ are set and removed from the EnumerableMap). │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant consistencyIndex(uint256 index)
|
||||
index < length() => to_mathint(_positionOf(key_at(index))) == index + 1
|
||||
{
|
||||
preserved remove(bytes32 key) {
|
||||
requireInvariant consistencyIndex(require_uint256(length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
invariant consistencyKey(bytes32 key)
|
||||
contains(key) => (
|
||||
_positionOf(key) > 0 &&
|
||||
_positionOf(key) <= length() &&
|
||||
key_at(require_uint256(_positionOf(key) - 1)) == key
|
||||
)
|
||||
{
|
||||
preserved remove(bytes32 otherKey) {
|
||||
requireInvariant consistencyKey(otherKey);
|
||||
requireInvariant atUniqueness(
|
||||
require_uint256(_positionOf(key) - 1),
|
||||
require_uint256(_positionOf(otherKey) - 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: state only changes by setting or removing elements │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule stateChange(env e, bytes32 key) {
|
||||
require sanity();
|
||||
requireInvariant consistencyKey(key);
|
||||
|
||||
uint256 lengthBefore = length();
|
||||
bool containsBefore = contains(key);
|
||||
bytes32 valueBefore = tryGet_value(key);
|
||||
|
||||
method f;
|
||||
calldataarg args;
|
||||
f(e, args);
|
||||
|
||||
uint256 lengthAfter = length();
|
||||
bool containsAfter = contains(key);
|
||||
bytes32 valueAfter = tryGet_value(key);
|
||||
|
||||
assert lengthBefore != lengthAfter => (
|
||||
(f.selector == sig:set(bytes32,bytes32).selector && to_mathint(lengthAfter) == lengthBefore + 1) ||
|
||||
(f.selector == sig:remove(bytes32).selector && to_mathint(lengthAfter) == lengthBefore - 1)
|
||||
);
|
||||
|
||||
assert containsBefore != containsAfter => (
|
||||
(f.selector == sig:set(bytes32,bytes32).selector && containsAfter) ||
|
||||
(f.selector == sig:remove(bytes32).selector && !containsAfter)
|
||||
);
|
||||
|
||||
assert valueBefore != valueAfter => (
|
||||
(f.selector == sig:set(bytes32,bytes32).selector && containsAfter) ||
|
||||
(f.selector == sig:remove(bytes32).selector && !containsAfter && valueAfter == to_bytes32(0))
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: check liveness of view functions. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule liveness_1(bytes32 key) {
|
||||
requireInvariant consistencyKey(key);
|
||||
|
||||
// contains never revert
|
||||
bool contains = contains@withrevert(key);
|
||||
assert !lastReverted;
|
||||
|
||||
// tryGet never reverts (key)
|
||||
tryGet_contains@withrevert(key);
|
||||
assert !lastReverted;
|
||||
|
||||
// tryGet never reverts (value)
|
||||
tryGet_value@withrevert(key);
|
||||
assert !lastReverted;
|
||||
|
||||
// get reverts iff the key is not in the map
|
||||
get@withrevert(key);
|
||||
assert !lastReverted <=> contains;
|
||||
}
|
||||
|
||||
rule liveness_2(uint256 index) {
|
||||
requireInvariant consistencyIndex(index);
|
||||
|
||||
// length never revert
|
||||
uint256 length = length@withrevert();
|
||||
assert !lastReverted;
|
||||
|
||||
// key_at reverts iff the index is out of bound
|
||||
key_at@withrevert(index);
|
||||
assert !lastReverted <=> index < length;
|
||||
|
||||
// value_at reverts iff the index is out of bound
|
||||
value_at@withrevert(index);
|
||||
assert !lastReverted <=> index < length;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: get and tryGet return the expected values. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule getAndTryGet(bytes32 key) {
|
||||
requireInvariant noValueIfNotContained(key);
|
||||
|
||||
bool contained = contains(key);
|
||||
bool tryContained = tryGet_contains(key);
|
||||
bytes32 tryValue = tryGet_value(key);
|
||||
bytes32 value = get@withrevert(key); // revert is not contained
|
||||
|
||||
assert contained == tryContained;
|
||||
assert contained => tryValue == value;
|
||||
assert !contained => tryValue == to_bytes32(0);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: set key-value in EnumerableMap │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule set(bytes32 key, bytes32 value, bytes32 otherKey) {
|
||||
require sanity();
|
||||
|
||||
uint256 lengthBefore = length();
|
||||
bool containsBefore = contains(key);
|
||||
bool containsOtherBefore = contains(otherKey);
|
||||
bytes32 otherValueBefore = tryGet_value(otherKey);
|
||||
|
||||
bool added = set@withrevert(key, value);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success && contains(key) && get(key) == value,
|
||||
"liveness & immediate effect";
|
||||
|
||||
assert added <=> !containsBefore,
|
||||
"return value: added iff not contained";
|
||||
|
||||
assert to_mathint(length()) == lengthBefore + to_mathint(added ? 1 : 0),
|
||||
"effect: length increases iff added";
|
||||
|
||||
assert added => (key_at(lengthBefore) == key && value_at(lengthBefore) == value),
|
||||
"effect: add at the end";
|
||||
|
||||
assert containsOtherBefore != contains(otherKey) => (added && key == otherKey),
|
||||
"side effect: other keys are not affected";
|
||||
|
||||
assert otherValueBefore != tryGet_value(otherKey) => key == otherKey,
|
||||
"side effect: values attached to other keys are not affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: remove key from EnumerableMap │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule remove(bytes32 key, bytes32 otherKey) {
|
||||
requireInvariant consistencyKey(key);
|
||||
requireInvariant consistencyKey(otherKey);
|
||||
|
||||
uint256 lengthBefore = length();
|
||||
bool containsBefore = contains(key);
|
||||
bool containsOtherBefore = contains(otherKey);
|
||||
bytes32 otherValueBefore = tryGet_value(otherKey);
|
||||
|
||||
bool removed = remove@withrevert(key);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success && !contains(key),
|
||||
"liveness & immediate effect";
|
||||
|
||||
assert removed <=> containsBefore,
|
||||
"return value: removed iff contained";
|
||||
|
||||
assert to_mathint(length()) == lengthBefore - to_mathint(removed ? 1 : 0),
|
||||
"effect: length decreases iff removed";
|
||||
|
||||
assert containsOtherBefore != contains(otherKey) => (removed && key == otherKey),
|
||||
"side effect: other keys are not affected";
|
||||
|
||||
assert otherValueBefore != tryGet_value(otherKey) => key == otherKey,
|
||||
"side effect: values attached to other keys are not affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: when adding a new key, the other keys remain in set, at the same index. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule setEnumerability(bytes32 key, bytes32 value, uint256 index) {
|
||||
require sanity();
|
||||
|
||||
bytes32 atKeyBefore = key_at(index);
|
||||
bytes32 atValueBefore = value_at(index);
|
||||
|
||||
set(key, value);
|
||||
|
||||
bytes32 atKeyAfter = key_at@withrevert(index);
|
||||
assert !lastReverted;
|
||||
|
||||
bytes32 atValueAfter = value_at@withrevert(index);
|
||||
assert !lastReverted;
|
||||
|
||||
assert atKeyAfter == atKeyBefore;
|
||||
assert atValueAfter != atValueBefore => (
|
||||
key == atKeyBefore &&
|
||||
value == atValueAfter
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: when removing a existing key, the other keys remain in set, at the same index (except for the last one). │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule removeEnumerability(bytes32 key, uint256 index) {
|
||||
uint256 last = require_uint256(length() - 1);
|
||||
|
||||
requireInvariant consistencyKey(key);
|
||||
requireInvariant consistencyIndex(index);
|
||||
requireInvariant consistencyIndex(last);
|
||||
|
||||
bytes32 atKeyBefore = key_at(index);
|
||||
bytes32 atValueBefore = value_at(index);
|
||||
bytes32 lastKeyBefore = key_at(last);
|
||||
bytes32 lastValueBefore = value_at(last);
|
||||
|
||||
remove(key);
|
||||
|
||||
// can't read last value & keys (length decreased)
|
||||
bytes32 atKeyAfter = key_at@withrevert(index);
|
||||
assert lastReverted <=> index == last;
|
||||
|
||||
bytes32 atValueAfter = value_at@withrevert(index);
|
||||
assert lastReverted <=> index == last;
|
||||
|
||||
// One value that is allowed to change is if previous value was removed,
|
||||
// in that case the last value before took its place.
|
||||
assert (
|
||||
index != last &&
|
||||
atKeyBefore != atKeyAfter
|
||||
) => (
|
||||
atKeyBefore == key &&
|
||||
atKeyAfter == lastKeyBefore
|
||||
);
|
||||
|
||||
assert (
|
||||
index != last &&
|
||||
atValueBefore != atValueAfter
|
||||
) => (
|
||||
atValueAfter == lastValueBefore
|
||||
);
|
||||
}
|
||||
246
certora/specs/EnumerableSet.spec
Normal file
246
certora/specs/EnumerableSet.spec
Normal file
@ -0,0 +1,246 @@
|
||||
import "helpers/helpers.spec";
|
||||
|
||||
methods {
|
||||
// library
|
||||
function add(bytes32) external returns (bool) envfree;
|
||||
function remove(bytes32) external returns (bool) envfree;
|
||||
function contains(bytes32) external returns (bool) envfree;
|
||||
function length() external returns (uint256) envfree;
|
||||
function at_(uint256) external returns (bytes32) envfree;
|
||||
|
||||
// FV
|
||||
function _positionOf(bytes32) external returns (uint256) envfree;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Helpers │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
definition sanity() returns bool =
|
||||
length() < max_uint256;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: All indexed keys are contained │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant indexedContained(uint256 index)
|
||||
index < length() => contains(at_(index))
|
||||
{
|
||||
preserved {
|
||||
requireInvariant consistencyIndex(index);
|
||||
requireInvariant consistencyIndex(require_uint256(length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: A value can only be stored at a single location │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant atUniqueness(uint256 index1, uint256 index2)
|
||||
index1 == index2 <=> at_(index1) == at_(index2)
|
||||
{
|
||||
preserved remove(bytes32 key) {
|
||||
requireInvariant atUniqueness(index1, require_uint256(length() - 1));
|
||||
requireInvariant atUniqueness(index2, require_uint256(length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: index <> key relationship is consistent │
|
||||
│ │
|
||||
│ Note that the two consistencyXxx invariants, put together, prove that at_ and _positionOf are inverse of one │
|
||||
│ another. This proves that we have a bijection between indices (the enumerability part) and keys (the entries that │
|
||||
│ are added and removed from the EnumerableSet). │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant consistencyIndex(uint256 index)
|
||||
index < length() => _positionOf(at_(index)) == require_uint256(index + 1)
|
||||
{
|
||||
preserved remove(bytes32 key) {
|
||||
requireInvariant consistencyIndex(require_uint256(length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
invariant consistencyKey(bytes32 key)
|
||||
contains(key) => (
|
||||
_positionOf(key) > 0 &&
|
||||
_positionOf(key) <= length() &&
|
||||
at_(require_uint256(_positionOf(key) - 1)) == key
|
||||
)
|
||||
{
|
||||
preserved remove(bytes32 otherKey) {
|
||||
requireInvariant consistencyKey(otherKey);
|
||||
requireInvariant atUniqueness(
|
||||
require_uint256(_positionOf(key) - 1),
|
||||
require_uint256(_positionOf(otherKey) - 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: state only changes by adding or removing elements │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule stateChange(env e, bytes32 key) {
|
||||
require sanity();
|
||||
requireInvariant consistencyKey(key);
|
||||
|
||||
uint256 lengthBefore = length();
|
||||
bool containsBefore = contains(key);
|
||||
|
||||
method f;
|
||||
calldataarg args;
|
||||
f(e, args);
|
||||
|
||||
uint256 lengthAfter = length();
|
||||
bool containsAfter = contains(key);
|
||||
|
||||
assert lengthBefore != lengthAfter => (
|
||||
(f.selector == sig:add(bytes32).selector && lengthAfter == require_uint256(lengthBefore + 1)) ||
|
||||
(f.selector == sig:remove(bytes32).selector && lengthAfter == require_uint256(lengthBefore - 1))
|
||||
);
|
||||
|
||||
assert containsBefore != containsAfter => (
|
||||
(f.selector == sig:add(bytes32).selector && containsAfter) ||
|
||||
(f.selector == sig:remove(bytes32).selector && containsBefore)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: check liveness of view functions. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule liveness_1(bytes32 key) {
|
||||
requireInvariant consistencyKey(key);
|
||||
|
||||
// contains never revert
|
||||
contains@withrevert(key);
|
||||
assert !lastReverted;
|
||||
}
|
||||
|
||||
rule liveness_2(uint256 index) {
|
||||
requireInvariant consistencyIndex(index);
|
||||
|
||||
// length never revert
|
||||
uint256 length = length@withrevert();
|
||||
assert !lastReverted;
|
||||
|
||||
// at reverts iff the index is out of bound
|
||||
at_@withrevert(index);
|
||||
assert !lastReverted <=> index < length;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: add key to EnumerableSet if not already contained │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule add(bytes32 key, bytes32 otherKey) {
|
||||
require sanity();
|
||||
|
||||
uint256 lengthBefore = length();
|
||||
bool containsBefore = contains(key);
|
||||
bool containsOtherBefore = contains(otherKey);
|
||||
|
||||
bool added = add@withrevert(key);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success && contains(key),
|
||||
"liveness & immediate effect";
|
||||
|
||||
assert added <=> !containsBefore,
|
||||
"return value: added iff not contained";
|
||||
|
||||
assert length() == require_uint256(lengthBefore + to_mathint(added ? 1 : 0)),
|
||||
"effect: length increases iff added";
|
||||
|
||||
assert added => at_(lengthBefore) == key,
|
||||
"effect: add at the end";
|
||||
|
||||
assert containsOtherBefore != contains(otherKey) => (added && key == otherKey),
|
||||
"side effect: other keys are not affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: remove key from EnumerableSet if already contained │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule remove(bytes32 key, bytes32 otherKey) {
|
||||
requireInvariant consistencyKey(key);
|
||||
requireInvariant consistencyKey(otherKey);
|
||||
|
||||
uint256 lengthBefore = length();
|
||||
bool containsBefore = contains(key);
|
||||
bool containsOtherBefore = contains(otherKey);
|
||||
|
||||
bool removed = remove@withrevert(key);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success && !contains(key),
|
||||
"liveness & immediate effect";
|
||||
|
||||
assert removed <=> containsBefore,
|
||||
"return value: removed iff contained";
|
||||
|
||||
assert length() == require_uint256(lengthBefore - to_mathint(removed ? 1 : 0)),
|
||||
"effect: length decreases iff removed";
|
||||
|
||||
assert containsOtherBefore != contains(otherKey) => (removed && key == otherKey),
|
||||
"side effect: other keys are not affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: when adding a new key, the other keys remain in set, at the same index. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule addEnumerability(bytes32 key, uint256 index) {
|
||||
require sanity();
|
||||
|
||||
bytes32 atBefore = at_(index);
|
||||
add(key);
|
||||
bytes32 atAfter = at_@withrevert(index);
|
||||
bool atAfterSuccess = !lastReverted;
|
||||
|
||||
assert atAfterSuccess;
|
||||
assert atBefore == atAfter;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: when removing a existing key, the other keys remain in set, at the same index (except for the last one). │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule removeEnumerability(bytes32 key, uint256 index) {
|
||||
uint256 last = require_uint256(length() - 1);
|
||||
|
||||
requireInvariant consistencyKey(key);
|
||||
requireInvariant consistencyIndex(index);
|
||||
requireInvariant consistencyIndex(last);
|
||||
|
||||
bytes32 atBefore = at_(index);
|
||||
bytes32 lastBefore = at_(last);
|
||||
|
||||
remove(key);
|
||||
|
||||
// can't read last value (length decreased)
|
||||
bytes32 atAfter = at_@withrevert(index);
|
||||
assert lastReverted <=> index == last;
|
||||
|
||||
// One value that is allowed to change is if previous value was removed,
|
||||
// in that case the last value before took its place.
|
||||
assert (
|
||||
index != last &&
|
||||
atBefore != atAfter
|
||||
) => (
|
||||
atBefore == key &&
|
||||
atAfter == lastBefore
|
||||
);
|
||||
}
|
||||
165
certora/specs/Initializable.spec
Normal file
165
certora/specs/Initializable.spec
Normal file
@ -0,0 +1,165 @@
|
||||
import "helpers/helpers.spec";
|
||||
|
||||
methods {
|
||||
// initialize, reinitialize, disable
|
||||
function initialize() external envfree;
|
||||
function reinitialize(uint64) external envfree;
|
||||
function disable() external envfree;
|
||||
|
||||
function nested_init_init() external envfree;
|
||||
function nested_init_reinit(uint64) external envfree;
|
||||
function nested_reinit_init(uint64) external envfree;
|
||||
function nested_reinit_reinit(uint64,uint64) external envfree;
|
||||
|
||||
// view
|
||||
function version() external returns uint64 envfree;
|
||||
function initializing() external returns bool envfree;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Definitions │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
definition isUninitialized() returns bool = version() == 0;
|
||||
definition isInitialized() returns bool = version() > 0;
|
||||
definition isDisabled() returns bool = version() == max_uint64;
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: A contract must only ever be in an initializing state while in the middle of a transaction execution. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant notInitializing()
|
||||
!initializing();
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: The version cannot decrease & disable state is irrevocable. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule increasingVersion(env e) {
|
||||
uint64 versionBefore = version();
|
||||
bool disabledBefore = isDisabled();
|
||||
|
||||
method f; calldataarg args;
|
||||
f(e, args);
|
||||
|
||||
assert versionBefore <= version(), "_initialized must only increase";
|
||||
assert disabledBefore => isDisabled(), "a disabled initializer must stay disabled";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: Cannot initialize a contract that is already initialized. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule cannotInitializeTwice() {
|
||||
require isInitialized();
|
||||
|
||||
initialize@withrevert();
|
||||
|
||||
assert lastReverted, "contract must only be initialized once";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: Cannot initialize once disabled. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule cannotInitializeOnceDisabled() {
|
||||
require isDisabled();
|
||||
|
||||
initialize@withrevert();
|
||||
|
||||
assert lastReverted, "contract is disabled";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: Cannot reinitialize once disabled. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule cannotReinitializeOnceDisabled() {
|
||||
require isDisabled();
|
||||
|
||||
uint64 n;
|
||||
reinitialize@withrevert(n);
|
||||
|
||||
assert lastReverted, "contract is disabled";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: Cannot nest initializers (after construction). │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule cannotNestInitializers_init_init() {
|
||||
nested_init_init@withrevert();
|
||||
assert lastReverted, "nested initializers";
|
||||
}
|
||||
|
||||
rule cannotNestInitializers_init_reinit(uint64 m) {
|
||||
nested_init_reinit@withrevert(m);
|
||||
assert lastReverted, "nested initializers";
|
||||
}
|
||||
|
||||
rule cannotNestInitializers_reinit_init(uint64 n) {
|
||||
nested_reinit_init@withrevert(n);
|
||||
assert lastReverted, "nested initializers";
|
||||
}
|
||||
|
||||
rule cannotNestInitializers_reinit_reinit(uint64 n, uint64 m) {
|
||||
nested_reinit_reinit@withrevert(n, m);
|
||||
assert lastReverted, "nested initializers";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: Initialize correctly sets the version. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule initializeEffects() {
|
||||
requireInvariant notInitializing();
|
||||
|
||||
bool isUninitializedBefore = isUninitialized();
|
||||
|
||||
initialize@withrevert();
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> isUninitializedBefore, "can only initialize uninitialized contracts";
|
||||
assert success => version() == 1, "initialize must set version() to 1";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: Reinitialize correctly sets the version. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule reinitializeEffects() {
|
||||
requireInvariant notInitializing();
|
||||
|
||||
uint64 versionBefore = version();
|
||||
|
||||
uint64 n;
|
||||
reinitialize@withrevert(n);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> versionBefore < n, "can only reinitialize to a latter versions";
|
||||
assert success => version() == n, "reinitialize must set version() to n";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: Can disable. │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule disableEffect() {
|
||||
requireInvariant notInitializing();
|
||||
|
||||
disable@withrevert();
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success, "call to _disableInitializers failed";
|
||||
assert isDisabled(), "disable state not set";
|
||||
}
|
||||
92
certora/specs/Nonces.spec
Normal file
92
certora/specs/Nonces.spec
Normal file
@ -0,0 +1,92 @@
|
||||
import "helpers/helpers.spec";
|
||||
|
||||
methods {
|
||||
function nonces(address) external returns (uint256) envfree;
|
||||
function useNonce(address) external returns (uint256) envfree;
|
||||
function useCheckedNonce(address,uint256) external envfree;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Helpers │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
function nonceSanity(address account) returns bool {
|
||||
return nonces(account) < max_uint256;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: useNonce uses nonce │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule useNonce(address account) {
|
||||
require nonceSanity(account);
|
||||
|
||||
address other;
|
||||
|
||||
mathint nonceBefore = nonces(account);
|
||||
mathint otherNonceBefore = nonces(other);
|
||||
|
||||
mathint nonceUsed = useNonce@withrevert(account);
|
||||
bool success = !lastReverted;
|
||||
|
||||
mathint nonceAfter = nonces(account);
|
||||
mathint otherNonceAfter = nonces(other);
|
||||
|
||||
// liveness
|
||||
assert success, "doesn't revert";
|
||||
|
||||
// effect
|
||||
assert nonceAfter == nonceBefore + 1 && nonceBefore == nonceUsed, "nonce is used";
|
||||
|
||||
// no side effect
|
||||
assert otherNonceBefore != otherNonceAfter => other == account, "no other nonce is used";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: useCheckedNonce uses only the current nonce │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule useCheckedNonce(address account, uint256 currentNonce) {
|
||||
require nonceSanity(account);
|
||||
|
||||
address other;
|
||||
|
||||
mathint nonceBefore = nonces(account);
|
||||
mathint otherNonceBefore = nonces(other);
|
||||
|
||||
useCheckedNonce@withrevert(account, currentNonce);
|
||||
bool success = !lastReverted;
|
||||
|
||||
mathint nonceAfter = nonces(account);
|
||||
mathint otherNonceAfter = nonces(other);
|
||||
|
||||
// liveness
|
||||
assert success <=> to_mathint(currentNonce) == nonceBefore, "works iff current nonce is correct";
|
||||
|
||||
// effect
|
||||
assert success => nonceAfter == nonceBefore + 1, "nonce is used";
|
||||
|
||||
// no side effect
|
||||
assert otherNonceBefore != otherNonceAfter => other == account, "no other nonce is used";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: nonce only increments │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule nonceOnlyIncrements(address account) {
|
||||
require nonceSanity(account);
|
||||
|
||||
mathint nonceBefore = nonces(account);
|
||||
|
||||
env e; method f; calldataarg args;
|
||||
f(e, args);
|
||||
|
||||
mathint nonceAfter = nonces(account);
|
||||
|
||||
assert nonceAfter == nonceBefore || nonceAfter == nonceBefore + 1, "nonce only increments";
|
||||
}
|
||||
77
certora/specs/Ownable.spec
Normal file
77
certora/specs/Ownable.spec
Normal file
@ -0,0 +1,77 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IOwnable.spec";
|
||||
|
||||
methods {
|
||||
function restricted() external;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: transferOwnership changes ownership │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule transferOwnership(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address newOwner;
|
||||
address current = owner();
|
||||
|
||||
transferOwnership@withrevert(e, newOwner);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> (e.msg.sender == current && newOwner != 0), "unauthorized caller or invalid arg";
|
||||
assert success => owner() == newOwner, "current owner changed";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: renounceOwnership removes the owner │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule renounceOwnership(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address current = owner();
|
||||
|
||||
renounceOwnership@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> e.msg.sender == current, "unauthorized caller";
|
||||
assert success => owner() == 0, "owner not cleared";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Access control: only current owner can call restricted functions │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyCurrentOwnerCanCallOnlyOwner(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address current = owner();
|
||||
|
||||
calldataarg args;
|
||||
restricted@withrevert(e, args);
|
||||
|
||||
assert !lastReverted <=> e.msg.sender == current, "access control failed";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: ownership can only change in specific ways │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyOwnerOrPendingOwnerCanChangeOwnership(env e) {
|
||||
address oldCurrent = owner();
|
||||
|
||||
method f; calldataarg args;
|
||||
f(e, args);
|
||||
|
||||
address newCurrent = owner();
|
||||
|
||||
// If owner changes, must be either transferOwnership or renounceOwnership
|
||||
assert oldCurrent != newCurrent => (
|
||||
(e.msg.sender == oldCurrent && newCurrent != 0 && f.selector == sig:transferOwnership(address).selector) ||
|
||||
(e.msg.sender == oldCurrent && newCurrent == 0 && f.selector == sig:renounceOwnership().selector)
|
||||
);
|
||||
}
|
||||
108
certora/specs/Ownable2Step.spec
Normal file
108
certora/specs/Ownable2Step.spec
Normal file
@ -0,0 +1,108 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IOwnable2Step.spec";
|
||||
|
||||
methods {
|
||||
function restricted() external;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: transferOwnership sets the pending owner │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule transferOwnership(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address newOwner;
|
||||
address current = owner();
|
||||
|
||||
transferOwnership@withrevert(e, newOwner);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> e.msg.sender == current, "unauthorized caller";
|
||||
assert success => pendingOwner() == newOwner, "pending owner not set";
|
||||
assert success => owner() == current, "current owner changed";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: renounceOwnership removes the owner and the pendingOwner │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule renounceOwnership(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address current = owner();
|
||||
|
||||
renounceOwnership@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> e.msg.sender == current, "unauthorized caller";
|
||||
assert success => pendingOwner() == 0, "pending owner not cleared";
|
||||
assert success => owner() == 0, "owner not cleared";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: acceptOwnership changes owner and reset pending owner │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule acceptOwnership(env e) {
|
||||
|
||||
require nonpayable(e);
|
||||
|
||||
address current = owner();
|
||||
address pending = pendingOwner();
|
||||
|
||||
acceptOwnership@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
assert success <=> e.msg.sender == pending, "unauthorized caller";
|
||||
assert success => pendingOwner() == 0, "pending owner not cleared";
|
||||
assert success => owner() == pending, "owner not transferred";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Access control: only current owner can call restricted functions │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule onlyCurrentOwnerCanCallOnlyOwner(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
address current = owner();
|
||||
|
||||
calldataarg args;
|
||||
restricted@withrevert(e, args);
|
||||
|
||||
assert !lastReverted <=> e.msg.sender == current, "access control failed";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: ownership and pending ownership can only change in specific ways │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule ownerOrPendingOwnerChange(env e, method f) {
|
||||
address oldCurrent = owner();
|
||||
address oldPending = pendingOwner();
|
||||
|
||||
calldataarg args;
|
||||
f(e, args);
|
||||
|
||||
address newCurrent = owner();
|
||||
address newPending = pendingOwner();
|
||||
|
||||
// If owner changes, must be either acceptOwnership or renounceOwnership
|
||||
assert oldCurrent != newCurrent => (
|
||||
(e.msg.sender == oldPending && newCurrent == oldPending && newPending == 0 && f.selector == sig:acceptOwnership().selector) ||
|
||||
(e.msg.sender == oldCurrent && newCurrent == 0 && newPending == 0 && f.selector == sig:renounceOwnership().selector)
|
||||
);
|
||||
|
||||
// If pending changes, must be either acceptance or reset
|
||||
assert oldPending != newPending => (
|
||||
(e.msg.sender == oldCurrent && newCurrent == oldCurrent && f.selector == sig:transferOwnership(address).selector) ||
|
||||
(e.msg.sender == oldPending && newCurrent == oldPending && newPending == 0 && f.selector == sig:acceptOwnership().selector) ||
|
||||
(e.msg.sender == oldCurrent && newCurrent == 0 && newPending == 0 && f.selector == sig:renounceOwnership().selector)
|
||||
);
|
||||
}
|
||||
96
certora/specs/Pausable.spec
Normal file
96
certora/specs/Pausable.spec
Normal file
@ -0,0 +1,96 @@
|
||||
import "helpers/helpers.spec";
|
||||
|
||||
methods {
|
||||
function paused() external returns (bool) envfree;
|
||||
function pause() external;
|
||||
function unpause() external;
|
||||
function onlyWhenPaused() external;
|
||||
function onlyWhenNotPaused() external;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: _pause pauses the contract │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule pause(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
bool pausedBefore = paused();
|
||||
|
||||
pause@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
bool pausedAfter = paused();
|
||||
|
||||
// liveness
|
||||
assert success <=> !pausedBefore, "works if and only if the contract was not paused before";
|
||||
|
||||
// effect
|
||||
assert success => pausedAfter, "contract must be paused after a successful call";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: _unpause unpauses the contract │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule unpause(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
bool pausedBefore = paused();
|
||||
|
||||
unpause@withrevert(e);
|
||||
bool success = !lastReverted;
|
||||
|
||||
bool pausedAfter = paused();
|
||||
|
||||
// liveness
|
||||
assert success <=> pausedBefore, "works if and only if the contract was paused before";
|
||||
|
||||
// effect
|
||||
assert success => !pausedAfter, "contract must be unpaused after a successful call";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: whenPaused modifier can only be called if the contract is paused │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule whenPaused(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
onlyWhenPaused@withrevert(e);
|
||||
assert !lastReverted <=> paused(), "works if and only if the contract is paused";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Function correctness: whenNotPaused modifier can only be called if the contract is not paused │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule whenNotPaused(env e) {
|
||||
require nonpayable(e);
|
||||
|
||||
onlyWhenNotPaused@withrevert(e);
|
||||
assert !lastReverted <=> !paused(), "works if and only if the contract is not paused";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rules: only _pause and _unpause can change paused status │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule noPauseChange(env e) {
|
||||
method f;
|
||||
calldataarg args;
|
||||
|
||||
bool pausedBefore = paused();
|
||||
f(e, args);
|
||||
bool pausedAfter = paused();
|
||||
|
||||
assert pausedBefore != pausedAfter => (
|
||||
(!pausedAfter && f.selector == sig:unpause().selector) ||
|
||||
(pausedAfter && f.selector == sig:pause().selector)
|
||||
), "contract's paused status can only be changed by _pause() or _unpause()";
|
||||
}
|
||||
274
certora/specs/TimelockController.spec
Normal file
274
certora/specs/TimelockController.spec
Normal file
@ -0,0 +1,274 @@
|
||||
import "helpers/helpers.spec";
|
||||
import "methods/IAccessControl.spec";
|
||||
|
||||
methods {
|
||||
function PROPOSER_ROLE() external returns (bytes32) envfree;
|
||||
function EXECUTOR_ROLE() external returns (bytes32) envfree;
|
||||
function CANCELLER_ROLE() external returns (bytes32) envfree;
|
||||
function isOperation(bytes32) external returns (bool);
|
||||
function isOperationPending(bytes32) external returns (bool);
|
||||
function isOperationReady(bytes32) external returns (bool);
|
||||
function isOperationDone(bytes32) external returns (bool);
|
||||
function getTimestamp(bytes32) external returns (uint256) envfree;
|
||||
function getMinDelay() external returns (uint256) envfree;
|
||||
|
||||
function hashOperation(address, uint256, bytes, bytes32, bytes32) external returns(bytes32) envfree;
|
||||
function hashOperationBatch(address[], uint256[], bytes[], bytes32, bytes32) external returns(bytes32) envfree;
|
||||
|
||||
function schedule(address, uint256, bytes, bytes32, bytes32, uint256) external;
|
||||
function scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256) external;
|
||||
function execute(address, uint256, bytes, bytes32, bytes32) external;
|
||||
function executeBatch(address[], uint256[], bytes[], bytes32, bytes32) external;
|
||||
function cancel(bytes32) external;
|
||||
|
||||
function updateDelay(uint256) external;
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Helpers │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
// Uniformly handle scheduling of batched and non-batched operations.
|
||||
function helperScheduleWithRevert(env e, method f, bytes32 id, uint256 delay) {
|
||||
if (f.selector == sig:schedule(address, uint256, bytes, bytes32, bytes32, uint256).selector) {
|
||||
address target; uint256 value; bytes data; bytes32 predecessor; bytes32 salt;
|
||||
require hashOperation(target, value, data, predecessor, salt) == id; // Correlation
|
||||
schedule@withrevert(e, target, value, data, predecessor, salt, delay);
|
||||
} else if (f.selector == sig:scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256).selector) {
|
||||
address[] targets; uint256[] values; bytes[] payloads; bytes32 predecessor; bytes32 salt;
|
||||
require hashOperationBatch(targets, values, payloads, predecessor, salt) == id; // Correlation
|
||||
scheduleBatch@withrevert(e, targets, values, payloads, predecessor, salt, delay);
|
||||
} else {
|
||||
calldataarg args;
|
||||
f@withrevert(e, args);
|
||||
}
|
||||
}
|
||||
|
||||
// Uniformly handle execution of batched and non-batched operations.
|
||||
function helperExecuteWithRevert(env e, method f, bytes32 id, bytes32 predecessor) {
|
||||
if (f.selector == sig:execute(address, uint256, bytes, bytes32, bytes32).selector) {
|
||||
address target; uint256 value; bytes data; bytes32 salt;
|
||||
require hashOperation(target, value, data, predecessor, salt) == id; // Correlation
|
||||
execute@withrevert(e, target, value, data, predecessor, salt);
|
||||
} else if (f.selector == sig:executeBatch(address[], uint256[], bytes[], bytes32, bytes32).selector) {
|
||||
address[] targets; uint256[] values; bytes[] payloads; bytes32 salt;
|
||||
require hashOperationBatch(targets, values, payloads, predecessor, salt) == id; // Correlation
|
||||
executeBatch@withrevert(e, targets, values, payloads, predecessor, salt);
|
||||
} else {
|
||||
calldataarg args;
|
||||
f@withrevert(e, args);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Definitions │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
definition DONE_TIMESTAMP() returns uint256 = 1;
|
||||
definition UNSET() returns uint8 = 0x1;
|
||||
definition PENDING() returns uint8 = 0x2;
|
||||
definition DONE() returns uint8 = 0x4;
|
||||
|
||||
definition isUnset(env e, bytes32 id) returns bool = !isOperation(e, id);
|
||||
definition isPending(env e, bytes32 id) returns bool = isOperationPending(e, id);
|
||||
definition isDone(env e, bytes32 id) returns bool = isOperationDone(e, id);
|
||||
definition state(env e, bytes32 id) returns uint8 = (isUnset(e, id) ? UNSET() : 0) | (isPending(e, id) ? PENDING() : 0) | (isDone(e, id) ? DONE() : 0);
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariants: consistency of accessors │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant isOperationCheck(env e, bytes32 id)
|
||||
isOperation(e, id) <=> getTimestamp(id) > 0
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
invariant isOperationPendingCheck(env e, bytes32 id)
|
||||
isOperationPending(e, id) <=> getTimestamp(id) > DONE_TIMESTAMP()
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
invariant isOperationDoneCheck(env e, bytes32 id)
|
||||
isOperationDone(e, id) <=> getTimestamp(id) == DONE_TIMESTAMP()
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
invariant isOperationReadyCheck(env e, bytes32 id)
|
||||
isOperationReady(e, id) <=> (isOperationPending(e, id) && getTimestamp(id) <= e.block.timestamp)
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Invariant: a proposal id is either unset, pending or done │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
invariant stateConsistency(bytes32 id, env e)
|
||||
// Check states are mutually exclusive
|
||||
(isUnset(e, id) <=> (!isPending(e, id) && !isDone(e, id) )) &&
|
||||
(isPending(e, id) <=> (!isUnset(e, id) && !isDone(e, id) )) &&
|
||||
(isDone(e, id) <=> (!isUnset(e, id) && !isPending(e, id))) &&
|
||||
// Check that the state helper behaves as expected:
|
||||
(isUnset(e, id) <=> state(e, id) == UNSET() ) &&
|
||||
(isPending(e, id) <=> state(e, id) == PENDING() ) &&
|
||||
(isDone(e, id) <=> state(e, id) == DONE() ) &&
|
||||
// Check substate
|
||||
isOperationReady(e, id) => isPending(e, id)
|
||||
filtered { f -> !f.isView }
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: state transition rules │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule stateTransition(bytes32 id, env e, method f, calldataarg args) {
|
||||
require e.block.timestamp > 1; // Sanity
|
||||
|
||||
uint8 stateBefore = state(e, id);
|
||||
f(e, args);
|
||||
uint8 stateAfter = state(e, id);
|
||||
|
||||
// Cannot jump from UNSET to DONE
|
||||
assert stateBefore == UNSET() => stateAfter != DONE();
|
||||
|
||||
// UNSET → PENDING: schedule or scheduleBatch
|
||||
assert stateBefore == UNSET() && stateAfter == PENDING() => (
|
||||
f.selector == sig:schedule(address, uint256, bytes, bytes32, bytes32, uint256).selector ||
|
||||
f.selector == sig:scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256).selector
|
||||
);
|
||||
|
||||
// PENDING → UNSET: cancel
|
||||
assert stateBefore == PENDING() && stateAfter == UNSET() => (
|
||||
f.selector == sig:cancel(bytes32).selector
|
||||
);
|
||||
|
||||
// PENDING → DONE: execute or executeBatch
|
||||
assert stateBefore == PENDING() && stateAfter == DONE() => (
|
||||
f.selector == sig:execute(address, uint256, bytes, bytes32, bytes32).selector ||
|
||||
f.selector == sig:executeBatch(address[], uint256[], bytes[], bytes32, bytes32).selector
|
||||
);
|
||||
|
||||
// DONE is final
|
||||
assert stateBefore == DONE() => stateAfter == DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: minimum delay can only be updated through a timelock execution │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule minDelayOnlyChange(env e) {
|
||||
uint256 delayBefore = getMinDelay();
|
||||
|
||||
method f; calldataarg args;
|
||||
f(e, args);
|
||||
|
||||
assert delayBefore != getMinDelay() => (e.msg.sender == currentContract && f.selector == sig:updateDelay(uint256).selector), "Unauthorized delay update";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: schedule liveness and effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule schedule(env e, method f, bytes32 id, uint256 delay) filtered { f ->
|
||||
f.selector == sig:schedule(address, uint256, bytes, bytes32, bytes32, uint256).selector ||
|
||||
f.selector == sig:scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256).selector
|
||||
} {
|
||||
require nonpayable(e);
|
||||
|
||||
// Basic timestamp assumptions
|
||||
require e.block.timestamp > 1;
|
||||
require e.block.timestamp + delay < max_uint256;
|
||||
require e.block.timestamp + getMinDelay() < max_uint256;
|
||||
|
||||
bytes32 otherId; uint256 otherTimestamp = getTimestamp(otherId);
|
||||
|
||||
uint8 stateBefore = state(e, id);
|
||||
bool isDelaySufficient = delay >= getMinDelay();
|
||||
bool isProposerBefore = hasRole(PROPOSER_ROLE(), e.msg.sender);
|
||||
|
||||
helperScheduleWithRevert(e, f, id, delay);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
stateBefore == UNSET() &&
|
||||
isDelaySufficient &&
|
||||
isProposerBefore
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => state(e, id) == PENDING(), "State transition violation";
|
||||
assert success => getTimestamp(id) == require_uint256(e.block.timestamp + delay), "Proposal timestamp not correctly set";
|
||||
|
||||
// no side effect
|
||||
assert otherTimestamp != getTimestamp(otherId) => id == otherId, "Other proposal affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: execute liveness and effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule execute(env e, method f, bytes32 id, bytes32 predecessor) filtered { f ->
|
||||
f.selector == sig:execute(address, uint256, bytes, bytes32, bytes32).selector ||
|
||||
f.selector == sig:executeBatch(address[], uint256[], bytes[], bytes32, bytes32).selector
|
||||
} {
|
||||
bytes32 otherId; uint256 otherTimestamp = getTimestamp(otherId);
|
||||
|
||||
uint8 stateBefore = state(e, id);
|
||||
bool isOperationReadyBefore = isOperationReady(e, id);
|
||||
bool isExecutorOrOpen = hasRole(EXECUTOR_ROLE(), e.msg.sender) || hasRole(EXECUTOR_ROLE(), 0);
|
||||
bool predecessorDependency = predecessor == to_bytes32(0) || isDone(e, predecessor);
|
||||
|
||||
helperExecuteWithRevert(e, f, id, predecessor);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// The underlying transaction can revert, and that would cause the execution to revert. We can check that all non
|
||||
// reverting calls meet the requirements in terms of proposal readiness, access control and predecessor dependency.
|
||||
// We can't however guarantee that these requirements being meet ensure liveness of the proposal, because the
|
||||
// proposal can revert for reasons beyond our control.
|
||||
|
||||
// liveness, should be `<=>` but can only check `=>` (see comment above)
|
||||
assert success => (
|
||||
stateBefore == PENDING() &&
|
||||
isOperationReadyBefore &&
|
||||
predecessorDependency &&
|
||||
isExecutorOrOpen
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => state(e, id) == DONE(), "State transition violation";
|
||||
|
||||
// no side effect
|
||||
assert otherTimestamp != getTimestamp(otherId) => id == otherId, "Other proposal affected";
|
||||
}
|
||||
|
||||
/*
|
||||
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Rule: cancel liveness and effects │
|
||||
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
*/
|
||||
rule cancel(env e, bytes32 id) {
|
||||
require nonpayable(e);
|
||||
|
||||
bytes32 otherId; uint256 otherTimestamp = getTimestamp(otherId);
|
||||
|
||||
uint8 stateBefore = state(e, id);
|
||||
bool isCanceller = hasRole(CANCELLER_ROLE(), e.msg.sender);
|
||||
|
||||
cancel@withrevert(e, id);
|
||||
bool success = !lastReverted;
|
||||
|
||||
// liveness
|
||||
assert success <=> (
|
||||
stateBefore == PENDING() &&
|
||||
isCanceller
|
||||
);
|
||||
|
||||
// effect
|
||||
assert success => state(e, id) == UNSET(), "State transition violation";
|
||||
|
||||
// no side effect
|
||||
assert otherTimestamp != getTimestamp(otherId) => id == otherId, "Other proposal affected";
|
||||
}
|
||||
12
certora/specs/helpers/helpers.spec
Normal file
12
certora/specs/helpers/helpers.spec
Normal file
@ -0,0 +1,12 @@
|
||||
// environment
|
||||
definition nonpayable(env e) returns bool = e.msg.value == 0;
|
||||
definition nonzerosender(env e) returns bool = e.msg.sender != 0;
|
||||
definition sanity(env e) returns bool = clock(e) > 0 && clock(e) <= max_uint48;
|
||||
|
||||
// math
|
||||
definition min(mathint a, mathint b) returns mathint = a < b ? a : b;
|
||||
definition max(mathint a, mathint b) returns mathint = a > b ? a : b;
|
||||
|
||||
// time
|
||||
definition clock(env e) returns mathint = to_mathint(e.block.timestamp);
|
||||
definition isSetAndPast(env e, uint48 timepoint) returns bool = timepoint != 0 && to_mathint(timepoint) <= clock(e);
|
||||
8
certora/specs/methods/IAccessControl.spec
Normal file
8
certora/specs/methods/IAccessControl.spec
Normal file
@ -0,0 +1,8 @@
|
||||
methods {
|
||||
function DEFAULT_ADMIN_ROLE() external returns (bytes32) envfree;
|
||||
function hasRole(bytes32, address) external returns(bool) envfree;
|
||||
function getRoleAdmin(bytes32) external returns(bytes32) envfree;
|
||||
function grantRole(bytes32, address) external;
|
||||
function revokeRole(bytes32, address) external;
|
||||
function renounceRole(bytes32, address) external;
|
||||
}
|
||||
36
certora/specs/methods/IAccessControlDefaultAdminRules.spec
Normal file
36
certora/specs/methods/IAccessControlDefaultAdminRules.spec
Normal file
@ -0,0 +1,36 @@
|
||||
import "./IERC5313.spec";
|
||||
|
||||
methods {
|
||||
// === View ==
|
||||
|
||||
// Default Admin
|
||||
function defaultAdmin() external returns(address) envfree;
|
||||
function pendingDefaultAdmin() external returns(address, uint48) envfree;
|
||||
|
||||
// Default Admin Delay
|
||||
function defaultAdminDelay() external returns(uint48);
|
||||
function pendingDefaultAdminDelay() external returns(uint48, uint48);
|
||||
function defaultAdminDelayIncreaseWait() external returns(uint48) envfree;
|
||||
|
||||
// === Mutations ==
|
||||
|
||||
// Default Admin
|
||||
function beginDefaultAdminTransfer(address) external;
|
||||
function cancelDefaultAdminTransfer() external;
|
||||
function acceptDefaultAdminTransfer() external;
|
||||
|
||||
// Default Admin Delay
|
||||
function changeDefaultAdminDelay(uint48) external;
|
||||
function rollbackDefaultAdminDelay() external;
|
||||
|
||||
// == FV ==
|
||||
|
||||
// Default Admin
|
||||
function pendingDefaultAdmin_() external returns (address) envfree;
|
||||
function pendingDefaultAdminSchedule_() external returns (uint48) envfree;
|
||||
|
||||
// Default Admin Delay
|
||||
function pendingDelay_() external returns (uint48);
|
||||
function pendingDelaySchedule_() external returns (uint48);
|
||||
function delayChangeWait_(uint48) external returns (uint48);
|
||||
}
|
||||
5
certora/specs/methods/IAccessManaged.spec
Normal file
5
certora/specs/methods/IAccessManaged.spec
Normal file
@ -0,0 +1,5 @@
|
||||
methods {
|
||||
function authority() external returns (address) envfree;
|
||||
function isConsumingScheduledOp() external returns (bytes4) envfree;
|
||||
function setAuthority(address) external;
|
||||
}
|
||||
33
certora/specs/methods/IAccessManager.spec
Normal file
33
certora/specs/methods/IAccessManager.spec
Normal file
@ -0,0 +1,33 @@
|
||||
methods {
|
||||
function ADMIN_ROLE() external returns (uint64) envfree;
|
||||
function PUBLIC_ROLE() external returns (uint64) envfree;
|
||||
function canCall(address,address,bytes4) external returns (bool,uint32);
|
||||
function expiration() external returns (uint32) envfree;
|
||||
function minSetback() external returns (uint32) envfree;
|
||||
function isTargetClosed(address) external returns (bool) envfree;
|
||||
function getTargetFunctionRole(address,bytes4) external returns (uint64) envfree;
|
||||
function getTargetAdminDelay(address) external returns (uint32);
|
||||
function getRoleAdmin(uint64) external returns (uint64) envfree;
|
||||
function getRoleGuardian(uint64) external returns (uint64) envfree;
|
||||
function getRoleGrantDelay(uint64) external returns (uint32);
|
||||
function getAccess(uint64,address) external returns (uint48,uint32,uint32,uint48);
|
||||
function hasRole(uint64,address) external returns (bool,uint32);
|
||||
function labelRole(uint64,string) external;
|
||||
function grantRole(uint64,address,uint32) external;
|
||||
function revokeRole(uint64,address) external;
|
||||
function renounceRole(uint64,address) external;
|
||||
function setRoleAdmin(uint64,uint64) external;
|
||||
function setRoleGuardian(uint64,uint64) external;
|
||||
function setGrantDelay(uint64,uint32) external;
|
||||
function setTargetFunctionRole(address,bytes4[],uint64) external;
|
||||
function setTargetAdminDelay(address,uint32) external;
|
||||
function setTargetClosed(address,bool) external;
|
||||
function hashOperation(address,address,bytes) external returns (bytes32) envfree;
|
||||
function getNonce(bytes32) external returns (uint32) envfree;
|
||||
function getSchedule(bytes32) external returns (uint48);
|
||||
function schedule(address,bytes,uint48) external returns (bytes32,uint32);
|
||||
function execute(address,bytes) external returns (uint32);
|
||||
function cancel(address,address,bytes) external returns (uint32);
|
||||
function consumeScheduledOp(address,bytes) external;
|
||||
function updateAuthority(address,address) external;
|
||||
}
|
||||
11
certora/specs/methods/IERC20.spec
Normal file
11
certora/specs/methods/IERC20.spec
Normal file
@ -0,0 +1,11 @@
|
||||
methods {
|
||||
function name() external returns (string) envfree;
|
||||
function symbol() external returns (string) envfree;
|
||||
function decimals() external returns (uint8) envfree;
|
||||
function totalSupply() external returns (uint256) envfree;
|
||||
function balanceOf(address) external returns (uint256) envfree;
|
||||
function allowance(address,address) external returns (uint256) envfree;
|
||||
function approve(address,uint256) external returns (bool);
|
||||
function transfer(address,uint256) external returns (bool);
|
||||
function transferFrom(address,address,uint256) external returns (bool);
|
||||
}
|
||||
5
certora/specs/methods/IERC2612.spec
Normal file
5
certora/specs/methods/IERC2612.spec
Normal file
@ -0,0 +1,5 @@
|
||||
methods {
|
||||
function permit(address,address,uint256,uint256,uint8,bytes32,bytes32) external;
|
||||
function nonces(address) external returns (uint256) envfree;
|
||||
function DOMAIN_SEPARATOR() external returns (bytes32) envfree;
|
||||
}
|
||||
3
certora/specs/methods/IERC3156FlashBorrower.spec
Normal file
3
certora/specs/methods/IERC3156FlashBorrower.spec
Normal file
@ -0,0 +1,3 @@
|
||||
methods {
|
||||
function _.onFlashLoan(address,address,uint256,uint256,bytes) external => DISPATCHER(true);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user