mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 18:55:49 +00:00
Compare commits
650 Commits
nodestore
...
patch-payc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cb1485d5c | ||
|
|
bd79b7f339 | ||
|
|
ae573894c9 | ||
|
|
58dec112f5 | ||
|
|
23250a7985 | ||
|
|
256de4229c | ||
|
|
d9d7e49d7c | ||
|
|
74cdfc4228 | ||
|
|
fcae641049 | ||
|
|
bff711b0ab | ||
|
|
21b5002419 | ||
|
|
985c8d7dce | ||
|
|
ea25183858 | ||
|
|
9841c8da72 | ||
|
|
d9f2401713 | ||
|
|
28b8be7d8e | ||
|
|
a08f21d900 | ||
|
|
2337156d67 | ||
|
|
cb86237c10 | ||
|
|
607b581406 | ||
|
|
6dc86a9611 | ||
|
|
797681f33b | ||
|
|
d08fe26f84 | ||
|
|
150749291f | ||
|
|
6102b4ba2e | ||
|
|
5fac2771da | ||
|
|
0f04ada876 | ||
|
|
32b7cbe910 | ||
|
|
522cfe9d6a | ||
|
|
785ba90712 | ||
|
|
1c00600cfa | ||
|
|
48d12395ca | ||
|
|
98e1fb83de | ||
|
|
834442132b | ||
|
|
40631c1a7c | ||
|
|
3062a7d17e | ||
|
|
e44eeec631 | ||
|
|
87c6c2d3c0 | ||
|
|
75525c2d38 | ||
|
|
b7055927b2 | ||
|
|
3502e016e9 | ||
|
|
f9a43f262c | ||
|
|
dd6e21c38b | ||
|
|
d7e4ba8254 | ||
|
|
18a90ec432 | ||
|
|
25b5b7134d | ||
|
|
92e5e08025 | ||
|
|
517c7a494b | ||
|
|
2aae0b667c | ||
|
|
401a666f4d | ||
|
|
a6b84caea2 | ||
|
|
d568761fdf | ||
|
|
3c35024bf9 | ||
|
|
f4e738ac64 | ||
|
|
838898e758 | ||
|
|
88ded30810 | ||
|
|
6b8cc6dd9b | ||
|
|
37d3d7dae7 | ||
|
|
d6a0746f99 | ||
|
|
aa6d05c8b9 | ||
|
|
b6b6e0fe5c | ||
|
|
28650cb14b | ||
|
|
0a291371c9 | ||
|
|
ab6d3d505f | ||
|
|
debf178546 | ||
|
|
89df87dec8 | ||
|
|
cfa46934ed | ||
|
|
e7cd845d93 | ||
|
|
9b089bee94 | ||
|
|
e15f9244de | ||
|
|
ab67ddeeb6 | ||
|
|
e55820e7c6 | ||
|
|
4d87210e01 | ||
|
|
457c64088b | ||
|
|
fb44359988 | ||
|
|
9bcf186aa2 | ||
|
|
a70461f4d5 | ||
|
|
269909d5f9 | ||
|
|
db8fc670c5 | ||
|
|
f2e7fde64f | ||
|
|
5e96402770 | ||
|
|
f050bbfcea | ||
|
|
4d06d898ee | ||
|
|
571ad5c60d | ||
|
|
c2f8b1354a | ||
|
|
ed6c25d093 | ||
|
|
e2a6891d11 | ||
|
|
88dd6a6f85 | ||
|
|
7ebfa0b324 | ||
|
|
3965ecc6c1 | ||
|
|
c7e03cc419 | ||
|
|
a01c601242 | ||
|
|
ede561cea3 | ||
|
|
250f4dc13b | ||
|
|
86b765cb0f | ||
|
|
c65a0332bc | ||
|
|
d4a6854835 | ||
|
|
e5a3cd68b7 | ||
|
|
0f83256ffa | ||
|
|
01a4df0584 | ||
|
|
032e61a784 | ||
|
|
129c25a90a | ||
|
|
7a860910a6 | ||
|
|
8aded497e7 | ||
|
|
e5bf299e39 | ||
|
|
b19feb4dd4 | ||
|
|
8e28f74b5d | ||
|
|
ac009c63b1 | ||
|
|
8262785c90 | ||
|
|
e7dab07e91 | ||
|
|
a547f87c46 | ||
|
|
f6258deb96 | ||
|
|
b980edd479 | ||
|
|
af5e9d9437 | ||
|
|
786b559b05 | ||
|
|
1cb0e428b7 | ||
|
|
b2ec73cdc5 | ||
|
|
11b9a69f72 | ||
|
|
ba2b168847 | ||
|
|
52e58ceade | ||
|
|
0be22fd91c | ||
|
|
164eb58c4f | ||
|
|
5038a42701 | ||
|
|
b9f40f4dc5 | ||
|
|
d823050fb1 | ||
|
|
2c61c4a79d | ||
|
|
0c4441ac36 | ||
|
|
7aa342b003 | ||
|
|
0454beaf76 | ||
|
|
6c65c6199a | ||
|
|
febdb1c9c2 | ||
|
|
264f25c2a6 | ||
|
|
35a0e18973 | ||
|
|
55b28f9bf1 | ||
|
|
a919e440ae | ||
|
|
441bcdf001 | ||
|
|
3ec852cf1c | ||
|
|
9285ab522d | ||
|
|
f89bd966ec | ||
|
|
00a3b5adc2 | ||
|
|
1cb9b67a0f | ||
|
|
2b359408a8 | ||
|
|
ba8b5a8cbe | ||
|
|
c36683a825 | ||
|
|
5aec64c84d | ||
|
|
c96d1386a1 | ||
|
|
a9290dbdcd | ||
|
|
53a7408f18 | ||
|
|
d0295da992 | ||
|
|
17df89c075 | ||
|
|
e9fc4ced98 | ||
|
|
a3e2f4257b | ||
|
|
7b8d5fc5b8 | ||
|
|
adf8120483 | ||
|
|
623778d1a9 | ||
|
|
4ae13f2bea | ||
|
|
152780b218 | ||
|
|
076b8e3e11 | ||
|
|
96af8735ba | ||
|
|
728d2b4683 | ||
|
|
4f7fed3708 | ||
|
|
08e7059b8c | ||
|
|
4f86551fb3 | ||
|
|
f06124e8c7 | ||
|
|
234d811ce3 | ||
|
|
a3e940844d | ||
|
|
fc6f8dde94 | ||
|
|
d6ce1add8b | ||
|
|
338b646a3d | ||
|
|
6b4f45f0eb | ||
|
|
ecf78bd818 | ||
|
|
111f7d20ba | ||
|
|
11391d91b2 | ||
|
|
b38c2c14dc | ||
|
|
b64650af71 | ||
|
|
2211d6f851 | ||
|
|
1bf5088b16 | ||
|
|
8c1e483416 | ||
|
|
0bf51e257b | ||
|
|
48dc6b29bf | ||
|
|
29e733cab3 | ||
|
|
b1584d6b8c | ||
|
|
afde76bd11 | ||
|
|
e07a99153a | ||
|
|
d70ec5d2e4 | ||
|
|
b13e515698 | ||
|
|
ea02919a0c | ||
|
|
de03278927 | ||
|
|
9d40dce759 | ||
|
|
0bec0515b6 | ||
|
|
6baa95b190 | ||
|
|
df4891c4a7 | ||
|
|
51e8a1b222 | ||
|
|
f42d9124df | ||
|
|
41461bdddc | ||
|
|
e397107ce9 | ||
|
|
034318b158 | ||
|
|
95bef7ced3 | ||
|
|
c33e64fa3d | ||
|
|
d31ee509a9 | ||
|
|
8926a95af3 | ||
|
|
68b3db602b | ||
|
|
1ae08afb02 | ||
|
|
01e298befe | ||
|
|
58d71b8c96 | ||
|
|
4c6fd4785d | ||
|
|
c26f181528 | ||
|
|
d919d2ad06 | ||
|
|
98df71a919 | ||
|
|
892ba747be | ||
|
|
48c1c21542 | ||
|
|
724cb4494f | ||
|
|
131bd9f4b3 | ||
|
|
8b87cc291c | ||
|
|
025772a92b | ||
|
|
dc29234ff5 | ||
|
|
b3d714260f | ||
|
|
1e21d9f01d | ||
|
|
551e86f22b | ||
|
|
49b7cd3138 | ||
|
|
7a1011c193 | ||
|
|
33f01147e3 | ||
|
|
8a10716a5c | ||
|
|
9853ff3828 | ||
|
|
fa31522d5c | ||
|
|
3b580c0d07 | ||
|
|
cb259e83b0 | ||
|
|
5e814a6da4 | ||
|
|
056262d922 | ||
|
|
8d70bc4210 | ||
|
|
4e13e13c3a | ||
|
|
9915e5fafc | ||
|
|
0b32a1429e | ||
|
|
669a0bc040 | ||
|
|
f0d0909eb2 | ||
|
|
f9af9ac6c8 | ||
|
|
dfc95ec291 | ||
|
|
81d795dcfc | ||
|
|
e71137fe4a | ||
|
|
b7ccfaa7b1 | ||
|
|
a56034b47c | ||
|
|
311d0b8bf1 | ||
|
|
a5ca117ff6 | ||
|
|
0371795d78 | ||
|
|
f191c911d4 | ||
|
|
435c956ef7 | ||
|
|
e6f49040f5 | ||
|
|
2f3f6dcb03 | ||
|
|
5ebcaf0a6c | ||
|
|
8bfdbcbab5 | ||
|
|
135b63dbe0 | ||
|
|
46167d1c46 | ||
|
|
79e621d96c | ||
|
|
66627b26cf | ||
|
|
2ddf7541a6 | ||
|
|
7aad6e5127 | ||
|
|
dffcdea12b | ||
|
|
24384be242 | ||
|
|
d7725837f5 | ||
|
|
7745c72b2c | ||
|
|
acb373280b | ||
|
|
4f506599f6 | ||
|
|
383f1b6ab3 | ||
|
|
da18c86cbf | ||
|
|
9fcb28acad | ||
|
|
305c9a8d61 | ||
|
|
9b2d563dec | ||
|
|
d4b54c20ed | ||
|
|
150d4a47e4 | ||
|
|
1c9df69b33 | ||
|
|
10555faa92 | ||
|
|
0f1ffff068 | ||
|
|
9309b57364 | ||
|
|
cb08f2b6ec | ||
|
|
84cde3ce0b | ||
|
|
f7b3ddd87b | ||
|
|
1e7710eee2 | ||
|
|
07f047b1e2 | ||
|
|
190c18a7c2 | ||
|
|
4228946747 | ||
|
|
7c364377fe | ||
|
|
94d3d5a6bb | ||
|
|
8f02b24cc4 | ||
|
|
f732d724a2 | ||
|
|
cd8faf611c | ||
|
|
b35c23bf90 | ||
|
|
696ed4729b | ||
|
|
8abfbc1ae9 | ||
|
|
6c6cd26a9a | ||
|
|
8a02a58e4b | ||
|
|
9e1b969e4c | ||
|
|
1d75b27a1b | ||
|
|
466c7dba9f | ||
|
|
c19af115c8 | ||
|
|
bf41273d2f | ||
|
|
39f81d0af5 | ||
|
|
b5f6205f4d | ||
|
|
7abfc033c0 | ||
|
|
0940843766 | ||
|
|
663c1bda0e | ||
|
|
c0efc5ea5f | ||
|
|
2b1727fb05 | ||
|
|
8687b5c3c9 | ||
|
|
ecd49e1535 | ||
|
|
c77a8d5ec6 | ||
|
|
e13676f709 | ||
|
|
74594d5348 | ||
|
|
ae350c4390 | ||
|
|
8a62a613ec | ||
|
|
caf4827c0b | ||
|
|
e5840f67e5 | ||
|
|
ef3272b3ad | ||
|
|
bcdaca0f23 | ||
|
|
9998e33495 | ||
|
|
5fa071c833 | ||
|
|
649a9392f5 | ||
|
|
cfb6dfedf9 | ||
|
|
9b47b188fc | ||
|
|
e8da019386 | ||
|
|
c2b03fecca | ||
|
|
60c276d90b | ||
|
|
2929748898 | ||
|
|
5ec8783d35 | ||
|
|
243eb4d921 | ||
|
|
272d533fcc | ||
|
|
197bde6ebd | ||
|
|
03a5d25143 | ||
|
|
01dffa9348 | ||
|
|
a26412055e | ||
|
|
b75b9f2a71 | ||
|
|
46e4df0f85 | ||
|
|
1dea9bcfd6 | ||
|
|
96aab1288f | ||
|
|
510c69d487 | ||
|
|
0cdea9d7f7 | ||
|
|
aa9b03e57b | ||
|
|
38c466c47d | ||
|
|
5f5a947d6c | ||
|
|
7a008c21ee | ||
|
|
4f44747342 | ||
|
|
aebf2ac990 | ||
|
|
ee073c179d | ||
|
|
661b6b6dd4 | ||
|
|
8f8177b139 | ||
|
|
31ab52d149 | ||
|
|
9ccb9d366d | ||
|
|
06d3270e3e | ||
|
|
0feaec0d7e | ||
|
|
d6c699f734 | ||
|
|
ac78b7a9a7 | ||
|
|
b72a87c7d3 | ||
|
|
39c32561bd | ||
|
|
89aa8b21ec | ||
|
|
a828e24cf0 | ||
|
|
f7a8d2de84 | ||
|
|
0aa3b2ed74 | ||
|
|
c9b4977d93 | ||
|
|
daacb45613 | ||
|
|
32559463ef | ||
|
|
2216c62fbc | ||
|
|
750dbfc364 | ||
|
|
68bf9f264f | ||
|
|
c625309733 | ||
|
|
ae0335a308 | ||
|
|
7a5d4d1977 | ||
|
|
c33f5b46a8 | ||
|
|
12d9d399a9 | ||
|
|
a11905c43a | ||
|
|
348bfe5ede | ||
|
|
7fee0eb171 | ||
|
|
69327445e9 | ||
|
|
8f514937a4 | ||
|
|
36b34a7bd5 | ||
|
|
5edaec2bd0 | ||
|
|
2f1f453052 | ||
|
|
6eaaa7bcfa | ||
|
|
e354497f63 | ||
|
|
6fcd654bee | ||
|
|
d275a2ab72 | ||
|
|
3f33471220 | ||
|
|
a82ad5ba76 | ||
|
|
48e804c40c | ||
|
|
c9c54c9799 | ||
|
|
24fe5f9fd0 | ||
|
|
476ee8a479 | ||
|
|
0ee63b7c7b | ||
|
|
2916b7e692 | ||
|
|
d72a597aa4 | ||
|
|
5da990661a | ||
|
|
d3cc1a8798 | ||
|
|
aa61e1be38 | ||
|
|
307f9702ea | ||
|
|
192308fb3e | ||
|
|
0e2e674c51 | ||
|
|
0f10f3b5c0 | ||
|
|
86614de00e | ||
|
|
b9903a822f | ||
|
|
584db523b4 | ||
|
|
14dee2d976 | ||
|
|
cfb8e02f16 | ||
|
|
43b6e89303 | ||
|
|
0aa2c26680 | ||
|
|
c848fe91d6 | ||
|
|
56d062f907 | ||
|
|
7d4b00cfcb | ||
|
|
66105b6c68 | ||
|
|
641b8c546d | ||
|
|
8186dd960e | ||
|
|
11bfcbf915 | ||
|
|
8df65be522 | ||
|
|
9effcc3924 | ||
|
|
163c2b4631 | ||
|
|
be7ca74e46 | ||
|
|
448258f861 | ||
|
|
f8591d0fd6 | ||
|
|
31da4bf8d4 | ||
|
|
4e6e81f5de | ||
|
|
b5e9325bd9 | ||
|
|
c7aec60cec | ||
|
|
5d6726ce07 | ||
|
|
ac72ef80a4 | ||
|
|
c681de1d39 | ||
|
|
b3168c7ea5 | ||
|
|
272a6c0999 | ||
|
|
0133a4136e | ||
|
|
31e7e5a56e | ||
|
|
4438ebb5b7 | ||
|
|
c2f99e80af | ||
|
|
e4b17d1cf2 | ||
|
|
ba86191406 | ||
|
|
fc8695f044 | ||
|
|
25e65f739f | ||
|
|
30ce0e3937 | ||
|
|
c6e4d79a7b | ||
|
|
bebf34311b | ||
|
|
1e8bbcc60c | ||
|
|
ef6613421d | ||
|
|
c4b3e69cec | ||
|
|
b0343d0509 | ||
|
|
476bd329b3 | ||
|
|
516c4e9fed | ||
|
|
61750dcb0d | ||
|
|
15b449b119 | ||
|
|
70c694ea4a | ||
|
|
8aa07383ec | ||
|
|
ecea635db5 | ||
|
|
5c80fb3669 | ||
|
|
2f42ddb285 | ||
|
|
99b00a6c1b | ||
|
|
d9fba022a6 | ||
|
|
72fb172649 | ||
|
|
c164acd3d6 | ||
|
|
676480cc44 | ||
|
|
8ca7a2e2b3 | ||
|
|
bb1a6d2c35 | ||
|
|
2c583ffb43 | ||
|
|
0795d79d9a | ||
|
|
f4f51d0643 | ||
|
|
9790332232 | ||
|
|
fbafb72262 | ||
|
|
49207d007d | ||
|
|
f6dadf36da | ||
|
|
8eb4589e09 | ||
|
|
8b6efee476 | ||
|
|
a0ce24d4e3 | ||
|
|
10c94831e9 | ||
|
|
250ed22922 | ||
|
|
8a8c980be7 | ||
|
|
139d57921a | ||
|
|
a145dd7379 | ||
|
|
3b5e4b7e33 | ||
|
|
5f091922c6 | ||
|
|
d42d965908 | ||
|
|
776d1fb797 | ||
|
|
b19287c6d0 | ||
|
|
c50eb7773f | ||
|
|
5f12c22fbe | ||
|
|
c49406d8c9 | ||
|
|
15a07d14f8 | ||
|
|
0aaf98c46e | ||
|
|
039ce53c00 | ||
|
|
f79b6c7193 | ||
|
|
3dd7fd4754 | ||
|
|
76779d379c | ||
|
|
8a344a39e1 | ||
|
|
6569421524 | ||
|
|
beb0710d46 | ||
|
|
cbad4e53d2 | ||
|
|
63fa10412e | ||
|
|
cd748dec95 | ||
|
|
3cf5a3d3d1 | ||
|
|
14c68f88ea | ||
|
|
8740108f99 | ||
|
|
d492ffd04e | ||
|
|
f49dce56b0 | ||
|
|
ccb3f36245 | ||
|
|
f6c64e1c80 | ||
|
|
da7a99c231 | ||
|
|
f8342a7069 | ||
|
|
6f43313393 | ||
|
|
c008c1e951 | ||
|
|
fb58424598 | ||
|
|
e12009d12c | ||
|
|
720930a8f6 | ||
|
|
2c2b70f05e | ||
|
|
0c43377d6f | ||
|
|
a9c15ddbfc | ||
|
|
0c1aedfe15 | ||
|
|
312c10e053 | ||
|
|
456d1ebb0d | ||
|
|
ad8e66f50d | ||
|
|
64329a0f20 | ||
|
|
b51723269d | ||
|
|
17193d12c7 | ||
|
|
4177d5b00f | ||
|
|
fc55a7cd04 | ||
|
|
d500fce743 | ||
|
|
4db22471d8 | ||
|
|
c7dfc60571 | ||
|
|
4c633995f5 | ||
|
|
b99e445c56 | ||
|
|
4e9d1fd575 | ||
|
|
1da0cd9753 | ||
|
|
231647d156 | ||
|
|
79601159a5 | ||
|
|
713fbb3d72 | ||
|
|
74c0f9fa0f | ||
|
|
45d4949b90 | ||
|
|
1d91f9c9e4 | ||
|
|
91c6c64b72 | ||
|
|
2b335ab1ca | ||
|
|
dafba0fb10 | ||
|
|
ca5436fc73 | ||
|
|
1c3c9cd91f | ||
|
|
5f913b5897 | ||
|
|
0209c98c75 | ||
|
|
989d386912 | ||
|
|
3f922eb8c5 | ||
|
|
5e159356cc | ||
|
|
7c1cc2e1d1 | ||
|
|
b3559f1f88 | ||
|
|
99e830606d | ||
|
|
78f14c07e7 | ||
|
|
e555b3e49d | ||
|
|
c193fd58af | ||
|
|
8422947375 | ||
|
|
9791075bb8 | ||
|
|
b12b39d3a6 | ||
|
|
ba1a9ed9ee | ||
|
|
296ecb3dc9 | ||
|
|
e75e280b25 | ||
|
|
9adf190b75 | ||
|
|
98d8efdb6a | ||
|
|
e299f099d8 | ||
|
|
61e0a3766c | ||
|
|
f73d26b9fe | ||
|
|
c9077e8c84 | ||
|
|
480ff62f13 | ||
|
|
75007dc8a3 | ||
|
|
0fe8d9a72f | ||
|
|
bbe0791966 | ||
|
|
b6ca19ba4e | ||
|
|
5917dc76f9 | ||
|
|
f70ddf9e65 | ||
|
|
75f3b93c78 | ||
|
|
e0533cae8d | ||
|
|
3075a01caa | ||
|
|
708a567f10 | ||
|
|
8ede26b000 | ||
|
|
8a10898f23 | ||
|
|
6be3f2d873 | ||
|
|
c44e18728d | ||
|
|
7d375c93fc | ||
|
|
10118aa61b | ||
|
|
8629a29ec7 | ||
|
|
3fb1d27aa9 | ||
|
|
77c76c044e | ||
|
|
f1c5cf99be | ||
|
|
34347384c0 | ||
|
|
2c77a4d3dc | ||
|
|
b5cdeb5812 | ||
|
|
3c045736bc | ||
|
|
0ce15e0e35 | ||
|
|
87fe411483 | ||
|
|
0999033ec0 | ||
|
|
77cecaf187 | ||
|
|
5bff2ad2b9 | ||
|
|
b0e0f319a1 | ||
|
|
2233f585f8 | ||
|
|
61d8c7a85b | ||
|
|
6f8750316c | ||
|
|
4f94f07b2b | ||
|
|
3c0aaab21b | ||
|
|
2bad9bde04 | ||
|
|
cbee151d2d | ||
|
|
e899147a4e | ||
|
|
24c51a51a6 | ||
|
|
c463bd8ccc | ||
|
|
c11472ed0b | ||
|
|
eb6d770981 | ||
|
|
72ec634a25 | ||
|
|
6b9c2826fc | ||
|
|
0913a3c596 | ||
|
|
3284ab1804 | ||
|
|
167a7b3a5b | ||
|
|
3c1f84f09e | ||
|
|
74f1228d4a | ||
|
|
d46664df0f | ||
|
|
c912b939d6 | ||
|
|
9fc1a786dc | ||
|
|
63f80ea033 | ||
|
|
8682d40eca | ||
|
|
68f0e4baf5 | ||
|
|
e8e4bf7bf3 | ||
|
|
7aa49cdf19 | ||
|
|
fda9e9a7ee | ||
|
|
4b2b6a871a | ||
|
|
d8a84e9530 | ||
|
|
c3a9f3dbf3 | ||
|
|
df1300fb37 | ||
|
|
648d6c3e2f | ||
|
|
47ffc392d7 | ||
|
|
0362e935af | ||
|
|
a79fa2026b | ||
|
|
c1e7fe2d93 | ||
|
|
4a5ad4cfac | ||
|
|
ffd453f7dd | ||
|
|
518fb6d208 | ||
|
|
093055c039 | ||
|
|
b7ac73c8e4 | ||
|
|
004ec2d201 | ||
|
|
ebbf4b64a5 | ||
|
|
649ab872ff | ||
|
|
7e9e9104ea | ||
|
|
3726f8bf31 | ||
|
|
e37dc710cf | ||
|
|
5d38e4cfbf | ||
|
|
28f4cc7817 | ||
|
|
95fabd5762 | ||
|
|
23ce431876 | ||
|
|
04ef885108 | ||
|
|
d33df35378 | ||
|
|
ba3c0e5145 | ||
|
|
be1ce5eca9 | ||
|
|
df66e4151e | ||
|
|
9a31f321cd | ||
|
|
e40e38e8d3 | ||
|
|
f5af42a640 | ||
|
|
6dfbf39c99 | ||
|
|
691f674743 |
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
||||
# Ignore everything
|
||||
*
|
||||
|
||||
# Allow files and directories
|
||||
!/build-inner.sh
|
||||
!/release-builder.sh
|
||||
|
||||
35
.github/workflows/build-in-docker.yml
vendored
Normal file
35
.github/workflows/build-in-docker.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Build using Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev", "test", "release" ]
|
||||
pull_request:
|
||||
branches: [ "dev", "release" ]
|
||||
|
||||
jobs:
|
||||
builder:
|
||||
runs-on: [self-hosted, vanity]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- name: Build using Docker
|
||||
run: /bin/bash release-builder.sh
|
||||
|
||||
unittests:
|
||||
needs: builder
|
||||
runs-on: [self-hosted, vanity]
|
||||
steps:
|
||||
- name: Unit tests
|
||||
run: /bin/bash docker-unit-tests.sh
|
||||
|
||||
# publisher:
|
||||
# needs: builder
|
||||
# runs-on: [self-hosted, vanity]
|
||||
# steps:
|
||||
# - uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: build-${{ github.run_number }}
|
||||
# path: |
|
||||
# release-build/xahaud
|
||||
# release-build/release.info
|
||||
7
.github/workflows/clang-format.yml
vendored
7
.github/workflows/clang-format.yml
vendored
@@ -4,16 +4,17 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CLANG_VERSION: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
codename=$( lsb_release --codename --short )
|
||||
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
||||
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${CLANG_VERSION} main
|
||||
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-${CLANG_VERSION} main
|
||||
deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||
EOF
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
||||
sudo apt-get update
|
||||
|
||||
2
.github/workflows/doxygen.yml
vendored
2
.github/workflows/doxygen.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
job:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker://rippleci/rippled-ci-builder:2944b78d22db
|
||||
steps:
|
||||
|
||||
2
.github/workflows/levelization.yml
vendored
2
.github/workflows/levelization.yml
vendored
@@ -4,7 +4,7 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CLANG_VERSION: 10
|
||||
steps:
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -111,3 +111,6 @@ compile_commands.json
|
||||
.clangd
|
||||
packages
|
||||
pkg_out
|
||||
pkg
|
||||
CMakeUserPresets.json
|
||||
bld.rippled/
|
||||
|
||||
13
.vscode/settings.json
vendored
Normal file
13
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"C_Cpp.formatting": "clangFormat",
|
||||
"C_Cpp.clang_format_path": "/Users/dustedfloor/projects/transia-rnd/rippled-icv2/.clang-format",
|
||||
"C_Cpp.clang_format_fallbackStyle": "{ ColumnLimit: 0 }",
|
||||
"[cpp]":{
|
||||
"editor.wordBasedSuggestions": false,
|
||||
"editor.suggest.insertMode": "replace",
|
||||
"editor.semanticHighlighting.enabled": true,
|
||||
"editor.tabSize": 4,
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
"editor.formatOnSave": false
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,10 @@ else ()
|
||||
# * static option set and
|
||||
# * NOT APPLE (AppleClang does not support static libc/c++) and
|
||||
# * NOT san (sanitizers typically don't work with static libc/c++)
|
||||
$<$<AND:$<BOOL:${static}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${san}>>>:-static-libstdc++>)
|
||||
$<$<AND:$<BOOL:${static}>,$<NOT:$<BOOL:${APPLE}>>,$<NOT:$<BOOL:${san}>>>:
|
||||
-static-libstdc++
|
||||
-static-libgcc
|
||||
>)
|
||||
endif ()
|
||||
|
||||
if (use_gold AND is_gcc)
|
||||
|
||||
@@ -13,6 +13,15 @@ if (unity)
|
||||
set_target_properties(xrpl_core PROPERTIES UNITY_BUILD ON)
|
||||
endif ()
|
||||
|
||||
# Try to find the ACL library
|
||||
find_library(ACL_LIBRARY NAMES acl)
|
||||
|
||||
# Check if ACL was found
|
||||
if(ACL_LIBRARY)
|
||||
message(STATUS "Found ACL: ${ACL_LIBRARY}")
|
||||
else()
|
||||
message(STATUS "ACL not found, continuing without ACL support")
|
||||
endif()
|
||||
|
||||
#[===============================[
|
||||
beast/legacy FILES:
|
||||
@@ -50,6 +59,7 @@ target_sources (xrpl_core PRIVATE
|
||||
src/ripple/basics/impl/FileUtilities.cpp
|
||||
src/ripple/basics/impl/IOUAmount.cpp
|
||||
src/ripple/basics/impl/Log.cpp
|
||||
src/ripple/basics/impl/Number.cpp
|
||||
src/ripple/basics/impl/StringUtilities.cpp
|
||||
#[===============================[
|
||||
main sources:
|
||||
@@ -154,6 +164,7 @@ install (
|
||||
src/ripple/basics/LocalValue.h
|
||||
src/ripple/basics/Log.h
|
||||
src/ripple/basics/MathUtilities.h
|
||||
src/ripple/basics/Number.h
|
||||
src/ripple/basics/safe_cast.h
|
||||
src/ripple/basics/Slice.h
|
||||
src/ripple/basics/spinlock.h
|
||||
@@ -441,12 +452,15 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/tx/impl/SetRegularKey.cpp
|
||||
src/ripple/app/tx/impl/SetHook.cpp
|
||||
src/ripple/app/tx/impl/ClaimReward.cpp
|
||||
src/ripple/app/tx/impl/GenesisMint.cpp
|
||||
src/ripple/app/tx/impl/Import.cpp
|
||||
src/ripple/app/tx/impl/Invoke.cpp
|
||||
src/ripple/app/tx/impl/SetSignerList.cpp
|
||||
src/ripple/app/tx/impl/SetTrust.cpp
|
||||
src/ripple/app/tx/impl/SignerEntries.cpp
|
||||
src/ripple/app/tx/impl/Taker.cpp
|
||||
src/ripple/app/tx/impl/Transactor.cpp
|
||||
src/ripple/app/tx/impl/URIToken.cpp
|
||||
src/ripple/app/tx/impl/apply.cpp
|
||||
src/ripple/app/tx/impl/applySteps.cpp
|
||||
src/ripple/app/hook/impl/applyHook.cpp
|
||||
@@ -535,7 +549,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/nodestore/impl/DeterministicShard.cpp
|
||||
src/ripple/nodestore/impl/DecodedBlob.cpp
|
||||
src/ripple/nodestore/impl/DummyScheduler.cpp
|
||||
src/ripple/nodestore/impl/EncodedBlob.cpp
|
||||
src/ripple/nodestore/impl/ManagerImp.cpp
|
||||
src/ripple/nodestore/impl/NodeObject.cpp
|
||||
src/ripple/nodestore/impl/Shard.cpp
|
||||
@@ -645,7 +658,6 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/rpc/handlers/WalletPropose.cpp
|
||||
src/ripple/rpc/impl/DeliveredAmount.cpp
|
||||
src/ripple/rpc/impl/Handler.cpp
|
||||
src/ripple/rpc/impl/GRPCHelpers.cpp
|
||||
src/ripple/rpc/impl/LegacyPathFind.cpp
|
||||
src/ripple/rpc/impl/RPCHandler.cpp
|
||||
src/ripple/rpc/impl/RPCHelpers.cpp
|
||||
@@ -691,6 +703,7 @@ if (tests)
|
||||
src/test/app/AccountTxPaging_test.cpp
|
||||
src/test/app/AmendmentTable_test.cpp
|
||||
src/test/app/Check_test.cpp
|
||||
src/test/app/ClaimReward_test.cpp
|
||||
src/test/app/CrossingLimits_test.cpp
|
||||
src/test/app/DeliverMin_test.cpp
|
||||
src/test/app/DepositAuth_test.cpp
|
||||
@@ -700,9 +713,13 @@ if (tests)
|
||||
src/test/app/FeeVote_test.cpp
|
||||
src/test/app/Flow_test.cpp
|
||||
src/test/app/Freeze_test.cpp
|
||||
src/test/app/GenesisMint_test.cpp
|
||||
src/test/app/HashRouter_test.cpp
|
||||
src/test/app/Import_test.cpp
|
||||
src/test/app/Invoke_test.cpp
|
||||
src/test/app/LedgerHistory_test.cpp
|
||||
src/test/app/LedgerLoad_test.cpp
|
||||
src/test/app/LedgerMaster_test.cpp
|
||||
src/test/app/LedgerReplay_test.cpp
|
||||
src/test/app/LoadFeeTrack_test.cpp
|
||||
src/test/app/Manifest_test.cpp
|
||||
@@ -731,10 +748,12 @@ if (tests)
|
||||
src/test/app/Transaction_ordering_test.cpp
|
||||
src/test/app/TrustAndBalance_test.cpp
|
||||
src/test/app/TxQ_test.cpp
|
||||
src/test/app/URIToken_test.cpp
|
||||
src/test/app/ValidatorKeys_test.cpp
|
||||
src/test/app/ValidatorList_test.cpp
|
||||
src/test/app/ValidatorSite_test.cpp
|
||||
src/test/app/SetHook_test.cpp
|
||||
src/test/app/XahauGenesis_test.cpp
|
||||
src/test/app/tx/apply_test.cpp
|
||||
#[===============================[
|
||||
test sources:
|
||||
@@ -746,6 +765,7 @@ if (tests)
|
||||
src/test/basics/FileUtilities_test.cpp
|
||||
src/test/basics/IOUAmount_test.cpp
|
||||
src/test/basics/KeyCache_test.cpp
|
||||
src/test/basics/Number_test.cpp
|
||||
src/test/basics/PerfLog_test.cpp
|
||||
src/test/basics/RangeSet_test.cpp
|
||||
src/test/basics/scope_test.cpp
|
||||
@@ -793,6 +813,7 @@ if (tests)
|
||||
src/test/consensus/LedgerTrie_test.cpp
|
||||
src/test/consensus/NegativeUNL_test.cpp
|
||||
src/test/consensus/ScaleFreeSim_test.cpp
|
||||
src/test/consensus/UNLReport_test.cpp
|
||||
src/test/consensus/Validations_test.cpp
|
||||
#[===============================[
|
||||
test sources:
|
||||
@@ -918,8 +939,8 @@ if (tests)
|
||||
src/test/protocol/BuildInfo_test.cpp
|
||||
src/test/protocol/InnerObjectFormats_test.cpp
|
||||
src/test/protocol/Issue_test.cpp
|
||||
src/test/protocol/KnownFormatToGRPC_test.cpp
|
||||
src/test/protocol/Hooks_test.cpp
|
||||
src/test/protocol/Memo_test.cpp
|
||||
src/test/protocol/PublicKey_test.cpp
|
||||
src/test/protocol/Quality_test.cpp
|
||||
src/test/protocol/STAccount_test.cpp
|
||||
@@ -953,7 +974,6 @@ if (tests)
|
||||
src/test/rpc/DepositAuthorized_test.cpp
|
||||
src/test/rpc/DeliveredAmount_test.cpp
|
||||
src/test/rpc/Feature_test.cpp
|
||||
src/test/rpc/Fee_test.cpp
|
||||
src/test/rpc/GatewayBalances_test.cpp
|
||||
src/test/rpc/GetCounts_test.cpp
|
||||
src/test/rpc/JSONRPC_test.cpp
|
||||
@@ -976,12 +996,10 @@ if (tests)
|
||||
src/test/rpc/ServerInfo_test.cpp
|
||||
src/test/rpc/ShardArchiveHandler_test.cpp
|
||||
src/test/rpc/Status_test.cpp
|
||||
src/test/rpc/Submit_test.cpp
|
||||
src/test/rpc/Subscribe_test.cpp
|
||||
src/test/rpc/Transaction_test.cpp
|
||||
src/test/rpc/TransactionEntry_test.cpp
|
||||
src/test/rpc/TransactionHistory_test.cpp
|
||||
src/test/rpc/Tx_test.cpp
|
||||
src/test/rpc/ValidatorInfo_test.cpp
|
||||
src/test/rpc/ValidatorRPC_test.cpp
|
||||
src/test/rpc/Version_test.cpp
|
||||
@@ -1033,3 +1051,7 @@ if (tests)
|
||||
src/test/rpc/ShardArchiveHandler_test.cpp
|
||||
PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||
endif () #tests
|
||||
|
||||
if(ACL_LIBRARY)
|
||||
target_link_libraries(rippled ${ACL_LIBRARY})
|
||||
endif()
|
||||
|
||||
@@ -37,7 +37,7 @@ if (is_root_project)
|
||||
docker build
|
||||
--pull
|
||||
--build-arg GIT_COMMIT=${commit_hash}
|
||||
-t rippled-rpm-builder:${container_label}
|
||||
-t rippleci/rippled-rpm-builder:${container_label}
|
||||
$<$<BOOL:${rpm_cache_from}>:--cache-from=${rpm_cache_from}>
|
||||
-f centos-builder/Dockerfile .
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Builds/containers
|
||||
@@ -47,12 +47,10 @@ if (is_root_project)
|
||||
SOURCES
|
||||
Builds/containers/centos-builder/Dockerfile
|
||||
Builds/containers/centos-builder/centos_setup.sh
|
||||
Builds/containers/centos-builder/extras.sh
|
||||
Builds/containers/shared/update-rippled.sh
|
||||
Builds/containers/shared/update_sources.sh
|
||||
Builds/containers/shared/rippled.service
|
||||
Builds/containers/shared/rippled-reporting.service
|
||||
Builds/containers/shared/build_deps.sh
|
||||
Builds/containers/packaging/rpm/rippled.spec
|
||||
Builds/containers/packaging/rpm/build_rpm.sh
|
||||
Builds/containers/packaging/rpm/50-rippled.preset
|
||||
@@ -66,8 +64,7 @@ if (is_root_project)
|
||||
-v ${NIH_CACHE_ROOT}/pkgbuild:/opt/rippled_bld/pkg/.nih_c
|
||||
-v ${CMAKE_CURRENT_SOURCE_DIR}:/opt/rippled_bld/pkg/rippled
|
||||
-v ${CMAKE_CURRENT_BINARY_DIR}/packages:/opt/rippled_bld/pkg/out
|
||||
"$<$<BOOL:${map_user}>:--volume=/etc/passwd:/etc/passwd;--volume=/etc/group:/etc/group;--user=${DOCKER_USER_ID}:${DOCKER_GROUP_ID}>"
|
||||
-t rippled-rpm-builder:${container_label}
|
||||
-t rippleci/rippled-rpm-builder:${container_label}
|
||||
/bin/bash -c "cp -fpu rippled/Builds/containers/packaging/rpm/build_rpm.sh . && ./build_rpm.sh"
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
@@ -82,7 +79,7 @@ if (is_root_project)
|
||||
#[===================================================================[
|
||||
dpkg
|
||||
#]===================================================================]
|
||||
# currently use ubuntu 16.04 as a base b/c it has one of
|
||||
# currently use ubuntu 18.04 as a base b/c it has one of
|
||||
# the lower versions of libc among ubuntu and debian releases.
|
||||
# we could change this in the future and build with some other deb
|
||||
# based system.
|
||||
@@ -125,10 +122,8 @@ if (is_root_project)
|
||||
Builds/containers/ubuntu-builder/ubuntu_setup.sh
|
||||
bin/getRippledInfo
|
||||
Builds/containers/shared/install_cmake.sh
|
||||
Builds/containers/shared/install_boost.sh
|
||||
Builds/containers/shared/update-rippled.sh
|
||||
Builds/containers/shared/update_sources.sh
|
||||
Builds/containers/shared/build_deps.sh
|
||||
Builds/containers/shared/rippled.service
|
||||
Builds/containers/shared/rippled-reporting.service
|
||||
Builds/containers/shared/rippled-logrotate
|
||||
@@ -141,7 +136,6 @@ if (is_root_project)
|
||||
-v ${NIH_CACHE_ROOT}/pkgbuild:/opt/rippled_bld/pkg/.nih_c
|
||||
-v ${CMAKE_CURRENT_SOURCE_DIR}:/opt/rippled_bld/pkg/rippled
|
||||
-v ${CMAKE_CURRENT_BINARY_DIR}/packages:/opt/rippled_bld/pkg/out
|
||||
"$<$<BOOL:${map_user}>:--volume=/etc/passwd:/etc/passwd;--volume=/etc/group:/etc/group;--user=${DOCKER_USER_ID}:${DOCKER_GROUP_ID}>"
|
||||
-t rippled-dpkg-builder:${container_label}
|
||||
/bin/bash -c "cp -fpu rippled/Builds/containers/packaging/dpkg/build_dpkg.sh . && ./build_dpkg.sh"
|
||||
VERBATIM
|
||||
@@ -195,7 +189,6 @@ if (is_root_project)
|
||||
SOURCES
|
||||
Builds/containers/ubuntu-builder/Dockerfile
|
||||
Builds/containers/ubuntu-builder/ubuntu_setup.sh
|
||||
Builds/containers/shared/build_deps.sh
|
||||
)
|
||||
exclude_from_default (ci_container)
|
||||
else ()
|
||||
|
||||
106
Builds/CMake/SociConfig.cmake.patched
Normal file
106
Builds/CMake/SociConfig.cmake.patched
Normal file
@@ -0,0 +1,106 @@
|
||||
################################################################################
|
||||
# SociConfig.cmake - CMake build configuration of SOCI library
|
||||
################################################################################
|
||||
# Copyright (C) 2010 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
################################################################################
|
||||
|
||||
include(CheckCXXSymbolExists)
|
||||
|
||||
if(WIN32)
|
||||
check_cxx_symbol_exists("_M_AMD64" "" SOCI_TARGET_ARCH_X64)
|
||||
if(NOT RTC_ARCH_X64)
|
||||
check_cxx_symbol_exists("_M_IX86" "" SOCI_TARGET_ARCH_X86)
|
||||
endif(NOT RTC_ARCH_X64)
|
||||
# add check for arm here
|
||||
# see http://msdn.microsoft.com/en-us/library/b0084kay.aspx
|
||||
else(WIN32)
|
||||
check_cxx_symbol_exists("__i386__" "" SOCI_TARGET_ARCH_X86)
|
||||
check_cxx_symbol_exists("__x86_64__" "" SOCI_TARGET_ARCH_X64)
|
||||
check_cxx_symbol_exists("__arm__" "" SOCI_TARGET_ARCH_ARM)
|
||||
endif(WIN32)
|
||||
|
||||
if(NOT DEFINED LIB_SUFFIX)
|
||||
if(SOCI_TARGET_ARCH_X64)
|
||||
set(_lib_suffix "64")
|
||||
else()
|
||||
set(_lib_suffix "")
|
||||
endif()
|
||||
set(LIB_SUFFIX ${_lib_suffix} CACHE STRING "Specifies suffix for the lib directory")
|
||||
endif()
|
||||
|
||||
#
|
||||
# C++11 Option
|
||||
#
|
||||
|
||||
if(NOT SOCI_CXX_C11)
|
||||
set (SOCI_CXX_C11 OFF CACHE BOOL "Build to the C++11 standard")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Force compilation flags and set desired warnings level
|
||||
#
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_WARNING)
|
||||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||
|
||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /we4266")
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
set(SOCI_GCC_CLANG_COMMON_FLAGS "")
|
||||
# "-pedantic -Werror -Wno-error=parentheses -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Woverloaded-virtual -Wredundant-decls -Wno-long-long")
|
||||
|
||||
|
||||
if (SOCI_CXX_C11)
|
||||
set(SOCI_CXX_VERSION_FLAGS "-std=c++11")
|
||||
else()
|
||||
set(SOCI_CXX_VERSION_FLAGS "-std=gnu++98")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER}" MATCHES "clang")
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION LESS 3.1 AND SOCI_ASAN)
|
||||
set(SOCI_GCC_CLANG_COMMON_FLAGS "${SOCI_GCC_CLANG_COMMON_FLAGS} -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# enforce C++11 for Clang
|
||||
set(SOCI_CXX_C11 ON)
|
||||
set(SOCI_CXX_VERSION_FLAGS "-std=c++11")
|
||||
add_definitions(-DCATCH_CONFIG_CPP11_NO_IS_ENUM)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SOCI_GCC_CLANG_COMMON_FLAGS} ${SOCI_CXX_VERSION_FLAGS}")
|
||||
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION LESS 4.8 AND SOCI_ASAN)
|
||||
set(SOCI_GCC_CLANG_COMMON_FLAGS "${SOCI_GCC_CLANG_COMMON_FLAGS} -fsanitize=address")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SOCI_GCC_CLANG_COMMON_FLAGS} ${SOCI_CXX_VERSION_FLAGS} ")
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(WARNING "Unknown toolset - using default flags to build SOCI")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# Set SOCI_HAVE_* variables for soci-config.h generator
|
||||
set(SOCI_HAVE_CXX_C11 ${SOCI_CXX_C11} CACHE INTERNAL "Enables C++11 support")
|
||||
@@ -15,3 +15,5 @@ find_library (soci
|
||||
|
||||
find_path (SOCI_INCLUDE_DIR
|
||||
NAMES soci/soci.h)
|
||||
|
||||
message("SOCI FOUND AT: ${SOCI_LIB}")
|
||||
|
||||
@@ -13,7 +13,7 @@ if(reporting)
|
||||
ExternalProject_Add(postgres_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/postgres/postgres.git
|
||||
GIT_TAG master
|
||||
GIT_TAG REL_14_5
|
||||
CONFIGURE_COMMAND ./configure --without-readline > /dev/null
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E env --unset=MAKELEVEL make
|
||||
UPDATE_COMMAND ""
|
||||
|
||||
@@ -51,7 +51,8 @@ else()
|
||||
# This patch process is likely fragile and should be reviewed carefully
|
||||
# whenever we update the GIT_TAG above.
|
||||
PATCH_COMMAND
|
||||
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake/soci_patch.cmake
|
||||
${CMAKE_COMMAND} -D RIPPLED_SOURCE=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake/soci_patch.cmake
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
|
||||
@@ -2,6 +2,15 @@
|
||||
NIH dep: wasmedge: web assembly runtime for hooks.
|
||||
#]===================================================================]
|
||||
|
||||
find_package(Curses)
|
||||
if(CURSES_FOUND)
|
||||
include_directories(${CURSES_INCLUDE_DIR})
|
||||
target_link_libraries(ripple_libs INTERFACE ${CURSES_LIBRARY})
|
||||
else()
|
||||
message(WARNING "CURSES library not found... (only important for mac builds)")
|
||||
endif()
|
||||
|
||||
|
||||
find_package(LLVM REQUIRED CONFIG)
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
||||
@@ -24,6 +33,7 @@ ExternalProject_Add (wasmedge_src
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DLLVM_DIR=${LLVM_DIR}
|
||||
-DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
|
||||
-DLLVM_ENABLE_TERMINFO=OFF
|
||||
$<$<NOT:$<BOOL:${is_multiconfig}>>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}>
|
||||
$<$<BOOL:${MSVC}>:
|
||||
"-DCMAKE_C_FLAGS=-GR -Gd -fp:precise -FS -MP -march=native"
|
||||
@@ -63,4 +73,12 @@ set_target_properties (wasmedge PROPERTIES
|
||||
"${wasmedge_src_BINARY_DIR}/include/api/"
|
||||
)
|
||||
target_link_libraries (ripple_libs INTERFACE wasmedge)
|
||||
#RH NOTE: some compilers / versions of some libraries need these, most don't
|
||||
|
||||
find_library(XAR_LIBRARY NAMES xar)
|
||||
if(XAR_LIBRARY)
|
||||
target_link_libraries(ripple_libs INTERFACE ${XAR_LIBRARY})
|
||||
else()
|
||||
message(WARNING "xar library not found... (only important for mac builds)")
|
||||
endif()
|
||||
add_library (NIH::WasmEdge ALIAS wasmedge)
|
||||
|
||||
@@ -11,7 +11,7 @@ if(reporting)
|
||||
ExternalProject_Add(zlib_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/madler/zlib.git
|
||||
GIT_TAG master
|
||||
GIT_TAG v1.2.12
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/${ep_lib_prefix}z.a
|
||||
LOG_BUILD TRUE
|
||||
@@ -45,7 +45,7 @@ if(reporting)
|
||||
ExternalProject_Add(krb5_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/krb5/krb5.git
|
||||
GIT_TAG master
|
||||
GIT_TAG krb5-1.20-final
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND autoreconf src && CFLAGS=-fcommon ./src/configure --enable-static --disable-shared > /dev/null
|
||||
BUILD_IN_SOURCE 1
|
||||
@@ -80,7 +80,7 @@ if(reporting)
|
||||
ExternalProject_Add(libuv_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||
GIT_TAG v1.x
|
||||
GIT_TAG v1.44.2
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS <BINARY_DIR>/${ep_lib_prefix}uv_a.a
|
||||
LOG_BUILD TRUE
|
||||
@@ -106,7 +106,7 @@ if(reporting)
|
||||
ExternalProject_Add(cassandra_src
|
||||
PREFIX ${nih_cache_path}
|
||||
GIT_REPOSITORY https://github.com/datastax/cpp-driver.git
|
||||
GIT_TAG master
|
||||
GIT_TAG 2.16.2
|
||||
CMAKE_ARGS
|
||||
-DLIBUV_ROOT_DIR=${BINARY_DIR}
|
||||
-DLIBUV_LIBARY=${BINARY_DIR}/libuv_a.a
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
# so as to remove type range check exceptions that cause
|
||||
# us trouble when using boost::optional to select int values
|
||||
|
||||
# Soci's CMake setup leaves flags in place that will cause warnings to
|
||||
# be treated as errors, but some compiler versions throw "new" warnings
|
||||
# that then cause the build to fail. Simplify that until soci fixes
|
||||
# those warnings.
|
||||
if (RIPPLED_SOURCE)
|
||||
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${RIPPLED_SOURCE}/Builds/CMake/SociConfig.cmake.patched
|
||||
cmake/SociConfig.cmake )
|
||||
endif ()
|
||||
|
||||
# Some versions of CMake erroneously patch external projects on every build.
|
||||
# If the patch makes no changes, skip it. This workaround can be
|
||||
# removed once we stop supporting vulnerable versions of CMake.
|
||||
|
||||
1
Builds/README.md
Normal file
1
Builds/README.md
Normal file
@@ -0,0 +1 @@
|
||||
[Please see the BUILD instructions here](../BUILD.md)
|
||||
@@ -1,263 +1 @@
|
||||
# Visual Studio 2017 Build Instructions
|
||||
|
||||
## Important
|
||||
|
||||
We do not recommend Windows for rippled production use at this time. Currently,
|
||||
the Ubuntu platform has received the highest level of quality assurance,
|
||||
testing, and support. Additionally, 32-bit Windows versions are not supported.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To clone the source code repository, create branches for inspection or
|
||||
modification, build rippled under Visual Studio, and run the unit tests you will
|
||||
need these software components
|
||||
|
||||
| Component | Minimum Recommended Version |
|
||||
|-----------|-----------------------|
|
||||
| [Visual Studio 2017](README.md#install-visual-studio-2017)| 15.5.4 |
|
||||
| [Git for Windows](README.md#install-git-for-windows)| 2.16.1 |
|
||||
| [OpenSSL Library](README.md#install-openssl) | 1.1.1L |
|
||||
| [Boost library](README.md#build-boost) | 1.70.0 |
|
||||
| [CMake for Windows](README.md#optional-install-cmake-for-windows)* | 3.12 |
|
||||
|
||||
\* Only needed if not using the integrated CMake in VS 2017 and prefer generating dedicated project/solution files.
|
||||
|
||||
## Install Software
|
||||
|
||||
### Install Visual Studio 2017
|
||||
|
||||
If not already installed on your system, download your choice of installer from
|
||||
the [Visual Studio 2017
|
||||
Download](https://www.visualstudio.com/downloads/download-visual-studio-vs)
|
||||
page, run the installer, and follow the directions. **You may need to choose the
|
||||
`Desktop development with C++` workload to install all necessary C++ features.**
|
||||
|
||||
Any version of Visual Studio 2017 may be used to build rippled. The **Visual
|
||||
Studio 2017 Community** edition is available free of charge (see [the product
|
||||
page](https://www.visualstudio.com/products/visual-studio-community-vs) for
|
||||
licensing details), while paid editions may be used for an initial free-trial
|
||||
period.
|
||||
|
||||
### Install Git for Windows
|
||||
|
||||
Git is a distributed revision control system. The Windows version also provides
|
||||
the bash shell and many Windows versions of Unix commands. While there are other
|
||||
varieties of Git (such as TortoiseGit, which has a native Windows interface and
|
||||
integrates with the Explorer shell), we recommend installing [Git for
|
||||
Windows](https://git-scm.com/) since it provides a Unix-like command line
|
||||
environment useful for running shell scripts. Use of the bash shell under
|
||||
Windows is mandatory for running the unit tests.
|
||||
|
||||
### Install OpenSSL
|
||||
|
||||
[Download the latest version of
|
||||
OpenSSL.](http://slproweb.com/products/Win32OpenSSL.html) There will
|
||||
several `Win64` bit variants available, you want the non-light
|
||||
`v1.1` line. As of this writing, you **should** select
|
||||
|
||||
* Win64 OpenSSL v1.1.1L
|
||||
|
||||
and should **not** select
|
||||
|
||||
* Anything with "Win32" in the name
|
||||
* Anything with "light" in the name
|
||||
* Anything with "EXPERIMENTAL" in the name
|
||||
* Anything in the 3.0 line - rippled won't currently build with this version.
|
||||
|
||||
Run the installer, and choose an appropriate location for your OpenSSL
|
||||
installation. In this guide we use `C:\lib\OpenSSL-Win64` as the destination
|
||||
location.
|
||||
|
||||
You may be informed on running the installer that "Visual C++ 2008
|
||||
Redistributables" must first be installed first. If so, download it from the
|
||||
[same page](http://slproweb.com/products/Win32OpenSSL.html), again making sure
|
||||
to get the correct 32-/64-bit variant.
|
||||
|
||||
* NOTE: Since rippled links statically to OpenSSL, it does not matter where the
|
||||
OpenSSL .DLL files are placed, or what version they are. rippled does not use
|
||||
or require any external .DLL files to run other than the standard operating
|
||||
system ones.
|
||||
|
||||
### Build Boost
|
||||
|
||||
Boost 1.70 or later is required.
|
||||
|
||||
After [downloading boost](http://www.boost.org/users/download/) and unpacking it
|
||||
to `c:\lib`. As of this writing, the most recent version of boost is 1.70.0,
|
||||
which will unpack into a directory named `boost_1_70_0`. We recommended either
|
||||
renaming this directory to `boost`, or creating a junction link `mklink /J boost
|
||||
boost_1_70_0`, so that you can more easily switch between versions.
|
||||
|
||||
Next, open **Developer Command Prompt** and type the following commands
|
||||
|
||||
```powershell
|
||||
cd C:\lib\boost
|
||||
bootstrap
|
||||
```
|
||||
|
||||
The rippled application is linked statically to the standard runtimes and
|
||||
external dependencies on Windows, to ensure that the behavior of the executable
|
||||
is not affected by changes in outside files. Therefore, it is necessary to build
|
||||
the required boost static libraries using this command:
|
||||
|
||||
```powershell
|
||||
bjam -j<Num Parallel> --toolset=msvc-14.1 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared,static stage
|
||||
```
|
||||
|
||||
where you should replace `<Num Parallel>` with the number of parallel
|
||||
invocations to use build, e.g. `bjam -j4 ...` would use up to 4 concurrent build
|
||||
shell commands for the build.
|
||||
|
||||
Building the boost libraries may take considerable time. When the build process
|
||||
is completed, take note of both the reported compiler include paths and linker
|
||||
library paths as they will be required later.
|
||||
|
||||
### (Optional) Install CMake for Windows
|
||||
|
||||
[CMake](http://cmake.org) is a cross platform build system generator. Visual
|
||||
Studio 2017 includes an integrated version of CMake that avoids having to
|
||||
manually run CMake, but it is undergoing continuous improvement. Users that
|
||||
prefer to use standard Visual Studio project and solution files need to install
|
||||
a dedicated version of CMake to generate them. The latest version can be found
|
||||
at the [CMake download site](https://cmake.org/download/). It is recommended you
|
||||
select the install option to add CMake to your path.
|
||||
|
||||
## Clone the rippled repository
|
||||
|
||||
If you are familiar with cloning github repositories, just follow your normal
|
||||
process and clone `git@github.com:ripple/rippled.git`. Otherwise follow this
|
||||
section for instructions.
|
||||
|
||||
1. If you don't have a github account, sign up for one at
|
||||
[github.com](https://github.com/).
|
||||
2. Make sure you have Github ssh keys. For help see
|
||||
[generating-ssh-keys](https://help.github.com/articles/generating-ssh-keys).
|
||||
|
||||
Open the "Git Bash" shell that was installed with "Git for Windows" in the step
|
||||
above. Navigate to the directory where you want to clone rippled (git bash uses
|
||||
`/c` for windows's `C:` and forward slash where windows uses backslash, so
|
||||
`C:\Users\joe\projs` would be `/c/Users/joe/projs` in git bash). Now clone the
|
||||
repository and optionally switch to the *master* branch. Type the following at
|
||||
the bash prompt:
|
||||
|
||||
```powershell
|
||||
git clone git@github.com:ripple/rippled.git
|
||||
cd rippled
|
||||
```
|
||||
If you receive an error about not having the "correct access rights" make sure
|
||||
you have Github ssh keys, as described above.
|
||||
|
||||
For a stable release, choose the `master` branch or one of the tagged releases
|
||||
listed on [rippled's GitHub page](https://github.com/ripple/rippled/releases).
|
||||
|
||||
```
|
||||
git checkout master
|
||||
```
|
||||
|
||||
To test the latest release candidate, choose the `release` branch.
|
||||
|
||||
```
|
||||
git checkout release
|
||||
```
|
||||
|
||||
If you are doing development work and want the latest set of untested features,
|
||||
you can consider using the `develop` branch instead.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
# Build using Visual Studio integrated CMake
|
||||
|
||||
In Visual Studio 2017, Microsoft added [integrated IDE support for
|
||||
cmake](https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/).
|
||||
To begin, simply:
|
||||
|
||||
1. Launch Visual Studio and choose **File | Open | Folder**, navigating to the
|
||||
cloned rippled folder.
|
||||
2. Right-click on `CMakeLists.txt` in the **Solution Explorer - Folder View** to
|
||||
generate a `CMakeSettings.json` file. A sample settings file is provided
|
||||
[here](/Builds/VisualStudio2017/CMakeSettings-example.json). Customize the
|
||||
settings for `BOOST_ROOT`, `OPENSSL_ROOT` to match the install paths if they
|
||||
differ from those in the file.
|
||||
4. Select either the `x64-Release` or `x64-Debug` configuration from the
|
||||
**Project Setings** drop-down. This should invoke the built-in CMake project
|
||||
generator. If not, you can right-click on the `CMakeLists.txt` file and
|
||||
choose **Cache | Generate Cache**.
|
||||
5. Select either the `rippled.exe` (unity) or `rippled_classic.exe` (non-unity)
|
||||
option in the **Select Startup Item** drop-down. This will be the target
|
||||
built when you press F7. Alternatively, you can choose a target to build from
|
||||
the top-level **CMake | Build** menu. Note that at this time, there are other
|
||||
targets listed that come from third party visual studio files embedded in the
|
||||
rippled repo, e.g. `datagen.vcxproj`. Please ignore them.
|
||||
|
||||
For details on configuring debugging sessions or further customization of CMake,
|
||||
please refer to the [CMake tools for VS
|
||||
documentation](https://docs.microsoft.com/en-us/cpp/ide/cmake-tools-for-visual-cpp).
|
||||
|
||||
If using the provided `CMakeSettings.json` file, the executable will be in
|
||||
```
|
||||
.\build\x64-Release\Release\rippled.exe
|
||||
```
|
||||
or
|
||||
```
|
||||
.\build\x64-Debug\Debug\rippled.exe
|
||||
```
|
||||
These paths are relative to your cloned git repository.
|
||||
|
||||
# Build using stand-alone CMake
|
||||
|
||||
This requires having installed [CMake for
|
||||
Windows](README.md#optional-install-cmake-for-windows). We do not recommend
|
||||
mixing this method with the integrated CMake method for the same repository
|
||||
clone. Assuming you included the cmake executable folder in your path,
|
||||
execute the following commands within your `rippled` cloned repository:
|
||||
|
||||
```
|
||||
mkdir build\cmake
|
||||
cd build\cmake
|
||||
cmake ..\.. -G"Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:\lib\boost_1_70_0" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64" -DCMAKE_GENERATOR_TOOLSET=host=x64
|
||||
```
|
||||
Now launch Visual Studio 2017 and select **File | Open | Project/Solution**.
|
||||
Navigate to the `build\cmake` folder created above and select the `rippled.sln`
|
||||
file. You can then choose whether to build the `Debug` or `Release` solution
|
||||
configuration.
|
||||
|
||||
The executable will be in
|
||||
```
|
||||
.\build\cmake\Release\rippled.exe
|
||||
```
|
||||
or
|
||||
```
|
||||
.\build\cmake\Debug\rippled.exe
|
||||
```
|
||||
These paths are relative to your cloned git repository.
|
||||
|
||||
# Unity/No-Unity Builds
|
||||
|
||||
The rippled build system defaults to using
|
||||
[unity source files](http://onqtam.com/programming/2018-07-07-unity-builds/)
|
||||
to improve build times. In some cases it might be desirable to disable the
|
||||
unity build and compile individual translation units. Here is how you can
|
||||
switch to a "no-unity" build configuration:
|
||||
|
||||
## Visual Studio Integrated CMake
|
||||
|
||||
Edit your `CmakeSettings.json` (described above) by adding `-Dunity=OFF`
|
||||
to the `cmakeCommandArgs` entry for each build configuration.
|
||||
|
||||
## Standalone CMake Builds
|
||||
|
||||
When running cmake to generate the Visual Studio project files, add
|
||||
`-Dunity=OFF` to the command line options passed to cmake.
|
||||
|
||||
**Note:** you will need to re-run the cmake configuration step anytime you
|
||||
want to switch between unity/no-unity builds.
|
||||
|
||||
# Unit Test (Recommended)
|
||||
|
||||
`rippled` builds a set of unit tests into the server executable. To run these
|
||||
unit tests after building, pass the `--unittest` option to the compiled
|
||||
`rippled` executable. The executable will exit with summary info after running
|
||||
the unit tests.
|
||||
|
||||
[Build instructions are currently located in `BUILD.md`](../../BUILD.md)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${thisFileDir}\\build\\${name}",
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${thisFileDir}\\build\\${name}",
|
||||
263
Builds/VisualStudio2019/README.md
Normal file
263
Builds/VisualStudio2019/README.md
Normal file
@@ -0,0 +1,263 @@
|
||||
# Visual Studio 2019 Build Instructions
|
||||
|
||||
## Important
|
||||
|
||||
We do not recommend Windows for rippled production use at this time. Currently,
|
||||
the Ubuntu platform has received the highest level of quality assurance,
|
||||
testing, and support. Additionally, 32-bit Windows versions are not supported.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To clone the source code repository, create branches for inspection or
|
||||
modification, build rippled under Visual Studio, and run the unit tests you will
|
||||
need these software components
|
||||
|
||||
| Component | Minimum Recommended Version |
|
||||
|-----------|-----------------------|
|
||||
| [Visual Studio 2019](README.md#install-visual-studio-2019)| 15.5.4 |
|
||||
| [Git for Windows](README.md#install-git-for-windows)| 2.16.1 |
|
||||
| [OpenSSL Library](README.md#install-openssl) | 1.1.1L |
|
||||
| [Boost library](README.md#build-boost) | 1.70.0 |
|
||||
| [CMake for Windows](README.md#optional-install-cmake-for-windows)* | 3.12 |
|
||||
|
||||
\* Only needed if not using the integrated CMake in VS 2019 and prefer generating dedicated project/solution files.
|
||||
|
||||
## Install Software
|
||||
|
||||
### Install Visual Studio 2019
|
||||
|
||||
If not already installed on your system, download your choice of installer from
|
||||
the [Visual Studio 2019
|
||||
Download](https://www.visualstudio.com/downloads/download-visual-studio-vs)
|
||||
page, run the installer, and follow the directions. **You may need to choose the
|
||||
`Desktop development with C++` workload to install all necessary C++ features.**
|
||||
|
||||
Any version of Visual Studio 2019 may be used to build rippled. The **Visual
|
||||
Studio 2019 Community** edition is available free of charge (see [the product
|
||||
page](https://www.visualstudio.com/products/visual-studio-community-vs) for
|
||||
licensing details), while paid editions may be used for an initial free-trial
|
||||
period.
|
||||
|
||||
### Install Git for Windows
|
||||
|
||||
Git is a distributed revision control system. The Windows version also provides
|
||||
the bash shell and many Windows versions of Unix commands. While there are other
|
||||
varieties of Git (such as TortoiseGit, which has a native Windows interface and
|
||||
integrates with the Explorer shell), we recommend installing [Git for
|
||||
Windows](https://git-scm.com/) since it provides a Unix-like command line
|
||||
environment useful for running shell scripts. Use of the bash shell under
|
||||
Windows is mandatory for running the unit tests.
|
||||
|
||||
### Install OpenSSL
|
||||
|
||||
[Download the latest version of
|
||||
OpenSSL.](http://slproweb.com/products/Win32OpenSSL.html) There will
|
||||
several `Win64` bit variants available, you want the non-light
|
||||
`v1.1` line. As of this writing, you **should** select
|
||||
|
||||
* Win64 OpenSSL v1.1.1q
|
||||
|
||||
and should **not** select
|
||||
|
||||
* Anything with "Win32" in the name
|
||||
* Anything with "light" in the name
|
||||
* Anything with "EXPERIMENTAL" in the name
|
||||
* Anything in the 3.0 line - rippled won't currently build with this version.
|
||||
|
||||
Run the installer, and choose an appropriate location for your OpenSSL
|
||||
installation. In this guide we use `C:\lib\OpenSSL-Win64` as the destination
|
||||
location.
|
||||
|
||||
You may be informed on running the installer that "Visual C++ 2008
|
||||
Redistributables" must first be installed first. If so, download it from the
|
||||
[same page](http://slproweb.com/products/Win32OpenSSL.html), again making sure
|
||||
to get the correct 32-/64-bit variant.
|
||||
|
||||
* NOTE: Since rippled links statically to OpenSSL, it does not matter where the
|
||||
OpenSSL .DLL files are placed, or what version they are. rippled does not use
|
||||
or require any external .DLL files to run other than the standard operating
|
||||
system ones.
|
||||
|
||||
### Build Boost
|
||||
|
||||
Boost 1.70 or later is required.
|
||||
|
||||
[Download boost](http://www.boost.org/users/download/) and unpack it
|
||||
to `c:\lib`. As of this writing, the most recent version of boost is 1.80.0,
|
||||
which will unpack into a directory named `boost_1_80_0`. We recommended either
|
||||
renaming this directory to `boost`, or creating a junction link `mklink /J boost
|
||||
boost_1_80_0`, so that you can more easily switch between versions.
|
||||
|
||||
Next, open **Developer Command Prompt** and type the following commands
|
||||
|
||||
```powershell
|
||||
cd C:\lib\boost
|
||||
bootstrap
|
||||
```
|
||||
|
||||
The rippled application is linked statically to the standard runtimes and
|
||||
external dependencies on Windows, to ensure that the behavior of the executable
|
||||
is not affected by changes in outside files. Therefore, it is necessary to build
|
||||
the required boost static libraries using this command:
|
||||
|
||||
```powershell
|
||||
b2 -j<Num Parallel> --toolset=msvc-14.2 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared,static stage
|
||||
```
|
||||
|
||||
where you should replace `<Num Parallel>` with the number of parallel
|
||||
invocations to use build, e.g. `bjam -j8 ...` would use up to 8 concurrent build
|
||||
shell commands for the build.
|
||||
|
||||
Building the boost libraries may take considerable time. When the build process
|
||||
is completed, take note of both the reported compiler include paths and linker
|
||||
library paths as they will be required later.
|
||||
|
||||
### (Optional) Install CMake for Windows
|
||||
|
||||
[CMake](http://cmake.org) is a cross platform build system generator. Visual
|
||||
Studio 2019 includes an integrated version of CMake that avoids having to
|
||||
manually run CMake, but it is undergoing continuous improvement. Users that
|
||||
prefer to use standard Visual Studio project and solution files need to install
|
||||
a dedicated version of CMake to generate them. The latest version can be found
|
||||
at the [CMake download site](https://cmake.org/download/). It is recommended you
|
||||
select the install option to add CMake to your path.
|
||||
|
||||
## Clone the rippled repository
|
||||
|
||||
If you are familiar with cloning github repositories, just follow your normal
|
||||
process and clone `git@github.com:ripple/rippled.git`. Otherwise follow this
|
||||
section for instructions.
|
||||
|
||||
1. If you don't have a github account, sign up for one at
|
||||
[github.com](https://github.com/).
|
||||
2. Make sure you have Github ssh keys. For help see
|
||||
[generating-ssh-keys](https://help.github.com/articles/generating-ssh-keys).
|
||||
|
||||
Open the "Git Bash" shell that was installed with "Git for Windows" in the step
|
||||
above. Navigate to the directory where you want to clone rippled (git bash uses
|
||||
`/c` for windows's `C:` and forward slash where windows uses backslash, so
|
||||
`C:\Users\joe\projs` would be `/c/Users/joe/projs` in git bash). Now clone the
|
||||
repository and optionally switch to the *master* branch. Type the following at
|
||||
the bash prompt:
|
||||
|
||||
```powershell
|
||||
git clone git@github.com:XRPLF/rippled.git
|
||||
cd rippled
|
||||
```
|
||||
If you receive an error about not having the "correct access rights" make sure
|
||||
you have Github ssh keys, as described above.
|
||||
|
||||
For a stable release, choose the `master` branch or one of the tagged releases
|
||||
listed on [rippled's GitHub page](https://github.com/ripple/rippled/releases).
|
||||
|
||||
```
|
||||
git checkout master
|
||||
```
|
||||
|
||||
To test the latest release candidate, choose the `release` branch.
|
||||
|
||||
```
|
||||
git checkout release
|
||||
```
|
||||
|
||||
If you are doing development work and want the latest set of beta features,
|
||||
you can consider using the `develop` branch instead.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
# Build using Visual Studio integrated CMake
|
||||
|
||||
In Visual Studio 2017, Microsoft added [integrated IDE support for
|
||||
cmake](https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/).
|
||||
To begin, simply:
|
||||
|
||||
1. Launch Visual Studio and choose **File | Open | Folder**, navigating to the
|
||||
cloned rippled folder.
|
||||
2. Right-click on `CMakeLists.txt` in the **Solution Explorer - Folder View** to
|
||||
generate a `CMakeSettings.json` file. A sample settings file is provided
|
||||
[here](/Builds/VisualStudio2019/CMakeSettings-example.json). Customize the
|
||||
settings for `BOOST_ROOT`, `OPENSSL_ROOT` to match the install paths if they
|
||||
differ from those in the file.
|
||||
4. Select either the `x64-Release` or `x64-Debug` configuration from the
|
||||
**Project Settings** drop-down. This should invoke the built-in CMake project
|
||||
generator. If not, you can right-click on the `CMakeLists.txt` file and
|
||||
choose **Configure rippled**.
|
||||
5. Select the `rippled.exe`
|
||||
option in the **Select Startup Item** drop-down. This will be the target
|
||||
built when you press F7. Alternatively, you can choose a target to build from
|
||||
the top-level **CMake | Build** menu. Note that at this time, there are other
|
||||
targets listed that come from third party visual studio files embedded in the
|
||||
rippled repo, e.g. `datagen.vcxproj`. Please ignore them.
|
||||
|
||||
For details on configuring debugging sessions or further customization of CMake,
|
||||
please refer to the [CMake tools for VS
|
||||
documentation](https://docs.microsoft.com/en-us/cpp/ide/cmake-tools-for-visual-cpp).
|
||||
|
||||
If using the provided `CMakeSettings.json` file, the executable will be in
|
||||
```
|
||||
.\build\x64-Release\Release\rippled.exe
|
||||
```
|
||||
or
|
||||
```
|
||||
.\build\x64-Debug\Debug\rippled.exe
|
||||
```
|
||||
These paths are relative to your cloned git repository.
|
||||
|
||||
# Build using stand-alone CMake
|
||||
|
||||
This requires having installed [CMake for
|
||||
Windows](README.md#optional-install-cmake-for-windows). We do not recommend
|
||||
mixing this method with the integrated CMake method for the same repository
|
||||
clone. Assuming you included the cmake executable folder in your path,
|
||||
execute the following commands within your `rippled` cloned repository:
|
||||
|
||||
```
|
||||
mkdir build\cmake
|
||||
cd build\cmake
|
||||
cmake ..\.. -G"Visual Studio 16 2019" -Ax64 -DBOOST_ROOT="C:\lib\boost" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64" -DCMAKE_GENERATOR_TOOLSET=host=x64
|
||||
```
|
||||
Now launch Visual Studio 2019 and select **File | Open | Project/Solution**.
|
||||
Navigate to the `build\cmake` folder created above and select the `rippled.sln`
|
||||
file. You can then choose whether to build the `Debug` or `Release` solution
|
||||
configuration.
|
||||
|
||||
The executable will be in
|
||||
```
|
||||
.\build\cmake\Release\rippled.exe
|
||||
```
|
||||
or
|
||||
```
|
||||
.\build\cmake\Debug\rippled.exe
|
||||
```
|
||||
These paths are relative to your cloned git repository.
|
||||
|
||||
# Unity/No-Unity Builds
|
||||
|
||||
The rippled build system defaults to using
|
||||
[unity source files](http://onqtam.com/programming/2018-07-07-unity-builds/)
|
||||
to improve build times. In some cases it might be desirable to disable the
|
||||
unity build and compile individual translation units. Here is how you can
|
||||
switch to a "no-unity" build configuration:
|
||||
|
||||
## Visual Studio Integrated CMake
|
||||
|
||||
Edit your `CmakeSettings.json` (described above) by adding `-Dunity=OFF`
|
||||
to the `cmakeCommandArgs` entry for each build configuration.
|
||||
|
||||
## Standalone CMake Builds
|
||||
|
||||
When running cmake to generate the Visual Studio project files, add
|
||||
`-Dunity=OFF` to the command line options passed to cmake.
|
||||
|
||||
**Note:** you will need to re-run the cmake configuration step anytime you
|
||||
want to switch between unity/no-unity builds.
|
||||
|
||||
# Unit Test (Recommended)
|
||||
|
||||
`rippled` builds a set of unit tests into the server executable. To run these
|
||||
unit tests after building, pass the `--unittest` option to the compiled
|
||||
`rippled` executable. The executable will exit with summary info after running
|
||||
the unit tests.
|
||||
|
||||
@@ -1,43 +1,26 @@
|
||||
FROM centos:7
|
||||
FROM rippleci/centos:7
|
||||
ARG GIT_COMMIT=unknown
|
||||
ARG CI_USE=false
|
||||
|
||||
LABEL git-commit=$GIT_COMMIT
|
||||
|
||||
COPY centos-builder/centos_setup.sh /tmp/
|
||||
COPY shared/build_deps.sh /tmp/
|
||||
COPY shared/install_cmake.sh /tmp/
|
||||
COPY centos-builder/extras.sh /tmp/
|
||||
COPY shared/install_boost.sh /tmp/
|
||||
RUN chmod +x /tmp/centos_setup.sh && \
|
||||
chmod +x /tmp/build_deps.sh && \
|
||||
chmod +x /tmp/install_boost.sh && \
|
||||
chmod +x /tmp/install_cmake.sh && \
|
||||
chmod +x /tmp/extras.sh
|
||||
chmod +x /tmp/install_cmake.sh
|
||||
RUN /tmp/centos_setup.sh
|
||||
|
||||
RUN /tmp/install_cmake.sh 3.16.1 /opt/local/cmake-3.16
|
||||
RUN /tmp/install_cmake.sh 3.16.3 /opt/local/cmake-3.16
|
||||
RUN ln -s /opt/local/cmake-3.16 /opt/local/cmake
|
||||
ENV PATH="/opt/local/cmake/bin:$PATH"
|
||||
# also install min supported cmake for testing
|
||||
RUN if [ "${CI_USE}" = true ] ; then /tmp/install_cmake.sh 3.9.0 /opt/local/cmake-3.9; fi
|
||||
# TODO: Install latest CMake for testing
|
||||
RUN if [ "${CI_USE}" = true ] ; then /tmp/install_cmake.sh 3.16.3 /opt/local/cmake-3.16; fi
|
||||
|
||||
RUN source scl_source enable devtoolset-7 python27 && \
|
||||
/tmp/build_deps.sh
|
||||
ENV BOOST_ROOT="/opt/local/boost/_INSTALLED_"
|
||||
ENV PLANTUML_JAR="/opt/plantuml/plantuml.jar"
|
||||
ENV OPENSSL_ROOT="/opt/local/openssl"
|
||||
ENV GDB_ROOT="/opt/local/gdb"
|
||||
RUN source scl_source enable devtoolset-7 python27 && \
|
||||
/tmp/extras.sh
|
||||
|
||||
# prep files for package building
|
||||
RUN mkdir -m 777 -p /opt/rippled_bld/pkg
|
||||
|
||||
WORKDIR /opt/rippled_bld/pkg
|
||||
RUN mkdir -m 777 ./rpmbuild
|
||||
RUN mkdir -m 777 ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||
|
||||
COPY packaging/rpm/build_rpm.sh ./
|
||||
CMD ./build_rpm.sh
|
||||
|
||||
|
||||
|
||||
@@ -7,31 +7,16 @@ yum -y upgrade
|
||||
yum -y update
|
||||
yum -y install epel-release centos-release-scl
|
||||
yum -y install \
|
||||
wget curl time gcc-c++ time yum-utils autoconf automake pkgconfig libtool \
|
||||
wget curl time gcc-c++ yum-utils autoconf automake pkgconfig libtool \
|
||||
libstdc++-static rpm-build gnupg which make cmake \
|
||||
devtoolset-7 devtoolset-7-gdb devtoolset-7-libasan-devel devtoolset-7-libtsan-devel devtoolset-7-libubsan-devel \
|
||||
devtoolset-8 devtoolset-8-gdb devtoolset-8-binutils devtoolset-8-libstdc++-devel \
|
||||
devtoolset-8-libasan-devel devtoolset-8-libtsan-devel devtoolset-8-libubsan-devel devtoolset-8-liblsan-devel \
|
||||
devtoolset-11 devtoolset-11-gdb devtoolset-11-binutils devtoolset-11-libstdc++-devel \
|
||||
devtoolset-11-libasan-devel devtoolset-11-libtsan-devel devtoolset-11-libubsan-devel devtoolset-11-liblsan-devel \
|
||||
flex flex-devel bison bison-devel parallel \
|
||||
ncurses ncurses-devel ncurses-libs graphviz graphviz-devel \
|
||||
lzip p7zip bzip2 bzip2-devel lzma-sdk lzma-sdk-devel xz-devel \
|
||||
zlib zlib-devel zlib-static texinfo openssl openssl-static \
|
||||
jemalloc jemalloc-devel \
|
||||
libicu-devel htop \
|
||||
python27-python rh-python35-python \
|
||||
python-devel python27-python-devel rh-python35-python-devel \
|
||||
python27 rh-python35 \
|
||||
rh-python38 \
|
||||
ninja-build git svn \
|
||||
swig perl-Digest-MD5 python2-pip
|
||||
|
||||
if [ "${CI_USE}" = true ] ; then
|
||||
# TODO need permanent link
|
||||
yum -y install ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora-secondary/updates/26/i386/Packages/p/python2-six-1.10.0-9.fc26.noarch.rpm
|
||||
|
||||
yum -y install \
|
||||
llvm-toolset-7 llvm-toolset-7-runtime llvm-toolset-7-build llvm-toolset-7-clang \
|
||||
llvm-toolset-7-clang-analyzer llvm-toolset-7-clang-devel llvm-toolset-7-clang-libs \
|
||||
llvm-toolset-7-clang-tools-extra llvm-toolset-7-compiler-rt llvm-toolset-7-lldb \
|
||||
llvm-toolset-7-lldb-devel llvm-toolset-7-python-lldb
|
||||
|
||||
fi
|
||||
swig perl-Digest-MD5
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
if [ "${CI_USE}" = true ] ; then
|
||||
cd /tmp
|
||||
wget https://ftp.gnu.org/gnu/gdb/gdb-8.3.1.tar.xz
|
||||
tar xf gdb-8.3.1.tar.xz
|
||||
cd gdb-8.3
|
||||
./configure CFLAGS="-w -O2" CXXFLAGS="-std=gnu++11 -g -O2 -w" --prefix=/opt/local/gdb-8.3
|
||||
make -j$(nproc)
|
||||
make install
|
||||
ln -s /opt/local/gdb-8.3 /opt/local/gdb
|
||||
cd ..
|
||||
rm -f gdb-8.3.tar.xz
|
||||
rm -rf gdb-8.3
|
||||
|
||||
# clang from source
|
||||
cd /tmp
|
||||
git clone https://github.com/llvm/llvm-project.git
|
||||
cd llvm-project
|
||||
git checkout llvmorg-9.0.0
|
||||
INSTALL=/opt/llvm-9/
|
||||
mkdir mybuilddir && cd mybuilddir
|
||||
# TODO figure out necessary options
|
||||
cmake ../llvm -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;libcxx;libcxxabi;lldb;compiler-rt;lld;polly' \
|
||||
-DCMAKE_INSTALL_PREFIX=${INSTALL} \
|
||||
-DLLVM_LIBDIR_SUFFIX=64
|
||||
cmake --build . --parallel --target install
|
||||
cd /tmp
|
||||
rm -rf llvm-project
|
||||
fi
|
||||
@@ -11,10 +11,10 @@ variables:
|
||||
# these containers are built manually using the rippled
|
||||
# cmake build (container targets) and tagged/pushed so they
|
||||
# can be used here
|
||||
RPM_CONTAINER_TAG: "2020-02-10"
|
||||
RPM_CONTAINER_TAG: "2023-02-13"
|
||||
RPM_CONTAINER_NAME: "rippled-rpm-builder"
|
||||
RPM_CONTAINER_FULLNAME: "${RPM_CONTAINER_NAME}:${RPM_CONTAINER_TAG}"
|
||||
DPKG_CONTAINER_TAG: "2020-02-10"
|
||||
DPKG_CONTAINER_TAG: "2023-03-20"
|
||||
DPKG_CONTAINER_NAME: "rippled-dpkg-builder"
|
||||
DPKG_CONTAINER_FULLNAME: "${DPKG_CONTAINER_NAME}:${DPKG_CONTAINER_TAG}"
|
||||
ARTIFACTORY_HOST: "artifactory.ops.ripple.com"
|
||||
@@ -83,6 +83,7 @@ stages:
|
||||
#########################################################################
|
||||
|
||||
rpm_build:
|
||||
timeout: "1h 30m"
|
||||
stage: build_packages
|
||||
<<: *dind_param
|
||||
artifacts:
|
||||
@@ -92,6 +93,7 @@ rpm_build:
|
||||
- . ./Builds/containers/gitlab-ci/build_package.sh rpm
|
||||
|
||||
dpkg_build:
|
||||
timeout: "1h 30m"
|
||||
stage: build_packages
|
||||
<<: *dind_param
|
||||
artifacts:
|
||||
@@ -179,47 +181,38 @@ centos_7_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
- rpm_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/centos:7
|
||||
<<: *run_local_smoketest
|
||||
|
||||
# TODO: Remove "allow_failure" when tests fixed
|
||||
rocky_8_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
- rpm_sign
|
||||
image:
|
||||
name: rockylinux/rockylinux:8
|
||||
name: artifactory.ops.ripple.com/rockylinux/rockylinux:8
|
||||
<<: *run_local_smoketest
|
||||
allow_failure: true
|
||||
|
||||
fedora_34_smoketest:
|
||||
fedora_37_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
- rpm_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:34
|
||||
name: artifactory.ops.ripple.com/fedora:37
|
||||
<<: *run_local_smoketest
|
||||
allow_failure: true
|
||||
|
||||
fedora_35_smoketest:
|
||||
fedora_38_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- rpm_build
|
||||
- rpm_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:35
|
||||
name: artifactory.ops.ripple.com/fedora:38
|
||||
<<: *run_local_smoketest
|
||||
allow_failure: true
|
||||
|
||||
ubuntu_18_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- dpkg_build
|
||||
- dpkg_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/ubuntu:18.04
|
||||
<<: *run_local_smoketest
|
||||
@@ -228,36 +221,22 @@ ubuntu_20_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- dpkg_build
|
||||
- dpkg_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/ubuntu:20.04
|
||||
<<: *run_local_smoketest
|
||||
|
||||
# TODO: remove "allow_failure" when 22.04 released in 4/2022...
|
||||
ubuntu_22_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- dpkg_build
|
||||
- dpkg_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/ubuntu:22.04
|
||||
<<: *run_local_smoketest
|
||||
allow_failure: true
|
||||
|
||||
debian_9_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- dpkg_build
|
||||
- dpkg_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:9
|
||||
<<: *run_local_smoketest
|
||||
|
||||
debian_10_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- dpkg_build
|
||||
- dpkg_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:10
|
||||
<<: *run_local_smoketest
|
||||
@@ -266,7 +245,6 @@ debian_11_smoketest:
|
||||
stage: smoketest
|
||||
dependencies:
|
||||
- dpkg_build
|
||||
- dpkg_sign
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:11
|
||||
<<: *run_local_smoketest
|
||||
@@ -367,41 +345,39 @@ centos_7_verify_repo_test:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
|
||||
rocky_8_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: rockylinux/rockylinux:8
|
||||
name: artifactory.ops.ripple.com/rockylinux/rockylinux:8
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
fedora_34_verify_repo_test:
|
||||
fedora_37_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:34
|
||||
name: artifactory.ops.ripple.com/fedora:37
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
fedora_35_verify_repo_test:
|
||||
fedora_38_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:35
|
||||
name: artifactory.ops.ripple.com/fedora:38
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
ubuntu_18_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
@@ -427,7 +403,6 @@ ubuntu_20_verify_repo_test:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
# TODO: remove "allow_failure" when 22.04 released in 4/2022...
|
||||
ubuntu_22_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
@@ -439,19 +414,6 @@ ubuntu_22_verify_repo_test:
|
||||
- dpkg_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
debian_9_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
DISTRO: "stretch"
|
||||
DEB_REPO: "rippled-deb-test-mirror"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:9
|
||||
dependencies:
|
||||
- dpkg_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
debian_10_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
@@ -542,41 +504,38 @@ centos_7_verify_repo_prod:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
rocky_8_verify_repo_test:
|
||||
stage: verify_from_test
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm-test-mirror"
|
||||
image:
|
||||
name: rockylinux/rockylinux:8
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
fedora_34_verify_repo_prod:
|
||||
rocky_8_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:34
|
||||
name: artifactory.ops.ripple.com/rockylinux/rockylinux:8
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
fedora_35_verify_repo_prod:
|
||||
fedora_37_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:35
|
||||
name: artifactory.ops.ripple.com/fedora:37
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
fedora_38_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
RPM_REPO: "rippled-rpm"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/fedora:38
|
||||
dependencies:
|
||||
- rpm_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
ubuntu_18_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
@@ -602,7 +561,6 @@ ubuntu_20_verify_repo_prod:
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
# TODO: remove "allow_failure" when 22.04 released in 4/2022...
|
||||
ubuntu_22_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
@@ -614,19 +572,6 @@ ubuntu_22_verify_repo_prod:
|
||||
- dpkg_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
allow_failure: true
|
||||
|
||||
debian_9_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
variables:
|
||||
DISTRO: "stretch"
|
||||
DEB_REPO: "rippled-deb"
|
||||
image:
|
||||
name: artifactory.ops.ripple.com/debian:9
|
||||
dependencies:
|
||||
- dpkg_sign
|
||||
<<: *only_primary
|
||||
<<: *run_repo_smoketest
|
||||
|
||||
debian_10_verify_repo_prod:
|
||||
stage: verify_from_prod
|
||||
@@ -693,11 +638,9 @@ build_centos_container:
|
||||
<<: *dind_param
|
||||
script:
|
||||
- . ./Builds/containers/gitlab-ci/build_container.sh rpm
|
||||
allow_failure: true
|
||||
|
||||
build_ubuntu_container:
|
||||
stage: build_containers
|
||||
<<: *dind_param
|
||||
script:
|
||||
- . ./Builds/containers/gitlab-ci/build_container.sh dpkg
|
||||
allow_failure: true
|
||||
|
||||
@@ -14,18 +14,17 @@ cd $TOPDIR
|
||||
cd build/dpkg/packages
|
||||
CURLARGS="-sk -X${action} -urippled:${ARTIFACTORY_DEPLOY_KEY_RIPPLED}"
|
||||
RIPPLED_PKG=$(ls rippled_*.deb)
|
||||
RIPPLED_DEV_PKG=$(ls rippled-dev_*.deb)
|
||||
RIPPLED_REPORTING_PKG=$(ls rippled-reporting_*.deb)
|
||||
RIPPLED_DBG_PKG=$(ls rippled-dbgsym_*.deb)
|
||||
RIPPLED_REPORTING_DBG_PKG=$(ls rippled-reporting-dbgsym_*.deb)
|
||||
RIPPLED_DBG_PKG=$(ls rippled-dbgsym_*.*deb)
|
||||
RIPPLED_REPORTING_DBG_PKG=$(ls rippled-reporting-dbgsym_*.*deb)
|
||||
# TODO - where to upload src tgz?
|
||||
RIPPLED_SRC=$(ls rippled_*.orig.tar.gz)
|
||||
DEB_MATRIX=";deb.component=${COMPONENT};deb.architecture=amd64"
|
||||
for dist in stretch buster bullseye bionic focal jammy; do
|
||||
for dist in buster bullseye bionic focal jammy; do
|
||||
DEB_MATRIX="${DEB_MATRIX};deb.distribution=${dist}"
|
||||
done
|
||||
echo "{ \"debs\": {" > "${TOPDIR}/files.info"
|
||||
for deb in ${RIPPLED_PKG} ${RIPPLED_DEV_PKG} ${RIPPLED_DBG_PKG} ${RIPPLED_REPORTING_PKG} ${RIPPLED_REPORTING_DBG_PKG}; do
|
||||
for deb in ${RIPPLED_PKG} ${RIPPLED_DBG_PKG} ${RIPPLED_REPORTING_PKG} ${RIPPLED_REPORTING_DBG_PKG}; do
|
||||
# first item doesn't get a comma separator
|
||||
if [ $deb != $RIPPLED_PKG ] ; then
|
||||
echo "," >> "${TOPDIR}/files.info"
|
||||
|
||||
@@ -81,8 +81,10 @@ else
|
||||
elif [ "${install_from}" = "local" ] ; then
|
||||
# cached pkg install
|
||||
pkgs=("yum-utils openssl-static zlib-static")
|
||||
if [ "$ID" = "rocky" ]; then
|
||||
sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/Rocky-PowerTools.repo
|
||||
if [[ "$ID" =~ rocky|fedora ]]; then
|
||||
if [[ "$ID" =~ "rocky" ]]; then
|
||||
sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/Rocky-PowerTools.repo
|
||||
fi
|
||||
pkgs="${pkgs[@]/openssl-static}"
|
||||
fi
|
||||
yum install -y $pkgs
|
||||
|
||||
@@ -15,7 +15,7 @@ RIPPLED_DPKG_VERSION=$(echo "${RIPPLED_VERSION}" | sed 's!-!~!g')
|
||||
# TODO - decide how to handle the trailing/release
|
||||
# version here (hardcoded to 1). Does it ever need to change?
|
||||
RIPPLED_DPKG_FULL_VERSION="${RIPPLED_DPKG_VERSION}-1"
|
||||
|
||||
git config --global --add safe.directory /opt/rippled_bld/pkg/rippled
|
||||
cd /opt/rippled_bld/pkg/rippled
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
git status
|
||||
@@ -45,8 +45,6 @@ CHANGELOG
|
||||
# PATH must be preserved for our more modern cmake in /opt/local
|
||||
# TODO : consider allowing lintian to run in future ?
|
||||
export DH_BUILD_DDEBS=1
|
||||
export CC=gcc-8
|
||||
export CXX=g++-8
|
||||
debuild --no-lintian --preserve-envvar PATH --preserve-env -us -uc
|
||||
rc=$?; if [[ $rc != 0 ]]; then
|
||||
error "error building dpkg"
|
||||
@@ -54,7 +52,6 @@ fi
|
||||
cd ..
|
||||
|
||||
# copy artifacts
|
||||
cp rippled-dev_${RIPPLED_DPKG_FULL_VERSION}_amd64.deb ${PKG_OUTDIR}
|
||||
cp rippled-reporting_${RIPPLED_DPKG_FULL_VERSION}_amd64.deb ${PKG_OUTDIR}
|
||||
cp rippled_${RIPPLED_DPKG_FULL_VERSION}_amd64.deb ${PKG_OUTDIR}
|
||||
cp rippled_${RIPPLED_DPKG_FULL_VERSION}.dsc ${PKG_OUTDIR}
|
||||
@@ -84,15 +81,12 @@ DBG_SHA256=$(cat shasums | \
|
||||
grep "rippled-dbgsym_${RIPPLED_DPKG_VERSION}-1_amd64.*" | cut -d " " -f 1)
|
||||
REPORTING_DBG_SHA256=$(cat shasums | \
|
||||
grep "rippled-reporting-dbgsym_${RIPPLED_DPKG_VERSION}-1_amd64.*" | cut -d " " -f 1)
|
||||
DEV_SHA256=$(cat shasums | \
|
||||
grep "rippled-dev_${RIPPLED_DPKG_VERSION}-1_amd64.deb" | cut -d " " -f 1)
|
||||
REPORTING_SHA256=$(cat shasums | \
|
||||
grep "rippled-reporting_${RIPPLED_DPKG_VERSION}-1_amd64.deb" | cut -d " " -f 1)
|
||||
SRC_SHA256=$(cat shasums | \
|
||||
grep "rippled_${RIPPLED_DPKG_VERSION}.orig.tar.gz" | cut -d " " -f 1)
|
||||
echo "deb_sha256=${DEB_SHA256}" >> ${PKG_OUTDIR}/build_vars
|
||||
echo "dbg_sha256=${DBG_SHA256}" >> ${PKG_OUTDIR}/build_vars
|
||||
echo "dev_sha256=${DEV_SHA256}" >> ${PKG_OUTDIR}/build_vars
|
||||
echo "reporting_sha256=${REPORTING_SHA256}" >> ${PKG_OUTDIR}/build_vars
|
||||
echo "reporting_dbg_sha256=${REPORTING_DBG_SHA256}" >> ${PKG_OUTDIR}/build_vars
|
||||
echo "src_sha256=${SRC_SHA256}" >> ${PKG_OUTDIR}/build_vars
|
||||
|
||||
@@ -17,11 +17,3 @@ Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: rippled reporting daemon
|
||||
|
||||
Package: rippled-dev
|
||||
Section: devel
|
||||
Recommends: rippled (= ${binary:Version})
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}, libprotobuf-dev, libprotoc-dev, protobuf-compiler
|
||||
Description: development files for applications using xrpl core library (serialize + sign)
|
||||
|
||||
@@ -5,4 +5,4 @@ opt/ripple/bin/getRippledInfo
|
||||
opt/ripple/etc/rippled.cfg
|
||||
opt/ripple/etc/validators.txt
|
||||
opt/ripple/etc/update-rippled-cron
|
||||
etc/logrotate.d/rippled
|
||||
etc/logrotate.d/rippled
|
||||
|
||||
@@ -16,31 +16,50 @@ override_dh_systemd_start:
|
||||
|
||||
override_dh_auto_configure:
|
||||
env
|
||||
rm -rf bld && mkdir -p bld/rippled
|
||||
cd bld/rippled && \
|
||||
cmake ../.. -G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/ripple \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dstatic=ON \
|
||||
-Dunity=OFF \
|
||||
-Dvalidator_keys=ON \
|
||||
-Dunity=OFF \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=OFF
|
||||
rm -rf bld
|
||||
|
||||
conan export external/snappy snappy/1.1.9@
|
||||
|
||||
cmake -S . \
|
||||
-B bld/rippled-reporting \
|
||||
conan install . \
|
||||
--install-folder bld/rippled \
|
||||
--build missing \
|
||||
--build boost \
|
||||
--build sqlite3 \
|
||||
--settings build_type=Release
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rippled-reporting \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/ripple \
|
||||
-Dstatic=ON \
|
||||
-Dunity=OFF \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=OFF \
|
||||
-Dreporting=ON
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-B bld/rippled
|
||||
|
||||
conan install . \
|
||||
--install-folder bld/rippled-reporting \
|
||||
--build missing \
|
||||
--build boost \
|
||||
--build sqlite3 \
|
||||
--build libuv \
|
||||
--settings build_type=Release \
|
||||
--options reporting=True
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rippled-reporting \
|
||||
-Dstatic=ON \
|
||||
-Dunity=OFF \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-Dreporting=ON \
|
||||
-B bld/rippled-reporting
|
||||
|
||||
override_dh_auto_build:
|
||||
cmake --build bld/rippled --target rippled --target validator-keys --parallel
|
||||
cmake --build bld/rippled-reporting --target rippled --parallel
|
||||
cmake --build bld/rippled --target rippled --target validator-keys -j${nproc}
|
||||
|
||||
cmake --build bld/rippled-reporting --target rippled -j${nproc}
|
||||
|
||||
override_dh_auto_install:
|
||||
cmake --install bld/rippled --prefix debian/tmp/opt/ripple
|
||||
@@ -52,10 +71,10 @@ override_dh_auto_install:
|
||||
rm -rf debian/tmp/opt/ripple/lib64/cmake/date
|
||||
|
||||
mkdir -p debian/tmp/opt/rippled-reporting/etc
|
||||
mkdir -p debian/tmp/opt/rippled-reporting/bin
|
||||
cp cfg/validators-example.txt debian/tmp/opt/rippled-reporting/etc/validators.txt
|
||||
install -D bld/rippled/validator-keys/validator-keys debian/tmp/opt/rippled-reporting/bin/validator-keys
|
||||
|
||||
sed -E 's/rippled?/rippled-reporting/g' Builds/containers/shared/update-rippled.sh > debian/tmp/opt/rippled-reporting/bin/update-rippled-reporting.sh
|
||||
sed -E 's/rippled?/rippled-reporting/g' bin/getRippledInfo > debian/tmp/opt/rippled-reporting/bin/getRippledReportingInfo
|
||||
sed -E 's/rippled?/rippled-reporting/g' Builds/containers/shared/update-rippled-cron > debian/tmp/opt/rippled-reporting/etc/update-rippled-reporting-cron
|
||||
sed -E 's/rippled?/rippled-reporting/g' Builds/containers/shared/rippled-logrotate > debian/tmp/etc/logrotate.d/rippled-reporting
|
||||
sed -E 's/rippled?/rippled-reporting/g' Builds/containers/shared/rippled-logrotate > debian/tmp/etc/logrotate.d/rippled-reporting
|
||||
|
||||
@@ -29,17 +29,20 @@ if [[ $RPM_PATCH ]]; then
|
||||
fi
|
||||
|
||||
cd /opt/rippled_bld/pkg/rippled
|
||||
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
git status
|
||||
error "Unstaged changes in this repo - please commit first"
|
||||
fi
|
||||
|
||||
git archive --format tar.gz --prefix rippled/ -o ../rpmbuild/SOURCES/rippled.tar.gz HEAD
|
||||
# TODO include validator-keys sources
|
||||
|
||||
cd ..
|
||||
|
||||
source /opt/rh/devtoolset-8/enable
|
||||
source /opt/rh/devtoolset-11/enable
|
||||
|
||||
rpmbuild --define "_topdir ${PWD}/rpmbuild" -ba rippled.spec
|
||||
|
||||
rc=$?; if [[ $rc != 0 ]]; then
|
||||
error "error building rpm"
|
||||
fi
|
||||
|
||||
@@ -36,16 +36,64 @@ History server for XRP Ledger
|
||||
%setup -c -n rippled
|
||||
|
||||
%build
|
||||
rm -rf ~/.conan/profiles/default
|
||||
|
||||
cp /opt/libcstd/libstdc++.so.6.0.22 /usr/lib64
|
||||
cp /opt/libcstd/libstdc++.so.6.0.22 /lib64
|
||||
ln -sf /usr/lib64/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6
|
||||
ln -sf /lib64/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6
|
||||
|
||||
source /opt/rh/rh-python38/enable
|
||||
pip install "conan<2"
|
||||
conan profile new default --detect
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||
conan profile update settings.compiler.cppstd=20 default
|
||||
|
||||
cd rippled
|
||||
|
||||
mkdir -p bld.rippled
|
||||
conan export external/snappy snappy/1.1.9@
|
||||
|
||||
pushd bld.rippled
|
||||
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_BUILD_TYPE=Release -Dunity=OFF -Dstatic=true -DCMAKE_VERBOSE_MAKEFILE=OFF -Dvalidator_keys=ON
|
||||
conan install .. \
|
||||
--settings build_type=Release \
|
||||
--output-folder . \
|
||||
--build missing
|
||||
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dunity=OFF \
|
||||
-Dstatic=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
..
|
||||
|
||||
cmake --build . --parallel $(nproc) --target rippled --target validator-keys
|
||||
popd
|
||||
|
||||
mkdir -p bld.rippled-reporting
|
||||
cd bld.rippled-reporting
|
||||
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=%{_prefix}-reporting -DCMAKE_BUILD_TYPE=Release -Dunity=OFF -Dstatic=true -DCMAKE_VERBOSE_MAKEFILE=OFF -Dreporting=ON
|
||||
pushd bld.rippled-reporting
|
||||
|
||||
conan install .. \
|
||||
--settings build_type=Release \
|
||||
--output-folder . \
|
||||
--build missing \
|
||||
--settings compiler.cppstd=17 \
|
||||
--options reporting=True
|
||||
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-Dunity=OFF \
|
||||
-Dstatic=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-Dreporting=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
..
|
||||
|
||||
cmake --build . --parallel $(nproc) --target rippled
|
||||
|
||||
%pre
|
||||
@@ -53,13 +101,18 @@ test -e /etc/pki/tls || { mkdir -p /etc/pki; ln -s /usr/lib/ssl /etc/pki/tls; }
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
DESTDIR=$RPM_BUILD_ROOT cmake --build rippled/bld.rippled --target install -- -v
|
||||
rm -rf ${RPM_BUILD_ROOT}/%{_prefix}/lib64/cmake/date
|
||||
DESTDIR=$RPM_BUILD_ROOT cmake --build rippled/bld.rippled --target install #-- -v
|
||||
mkdir -p $RPM_BUILD_ROOT
|
||||
rm -rf ${RPM_BUILD_ROOT}/%{_prefix}/lib64/
|
||||
install -d ${RPM_BUILD_ROOT}/etc/opt/ripple
|
||||
install -d ${RPM_BUILD_ROOT}/usr/local/bin
|
||||
ln -s %{_prefix}/etc/rippled.cfg ${RPM_BUILD_ROOT}/etc/opt/ripple/rippled.cfg
|
||||
ln -s %{_prefix}/etc/validators.txt ${RPM_BUILD_ROOT}/etc/opt/ripple/validators.txt
|
||||
ln -s %{_prefix}/bin/rippled ${RPM_BUILD_ROOT}/usr/local/bin/rippled
|
||||
|
||||
install -D ./rippled/cfg/rippled-example.cfg ${RPM_BUILD_ROOT}/%{_prefix}/etc/rippled.cfg
|
||||
install -D ./rippled/cfg/validators-example.txt ${RPM_BUILD_ROOT}/%{_prefix}/etc/validators.txt
|
||||
|
||||
ln -sf %{_prefix}/etc/rippled.cfg ${RPM_BUILD_ROOT}/etc/opt/ripple/rippled.cfg
|
||||
ln -sf %{_prefix}/etc/validators.txt ${RPM_BUILD_ROOT}/etc/opt/ripple/validators.txt
|
||||
ln -sf %{_prefix}/bin/rippled ${RPM_BUILD_ROOT}/usr/local/bin/rippled
|
||||
install -D rippled/bld.rippled/validator-keys/validator-keys ${RPM_BUILD_ROOT}%{_bindir}/validator-keys
|
||||
install -D ./rippled/Builds/containers/shared/rippled.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/rippled.service
|
||||
install -D ./rippled/Builds/containers/packaging/rpm/50-rippled.preset ${RPM_BUILD_ROOT}/usr/lib/systemd/system-preset/50-rippled.preset
|
||||
@@ -141,6 +194,7 @@ chmod -x /usr/lib/systemd/system/rippled-reporting.service
|
||||
%config(noreplace) /etc/logrotate.d/rippled
|
||||
%config(noreplace) /usr/lib/systemd/system/rippled.service
|
||||
%config(noreplace) /usr/lib/systemd/system-preset/50-rippled.preset
|
||||
|
||||
%dir /var/log/rippled/
|
||||
%dir /var/lib/rippled/
|
||||
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
function build_boost()
|
||||
{
|
||||
local boost_ver=$1
|
||||
local do_link=$2
|
||||
local boost_path=$(echo "${boost_ver}" | sed -e 's!\.!_!g')
|
||||
mkdir -p /opt/local
|
||||
cd /opt/local
|
||||
BOOST_ROOT=/opt/local/boost_${boost_path}
|
||||
BOOST_URL="https://boostorg.jfrog.io/artifactory/main/release/${boost_ver}/source/boost_${boost_path}.tar.gz"
|
||||
BOOST_BUILD_ALL=true
|
||||
. /tmp/install_boost.sh
|
||||
if [ "$do_link" = true ] ; then
|
||||
ln -s ./boost_${boost_path} boost
|
||||
fi
|
||||
}
|
||||
|
||||
build_boost "1.70.0" true
|
||||
|
||||
# installed in opt, so won't be used
|
||||
# unless specified by OPENSSL_ROOT_DIR
|
||||
cd /tmp
|
||||
OPENSSL_VER=1.1.1d
|
||||
wget https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz
|
||||
tar xf openssl-${OPENSSL_VER}.tar.gz
|
||||
cd openssl-${OPENSSL_VER}
|
||||
# NOTE: add -g to the end of the following line if we want debug symbols for openssl
|
||||
SSLDIR=$(openssl version -d | cut -d: -f2 | tr -d [:space:]\")
|
||||
./config -fPIC --prefix=/opt/local/openssl --openssldir=${SSLDIR} zlib shared
|
||||
make -j$(nproc) >> make_output.txt 2>&1
|
||||
make install >> make_output.txt 2>&1
|
||||
cd ..
|
||||
rm -f openssl-${OPENSSL_VER}.tar.gz
|
||||
rm -rf openssl-${OPENSSL_VER}
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:/opt/local/openssl/lib /opt/local/openssl/bin/openssl version -a
|
||||
|
||||
cd /tmp
|
||||
wget https://libarchive.org/downloads/libarchive-3.4.1.tar.gz
|
||||
tar xzf libarchive-3.4.1.tar.gz
|
||||
cd libarchive-3.4.1
|
||||
mkdir _bld && cd _bld
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make -j$(nproc) >> make_output.txt 2>&1
|
||||
make install >> make_output.txt 2>&1
|
||||
cd ../..
|
||||
rm -f libarchive-3.4.1.tar.gz
|
||||
rm -rf libarchive-3.4.1
|
||||
|
||||
cd /tmp
|
||||
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.10.1/protobuf-all-3.10.1.tar.gz
|
||||
tar xf protobuf-all-3.10.1.tar.gz
|
||||
cd protobuf-3.10.1
|
||||
./autogen.sh
|
||||
./configure
|
||||
make -j$(nproc) >> make_output.txt 2>&1
|
||||
make install >> make_output.txt 2>&1
|
||||
ldconfig
|
||||
cd ..
|
||||
rm -f protobuf-all-3.10.1.tar.gz
|
||||
rm -rf protobuf-3.10.1
|
||||
|
||||
cd /tmp
|
||||
wget https://c-ares.haxx.se/download/c-ares-1.15.0.tar.gz
|
||||
tar xf c-ares-1.15.0.tar.gz
|
||||
cd c-ares-1.15.0
|
||||
mkdir _bld && cd _bld
|
||||
cmake \
|
||||
-DHAVE_LIBNSL=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCARES_STATIC=ON \
|
||||
-DCARES_SHARED=OFF \
|
||||
-DCARES_INSTALL=ON \
|
||||
-DCARES_STATIC_PIC=ON \
|
||||
-DCARES_BUILD_TOOLS=OFF \
|
||||
-DCARES_BUILD_TESTS=OFF \
|
||||
-DCARES_BUILD_CONTAINER_TESTS=OFF \
|
||||
..
|
||||
make -j$(nproc) >> make_output.txt 2>&1
|
||||
make install >> make_output.txt 2>&1
|
||||
cd ../..
|
||||
rm -f c-ares-1.15.0.tar.gz
|
||||
rm -rf c-ares-1.15.0
|
||||
|
||||
cd /tmp
|
||||
wget https://github.com/grpc/grpc/archive/v1.25.0.tar.gz
|
||||
tar xf v1.25.0.tar.gz
|
||||
cd grpc-1.25.0
|
||||
mkdir _bld && cd _bld
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DgRPC_ZLIB_PROVIDER=package \
|
||||
-DgRPC_CARES_PROVIDER=package \
|
||||
-DgRPC_SSL_PROVIDER=package \
|
||||
-DgRPC_PROTOBUF_PROVIDER=package \
|
||||
-DProtobuf_USE_STATIC_LIBS=ON \
|
||||
..
|
||||
make -j$(nproc) >> make_output.txt 2>&1
|
||||
make install >> make_output.txt 2>&1
|
||||
cd ../..
|
||||
rm -f xf v1.25.0.tar.gz
|
||||
rm -rf grpc-1.25.0
|
||||
|
||||
if [ "${CI_USE}" = true ] ; then
|
||||
|
||||
build_boost "1.71.0" false
|
||||
|
||||
cd /tmp
|
||||
wget https://github.com/doxygen/doxygen/archive/Release_1_8_16.tar.gz
|
||||
tar xf Release_1_8_16.tar.gz
|
||||
cd doxygen-Release_1_8_16
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Unix Makefiles" ..
|
||||
make -j$(nproc) >> make_output.txt 2>&1
|
||||
make install >> make_output.txt 2>&1
|
||||
cd ../..
|
||||
rm -f Release_1_8_16.tar.gz
|
||||
rm -rf doxygen-Release_1_8_16
|
||||
|
||||
mkdir -p /opt/plantuml
|
||||
wget -O /opt/plantuml/plantuml.jar https://downloads.sourceforge.net/project/plantuml/plantuml.jar
|
||||
|
||||
cd /tmp
|
||||
wget https://github.com/linux-test-project/lcov/releases/download/v1.14/lcov-1.14.tar.gz
|
||||
tar xfz lcov-1.14.tar.gz
|
||||
cd lcov-1.14
|
||||
make install PREFIX=/usr/local
|
||||
cd ..
|
||||
rm -r lcov-1.14 lcov-1.14.tar.gz
|
||||
|
||||
cd /tmp
|
||||
wget https://github.com/ccache/ccache/releases/download/v3.7.6/ccache-3.7.6.tar.gz
|
||||
tar xf ccache-3.7.6.tar.gz
|
||||
cd ccache-3.7.6
|
||||
./configure --prefix=/usr/local
|
||||
make >> make_output.txt 2>&1
|
||||
make install >> make_output.txt 2>&1
|
||||
cd ..
|
||||
rm -f ccache-3.7.6.tar.gz
|
||||
rm -rf ccache-3.7.6
|
||||
|
||||
pip install requests
|
||||
pip install https://github.com/codecov/codecov-python/archive/master.zip
|
||||
fi
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Assumptions:
|
||||
# 1) BOOST_ROOT and BOOST_URL are already defined,
|
||||
# and contain valid values. BOOST_URL2 may be defined
|
||||
# as a fallback. BOOST_WGET_OPTIONS may be defined with
|
||||
# retry options if the download(s) fail on the first try.
|
||||
# 2) The last namepart of BOOST_ROOT matches the
|
||||
# folder name internal to boost's .tar.gz
|
||||
# When testing you can force a boost build by clearing travis caches:
|
||||
# https://travis-ci.org/ripple/rippled/caches
|
||||
set -exu
|
||||
|
||||
odir=$(pwd)
|
||||
: ${BOOST_TOOLSET:=msvc-14.1}
|
||||
|
||||
if [[ -d "$BOOST_ROOT/lib" || -d "${BOOST_ROOT}/stage/lib" ]] ; then
|
||||
echo "Using cached boost at $BOOST_ROOT"
|
||||
exit
|
||||
fi
|
||||
|
||||
#fetch/unpack:
|
||||
fn=$(basename -- "$BOOST_URL")
|
||||
ext="${fn##*.}"
|
||||
wopt="--quiet"
|
||||
wget ${wopt} $BOOST_URL -O /tmp/boost.tar.${ext} || \
|
||||
( [ -n "${BOOST_URL2}" ] && \
|
||||
wget ${wopt} $BOOST_URL2 -O /tmp/boost.tar.${ext} ) || \
|
||||
( [ -n "${BOOST_WGET_OPTIONS}" ] &&
|
||||
( wget ${wopt} ${BOOST_WGET_OPTIONS} $BOOST_URL -O /tmp/boost.tar.${ext} || \
|
||||
( [ -n "${BOOST_URL2}" ] && \
|
||||
wget ${wopt} ${BOOST_WGET_OPTIONS} $BOOST_URL2 -O /tmp/boost.tar.${ext} )
|
||||
)
|
||||
)
|
||||
cd $(dirname $BOOST_ROOT)
|
||||
rm -fr ${BOOST_ROOT}
|
||||
mkdir ${BOOST_ROOT}
|
||||
tar xf /tmp/boost.tar.${ext} -C ${BOOST_ROOT} --strip-components 1
|
||||
cd $BOOST_ROOT
|
||||
|
||||
BLDARGS=()
|
||||
if [[ ${BOOST_BUILD_ALL:-false} == "true" ]]; then
|
||||
# we never need boost-python...so even for ALL
|
||||
# option we can skip it
|
||||
BLDARGS+=(--without-python)
|
||||
else
|
||||
BLDARGS+=(--with-chrono)
|
||||
BLDARGS+=(--with-container)
|
||||
BLDARGS+=(--with-context)
|
||||
BLDARGS+=(--with-coroutine)
|
||||
BLDARGS+=(--with-date_time)
|
||||
BLDARGS+=(--with-filesystem)
|
||||
BLDARGS+=(--with-program_options)
|
||||
BLDARGS+=(--with-regex)
|
||||
BLDARGS+=(--with-system)
|
||||
BLDARGS+=(--with-atomic)
|
||||
BLDARGS+=(--with-thread)
|
||||
fi
|
||||
BLDARGS+=(-j$((2*${NUM_PROCESSORS:-2})))
|
||||
BLDARGS+=(--prefix=${BOOST_ROOT}/_INSTALLED_)
|
||||
BLDARGS+=(-d0) # suppress messages/output
|
||||
|
||||
if [[ -z ${COMSPEC:-} ]]; then
|
||||
if [[ "$(uname)" == "Darwin" ]] ; then
|
||||
BLDARGS+=(cxxflags="-std=c++14 -fvisibility=default")
|
||||
else
|
||||
BLDARGS+=(cxxflags="-std=c++14")
|
||||
BLDARGS+=(runtime-link="static,shared")
|
||||
fi
|
||||
BLDARGS+=(--layout=tagged)
|
||||
./bootstrap.sh
|
||||
./b2 "${BLDARGS[@]}" stage
|
||||
./b2 "${BLDARGS[@]}" install
|
||||
else
|
||||
BLDARGS+=(runtime-link="static,shared")
|
||||
BLDARGS+=(--layout=versioned)
|
||||
BLDARGS+=(--toolset="${BOOST_TOOLSET}")
|
||||
BLDARGS+=(address-model=64)
|
||||
BLDARGS+=(architecture=x86)
|
||||
BLDARGS+=(link=static)
|
||||
BLDARGS+=(threading=multi)
|
||||
cmd /E:ON /D /S /C"bootstrap.bat"
|
||||
./b2.exe "${BLDARGS[@]}" stage
|
||||
./b2.exe "${BLDARGS[@]}" install
|
||||
fi
|
||||
|
||||
if [[ ${CI:-false} == "true" ]]; then
|
||||
# save some disk space...these are mostly
|
||||
# obj files and don't need to be kept in CI contexts
|
||||
rm -rf bin.v2
|
||||
fi
|
||||
|
||||
cd $odir
|
||||
|
||||
@@ -21,8 +21,13 @@ if [[ "${installed}" != "" && ${installed} =~ ${cm_maj}.${cm_min}.${cm_rel} ]] ;
|
||||
echo "cmake already installed: ${installed}"
|
||||
exit
|
||||
fi
|
||||
|
||||
pkgname="cmake-${cm_maj}.${cm_min}.${cm_rel}-$(uname)-x86_64.tar.gz"
|
||||
# From CMake 20+ "Linux" is lowercase so using `uname` won't create be the correct path
|
||||
if [ ${cm_min} -gt 19 ]; then
|
||||
linux="linux"
|
||||
else
|
||||
linux=$(uname)
|
||||
fi
|
||||
pkgname="cmake-${cm_maj}.${cm_min}.${cm_rel}-${linux}-x86_64.tar.gz"
|
||||
tmppkg="/tmp/cmake.tar.gz"
|
||||
wget --quiet https://cmake.org/files/v${cm_maj}.${cm_min}/${pkgname} -O ${tmppkg}
|
||||
mkdir -p ${CMAKE_ROOT}
|
||||
@@ -30,5 +35,3 @@ cd ${CMAKE_ROOT}
|
||||
tar --strip-components 1 -xf ${tmppkg}
|
||||
rm -f ${tmppkg}
|
||||
echo "installed: $(cmake_version)"
|
||||
|
||||
|
||||
|
||||
@@ -4,33 +4,12 @@ ARG GIT_COMMIT=unknown
|
||||
ARG CI_USE=false
|
||||
LABEL git-commit=$GIT_COMMIT
|
||||
|
||||
# install/setup prerequisites:
|
||||
COPY ubuntu-builder/ubuntu_setup.sh /tmp/
|
||||
COPY shared/build_deps.sh /tmp/
|
||||
COPY shared/install_cmake.sh /tmp/
|
||||
COPY shared/install_boost.sh /tmp/
|
||||
RUN chmod +x /tmp/ubuntu_setup.sh && \
|
||||
chmod +x /tmp/build_deps.sh && \
|
||||
chmod +x /tmp/install_boost.sh && \
|
||||
chmod +x /tmp/install_cmake.sh
|
||||
RUN /tmp/ubuntu_setup.sh
|
||||
WORKDIR /root
|
||||
COPY ubuntu-builder/ubuntu_setup.sh .
|
||||
RUN ./ubuntu_setup.sh && rm ubuntu_setup.sh
|
||||
|
||||
RUN /tmp/install_cmake.sh 3.16.1 /opt/local/cmake-3.16
|
||||
RUN ln -s /opt/local/cmake-3.16 /opt/local/cmake
|
||||
ENV PATH="/opt/local/cmake/bin:$PATH"
|
||||
# also install min supported cmake for testing
|
||||
RUN if [ "${CI_USE}" = true ] ; then /tmp/install_cmake.sh 3.9.0 /opt/local/cmake-3.9; fi
|
||||
|
||||
RUN /tmp/build_deps.sh
|
||||
ENV PLANTUML_JAR="/opt/plantuml/plantuml.jar"
|
||||
ENV BOOST_ROOT="/opt/local/boost/_INSTALLED_"
|
||||
ENV OPENSSL_ROOT="/opt/local/openssl"
|
||||
|
||||
# prep files for package building
|
||||
RUN mkdir -m 777 -p /opt/rippled_bld/pkg/debian
|
||||
RUN update-alternatives --set gcc /usr/bin/gcc-8
|
||||
RUN mkdir -m 777 -p /opt/rippled_bld/pkg/
|
||||
WORKDIR /opt/rippled_bld/pkg
|
||||
|
||||
COPY packaging/dpkg/build_dpkg.sh ./
|
||||
CMD ./build_dpkg.sh
|
||||
|
||||
|
||||
@@ -1,189 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
source /etc/os-release
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o xtrace
|
||||
|
||||
if [[ ${VERSION_ID} =~ ^18\. || ${VERSION_ID} =~ ^16\. ]] ; then
|
||||
echo "setup for ${PRETTY_NAME}"
|
||||
else
|
||||
echo "${VERSION} not supported"
|
||||
exit 1
|
||||
fi
|
||||
# Parameters
|
||||
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
echo "Acquire::Retries 3;" > /etc/apt/apt.conf.d/80-retries
|
||||
echo "Acquire::http::Pipeline-Depth 0;" >> /etc/apt/apt.conf.d/80-retries
|
||||
echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/80-retries
|
||||
echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/80-retries
|
||||
apt-get update -o Acquire::CompressionTypes::Order::=gz
|
||||
gcc_version=${GCC_VERSION:-10}
|
||||
cmake_version=${CMAKE_VERSION:-3.25.1}
|
||||
conan_version=${CONAN_VERSION:-1.59}
|
||||
|
||||
apt-get -y update
|
||||
apt-get -y install apt-utils
|
||||
apt-get -y install software-properties-common wget
|
||||
apt-get -y upgrade
|
||||
if [[ ${VERSION_ID} =~ ^18\. ]] ; then
|
||||
apt-add-repository -y multiverse
|
||||
apt-add-repository -y universe
|
||||
fi
|
||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
apt-get -y clean
|
||||
apt-get -y update
|
||||
apt update
|
||||
# Iteratively build the list of packages to install so that we can interleave
|
||||
# the lines with comments explaining their inclusion.
|
||||
dependencies=''
|
||||
# - to identify the Ubuntu version
|
||||
dependencies+=' lsb-release'
|
||||
# - for add-apt-repository
|
||||
dependencies+=' software-properties-common'
|
||||
# - to download CMake
|
||||
dependencies+=' curl'
|
||||
# - to build CMake
|
||||
dependencies+=' libssl-dev'
|
||||
# - Python headers for Boost.Python
|
||||
dependencies+=' python3-dev'
|
||||
# - to install Conan
|
||||
dependencies+=' python3-pip'
|
||||
# - to download rippled
|
||||
dependencies+=' git'
|
||||
# - CMake generators (but not CMake itself)
|
||||
dependencies+=' make ninja-build'
|
||||
apt install --yes ${dependencies}
|
||||
|
||||
apt-get -y --fix-missing install \
|
||||
make cmake ninja-build autoconf automake libtool pkg-config libtool \
|
||||
openssl libssl-dev \
|
||||
liblzma-dev libbz2-dev zlib1g-dev \
|
||||
libjemalloc-dev \
|
||||
python-pip \
|
||||
gdb gdbserver \
|
||||
libstdc++6 \
|
||||
flex bison parallel \
|
||||
libicu-dev texinfo \
|
||||
java-common javacc \
|
||||
dpkg-dev debhelper devscripts fakeroot \
|
||||
debmake git-buildpackage dh-make gitpkg debsums gnupg \
|
||||
dh-buildinfo dh-make dh-systemd \
|
||||
apt-transport-https
|
||||
add-apt-repository --yes ppa:ubuntu-toolchain-r/test
|
||||
apt install --yes gcc-${gcc_version} g++-${gcc_version} \
|
||||
debhelper debmake debsums gnupg dh-buildinfo dh-make dh-systemd cmake \
|
||||
ninja-build zlib1g-dev make cmake ninja-build autoconf automake \
|
||||
pkg-config apt-transport-https
|
||||
|
||||
apt-get -y install gcc-7 g++-7
|
||||
# Give us nice unversioned aliases for gcc and company.
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-7 40 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-7 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 \
|
||||
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-7 \
|
||||
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-7 \
|
||||
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-7
|
||||
|
||||
apt-get -y install gcc-8 g++-8
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-8 20 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-8 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-8 \
|
||||
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-8 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-8 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-8 \
|
||||
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-8 \
|
||||
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-8
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-${gcc_version} 100 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-${gcc_version} \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-${gcc_version} \
|
||||
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-${gcc_version} \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-${gcc_version} \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-${gcc_version} \
|
||||
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-${gcc_version} \
|
||||
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-${gcc_version}
|
||||
update-alternatives --auto gcc
|
||||
|
||||
update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-7 40
|
||||
update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-8 20
|
||||
update-alternatives --auto cpp
|
||||
# Download and unpack CMake.
|
||||
cmake_slug="cmake-${cmake_version}"
|
||||
curl --location --remote-name \
|
||||
"https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${cmake_slug}.tar.gz"
|
||||
tar xzf ${cmake_slug}.tar.gz
|
||||
rm ${cmake_slug}.tar.gz
|
||||
|
||||
if [ "${CI_USE}" = true ] ; then
|
||||
apt-get -y install gcc-6 g++-6
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-6 10 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-6 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-6 \
|
||||
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-6 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-6 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-6 \
|
||||
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-6 \
|
||||
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-6
|
||||
# Build and install CMake.
|
||||
cd ${cmake_slug}
|
||||
./bootstrap --parallel=$(nproc)
|
||||
make --jobs $(nproc)
|
||||
make install
|
||||
cd ..
|
||||
rm --recursive --force ${cmake_slug}
|
||||
|
||||
apt-get -y install gcc-9 g++-9
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-9 15 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-9 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-9 \
|
||||
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-9 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-9 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-9 \
|
||||
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-dump-9 \
|
||||
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-tool-9
|
||||
fi
|
||||
|
||||
if [[ ${VERSION_ID} =~ ^18\. ]] ; then
|
||||
apt-get -y install binutils
|
||||
elif [[ ${VERSION_ID} =~ ^16\. ]] ; then
|
||||
apt-get -y install python-software-properties binutils-gold
|
||||
fi
|
||||
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
|
||||
if [[ ${VERSION_ID} =~ ^18\. ]] ; then
|
||||
cat << EOF > /etc/apt/sources.list.d/llvm.list
|
||||
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main
|
||||
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main
|
||||
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main
|
||||
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main
|
||||
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main
|
||||
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main
|
||||
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main
|
||||
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main
|
||||
EOF
|
||||
elif [[ ${VERSION_ID} =~ ^16\. ]] ; then
|
||||
cat << EOF > /etc/apt/sources.list.d/llvm.list
|
||||
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
|
||||
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
|
||||
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main
|
||||
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main
|
||||
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main
|
||||
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main
|
||||
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main
|
||||
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main
|
||||
EOF
|
||||
fi
|
||||
apt-get -y update
|
||||
|
||||
apt-get -y install \
|
||||
clang-7 libclang-common-7-dev libclang-7-dev libllvm7 llvm-7 \
|
||||
llvm-7-dev llvm-7-runtime clang-format-7 python-clang-7 \
|
||||
lld-7 libfuzzer-7-dev libc++-7-dev
|
||||
update-alternatives --install \
|
||||
/usr/bin/clang clang /usr/bin/clang-7 40 \
|
||||
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-7 \
|
||||
--slave /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-7 \
|
||||
--slave /usr/bin/asan-symbolize asan-symbolize /usr/bin/asan_symbolize-7 \
|
||||
--slave /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-7 \
|
||||
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-7 \
|
||||
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-7 \
|
||||
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-7 \
|
||||
--slave /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-7
|
||||
apt-get -y install \
|
||||
clang-8 libclang-common-8-dev libclang-8-dev libllvm8 llvm-8 \
|
||||
llvm-8-dev llvm-8-runtime clang-format-8 python-clang-8 \
|
||||
lld-8 libfuzzer-8-dev libc++-8-dev
|
||||
update-alternatives --install \
|
||||
/usr/bin/clang clang /usr/bin/clang-8 20 \
|
||||
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-8 \
|
||||
--slave /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-8 \
|
||||
--slave /usr/bin/asan-symbolize asan-symbolize /usr/bin/asan_symbolize-8 \
|
||||
--slave /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-8 \
|
||||
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-8 \
|
||||
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-8 \
|
||||
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-8 \
|
||||
--slave /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-8
|
||||
update-alternatives --auto clang
|
||||
|
||||
if [ "${CI_USE}" = true ] ; then
|
||||
apt-get -y install \
|
||||
clang-9 libclang-common-9-dev libclang-9-dev libllvm9 llvm-9 \
|
||||
llvm-9-dev llvm-9-runtime clang-format-9 python-clang-9 \
|
||||
lld-9 libfuzzer-9-dev libc++-9-dev
|
||||
update-alternatives --install \
|
||||
/usr/bin/clang clang /usr/bin/clang-9 20 \
|
||||
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-9 \
|
||||
--slave /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-9 \
|
||||
--slave /usr/bin/asan-symbolize asan-symbolize /usr/bin/asan_symbolize-9 \
|
||||
--slave /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-9 \
|
||||
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-9 \
|
||||
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-9 \
|
||||
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-9 \
|
||||
--slave /usr/bin/llvm-nm llvm-nm /usr/bin/llvm-nm-9
|
||||
|
||||
# only install latest lldb
|
||||
apt-get -y install lldb-9 python-lldb-9 liblldb-9-dev
|
||||
update-alternatives --install \
|
||||
/usr/bin/lldb lldb /usr/bin/lldb-9 50 \
|
||||
--slave /usr/bin/lldb-server lldb-server /usr/bin/lldb-server-9 \
|
||||
--slave /usr/bin/lldb-argdumper lldb-argdumper /usr/bin/lldb-argdumper-9 \
|
||||
--slave /usr/bin/lldb-instr lldb-instr /usr/bin/lldb-instr-9 \
|
||||
--slave /usr/bin/lldb-mi lldb-mi /usr/bin/lldb-mi-9
|
||||
update-alternatives --auto clang
|
||||
fi
|
||||
|
||||
apt-get -y autoremove
|
||||
# Install Conan.
|
||||
pip3 install conan==${conan_version}
|
||||
|
||||
conan profile new --detect gcc
|
||||
conan profile update settings.compiler=gcc gcc
|
||||
conan profile update settings.compiler.version=${gcc_version} gcc
|
||||
conan profile update settings.compiler.libcxx=libstdc++11 gcc
|
||||
conan profile update env.CC=/usr/bin/gcc gcc
|
||||
conan profile update env.CXX=/usr/bin/g++ gcc
|
||||
|
||||
@@ -112,7 +112,6 @@ test.consensus > ripple.basics
|
||||
test.consensus > ripple.beast
|
||||
test.consensus > ripple.consensus
|
||||
test.consensus > ripple.ledger
|
||||
test.consensus > ripple.rpc
|
||||
test.consensus > test.csf
|
||||
test.consensus > test.toplevel
|
||||
test.consensus > test.unit_test
|
||||
|
||||
@@ -1,270 +1 @@
|
||||
# Linux Build Instructions
|
||||
|
||||
This document focuses on building rippled for development purposes under recent
|
||||
Ubuntu linux distributions. To build rippled for Redhat, Fedora or Centos
|
||||
builds, including docker based builds for those distributions, please consult
|
||||
the [rippled-package-builder](https://github.com/ripple/rippled-package-builder)
|
||||
repository.
|
||||
|
||||
Note: Ubuntu 16.04 users may need to update their compiler (see the dependencies
|
||||
section). For non Ubuntu distributions, the steps below should work be
|
||||
installing the appropriate dependencies using that distribution's package
|
||||
management tools.
|
||||
|
||||
## Dependencies
|
||||
|
||||
gcc-8 or later is required.
|
||||
|
||||
Use `apt-get` to install the dependencies provided by the distribution
|
||||
|
||||
```
|
||||
$ apt-get update
|
||||
$ apt-get install -y gcc g++ wget git cmake pkg-config libprotoc-dev protobuf-compiler libprotobuf-dev libssl-dev
|
||||
```
|
||||
|
||||
To build the software in reporting mode, install these additional dependencies:
|
||||
```
|
||||
$ apt-get install -y autoconf flex bison
|
||||
```
|
||||
|
||||
Advanced users can choose to install newer versions of gcc, or the clang compiler.
|
||||
At this time, rippled only supports protobuf version 2. Using version 3 of
|
||||
protobuf will give errors.
|
||||
|
||||
### Build Boost
|
||||
|
||||
Boost 1.70 or later is required. We recommend downloading and compiling boost
|
||||
with the following process: After changing to the directory where
|
||||
you wish to download and compile boost, run
|
||||
```
|
||||
$ wget https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.gz
|
||||
$ tar -xzf boost_1_70_0.tar.gz
|
||||
$ cd boost_1_70_0
|
||||
$ ./bootstrap.sh
|
||||
$ ./b2 headers
|
||||
$ ./b2 -j<Num Parallel>
|
||||
```
|
||||
|
||||
### (Optional) Dependencies for Building Source Documentation
|
||||
|
||||
Source code documentation is not required for running/debugging rippled. That
|
||||
said, the documentation contains some helpful information about specific
|
||||
components of the application. For more information on how to install and run
|
||||
the necessary components, see [this document](../../docs/README.md)
|
||||
|
||||
## Build
|
||||
|
||||
### Clone the rippled repository
|
||||
|
||||
From a shell:
|
||||
|
||||
```
|
||||
git clone git@github.com:ripple/rippled.git
|
||||
cd rippled
|
||||
```
|
||||
|
||||
For a stable release, choose the `master` branch or one of the tagged releases
|
||||
listed on [GitHub](https://github.com/ripple/rippled/releases).
|
||||
|
||||
```
|
||||
git checkout master
|
||||
```
|
||||
|
||||
or to test the latest release candidate, choose the `release` branch.
|
||||
|
||||
```
|
||||
git checkout release
|
||||
```
|
||||
|
||||
If you are doing development work and want the latest set of untested
|
||||
features, you can consider using the `develop` branch instead.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
### Configure Library Paths
|
||||
|
||||
If you didn't persistently set the `BOOST_ROOT` environment variable to the
|
||||
directory in which you compiled boost, then you should set it temporarily.
|
||||
|
||||
For example, you built Boost in your home directory `~/boost_1_70_0`, you
|
||||
would do for any shell in which you want to build:
|
||||
|
||||
```
|
||||
export BOOST_ROOT=~/boost_1_70_0
|
||||
```
|
||||
|
||||
Alternatively, you can add `DBOOST_ROOT=~/boost_1_70_0` to the command line when
|
||||
invoking `cmake`.
|
||||
|
||||
### Generate Configuration
|
||||
|
||||
All builds should be done in a separate directory from the source tree root
|
||||
(a subdirectory is fine). For example, from the root of the ripple source tree:
|
||||
|
||||
```
|
||||
mkdir my_build
|
||||
cd my_build
|
||||
```
|
||||
|
||||
followed by:
|
||||
|
||||
```
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
```
|
||||
|
||||
If your operating system does not provide static libraries (Arch Linux, and
|
||||
Manjaro Linux, for example), you must configure a non-static build by adding
|
||||
`-Dstatic=OFF` to the above cmake line.
|
||||
|
||||
`CMAKE_BUILD_TYPE` can be changed as desired for `Debug` vs.
|
||||
`Release` builds (all four standard cmake build types are supported).
|
||||
|
||||
To select a different compiler (most likely gcc will be found by default), pass
|
||||
`-DCMAKE_C_COMPILER=<path/to/c-compiler>` and
|
||||
`-DCMAKE_CXX_COMPILER=</path/to/cxx-compiler>` when configuring. If you prefer,
|
||||
you can instead set `CC` and `CXX` environment variables which cmake will honor.
|
||||
|
||||
#### Options During Configuration:
|
||||
|
||||
The CMake file defines a number of configure-time options which can be
|
||||
examined by running `cmake-gui` or `ccmake` to generated the build. In
|
||||
particular, the `unity` option allows you to select between the unity and
|
||||
non-unity builds. `unity` builds are faster to compile since they combine
|
||||
multiple sources into a single compiliation unit - this is the default if you
|
||||
don't specify. `nounity` builds can be helpful for detecting include omissions
|
||||
or for finding other build-related issues, but aren't generally needed for
|
||||
testing and running.
|
||||
|
||||
* `-Dunity=ON` to enable/disable unity builds (defaults to ON)
|
||||
* `-Dassert=ON` to enable asserts
|
||||
* `-Djemalloc=ON` to enable jemalloc support for heap checking
|
||||
* `-Dsan=thread` to enable the thread sanitizer with clang
|
||||
* `-Dsan=address` to enable the address sanitizer with clang
|
||||
* `-Dstatic=ON` to enable static linking library dependencies
|
||||
* `-Dreporting=ON` to build code necessary for reporting mode (defaults to OFF)
|
||||
|
||||
Several other infrequently used options are available - run `ccmake` or
|
||||
`cmake-gui` for a list of all options.
|
||||
|
||||
### Build
|
||||
|
||||
Once you have generated the build system, you can run the build via cmake:
|
||||
|
||||
```
|
||||
cmake --build . -- -j <parallel jobs>
|
||||
```
|
||||
|
||||
the `-j` parameter in this example tells the build tool to compile several
|
||||
files in parallel. This value should be chosen roughly based on the number of
|
||||
cores you have available and/or want to use for building.
|
||||
|
||||
When the build completes successfully, you will have a `rippled` executable in
|
||||
the current directory, which can be used to connect to the network (when
|
||||
properly configured) or to run unit tests.
|
||||
|
||||
|
||||
#### Optional Installation
|
||||
|
||||
The rippled cmake build supports an installation target that will install
|
||||
rippled as well as a support library that can be used to sign transactions. In
|
||||
order to build and install the files, specify the `install` target when
|
||||
building, e.g.:
|
||||
|
||||
```
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/opt/local ..
|
||||
cmake --build . --target install -- -j <parallel jobs>
|
||||
```
|
||||
|
||||
We recommend specifying `CMAKE_INSTALL_PREFIX` when configuring in order to
|
||||
explicitly control the install location for your files. Without this setting,
|
||||
cmake will typically install in `/usr/local`. It is also possible to "rehome"
|
||||
the installation by specifying the `DESTDIR` env variable during the install phase,
|
||||
e.g.:
|
||||
|
||||
```
|
||||
DESTDIR=~/mylibs cmake --build . --target install -- -j <parallel jobs>
|
||||
```
|
||||
|
||||
in which case, the files would be installed in the `CMAKE_INSTALL_PREFIX` within
|
||||
the specified `DESTDIR` path.
|
||||
|
||||
#### Signing Library
|
||||
|
||||
If you want to use the signing support library to create an application, there
|
||||
are two simple mechanisms with cmake + git that facilitate this.
|
||||
|
||||
With either option below, you will have access to a library from the
|
||||
rippled project that you can link to in your own project's CMakeLists.txt, e.g.:
|
||||
|
||||
```
|
||||
target_link_libraries (my-signing-app Ripple::xrpl_core)
|
||||
```
|
||||
|
||||
##### Option 1: git submodules + add_subdirectory
|
||||
|
||||
First, add the rippled repo as a submodule to your project repo:
|
||||
|
||||
```
|
||||
git submodule add -b master https://github.com/ripple/rippled.git vendor/rippled
|
||||
```
|
||||
|
||||
change the `vendor/rippled` path as desired for your repo layout. Furthermore,
|
||||
change the branch name if you want to track a different rippled branch, such
|
||||
as `develop`.
|
||||
|
||||
Second, to bring this submodule into your project, just add the rippled subdirectory:
|
||||
|
||||
```
|
||||
add_subdirectory (vendor/rippled)
|
||||
```
|
||||
|
||||
##### Option 2: installed rippled + find_package
|
||||
|
||||
First, follow the "Optional Installation" instructions above to
|
||||
build and install the desired version of rippled.
|
||||
|
||||
To make use of the installed files, add the following to your CMakeLists.txt file:
|
||||
|
||||
```
|
||||
set (CMAKE_MODULE_PATH /opt/local/lib/cmake/ripple ${CMAKE_MODULE_PATH})
|
||||
find_package(Ripple REQUIRED)
|
||||
```
|
||||
|
||||
change the `/opt/local` module path above to match your chosen installation prefix.
|
||||
|
||||
## Unit Tests (Recommended)
|
||||
|
||||
`rippled` builds a set of unit tests into the server executable. To run these unit
|
||||
tests after building, pass the `--unittest` option to the compiled `rippled`
|
||||
executable. The executable will exit with summary info after running the unit tests.
|
||||
|
||||
## Workaround for a compile error in soci
|
||||
|
||||
Compilation errors have been observed with Apple Clang 13.1.6+ and soci v4.x. soci compiles with the `-Werror` flag which causes warnings to be treated as errors. These warnings pertain to style (not correctness). However, they cause the cmake process to fail.
|
||||
|
||||
Here's an example of how this looks:
|
||||
```
|
||||
.../rippled/.nih_c/unix_makefiles/AppleClang_13.1.6.13160021/Debug/src/soci/src/core/session.cpp:450:66: note: in instantiation of function template specialization 'soci::use<std::string>' requested here
|
||||
return prepare << backEnd_->get_column_descriptions_query(), use(table_name, "t");
|
||||
^
|
||||
1 error generated.
|
||||
```
|
||||
|
||||
Please apply the below patch (courtesy of Scott Determan) to remove these errors. `.nih_c/unix_makefiles/AppleClang_13.1.6.13160021/Debug/src/soci/cmake/SociConfig.cmake` file needs to be edited. This file is an example for Mac OS and it might be slightly different for other OS/Architectures.
|
||||
|
||||
```
|
||||
diff --git a/cmake/SociConfig.cmake b/cmake/SociConfig.cmake
|
||||
index 97d907e4..11bcd1f3 100644
|
||||
--- a/cmake/SociConfig.cmake
|
||||
+++ b/cmake/SociConfig.cmake
|
||||
@@ -58,8 +58,8 @@ if (MSVC)
|
||||
|
||||
else()
|
||||
|
||||
- set(SOCI_GCC_CLANG_COMMON_FLAGS
|
||||
- "-pedantic -Werror -Wno-error=parentheses -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Woverloaded-virtual -Wredundant-decls -Wno-long-long")
|
||||
+ set(SOCI_GCC_CLANG_COMMON_FLAGS "")
|
||||
+ # "-pedantic -Werror -Wno-error=parentheses -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Woverloaded-virtual -Wredundant-decls -Wno-long-long")
|
||||
```
|
||||
[Build instructions are currently located in `BUILD.md`](../../BUILD.md)
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
# macOS Build Instructions
|
||||
|
||||
[Build and Run rippled on macOS](https://xrpl.org/build-run-rippled-macos.html)
|
||||
[Build instructions are currently located in `BUILD.md`](../../BUILD.md)
|
||||
|
||||
@@ -83,4 +83,5 @@ include(RippledCore)
|
||||
include(RippledInstall)
|
||||
include(RippledCov)
|
||||
include(RippledMultiConfig)
|
||||
include(RippledDocs)
|
||||
include(RippledValidatorKeys)
|
||||
|
||||
@@ -58,7 +58,7 @@ Existing maintainers can resign, or be subject to a vote for removal at the behe
|
||||
* [JoelKatz](https://github.com/JoelKatz) (Ripple)
|
||||
* [Manojsdoshi](https://github.com/manojsdoshi) (Ripple)
|
||||
* [N3tc4t](https://github.com/n3tc4t) (XRPL Labs)
|
||||
* [Nikolaos D Bougalis](https://github.com/nbougalis) (Ripple)
|
||||
* [Nikolaos D Bougalis](https://github.com/nbougalis)
|
||||
* [Nixer89](https://github.com/nixer89) (XRP Ledger Foundation)
|
||||
* [RichardAH](https://github.com/RichardAH) (XRPL Labs + XRP Ledger Foundation)
|
||||
* [Seelabs](https://github.com/seelabs) (Ripple)
|
||||
|
||||
64
README.md
64
README.md
@@ -1,63 +1,3 @@
|
||||
# Hooks Public Testnet + Documentation
|
||||
# The Xahau Ledger
|
||||
|
||||
Please see [Hooks Testnet V2](https://hooks-testnet-v2.xrpl-labs.com/) for faucet + documentation + explorer + builder.
|
||||
|
||||
# The XRP Ledger
|
||||
|
||||
The [XRP Ledger](https://xrpl.org/) is a decentralized cryptographic ledger powered by a network of peer-to-peer nodes. The XRP Ledger uses a novel Byzantine Fault Tolerant consensus algorithm to settle and record transactions in a secure distributed database without a central operator.
|
||||
|
||||
## XRP
|
||||
[XRP](https://xrpl.org/xrp.html) is a public, counterparty-free asset native to the XRP Ledger, and is designed to bridge the many different currencies in use worldwide. XRP is traded on the open-market and is available for anyone to access. The XRP Ledger was created in 2012 with a finite supply of 100 billion units of XRP. Its creators gifted 80 billion XRP to a company, now called [Ripple](https://ripple.com/), to develop the XRP Ledger and its ecosystem. Ripple uses XRP to help build the Internet of Value, ushering in a world in which money moves as fast and efficiently as information does today.
|
||||
|
||||
## rippled
|
||||
The server software that powers the XRP Ledger is called `rippled` and is available in this repository under the permissive [ISC open-source license](LICENSE.md). The `rippled` server software is written primarily in C++ and runs on a variety of platforms. The `rippled` server software can run in several modes depending on its [configuration](https://xrpl.org/rippled-server-modes.html).
|
||||
|
||||
### Build from Source
|
||||
|
||||
* [Linux](Builds/linux/README.md)
|
||||
* [Mac](Builds/macos/README.md) (Not recommended for production)
|
||||
* [Windows](Builds/VisualStudio2017/README.md) (Not recommended for production)
|
||||
|
||||
## Key Features of the XRP Ledger
|
||||
|
||||
- **[Censorship-Resistant Transaction Processing][]:** No single party decides which transactions succeed or fail, and no one can "roll back" a transaction after it completes. As long as those who choose to participate in the network keep it healthy, they can settle transactions in seconds.
|
||||
- **[Fast, Efficient Consensus Algorithm][]:** The XRP Ledger's consensus algorithm settles transactions in 4 to 5 seconds, processing at a throughput of up to 1500 transactions per second. These properties put XRP at least an order of magnitude ahead of other top digital assets.
|
||||
- **[Finite XRP Supply][]:** When the XRP Ledger began, 100 billion XRP were created, and no more XRP will ever be created. The available supply of XRP decreases slowly over time as small amounts are destroyed to pay transaction costs.
|
||||
- **[Responsible Software Governance][]:** A team of full-time, world-class developers at Ripple maintain and continually improve the XRP Ledger's underlying software with contributions from the open-source community. Ripple acts as a steward for the technology and an advocate for its interests, and builds constructive relationships with governments and financial institutions worldwide.
|
||||
- **[Secure, Adaptable Cryptography][]:** The XRP Ledger relies on industry standard digital signature systems like ECDSA (the same scheme used by Bitcoin) but also supports modern, efficient algorithms like Ed25519. The extensible nature of the XRP Ledger's software makes it possible to add and disable algorithms as the state of the art in cryptography advances.
|
||||
- **[Modern Features for Smart Contracts][]:** Features like Escrow, Checks, and Payment Channels support cutting-edge financial applications including the [Interledger Protocol](https://interledger.org/). This toolbox of advanced features comes with safety features like a process for amending the network and separate checks against invariant constraints.
|
||||
- **[On-Ledger Decentralized Exchange][]:** In addition to all the features that make XRP useful on its own, the XRP Ledger also has a fully-functional accounting system for tracking and trading obligations denominated in any way users want, and an exchange built into the protocol. The XRP Ledger can settle long, cross-currency payment paths and exchanges of multiple currencies in atomic transactions, bridging gaps of trust with XRP.
|
||||
|
||||
[Censorship-Resistant Transaction Processing]: https://xrpl.org/xrp-ledger-overview.html#censorship-resistant-transaction-processing
|
||||
[Fast, Efficient Consensus Algorithm]: https://xrpl.org/xrp-ledger-overview.html#fast-efficient-consensus-algorithm
|
||||
[Finite XRP Supply]: https://xrpl.org/xrp-ledger-overview.html#finite-xrp-supply
|
||||
[Responsible Software Governance]: https://xrpl.org/xrp-ledger-overview.html#responsible-software-governance
|
||||
[Secure, Adaptable Cryptography]: https://xrpl.org/xrp-ledger-overview.html#secure-adaptable-cryptography
|
||||
[Modern Features for Smart Contracts]: https://xrpl.org/xrp-ledger-overview.html#modern-features-for-smart-contracts
|
||||
[On-Ledger Decentralized Exchange]: https://xrpl.org/xrp-ledger-overview.html#on-ledger-decentralized-exchange
|
||||
|
||||
|
||||
## Source Code
|
||||
[](https://travis-ci.com/ripple/rippled)
|
||||
[](https://codecov.io/gh/ripple/rippled)
|
||||
|
||||
### Repository Contents
|
||||
|
||||
| Folder | Contents |
|
||||
|:-----------|:-------------------------------------------------|
|
||||
| `./bin` | Scripts and data files for Ripple integrators. |
|
||||
| `./Builds` | Platform-specific guides for building `rippled`. |
|
||||
| `./docs` | Source documentation files and doxygen config. |
|
||||
| `./cfg` | Example configuration files. |
|
||||
| `./src` | Source code. |
|
||||
|
||||
Some of the directories under `src` are external repositories included using
|
||||
git-subtree. See those directories' README files for more details.
|
||||
|
||||
|
||||
## See Also
|
||||
|
||||
* [XRP Ledger Dev Portal](https://xrpl.org/)
|
||||
* [Setup and Installation](https://xrpl.org/install-rippled.html)
|
||||
* [Source Documentation (Doxygen)](https://xrplf.github.io/rippled/)
|
||||
* [Learn more about the XRP Ledger (YouTube)](https://www.youtube.com/playlist?list=PLJQ55Tj1hIVZtJ_JdTvSum2qMTsedWkNi)
|
||||
TODO: Doco
|
||||
|
||||
252
RELEASENOTES.md
252
RELEASENOTES.md
@@ -5,7 +5,255 @@
|
||||
This document contains the release notes for `rippled`, the reference server implementation of the XRP Ledger protocol. To learn more about how to build, run or update a `rippled` server, visit https://xrpl.org/install-rippled.html
|
||||
|
||||
|
||||
Have new ideas? Need help with setting up your node? Come visit us [here](https://github.com/xrplf/rippled/issues/new/choose)
|
||||
Have new ideas? Need help with setting up your node? [Please open an issue here](https://github.com/xrplf/rippled/issues/new/choose).
|
||||
|
||||
|
||||
# Introducing XRP Ledger version 1.10.1
|
||||
|
||||
Version 1.10.1 of `rippled`, the reference server implementation of the XRP Ledger protocol, is now available. This release restores packages for Ubuntu 18.04.
|
||||
|
||||
Compared to version 1.10.0, the only C++ code change fixes an edge case in Reporting Mode.
|
||||
|
||||
If you are already running version 1.10.0, then upgrading to version 1.10.1 is generally not required.
|
||||
|
||||
[Sign Up for Future Release Announcements](https://groups.google.com/g/ripple-server)
|
||||
|
||||
<!-- BREAK -->
|
||||
|
||||
## Install / Upgrade
|
||||
|
||||
On supported platforms, see the [instructions on installing or updating `rippled`](https://xrpl.org/install-rippled.html).
|
||||
|
||||
## Changelog
|
||||
|
||||
- [`da18c86cbf`](https://github.com/ripple/rippled/commit/da18c86cbfea1d8fe6940035f9103e15890d47ce) Build packages with Ubuntu 18.04
|
||||
- [`f7b3ddd87b`](https://github.com/ripple/rippled/commit/f7b3ddd87b8ef093a06ab1420bea57ed1e77643a) Reporting Mode: Do not attempt to acquire missing data from peer network (#4458)
|
||||
|
||||
### GitHub
|
||||
|
||||
The public source code repository for `rippled` is hosted on GitHub at <https://github.com/XRPLF/rippled>.
|
||||
|
||||
We welcome all contributions and invite everyone to join the community of XRP Ledger developers to help build the Internet of Value.
|
||||
|
||||
### Credits
|
||||
|
||||
The following people contributed directly to this release:
|
||||
|
||||
- John Freeman <jfreeman08@gmail.com>
|
||||
- Mark Travis <mtrippled@users.noreply.github.com>
|
||||
- Michael Legleux <mlegleux@ripple.com>
|
||||
|
||||
Bug Bounties and Responsible Disclosures:
|
||||
We welcome reviews of the rippled code and urge researchers to
|
||||
responsibly disclose any issues they may find.
|
||||
|
||||
To report a bug, please send a detailed report to:
|
||||
|
||||
bugs@xrpl.org
|
||||
|
||||
|
||||
# Introducing XRP Ledger version 1.10.0
|
||||
|
||||
Version 1.10.0 of `rippled`, the reference server implementation of the XRP Ledger protocol, is now available. This release introduces six new amendments, detailed below, and cleans up code to improve performance.
|
||||
|
||||
[Sign Up for Future Release Announcements](https://groups.google.com/g/ripple-server)
|
||||
|
||||
<!-- BREAK -->
|
||||
|
||||
## Action Required
|
||||
|
||||
Six new amendments are now open for voting according to the XRP Ledger's [amendment process](https://xrpl.org/amendments.html), which enables protocol changes following two weeks of >80% support from trusted validators.
|
||||
|
||||
If you operate an XRP Ledger server, upgrade to version 1.10.0 by March 21 to ensure service continuity. The exact time that protocol changes take effect depends on the voting decisions of the decentralized network.
|
||||
|
||||
|
||||
## Install / Upgrade
|
||||
|
||||
On supported platforms, see the [instructions on installing or updating `rippled`](https://xrpl.org/install-rippled.html).
|
||||
|
||||
|
||||
## New Amendments
|
||||
|
||||
- **`featureImmediateOfferKilled`**: Changes the response code of an `OfferCreate` transaction with the `tfImmediateOrCancel` flag to return `tecKILLED` when no funds are moved. The previous return code of `tecSUCCESS` was unintuitive. [#4157](https://github.com/XRPLF/rippled/pull/4157)
|
||||
|
||||
- **`featureDisallowIncoming`**: Enables an account to block incoming checks, payment channels, NFToken offers, and trust lines. [#4336](https://github.com/XRPLF/rippled/pull/4336)
|
||||
|
||||
- **`featureXRPFees`**: Simplifies transaction cost calculations to use XRP directly, rather than calculating indirectly in "fee units" and translating the results to XRP. Updates all instances of "fee units" in the protocol and ledger data to be drops of XRP instead. [#4247](https://github.com/XRPLF/rippled/pull/4247)
|
||||
|
||||
- **`fixUniversalNumber`**: Simplifies and unifies the code for decimal floating point math. In some cases, this provides slightly better accuracy than the previous code, resulting in calculations whose least significant digits are different than when calculated with the previous code. The different results may cause other edge case differences where precise calculations are used, such as ranking of offers or processing of payments that use several different paths. [#4192](https://github.com/XRPLF/rippled/pull/4192)
|
||||
|
||||
- **`fixNonFungibleTokensV1_2`**: This amendment is a combination of NFToken fixes. [#4417](https://github.com/XRPLF/rippled/pull/4417)
|
||||
- Fixes unburnable NFTokens when it has over 500 offers. [#4346](https://github.com/XRPLF/rippled/pull/4346)
|
||||
- Fixes 3 NFToken offer acceptance issues. [#4380](https://github.com/XRPLF/rippled/pull/4380)
|
||||
- Prevents brokered sales of NFTokens to owners. [#4403](https://github.com/XRPLF/rippled/pull/4403)
|
||||
- Only allows the destination to settle NFToken offers through brokerage. [#4399](https://github.com/XRPLF/rippled/pull/4399)
|
||||
|
||||
- **`fixTrustLinesToSelf`**: Trust lines must be between two different accounts, but two exceptions exist because of a bug that briefly existed. This amendment removes those trust lines. [69bb2be](https://github.com/XRPLF/rippled/pull/4270/commits/69bb2be446e3cc24c694c0835b48bd2ecd3d119e)
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
|
||||
### New Features and Improvements
|
||||
|
||||
- **Improve Handshake in the peer protocol**: Switched to using a cryptographically secure PRNG for the Instance Cookie. `rippled` now uses hex encoding for the `Closed-Ledger` and `Previous-Ledger` fields in the Handshake. Also added `--newnodeid` and `--nodeid` command line options. [5a15229](https://github.com/XRPLF/rippled/pull/4270/commits/5a15229eeb13b69c8adf1f653b88a8f8b9480546)
|
||||
|
||||
- **RPC tooBusy response now has 503 HTTP status code**: Added ripplerpc 3.0, enabling RPC tooBusy responses to return relevant HTTP status codes. This is a non-breaking change that only applies to JSON-RPC when you include `"ripplerpc": "3.0"` in the request. [#4143](https://github.com/XRPLF/rippled/pull/4143)
|
||||
|
||||
- **Use the Conan package manager**: Added a `conanfile.py` and Conan recipe for Snappy. Removed the RocksDB recipe from the repo; you can now get it from Conan Center. [#4367](https://github.com/XRPLF/rippled/pull/4367), [c2b03fe](https://github.com/XRPLF/rippled/commit/c2b03fecca19a304b37467b01fa78593d3dce3fb)
|
||||
|
||||
- **Update Build Instructions**: Updated the build instructions to build with the Conan package manager and restructured info for easier comprehension. [#4376](https://github.com/XRPLF/rippled/pull/4376), [#4383](https://github.com/XRPLF/rippled/pull/4383)
|
||||
|
||||
- **Revise CONTRIBUTING**: Updated code contribution guidelines. `rippled` is an open source project and contributions are very welcome. [#4382](https://github.com/XRPLF/rippled/pull/4382)
|
||||
|
||||
- **Update documented pathfinding configuration defaults**: `417cfc2` changed the default Path Finding configuration values, but missed updating the values documented in rippled-example.cfg. Updated those defaults and added recommended values for nodes that want to support advanced pathfinding. [#4409](https://github.com/XRPLF/rippled/pull/4409)
|
||||
|
||||
- **Remove gRPC code previously used for the Xpring SDK**: Removed gRPC code used for the Xpring SDK. The gRPC API is also enabled locally by default in `rippled-example.cfg`. This API is used for [Reporting Mode](https://xrpl.org/build-run-rippled-in-reporting-mode.html) and [Clio](https://github.com/XRPLF/clio). [28f4cc7](https://github.com/XRPLF/rippled/pull/4321/commits/28f4cc7817c2e477f0d7e9ade8f07a45ff2b81f1)
|
||||
|
||||
- **Switch from C++17 to C++20**: Updated `rippled` to use C++20. [92d35e5](https://github.com/XRPLF/rippled/pull/4270/commits/92d35e54c7de6bbe44ff6c7c52cc0765b3f78258)
|
||||
|
||||
- **Support for Boost 1.80.0:**: [04ef885](https://github.com/XRPLF/rippled/pull/4321/commits/04ef8851081f6ee9176783ad3725960b8a931ebb)
|
||||
|
||||
- **Reduce default reserves to 10/2**: Updated the hard-coded default reserves to match the current settings on Mainnet. [#4329](https://github.com/XRPLF/rippled/pull/4329)
|
||||
|
||||
- **Improve self-signed certificate generation**: Improved speed and security of TLS certificate generation on fresh startup. [0ecfc7c](https://github.com/XRPLF/rippled/pull/4270/commits/0ecfc7cb1a958b731e5f184876ea89ae2d4214ee)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **Update command-line usage help message**: Added `manifest` and `validator_info` to the `rippled` CLI usage statement. [b88ed5a](https://github.com/XRPLF/rippled/pull/4270/commits/b88ed5a8ec2a0735031ca23dc6569d54787dc2f2)
|
||||
|
||||
- **Work around gdb bug by changing a template parameter**: Added a workaround for a bug in gdb, where unsigned template parameters caused issues with RTTI. [#4332](https://github.com/XRPLF/rippled/pull/4332)
|
||||
|
||||
- **Fix clang 15 warnings**: [#4325](https://github.com/XRPLF/rippled/pull/4325)
|
||||
|
||||
- **Catch transaction deserialization error in doLedgerGrpc**: Fixed an issue in the gRPC API, so `Clio` can extract ledger headers and state objects from specific transactions that can't be deserialized by `rippled` code. [#4323](https://github.com/XRPLF/rippled/pull/4323)
|
||||
|
||||
- **Update dependency: gRPC**: New Conan recipes broke the old version of gRPC, so the dependency was updated. [#4407](https://github.com/XRPLF/rippled/pull/4407)
|
||||
|
||||
- **Fix Doxygen workflow**: Added options to build documentation that don't depend on the library dependencies of `rippled`. [#4372](https://github.com/XRPLF/rippled/pull/4372)
|
||||
|
||||
- **Don't try to read SLE with key 0 from the ledger**: Fixed the `preclaim` function to check for 0 in `NFTokenSellOffer` and `NFTokenBuyOffer` before calling `Ledger::read`. This issue only affected debug builds. [#4351](https://github.com/XRPLF/rippled/pull/4351)
|
||||
|
||||
- **Update broken link to hosted Doxygen content**: [5e1cb09](https://github.com/XRPLF/rippled/pull/4270/commits/5e1cb09b8892e650f6c34a66521b6b1673bd6b65)
|
||||
|
||||
|
||||
### Code Cleanup
|
||||
|
||||
- **Prevent unnecessary `shared_ptr` copies by accepting a value in `SHAMapInnerNode::setChild`**: [#4266](https://github.com/XRPLF/rippled/pull/4266)
|
||||
|
||||
- **Release TaggedCache object memory outside the lock**: [3726f8b](https://github.com/XRPLF/rippled/pull/4321/commits/3726f8bf31b3eab8bab39dce139656fd705ae9a0)
|
||||
|
||||
- **Rename SHAMapStoreImp::stopping() to healthWait()**: [7e9e910](https://github.com/XRPLF/rippled/pull/4321/commits/7e9e9104eabbf0391a0837de5630af17a788e233)
|
||||
|
||||
- **Improve wrapper around OpenSSL RAND**: [7b3507b](https://github.com/XRPLF/rippled/pull/4270/commits/7b3507bb873495a974db33c57a888221ddabcacc)
|
||||
|
||||
- **Improve AccountID string conversion caching**: Improved memory cache usage. [e2eed96](https://github.com/XRPLF/rippled/pull/4270/commits/e2eed966b0ecb6445027e6a023b48d702c5f4832)
|
||||
|
||||
- **Build the command map at compile time**: [9aaa0df](https://github.com/XRPLF/rippled/pull/4270/commits/9aaa0dff5fd422e5f6880df8e20a1fd5ad3b4424)
|
||||
|
||||
- **Avoid unnecessary copying and dynamic memory allocations**: [d318ab6](https://github.com/XRPLF/rippled/pull/4270/commits/d318ab612adc86f1fd8527a50af232f377ca89ef)
|
||||
|
||||
- **Use constexpr to check memo validity**: [e67f905](https://github.com/XRPLF/rippled/pull/4270/commits/e67f90588a9050162881389d7e7d1d0fb31066b0)
|
||||
|
||||
- **Remove charUnHex**: [83ac141](https://github.com/XRPLF/rippled/pull/4270/commits/83ac141f656b1a95b5661853951ebd95b3ffba99)
|
||||
|
||||
- **Remove deprecated AccountTxOld.cpp**: [ce64f7a](https://github.com/XRPLF/rippled/pull/4270/commits/ce64f7a90f99c6b5e68d3c3d913443023de061a6)
|
||||
|
||||
- **Remove const_cast usage**: [23ce431](https://github.com/XRPLF/rippled/pull/4321/commits/23ce4318768b718c82e01004d23f1abc9a9549ff)
|
||||
|
||||
- **Remove inaccessible code paths and outdated data format wchar_t**: [95fabd5](https://github.com/XRPLF/rippled/pull/4321/commits/95fabd5762a4917753c06268192e4d4e4baef8e4)
|
||||
|
||||
- **Improve move semantics in Expected**: [#4326](https://github.com/XRPLF/rippled/pull/4326)
|
||||
|
||||
|
||||
### GitHub
|
||||
|
||||
The public source code repository for `rippled` is hosted on GitHub at <https://github.com/XRPLF/rippled>.
|
||||
|
||||
We welcome all contributions and invite everyone to join the community of XRP Ledger developers to help build the Internet of Value.
|
||||
|
||||
### Credits
|
||||
|
||||
The following people contributed directly to this release:
|
||||
|
||||
- Alexander Kremer <akremer@ripple.com>
|
||||
- Alloy Networks <45832257+alloynetworks@users.noreply.github.com>
|
||||
- CJ Cobb <46455409+cjcobb23@users.noreply.github.com>
|
||||
- Chenna Keshava B S <ckbs.keshava56@gmail.com>
|
||||
- Crypto Brad Garlinghouse <cryptobradgarlinghouse@protonmail.com>
|
||||
- Denis Angell <dangell@transia.co>
|
||||
- Ed Hennis <ed@ripple.com>
|
||||
- Elliot Lee <github.public@intelliot.com>
|
||||
- Gregory Popovitch <greg7mdp@gmail.com>
|
||||
- Howard Hinnant <howard.hinnant@gmail.com>
|
||||
- J. Scott Branson <18340247+crypticrabbit@users.noreply.github.com>
|
||||
- John Freeman <jfreeman08@gmail.com>
|
||||
- ledhed2222 <ledhed2222@users.noreply.github.com>
|
||||
- Levin Winter <33220502+levinwinter@users.noreply.github.com>
|
||||
- manojsdoshi <mdoshi@ripple.com>
|
||||
- Nik Bougalis <nikb@bougalis.net>
|
||||
- RichardAH <richard.holland@starstone.co.nz>
|
||||
- Scott Determan <scott.determan@yahoo.com>
|
||||
- Scott Schurr <scott@ripple.com>
|
||||
- Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
|
||||
|
||||
Security Bug Bounty Acknowledgements:
|
||||
- Aaron Hook
|
||||
- Levin Winter
|
||||
|
||||
Bug Bounties and Responsible Disclosures:
|
||||
We welcome reviews of the rippled code and urge researchers to
|
||||
responsibly disclose any issues they may find.
|
||||
|
||||
To report a bug, please send a detailed report to:
|
||||
|
||||
bugs@xrpl.org
|
||||
|
||||
|
||||
# Introducing XRP Ledger version 1.9.4
|
||||
|
||||
Version 1.9.4 of `rippled`, the reference implementation of the XRP Ledger protocol is now available. This release introduces an amendment that removes the ability for an NFT issuer to indicate that trust lines should be automatically created for royalty payments from secondary sales of NFTs, in response to a bug report that indicated how this functionality could be abused to mount a denial of service attack against the issuer.
|
||||
|
||||
## Action Required
|
||||
|
||||
This release introduces a new amendment to the XRP Ledger protocol, **`fixRemoveNFTokenAutoTrustLine`** to mitigate a potential denial-of-service attack against NFT issuers that minted NFTs and allowed secondary trading of those NFTs to create trust lines for any asset.
|
||||
|
||||
This amendment is open for voting according to the XRP Ledger's [amendment process](https://xrpl.org/amendments.html), which enables protocol changes following two weeks of >80% support from trusted validators.
|
||||
|
||||
If you operate an XRP Ledger server, then you should upgrade to version 1.9.4 within two weeks, to ensure service continuity. The exact time that protocol changes take effect depends on the voting decisions of the decentralized network.
|
||||
|
||||
For more information about NFTs on the XRP Ledger, see [NFT Conceptual Overview](https://xrpl.org/nft-conceptual-overview.html).
|
||||
|
||||
|
||||
## Install / Upgrade
|
||||
|
||||
On supported platforms, see the [instructions on installing or updating `rippled`](https://xrpl.org/install-rippled.html).
|
||||
|
||||
## Changelog
|
||||
|
||||
## Contributions
|
||||
|
||||
The primary change in this release is the following bug fix:
|
||||
|
||||
- **Introduce fixRemoveNFTokenAutoTrustLine amendment**: Introduces the `fixRemoveNFTokenAutoTrustLine` amendment, which disables the `tfTrustLine` flag, which a malicious attacker could exploit to mount denial-of-service attacks against NFT issuers that specified the flag on their NFTs. ([#4301](https://github.com/XRPLF/rippled/4301))
|
||||
|
||||
|
||||
### GitHub
|
||||
|
||||
The public source code repository for `rippled` is hosted on GitHub at <https://github.com/XRPLF/rippled>.
|
||||
|
||||
We welcome all contributions and invite everyone to join the community of XRP Ledger developers and help us build the Internet of Value.
|
||||
|
||||
### Credits
|
||||
|
||||
The following people contributed directly to this release:
|
||||
|
||||
- Scott Schurr <scott@ripple.com>
|
||||
- Howard Hinnant <howard@ripple.com>
|
||||
- Scott Determan <scott.determan@yahoo.com>
|
||||
- Ikko Ashimine <eltociear@gmail.com>
|
||||
|
||||
|
||||
# Introducing XRP Ledger version 1.9.3
|
||||
|
||||
@@ -19,7 +267,7 @@ On supported platforms, see the [instructions on installing or updating `rippled
|
||||
|
||||
## Contributions
|
||||
|
||||
This releases contains the following bug fixes:
|
||||
This release contains the following bug fixes:
|
||||
|
||||
- **Change by-value to by-reference to persist vote**: A minor technical flaw, caused by use of a copy instead of a reference, resulted in operator-configured "yes" votes to not be properly loaded after a restart. ([#4256](https://github.com/XRPLF/rippled/pull/4256))
|
||||
- **Properly handle self-assignment of PublicKey**: The `PublicKey` copy assignment operator mishandled the case where a `PublicKey` would be assigned to itself, and could result in undefined behavior.
|
||||
|
||||
61
build-core.sh
Executable file
61
build-core.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "START INSIDE CONTAINER - CORE"
|
||||
|
||||
echo "-- BUILD CORES: $3"
|
||||
echo "-- GITHUB_REPOSITORY: $1"
|
||||
echo "-- GITHUB_SHA: $2"
|
||||
echo "-- GITHUB_RUN_NUMBER: $4"
|
||||
|
||||
umask 0000;
|
||||
|
||||
cd /io/ &&
|
||||
echo "Importing env... Lines:" &&
|
||||
cat .env|wc -l &&
|
||||
source .env &&
|
||||
perl -i -pe "s/^(\\s*)-DBUILD_SHARED_LIBS=OFF/\\1-DBUILD_SHARED_LIBS=OFF\\n\\1-DROCKSDB_BUILD_SHARED=OFF/g" Builds/CMake/deps/Rocksdb.cmake &&
|
||||
mv Builds/CMake/deps/WasmEdge.cmake Builds/CMake/deps/WasmEdge.old &&
|
||||
echo "find_package(LLVM REQUIRED CONFIG)
|
||||
message(STATUS \"Found LLVM ${LLVM_PACKAGE_VERSION}\")
|
||||
message(STATUS \"Using LLVMConfig.cmake in: \${LLVM_DIR}\")
|
||||
add_library (wasmedge STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(wasmedge PROPERTIES IMPORTED_LOCATION \${WasmEdge_LIB})
|
||||
target_link_libraries (ripple_libs INTERFACE wasmedge)
|
||||
add_library (NIH::WasmEdge ALIAS wasmedge)
|
||||
message(\"WasmEdge DONE\")
|
||||
" > Builds/CMake/deps/WasmEdge.cmake &&
|
||||
git checkout src/ripple/protocol/impl/BuildInfo.cpp &&
|
||||
sed -i s/\"0.0.0\"/\"$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4\"/g src/ripple/protocol/impl/BuildInfo.cpp &&
|
||||
cd release-build &&
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DBoost_NO_BOOST_CMAKE=ON -DLLVM_DIR=/usr/lib64/llvm13/lib/cmake/llvm/ -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ -DWasmEdge_LIB=/usr/local/lib64/libwasmedge.a &&
|
||||
make -j$3 VERBOSE=1 &&
|
||||
strip -s rippled &&
|
||||
mv rippled xahaud &&
|
||||
echo "Build host: `hostname`" > release.info &&
|
||||
echo "Build date: `date`" >> release.info &&
|
||||
echo "Build md5: `md5sum xahaud`" >> release.info &&
|
||||
echo "Git remotes:" >> release.info &&
|
||||
git remote -v >> release.info
|
||||
echo "Git status:" >> release.info &&
|
||||
git status -v >> release.info &&
|
||||
echo "Git log [last 20]:" >> release.info &&
|
||||
git log -n 20 >> release.info;
|
||||
|
||||
if [[ "$4" == "" ]]; then
|
||||
# Non GH, local building
|
||||
echo "Non GH, local building, no Action runner magic"
|
||||
else
|
||||
# GH Action, runner
|
||||
cp /io/release-build/xahaud /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
|
||||
cp /io/release-build/release.info /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
|
||||
echo "Published build to: http://build.xahau.tech/"
|
||||
echo $(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
|
||||
fi
|
||||
|
||||
cd ..;
|
||||
mv src/ripple/net/impl/RegisterSSLCerts.cpp.old src/ripple/net/impl/RegisterSSLCerts.cpp;
|
||||
mv Builds/CMake/deps/Rocksdb.cmake.old Builds/CMake/deps/Rocksdb.cmake;
|
||||
mv Builds/CMake/deps/WasmEdge.old Builds/CMake/deps/WasmEdge.cmake;
|
||||
|
||||
|
||||
echo "END INSIDE CONTAINER - CORE"
|
||||
159
build-full.sh
Executable file
159
build-full.sh
Executable file
@@ -0,0 +1,159 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "START INSIDE CONTAINER - FULL"
|
||||
|
||||
echo "-- BUILD CORES: $3"
|
||||
echo "-- GITHUB_REPOSITORY: $1"
|
||||
echo "-- GITHUB_SHA: $2"
|
||||
echo "-- GITHUB_RUN_NUMBER: $4"
|
||||
|
||||
umask 0000;
|
||||
|
||||
cd /io;
|
||||
mkdir src/certs;
|
||||
curl --silent -k https://raw.githubusercontent.com/RichardAH/rippled-release-builder/main/ca-bundle/certbundle.h -o src/certs/certbundle.h;
|
||||
if [ "`grep certbundle.h src/ripple/net/impl/RegisterSSLCerts.cpp | wc -l`" -eq "0" ]
|
||||
then
|
||||
cp src/ripple/net/impl/RegisterSSLCerts.cpp src/ripple/net/impl/RegisterSSLCerts.cpp.old
|
||||
perl -i -pe "s/^{/{
|
||||
#ifdef EMBEDDED_CA_BUNDLE
|
||||
BIO *cbio = BIO_new_mem_buf(ca_bundle.data(), ca_bundle.size());
|
||||
X509_STORE *cts = SSL_CTX_get_cert_store(ctx.native_handle());
|
||||
if(!cts || !cbio)
|
||||
JLOG(j.warn())
|
||||
<< \"Failed to create cts\/cbio when loading embedded certs.\";
|
||||
else
|
||||
{
|
||||
X509_INFO *itmp;
|
||||
int i, count = 0, type = X509_FILETYPE_PEM;
|
||||
STACK_OF(X509_INFO) *inf = PEM_X509_INFO_read_bio(cbio, NULL, NULL, NULL);
|
||||
|
||||
if (!inf)
|
||||
{
|
||||
BIO_free(cbio);
|
||||
JLOG(j.warn())
|
||||
<< \"Failed to read cbio when loading embedded certs.\";
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < sk_X509_INFO_num(inf); i++)
|
||||
{
|
||||
itmp = sk_X509_INFO_value(inf, i);
|
||||
if (itmp->x509)
|
||||
{
|
||||
X509_STORE_add_cert(cts, itmp->x509);
|
||||
count++;
|
||||
}
|
||||
if (itmp->crl)
|
||||
{
|
||||
X509_STORE_add_crl(cts, itmp->crl);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
sk_X509_INFO_pop_free(inf, X509_INFO_free);
|
||||
BIO_free(cbio);
|
||||
}
|
||||
}
|
||||
#endif/g" src/ripple/net/impl/RegisterSSLCerts.cpp &&
|
||||
sed -i "s/#include <ripple\/net\/RegisterSSLCerts.h>/\0\n#include <certs\/certbundle.h>/g" src/ripple/net/impl/RegisterSSLCerts.cpp
|
||||
fi
|
||||
mkdir .nih_c;
|
||||
mkdir .nih_toolchain;
|
||||
cd .nih_toolchain &&
|
||||
yum install -y wget lz4 lz4-devel git llvm13-static.x86_64 llvm13-devel.x86_64 devtoolset-10-binutils zlib-static ncurses-static -y \
|
||||
devtoolset-7-gcc-c++ \
|
||||
devtoolset-9-gcc-c++ \
|
||||
devtoolset-10-gcc-c++ \
|
||||
snappy snappy-devel \
|
||||
zlib zlib-devel \
|
||||
lz4-devel \
|
||||
libasan &&
|
||||
export PATH=`echo $PATH | sed -E "s/devtoolset-9/devtoolset-7/g"` &&
|
||||
echo "-- Install ZStd 1.1.3 --" &&
|
||||
yum install epel-release -y &&
|
||||
ZSTD_VERSION="1.1.3" &&
|
||||
( wget -nc -q -O zstd-${ZSTD_VERSION}.tar.gz https://github.com/facebook/zstd/archive/v${ZSTD_VERSION}.tar.gz; echo "" ) &&
|
||||
tar xzvf zstd-${ZSTD_VERSION}.tar.gz &&
|
||||
cd zstd-${ZSTD_VERSION} &&
|
||||
make -j$3 install &&
|
||||
cd .. &&
|
||||
echo "-- Install Cmake 3.23.1 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz; echo "" ) &&
|
||||
tar -xzf cmake-3.23.1-linux-x86_64.tar.gz -C /hbb/ &&
|
||||
echo "-- Install Boost 1.75.0 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz; echo "" ) &&
|
||||
tar -xzf boost_1_75_0.tar.gz &&
|
||||
cd boost_1_75_0 && ./bootstrap.sh && ./b2 link=static -j$3 && ./b2 install &&
|
||||
cd ../ &&
|
||||
echo "-- Install Protobuf 3.20.0 --" &&
|
||||
pwd &&
|
||||
( wget -nc -q https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/protobuf-all-3.20.0.tar.gz; echo "" ) &&
|
||||
tar -xzf protobuf-all-3.20.0.tar.gz &&
|
||||
cd protobuf-3.20.0/ &&
|
||||
./autogen.sh && ./configure --prefix=/usr --disable-shared link=static && make -j$3 && make install &&
|
||||
cd .. &&
|
||||
echo "-- Build LLD --" &&
|
||||
pwd &&
|
||||
ln /usr/bin/llvm-config-13 /usr/bin/llvm-config &&
|
||||
mv /opt/rh/devtoolset-9/root/usr/bin/ar /opt/rh/devtoolset-9/root/usr/bin/ar-9 &&
|
||||
ln /opt/rh/devtoolset-10/root/usr/bin/ar /opt/rh/devtoolset-9/root/usr/bin/ar &&
|
||||
( wget -nc -q https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/lld-13.0.1.src.tar.xz; echo "" ) &&
|
||||
( wget -nc -q https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/libunwind-13.0.1.src.tar.xz; echo "" ) &&
|
||||
tar -xf lld-13.0.1.src.tar.xz &&
|
||||
tar -xf libunwind-13.0.1.src.tar.xz &&
|
||||
cp -r libunwind-13.0.1.src/include libunwind-13.0.1.src/src lld-13.0.1.src/ &&
|
||||
cd lld-13.0.1.src &&
|
||||
rm -rf build CMakeCache.txt &&
|
||||
mkdir build &&
|
||||
cd build &&
|
||||
cmake .. -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ -DCMAKE_INSTALL_PREFIX=/usr/lib64/llvm13/ -DCMAKE_BUILD_TYPE=Release &&
|
||||
make -j$3 install &&
|
||||
ln -s /usr/lib64/llvm13/lib/include/lld /usr/include/lld &&
|
||||
cp /usr/lib64/llvm13/lib/liblld*.a /usr/local/lib/ &&
|
||||
cd ../../ &&
|
||||
echo "-- Build WasmEdge --" &&
|
||||
( wget -nc -q https://github.com/WasmEdge/WasmEdge/archive/refs/tags/0.11.2.zip; unzip -o 0.11.2.zip; ) &&
|
||||
cd WasmEdge-0.11.2 &&
|
||||
( mkdir build; echo "" ) &&
|
||||
cd build &&
|
||||
export BOOST_ROOT="/usr/local/src/boost_1_75_0" &&
|
||||
export Boost_LIBRARY_DIRS="/usr/local/lib" &&
|
||||
export BOOST_INCLUDEDIR="/usr/local/src/boost_1_75_0" &&
|
||||
export PATH=`echo $PATH | sed -E "s/devtoolset-7/devtoolset-9/g"` &&
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWASMEDGE_BUILD_SHARED_LIB=OFF \
|
||||
-DWASMEDGE_BUILD_STATIC_LIB=ON \
|
||||
-DWASMEDGE_BUILD_AOT_RUNTIME=ON \
|
||||
-DWASMEDGE_FORCE_DISABLE_LTO=ON \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
||||
-DWASMEDGE_LINK_LLVM_STATIC=ON \
|
||||
-DWASMEDGE_BUILD_PLUGINS=OFF \
|
||||
-DWASMEDGE_LINK_TOOLS_STATIC=ON \
|
||||
-DBoost_NO_BOOST_CMAKE=ON -DLLVM_DIR=/usr/lib64/llvm13/lib/cmake/llvm/ -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ &&
|
||||
make -j$3 install &&
|
||||
export PATH=`echo $PATH | sed -E "s/devtoolset-9/devtoolset-10/g"` &&
|
||||
cp -r include/api/wasmedge /usr/include/ &&
|
||||
cd /io/ &&
|
||||
echo "-- Build Rippled --" &&
|
||||
pwd &&
|
||||
cp Builds/CMake/deps/Rocksdb.cmake Builds/CMake/deps/Rocksdb.cmake.old &&
|
||||
|
||||
echo "MOVING TO [ build-core.sh ]"
|
||||
cd /io;
|
||||
|
||||
printenv > .env.temp;
|
||||
cat .env.temp | grep '=' | sed s/\\\(^[^=]\\+=\\\)/\\1\\\"/g|sed s/\$/\\\"/g > .env;
|
||||
rm .env.temp;
|
||||
|
||||
echo "Persisting ENV:"
|
||||
cat .env
|
||||
|
||||
./build-core.sh "$1" "$2" "$3" "$4"
|
||||
echo "END [ build-core.sh ]"
|
||||
|
||||
echo "END INSIDE CONTAINER - FULL"
|
||||
|
||||
echo "-- Built with env vars:"
|
||||
88
cfg/genesis.json
Normal file
88
cfg/genesis.json
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"ledger": {
|
||||
"accepted": true,
|
||||
"accountState": [
|
||||
{
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Balance": "100000000000000000",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"OwnerCount": 0,
|
||||
"PreviousTxnID": "A92EF82C3C68F771927E3892A2F708F12CBD492EF68A860F042E4053C8EC6C8D",
|
||||
"PreviousTxnLgrSeq": 3,
|
||||
"Sequence": 4,
|
||||
"index": "2B6AC232AA4C4BE41BF49D2459FA4A0347E1B543A4C92FCEE0821C0201E2E9A8"
|
||||
},
|
||||
{
|
||||
"Amendments": [
|
||||
"740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D628A06927F11",
|
||||
"3012E8230864E95A58C60FD61430D7E1B4D3353195F2981DC12B0C7C0950FFAC",
|
||||
"67A34F2CF55BFC0F93AACD5B281413176FEE195269FA6D95219A2DF738671172",
|
||||
"F64E1EABBE79D55B3BB82020516CEC2C582A98A6BFE20FBE9BB6A0D233418064",
|
||||
"157D2D480E006395B76F948E3E07A45A05FE10230D88A7993C71F97AE4B1F2D1",
|
||||
"7117E2EC2DBF119CA55181D69819F1999ECEE1A0225A7FD2B9ED47940968479C",
|
||||
"CA7C02118BA27599528543DFE77BA6838D1B0F43B447D4D7F53523CE6A0E9AC2",
|
||||
"58BE9B5968C4DA7C59BA900961828B113E5490699B21877DEF9A31E9D0FE5D5F",
|
||||
"3CBC5C4E630A1B82380295CDA84B32B49DD066602E74E39B85EF64137FA65194",
|
||||
"5D08145F0A4983F23AFFFF514E83FAD355C5ABFBB6CAB76FB5BC8519FF5F33BE",
|
||||
"FBD513F1B893AC765B78F250E6FFA6A11B573209D1842ADC787C850696741288",
|
||||
"586480873651E106F1D6339B0C4A8945BA705A777F3F4524626FF1FC07EFE41D",
|
||||
"2CD5286D8D687E98B41102BDD797198E81EA41DF7BD104E6561FEB104EFF2561",
|
||||
"C4483A1896170C66C098DEA5B0E024309C60DC960DE5F01CD7AF986AA3D9AD37",
|
||||
"8F81B066ED20DAECA20DF57187767685EEF3980B228E0667A650BAF24426D3B4",
|
||||
"621A0B264970359869E3C0363A899909AAB7A887C8B73519E4ECF952D33258A8",
|
||||
"89308AF3B8B10B7192C4E613E1D2E4D9BA64B2EE2D5232402AE82A6A7220D953",
|
||||
"00C1FC4A53E60AB02C864641002B3172F38677E29C26C5406685179B37E1EDAC",
|
||||
"25BA44241B3BD880770BFA4DA21C7180576831855368CBEC6A3154FDE4A7676E",
|
||||
"1F4AFA8FA1BC8827AD4C0F682C03A8B671DCDF6B5C4DE36D44243A684103EF88",
|
||||
"4F46DF03559967AC60F2EB272FEFE3928A7594A45FF774B87A7E540DB0F8F068",
|
||||
"B4E4F5D2D6FB84DF7399960A732309C9FD530EAE5941838160042833625A6076",
|
||||
"955DF3FA5891195A9DAEFA1DDC6BB244B545DDE1BAA84CBB25D5F12A8DA68A0C",
|
||||
"AF8DF7465C338AE64B1E937D6C8DA138C0D63AD5134A68792BBBE1F63356C422",
|
||||
"452F5906C46D46F407883344BFDD90E672B672C5E9943DB4891E3A34FEEEB9DB",
|
||||
"B6B3EEDC0267AB50491FDC450A398AF30DBCD977CECED8BEF2499CAB5DAC19E2",
|
||||
"98DECF327BF79997AEC178323AD51A830E457BFC6D454DAF3E46E5EC42DC619F",
|
||||
"B2A4DB846F0891BF2C76AB2F2ACC8F5B4EC64437135C6E56F3F859DE5FFD5856",
|
||||
"32A122F1352A4C7B3A6D790362CC34749C5E57FCE896377BFDC6CCD14F6CD627",
|
||||
"F1ED6B4A411D8B872E65B9DCB4C8B100375B0DD3D62D07192E011D6D7F339013",
|
||||
"75A7E01C505DD5A179DFE3E000A9B6F1EDDEB55A12F95579A23E15B15DC8BE5A",
|
||||
"47C3002ABA31628447E8E9A8B315FAA935CE30183F9A9B86845E469CA2CDC3DF",
|
||||
"93E516234E35E08CA689FA33A6D38E103881F8DCB53023F728C307AA89D515A7",
|
||||
"2E2FB9CF8A44EB80F4694D38AADAE9B8B7ADAFD2F092E10068E61C98C4F092B0",
|
||||
"73761231F7F3D94EC3D8C63D91BDD0D89045C6F71B917D1925C01253515A6669",
|
||||
"AE35ABDEFBDE520372B31C957020B34A7A4A9DC3115A69803A44016477C84D6E",
|
||||
"ECE6819DBA5DB528F1A241695F5A9811EF99467CDE22510954FD357780BBD078",
|
||||
"42F8B586B357ABBAAAA1C733C3E7D3B75761395340D0CDF600179E8737E22478",
|
||||
"919857E4B902A20216E4819B9BD9FD1FD19A66ECF63151C18A4C48C873DB9578",
|
||||
"ECF412BE0964EC2E71DCF807EEEA6EA8470D3DB15173D46F28AB6E234860AC32",
|
||||
"86E83A7D2ECE3AD5FA87AB2195AE015C950469ABF0B72EAACED318F74886AE90",
|
||||
"3C43D9A973AA4443EF3FC38E42DD306160FBFFDAB901CD8BAA15D09F2597EB87",
|
||||
"0285B7E5E08E1A8E4C15636F0591D87F73CB6A7B6452A932AD72BBC8E5D1CBE3",
|
||||
"36799EA497B1369B170805C078AEFE6188345F9B3E324C21E9CA3FF574E3C3D6"
|
||||
],
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "Amendments",
|
||||
"index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4"
|
||||
}
|
||||
],
|
||||
"account_hash": "5DF3A98772FB73E782B8740E87885C6BAD9BA486422E3626DEF968AD2CB2C514",
|
||||
"close_flags": 0,
|
||||
"close_time": 733708800,
|
||||
"close_time_human": "2023-Apr-02 00:00:00.000000",
|
||||
"close_time_resolution": 10,
|
||||
"closed": true,
|
||||
"hash": "56DA0940767AC2F17F0E384F04816002403D0756432B9D503DDA20128A2AAF11",
|
||||
"ledger_hash": "56DA0940767AC2F17F0E384F04816002403D0756432B9D503DDA20128A2AAF11",
|
||||
"ledger_index": "5",
|
||||
"parent_close_time": 733708800,
|
||||
"parent_hash": "56DA0940767AC2F17F0E384F04816002403D0756432B9D503DDA20128A2AAF11",
|
||||
"seqNum": "5",
|
||||
"totalCoins": "100000000000000000",
|
||||
"total_coins": "100000000000000000",
|
||||
"transaction_hash": "9A77D1D1A4B36DA77B9C4DC63FDEB8F821741D157802F9C42A6ED86003D8B4A0",
|
||||
"transactions": []
|
||||
},
|
||||
"ledger_current_index": 5,
|
||||
"status": "success",
|
||||
"validated": true
|
||||
}
|
||||
@@ -758,7 +758,9 @@
|
||||
# When searching for paths, the default search aggressiveness. This can take
|
||||
# exponentially more resources as the size is increased.
|
||||
#
|
||||
# The default is: 7
|
||||
# The recommended value to support advanced pathfinding is: 7
|
||||
#
|
||||
# The default is: 2
|
||||
#
|
||||
# [path_search_fast]
|
||||
# [path_search_max]
|
||||
@@ -767,12 +769,19 @@
|
||||
# If you do not need pathfinding, you can set path_search_max to zero to
|
||||
# disable it and avoid some expensive bookkeeping.
|
||||
#
|
||||
# The default for 'path_search_fast' is 2. The default for 'path_search_max' is 10.
|
||||
# To support advanced pathfinding the recommended value for
|
||||
# 'path_search_fast' is 2, and for 'path_search_max' is 10.
|
||||
#
|
||||
# The default for 'path_search_fast' is 2. The default for 'path_search_max' is 3.
|
||||
#
|
||||
# [path_search_old]
|
||||
#
|
||||
# For clients that use the legacy path finding interfaces, the search
|
||||
# aggressiveness to use. The default is 7.
|
||||
# aggressiveness to use.
|
||||
#
|
||||
# The recommended value to support advanced pathfinding is: 7.
|
||||
#
|
||||
# The default is: 2
|
||||
#
|
||||
#
|
||||
#
|
||||
@@ -1432,7 +1441,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# account_reserve = 20000000 # 20 XRP
|
||||
# account_reserve = 10000000 # 10 XRP
|
||||
#
|
||||
# owner_reserve = <drops>
|
||||
#
|
||||
@@ -1444,7 +1453,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# owner_reserve = 5000000 # 5 XRP
|
||||
# owner_reserve = 2000000 # 2 XRP
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1629,10 +1638,10 @@ ip = 127.0.0.1
|
||||
admin = 127.0.0.1
|
||||
protocol = ws
|
||||
|
||||
#[port_grpc]
|
||||
#port = 50051
|
||||
#ip = 0.0.0.0
|
||||
#secure_gateway = 127.0.0.1
|
||||
[port_grpc]
|
||||
port = 50051
|
||||
ip = 127.0.0.1
|
||||
secure_gateway = 127.0.0.1
|
||||
|
||||
#[port_ws_public]
|
||||
#port = 6005
|
||||
|
||||
@@ -1401,7 +1401,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# account_reserve = 20000000 # 20 XRP
|
||||
# account_reserve = 10000000 # 10 XRP
|
||||
#
|
||||
# owner_reserve = <drops>
|
||||
#
|
||||
@@ -1413,7 +1413,7 @@
|
||||
# default. Don't change this without understanding the consequences.
|
||||
#
|
||||
# Example:
|
||||
# owner_reserve = 5000000 # 5 XRP
|
||||
# owner_reserve = 2000000 # 2 XRP
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
140
cfg/rippled-standalone.cfg
Executable file
140
cfg/rippled-standalone.cfg
Executable file
@@ -0,0 +1,140 @@
|
||||
# standalone: ./rippled -a --ledgerfile config/genesis.json --conf config/rippled-standalone.cfg
|
||||
[server]
|
||||
port_rpc_admin_local
|
||||
port_ws_public
|
||||
port_ws_admin_local
|
||||
|
||||
# port_peer
|
||||
# port_ws_admin_local
|
||||
# ssl_key = /etc/ssl/private/server.key
|
||||
# ssl_cert = /etc/ssl/certs/server.crt
|
||||
|
||||
[port_rpc_admin_local]
|
||||
port = 5005
|
||||
ip = 0.0.0.0
|
||||
admin = 0.0.0.0
|
||||
protocol = http
|
||||
|
||||
[port_ws_public]
|
||||
port = 80
|
||||
ip = 0.0.0.0
|
||||
protocol = ws
|
||||
|
||||
# [port_peer]
|
||||
# port = 51235
|
||||
# ip = 0.0.0.0
|
||||
# protocol = peer
|
||||
|
||||
[port_ws_admin_local]
|
||||
port = 6006
|
||||
ip = 0.0.0.0
|
||||
admin = 0.0.0.0
|
||||
protocol = ws
|
||||
|
||||
[node_size]
|
||||
small
|
||||
|
||||
# tiny
|
||||
# small
|
||||
# medium
|
||||
# large
|
||||
# huge
|
||||
|
||||
[node_db]
|
||||
type=NuDB
|
||||
path=db/nudb
|
||||
advisory_delete=0
|
||||
|
||||
# How many ledgers do we want to keep (history)?
|
||||
# Integer value that defines the number of ledgers
|
||||
# between online deletion events
|
||||
online_delete=256
|
||||
|
||||
[ledger_history]
|
||||
# How many ledgers do we want to keep (history)?
|
||||
# Integer value (ledger count)
|
||||
# or (if you have lots of TB SSD storage): 'full'
|
||||
256
|
||||
|
||||
[database_path]
|
||||
db
|
||||
|
||||
[debug_logfile]
|
||||
debug.log
|
||||
|
||||
[sntp_servers]
|
||||
time.windows.com
|
||||
time.apple.com
|
||||
time.nist.gov
|
||||
pool.ntp.org
|
||||
|
||||
[ips]
|
||||
r.ripple.com 51235
|
||||
|
||||
[validators_file]
|
||||
validators-example.txt
|
||||
|
||||
[rpc_startup]
|
||||
{ "command": "log_level", "severity": "trace" }
|
||||
|
||||
# severity (order: lots of information .. only errors)
|
||||
# debug
|
||||
# info
|
||||
# warning
|
||||
# error
|
||||
# fatal
|
||||
|
||||
[ssl_verify]
|
||||
1
|
||||
|
||||
[fee_account_reserve]
|
||||
5000000
|
||||
|
||||
[fee_owner_reserve]
|
||||
1000000
|
||||
|
||||
[network_id]
|
||||
21338
|
||||
|
||||
[amendments]
|
||||
740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D628A06927F11 Flow
|
||||
3012E8230864E95A58C60FD61430D7E1B4D3353195F2981DC12B0C7C0950FFAC FlowCross
|
||||
67A34F2CF55BFC0F93AACD5B281413176FEE195269FA6D95219A2DF738671172 fix1513
|
||||
F64E1EABBE79D55B3BB82020516CEC2C582A98A6BFE20FBE9BB6A0D233418064 DepositAuth
|
||||
157D2D480E006395B76F948E3E07A45A05FE10230D88A7993C71F97AE4B1F2D1 Checks
|
||||
7117E2EC2DBF119CA55181D69819F1999ECEE1A0225A7FD2B9ED47940968479C fix1571
|
||||
CA7C02118BA27599528543DFE77BA6838D1B0F43B447D4D7F53523CE6A0E9AC2 fix1543
|
||||
58BE9B5968C4DA7C59BA900961828B113E5490699B21877DEF9A31E9D0FE5D5F fix1623
|
||||
3CBC5C4E630A1B82380295CDA84B32B49DD066602E74E39B85EF64137FA65194 DepositPreauth
|
||||
5D08145F0A4983F23AFFFF514E83FAD355C5ABFBB6CAB76FB5BC8519FF5F33BE fix1515
|
||||
FBD513F1B893AC765B78F250E6FFA6A11B573209D1842ADC787C850696741288 fix1578
|
||||
586480873651E106F1D6339B0C4A8945BA705A777F3F4524626FF1FC07EFE41D MultiSignReserve
|
||||
2CD5286D8D687E98B41102BDD797198E81EA41DF7BD104E6561FEB104EFF2561 fixTakerDryOfferRemoval
|
||||
C4483A1896170C66C098DEA5B0E024309C60DC960DE5F01CD7AF986AA3D9AD37 fixMasterKeyAsRegularKey
|
||||
8F81B066ED20DAECA20DF57187767685EEF3980B228E0667A650BAF24426D3B4 fixCheckThreading
|
||||
621A0B264970359869E3C0363A899909AAB7A887C8B73519E4ECF952D33258A8 fixPayChanRecipientOwnerDir
|
||||
30CD365592B8EE40489BA01AE2F7555CAC9C983145871DC82A42A31CF5BAE7D9 DeletableAccounts
|
||||
89308AF3B8B10B7192C4E613E1D2E4D9BA64B2EE2D5232402AE82A6A7220D953 fixQualityUpperBound
|
||||
00C1FC4A53E60AB02C864641002B3172F38677E29C26C5406685179B37E1EDAC RequireFullyCanonicalSig
|
||||
25BA44241B3BD880770BFA4DA21C7180576831855368CBEC6A3154FDE4A7676E fix1781
|
||||
1F4AFA8FA1BC8827AD4C0F682C03A8B671DCDF6B5C4DE36D44243A684103EF88 HardenedValidations
|
||||
4F46DF03559967AC60F2EB272FEFE3928A7594A45FF774B87A7E540DB0F8F068 fixAmendmentMajorityCalc
|
||||
B4E4F5D2D6FB84DF7399960A732309C9FD530EAE5941838160042833625A6076 NegativeUNL
|
||||
955DF3FA5891195A9DAEFA1DDC6BB244B545DDE1BAA84CBB25D5F12A8DA68A0C TicketBatch
|
||||
AF8DF7465C338AE64B1E937D6C8DA138C0D63AD5134A68792BBBE1F63356C422 FlowSortStrands
|
||||
452F5906C46D46F407883344BFDD90E672B672C5E9943DB4891E3A34FEEEB9DB fixSTAmountCanonicalize
|
||||
B6B3EEDC0267AB50491FDC450A398AF30DBCD977CECED8BEF2499CAB5DAC19E2 fixRmSmallIncreasedQOffers
|
||||
98DECF327BF79997AEC178323AD51A830E457BFC6D454DAF3E46E5EC42DC619F CheckCashMakesTrustLine
|
||||
B2A4DB846F0891BF2C76AB2F2ACC8F5B4EC64437135C6E56F3F859DE5FFD5856 ExpandedSignerList
|
||||
32A122F1352A4C7B3A6D790362CC34749C5E57FCE896377BFDC6CCD14F6CD627 NonFungibleTokensV1_1
|
||||
2E2FB9CF8A44EB80F4694D38AADAE9B8B7ADAFD2F092E10068E61C98C4F092B0 fixUniversalNumber
|
||||
73761231F7F3D94EC3D8C63D91BDD0D89045C6F71B917D1925C01253515A6669 fixNonFungibleTokensV1_2
|
||||
AE35ABDEFBDE520372B31C957020B34A7A4A9DC3115A69803A44016477C84D6E fixNFTokenRemint
|
||||
ECF412BE0964EC2E71DCF807EEEA6EA8470D3DB15173D46F28AB6E234860AC32 Hooks
|
||||
42F8B586B357ABBAAAA1C733C3E7D3B75761395340D0CDF600179E8737E22478 BalanceRewards
|
||||
919857E4B902A20216E4819B9BD9FD1FD19A66ECF63151C18A4C48C873DB9578 PaychanAndEscrowForTokens
|
||||
ECF412BE0964EC2E71DCF807EEEA6EA8470D3DB15173D46F28AB6E234860AC32 URIToken
|
||||
86E83A7D2ECE3AD5FA87AB2195AE015C950469ABF0B72EAACED318F74886AE90 CryptoConditionsSuite
|
||||
3C43D9A973AA4443EF3FC38E42DD306160FBFFDAB901CD8BAA15D09F2597EB87 NonFungibleTokensV1
|
||||
0285B7E5E08E1A8E4C15636F0591D87F73CB6A7B6452A932AD72BBC8E5D1CBE3 fixNFTokenDirV1
|
||||
36799EA497B1369B170805C078AEFE6188345F9B3E324C21E9CA3FF574E3C3D6 fixNFTokenNegOffer
|
||||
@@ -26,7 +26,6 @@
|
||||
#
|
||||
# Examples:
|
||||
# https://vl.ripple.com
|
||||
# https://vl.coil.com
|
||||
# https://vl.xrplf.org
|
||||
# http://127.0.0.1:8000
|
||||
# file:///etc/opt/ripple/vl.txt
|
||||
|
||||
4
docker-unit-tests.sh
Normal file
4
docker-unit-tests.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run --rm -i -v $(pwd):/io ubuntu sh -c '/io/release-build/xahaud -u'
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
# Rippled Docker Image
|
||||
# `rippled` Docker Image
|
||||
|
||||
Rippled has a continuous deployment pipeline that turns every git commit into a
|
||||
docker image for quick testing and deployment.
|
||||
|
||||
To run the tip of the latest release via docker:
|
||||
|
||||
```$ docker run -P -v /srv/rippled/ ripple/rippled:latest```
|
||||
|
||||
To run the tip of active development:
|
||||
|
||||
```$ docker run -P -v /srv/rippled/ ripple/rippled:develop```
|
||||
|
||||
Where ```/srv/rippled``` points to a directory containing a rippled.cfg and
|
||||
database files. By default, port 5005/tcp maps to the RPC port and 51235/udp to
|
||||
the peer port.
|
||||
- Some info relating to Docker containers can be found here: [../Builds/containers](../Builds/containers)
|
||||
- Images for building and testing rippled can be found here: [thejohnfreeman/rippled-docker](https://github.com/thejohnfreeman/rippled-docker/)
|
||||
- These images do not have rippled. They have all the tools necessary to build rippled.
|
||||
|
||||
16
external/snappy/conandata.yml
vendored
Normal file
16
external/snappy/conandata.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
sources:
|
||||
"1.1.9":
|
||||
url: "https://github.com/google/snappy/archive/1.1.9.tar.gz"
|
||||
sha256: "75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7"
|
||||
"1.1.8":
|
||||
url: "https://github.com/google/snappy/archive/1.1.8.tar.gz"
|
||||
sha256: "16b677f07832a612b0836178db7f374e414f94657c138e6993cbfc5dcc58651f"
|
||||
"1.1.7":
|
||||
url: "https://github.com/google/snappy/archive/1.1.7.tar.gz"
|
||||
sha256: "3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4"
|
||||
patches:
|
||||
"1.1.9":
|
||||
- patch_file: "patches/1.1.9-0001-fix-inlining-failure.patch"
|
||||
- patch_file: "patches/1.1.9-0002-no-Werror.patch"
|
||||
- patch_file: "patches/1.1.9-0003-fix-clobber-list-older-llvm.patch"
|
||||
- patch_file: "patches/1.1.9-0004-rtti-by-default.patch"
|
||||
89
external/snappy/conanfile.py
vendored
Normal file
89
external/snappy/conanfile.py
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.54.0"
|
||||
|
||||
|
||||
class SnappyConan(ConanFile):
|
||||
name = "snappy"
|
||||
description = "A fast compressor/decompressor"
|
||||
topics = ("google", "compressor", "decompressor")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/google/snappy"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == 'Windows':
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
check_min_cppstd(self, 11)
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["SNAPPY_BUILD_TESTS"] = False
|
||||
if Version(self.version) >= "1.1.8":
|
||||
tc.variables["SNAPPY_FUZZING_BUILD"] = False
|
||||
tc.variables["SNAPPY_REQUIRE_AVX"] = False
|
||||
tc.variables["SNAPPY_REQUIRE_AVX2"] = False
|
||||
tc.variables["SNAPPY_INSTALL"] = True
|
||||
if Version(self.version) >= "1.1.9":
|
||||
tc.variables["SNAPPY_BUILD_BENCHMARKS"] = False
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "Snappy")
|
||||
self.cpp_info.set_property("cmake_target_name", "Snappy::snappy")
|
||||
# TODO: back to global scope in conan v2 once cmake_find_package* generators removed
|
||||
self.cpp_info.components["snappylib"].libs = ["snappy"]
|
||||
if not self.options.shared:
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.components["snappylib"].system_libs.append("m")
|
||||
|
||||
# TODO: to remove in conan v2 once cmake_find_package* generators removed
|
||||
self.cpp_info.names["cmake_find_package"] = "Snappy"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "Snappy"
|
||||
self.cpp_info.components["snappylib"].names["cmake_find_package"] = "snappy"
|
||||
self.cpp_info.components["snappylib"].names["cmake_find_package_multi"] = "snappy"
|
||||
self.cpp_info.components["snappylib"].set_property("cmake_target_name", "Snappy::snappy")
|
||||
14
external/snappy/patches/1.1.9-0001-fix-inlining-failure.patch
vendored
Normal file
14
external/snappy/patches/1.1.9-0001-fix-inlining-failure.patch
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
Fixes the following error:
|
||||
error: inlining failed in call to ‘always_inline’ ‘size_t snappy::AdvanceToNextTag(const uint8_t**, size_t*)’: function body can be overwritten at link time
|
||||
|
||||
--- snappy-stubs-internal.h
|
||||
+++ snappy-stubs-internal.h
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
// Inlining hints.
|
||||
#ifdef HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||
-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
|
||||
+#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#else
|
||||
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||
#endif
|
||||
12
external/snappy/patches/1.1.9-0002-no-Werror.patch
vendored
Normal file
12
external/snappy/patches/1.1.9-0002-no-Werror.patch
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
--- CMakeLists.txt
|
||||
+++ CMakeLists.txt
|
||||
@@ -69,7 +69,7 @@
|
||||
- # Use -Werror for clang only.
|
||||
+if(0)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
||||
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
-
|
||||
+endif()
|
||||
12
external/snappy/patches/1.1.9-0003-fix-clobber-list-older-llvm.patch
vendored
Normal file
12
external/snappy/patches/1.1.9-0003-fix-clobber-list-older-llvm.patch
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
asm clobbers do not work for clang < 9 and apple-clang < 11 (found by SpaceIm)
|
||||
--- snappy.cc
|
||||
+++ snappy.cc
|
||||
@@ -1026,7 +1026,7 @@
|
||||
size_t literal_len = *tag >> 2;
|
||||
size_t tag_type = *tag;
|
||||
bool is_literal;
|
||||
-#if defined(__GNUC__) && defined(__x86_64__)
|
||||
+#if defined(__GNUC__) && defined(__x86_64__) && ( (!defined(__clang__) && !defined(__APPLE__)) || (!defined(__APPLE__) && defined(__clang__) && (__clang_major__ >= 9)) || (defined(__APPLE__) && defined(__clang__) && (__clang_major__ > 11)) )
|
||||
// TODO clang misses the fact that the (c & 3) already correctly
|
||||
// sets the zero flag.
|
||||
asm("and $3, %k[tag_type]\n\t"
|
||||
20
external/snappy/patches/1.1.9-0004-rtti-by-default.patch
vendored
Normal file
20
external/snappy/patches/1.1.9-0004-rtti-by-default.patch
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -53,8 +53,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_definitions(-D_HAS_EXCEPTIONS=0)
|
||||
|
||||
# Disable RTTI.
|
||||
- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Use -Wall for clang and gcc.
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
||||
@@ -78,8 +76,6 @@ endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
|
||||
# Disable RTTI.
|
||||
- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
|
||||
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
||||
68
hook/LaunchHooks.md
Normal file
68
hook/LaunchHooks.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# Xahau Launch Hooks
|
||||
|
||||
## Savings Hook
|
||||
When it comes to managing money, it is a common practice to maintain separate spending and savings accounts.
|
||||
Suppose you receive an income or salary to your on-ledger account several times a month. Each time you receive funds above a certain threshold you may wish to move a predefined percentage to a savings account where you will not accidentally spend them. The savings hook does exactly this.
|
||||
### Hook Parameters
|
||||
1. Account to install on
|
||||
2. Account to send savings to
|
||||
3. The percentage to send
|
||||
4. The threshold at which it is activated
|
||||
5. Whether it applies to incoming payments only, outgoing payments only or both.
|
||||
### xApp Features
|
||||
1. Display the send-to account
|
||||
2. Display the percentage
|
||||
3. Display the total amount sent
|
||||
4. Display the conditions of sending (threshold + incoming/outgoing payments)
|
||||
5. Allow the hook to be uninstalled
|
||||
|
||||
## Firewall Hook
|
||||
The ledger is a messy place full of unwanted transactions and spam. To avoid being spammed with low value transactions containing unsolicitied memos you may install a Firewall hook on your account.
|
||||
### Hook Parameters
|
||||
1. Types of transactions to allow into and out of your account (Payment, Escrow, PayChannel) etc.
|
||||
2. Allow a minimum number of drops for an incoming txn to be allowed.
|
||||
3. Allow a minimum amount to be specified for each of the trustline assets on the account as well.
|
||||
4. Allow any txn with a memo larger than X bytes to be blocked regardless of other rules.
|
||||
### xApp Features
|
||||
1. Display the current settings of the hook. Allow the settings to be changed.
|
||||
2. Allow the hook to be uninstalled.
|
||||
|
||||
## Blocklist Hook
|
||||
Filter outgoing and incoming payments against a known list of scam accounts maintained by a third party. This acts as a guard against accidentally sending to a scam, or being sent tainted funds by a scammer.
|
||||
### Hook Parameters
|
||||
1. The blocklist (account) to listen to.
|
||||
### xApp Features
|
||||
1. Number of times a transaction was blocked.
|
||||
2. The current blocklist (account) being listened to.
|
||||
3. Allow the hook to be uninstalled.
|
||||
|
||||
## Direct Debit Hook
|
||||
Allow trusted third parties to pull funds from your account up to a limit you set. For example your power company can bill you and your account can automatically pay that bill.
|
||||
### Hook Parameters
|
||||
1. One or more accounts to provide direct deposit authorization to.
|
||||
2. A currency and a limit for each of these.
|
||||
## xApp Features
|
||||
1. See who you've authorized.
|
||||
2. See how much they're authorized for.
|
||||
3. See how much they've drawn down this month.
|
||||
4. Allow authorization to be removed.
|
||||
5. Allow authorization limit to be changed.
|
||||
6. Allow additional authorizations to be created.
|
||||
7. Allow the hook to be uninstalled.
|
||||
8. Show a list of recent direct debit transactions.
|
||||
|
||||
|
||||
## High-Value Payment Hook
|
||||
When sending high value transactions out of your account, require first a notification that a high valued payment will be made, followed by a time delay, followed by the high value transaction itself. This prevents accidental high value sends, adding an additional layer of security to your account.
|
||||
### Hook Parameters
|
||||
1. Select currencies for which the hook will act.
|
||||
2. Select the thresholds for which the hook will be triggered.
|
||||
### xApp Features
|
||||
1. See current pending outgoing high value transactions.
|
||||
2. State that the hook is active and for which currencies and thresholds.
|
||||
3. Allow the hook to be uninstalled.
|
||||
4. If installed, and a high value transaction is made from Xumm, it is redirected into the xApp.
|
||||
5. The xApp then generates a notification transaction (ttInvoke) which is sent to the hook.
|
||||
6. The xApp will then remind the user with an event at a later time that the transaction proper still needs to be sent.
|
||||
7. Sending the transaction proper again will result in successful send.
|
||||
|
||||
@@ -41,12 +41,18 @@
|
||||
"PayChannel": 120,
|
||||
"Check": 67,
|
||||
"DepositPreauth": 112,
|
||||
"NegativeUnl": 78,
|
||||
"Any": 0,
|
||||
"Child": 7378,
|
||||
"NegativeUNL": 78,
|
||||
"NFTokenPage": 80,
|
||||
"NFTokenOffer": 55,
|
||||
"Any": -3,
|
||||
"Child": -2,
|
||||
"Nickname": 110,
|
||||
"Contract": 99,
|
||||
"GeneratorMap": 103
|
||||
"GeneratorMap": 103,
|
||||
"Hook": 72,
|
||||
"HookState": 118,
|
||||
"HookDefinition": 68,
|
||||
"EmittedTxn": 69
|
||||
},
|
||||
"FIELDS": [
|
||||
[
|
||||
@@ -132,7 +138,7 @@
|
||||
[
|
||||
"LedgerEntry",
|
||||
{
|
||||
"nth": 257,
|
||||
"nth": 1,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": false,
|
||||
"isSigningField": true,
|
||||
@@ -142,7 +148,7 @@
|
||||
[
|
||||
"Transaction",
|
||||
{
|
||||
"nth": 257,
|
||||
"nth": 1,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": false,
|
||||
"isSigningField": true,
|
||||
@@ -152,7 +158,7 @@
|
||||
[
|
||||
"Validation",
|
||||
{
|
||||
"nth": 257,
|
||||
"nth": 1,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": false,
|
||||
"isSigningField": true,
|
||||
@@ -162,7 +168,7 @@
|
||||
[
|
||||
"Metadata",
|
||||
{
|
||||
"nth": 257,
|
||||
"nth": 1,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -319,6 +325,16 @@
|
||||
"type": "UInt16"
|
||||
}
|
||||
],
|
||||
[
|
||||
"NetworkID",
|
||||
{
|
||||
"nth": 1,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "UInt32"
|
||||
}
|
||||
],
|
||||
[
|
||||
"Flags",
|
||||
{
|
||||
@@ -710,7 +726,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
"TokenTaxon",
|
||||
"NFTokenTaxon",
|
||||
{
|
||||
"nth": 42,
|
||||
"isVLEncoded": false,
|
||||
@@ -720,7 +736,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
"MintedTokens",
|
||||
"MintedNFTokens",
|
||||
{
|
||||
"nth": 43,
|
||||
"isVLEncoded": false,
|
||||
@@ -730,7 +746,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
"BurnedTokens",
|
||||
"BurnedNFTokens",
|
||||
{
|
||||
"nth": 44,
|
||||
"isVLEncoded": false,
|
||||
@@ -759,6 +775,16 @@
|
||||
"type": "UInt32"
|
||||
}
|
||||
],
|
||||
[
|
||||
"LockCount",
|
||||
{
|
||||
"nth": 47,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "UInt32"
|
||||
}
|
||||
],
|
||||
[
|
||||
"RewardTime",
|
||||
{
|
||||
@@ -900,7 +926,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
"OfferNode",
|
||||
"NFTokenOfferNode",
|
||||
{
|
||||
"nth": 12,
|
||||
"isVLEncoded": false,
|
||||
@@ -919,16 +945,6 @@
|
||||
"type": "UInt64"
|
||||
}
|
||||
],
|
||||
[
|
||||
"HookOn",
|
||||
{
|
||||
"nth": 16,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "UInt64"
|
||||
}
|
||||
],
|
||||
[
|
||||
"HookInstructionCount",
|
||||
{
|
||||
@@ -1189,6 +1205,16 @@
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"HookOn",
|
||||
{
|
||||
"nth": 20,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"Digest",
|
||||
{
|
||||
@@ -1260,7 +1286,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
"BuyOffer",
|
||||
"NFTokenBuyOffer",
|
||||
{
|
||||
"nth": 28,
|
||||
"isVLEncoded": false,
|
||||
@@ -1270,7 +1296,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
"SellOffer",
|
||||
"NFTokenSellOffer",
|
||||
{
|
||||
"nth": 29,
|
||||
"isVLEncoded": false,
|
||||
@@ -1319,6 +1345,26 @@
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"OfferID",
|
||||
{
|
||||
"nth": 34,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"EscrowID",
|
||||
{
|
||||
"nth": 35,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"Amount",
|
||||
{
|
||||
@@ -1459,6 +1505,26 @@
|
||||
"type": "Amount"
|
||||
}
|
||||
],
|
||||
[
|
||||
"HookCallbackFee",
|
||||
{
|
||||
"nth": 20,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Amount"
|
||||
}
|
||||
],
|
||||
[
|
||||
"LockedBalance",
|
||||
{
|
||||
"nth": 21,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Amount"
|
||||
}
|
||||
],
|
||||
[
|
||||
"PublicKey",
|
||||
{
|
||||
@@ -1706,7 +1772,7 @@
|
||||
"isVLEncoded": true,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type":"Blob"
|
||||
"type": "Blob"
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -1840,7 +1906,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
"TokenOffers",
|
||||
"NFTokenOffers",
|
||||
{
|
||||
"nth": 4,
|
||||
"isVLEncoded": true,
|
||||
@@ -1849,6 +1915,16 @@
|
||||
"type": "Vector256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"HookNamespaces",
|
||||
{
|
||||
"nth": 5,
|
||||
"isVLEncoded": true,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
"type": "Vector256"
|
||||
}
|
||||
],
|
||||
[
|
||||
"Paths",
|
||||
{
|
||||
@@ -2224,6 +2300,9 @@
|
||||
"telCAN_NOT_QUEUE_BLOCKED": -389,
|
||||
"telCAN_NOT_QUEUE_FEE": -388,
|
||||
"telCAN_NOT_QUEUE_FULL": -387,
|
||||
"telWRONG_NETWORK": -386,
|
||||
"telREQUIRES_NETWORK_ID": -385,
|
||||
"telNETWORK_ID_MAKES_TX_NON_CANONICAL": -384,
|
||||
|
||||
"temMALFORMED": -299,
|
||||
"temBAD_AMOUNT": -298,
|
||||
@@ -2258,10 +2337,13 @@
|
||||
"temBAD_TICK_SIZE": -269,
|
||||
"temINVALID_ACCOUNT_ID": -268,
|
||||
"temCANNOT_PREAUTH_SELF": -267,
|
||||
"temUNCERTAIN": -266,
|
||||
"temUNKNOWN": -265,
|
||||
"temSEQ_AND_TICKET": -264,
|
||||
"temBAD_NFTOKEN_TRANSFER_FEE": -263,
|
||||
"temINVALID_COUNT": -266,
|
||||
"temHOOK_DATA_TOO_LARGE": -265,
|
||||
"temHOOK_REJECTED": -264,
|
||||
"temUNCERTAIN": -263,
|
||||
"temUNKNOWN": -262,
|
||||
"temSEQ_AND_TICKET": -261,
|
||||
"temBAD_NFTOKEN_TRANSFER_FEE": -260,
|
||||
|
||||
"tefFAILURE": -199,
|
||||
"tefALREADY": -198,
|
||||
@@ -2297,6 +2379,7 @@
|
||||
"terNO_RIPPLE": -90,
|
||||
"terQUEUED": -89,
|
||||
"terPRE_TICKET": -88,
|
||||
"terNO_HOOK": -87,
|
||||
|
||||
"tesSUCCESS": 0,
|
||||
|
||||
@@ -2339,7 +2422,6 @@
|
||||
"tecHAS_OBLIGATIONS": 151,
|
||||
"tecTOO_SOON": 152,
|
||||
"tecHOOK_REJECTED": 153,
|
||||
|
||||
"tecMAX_SEQUENCE_REACHED": 154,
|
||||
"tecNO_SUITABLE_NFTOKEN_PAGE": 155,
|
||||
"tecNFTOKEN_BUY_SELL_MISMATCH": 156,
|
||||
@@ -2348,8 +2430,8 @@
|
||||
"tecINSUFFICIENT_FUNDS": 159,
|
||||
"tecOBJECT_NOT_FOUND": 160,
|
||||
"tecINSUFFICIENT_PAYMENT": 161,
|
||||
"tecINCORRECT_ASSET": 162,
|
||||
"tecTOO_MANY": 163
|
||||
"tecREQUIRES_FLAG": 162,
|
||||
"tecPRECISION_LOSS": 163
|
||||
},
|
||||
"TRANSACTION_TYPES": {
|
||||
"Invalid": -1,
|
||||
@@ -2385,8 +2467,7 @@
|
||||
"Invoke": 99,
|
||||
"EnableAmendment": 100,
|
||||
"SetFee": 101,
|
||||
"UNLModify": 102
|
||||
"UNLModify": 102,
|
||||
"EmitFailure": 103
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define MANTISSA_UNDERSIZED -27
|
||||
#define EXPONENT_OVERSIZED -28
|
||||
#define EXPONENT_UNDERSIZED -29
|
||||
#define OVERFLOW -30
|
||||
#define XFL_OVERFLOW -30
|
||||
#define NOT_IOU_AMOUNT -31
|
||||
#define NOT_AN_AMOUNT -32
|
||||
#define CANT_RETURN_NEGATIVE -33
|
||||
@@ -42,5 +42,8 @@
|
||||
#define RESERVE_INSUFFICIENT -38
|
||||
#define COMPLEX_NOT_SUPPORTED -39
|
||||
#define DOES_NOT_MATCH -40
|
||||
#define INVALID_KEY -41
|
||||
#define NOT_A_STRING -42
|
||||
#define MEM_OVERLAP -43
|
||||
#define HOOK_ERROR_CODES
|
||||
#endif //HOOK_ERROR_CODES
|
||||
#endif //HOOK_ERROR_CODES
|
||||
543
hook/extern.h
543
hook/extern.h
@@ -9,250 +9,63 @@ _g(uint32_t guard_id, uint32_t maxiter);
|
||||
extern int64_t
|
||||
accept(uint32_t read_ptr, uint32_t read_len, int64_t error_code);
|
||||
|
||||
extern int64_t
|
||||
emit(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
etxn_burden(void);
|
||||
|
||||
extern int64_t
|
||||
etxn_details(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
etxn_fee_base(uint32_t read_ptr, uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
etxn_generation(void);
|
||||
|
||||
extern int64_t
|
||||
etxn_nonce(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
etxn_reserve(uint32_t count);
|
||||
|
||||
extern int64_t
|
||||
fee_base(void);
|
||||
|
||||
extern int64_t
|
||||
float_compare(int64_t float1, int64_t float2, uint32_t mode);
|
||||
|
||||
extern int64_t
|
||||
float_divide(int64_t float1, int64_t float2);
|
||||
|
||||
extern int64_t
|
||||
float_exponent(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_exponent_set(int64_t float1, int32_t exponent);
|
||||
|
||||
extern int64_t
|
||||
float_int(int64_t float1, uint32_t decimal_places, uint32_t abs);
|
||||
|
||||
extern int64_t
|
||||
float_invert(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_log(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_mantissa(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_mantissa_set(int64_t float1, int64_t mantissa);
|
||||
|
||||
extern int64_t
|
||||
float_mulratio(
|
||||
int64_t float1,
|
||||
uint32_t round_up,
|
||||
uint32_t numerator,
|
||||
uint32_t denominator);
|
||||
|
||||
extern int64_t
|
||||
float_multiply(int64_t float1, int64_t float2);
|
||||
|
||||
extern int64_t
|
||||
float_negate(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_one(void);
|
||||
|
||||
extern int64_t
|
||||
float_root(int64_t float1, uint32_t n);
|
||||
|
||||
extern int64_t
|
||||
float_set(int32_t exponent, int64_t mantissa);
|
||||
|
||||
extern int64_t
|
||||
float_sign(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_sign_set(int64_t float1, uint32_t negative);
|
||||
|
||||
extern int64_t
|
||||
float_sto(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t cread_ptr,
|
||||
uint32_t cread_len,
|
||||
uint32_t iread_ptr,
|
||||
uint32_t iread_len,
|
||||
int64_t float1,
|
||||
uint32_t field_code);
|
||||
|
||||
extern int64_t
|
||||
float_sto_set(uint32_t read_ptr, uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
float_sum(int64_t float1, int64_t float2);
|
||||
|
||||
extern int64_t
|
||||
hook_account(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
hook_again(void);
|
||||
|
||||
extern int64_t
|
||||
hook_hash(uint32_t write_ptr, uint32_t write_len, int32_t hook_no);
|
||||
|
||||
extern int64_t
|
||||
hook_param(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
hook_param_set(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len,
|
||||
uint32_t hread_ptr,
|
||||
uint32_t hread_len);
|
||||
|
||||
extern int64_t
|
||||
hook_pos(void);
|
||||
|
||||
extern int64_t
|
||||
hook_skip(uint32_t read_ptr, uint32_t read_len, uint32_t flags);
|
||||
|
||||
extern int64_t
|
||||
ledger_keylet(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t lread_ptr,
|
||||
uint32_t lread_len,
|
||||
uint32_t hread_ptr,
|
||||
uint32_t hread_len);
|
||||
|
||||
extern int64_t
|
||||
ledger_last_hash(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
ledger_last_time(void);
|
||||
|
||||
extern int64_t
|
||||
ledger_nonce(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
ledger_seq(void);
|
||||
|
||||
extern int64_t
|
||||
meta_slot(uint32_t slot_no);
|
||||
|
||||
extern int64_t
|
||||
otxn_burden(void);
|
||||
|
||||
extern int64_t
|
||||
otxn_field(uint32_t write_ptr, uint32_t write_len, uint32_t field_id);
|
||||
|
||||
extern int64_t
|
||||
otxn_field_txt(uint32_t write_ptr, uint32_t write_len, uint32_t field_id);
|
||||
|
||||
extern int64_t
|
||||
otxn_generation(void);
|
||||
|
||||
extern int64_t
|
||||
otxn_id(uint32_t write_ptr, uint32_t write_len, uint32_t flags);
|
||||
|
||||
extern int64_t
|
||||
otxn_slot(uint32_t slot_no);
|
||||
|
||||
extern int64_t
|
||||
otxn_type(void);
|
||||
|
||||
extern int64_t
|
||||
rollback(uint32_t read_ptr, uint32_t read_len, int64_t error_code);
|
||||
|
||||
extern int64_t
|
||||
slot(uint32_t write_ptr, uint32_t write_len, uint32_t slot);
|
||||
// UTIL
|
||||
|
||||
extern int64_t
|
||||
slot_clear(uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_count(uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_float(uint32_t slot_no);
|
||||
|
||||
extern int64_t
|
||||
slot_id(uint32_t write_ptr, uint32_t write_len, uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_set(uint32_t read_ptr, uint32_t read_len, uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_size(uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_subarray(uint32_t parent_slot, uint32_t array_id, uint32_t new_slot);
|
||||
|
||||
extern int64_t
|
||||
slot_subfield(uint32_t parent_slot, uint32_t field_id, uint32_t new_slot);
|
||||
|
||||
extern int64_t
|
||||
slot_type(uint32_t slot_no, uint32_t flags);
|
||||
|
||||
extern int64_t
|
||||
state(
|
||||
util_raddr(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
util_accid(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
util_verify(
|
||||
uint32_t dread_ptr,
|
||||
uint32_t dread_len,
|
||||
uint32_t sread_ptr,
|
||||
uint32_t sread_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len);
|
||||
|
||||
extern int64_t
|
||||
state_foreign(
|
||||
util_sha512h(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len,
|
||||
uint32_t nread_ptr,
|
||||
uint32_t nread_len,
|
||||
uint32_t aread_ptr,
|
||||
uint32_t aread_len);
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
state_foreign_set(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len,
|
||||
uint32_t nread_ptr,
|
||||
uint32_t nread_len,
|
||||
uint32_t aread_ptr,
|
||||
uint32_t aread_len);
|
||||
util_keylet(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t keylet_type,
|
||||
uint32_t a,
|
||||
uint32_t b,
|
||||
uint32_t c,
|
||||
uint32_t d,
|
||||
uint32_t e,
|
||||
uint32_t f);
|
||||
|
||||
// STO
|
||||
|
||||
extern int64_t
|
||||
state_set(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len);
|
||||
sto_validate(uint32_t tread_ptr, uint32_t tread_len);
|
||||
|
||||
extern int64_t
|
||||
sto_subfield(uint32_t read_ptr, uint32_t read_len, uint32_t field_id);
|
||||
|
||||
extern int64_t
|
||||
sto_subarray(uint32_t read_ptr, uint32_t read_len, uint32_t array_id);
|
||||
|
||||
extern int64_t
|
||||
sto_emplace(
|
||||
@@ -272,14 +85,222 @@ sto_erase(
|
||||
uint32_t read_len,
|
||||
uint32_t field_id);
|
||||
|
||||
extern int64_t
|
||||
sto_subarray(uint32_t read_ptr, uint32_t read_len, uint32_t array_id);
|
||||
// EMITTED TXN
|
||||
|
||||
extern int64_t
|
||||
sto_subfield(uint32_t read_ptr, uint32_t read_len, uint32_t field_id);
|
||||
etxn_burden(void);
|
||||
|
||||
extern int64_t
|
||||
sto_validate(uint32_t tread_ptr, uint32_t tread_len);
|
||||
etxn_details(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
etxn_fee_base(uint32_t read_ptr, uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
etxn_reserve(uint32_t count);
|
||||
|
||||
extern int64_t
|
||||
etxn_generation(void);
|
||||
|
||||
extern int64_t
|
||||
etxn_nonce(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
emit(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
// FLOAT
|
||||
|
||||
extern int64_t
|
||||
float_set(int32_t exponent, int64_t mantissa);
|
||||
|
||||
extern int64_t
|
||||
float_multiply(int64_t float1, int64_t float2);
|
||||
|
||||
extern int64_t
|
||||
float_mulratio(
|
||||
int64_t float1,
|
||||
uint32_t round_up,
|
||||
uint32_t numerator,
|
||||
uint32_t denominator);
|
||||
|
||||
extern int64_t
|
||||
float_negate(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_compare(int64_t float1, int64_t float2, uint32_t mode);
|
||||
|
||||
extern int64_t
|
||||
float_sum(int64_t float1, int64_t float2);
|
||||
|
||||
extern int64_t
|
||||
float_sto(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t cread_ptr,
|
||||
uint32_t cread_len,
|
||||
uint32_t iread_ptr,
|
||||
uint32_t iread_len,
|
||||
int64_t float1,
|
||||
uint32_t field_code);
|
||||
|
||||
extern int64_t
|
||||
float_sto_set(uint32_t read_ptr, uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
float_invert(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_divide(int64_t float1, int64_t float2);
|
||||
|
||||
extern int64_t
|
||||
float_one(void);
|
||||
|
||||
extern int64_t
|
||||
float_mantissa(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_sign(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_int(int64_t float1, uint32_t decimal_places, uint32_t abs);
|
||||
|
||||
extern int64_t
|
||||
float_log(int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
float_root(int64_t float1, uint32_t n);
|
||||
|
||||
// LEDGER
|
||||
|
||||
extern int64_t
|
||||
fee_base(void);
|
||||
|
||||
extern int64_t
|
||||
ledger_seq(void);
|
||||
|
||||
extern int64_t
|
||||
ledger_last_time(void);
|
||||
|
||||
extern int64_t
|
||||
ledger_last_hash(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
ledger_nonce(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
ledger_keylet(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t lread_ptr,
|
||||
uint32_t lread_len,
|
||||
uint32_t hread_ptr,
|
||||
uint32_t hread_len);
|
||||
|
||||
// HOOK
|
||||
|
||||
extern int64_t
|
||||
hook_account(uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
extern int64_t
|
||||
hook_hash(uint32_t write_ptr, uint32_t write_len, int32_t hook_no);
|
||||
|
||||
extern int64_t
|
||||
hook_param_set(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len,
|
||||
uint32_t hread_ptr,
|
||||
uint32_t hread_len);
|
||||
|
||||
extern int64_t
|
||||
hook_param(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
hook_again(void);
|
||||
|
||||
extern int64_t
|
||||
hook_skip(uint32_t read_ptr, uint32_t read_len, uint32_t flags);
|
||||
|
||||
extern int64_t
|
||||
hook_pos(void);
|
||||
|
||||
// SLOT
|
||||
|
||||
extern int64_t
|
||||
slot(uint32_t write_ptr, uint32_t write_len, uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_clear(uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_count(uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_set(uint32_t read_ptr, uint32_t read_len, uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_size(uint32_t slot);
|
||||
|
||||
extern int64_t
|
||||
slot_subarray(uint32_t parent_slot, uint32_t array_id, uint32_t new_slot);
|
||||
|
||||
extern int64_t
|
||||
slot_subfield(uint32_t parent_slot, uint32_t field_id, uint32_t new_slot);
|
||||
|
||||
extern int64_t
|
||||
slot_type(uint32_t slot_no, uint32_t flags);
|
||||
|
||||
extern int64_t
|
||||
slot_float(uint32_t slot_no);
|
||||
|
||||
// STATE
|
||||
|
||||
extern int64_t
|
||||
state_set(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len);
|
||||
|
||||
extern int64_t
|
||||
state_foreign_set(
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len,
|
||||
uint32_t nread_ptr,
|
||||
uint32_t nread_len,
|
||||
uint32_t aread_ptr,
|
||||
uint32_t aread_len);
|
||||
|
||||
extern int64_t
|
||||
state(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len);
|
||||
|
||||
extern int64_t
|
||||
state_foreign(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len,
|
||||
uint32_t nread_ptr,
|
||||
uint32_t nread_len,
|
||||
uint32_t aread_ptr,
|
||||
uint32_t aread_len);
|
||||
|
||||
// TRACE
|
||||
|
||||
extern int64_t
|
||||
trace(
|
||||
@@ -289,55 +310,45 @@ trace(
|
||||
uint32_t dread_len,
|
||||
uint32_t as_hex);
|
||||
|
||||
extern int64_t
|
||||
trace_float(uint32_t read_ptr, uint32_t read_len, int64_t float1);
|
||||
|
||||
extern int64_t
|
||||
trace_num(uint32_t read_ptr, uint32_t read_len, int64_t number);
|
||||
|
||||
extern int64_t
|
||||
trace_slot(uint32_t read_ptr, uint32_t read_len, uint32_t slot);
|
||||
trace_float(uint32_t read_ptr, uint32_t read_len, int64_t float1);
|
||||
|
||||
// OTXN
|
||||
|
||||
extern int64_t
|
||||
util_accid(
|
||||
otxn_burden(void);
|
||||
|
||||
extern int64_t
|
||||
otxn_field(uint32_t write_ptr, uint32_t write_len, uint32_t field_id);
|
||||
|
||||
extern int64_t
|
||||
otxn_generation(void);
|
||||
|
||||
extern int64_t
|
||||
otxn_id(uint32_t write_ptr, uint32_t write_len, uint32_t flags);
|
||||
|
||||
extern int64_t
|
||||
otxn_type(void);
|
||||
|
||||
extern int64_t
|
||||
otxn_slot(uint32_t slot_no);
|
||||
|
||||
extern int64_t
|
||||
otxn_param(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
|
||||
extern int64_t
|
||||
util_keylet(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t keylet_type,
|
||||
uint32_t a,
|
||||
uint32_t b,
|
||||
uint32_t c,
|
||||
uint32_t d,
|
||||
uint32_t e,
|
||||
uint32_t f);
|
||||
meta_slot(uint32_t slot_no);
|
||||
|
||||
extern int64_t
|
||||
util_raddr(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
// featureHooks1
|
||||
|
||||
extern int64_t
|
||||
util_sha512h(
|
||||
uint32_t write_ptr,
|
||||
uint32_t write_len,
|
||||
uint32_t read_ptr,
|
||||
uint32_t read_len);
|
||||
extern int64_t xpop_slot(uint32_t, uint32_t);
|
||||
|
||||
extern int64_t
|
||||
util_verify(
|
||||
uint32_t dread_ptr,
|
||||
uint32_t dread_len,
|
||||
uint32_t sread_ptr,
|
||||
uint32_t sread_len,
|
||||
uint32_t kread_ptr,
|
||||
uint32_t kread_len);
|
||||
#define HOOK_EXTERN
|
||||
#endif // HOOK_EXTERN
|
||||
|
||||
377
hook/gov_hook.c
377
hook/gov_hook.c
@@ -1,377 +0,0 @@
|
||||
#include "hookapi.h"
|
||||
#define ASSERT(x)\
|
||||
if (!(x))\
|
||||
rollback(0,0,__LINE__);
|
||||
|
||||
#define INIT_MEMBER_COUNT 5
|
||||
#define MAX_MEMBER_COUNT 20
|
||||
#define INIT_AMOUNT 50000000000000ULL // 50MM
|
||||
|
||||
// test accounts only, must be replaced with real accounts prior to launch
|
||||
uint8_t initial_members[] =
|
||||
{
|
||||
// the first 12 bytes of each is padding to allow a reverse key
|
||||
// to be easily set for the account id
|
||||
|
||||
// acc 0 - rJmkqLL4mqrc9kbP5Ztkq4TvVamYNetedp
|
||||
0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U, 0x00U, 0x00U,
|
||||
0xC2U,0xF1U,0x07U,0xE6U,0xE8U,0x64U,0xD3U,0x90U,0x6DU,0x0AU,
|
||||
0x08U,0x84U,0x46U,0xFDU,0xDFU,0x8AU,0x7BU,0x2FU,0x56U,0x9CU,
|
||||
|
||||
// acc 1 - rEVGdPT6ACPPcXGNwNeeYYtoRTKFaqhEi4
|
||||
0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U, 0x00U, 0x00U,
|
||||
0x9EU,0xEAU,0x73U,0xF5U,0xF0U,0x62U,0x7EU,0x69U,0x39U,0x7EU,
|
||||
0xC7U,0x2EU,0x9AU,0x3CU,0x78U,0x04U,0xC0U,0xF2U,0xBFU,0x69U,
|
||||
|
||||
// acc 2 - rJi1kZsQthVqVPLmQdTmG8AtiAKk26J9ST
|
||||
0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U, 0x00U, 0x00U,
|
||||
0xC3U,0xE8U,0xE2U,0x9AU,0xB6U,0x28U,0x47U,0x27U,0x5CU,0xEDU,
|
||||
0x36U,0xEBU,0xF4U,0xE9U,0x28U,0xDCU,0x25U,0xA0U,0x7FU,0x24U,
|
||||
|
||||
// acc 3 - rHm34nx2QSJKXhe32NiNbsnrUSeZqDZMkg
|
||||
0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U, 0x00U, 0x00U,
|
||||
0xB7U,0xDAU,0x76U,0x2DU,0xB9U,0x90U,0x2EU,0x85U,0x19U,0x96U,
|
||||
0x66U,0xB2U,0xE6U,0xC3U,0x00U,0x9CU,0x5EU,0x27U,0x57U,0x69U,
|
||||
|
||||
// acc 4 - rLc3URyuFpTqBAcPFK5J7c73h488ew79dH
|
||||
0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U, 0x00U, 0x00U,
|
||||
0xD7U,0x0EU,0xF4U,0xD5U,0x02U,0x1CU,0x7CU,0x64U,0x6AU,0x98U,
|
||||
0xE8U,0x4FU,0x60U,0xFEU,0xD3U,0x64U,0xA0U,0x04U,0x45U,0x32U,
|
||||
};
|
||||
|
||||
// this is the xfl for 0.00333333333
|
||||
uint8_t initial_reward[] = // on key FF, 0..0
|
||||
{
|
||||
0x53U,0xCBU,0xD7U,0xA6U,0x25U,0x0DU,0x78U,0x80U
|
||||
};
|
||||
|
||||
uint8_t key[32];
|
||||
uint8_t account_field[32];
|
||||
uint8_t zero[32];
|
||||
|
||||
#define DONE()\
|
||||
{\
|
||||
accept(0,0,(uint32_t)__LINE__);\
|
||||
}
|
||||
|
||||
#define TRACELINE()\
|
||||
{\
|
||||
uint8_t out[4];\
|
||||
out[0] = (__LINE__ >> 24U) & 0xFFU;\
|
||||
out[1] = (__LINE__ >> 16U) & 0xFFU;\
|
||||
out[2] = (__LINE__ >> 8U) & 0xFFU;\
|
||||
out[3] = (__LINE__ >> 0U) & 0xFFU;\
|
||||
trace(SBUF("Line upto:"), out, 4, 1);\
|
||||
}
|
||||
|
||||
int64_t hook(uint32_t r)
|
||||
{
|
||||
_g(1,1);
|
||||
|
||||
uint8_t ttbuf[2];
|
||||
int64_t br = otxn_field(SBUF(ttbuf), sfTransactionType);
|
||||
uint32_t txntype = ((uint32_t)(ttbuf[0]) << 16U) + ((uint32_t)(ttbuf[1]));
|
||||
|
||||
if (txntype != 99) // ttINVOKE
|
||||
DONE();
|
||||
|
||||
// get the account id
|
||||
ASSERT(otxn_field(account_field + 12, 20, sfAccount) == 20);
|
||||
|
||||
uint8_t hook_accid[20];
|
||||
hook_account(SBUF(hook_accid));
|
||||
|
||||
// start of hook proper
|
||||
|
||||
|
||||
int64_t member_count = state(0,0, SBUF(key));
|
||||
|
||||
TRACEVAR(member_count);
|
||||
|
||||
// initial execution, setup hook
|
||||
if (member_count == DOESNT_EXIST)
|
||||
{
|
||||
etxn_reserve(INIT_MEMBER_COUNT);
|
||||
|
||||
// set member count
|
||||
int8_t imc = INIT_MEMBER_COUNT;
|
||||
ASSERT(state_set(&imc, 1, SBUF(key))); // member count is on the zero key
|
||||
|
||||
// set reward rate
|
||||
key[0] = 0xFFU;
|
||||
ASSERT(state_set(SBUF(initial_reward), SBUF(key))); // interest rate is on the the FF, 0...0 key
|
||||
key[0] = 0;
|
||||
|
||||
for (uint32_t i = 0; GUARD(INIT_MEMBER_COUNT), i < INIT_MEMBER_COUNT; ++i)
|
||||
{
|
||||
key[31] = i+1;
|
||||
|
||||
// 0... X where X is member id started from 1
|
||||
// maps to the member's account ID
|
||||
// reverse key
|
||||
ASSERT(state_set(initial_members + (i * 32) + 12, 20, SBUF(key)) == 20);
|
||||
|
||||
// 0, 0... ACCOUNT ID maps to member_id (as above)
|
||||
// forward key
|
||||
ASSERT(state_set(key + 31, 1, initial_members + (i * 32), 32) == 1);
|
||||
|
||||
// emit initial
|
||||
uint8_t tx[PREPARE_PAYMENT_SIMPLE_SIZE];
|
||||
PREPARE_PAYMENT_SIMPLE(tx, INIT_AMOUNT, (initial_members + (i * 32) + 12), 0, 0);
|
||||
|
||||
// emit the transaction
|
||||
uint8_t emithash[32];
|
||||
int64_t emit_result = emit(SBUF(emithash), SBUF(tx));
|
||||
ASSERT(emit_result > 0);
|
||||
TRACEVAR(emit_result);
|
||||
|
||||
}
|
||||
|
||||
DONE();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// outgoing txns allowed
|
||||
if (BUFFER_EQUAL_20(hook_accid, account_field + 12))
|
||||
DONE();
|
||||
|
||||
|
||||
|
||||
|
||||
// otherwise a normal execution (not initial)
|
||||
// first let's check if the invoking party is a member
|
||||
|
||||
int64_t member_id = state(0,0,SBUF(account_field));
|
||||
ASSERT(member_id >= 0);
|
||||
|
||||
// the only thing you can do is vote for a topic
|
||||
// so lets process their vote
|
||||
ASSERT(otxn_slot(1) == 1);
|
||||
ASSERT(slot_subfield(1, sfHookParameters, 2) == 2);
|
||||
// first parameter must contain the topic as key and the topic data as value
|
||||
ASSERT(slot_subarray(2, 0, 2) == 2);
|
||||
ASSERT(slot_subfield(2, sfHookParameterName, 3) == 3);
|
||||
ASSERT(slot_subfield(2, sfHookParameterValue, 4) == 4);
|
||||
|
||||
|
||||
uint8_t dump[1024];
|
||||
uint64_t dumpsize = slot(SBUF(dump), 4);
|
||||
trace(SBUF("dump"), dump, dumpsize, 1);
|
||||
|
||||
int64_t topic = slot(0,0, 3) & 0xFFU; // there's a high "size" byte because it's a VL
|
||||
TRACEVAR(topic);
|
||||
ASSERT(topic >= 1 && topic <= 25);
|
||||
|
||||
|
||||
uint8_t topic_data_buffer[44]; // this gives us some bytes on the front to play with to avoid buffer copies
|
||||
uint8_t* topic_data = topic_data_buffer + 12;;
|
||||
uint8_t topic_size =
|
||||
topic == 1 ? 8 :
|
||||
topic >= 2 && topic <= 5 ? 32 : 20;
|
||||
|
||||
// reuse account_field to record vote
|
||||
account_field[0] = topic;
|
||||
|
||||
// read canidate from ttINVOKE parameter
|
||||
ASSERT(slot(topic_data - 1, topic_size + 1, 4) == topic_size + 1);
|
||||
*(topic_data - 1) = 0; // this is the size byte for the VL
|
||||
|
||||
|
||||
// get previous vote if any on this topic (1-25)
|
||||
uint8_t previous_topic_data[32];
|
||||
int64_t previous_topic_size = state(previous_topic_data, topic_size, SBUF(account_field));
|
||||
|
||||
// write vote to voting key
|
||||
ASSERT(state_set(topic_data, topic_size, SBUF(account_field)) == topic_size);
|
||||
|
||||
// check if the vote they're making has already been cast before,
|
||||
// if it is identical to their existing vote for this topic then just end with tesSUCCESS
|
||||
if (previous_topic_size == topic_size && BUFFER_EQUAL_32(previous_topic_data, topic_data))
|
||||
DONE();
|
||||
|
||||
|
||||
// execution to here means the vote is different
|
||||
// we might have to decrement the old voting if they voted previously
|
||||
// and we will have to increment the new voting
|
||||
|
||||
|
||||
// decrement old counter
|
||||
if (previous_topic_size > 0)
|
||||
{
|
||||
uint8_t votes = 0;
|
||||
previous_topic_data[31] = topic;
|
||||
if (state(&votes, 1, SBUF(previous_topic_data)) && votes > 0)
|
||||
{
|
||||
votes--;
|
||||
ASSERT(state_set(&votes, 1, SBUF(previous_topic_data)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// increment new counter
|
||||
uint8_t votes = 0;
|
||||
uint8_t last_byte = *(topic_data + 31);
|
||||
*(topic_data + 31) = topic;
|
||||
state(&votes, 1, topic_data, 32);
|
||||
votes++;
|
||||
ASSERT(state_set(&votes, 1, topic_data, 32));
|
||||
*(topic_data + 31) = last_byte;
|
||||
|
||||
|
||||
// set this flag if the topic data is all zeros, it's important in some cases
|
||||
int topic_data_zero = BUFFER_EQUAL_32(topic_data, zero);
|
||||
|
||||
TRACEVAR(topic_data_zero);
|
||||
TRACEVAR(votes);
|
||||
TRACEVAR(member_count);
|
||||
TRACEVAR(topic);
|
||||
|
||||
// now check if we hit threshold
|
||||
if (votes == member_count || // 100% required for topics 1 - 5 (interest rate, hooks0-3)
|
||||
(topic > 5 && votes >= (member_count * 0.8))) // 80% required for membership voting
|
||||
{
|
||||
// 100%/80% threshold as needed is reached
|
||||
// action vote
|
||||
|
||||
TRACESTR("Actioning votes");
|
||||
|
||||
if (topic == 1)
|
||||
{
|
||||
// change reward %
|
||||
key[0] = 0xFFU;
|
||||
ASSERT(state_set(topic_data, 8, SBUF(key))); // interest rate is on the the FF, 0...0 key
|
||||
}
|
||||
else if (topic <= 5)
|
||||
{
|
||||
// set hook hash
|
||||
uint8_t pos = topic - 2;
|
||||
|
||||
// first get the hook ledget object
|
||||
uint8_t keylet[34];
|
||||
ASSERT(util_keylet(SBUF(keylet), KEYLET_HOOK, SBUF(hook_accid), 0,0,0,0) == 34);
|
||||
ASSERT(slot_set(SBUF(keylet), 5) == 5);
|
||||
|
||||
// now get the hooks array
|
||||
ASSERT(slot_subfield(5, sfHooks, 6) == 6);
|
||||
|
||||
// now check the entry
|
||||
if (slot_subarray(6, pos, 7) == 7)
|
||||
{
|
||||
// it exists
|
||||
// check if its identical
|
||||
uint8_t existing_hook[32];
|
||||
ASSERT(slot_subfield(7, sfHookHash, 8) == 8);
|
||||
ASSERT(slot(SBUF(existing_hook), 8) == 32);
|
||||
|
||||
// if it is then do nothing
|
||||
if (BUFFER_EQUAL_32(existing_hook, topic_data))
|
||||
DONE();
|
||||
}
|
||||
|
||||
// generate the hook definition keylet
|
||||
ASSERT(util_keylet(SBUF(keylet), KEYLET_HOOK_DEFINITION, topic_data, 32, 0,0,0,0) == 34);
|
||||
|
||||
// check if the ledger contains such a hook definition
|
||||
ASSERT(slot_set(SBUF(keylet), 9) == 9);
|
||||
|
||||
// it does so now we can do the emit
|
||||
etxn_reserve(1);
|
||||
|
||||
// RH UPTO: do hookset emit
|
||||
|
||||
uint8_t* hookhash =
|
||||
topic_data_zero
|
||||
? ((uint8_t*)0xFFFFFFFFU) // if the topic data is all zero then it's a delete operation
|
||||
: topic_data; // otherwise it's an install operation
|
||||
|
||||
uint8_t* h[4] =
|
||||
{
|
||||
pos == 0 ? hookhash : 0,
|
||||
pos == 1 ? hookhash : 0,
|
||||
pos == 2 ? hookhash : 0,
|
||||
pos == 3 ? hookhash : 0
|
||||
};
|
||||
|
||||
uint8_t emit_buf[1024];
|
||||
uint32_t emit_size = 0;
|
||||
PREPARE_HOOKSET(emit_buf, sizeof(emit_buf), h[0], h[1], h[2], h[3], emit_size);
|
||||
|
||||
uint8_t emithash[32];
|
||||
int64_t emit_result = emit(SBUF(emithash), emit_buf, emit_size);
|
||||
TRACEVAR(emit_result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// add / change member
|
||||
key[31] = topic - 6;
|
||||
|
||||
|
||||
uint8_t previous_member[32];
|
||||
int previous_present = (state(previous_member + 12, 20, SBUF(key)) == 20);
|
||||
|
||||
if (previous_present && !topic_data_zero)
|
||||
{
|
||||
// we will not change member count, we're adding a member and removing a member
|
||||
}
|
||||
else
|
||||
{
|
||||
// decrement member count
|
||||
ASSERT(member_count > 0); // just bail out if the last member is trying to self remove
|
||||
|
||||
if (previous_present)
|
||||
member_count--;
|
||||
else
|
||||
member_count++;
|
||||
|
||||
ASSERT(state_set(&member_count, 1, SBUF(zero)) == 1);
|
||||
}
|
||||
|
||||
// we need to garbage collect all their votes
|
||||
if (previous_present)
|
||||
{
|
||||
for (int i = 1; GUARD(25), i <= 25; ++i)
|
||||
{
|
||||
previous_member[0] = i;
|
||||
uint8_t vote_key[32];
|
||||
if (state(SBUF(vote_key), SBUF(previous_member)) == 32)
|
||||
{
|
||||
uint8_t vote_count = 0;
|
||||
if (state(&vote_count, 1, SBUF(vote_key)) == 1)
|
||||
{
|
||||
if (vote_count <= 1)
|
||||
{
|
||||
ASSERT(state_set(0,0, SBUF(vote_key)) == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
vote_count--;
|
||||
ASSERT(state_set(&vote_count, 1, SBUF(vote_key)) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
// delete the entry
|
||||
ASSERT(state_set(0,0, SBUF(previous_member)) == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!topic_data_zero)
|
||||
{
|
||||
// add the new member
|
||||
// reverse key
|
||||
key[31] = topic - 6;
|
||||
ASSERT(state_set(topic_data, 20, SBUF(key)) == 20);
|
||||
|
||||
// forward key
|
||||
ASSERT(state_set(key + 31, 1, topic_data_buffer, 32) == 20);
|
||||
}
|
||||
|
||||
// done!
|
||||
}
|
||||
}
|
||||
|
||||
DONE();
|
||||
}
|
||||
717
hook/govern.c
Normal file
717
hook/govern.c
Normal file
@@ -0,0 +1,717 @@
|
||||
#include "hookapi.h"
|
||||
#define ASSERT(x)\
|
||||
if (!(x))\
|
||||
rollback(SBUF("Govern: Assertion failed."),__LINE__);
|
||||
|
||||
#define SEAT_COUNT 20
|
||||
|
||||
#define HOOK_MAX 10 // maximum number of hooks on an account
|
||||
|
||||
/**
|
||||
* Xahau Governance Hook
|
||||
*
|
||||
* The governance model is a 20 seat round table.
|
||||
* Each seat may be filled or empty (provided there is at least one filled seat.)
|
||||
* The primary governance table sits on the genesis account. This is also called the L1 table.
|
||||
* Seats at this table are called L1s or L1 members.
|
||||
* At L1, for votes relating to table membership 80% of the filled seats must vote in favour.
|
||||
* At L1, for votes relating to everything else 100% of the filled seats must vote in favour.
|
||||
* One or more L1 seats may contain an account that has an L2 governance hook installed on it and is blackholed.
|
||||
* This is referred to as an L2 table. The seats at the table are called L2s or L2 members.
|
||||
* There may be multiple L2 tables.
|
||||
*
|
||||
* Hook Parameters:
|
||||
*
|
||||
* // both table types uses these parameters V
|
||||
*
|
||||
* Parameter Name: {'I', 'M', 'C'}
|
||||
* Parameter Value: Initial Member Count <1 byte>
|
||||
*
|
||||
* Parameter Name: {'I', 'S', '\0'}
|
||||
* Parameter Value: Initial seat #0's member's 20 byte Account ID.
|
||||
*
|
||||
* // only L1 table uses these parameters V
|
||||
*
|
||||
* Parameter Name: {'I', 'R', 'R'}
|
||||
* Parameter Value: Initial Reward Rate <8 byte XFL fraction between 0 and 1, LE>
|
||||
*
|
||||
* Parameter Name: {'I', 'R', 'D'}
|
||||
* Parameter Value: Initial Reward Delay <8 byte LE XFL seconds between rewards>
|
||||
* ...
|
||||
*
|
||||
* Topics:
|
||||
* 'H[0-9]' - Hook Hash in positions 0-9 <32 byte hash> on genesis
|
||||
* 'RR' - reward rate <le xfl 8 bytes>
|
||||
* 'RD' - reward delay <le xfl 8 bytes>
|
||||
* 'S[0-19]' - who is a governance member occupying that seat <20 byte accid>
|
||||
*
|
||||
* Hook State:
|
||||
* State Key: {0..0, 'M', 'C'}
|
||||
* State Data: Current member count <1 byte>
|
||||
*
|
||||
* State Key: {0..0, 'R', 'R'}
|
||||
* State Data: Current reward rate <8 byte LE XFL> (L1 table only)
|
||||
*
|
||||
* State Key: {0..0, 'R', 'D'}
|
||||
* State Data: Current reward delay <8 byte LE XFL> (L1 table only)
|
||||
*
|
||||
* State Key: {0..0, '\0 + seat id'}
|
||||
* State Data: 20 byte account ID for the member who occupies this seat. If absent unoccupied.
|
||||
*
|
||||
* State Key: {0..0, <20 byte account id>}
|
||||
* State Data: Seat number this member occupies <1 byte>
|
||||
*
|
||||
* State Key: {'V', 'H|R|S' <topic type>, '\0 + topic id', <layer>, 0..0, <member accid>}
|
||||
* State Data: A vote by a member for a topic and topic data
|
||||
*
|
||||
* State Key: {'C', 'H|R|S' <topic type>, '\0 + topic id', <layer>, 0*, <front truncated topic data>}
|
||||
* State Data: The number of members who have voted for that topic data and topic combination <1 byte>
|
||||
*
|
||||
* Hook Invocation:
|
||||
* ttINVOKE:
|
||||
* First time:
|
||||
* Behaviour: Setup hook, setup initial accounts, end (accept).
|
||||
*
|
||||
* Subsequent:
|
||||
* Behaviour: Vote on a topic, if the votes meet the topic vote threshold, action the topic.
|
||||
*
|
||||
* Parameter Name: {'L'}
|
||||
* Parameter Value: Which layer the vote is inteded for (ONLY L2 TABLES USE THIS PARAMETER)
|
||||
* { 1 a vote cast by an L2 member about an L1 topic }, or
|
||||
* { 2 a vote cast by an L2 member about an L2 topic }
|
||||
*
|
||||
*
|
||||
* Parameter Name: {'T'}
|
||||
* Parameter Value: The topic to vote on <2 bytes>
|
||||
* { 'S|H' (seat, hook), '\0 + topic id' }, or
|
||||
* { 'R' (reward), 'R|D' (rate, delay) }
|
||||
*
|
||||
* Parameter Name: {'V'}
|
||||
* Parameter Value: The data to vote for this topic (accid, hook hash, reward rate/delay)
|
||||
**/
|
||||
|
||||
#define SVAR(x) &x, sizeof(x)
|
||||
|
||||
#define DONE(x)\
|
||||
accept(SBUF(x),__LINE__);
|
||||
|
||||
#define NOPE(x)\
|
||||
rollback(SBUF(x), __LINE__);
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
// genesis account id
|
||||
uint8_t genesis[20] =
|
||||
{0xB5U,0xF7U,0x62U,0x79U,0x8AU,0x53U,0xD5U,0x43U,0xA0U,0x14U,
|
||||
0xCAU,0xF8U,0xB2U,0x97U,0xCFU,0xF8U,0xF2U,0xF9U,0x37U,0xE8U};
|
||||
|
||||
uint8_t zero32[32];
|
||||
|
||||
int64_t hook(uint32_t r)
|
||||
{
|
||||
_g(1,1);
|
||||
|
||||
etxn_reserve(1);
|
||||
|
||||
// in debug mode the test case can supply a line number that the hook will then print here.
|
||||
{
|
||||
uint8_t ln[2];
|
||||
if (otxn_param(SBUF(ln), "D", 1) == 2)
|
||||
{
|
||||
uint16_t lineno = (((uint16_t)ln[0]) << 8U) + ln[1];
|
||||
trace_num(SBUF("DBGLN"), lineno);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t tt = otxn_type();
|
||||
|
||||
if (tt != 99) // ttINVOKE only
|
||||
DONE("Governance: Passing non-Invoke txn. HookOn should be changed to avoid this.");
|
||||
|
||||
// get the account id
|
||||
uint8_t account_field[32];
|
||||
otxn_field(account_field + 12, 20, sfAccount);
|
||||
|
||||
uint8_t hook_accid[32];
|
||||
hook_account(hook_accid + 12, 20);
|
||||
|
||||
// outgoing txns to other hooks allowed
|
||||
if (BUFFER_EQUAL_20(hook_accid + 12, account_field + 12))
|
||||
{
|
||||
uint8_t dest_acc[20];
|
||||
if (otxn_field(SBUF(dest_acc), sfDestination) == 20 && !BUFFER_EQUAL_20(hook_accid + 12, dest_acc))
|
||||
DONE("Goverance: Passing outgoing txn.");
|
||||
}
|
||||
|
||||
int64_t is_L1_table = BUFFER_EQUAL_20(hook_accid + 12, genesis);
|
||||
|
||||
if (is_L1_table)
|
||||
trace(SBUF("Governance: Starting governance logic on L1 table."), 0,0,0);
|
||||
else
|
||||
trace(SBUF("Governance: Starting governance logic on L2 table."), 0,0,0);
|
||||
|
||||
int64_t member_count = state(0,0, "MC", 2);
|
||||
|
||||
// initial execution, setup hook
|
||||
if (member_count == DOESNT_EXIST)
|
||||
{
|
||||
// gather hook parameters
|
||||
|
||||
uint8_t imc;
|
||||
uint64_t irr, ird;
|
||||
if (hook_param(SVAR(imc), "IMC", 3) < 0)
|
||||
NOPE("Governance: Initial Member Count Parameter missing (IMC).");
|
||||
TRACEVAR(imc);
|
||||
|
||||
// set member count
|
||||
ASSERT(0 < state_set(SVAR(imc), "MC", 2));
|
||||
|
||||
member_count = imc;
|
||||
TRACEVAR(member_count);
|
||||
|
||||
|
||||
if (imc == 0)
|
||||
NOPE("Governance: Initial Member Count must be > 0.");
|
||||
|
||||
if (imc > SEAT_COUNT)
|
||||
NOPE("Governance: Initial Member Count must be <= Seat Count (20).");
|
||||
|
||||
if (is_L1_table)
|
||||
{
|
||||
if (hook_param(SVAR(irr), "IRR", 3) < 0)
|
||||
NOPE("Governance: Initial Reward Rate Parameter missing (IRR).");
|
||||
|
||||
if (hook_param(SVAR(ird), "IRD", 3) < 0)
|
||||
NOPE("Governance: Initial Reward Delay Parameter miss (IRD).");
|
||||
|
||||
if (ird == 0)
|
||||
NOPE("Governance: Initial Reward Delay must be > 0.");
|
||||
|
||||
// set reward rate
|
||||
ASSERT(0 < state_set(SVAR(irr), "RR", 2));
|
||||
|
||||
// set reward delay
|
||||
ASSERT(0 < state_set(SVAR(ird), "RD", 2));
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; GUARD(SEAT_COUNT), i < member_count; ++i)
|
||||
{
|
||||
uint8_t member_acc[20];
|
||||
uint8_t member_pkey[3] = {'I', 'S', i};
|
||||
if (hook_param(SBUF(member_acc), member_pkey, 3) != 20)
|
||||
NOPE("Governance: One or more initial member account ID's is missing");
|
||||
|
||||
// 0... X where X is member id started from 1
|
||||
// maps to the member's account ID
|
||||
trace(SBUF("Member:"), SBUF(member_acc), 1);
|
||||
// reverse key
|
||||
ASSERT(state_set(SBUF(member_acc), SVAR(i)) == 20);
|
||||
|
||||
// 0, 0... ACCOUNT ID maps to member_id (as above)
|
||||
// forward key
|
||||
ASSERT(state_set(SVAR(i), SBUF(member_acc)) == 1);
|
||||
}
|
||||
|
||||
DONE("Governance: Setup completed successfully.");
|
||||
}
|
||||
|
||||
if (DEBUG)
|
||||
TRACEVAR(member_count);
|
||||
|
||||
|
||||
// otherwise a normal execution (not initial)
|
||||
// first let's check if the invoking party is a member
|
||||
|
||||
int64_t member_id = state(0,0,account_field + 12, 20);
|
||||
if (member_id < 0)
|
||||
NOPE("Governance: You are not currently a governance member at this table.");
|
||||
|
||||
// the only thing a member can do is vote for a topic
|
||||
// so lets process their vote
|
||||
|
||||
// { 'S|H|R', '\0 + topicid' }
|
||||
uint8_t topic[2];
|
||||
int64_t result = otxn_param(SBUF(topic), "T", 1);
|
||||
uint8_t t = topic[0]; // topic type
|
||||
uint8_t n = topic[1]; // number (seats) (or R/D for reward rate/delay)
|
||||
|
||||
if (result != 2 || (
|
||||
t != 'S' && // topic type: seat
|
||||
t != 'H' && // topic type: hook
|
||||
t != 'R')) // topic type: reward
|
||||
NOPE("Governance: Valid TOPIC must be specified as otxn parameter.");
|
||||
|
||||
|
||||
if (t == 'S' && n > (SEAT_COUNT - 1))
|
||||
NOPE("Governance: Valid seat topics are 0 through 19.");
|
||||
|
||||
if (t == 'H' && n > HOOK_MAX)
|
||||
NOPE("Governance: Valid hook topics are 0 through 9.");
|
||||
|
||||
if (t == 'R' && n != 'R' && n != 'D')
|
||||
NOPE("Governance: Valid reward topics are R (rate) and D (delay).");
|
||||
|
||||
// is their vote for the L2 table or the L1 table?
|
||||
uint8_t l = 1;
|
||||
if (!is_L1_table)
|
||||
{
|
||||
result = otxn_param(&l, 1, "L", 1);
|
||||
if (result != 1)
|
||||
NOPE("Governance: Missing L parameter. Which layer are you voting for?");
|
||||
|
||||
TRACEVAR(l);
|
||||
|
||||
if (l != 1 && l != 2)
|
||||
NOPE("Governance: Layer parameter must be '1' or '2'.");
|
||||
}
|
||||
|
||||
if (l == 2 && t == 'R')
|
||||
NOPE("Governance: L2s cannot vote on RR/RD at L2, did you mean to set L=1?");
|
||||
|
||||
|
||||
// RH TODO: validate RR/RD xfl > 0
|
||||
uint8_t topic_data[56 /* there's a 24 byte pad on the back for later logic */];
|
||||
uint8_t topic_size =
|
||||
t == 'H' ? 32 : // hook topics are a 32 byte hook hash
|
||||
t == 'S' ? 20 : // account topics are a 20 byte account ID
|
||||
8; // reward topics are an 8 byte le xfl
|
||||
|
||||
uint8_t padding = 32 - topic_size;
|
||||
|
||||
result = otxn_param(topic_data + padding, topic_size, "V", 1);
|
||||
if (result != topic_size)
|
||||
NOPE("Governance: Missing or incorrect size of VOTE data for TOPIC type.");
|
||||
|
||||
// set this flag if the topic data is all zeros
|
||||
int topic_data_zero =
|
||||
(*((uint64_t*)(topic_data + 0)) == 0) &&
|
||||
(*((uint64_t*)(topic_data + 8)) == 0) &&
|
||||
(*((uint64_t*)(topic_data + 16)) == 0) &&
|
||||
(*((uint64_t*)(topic_data + 24)) == 0);
|
||||
|
||||
trace(SBUF("topic_data_raw:"), topic_data, 56, 1);
|
||||
trace_num(SBUF("topic_padding:"), padding);
|
||||
trace_num(SBUF("topic_size:"), topic_size);
|
||||
trace(SBUF("topic_data:"), topic_data + padding, topic_size, 1);
|
||||
|
||||
// reuse account_field to create vote key
|
||||
account_field[0] = 'V';
|
||||
account_field[1] = t;
|
||||
account_field[2] = n;
|
||||
account_field[3] = l;
|
||||
|
||||
// get their previous vote if any on this topic
|
||||
uint8_t previous_topic_data[32];
|
||||
int64_t previous_topic_size =
|
||||
state(previous_topic_data + padding, topic_size, SBUF(account_field));
|
||||
|
||||
// check if the vote they're making has already been cast before,
|
||||
// if it is identical to their existing vote for this topic then just end with tesSUCCESS
|
||||
trace(SBUF("previous_topic_data"), previous_topic_data, 32, 1);
|
||||
trace(SBUF("topic_data"), topic_data, 32, 1);
|
||||
trace_num(SBUF("previous_topic_size"), previous_topic_size);
|
||||
trace_num(SBUF("topic_size"), topic_size);
|
||||
if (previous_topic_size == topic_size && BUFFER_EQUAL_32(previous_topic_data, topic_data))
|
||||
DONE("Governance: Your vote is already cast this way for this topic.");
|
||||
|
||||
// execution to here means the vote is different
|
||||
// we might have to decrement the old voting if they voted previously
|
||||
// and we will have to increment the new voting
|
||||
|
||||
// write vote to their voting key
|
||||
ASSERT(state_set(topic_data + padding, topic_size, SBUF(account_field)) == topic_size);
|
||||
|
||||
uint8_t previous_votes = 0;
|
||||
// decrement old vote counter for this option
|
||||
if (previous_topic_size > 0)
|
||||
{
|
||||
uint8_t votes = 0;
|
||||
// override the first two bytes to turn it into a vote count key
|
||||
previous_topic_data[0] = 'C';
|
||||
previous_topic_data[1] = t;
|
||||
previous_topic_data[2] = n;
|
||||
previous_topic_data[3] = l;
|
||||
|
||||
ASSERT(state(&votes, 1, SBUF(previous_topic_data)) == 1);
|
||||
ASSERT(votes > 0);
|
||||
previous_votes = votes;
|
||||
votes--;
|
||||
// delete the state entry if votes hit zero
|
||||
ASSERT(state_set(votes == 0 ? 0 : &votes, votes == 0 ? 0 : 1, SBUF(previous_topic_data)) >= 0);
|
||||
}
|
||||
|
||||
// increment new counter
|
||||
uint8_t votes = 0;
|
||||
{
|
||||
// we're going to clobber the topic data to turn it into a vote count key
|
||||
// so store the first bytes
|
||||
uint64_t saved_data = *((uint64_t*)topic_data);
|
||||
topic_data[0] = 'C';
|
||||
topic_data[1] = t;
|
||||
topic_data[2] = n;
|
||||
topic_data[3] = l;
|
||||
|
||||
state(&votes, 1, topic_data, 32);
|
||||
votes++;
|
||||
ASSERT(0 < state_set(&votes, 1, topic_data, 32));
|
||||
|
||||
// restore the saved bytes
|
||||
*((uint64_t*)topic_data) = saved_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
TRACEVAR(topic_data_zero);
|
||||
TRACEVAR(votes);
|
||||
TRACEVAR(member_count);
|
||||
trace(SBUF("topic"), topic, 2, 1);
|
||||
}
|
||||
|
||||
// this flag is used to determine if a L2 table should send a "nulling" vote to remove its existing vote
|
||||
// from the L1 table it sits at.
|
||||
int64_t lost_majority = 0;
|
||||
|
||||
int64_t q80 = member_count * 0.8;
|
||||
int64_t q51 = member_count * 0.51;
|
||||
|
||||
if (q80 < 2)
|
||||
q80 = 2;
|
||||
|
||||
if (q51 < 2)
|
||||
q51 = 2;
|
||||
|
||||
if (is_L1_table || l == 2)
|
||||
{
|
||||
if (votes <
|
||||
(t == 'S'
|
||||
? q80 // L1s have 80% threshold for membership/seat voting
|
||||
: member_count)) // L1s have 100% threshold for all other voting
|
||||
DONE("Governance: Vote record. Not yet enough votes to action.");
|
||||
}
|
||||
else // layer 2 table voting on a l1 topic
|
||||
{
|
||||
lost_majority = previous_votes >= q51 && votes < q51;
|
||||
if (lost_majority)
|
||||
trace(SBUF("Governance: Majority lost, undoing L1 vote..."),0,0,0);
|
||||
else if (votes < q51)
|
||||
DONE("Governance: Not yet enough votes to action L1 vote..");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// action vote
|
||||
if (DEBUG)
|
||||
TRACESTR("Actioning votes");
|
||||
|
||||
if (l == 1 && !is_L1_table)
|
||||
{
|
||||
|
||||
|
||||
uint8_t txn_out[1024];
|
||||
uint8_t* buf_out = txn_out;
|
||||
uint32_t cls = (uint32_t)ledger_seq();
|
||||
_01_02_ENCODE_TT (buf_out, ttINVOKE);
|
||||
_02_02_ENCODE_FLAGS (buf_out, tfCANONICAL);
|
||||
_02_04_ENCODE_SEQUENCE (buf_out, 0);
|
||||
_02_26_ENCODE_FLS (buf_out, cls + 1);
|
||||
_02_27_ENCODE_LLS (buf_out, cls + 5);
|
||||
uint8_t* fee_ptr = buf_out;
|
||||
_06_08_ENCODE_DROPS_FEE (buf_out, 0);
|
||||
_07_03_ENCODE_SIGNING_PUBKEY_NULL (buf_out);
|
||||
_08_01_ENCODE_ACCOUNT_SRC (buf_out, hook_accid + 12);
|
||||
_08_03_ENCODE_ACCOUNT_DST (buf_out, genesis);
|
||||
int64_t edlen = etxn_details((uint32_t)buf_out, 512);
|
||||
buf_out += edlen;
|
||||
|
||||
/** Parameters:
|
||||
* F013E017 70180154
|
||||
* 701902
|
||||
* <00> <two byte topic code>
|
||||
* E1E0177018015670
|
||||
* 19
|
||||
* <topic len>
|
||||
* <topic data>
|
||||
* E1F1
|
||||
*/
|
||||
|
||||
// note wasm is LE and Txns are BE so these large constants are endian flipped
|
||||
// to undo the flipping on insertion into memory
|
||||
*((uint64_t*)buf_out) = 0x5401187017E013F0ULL; // parameters array, first parameter preamble
|
||||
buf_out += 8;
|
||||
*((uint32_t*)buf_out) = 0x021970UL;
|
||||
buf_out += 3;
|
||||
*buf_out++ = t; // topic
|
||||
*buf_out++ = n;
|
||||
*((uint64_t*)buf_out) = 0x705601187017E0E1ULL;
|
||||
buf_out += 8;
|
||||
*buf_out++ = 0x19U;
|
||||
// topic data len
|
||||
*buf_out++ = topic_size;
|
||||
if (lost_majority)
|
||||
{
|
||||
// do nothing, the array already has zeros here
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t* d = (uint64_t*)buf_out;
|
||||
uint64_t* s = (uint64_t*)(topic_data + padding);
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
}
|
||||
buf_out += topic_size;
|
||||
// topicdata
|
||||
*((uint16_t*)buf_out) = 0xF1E1U;
|
||||
|
||||
int64_t txn_len = buf_out - txn_out;
|
||||
|
||||
// populate fee
|
||||
int64_t fee = etxn_fee_base(txn_out, txn_len);
|
||||
_06_08_ENCODE_DROPS_FEE (fee_ptr, fee );
|
||||
|
||||
trace(SBUF("Governance: Emitting invoke to L1"), txn_out, txn_len, 1);
|
||||
|
||||
|
||||
uint8_t emit_hash[32];
|
||||
int64_t emit_result = emit(SBUF(emit_hash), txn_out, txn_len);
|
||||
|
||||
trace_num(SBUF("Governance: Emit result"), emit_result);
|
||||
|
||||
if (emit_result == 32)
|
||||
accept(SBUF("Governance: Successfully emitted L1 vote."), __LINE__);
|
||||
|
||||
NOPE("Governance: L1 vote emission failed.");
|
||||
}
|
||||
|
||||
switch(t)
|
||||
{
|
||||
case 'R':
|
||||
{
|
||||
// reward topics
|
||||
int64_t result = state_set(topic_data + padding, topic_size, SBUF(topic));
|
||||
TRACEVAR(result);
|
||||
ASSERT(0 < result);
|
||||
if (n == 'R')
|
||||
DONE("Governance: Reward rate change actioned!");
|
||||
|
||||
DONE("Governance: Reward delay change actioned!");
|
||||
}
|
||||
|
||||
case 'H':
|
||||
{
|
||||
// hook topics
|
||||
|
||||
// first get the hook ledget object
|
||||
uint8_t keylet[34];
|
||||
util_keylet(SBUF(keylet), KEYLET_HOOK, hook_accid + 12, 20, 0,0,0,0);
|
||||
slot_set(SBUF(keylet), 5);
|
||||
|
||||
// now get the hooks array
|
||||
slot_subfield(5, sfHooks, 6);
|
||||
|
||||
// now check the entry
|
||||
if (slot_subarray(6, n, 7) == 7)
|
||||
{
|
||||
// it exists
|
||||
// check if its identical
|
||||
uint8_t existing_hook[32];
|
||||
if (slot_subfield(7, sfHookHash, 8) == 8)
|
||||
{
|
||||
ASSERT(slot(SBUF(existing_hook), 8) == 32);
|
||||
|
||||
// if it is then do nothing
|
||||
if (BUFFER_EQUAL_32(existing_hook, topic_data))
|
||||
DONE("Goverance: Target hook is already the same as actioned hook.");
|
||||
}
|
||||
}
|
||||
|
||||
// generate the hook definition keylet
|
||||
if (!topic_data_zero)
|
||||
{
|
||||
util_keylet(SBUF(keylet), KEYLET_HOOK_DEFINITION, topic_data, 32, 0,0,0,0);
|
||||
|
||||
// check if the ledger contains such a hook definition
|
||||
if (slot_set(SBUF(keylet), 9) != 9)
|
||||
NOPE("Goverance: Hook Hash doesn't exist on ledger while actioning hook.");
|
||||
}
|
||||
|
||||
// it does so now we can do the emit
|
||||
|
||||
uint8_t* hookhash =
|
||||
topic_data_zero
|
||||
? ((uint8_t*)0xFFFFFFFFU) // if the topic data is all zero then it's a delete operation
|
||||
: topic_data; // otherwise it's an install operation
|
||||
|
||||
|
||||
uint8_t* h[10];
|
||||
h[n] = hookhash;
|
||||
|
||||
uint8_t emit_buf[1024];
|
||||
uint32_t emit_size = 0;
|
||||
PREPARE_HOOKSET(emit_buf, sizeof(emit_buf), h, emit_size);
|
||||
|
||||
trace(SBUF("EmittedTxn"), emit_buf, emit_size, 1);
|
||||
|
||||
uint8_t emithash[32];
|
||||
int64_t emit_result = emit(SBUF(emithash), emit_buf, emit_size);
|
||||
|
||||
if (DEBUG)
|
||||
TRACEVAR(emit_result);
|
||||
|
||||
if (emit_result != 32)
|
||||
NOPE("Governance: Emit failed during hook actioning.");
|
||||
|
||||
trace(SBUF("EmittedTxnHash"), emithash, 32, 1);
|
||||
DONE("Governance: Hook actioned.");
|
||||
}
|
||||
|
||||
case 'S':
|
||||
{
|
||||
// add / change member
|
||||
uint8_t previous_member[32];
|
||||
int previous_present = (state(previous_member + 12, 20, &n, 1) == 20);
|
||||
if (previous_present)
|
||||
{
|
||||
trace(SBUF("Previous present==:"), previous_member, 32, 1);
|
||||
}
|
||||
|
||||
|
||||
if (BUFFER_EQUAL_20((previous_member + 12), (topic_data + 12)))
|
||||
DONE("Governance: Actioning seat change, but seat already contains the new member.");
|
||||
|
||||
int64_t existing_member = state(0,0, topic_data + 12, 20);
|
||||
|
||||
int existing_member_moving = existing_member >= 0;
|
||||
if (existing_member_moving)
|
||||
trace(SBUF("Governance: Moving existing member to new seat."), 0,0,0);
|
||||
|
||||
|
||||
uint8_t op = ((!previous_present) << 2U) +
|
||||
(topic_data_zero << 1U) + existing_member_moving;
|
||||
|
||||
ASSERT(op != 0b011U && op != 0b111U && op < 8);
|
||||
|
||||
// logic table:
|
||||
// E/!E - seat is empty/filled
|
||||
// Z/!Z - topic data is zero non zero (zero = member deletion)
|
||||
// M/!M - topic is an existing member who is moving
|
||||
//
|
||||
// E|Z|M
|
||||
// -+-+-
|
||||
// 0 0 0 - seat is full, vote is for a member, an existing member is not moving MC
|
||||
// 0 0 1 - seat is full, vote is for a member, an existing member is moving MC--
|
||||
// 0 1 0 - seat is full, vote is for deletion, an existing member is not moving MC--
|
||||
// 0 1 1 - seat is full, vote is for deletion, an existing member is moving (impossible)
|
||||
// 1 0 0 - seat is empty, vote is for a member, member is not an existing member MC++
|
||||
// 1 0 1 - seat is empty, vote is for a member, member is an existing member MC
|
||||
// 1 1 0 - seat is empty, vote is for deletion, not an existing member moving MC
|
||||
// 1 1 1 - seat is empty, vote is for deletion, an existing member moving (impossible)
|
||||
|
||||
TRACEVAR(op);
|
||||
trace_num(SBUF("E"), !previous_present);
|
||||
trace_num(SBUF("Z"), topic_data_zero);
|
||||
trace_num(SBUF("M"), existing_member_moving);
|
||||
|
||||
// adjust member count
|
||||
{
|
||||
if (op == 0b001U || op == 0b010U)
|
||||
member_count--;
|
||||
else if (op == 0b100U)
|
||||
member_count++;
|
||||
|
||||
TRACEVAR(previous_present);
|
||||
TRACEVAR(topic_data_zero);
|
||||
TRACEVAR(member_count);
|
||||
|
||||
ASSERT(member_count > 1); // just bail out if the second last member is being removed
|
||||
|
||||
uint8_t mc = member_count;
|
||||
ASSERT(state_set(&mc, 1, "MC", 2) == 1);
|
||||
}
|
||||
|
||||
// if an existing member is moving we need to delete them before re-adding them
|
||||
if (existing_member_moving)
|
||||
{
|
||||
|
||||
// delete the old member
|
||||
// reverse key
|
||||
uint8_t m = (uint8_t)existing_member;
|
||||
ASSERT(state_set(0,0, &m, 1) == 0);
|
||||
|
||||
// forward key
|
||||
ASSERT(state_set(0, 0, topic_data + 12, 20) == 0);
|
||||
|
||||
}
|
||||
|
||||
// we need to garbage collect all their votes
|
||||
if (previous_present)
|
||||
{
|
||||
previous_member[0] = 'V';
|
||||
|
||||
for (int i = 1; GUARD(32), i < 32; ++i)
|
||||
{
|
||||
previous_member[1] = i < 2 ? 'R' : i < 12 ? 'H' : 'S';
|
||||
previous_member[2] =
|
||||
i == 0 ? 'R' :
|
||||
i == 1 ? 'D' :
|
||||
i < 12 ? i - 2 :
|
||||
i - 12;
|
||||
|
||||
uint8_t vote_key[32];
|
||||
if (state(SBUF(vote_key), SBUF(previous_member)) == 32)
|
||||
{
|
||||
uint8_t vote_count = 0;
|
||||
|
||||
// find and decrement the vote counter
|
||||
vote_key[0] = 'C';
|
||||
vote_key[1] = previous_member[1];
|
||||
vote_key[2] = previous_member[2];
|
||||
if (state(&vote_count, 1, SBUF(vote_key)) == 1)
|
||||
{
|
||||
// if we're down to 1 vote then delete state
|
||||
if (vote_count <= 1)
|
||||
{
|
||||
ASSERT(state_set(0,0, SBUF(vote_key)) == 0);
|
||||
trace_num(SBUF("Decrement vote count deleted"), vote_count);
|
||||
}
|
||||
else // otherwise decrement
|
||||
{
|
||||
vote_count--;
|
||||
ASSERT(state_set(&vote_count, 1, SBUF(vote_key)) == 1);
|
||||
trace_num(SBUF("Decrement vote count to"), vote_count);
|
||||
}
|
||||
}
|
||||
|
||||
// delete the vote entry
|
||||
ASSERT(state_set(0,0, SBUF(previous_member)) == 0);
|
||||
trace(SBUF("Vote entry deleted"), vote_key, 32, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// delete the old member
|
||||
// reverse key
|
||||
ASSERT(state_set(0,0, &n, 1) == 0);
|
||||
|
||||
// forward key
|
||||
ASSERT(state_set(0, 0, previous_member + 12, 20) == 0);
|
||||
}
|
||||
|
||||
if (!topic_data_zero)
|
||||
{
|
||||
// add the new member
|
||||
// reverse key
|
||||
ASSERT(state_set(topic_data + 12, 20, &n, 1) == 20);
|
||||
|
||||
// forward key
|
||||
ASSERT(state_set(&n, 1, topic_data + 12, 20) == 1);
|
||||
}
|
||||
|
||||
DONE("Governance: Action member change.");
|
||||
}
|
||||
}
|
||||
|
||||
rollback(SBUF("Governance: Internal logic error."), __LINE__);
|
||||
}
|
||||
@@ -36,6 +36,7 @@
|
||||
#define KEYLET_EMITTED 22
|
||||
#define KEYLET_NFT_OFFER 23
|
||||
#define KEYLET_HOOK_DEFINITION 24
|
||||
#define KEYLET_HOOK_STATE_DIR 25
|
||||
|
||||
#define COMPARE_EQUAL 1U
|
||||
#define COMPARE_LESS 2U
|
||||
@@ -45,5 +46,6 @@
|
||||
#include "extern.h"
|
||||
#include "sfcodes.h"
|
||||
#include "macro.h"
|
||||
#include "tts.h"
|
||||
|
||||
#endif
|
||||
|
||||
51
hook/macro.h
51
hook/macro.h
@@ -136,11 +136,7 @@ int out_len = 0;\
|
||||
*(((uint64_t*)(buf1)) + 0) == *(((uint64_t*)(buf2)) + 0) &&\
|
||||
*(((uint64_t*)(buf1)) + 1) == *(((uint64_t*)(buf2)) + 1) &&\
|
||||
*(((uint64_t*)(buf1)) + 2) == *(((uint64_t*)(buf2)) + 2) &&\
|
||||
*(((uint64_t*)(buf1)) + 3) == *(((uint64_t*)(buf2)) + 3) &&\
|
||||
*(((uint64_t*)(buf1)) + 4) == *(((uint64_t*)(buf2)) + 4) &&\
|
||||
*(((uint64_t*)(buf1)) + 5) == *(((uint64_t*)(buf2)) + 5) &&\
|
||||
*(((uint64_t*)(buf1)) + 6) == *(((uint64_t*)(buf2)) + 6) &&\
|
||||
*(((uint64_t*)(buf1)) + 7) == *(((uint64_t*)(buf2)) + 7))
|
||||
*(((uint64_t*)(buf1)) + 3) == *(((uint64_t*)(buf2)) + 3))
|
||||
|
||||
|
||||
// when using this macro buf1len may be dynamic but buf2len must be static
|
||||
@@ -265,10 +261,6 @@ int out_len = 0;\
|
||||
if (i < 0) buf[0] |= 0x80U;\
|
||||
}
|
||||
|
||||
#define ttPAYMENT 0
|
||||
#define ttCHECK_CREATE 16
|
||||
#define ttNFT_ACCEPT_OFFER 29
|
||||
#define ttHOOK_SET 22
|
||||
#define tfCANONICAL 0x80000000UL
|
||||
|
||||
#define atACCOUNT 1U
|
||||
@@ -491,16 +483,11 @@ int out_len = 0;\
|
||||
#define _07_03_ENCODE_SIGNING_PUBKEY(buf_out, pkey )\
|
||||
ENCODE_SIGNING_PUBKEY(buf_out, pkey );
|
||||
|
||||
#define ENCODE_SIGNING_PUBKEY_NULL_SIZE 35
|
||||
#define ENCODE_SIGNING_PUBKEY_NULL_SIZE 2
|
||||
#define ENCODE_SIGNING_PUBKEY_NULL(buf_out )\
|
||||
{\
|
||||
buf_out[0] = 0x73U;\
|
||||
buf_out[1] = 0x21U;\
|
||||
*(uint64_t*)(buf_out+2) = 0;\
|
||||
*(uint64_t*)(buf_out+10) = 0;\
|
||||
*(uint64_t*)(buf_out+18) = 0;\
|
||||
*(uint64_t*)(buf_out+25) = 0;\
|
||||
buf_out += ENCODE_SIGNING_PUBKEY_NULL_SIZE;\
|
||||
*buf_out++ = 0x73U;\
|
||||
*buf_out++ = 0x00U;\
|
||||
}
|
||||
|
||||
#define _07_03_ENCODE_SIGNING_PUBKEY_NULL(buf_out )\
|
||||
@@ -529,17 +516,21 @@ int out_len = 0;\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
*buf_out++ = 0x1FU; /* HookHash */\
|
||||
*buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; \
|
||||
*buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; \
|
||||
*buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; \
|
||||
*buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; *buf_out++ = *hook0++; \
|
||||
*buf_out++ = 0x50U; /* HookHash */\
|
||||
*buf_out++ = 0x1FU;\
|
||||
uint64_t* d = (uint64_t*)buf_out;\
|
||||
uint64_t* s = (uint64_t*)hook0;\
|
||||
*d++ = *s++;\
|
||||
*d++ = *s++;\
|
||||
*d++ = *s++;\
|
||||
*d++ = *s++;\
|
||||
buf_out+=32;\
|
||||
}\
|
||||
}\
|
||||
*buf_out++ = 0xE1U;\
|
||||
}
|
||||
|
||||
#define PREPARE_HOOKSET(buf_out_master, maxlen, hash0, hash1, hash2, hash3, sizeout)\
|
||||
#define PREPARE_HOOKSET(buf_out_master, maxlen, h, sizeout)\
|
||||
{\
|
||||
uint8_t* buf_out = (buf_out_master); \
|
||||
uint8_t acc[20]; \
|
||||
@@ -558,10 +549,16 @@ int out_len = 0;\
|
||||
int64_t edlen = etxn_details((uint32_t)buf_out, remaining_size); \
|
||||
buf_out += edlen; \
|
||||
*buf_out++ = 0xFBU; /* hook array start */ \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, hash0); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, hash1); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, hash2); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, hash3); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[0]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[1]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[2]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[3]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[4]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[5]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[6]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[7]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[8]); \
|
||||
_0E_0E_ENCODE_HOOKOBJ (buf_out, h[9]); \
|
||||
*buf_out++ = 0xF1U; /* hook array end */ \
|
||||
sizeout = (buf_out - (buf_out_master)); \
|
||||
int64_t fee = etxn_fee_base(buf_out_master, sizeout); \
|
||||
|
||||
146
hook/makefile
Normal file
146
hook/makefile
Normal file
@@ -0,0 +1,146 @@
|
||||
all: reward govern mint
|
||||
accept:
|
||||
wasmcc accept.c -o accept.wasm -Oz -Wl,--allow-undefined -I../
|
||||
hook-cleaner accept.wasm
|
||||
reward:
|
||||
wasmcc reward.c -o reward.wasm -Oz -Wl,--allow-undefined -I../
|
||||
wasm-opt reward.wasm -o reward.wasm \
|
||||
--shrink-level=100000000 \
|
||||
--coalesce-locals-learning \
|
||||
--vacuum \
|
||||
--merge-blocks \
|
||||
--merge-locals \
|
||||
--flatten \
|
||||
--ignore-implicit-traps \
|
||||
-ffm \
|
||||
--const-hoisting \
|
||||
--code-folding \
|
||||
--code-pushing \
|
||||
--dae-optimizing \
|
||||
--dce \
|
||||
--simplify-globals-optimizing \
|
||||
--simplify-locals-nonesting \
|
||||
--reorder-locals \
|
||||
--rereloop \
|
||||
--precompute-propagate \
|
||||
--local-cse \
|
||||
--remove-unused-brs \
|
||||
--memory-packing \
|
||||
-c \
|
||||
--avoid-reinterprets \
|
||||
-Oz
|
||||
hook-cleaner reward.wasm
|
||||
wasm-opt reward.wasm -o reward.wasm \
|
||||
--shrink-level=100000000 \
|
||||
--coalesce-locals-learning \
|
||||
--vacuum \
|
||||
--merge-blocks \
|
||||
--merge-locals \
|
||||
--flatten \
|
||||
--ignore-implicit-traps \
|
||||
-ffm \
|
||||
--const-hoisting \
|
||||
--code-folding \
|
||||
--code-pushing \
|
||||
--dae-optimizing \
|
||||
--dce \
|
||||
--simplify-globals-optimizing \
|
||||
--simplify-locals-nonesting \
|
||||
--reorder-locals \
|
||||
--rereloop \
|
||||
--precompute-propagate \
|
||||
--local-cse \
|
||||
--remove-unused-brs \
|
||||
--memory-packing \
|
||||
-c \
|
||||
--avoid-reinterprets \
|
||||
-Oz
|
||||
hook-cleaner reward.wasm
|
||||
guard_checker reward.wasm
|
||||
govern:
|
||||
wasmcc govern.c -o govern.wasm -Oz -Wl,--allow-undefined -I../
|
||||
wasm-opt govern.wasm -o govern.wasm \
|
||||
--shrink-level=100000000 \
|
||||
--coalesce-locals-learning \
|
||||
--vacuum \
|
||||
--merge-blocks \
|
||||
--merge-locals \
|
||||
--flatten \
|
||||
--ignore-implicit-traps \
|
||||
-ffm \
|
||||
--const-hoisting \
|
||||
--code-folding \
|
||||
--code-pushing \
|
||||
--dae-optimizing \
|
||||
--dce \
|
||||
--simplify-globals-optimizing \
|
||||
--simplify-locals-nonesting \
|
||||
--reorder-locals \
|
||||
--rereloop \
|
||||
--precompute-propagate \
|
||||
--local-cse \
|
||||
--remove-unused-brs \
|
||||
--memory-packing \
|
||||
-c \
|
||||
--avoid-reinterprets \
|
||||
-Oz
|
||||
hook-cleaner govern.wasm
|
||||
wasm-opt govern.wasm -o govern.wasm \
|
||||
--shrink-level=100000000 \
|
||||
--coalesce-locals-learning \
|
||||
--vacuum \
|
||||
--merge-blocks \
|
||||
--merge-locals \
|
||||
--flatten \
|
||||
--ignore-implicit-traps \
|
||||
-ffm \
|
||||
--const-hoisting \
|
||||
--code-folding \
|
||||
--code-pushing \
|
||||
--dae-optimizing \
|
||||
--dce \
|
||||
--simplify-globals-optimizing \
|
||||
--simplify-locals-nonesting \
|
||||
--reorder-locals \
|
||||
--rereloop \
|
||||
--precompute-propagate \
|
||||
--local-cse \
|
||||
--remove-unused-brs \
|
||||
--memory-packing \
|
||||
-c \
|
||||
--avoid-reinterprets \
|
||||
-Oz
|
||||
hook-cleaner govern.wasm
|
||||
guard_checker govern.wasm
|
||||
mint:
|
||||
wasmcc mint.c -o mint.wasm -Oz -Wl,--allow-undefined -I../
|
||||
wasm-opt mint.wasm -o mint.wasm \
|
||||
--shrink-level=100000000 \
|
||||
--coalesce-locals-learning \
|
||||
--vacuum \
|
||||
--merge-blocks \
|
||||
--merge-locals \
|
||||
--flatten \
|
||||
--ignore-implicit-traps \
|
||||
-ffm \
|
||||
--const-hoisting \
|
||||
--code-folding \
|
||||
--code-pushing \
|
||||
--dae-optimizing \
|
||||
--dce \
|
||||
--simplify-globals-optimizing \
|
||||
--simplify-locals-nonesting \
|
||||
--reorder-locals \
|
||||
--rereloop \
|
||||
--precompute-propagate \
|
||||
--local-cse \
|
||||
--remove-unused-brs \
|
||||
--memory-packing \
|
||||
-c \
|
||||
--avoid-reinterprets \
|
||||
-Oz
|
||||
hook-cleaner mint.wasm
|
||||
guard_checker mint.wasm
|
||||
nftoken:
|
||||
wasmcc nftoken.c -o nftoken.wasm -Oz -Wl,--allow-undefined -I../
|
||||
hook-cleaner nftoken.wasm
|
||||
123
hook/mint.c
Normal file
123
hook/mint.c
Normal file
@@ -0,0 +1,123 @@
|
||||
// This hook just tests GenesisMint transactor, it is not for production use
|
||||
|
||||
#include "hookapi.h"
|
||||
#define ASSERT(x)\
|
||||
if (!(x))\
|
||||
rollback(SBUF("MintTest: Assertion failure."),__LINE__);
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
uint8_t txn_mint[60000] =
|
||||
{
|
||||
/* size,upto */
|
||||
/* 3, 0 */ 0x12U, 0x00U, 0x60U, /* tt = GenesisMint */
|
||||
/* 5, 3 */ 0x22U, 0x80U, 0x00U, 0x00U, 0x00U, /* flags = tfCanonical */
|
||||
/* 5, 8 */ 0x24U, 0x00U, 0x00U, 0x00U, 0x00U, /* sequence = 0 */
|
||||
/* 6, 13 */ 0x20U, 0x1AU, 0x00U, 0x00U, 0x00U, 0x00U, /* first ledger seq */
|
||||
/* 6, 19 */ 0x20U, 0x1BU, 0x00U, 0x00U, 0x00U, 0x00U, /* last ledger seq */
|
||||
/* 9, 25 */ 0x68U, 0x40U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, /* fee */
|
||||
/* 35, 34 */ 0x73U, 0x21U, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* pubkey */
|
||||
/* 22, 69 */ 0x81U, 0x14U, 0xB5U,0xF7U,0x62U,0x79U,0x8AU,0x53U,0xD5U,0x43U,0xA0U,0x14U,
|
||||
0xCAU,0xF8U,0xB2U,0x97U,0xCFU,0xF8U,0xF2U,0xF9U,0x37U,0xE8U, /* src acc */
|
||||
|
||||
/* 116, 91 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* emit detail */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
/* 207, ... */ 0xF0U, 0x60U, /* gen mints arr */
|
||||
/* 34 bytes per entries + 1 tail byte
|
||||
E060
|
||||
61
|
||||
4111111111111111 // amount
|
||||
8114
|
||||
1234567891234567891234567891234567891234 // account
|
||||
E1
|
||||
... repeat
|
||||
F1 // tail byte
|
||||
*
|
||||
* */
|
||||
// 210 bytes + 34 bytes per entry * number of entries + any alignment padding desired
|
||||
};
|
||||
|
||||
#define BE_DROPS(drops)\
|
||||
{\
|
||||
uint64_t drops_tmp = drops;\
|
||||
uint8_t* b = (uint8_t*)&drops;\
|
||||
*b++ = 0b01000000 + (( drops_tmp >> 56 ) & 0b00111111 );\
|
||||
*b++ = (drops_tmp >> 48) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 40) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 32) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 24) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 16) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 8) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 0) & 0xFFU;\
|
||||
}
|
||||
|
||||
|
||||
int64_t hook(uint32_t r)
|
||||
{
|
||||
etxn_reserve(1);
|
||||
_g(1,1);
|
||||
|
||||
hook_account(txn_mint + 71, 20);
|
||||
|
||||
otxn_slot(1);
|
||||
ASSERT(slot_subfield(1, sfBlob, 2) == 2);
|
||||
|
||||
|
||||
int64_t bytes = slot(txn_mint + 207, 60000 - 207, 2);
|
||||
|
||||
ASSERT(bytes > 0);
|
||||
|
||||
bytes += 207;
|
||||
|
||||
// nop out any vl encoding
|
||||
uint8_t x = txn_mint[207];
|
||||
uint8_t y = txn_mint[208];
|
||||
uint8_t z = txn_mint[209];
|
||||
|
||||
txn_mint[207] = 0x99U;
|
||||
if (x > 192U)
|
||||
{
|
||||
txn_mint[208] = 0x99U;
|
||||
if (x > 240U)
|
||||
txn_mint[209] = 0x99U;
|
||||
}
|
||||
|
||||
|
||||
trace(SBUF("Txn:"), txn_mint, bytes, 1);
|
||||
|
||||
ASSERT(etxn_details(txn_mint + 91, 116) > 0);
|
||||
|
||||
int64_t fee = etxn_fee_base(txn_mint, bytes);
|
||||
BE_DROPS(fee);
|
||||
|
||||
*((uint64_t*)(txn_mint + 26)) = fee;
|
||||
|
||||
int64_t seq = ledger_seq() + 1;
|
||||
txn_mint[15] = (seq >> 24U) & 0xFFU;
|
||||
txn_mint[16] = (seq >> 16U) & 0xFFU;
|
||||
txn_mint[17] = (seq >> 8U) & 0xFFU;
|
||||
txn_mint[18] = seq & 0xFFU;
|
||||
|
||||
seq += 4;
|
||||
txn_mint[21] = (seq >> 24U) & 0xFFU;
|
||||
txn_mint[22] = (seq >> 16U) & 0xFFU;
|
||||
txn_mint[23] = (seq >> 8U) & 0xFFU;
|
||||
txn_mint[24] = seq & 0xFFU;
|
||||
|
||||
|
||||
trace(SBUF("emit:"), txn_mint, bytes, 1);
|
||||
|
||||
uint8_t emithash[32];
|
||||
int64_t emit_result = emit(SBUF(emithash), txn_mint, bytes);
|
||||
|
||||
if (DEBUG)
|
||||
TRACEVAR(emit_result);
|
||||
|
||||
if (emit_result < 0)
|
||||
rollback(SBUF("MintTest: Emit failed."), __LINE__);
|
||||
|
||||
|
||||
accept(SBUF("MintTest: Emitted txn successfully."), __LINE__);
|
||||
}
|
||||
213
hook/nftoken.c
Normal file
213
hook/nftoken.c
Normal file
@@ -0,0 +1,213 @@
|
||||
#include <stdint.h>
|
||||
#include "hookapi.h"
|
||||
#define SVAR(x) &x, sizeof(x)
|
||||
#define SBUF(x) (x), sizeof(x)
|
||||
#define NOPE(x)\
|
||||
{\
|
||||
return rollback((x), sizeof(x), __LINE__);\
|
||||
}
|
||||
|
||||
#define ttNFTOKEN_BURN 26
|
||||
#define ttIMPORT 97
|
||||
#define ttURITOKEN_MINT 45
|
||||
|
||||
int64_t hook(uint32_t r)
|
||||
{
|
||||
_g(1,1);
|
||||
|
||||
uint8_t hook_acc[20];
|
||||
hook_account(SBUF(hook_acc));
|
||||
|
||||
uint8_t otxn_acc[20];
|
||||
otxn_field(SBUF(otxn_acc), sfAccount);
|
||||
|
||||
// outgoing
|
||||
if (BUFFER_EQUAL_20(hook_acc, otxn_acc))
|
||||
accept(SBUF("NFTImport: Passing outgoing txn."), __LINE__);
|
||||
|
||||
if (otxn_type() != ttIMPORT)
|
||||
accept(SBUF("NFTImport: Passing non ttIMPORT txn."), otxn_type());
|
||||
|
||||
int64_t retval = xpop_slot(1,2);
|
||||
|
||||
if (retval <= 0)
|
||||
NOPE("Failed to slot xpop");
|
||||
|
||||
#define tx_slot 1
|
||||
#define meta_slot 2
|
||||
|
||||
trace_num("Slotted xpop", 12, retval);
|
||||
uint8_t dump1[2048];
|
||||
uint8_t dump2[2048];
|
||||
int64_t len1 = slot(dump1, sizeof(dump1), tx_slot);
|
||||
int64_t len2 = slot(dump2, sizeof(dump2), meta_slot);
|
||||
|
||||
trace("tx", 2, dump1, len1, 1);
|
||||
trace("meta", 4, dump2, len2, 1);
|
||||
|
||||
|
||||
if (slot_subfield(meta_slot, sfTransactionResult, 3) != 3)
|
||||
NOPE("Failed to slot transaction result");
|
||||
|
||||
uint8_t tr;
|
||||
if (slot(SVAR(tr), 3) != 1)
|
||||
NOPE("Failed to dump transaction result");
|
||||
|
||||
trace_num(SBUF("Inner Transaction Result:"), tr);
|
||||
if (tr != 0)
|
||||
NOPE("Inner Transaction Result not tesSUCCESS (0).");
|
||||
|
||||
// execution to here means tesSUCCESS on inner
|
||||
|
||||
if (slot_subfield(tx_slot, sfTransactionType, 4) != 4)
|
||||
NOPE("Could not slot transaction type");
|
||||
|
||||
uint8_t tt_buf[2];
|
||||
if (slot(SBUF(tt_buf), 4) != 2)
|
||||
NOPE("Could not dump transaction type");
|
||||
|
||||
uint16_t tt = UINT16_FROM_BUF(tt_buf);
|
||||
|
||||
if (tt != ttNFTOKEN_BURN)
|
||||
NOPE("Only NFTokenBurn is accepted");
|
||||
|
||||
// go track down the URI of the token (this is a huge pain, has to be done through metadata)
|
||||
//
|
||||
#define nodes 5
|
||||
if (slot_subfield(meta_slot, sfAffectedNodes, nodes) != nodes)
|
||||
NOPE("Could not slot sfAffectedNodes");
|
||||
|
||||
uint8_t dump4[1024];
|
||||
trace(SBUF("slot nodes"), dump4, slot(SBUF(dump4), nodes), 1);
|
||||
|
||||
|
||||
int64_t count = slot_count(nodes);
|
||||
if (count > 5) count = 5;
|
||||
|
||||
int64_t found;
|
||||
|
||||
for (int i = 0; GUARD(5), i < count; ++i)
|
||||
{
|
||||
if (slot_subarray(nodes, i, 6) != 6)
|
||||
break;
|
||||
|
||||
if (slot_subfield(6, sfLedgerEntryType, 7) != 7)
|
||||
NOPE("Could not slot LedgerEntryType");
|
||||
|
||||
uint8_t buf[2];
|
||||
slot(SVAR(buf), 7);
|
||||
|
||||
if (UINT16_FROM_BUF(buf) == 0x0050U)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
NOPE("Could not find NFTokenPage in xpop metadata");
|
||||
|
||||
if (slot_subfield(6, sfPreviousFields, 6) != 6 && slot_subfield(6, sfFinalFields, 6) != 6)
|
||||
NOPE("Could not slot sfPreviousFields");
|
||||
|
||||
if (slot_subfield(6, sfNFTokens, 6) != 6)
|
||||
NOPE("Could not slot sfNFTokens");
|
||||
|
||||
count = slot_count(6);
|
||||
if (count > 32) count = 32;
|
||||
|
||||
trace_num(SBUF("Modified node count:"), count);
|
||||
uint8_t burned_tid[32];
|
||||
if (slot_subfield(tx_slot, sfNFTokenID, 7) != 7 || slot(SBUF(burned_tid), 7) != 32)
|
||||
NOPE("Xpop txn did not contain valid nftokenid");
|
||||
|
||||
uint8_t uri[256];
|
||||
int64_t urilen;
|
||||
|
||||
found = 0;
|
||||
for (int i = 0; GUARD(32), i < count; ++i)
|
||||
{
|
||||
if (slot_subarray(6, i, 7) != 7)
|
||||
break;
|
||||
|
||||
{
|
||||
uint8_t dump4[1024];
|
||||
int64_t len = slot(SBUF(dump4), 7);
|
||||
trace(SBUF("dump4"), dump4, len, 1);
|
||||
}
|
||||
|
||||
uint8_t tid[32];
|
||||
int64_t r;
|
||||
if ((r=slot_subfield(7, sfNFTokenID, 8)) != 8)
|
||||
{
|
||||
trace_num(SBUF("r"), r);
|
||||
break;
|
||||
}
|
||||
|
||||
slot(SBUF(tid), 8);
|
||||
|
||||
if (slot_subfield(7, sfURI, 8) != 8)
|
||||
continue;
|
||||
|
||||
urilen = slot(SBUF(uri), 8);
|
||||
|
||||
trace(SBUF("uri: "), uri, urilen, 1);
|
||||
trace(SBUF("tid1"), tid, 32, 1);
|
||||
trace(SBUF("tid2"), burned_tid, 32, 1);
|
||||
found = BUFFER_EQUAL_32(tid, burned_tid);
|
||||
if (found)
|
||||
{
|
||||
trace(SBUF("found"), 0,0,0);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
NOPE("Could not find the NFTokenID in the metadata");
|
||||
|
||||
trace(SBUF("URI from xpop: "), uri, urilen, 1);
|
||||
|
||||
etxn_reserve(1);
|
||||
uint8_t txn_buf[1024];
|
||||
int64_t txn_len;
|
||||
{
|
||||
uint8_t* buf_out = txn_buf;
|
||||
uint32_t cls = (uint32_t)ledger_seq();
|
||||
_01_02_ENCODE_TT (buf_out, ttURITOKEN_MINT );
|
||||
_02_02_ENCODE_FLAGS (buf_out, tfCANONICAL );
|
||||
_02_04_ENCODE_SEQUENCE (buf_out, 0 );
|
||||
_02_26_ENCODE_FLS (buf_out, cls + 1 );
|
||||
_02_27_ENCODE_LLS (buf_out, cls + 5 );
|
||||
_06_01_ENCODE_DROPS_AMOUNT (buf_out, 0 );
|
||||
uint8_t* fee_ptr = buf_out;
|
||||
_06_08_ENCODE_DROPS_FEE (buf_out, 0 );
|
||||
_07_03_ENCODE_SIGNING_PUBKEY_NULL (buf_out );
|
||||
|
||||
// URI
|
||||
*buf_out++ = 0x75U;
|
||||
for (int i = 0; GUARD(32), i < 32; ++i)
|
||||
*(((uint64_t*)buf_out) + i) = *(((uint64_t*)uri) + i);
|
||||
buf_out += urilen;
|
||||
|
||||
_08_01_ENCODE_ACCOUNT_SRC (buf_out, hook_acc );
|
||||
_08_03_ENCODE_ACCOUNT_DST (buf_out, otxn_acc );
|
||||
int64_t edlen = etxn_details((uint32_t)buf_out, 512);
|
||||
trace_num(SBUF("edlen"), edlen);
|
||||
buf_out += edlen;
|
||||
txn_len = buf_out - txn_buf;
|
||||
int64_t fee = etxn_fee_base(txn_buf, txn_len);
|
||||
_06_08_ENCODE_DROPS_FEE (fee_ptr, fee );
|
||||
|
||||
}
|
||||
|
||||
trace(SBUF("emit txn"), txn_buf, txn_len, 1);
|
||||
|
||||
uint8_t etxid[32];
|
||||
if (emit(SBUF(etxid), txn_buf, txn_len) < 0)
|
||||
NOPE("Emission failed");
|
||||
|
||||
trace(SBUF("Emission success"), etxid, 32, 1);
|
||||
|
||||
return accept(0UL, 0UL, __LINE__);
|
||||
}
|
||||
69
hook/rekey-validator.js
Normal file
69
hook/rekey-validator.js
Normal file
@@ -0,0 +1,69 @@
|
||||
//reworked version of https://github.com/RichardAH/xrpl-tools/blob/master/validator-address-tool/vatool.js
|
||||
const rac = require('ripple-address-codec');
|
||||
const { XrplClient } = require('xrpl-client');
|
||||
const { sign, derive, XrplDefinitions } = require('xrpl-accountlib');
|
||||
const ed = require('elliptic').eddsa;
|
||||
const ec = new ed('ed25519');
|
||||
|
||||
if (process.argv.length < 6)
|
||||
{
|
||||
console.log("Rekey validator address tool");
|
||||
console.log("Usage: node " + process.argv[1] + " validator_secret_key raddr_to_rekey_to fee_drops network_id [ws://localhost:6005]");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const sk = (()=>
|
||||
{
|
||||
return 'ED' +
|
||||
Buffer.from(ec.keyFromSecret(rac.codec._codec.decode(process.argv[2]).slice(1,33)).secret()).
|
||||
toString('hex').toUpperCase();
|
||||
})();
|
||||
|
||||
|
||||
console.log(sk)
|
||||
const account = derive.privatekey(sk);
|
||||
console.log(account);
|
||||
|
||||
const endpoint = process.argv.length >= 7 ? process.argv[6] : 'ws://localhost:6005';
|
||||
console.log("endpoint:", endpoint);
|
||||
const client = new XrplClient(endpoint);
|
||||
|
||||
(async () => {
|
||||
const liveDefinitions = await client.send({ "command": "server_definitions" })
|
||||
|
||||
const definitions = new XrplDefinitions(liveDefinitions)
|
||||
|
||||
const ledgerInfo = await client.send({
|
||||
command: 'ledger'
|
||||
})
|
||||
|
||||
// console.log(ledgerInfo)
|
||||
|
||||
const accountInfo = await client.send({
|
||||
command: 'account_info',
|
||||
account: account.address,
|
||||
})
|
||||
|
||||
const txJsonPreSigning = {
|
||||
TransactionType: 'SetRegularKey',
|
||||
Account: account.address,
|
||||
RegularKey: process.argv[3],
|
||||
Fee: process.argv[4] + '',
|
||||
LastLedgerSequence: Number(ledgerInfo.closed.ledger.seqNum) + 5,
|
||||
Sequence: accountInfo.account_data.Sequence,
|
||||
NetworkID: process.argv[5]
|
||||
};
|
||||
|
||||
const signed = sign(txJsonPreSigning, account, definitions);
|
||||
|
||||
console.log('Tx', signed.id);
|
||||
console.log(signed.signedTransaction);
|
||||
|
||||
const submit = await client.send({
|
||||
command: 'submit',
|
||||
tx_blob: signed.signedTransaction
|
||||
});
|
||||
|
||||
console.log(submit);
|
||||
})();
|
||||
|
||||
348
hook/reward.c
Normal file
348
hook/reward.c
Normal file
@@ -0,0 +1,348 @@
|
||||
#include "hookapi.h"
|
||||
#define DEFAULT_REWARD_DELAY 6199553087261802496ULL
|
||||
// 2600000
|
||||
#define DEFAULT_REWARD_RATE 6038156834009797973ULL
|
||||
// 0.00333333333f
|
||||
|
||||
#define L1SEATS 20U
|
||||
#define MAXUNL 128U
|
||||
#define SVAR(x) &(x), sizeof(x)
|
||||
|
||||
#define ASSERT(x)\
|
||||
if (!(x))\
|
||||
rollback(SBUF("Reward: Assertion failure."),__LINE__);
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
uint8_t txn_mint[928] =
|
||||
{
|
||||
/* size,upto */
|
||||
/* 3, 0 */ 0x12U, 0x00U, 0x60U, /* tt = GenesisMint */
|
||||
/* 5, 3 */ 0x22U, 0x80U, 0x00U, 0x00U, 0x00U, /* flags = tfCanonical */
|
||||
/* 5, 8 */ 0x24U, 0x00U, 0x00U, 0x00U, 0x00U, /* sequence = 0 */
|
||||
/* 6, 13 */ 0x20U, 0x1AU, 0x00U, 0x00U, 0x00U, 0x00U, /* first ledger seq */
|
||||
/* 6, 19 */ 0x20U, 0x1BU, 0x00U, 0x00U, 0x00U, 0x00U, /* last ledger seq */
|
||||
/* 9, 25 */ 0x68U, 0x40U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, /* fee */
|
||||
/* 35, 34 */ 0x73U, 0x21U, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* pubkey */
|
||||
/* 22, 69 */ 0x81U, 0x14U, 0xB5U,0xF7U,0x62U,0x79U,0x8AU,0x53U,0xD5U,0x43U,0xA0U,0x14U,
|
||||
0xCAU,0xF8U,0xB2U,0x97U,0xCFU,0xF8U,0xF2U,0xF9U,0x37U,0xE8U, /* src acc */
|
||||
|
||||
/* 116, 91 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* emit detail */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
/* 207, ... */ 0xF0U, 0x60U, /* gen mints arr */
|
||||
/* 34 bytes per entries + 1 tail byte
|
||||
E060
|
||||
61
|
||||
4111111111111111 // amount
|
||||
8114
|
||||
1234567891234567891234567891234567891234 // account
|
||||
E1
|
||||
... repeat
|
||||
F1 // tail byte
|
||||
*
|
||||
* */
|
||||
// 210 bytes + 34 bytes per entry * number of entries + any alignment padding desired
|
||||
};
|
||||
|
||||
uint8_t template[40] = {
|
||||
/* 0, 2 */ 0xE0U, 0x60U, // obj start
|
||||
/* 2, 1 */ 0x61U, // amount header
|
||||
/* 3, 8 */ 0,0,0,0,0,0,0,0, // amount payload
|
||||
/* 11, 2 */ 0x83U, 0x14U, // account header
|
||||
/* 13, 20 */ 0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0, // account payload
|
||||
/* 33, 1 */ 0xE1U // obj end
|
||||
};
|
||||
|
||||
|
||||
#define TEMPLATE_DROPS(drops_tmp)\
|
||||
{\
|
||||
uint8_t* b = template + 3U;\
|
||||
*b++ = 0b01000000 + (( drops_tmp >> 56 ) & 0b00111111 );\
|
||||
*b++ = (drops_tmp >> 48) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 40) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 32) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 24) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 16) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 8) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 0) & 0xFFU;\
|
||||
}
|
||||
|
||||
#define BE_DROPS(drops)\
|
||||
{\
|
||||
uint64_t drops_tmp = drops;\
|
||||
uint8_t* b = (uint8_t*)&drops;\
|
||||
*b++ = 0b01000000 + (( drops_tmp >> 56 ) & 0b00111111 );\
|
||||
*b++ = (drops_tmp >> 48) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 40) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 32) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 24) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 16) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 8) & 0xFFU;\
|
||||
*b++ = (drops_tmp >> 0) & 0xFFU;\
|
||||
}
|
||||
|
||||
uint8_t member_count_key[2] = {'M', 'C'};
|
||||
|
||||
|
||||
uint8_t unlreport_keylet[34] =
|
||||
{
|
||||
0x00U,0x52U,0x61U,0xE3U,0x2EU,0x7AU,0x24U,0xA2U,0x38U,
|
||||
0xF1U,0xC6U,0x19U,0xD5U,0xF9U,0xDDU,0xCCU,0x41U,0xA9U,
|
||||
0x4BU,0x33U,0xB6U,0x6CU,0x01U,0x63U,0xF7U,0xEFU,0xCCU,
|
||||
0x8AU,0x19U,0xC9U,0xFDU,0x6FU,0x28U,0xDCU
|
||||
};
|
||||
|
||||
uint8_t msg_buf[] = "You must wait 0000000 seconds";
|
||||
int64_t hook(uint32_t r)
|
||||
{
|
||||
etxn_reserve(1);
|
||||
_g(1,1);
|
||||
|
||||
// only process ttCLAIM_REWARD
|
||||
if (otxn_type() != 98)
|
||||
accept(SBUF("Reward: Passing non-claim txn"), __LINE__);
|
||||
|
||||
uint8_t otxn_acc[20];
|
||||
uint8_t hook_acc[20];
|
||||
|
||||
// get the account id
|
||||
otxn_field(SBUF(otxn_acc), sfAccount);
|
||||
|
||||
// write the hook account into the txn template
|
||||
hook_account(SBUF(hook_acc));
|
||||
|
||||
if (BUFFER_EQUAL_20(hook_acc, otxn_acc))
|
||||
accept(SBUF("Reward: Passing outgoing txn"), __LINE__);
|
||||
|
||||
// the default rate and delay are used if somehow the keys are missing from hook state (graceful failure)
|
||||
int64_t xfl_rr = DEFAULT_REWARD_RATE;
|
||||
int64_t xfl_rd = DEFAULT_REWARD_DELAY;
|
||||
|
||||
// load state if it exists (which it should)
|
||||
state(&xfl_rr, 8, "RR", 2);
|
||||
state(&xfl_rd, 8, "RD", 2);
|
||||
|
||||
// if either of these is 0 that's disabled
|
||||
if (xfl_rr <= 0 || xfl_rd <= 0 )
|
||||
rollback(SBUF("Reward: Rewards are disabled by governance."), __LINE__);
|
||||
|
||||
int64_t required_delay = float_int(xfl_rd, 0, 0);
|
||||
|
||||
if (required_delay < 0 || float_sign(xfl_rr) != 0 ||
|
||||
float_compare(xfl_rr, float_one(), COMPARE_GREATER) ||
|
||||
float_compare(xfl_rd, float_one(), COMPARE_LESS))
|
||||
rollback(SBUF("Reward: Rewards incorrectly configured by governance or unrecoverable error."), __LINE__);
|
||||
|
||||
// get the account root keylet
|
||||
uint8_t kl[34];
|
||||
util_keylet(SBUF(kl), KEYLET_ACCOUNT, SBUF(otxn_acc), 0,0,0,0);
|
||||
|
||||
// slot the account root, this can't fail
|
||||
slot_set(SBUF(kl), 1);
|
||||
|
||||
// this is a first time claim reward has run and will setup these fields
|
||||
if (slot_subfield(1, sfRewardAccumulator, 2) != 2)
|
||||
accept(SBUF("Reward: Passing reward setup txn"), __LINE__);
|
||||
|
||||
// this is an actual claim reward
|
||||
slot_subfield(1, sfRewardLgrFirst, 3);
|
||||
slot_subfield(1, sfRewardLgrLast, 4);
|
||||
slot_subfield(1, sfBalance, 5);
|
||||
slot_subfield(1, sfRewardTime, 6);
|
||||
|
||||
int64_t time = slot(0,0,6);
|
||||
|
||||
int64_t time_elapsed = ledger_last_time() - time;
|
||||
|
||||
|
||||
if (time_elapsed < required_delay)
|
||||
{
|
||||
//2 600 000
|
||||
time_elapsed = required_delay - time_elapsed;
|
||||
msg_buf[14] += (time_elapsed / 1000000) % 10;
|
||||
msg_buf[15] += (time_elapsed / 100000) % 10;
|
||||
msg_buf[16] += (time_elapsed / 10000) % 10;
|
||||
msg_buf[17] += (time_elapsed / 1000) % 10;
|
||||
msg_buf[18] += (time_elapsed / 100) % 10;
|
||||
msg_buf[19] += (time_elapsed / 10) % 10;
|
||||
msg_buf[20] += (time_elapsed ) % 10;
|
||||
|
||||
rollback(SBUF(msg_buf), __LINE__);
|
||||
}
|
||||
|
||||
int64_t accumulator = slot(0,0,2);
|
||||
int64_t first = slot(0,0,3);
|
||||
int64_t last = slot(0,0,4);
|
||||
int64_t bal = slot(0,0,5);
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
TRACEVAR(accumulator);
|
||||
TRACEVAR(first);
|
||||
TRACEVAR(last);
|
||||
}
|
||||
|
||||
ASSERT(/*accumulator > 0 &&*/ first > 0 && last > 0);
|
||||
|
||||
// we need to add the final block ourselves
|
||||
|
||||
int64_t cur = ledger_seq();
|
||||
|
||||
int64_t elapsed = cur - first;
|
||||
|
||||
ASSERT(elapsed > 0);
|
||||
|
||||
int64_t elapsed_since_last = ledger_seq() - last;
|
||||
|
||||
bal &= ~0xE000000000000000ULL;
|
||||
bal /= 1000000LL;
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
TRACEVAR(bal);
|
||||
TRACEVAR(accumulator);
|
||||
}
|
||||
|
||||
if (bal > 0 && elapsed_since_last > 0)
|
||||
accumulator += bal * elapsed_since_last;
|
||||
|
||||
if (DEBUG)
|
||||
TRACEVAR(accumulator);
|
||||
|
||||
|
||||
int64_t xfl_accum = float_set(0, accumulator);
|
||||
ASSERT(xfl_accum > 0);
|
||||
|
||||
int64_t xfl_elapsed = float_set(0, elapsed);
|
||||
ASSERT(xfl_elapsed > 0);
|
||||
|
||||
int64_t xfl_reward = float_divide(xfl_accum, xfl_elapsed);
|
||||
xfl_reward = float_multiply(xfl_rr, xfl_reward);
|
||||
|
||||
if (DEBUG)
|
||||
TRACEVAR(xfl_reward);
|
||||
|
||||
|
||||
uint64_t reward_drops = float_int(xfl_reward, 6, 1);
|
||||
|
||||
uint64_t l1_drops = reward_drops / L1SEATS;
|
||||
|
||||
int64_t otxn_slot_num = otxn_slot(10);
|
||||
ASSERT(otxn_slot_num == 10);
|
||||
|
||||
int64_t fee_slot_num = slot_subfield(10, sfFee, 11);
|
||||
ASSERT(fee_slot_num == 11);
|
||||
|
||||
int64_t xfl_fee = slot_float(11);
|
||||
|
||||
// user gets back the fee they spent running the hook
|
||||
if (xfl_fee > 0)
|
||||
reward_drops += float_int(xfl_fee, 6, 1);
|
||||
|
||||
TEMPLATE_DROPS(reward_drops);
|
||||
|
||||
uint8_t* upto = txn_mint + 209U;
|
||||
uint8_t* end = upto + (34U * (L1SEATS + 1));
|
||||
|
||||
// first account is always the rewardee
|
||||
{
|
||||
uint64_t* d = (uint64_t*)upto;
|
||||
uint64_t* s = (uint64_t*)template;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*(d+2) = *(s+2);
|
||||
otxn_field(upto + 13, 20, sfAccount);
|
||||
}
|
||||
upto += 34U;
|
||||
|
||||
// now iterate all possible seats in all possible tables
|
||||
TEMPLATE_DROPS(l1_drops);
|
||||
|
||||
|
||||
// there are two conditions for L1 governance members to receive rewards:
|
||||
// 1. they must be an L1 member
|
||||
// 2. they must be an active validator
|
||||
|
||||
// load the UNLReport, this will let us know who has been validating and who hasn't
|
||||
|
||||
uint64_t can_reward[L1SEATS];
|
||||
|
||||
|
||||
uint8_t av_array[(60 * MAXUNL) + 4];
|
||||
if (slot_set(SBUF(unlreport_keylet), 1) == 1 &&
|
||||
slot_subfield(1, sfActiveValidators, 1) == 1 &&
|
||||
slot(SBUF(av_array), 1) > 0)
|
||||
{
|
||||
// at least some validators have been validating so those get a reward if they are on the governance table
|
||||
// we are going to assume the UNL never exceeds 64
|
||||
uint8_t seat = 0;
|
||||
uint8_t* av_upto = av_array + 39 /* offset to the first key */;
|
||||
uint64_t av_size = slot_count(1);
|
||||
if (av_size > MAXUNL) av_size = MAXUNL;
|
||||
for (uint64_t i = 0; GUARD(MAXUNL), i < av_size; ++i, av_upto += 60U)
|
||||
{
|
||||
trace(SBUF("av:"), av_upto, 20, 1);
|
||||
if (state(SVAR(seat), av_upto, 20) != 1 || seat > L1SEATS)
|
||||
continue;
|
||||
can_reward[seat] = 1;
|
||||
}
|
||||
|
||||
// iterate the seats at the table and add reward entries for the active validators
|
||||
for (uint8_t l1_seat = 0; upto < end && l1_seat < L1SEATS; l1_seat++)
|
||||
{
|
||||
GUARD(L1SEATS);
|
||||
if (!can_reward[l1_seat])
|
||||
continue;
|
||||
|
||||
// copy template 1 into next GenesisMints array position
|
||||
uint64_t* d = (uint64_t*)upto;
|
||||
uint64_t* s = (uint64_t*)template;
|
||||
*d++ = *s++;
|
||||
*d++ = *s++;
|
||||
*(d+2) = *(s+2);
|
||||
|
||||
if (state(upto + 13, 20, &l1_seat, 1) == 20)
|
||||
upto += 34;
|
||||
}
|
||||
|
||||
}
|
||||
*upto++ = 0xF1U;
|
||||
|
||||
|
||||
// populate other txn fields
|
||||
etxn_details(txn_mint + 91, 116);
|
||||
int64_t fee = etxn_fee_base(txn_mint, upto - txn_mint);
|
||||
BE_DROPS(fee);
|
||||
|
||||
*((uint64_t*)(txn_mint + 26)) = fee;
|
||||
|
||||
int64_t seq = ledger_seq() + 1;
|
||||
txn_mint[15] = (seq >> 24U) & 0xFFU;
|
||||
txn_mint[16] = (seq >> 16U) & 0xFFU;
|
||||
txn_mint[17] = (seq >> 8U) & 0xFFU;
|
||||
txn_mint[18] = seq & 0xFFU;
|
||||
|
||||
seq += 4;
|
||||
txn_mint[21] = (seq >> 24U) & 0xFFU;
|
||||
txn_mint[22] = (seq >> 16U) & 0xFFU;
|
||||
txn_mint[23] = (seq >> 8U) & 0xFFU;
|
||||
txn_mint[24] = seq & 0xFFU;
|
||||
|
||||
|
||||
trace(SBUF("emit:"), txn_mint, upto-txn_mint, 1);
|
||||
|
||||
uint8_t emithash[32];
|
||||
int64_t emit_result = emit(SBUF(emithash), txn_mint, upto - txn_mint);
|
||||
|
||||
if (DEBUG)
|
||||
TRACEVAR(emit_result);
|
||||
|
||||
if (emit_result < 0)
|
||||
rollback(SBUF("Reward: Emit loopback failed."), __LINE__);
|
||||
|
||||
|
||||
accept(SBUF("Reward: Emitted reward txn successfully."), __LINE__);
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
#include "hookapi.h"
|
||||
//#define REWARD_DELAY 2600000LL
|
||||
#define REWARD_DELAY 60LL
|
||||
#define REWARD_MULTIPLIER 0.00333333333f
|
||||
#define ASSERT(x)\
|
||||
if (!(x))\
|
||||
rollback(0,0,__LINE__);
|
||||
|
||||
int64_t hook(uint32_t r)
|
||||
{
|
||||
etxn_reserve(1);
|
||||
_g(1,1);
|
||||
|
||||
uint8_t ttbuf[16];
|
||||
int64_t br = otxn_field(SBUF(ttbuf), sfTransactionType);
|
||||
uint32_t txntype = ((uint32_t)(ttbuf[0]) << 16U) + ((uint32_t)(ttbuf[1]));
|
||||
|
||||
if (txntype != 98)
|
||||
accept(0,0,0);
|
||||
|
||||
// get the account id
|
||||
uint8_t account_field[20];
|
||||
ASSERT(otxn_field(SBUF(account_field), sfAccount) == 20);
|
||||
|
||||
uint8_t hook_accid[20];
|
||||
hook_account(SBUF(hook_accid));
|
||||
|
||||
|
||||
int equal = 0; BUFFER_EQUAL(equal, hook_accid, account_field, 20);
|
||||
if (equal)
|
||||
accept(0,0,0);
|
||||
|
||||
|
||||
// get the account root keylet
|
||||
uint8_t kl[34];
|
||||
ASSERT(util_keylet(SBUF(kl), KEYLET_ACCOUNT, SBUF(account_field), 0,0,0,0) == 34);
|
||||
|
||||
// slot the account root
|
||||
ASSERT(slot_set(SBUF(kl), 1) == 1);
|
||||
|
||||
|
||||
int64_t accum_slot = slot_subfield(1, sfRewardAccumulator, 2);
|
||||
|
||||
// this is a first time claim reward has run and will setup these fields
|
||||
if (accum_slot == DOESNT_EXIST)
|
||||
accept(0,0,0);
|
||||
|
||||
// this is an actual claim reward
|
||||
ASSERT(accum_slot == 2);
|
||||
ASSERT(slot_subfield(1, sfRewardLgrFirst, 3) == 3);
|
||||
ASSERT(slot_subfield(1, sfRewardLgrLast, 4) == 4);
|
||||
ASSERT(slot_subfield(1, sfBalance, 5) == 5);
|
||||
ASSERT(slot_subfield(1, sfRewardTime, 6) == 6);
|
||||
|
||||
int64_t time = slot(0,0,6);
|
||||
|
||||
int64_t time_elapsed = ledger_last_time() - time;
|
||||
if (time_elapsed < REWARD_DELAY)
|
||||
{
|
||||
uint8_t msg_buf[] =
|
||||
{
|
||||
'Y','o','u',' ','m','u','s','t', // 8
|
||||
' ','w','a','i','t',' ', //+6 = 14
|
||||
'0','0','0','0','0','0','0',
|
||||
' ','s','e','c','o','n','d','s' };
|
||||
|
||||
//2 600 000
|
||||
time_elapsed = REWARD_DELAY - time_elapsed;
|
||||
msg_buf[14] += (time_elapsed / 1000000) % 10;
|
||||
msg_buf[15] += (time_elapsed / 100000) % 10;
|
||||
msg_buf[16] += (time_elapsed / 10000) % 10;
|
||||
msg_buf[17] += (time_elapsed / 1000) % 10;
|
||||
msg_buf[18] += (time_elapsed / 100) % 10;
|
||||
msg_buf[19] += (time_elapsed / 10) % 10;
|
||||
msg_buf[20] += (time_elapsed ) % 10;
|
||||
|
||||
rollback(SBUF(msg_buf), time_elapsed);
|
||||
}
|
||||
|
||||
int64_t accumulator = slot(0,0,2);
|
||||
int64_t first = slot(0,0,3);
|
||||
int64_t last = slot(0,0,4);
|
||||
int64_t bal = slot(0,0,5);
|
||||
|
||||
|
||||
TRACEVAR(accumulator);
|
||||
TRACEVAR(first);
|
||||
TRACEVAR(last);
|
||||
|
||||
ASSERT(accumulator > 0 && first > 0 && last > 0);
|
||||
|
||||
// we need to add the final block ourselves
|
||||
|
||||
int64_t cur = ledger_seq();
|
||||
|
||||
int64_t elapsed = cur - first;
|
||||
|
||||
ASSERT(elapsed > 0);
|
||||
|
||||
int64_t elapsed_since_last = ledger_seq() - last;
|
||||
|
||||
bal &= ~0xE000000000000000ULL;
|
||||
bal /= 1000000LL;
|
||||
|
||||
TRACEVAR(bal);
|
||||
|
||||
TRACEVAR(accumulator);
|
||||
|
||||
if (bal > 0 && elapsed_since_last > 0)
|
||||
accumulator += bal * elapsed_since_last;
|
||||
|
||||
TRACEVAR(accumulator);
|
||||
|
||||
int64_t reward = (int64_t)(((REWARD_MULTIPLIER * (double)accumulator)) / ((double)elapsed));
|
||||
|
||||
TRACEVAR(reward);
|
||||
|
||||
int64_t reward_drops = reward * 1000000ULL;
|
||||
|
||||
ASSERT(reward_drops > reward);
|
||||
|
||||
TRACEVAR(reward_drops);
|
||||
|
||||
uint8_t tx[PREPARE_PAYMENT_SIMPLE_SIZE];
|
||||
PREPARE_PAYMENT_SIMPLE(tx, reward_drops, account_field, 0, 0);
|
||||
|
||||
// emit the transaction
|
||||
uint8_t emithash[32];
|
||||
int64_t emit_result = emit(SBUF(emithash), SBUF(tx));
|
||||
TRACEVAR(emit_result);
|
||||
|
||||
accept(0,0,0);
|
||||
}
|
||||
215
hook/sfcodes.h
Normal file
215
hook/sfcodes.h
Normal file
@@ -0,0 +1,215 @@
|
||||
// For documentation please see: https://xrpl-hooks.readme.io/reference/
|
||||
// Generated using generate_sfcodes.sh
|
||||
#define sfCloseResolution ((16U << 16U) + 1U)
|
||||
#define sfMethod ((16U << 16U) + 2U)
|
||||
#define sfTransactionResult ((16U << 16U) + 3U)
|
||||
#define sfTickSize ((16U << 16U) + 16U)
|
||||
#define sfUNLModifyDisabling ((16U << 16U) + 17U)
|
||||
#define sfHookResult ((16U << 16U) + 18U)
|
||||
#define sfLedgerEntryType ((1U << 16U) + 1U)
|
||||
#define sfTransactionType ((1U << 16U) + 2U)
|
||||
#define sfSignerWeight ((1U << 16U) + 3U)
|
||||
#define sfTransferFee ((1U << 16U) + 4U)
|
||||
#define sfVersion ((1U << 16U) + 16U)
|
||||
#define sfHookStateChangeCount ((1U << 16U) + 17U)
|
||||
#define sfHookEmitCount ((1U << 16U) + 18U)
|
||||
#define sfHookExecutionIndex ((1U << 16U) + 19U)
|
||||
#define sfHookApiVersion ((1U << 16U) + 20U)
|
||||
#define sfNetworkID ((2U << 16U) + 1U)
|
||||
#define sfFlags ((2U << 16U) + 2U)
|
||||
#define sfSourceTag ((2U << 16U) + 3U)
|
||||
#define sfSequence ((2U << 16U) + 4U)
|
||||
#define sfPreviousTxnLgrSeq ((2U << 16U) + 5U)
|
||||
#define sfLedgerSequence ((2U << 16U) + 6U)
|
||||
#define sfCloseTime ((2U << 16U) + 7U)
|
||||
#define sfParentCloseTime ((2U << 16U) + 8U)
|
||||
#define sfSigningTime ((2U << 16U) + 9U)
|
||||
#define sfExpiration ((2U << 16U) + 10U)
|
||||
#define sfTransferRate ((2U << 16U) + 11U)
|
||||
#define sfWalletSize ((2U << 16U) + 12U)
|
||||
#define sfOwnerCount ((2U << 16U) + 13U)
|
||||
#define sfDestinationTag ((2U << 16U) + 14U)
|
||||
#define sfHighQualityIn ((2U << 16U) + 16U)
|
||||
#define sfHighQualityOut ((2U << 16U) + 17U)
|
||||
#define sfLowQualityIn ((2U << 16U) + 18U)
|
||||
#define sfLowQualityOut ((2U << 16U) + 19U)
|
||||
#define sfQualityIn ((2U << 16U) + 20U)
|
||||
#define sfQualityOut ((2U << 16U) + 21U)
|
||||
#define sfStampEscrow ((2U << 16U) + 22U)
|
||||
#define sfBondAmount ((2U << 16U) + 23U)
|
||||
#define sfLoadFee ((2U << 16U) + 24U)
|
||||
#define sfOfferSequence ((2U << 16U) + 25U)
|
||||
#define sfFirstLedgerSequence ((2U << 16U) + 26U)
|
||||
#define sfLastLedgerSequence ((2U << 16U) + 27U)
|
||||
#define sfTransactionIndex ((2U << 16U) + 28U)
|
||||
#define sfOperationLimit ((2U << 16U) + 29U)
|
||||
#define sfReferenceFeeUnits ((2U << 16U) + 30U)
|
||||
#define sfReserveBase ((2U << 16U) + 31U)
|
||||
#define sfReserveIncrement ((2U << 16U) + 32U)
|
||||
#define sfSetFlag ((2U << 16U) + 33U)
|
||||
#define sfClearFlag ((2U << 16U) + 34U)
|
||||
#define sfSignerQuorum ((2U << 16U) + 35U)
|
||||
#define sfCancelAfter ((2U << 16U) + 36U)
|
||||
#define sfFinishAfter ((2U << 16U) + 37U)
|
||||
#define sfSignerListID ((2U << 16U) + 38U)
|
||||
#define sfSettleDelay ((2U << 16U) + 39U)
|
||||
#define sfTicketCount ((2U << 16U) + 40U)
|
||||
#define sfTicketSequence ((2U << 16U) + 41U)
|
||||
#define sfNFTokenTaxon ((2U << 16U) + 42U)
|
||||
#define sfMintedNFTokens ((2U << 16U) + 43U)
|
||||
#define sfBurnedNFTokens ((2U << 16U) + 44U)
|
||||
#define sfHookStateCount ((2U << 16U) + 45U)
|
||||
#define sfEmitGeneration ((2U << 16U) + 46U)
|
||||
#define sfLockCount ((2U << 16U) + 47U)
|
||||
#define sfRewardTime ((2U << 16U) + 98U)
|
||||
#define sfRewardLgrFirst ((2U << 16U) + 99U)
|
||||
#define sfRewardLgrLast ((2U << 16U) + 100U)
|
||||
#define sfIndexNext ((3U << 16U) + 1U)
|
||||
#define sfIndexPrevious ((3U << 16U) + 2U)
|
||||
#define sfBookNode ((3U << 16U) + 3U)
|
||||
#define sfOwnerNode ((3U << 16U) + 4U)
|
||||
#define sfBaseFee ((3U << 16U) + 5U)
|
||||
#define sfExchangeRate ((3U << 16U) + 6U)
|
||||
#define sfLowNode ((3U << 16U) + 7U)
|
||||
#define sfHighNode ((3U << 16U) + 8U)
|
||||
#define sfDestinationNode ((3U << 16U) + 9U)
|
||||
#define sfCookie ((3U << 16U) + 10U)
|
||||
#define sfServerVersion ((3U << 16U) + 11U)
|
||||
#define sfNFTokenOfferNode ((3U << 16U) + 12U)
|
||||
#define sfEmitBurden ((3U << 16U) + 13U)
|
||||
#define sfHookInstructionCount ((3U << 16U) + 17U)
|
||||
#define sfHookReturnCode ((3U << 16U) + 18U)
|
||||
#define sfReferenceCount ((3U << 16U) + 19U)
|
||||
#define sfRewardAccumulator ((3U << 16U) + 100U)
|
||||
#define sfEmailHash ((4U << 16U) + 1U)
|
||||
#define sfTakerPaysCurrency ((10U << 16U) + 1U)
|
||||
#define sfTakerPaysIssuer ((10U << 16U) + 2U)
|
||||
#define sfTakerGetsCurrency ((10U << 16U) + 3U)
|
||||
#define sfTakerGetsIssuer ((10U << 16U) + 4U)
|
||||
#define sfLedgerHash ((5U << 16U) + 1U)
|
||||
#define sfParentHash ((5U << 16U) + 2U)
|
||||
#define sfTransactionHash ((5U << 16U) + 3U)
|
||||
#define sfAccountHash ((5U << 16U) + 4U)
|
||||
#define sfPreviousTxnID ((5U << 16U) + 5U)
|
||||
#define sfLedgerIndex ((5U << 16U) + 6U)
|
||||
#define sfWalletLocator ((5U << 16U) + 7U)
|
||||
#define sfRootIndex ((5U << 16U) + 8U)
|
||||
#define sfAccountTxnID ((5U << 16U) + 9U)
|
||||
#define sfNFTokenID ((5U << 16U) + 10U)
|
||||
#define sfEmitParentTxnID ((5U << 16U) + 11U)
|
||||
#define sfEmitNonce ((5U << 16U) + 12U)
|
||||
#define sfEmitHookHash ((5U << 16U) + 13U)
|
||||
#define sfBookDirectory ((5U << 16U) + 16U)
|
||||
#define sfInvoiceID ((5U << 16U) + 17U)
|
||||
#define sfNickname ((5U << 16U) + 18U)
|
||||
#define sfAmendment ((5U << 16U) + 19U)
|
||||
#define sfHookOn ((5U << 16U) + 20U)
|
||||
#define sfDigest ((5U << 16U) + 21U)
|
||||
#define sfChannel ((5U << 16U) + 22U)
|
||||
#define sfConsensusHash ((5U << 16U) + 23U)
|
||||
#define sfCheckID ((5U << 16U) + 24U)
|
||||
#define sfValidatedHash ((5U << 16U) + 25U)
|
||||
#define sfPreviousPageMin ((5U << 16U) + 26U)
|
||||
#define sfNextPageMin ((5U << 16U) + 27U)
|
||||
#define sfNFTokenBuyOffer ((5U << 16U) + 28U)
|
||||
#define sfNFTokenSellOffer ((5U << 16U) + 29U)
|
||||
#define sfHookStateKey ((5U << 16U) + 30U)
|
||||
#define sfHookHash ((5U << 16U) + 31U)
|
||||
#define sfHookNamespace ((5U << 16U) + 32U)
|
||||
#define sfHookSetTxnID ((5U << 16U) + 33U)
|
||||
#define sfOfferID ((5U << 16U) + 34U)
|
||||
#define sfEscrowID ((5U << 16U) + 35U)
|
||||
#define sfURITokenID ((5U << 16U) + 36U)
|
||||
#define sfAmount ((6U << 16U) + 1U)
|
||||
#define sfBalance ((6U << 16U) + 2U)
|
||||
#define sfLimitAmount ((6U << 16U) + 3U)
|
||||
#define sfTakerPays ((6U << 16U) + 4U)
|
||||
#define sfTakerGets ((6U << 16U) + 5U)
|
||||
#define sfLowLimit ((6U << 16U) + 6U)
|
||||
#define sfHighLimit ((6U << 16U) + 7U)
|
||||
#define sfFee ((6U << 16U) + 8U)
|
||||
#define sfSendMax ((6U << 16U) + 9U)
|
||||
#define sfDeliverMin ((6U << 16U) + 10U)
|
||||
#define sfMinimumOffer ((6U << 16U) + 16U)
|
||||
#define sfRippleEscrow ((6U << 16U) + 17U)
|
||||
#define sfDeliveredAmount ((6U << 16U) + 18U)
|
||||
#define sfNFTokenBrokerFee ((6U << 16U) + 19U)
|
||||
#define sfHookCallbackFee ((6U << 16U) + 20U)
|
||||
#define sfLockedBalance ((6U << 16U) + 21U)
|
||||
#define sfPublicKey ((7U << 16U) + 1U)
|
||||
#define sfMessageKey ((7U << 16U) + 2U)
|
||||
#define sfSigningPubKey ((7U << 16U) + 3U)
|
||||
#define sfTxnSignature ((7U << 16U) + 4U)
|
||||
#define sfURI ((7U << 16U) + 5U)
|
||||
#define sfSignature ((7U << 16U) + 6U)
|
||||
#define sfDomain ((7U << 16U) + 7U)
|
||||
#define sfFundCode ((7U << 16U) + 8U)
|
||||
#define sfRemoveCode ((7U << 16U) + 9U)
|
||||
#define sfExpireCode ((7U << 16U) + 10U)
|
||||
#define sfCreateCode ((7U << 16U) + 11U)
|
||||
#define sfMemoType ((7U << 16U) + 12U)
|
||||
#define sfMemoData ((7U << 16U) + 13U)
|
||||
#define sfMemoFormat ((7U << 16U) + 14U)
|
||||
#define sfFulfillment ((7U << 16U) + 16U)
|
||||
#define sfCondition ((7U << 16U) + 17U)
|
||||
#define sfMasterSignature ((7U << 16U) + 18U)
|
||||
#define sfUNLModifyValidator ((7U << 16U) + 19U)
|
||||
#define sfValidatorToDisable ((7U << 16U) + 20U)
|
||||
#define sfValidatorToReEnable ((7U << 16U) + 21U)
|
||||
#define sfHookStateData ((7U << 16U) + 22U)
|
||||
#define sfHookReturnString ((7U << 16U) + 23U)
|
||||
#define sfHookParameterName ((7U << 16U) + 24U)
|
||||
#define sfHookParameterValue ((7U << 16U) + 25U)
|
||||
#define sfBlob ((7U << 16U) + 26U)
|
||||
#define sfAccount ((8U << 16U) + 1U)
|
||||
#define sfOwner ((8U << 16U) + 2U)
|
||||
#define sfDestination ((8U << 16U) + 3U)
|
||||
#define sfIssuer ((8U << 16U) + 4U)
|
||||
#define sfAuthorize ((8U << 16U) + 5U)
|
||||
#define sfUnauthorize ((8U << 16U) + 6U)
|
||||
#define sfRegularKey ((8U << 16U) + 8U)
|
||||
#define sfNFTokenMinter ((8U << 16U) + 9U)
|
||||
#define sfEmitCallback ((8U << 16U) + 10U)
|
||||
#define sfHookAccount ((8U << 16U) + 16U)
|
||||
#define sfIndexes ((19U << 16U) + 1U)
|
||||
#define sfHashes ((19U << 16U) + 2U)
|
||||
#define sfAmendments ((19U << 16U) + 3U)
|
||||
#define sfNFTokenOffers ((19U << 16U) + 4U)
|
||||
#define sfHookNamespaces ((19U << 16U) + 5U)
|
||||
#define sfPaths ((18U << 16U) + 1U)
|
||||
#define sfTransactionMetaData ((14U << 16U) + 2U)
|
||||
#define sfCreatedNode ((14U << 16U) + 3U)
|
||||
#define sfDeletedNode ((14U << 16U) + 4U)
|
||||
#define sfModifiedNode ((14U << 16U) + 5U)
|
||||
#define sfPreviousFields ((14U << 16U) + 6U)
|
||||
#define sfFinalFields ((14U << 16U) + 7U)
|
||||
#define sfNewFields ((14U << 16U) + 8U)
|
||||
#define sfTemplateEntry ((14U << 16U) + 9U)
|
||||
#define sfMemo ((14U << 16U) + 10U)
|
||||
#define sfSignerEntry ((14U << 16U) + 11U)
|
||||
#define sfNFToken ((14U << 16U) + 12U)
|
||||
#define sfEmitDetails ((14U << 16U) + 13U)
|
||||
#define sfHook ((14U << 16U) + 14U)
|
||||
#define sfSigner ((14U << 16U) + 16U)
|
||||
#define sfMajority ((14U << 16U) + 18U)
|
||||
#define sfDisabledValidator ((14U << 16U) + 19U)
|
||||
#define sfEmittedTxn ((14U << 16U) + 20U)
|
||||
#define sfHookExecution ((14U << 16U) + 21U)
|
||||
#define sfHookDefinition ((14U << 16U) + 22U)
|
||||
#define sfHookParameter ((14U << 16U) + 23U)
|
||||
#define sfHookGrant ((14U << 16U) + 24U)
|
||||
#define sfSigners ((15U << 16U) + 3U)
|
||||
#define sfSignerEntries ((15U << 16U) + 4U)
|
||||
#define sfTemplate ((15U << 16U) + 5U)
|
||||
#define sfNecessary ((15U << 16U) + 6U)
|
||||
#define sfSufficient ((15U << 16U) + 7U)
|
||||
#define sfAffectedNodes ((15U << 16U) + 8U)
|
||||
#define sfMemos ((15U << 16U) + 9U)
|
||||
#define sfNFTokens ((15U << 16U) + 10U)
|
||||
#define sfHooks ((15U << 16U) + 11U)
|
||||
#define sfMajorities ((15U << 16U) + 16U)
|
||||
#define sfDisabledValidators ((15U << 16U) + 17U)
|
||||
#define sfHookExecutions ((15U << 16U) + 18U)
|
||||
#define sfHookParameters ((15U << 16U) + 19U)
|
||||
#define sfHookGrants ((15U << 16U) + 20U)
|
||||
#define sfActiveValidators ((15U << 16U) + 95U)
|
||||
42
hook/tts.h
Normal file
42
hook/tts.h
Normal file
@@ -0,0 +1,42 @@
|
||||
// For documentation please see: https://xrpl-hooks.readme.io/reference/
|
||||
#define ttPAYMENT 0
|
||||
#define ttESCROW_CREATE 1
|
||||
#define ttESCROW_FINISH 2
|
||||
#define ttACCOUNT_SET 3
|
||||
#define ttESCROW_CANCEL 4
|
||||
#define ttREGULAR_KEY_SET 5
|
||||
// #define ttNICKNAME_SET 6 // deprecated
|
||||
#define ttOFFER_CREATE 7
|
||||
#define ttOFFER_CANCEL 8
|
||||
#define ttTICKET_CREATE 10
|
||||
// #define ttSPINAL_TAP 11 // deprecated
|
||||
#define ttSIGNER_LIST_SET 12
|
||||
#define ttPAYCHAN_CREATE 13
|
||||
#define ttPAYCHAN_FUND 14
|
||||
#define ttPAYCHAN_CLAIM 15
|
||||
#define ttCHECK_CREATE 16
|
||||
#define ttCHECK_CASH 17
|
||||
#define ttCHECK_CANCEL 18
|
||||
#define ttDEPOSIT_PREAUTH 19
|
||||
#define ttTRUST_SET 20
|
||||
#define ttACCOUNT_DELETE 21
|
||||
#define ttHOOK_SET 22
|
||||
#define ttNFTOKEN_MINT 25
|
||||
#define ttNFTOKEN_BURN 26
|
||||
#define ttNFTOKEN_CREATE_OFFER 27
|
||||
#define ttNFTOKEN_CANCEL_OFFER 28
|
||||
#define ttNFTOKEN_ACCEPT_OFFER 29
|
||||
#define ttURITOKEN_MINT 45
|
||||
#define ttURITOKEN_BURN 46
|
||||
#define ttURITOKEN_BUY 47
|
||||
#define ttURITOKEN_CREATE_SELL_OFFER 48
|
||||
#define ttURITOKEN_CANCEL_SELL_OFFER 49
|
||||
#define ttGENESIS_MINT 96
|
||||
#define ttIMPORT 97
|
||||
#define ttCLAIM_REWARD 98
|
||||
#define ttINVOKE 99
|
||||
#define ttAMENDMENT 100
|
||||
#define ttFEE 101
|
||||
#define ttUNL_MODIFY 102
|
||||
#define ttEMIT_FAILURE 103
|
||||
#define ttUNL_REPORT 104
|
||||
@@ -74,6 +74,8 @@ module.exports = {
|
||||
if (tx_blob)
|
||||
req['tx_blob'] = tx_blob;
|
||||
|
||||
console.log(req);
|
||||
|
||||
api.request(req).then(resp =>
|
||||
{
|
||||
resolve(resp.result.drops);
|
||||
@@ -233,7 +235,9 @@ module.exports = {
|
||||
let base_drops = fees.base_fee
|
||||
|
||||
delete txn_to_send['SigningPubKey']
|
||||
txn_to_send['Fee'] = base_drops + '';
|
||||
if (txn_to_send['Fee'] === undefined)
|
||||
txn_to_send['Fee'] = base_drops + '';
|
||||
|
||||
|
||||
api.request(
|
||||
{
|
||||
@@ -273,6 +277,17 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
|
||||
const submit = (seed, txn) =>
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
api.submit(txn,
|
||||
{wallet: xrpljs.Wallet.fromSeed(seed)}).then(s=>
|
||||
{
|
||||
resolve(s);
|
||||
}).catch(e=>{reject(e);});
|
||||
});
|
||||
}
|
||||
|
||||
const feeSubmit = (seed, txn) =>
|
||||
{
|
||||
@@ -577,6 +592,7 @@ module.exports = {
|
||||
resolve({
|
||||
hex_memos: hex_memos,
|
||||
rbc: rbc,
|
||||
rac: rac,
|
||||
api: api,
|
||||
xrpljs: xrpljs,
|
||||
assertTxnSuccess: assertTxnSuccess,
|
||||
@@ -609,6 +625,7 @@ module.exports = {
|
||||
trustSet: trustSet,
|
||||
issueTokens: issueTokens,
|
||||
log: log,
|
||||
submit: submit,
|
||||
setTshCollect: setTshCollect,
|
||||
feeSubmitAcceptMultiple: feeSubmitAcceptMultiple,
|
||||
nftid: nftid
|
||||
|
||||
13
hook/v3l1s
Normal file
13
hook/v3l1s
Normal file
@@ -0,0 +1,13 @@
|
||||
nHDs6fHVnhb4ZbSFWF2dTTPHoZ6Rr39i2UfLotzgf8FKUi7iZdxx #tn4
|
||||
nHUvgFxT8EGrXqQZ1rqMw67UtduefbaCHiVtVahk9RXDJP1g1mB4 #tn5
|
||||
nHU7Vn6co7xEFMBesV7qw7FXE8ucKrhVWQiYZB5oGyMhvqrnZrnJ #tn6 table with 2 members
|
||||
nHBoJCE3wPgkTcrNPMHyTJFQ2t77EyCAqcBRspFCpL6JhwCm94VZ #tn7 table with 3 members
|
||||
nHUVv4g47bFMySAZFUKVaXUYEmfiUExSoY4FzwXULNwJRzju4XnQ #tn8 table with 5 members
|
||||
nHBvr8avSFTz4TFxZvvi4rEJZZtyqE3J6KAAcVWVtifsE7edPM7q #tn9 tbale with 20 members
|
||||
nHUH3Z8TRU57zetHbEPr1ynyrJhxQCwrJvNjr4j1SMjYADyW1WWe #tn10
|
||||
nHBdSXv3DhYJVXUppMLpCwJWDFVQyFdZrbMxeh8CFiBEvfTCy3Uh #tn11
|
||||
|
||||
+sn4KDPD8Voo8izLJmZ3YouPWupc6t - rh93ixpFBnSmgnytLe2qkC5YNCqykvcKH5 # tn4
|
||||
+snggivhEEkSuTWuznHCiezKkd16aF - rHWQWs7Ci1N6USkJRcCQgmDQB4RjrKg9MT # tn5
|
||||
+sn6QG65zVPwBdAiWiMV9gYUpTSs12 - rswfmipoy321YysJo145LaD3q3b7aqiC3t # tn10
|
||||
+shvun4yCBEkvDmTjKek6jERHjrHDM - rwLnvKrNK1YvdnbrLoeFLUfZwSTWg3iuLx # tn11
|
||||
150
hook/v3l2s
Normal file
150
hook/v3l2s
Normal file
@@ -0,0 +1,150 @@
|
||||
V6 Seat 0:
|
||||
{
|
||||
r: 'rN4HyiKpUuQM68pohiMPinQnyPdY8tBcWa',
|
||||
s: 'shF4XCzYHfe3pSvKY6Yc526wFZmMA'
|
||||
}
|
||||
V6 Seat 1:
|
||||
{
|
||||
r: 'rnsVxwrctvfiPX6wtX5tjYLPMidXFTqWc8',
|
||||
s: 'sssxXie97ndAUgkrEsWasPYm7SgZx'
|
||||
}
|
||||
V7 Seat 0:
|
||||
{
|
||||
r: 'rLjrBkBUSRtZJnFfZAbX4SFQSpkk2HcpX8',
|
||||
s: 'shhohoyMjYKrJWDE4vUpS2SRNwB6G'
|
||||
}
|
||||
V7 Seat 1:
|
||||
{
|
||||
r: 'rKUt5c9zqGCsZTVhUqrTUNnAbHHo19vtoM',
|
||||
s: 'ssbEWV1w8gVdL8nFZncCmXVjnM8BW'
|
||||
}
|
||||
V7 Seat 2:
|
||||
{
|
||||
r: 'rJY9NAbesWDGupunxyTvvtL3yWUDrbuCRF',
|
||||
s: 'sp8vt3bSN28JWKhYB9ifcXcy76jT8'
|
||||
}
|
||||
V8 Seat 0:
|
||||
{
|
||||
r: 'r38XdJQ2TKdLRAENjLoft8eDvFsUee5wbr',
|
||||
s: 'saE4QyTBzDSNsmADzGE7hfywxxVzR'
|
||||
}
|
||||
V8 Seat 1:
|
||||
{
|
||||
r: 'rnVtyAEp4TGyje7ccS1SjWHVwxqqQBeft3',
|
||||
s: 'shngKoSPmo2vTq5ZEQ48MSsEkpRX7'
|
||||
}
|
||||
V8 Seat 2:
|
||||
{
|
||||
r: 'rpzQniG7qsVi6qaS5X2QuscfpWY31j5bks',
|
||||
s: 'spqgANJeTx9B8KdkWde46tNMtpD7Q'
|
||||
}
|
||||
V8 Seat 3:
|
||||
{
|
||||
r: 'rsb7Y9qE7uvftjHZPW1qBVbLdCxjGe5G8X',
|
||||
s: 'shaTpXZPvxiZu4LFTYHm6iqJNAQ4b'
|
||||
}
|
||||
V8 Seat 4:
|
||||
{
|
||||
r: 'rJeoxs1fZW78sMeamwJ27CVcXZNpQZR3t',
|
||||
s: 'sh2St95HdoahwkTKvQZPia3yquzER'
|
||||
}
|
||||
V9 Seat 0:
|
||||
{
|
||||
r: 'rh8svn1EFs3TKEYVBZfWpNdqNr2R1uyM7y',
|
||||
s: 'snPYNXdWmiXCKYai56JVqmHxCpQoU'
|
||||
}
|
||||
V9 Seat 1:
|
||||
{
|
||||
r: 'rMn7PRAiT22hytTpLBHHZ34jPe2RCi2svT',
|
||||
s: 'ssGAQLWSp3f48NgA1MuesSZePu4xH'
|
||||
}
|
||||
V9 Seat 2:
|
||||
{
|
||||
r: 'rLSCctV2Q5rsduFuZk7N65mbSrf3BFknPc',
|
||||
s: 'sn4kAb9ZvbExZSGgkrnefSxM9NdWo'
|
||||
}
|
||||
V9 Seat 3:
|
||||
{
|
||||
r: 'rn8b9tjZbKmPSoMKV8QwgcU8wq2DVCdfQN',
|
||||
s: 'snoo6dLLZkrriMrRqojLtcdjzSMH7'
|
||||
}
|
||||
V9 Seat 4:
|
||||
{
|
||||
r: 'rEAeU9EDmdcJ3xPLW714bm9fygDV8XoNrj',
|
||||
s: 'shw3jMCqPKSTQStGXG1vneYPDdG2e'
|
||||
}
|
||||
V9 Seat 5:
|
||||
{
|
||||
r: 'rpCLrZYhfaN7ysBNpfAZuNj49Fyg4SHFGv',
|
||||
s: 'snLsZJ32spovJXHq46DUZbiYU7DVn'
|
||||
}
|
||||
V9 Seat 6:
|
||||
{
|
||||
r: 'rafa8E9RPa5vxZ4rN8s571aWUdbE4oqv7i',
|
||||
s: 'sp8AzxGA9wreHT6GtjEKRxKqqXHbe'
|
||||
}
|
||||
V9 Seat 7:
|
||||
{
|
||||
r: 'r37Qu8nTfdJFkE14ERAB3LH3wSdz1LbyzU',
|
||||
s: 'shb2eB57gjwJQghkywSJB7dFzs2Gf'
|
||||
}
|
||||
V9 Seat 8:
|
||||
{
|
||||
r: 'rnqXJXh1mGf9BGt3aB74RscNsJiDMV1YPK',
|
||||
s: 'spxN1dbqj2eCR9GavBkZdk5vbHwgV'
|
||||
}
|
||||
V9 Seat 9:
|
||||
{
|
||||
r: 'rLhHTgwBbq7aVsrSPp2CDeyX3RRuXihGVv',
|
||||
s: 'shFpc2PJJKoacdPjgp4wio7rpZnyq'
|
||||
}
|
||||
V9 Seat 10:
|
||||
{
|
||||
r: 'rJt6kBV8EjhN9v7U4KnYtydfFu3DaQVCvF',
|
||||
s: 'shBVfbpYYrUKjBzwgzCDz1ZkeGEeU'
|
||||
}
|
||||
V9 Seat 11:
|
||||
{
|
||||
r: 'r4YGLYBzvWTZGLKwbByfVxc8ZjCgBUUwBn',
|
||||
s: 'sseqqUjoNptmRiNNpduE67vAiKKur'
|
||||
}
|
||||
V9 Seat 12:
|
||||
{
|
||||
r: 'rEw7zrMdCXFs3CzxtC3NFpjmM2HBLTigVL',
|
||||
s: 'shXdBhi8GyyPtmrRXwoVSRNDxpabc'
|
||||
}
|
||||
V9 Seat 13:
|
||||
{
|
||||
r: 'rwrqQBN88MeT3QDipCfJSeJ9sZMZA54xkD',
|
||||
s: 'sahvves9GbwcMPto383CBio5mq1uy'
|
||||
}
|
||||
V9 Seat 14:
|
||||
{
|
||||
r: 'rpmAcuJAWVgS1zL3R1ob8F5ZSJ9d4jEAoj',
|
||||
s: 'ssnPapLdvquGWyMqNj7nSgsRosjKa'
|
||||
}
|
||||
V9 Seat 15:
|
||||
{
|
||||
r: 'rwGMc2FXtvPitSppNwJaSxqSfEfrLVRtMm',
|
||||
s: 'shzZZot7Q4kEuWqW4j6SmCe9ptuc1'
|
||||
}
|
||||
V9 Seat 16:
|
||||
{
|
||||
r: 'rUrAvfQTv16EETc3Q2sgCTAoKS9C49crx2',
|
||||
s: 'snxdfhfLTkHM5ZYUTrTCPicxRt5Xh'
|
||||
}
|
||||
V9 Seat 17:
|
||||
{
|
||||
r: 'rBDsW6p9Xak9b2ye2eAgh9JjpubTzeV1ti',
|
||||
s: 'snb9xGH9M4WrtK4M15u4ZppzP84Rb'
|
||||
}
|
||||
V9 Seat 18:
|
||||
{
|
||||
r: 'rhGbC5n1qK3Cq3sBbdtKGV5AR3kboXi41K',
|
||||
s: 'shM2R6t3bM1cWrLKb7cMALgkL6mHS'
|
||||
}
|
||||
V9 Seat 19:
|
||||
{
|
||||
r: 'rNu4sdVz6d2H37okUeH47ASMwckhzSx3k5',
|
||||
s: 'ssBG6mp4rSAfK7FuwxCa4biY8Lqsu'
|
||||
}
|
||||
7602
patches/0001-Revert-Use-the-Conan-package-manager-4367.patch
Normal file
7602
patches/0001-Revert-Use-the-Conan-package-manager-4367.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "START BUILDING (HOST)"
|
||||
|
||||
echo "Cleaning previously built binary"
|
||||
rm -f release-build/xahaud
|
||||
|
||||
BUILD_CORES=$(echo "scale=0 ; `nproc` / 3" | bc)
|
||||
|
||||
if [[ "$GITHUB_REPOSITORY" == "" ]]; then
|
||||
#Default
|
||||
BUILD_CORES=8
|
||||
fi
|
||||
|
||||
echo "-- BUILD CORES: $BUILD_CORES"
|
||||
echo "-- GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
|
||||
echo "-- GITHUB_SHA: $GITHUB_SHA"
|
||||
echo "-- GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER"
|
||||
|
||||
which docker 2> /dev/null 2> /dev/null
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
@@ -9,153 +27,34 @@ fi
|
||||
stat .git 2> /dev/null 2> /dev/null
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
echo 'Run this inside the rippled directory. (.git dir not found).'
|
||||
echo 'Run this inside the source directory. (.git dir not found).'
|
||||
exit 1
|
||||
fi
|
||||
docker run -t -i --rm -v `pwd`:/io --network host ghcr.io/foobarwidget/holy-build-box-x64 /hbb_exe/activate-exec bash -x -c '
|
||||
cd /io;
|
||||
mkdir src/certs;
|
||||
curl -k https://raw.githubusercontent.com/RichardAH/rippled-release-builder/main/ca-bundle/certbundle.h -o src/certs/certbundle.h;
|
||||
if [ "`grep certbundle.h src/ripple/net/impl/RegisterSSLCerts.cpp | wc -l`" -eq "0" ]
|
||||
then
|
||||
cp src/ripple/net/impl/RegisterSSLCerts.cpp src/ripple/net/impl/RegisterSSLCerts.cpp.old
|
||||
perl -i -pe "s/^{/{
|
||||
#ifdef EMBEDDED_CA_BUNDLE
|
||||
BIO *cbio = BIO_new_mem_buf(ca_bundle.data(), ca_bundle.size());
|
||||
X509_STORE *cts = SSL_CTX_get_cert_store(ctx.native_handle());
|
||||
if(!cts || !cbio)
|
||||
JLOG(j.warn())
|
||||
<< \"Failed to create cts\/cbio when loading embedded certs.\";
|
||||
else
|
||||
{
|
||||
X509_INFO *itmp;
|
||||
int i, count = 0, type = X509_FILETYPE_PEM;
|
||||
STACK_OF(X509_INFO) *inf = PEM_X509_INFO_read_bio(cbio, NULL, NULL, NULL);
|
||||
|
||||
if (!inf)
|
||||
{
|
||||
BIO_free(cbio);
|
||||
JLOG(j.warn())
|
||||
<< \"Failed to read cbio when loading embedded certs.\";
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < sk_X509_INFO_num(inf); i++)
|
||||
{
|
||||
itmp = sk_X509_INFO_value(inf, i);
|
||||
if (itmp->x509)
|
||||
{
|
||||
X509_STORE_add_cert(cts, itmp->x509);
|
||||
count++;
|
||||
}
|
||||
if (itmp->crl)
|
||||
{
|
||||
X509_STORE_add_crl(cts, itmp->crl);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
sk_X509_INFO_pop_free(inf, X509_INFO_free);
|
||||
BIO_free(cbio);
|
||||
}
|
||||
}
|
||||
#endif/g" src/ripple/net/impl/RegisterSSLCerts.cpp &&
|
||||
sed -i "s/#include <ripple\/net\/RegisterSSLCerts.h>/\0\n#include <certs\/certbundle.h>/g" src/ripple/net/impl/RegisterSSLCerts.cpp
|
||||
STATIC_CONTAINER=$(docker ps -a | grep xahaud_cached_builder |wc -l)
|
||||
|
||||
if [[ "$STATIC_CONTAINER" -gt "0" && "$GITHUB_REPOSITORY" != "" ]]; then
|
||||
echo "Static container, execute in static container to have max. cache"
|
||||
docker start xahaud_cached_builder
|
||||
docker exec -i xahaud_cached_builder /hbb_exe/activate-exec bash -x /io/build-core.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
|
||||
docker stop xahaud_cached_builder
|
||||
else
|
||||
echo "No static container, build on temp container"
|
||||
rm -rf release-build;
|
||||
mkdir -p release-build;
|
||||
|
||||
if [[ "$GITHUB_REPOSITORY" == "" ]]; then
|
||||
# Non GH, local building
|
||||
echo "Non-GH runner, local building, temp container"
|
||||
docker run -i --user 0:$(id -g) --rm -v /data/builds:/data/builds -v `pwd`:/io --network host ghcr.io/foobarwidget/holy-build-box-x64 /hbb_exe/activate-exec bash -x /io/build-full.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
|
||||
else
|
||||
# GH Action, runner
|
||||
echo "GH Action, runner, clean & re-create create persistent container"
|
||||
docker rm -f xahaud_cached_builder
|
||||
docker run -di --user 0:$(id -g) --name xahaud_cached_builder -v /data/builds:/data/builds -v `pwd`:/io --network host ghcr.io/foobarwidget/holy-build-box-x64 /hbb_exe/activate-exec bash
|
||||
docker exec -i xahaud_cached_builder /hbb_exe/activate-exec bash -x /io/build-full.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
|
||||
docker stop xahaud_cached_builder
|
||||
fi
|
||||
fi
|
||||
rm -rf release-build;
|
||||
mkdir release-build;
|
||||
mkdir .nih_c;
|
||||
mkdir .nih_toolchain;
|
||||
cd .nih_toolchain &&
|
||||
yum install -y wget lz4 lz4-devel git llvm13-static.x86_64 llvm13-devel.x86_64 devtoolset-10-binutils zlib-static ncurses-static -y \
|
||||
gcc-c++ \
|
||||
snappy snappy-devel \
|
||||
zlib zlib-devel \
|
||||
lz4-devel \
|
||||
libasan &&
|
||||
echo "-- Install ZStd 1.1.3 --" &&
|
||||
yum install epel-release -y &&
|
||||
ZSTD_VERSION="1.1.3" &&
|
||||
( wget -nc -O zstd-${ZSTD_VERSION}.tar.gz https://github.com/facebook/zstd/archive/v${ZSTD_VERSION}.tar.gz; echo "" ) &&
|
||||
tar xzvf zstd-${ZSTD_VERSION}.tar.gz &&
|
||||
cd zstd-${ZSTD_VERSION} &&
|
||||
make -j8 && make install &&
|
||||
cd .. &&
|
||||
echo "-- Install Cmake 3.23.1 --" &&
|
||||
pwd &&
|
||||
( wget -nc https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz; echo "" ) &&
|
||||
tar -xzf cmake-3.23.1-linux-x86_64.tar.gz -C /hbb/ &&
|
||||
echo "-- Install Boost 1.75.0 --" &&
|
||||
pwd &&
|
||||
( wget -nc https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz; echo "" ) &&
|
||||
tar -xzf boost_1_75_0.tar.gz &&
|
||||
cd boost_1_75_0 && ./bootstrap.sh && ./b2 link=static -j8 && ./b2 install &&
|
||||
cd ../ &&
|
||||
echo "-- Install Protobuf 3.20.0 --" &&
|
||||
pwd &&
|
||||
( wget -nc https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/protobuf-all-3.20.0.tar.gz; echo "" ) &&
|
||||
tar -xzf protobuf-all-3.20.0.tar.gz &&
|
||||
cd protobuf-3.20.0/ &&
|
||||
./autogen.sh && ./configure --prefix=/usr --disable-shared link=static && make -j8 && make install &&
|
||||
cd .. &&
|
||||
echo "-- Build LLD --" &&
|
||||
pwd &&
|
||||
ln /usr/bin/llvm-config-13 /usr/bin/llvm-config &&
|
||||
mv /opt/rh/devtoolset-9/root/usr/bin/ar /opt/rh/devtoolset-9/root/usr/bin/ar-9 &&
|
||||
ln /opt/rh/devtoolset-10/root/usr/bin/ar /opt/rh/devtoolset-9/root/usr/bin/ar &&
|
||||
( wget -nc https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/lld-13.0.1.src.tar.xz; echo "" ) &&
|
||||
( wget -nc https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/libunwind-13.0.1.src.tar.xz; echo "" ) &&
|
||||
tar -xf lld-13.0.1.src.tar.xz &&
|
||||
tar -xf libunwind-13.0.1.src.tar.xz &&
|
||||
cp -r libunwind-13.0.1.src/include libunwind-13.0.1.src/src lld-13.0.1.src/ &&
|
||||
cd lld-13.0.1.src &&
|
||||
rm -rf build CMakeCache.txt &&
|
||||
mkdir build &&
|
||||
cd build &&
|
||||
cmake .. -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ -DCMAKE_INSTALL_PREFIX=/usr/lib64/llvm13/ -DCMAKE_BUILD_TYPE=Release &&
|
||||
make -j8 &&
|
||||
make install &&
|
||||
ln -s /usr/lib64/llvm13/lib/include/lld /usr/include/lld &&
|
||||
cp /usr/lib64/llvm13/lib/liblld*.a /usr/local/lib/ &&
|
||||
cd ../../../ &&
|
||||
echo "-- Build WasmEdge --" &&
|
||||
( git clone https://github.com/WasmEdge/WasmEdge.git; echo "" ) &&
|
||||
cd WasmEdge &&
|
||||
( mkdir build; echo "" ) &&
|
||||
cd build &&
|
||||
export BOOST_ROOT="/usr/local/src/boost_1_75_0" &&
|
||||
export Boost_LIBRARY_DIRS="/usr/local/lib" &&
|
||||
export BOOST_INCLUDEDIR="/usr/local/src/boost_1_75_0" &&
|
||||
cmake .. \
|
||||
-DWASMEDGE_BUILD_SHARED_LIB=OFF \
|
||||
-DWASMEDGE_BUILD_STATIC_LIB=ON \
|
||||
-DWASMEDGE_BUILD_AOT_RUNTIME=ON \
|
||||
-DWASMEDGE_FORCE_DISABLE_LTO=ON \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
||||
-DWASMEDGE_LINK_LLVM_STATIC=ON \
|
||||
-DWASMEDGE_BUILD_PLUGINS=OFF \
|
||||
-DWASMEDGE_LINK_TOOLS_STATIC=ON \
|
||||
-DBoost_NO_BOOST_CMAKE=ON -DLLVM_DIR=/usr/lib64/llvm13/lib/cmake/llvm/ -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ &&
|
||||
make -j8 &&
|
||||
make install &&
|
||||
cd ../../ &&
|
||||
echo "-- Build Rippled --" &&
|
||||
pwd &&
|
||||
cp Builds/CMake/deps/Rocksdb.cmake Builds/CMake/deps/Rocksdb.cmake.old &&
|
||||
perl -i -pe "s/^(\\s*)-DBUILD_SHARED_LIBS=OFF/\\1-DBUILD_SHARED_LIBS=OFF\\n\\1-DROCKSDB_BUILD_SHARED=OFF/g" Builds/CMake/deps/Rocksdb.cmake &&
|
||||
cd release-build &&
|
||||
cmake .. -DBoost_NO_BOOST_CMAKE=ON -DLLVM_DIR=/usr/lib64/llvm13/lib/cmake/llvm/ -DLLVM_LIBRARY_DIR=/usr/lib64/llvm13/lib/ &&
|
||||
make -j8 VERBOSE=1 &&
|
||||
strip -s rippled &&
|
||||
mv rippled xahaud &&
|
||||
echo "Build host: `hostname`" > release.info &&
|
||||
echo "Build date: `date`" >> release.info &&
|
||||
echo "Build md5: `md5sum xahaud`" >> release.info &&
|
||||
echo "Git remotes:" >> release.info &&
|
||||
git remote -v >> release.info
|
||||
echo "Git status:" >> release.info &&
|
||||
git status -v >> release.info &&
|
||||
echo "Git log [last 20]:" >> release.info &&
|
||||
git log -n 20 >> release.info;
|
||||
cd ..;
|
||||
mv src/ripple/net/impl/RegisterSSLCerts.cpp.old src/ripple/net/impl/RegisterSSLCerts.cpp;
|
||||
mv Builds/CMake/deps/Rocksdb.cmake.old Builds/CMake/deps/Rocksdb.cmake'
|
||||
|
||||
echo "DONE BUILDING (HOST)"
|
||||
|
||||
1448
src/magic/magic_enum.h
Normal file
1448
src/magic/magic_enum.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -92,7 +92,7 @@ RCLConsensus::Adaptor::Adaptor(
|
||||
rand_int(
|
||||
crypto_prng(),
|
||||
std::numeric_limits<std::uint64_t>::max() - 1))
|
||||
, nUnlVote_(validatorKeys_.nodeID, j_)
|
||||
, nUnlVote_(validatorKeys_.nodeID, j_, app)
|
||||
{
|
||||
assert(valCookie_ != 0);
|
||||
|
||||
@@ -178,11 +178,6 @@ RCLConsensus::Adaptor::share(RCLCxPeerPos const& peerPos)
|
||||
void
|
||||
RCLConsensus::Adaptor::share(RCLCxTx const& tx)
|
||||
{
|
||||
//RH TODO: never broadcast emitted transactions
|
||||
//fix below:
|
||||
//if (tx.isFieldPresent(sfEmitDetails))
|
||||
// return;
|
||||
|
||||
// If we didn't relay this transaction recently, relay it to all peers
|
||||
if (app_.getHashRouter().shouldRelay(tx.id()))
|
||||
{
|
||||
@@ -343,7 +338,7 @@ RCLConsensus::Adaptor::onClose(
|
||||
// pseudo-transactions
|
||||
auto validations = app_.validators().negativeUNLFilter(
|
||||
app_.getValidations().getTrustedForLedger(
|
||||
prevLedger->info().parentHash));
|
||||
prevLedger->info().parentHash, prevLedger->seq() - 1));
|
||||
if (validations.size() >= app_.validators().quorum())
|
||||
{
|
||||
feeVote_->doVoting(prevLedger, validations, initialSet);
|
||||
@@ -498,17 +493,23 @@ RCLConsensus::Adaptor::doAccept(
|
||||
|
||||
for (auto const& item : *result.txns.map_)
|
||||
{
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
retriableTxs.insert(
|
||||
std::make_shared<STTx const>(SerialIter{item.slice()}));
|
||||
JLOG(j_.debug()) << " Tx: " << item.key();
|
||||
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
failed.insert(item.key());
|
||||
JLOG(j_.warn()) << " Tx: " << item.key() << " throws!";
|
||||
JLOG(j_.warn())
|
||||
<< " Tx: " << item.key() << " throws: " << ex.what();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
auto built = buildLCL(
|
||||
@@ -621,10 +622,11 @@ RCLConsensus::Adaptor::doAccept(
|
||||
|
||||
anyDisputes = true;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.debug())
|
||||
<< "Failed to apply transaction we voted NO on";
|
||||
JLOG(j_.debug()) << "Failed to apply transaction we voted "
|
||||
"NO on. Exception: "
|
||||
<< ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -845,7 +847,8 @@ RCLConsensus::Adaptor::validate(
|
||||
if (ledger.ledger_->isVotingLedger())
|
||||
{
|
||||
// Fees:
|
||||
feeVote_->doValidation(ledger.ledger_->fees(), v);
|
||||
feeVote_->doValidation(
|
||||
ledger.ledger_->fees(), ledger.ledger_->rules(), v);
|
||||
|
||||
// Amendments
|
||||
// FIXME: pass `v` and have the function insert the array
|
||||
|
||||
@@ -25,6 +25,36 @@ namespace ripple
|
||||
|
||||
namespace hook
|
||||
{
|
||||
// RH TODO: put these somewhere better, and allow rules to be fed in
|
||||
inline
|
||||
uint32_t maxHookParameterKeySize(void)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
inline
|
||||
uint32_t maxHookParameterValueSize(void)
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
|
||||
inline
|
||||
uint32_t maxHookStateDataSize(void) {
|
||||
return 256U;
|
||||
}
|
||||
|
||||
inline
|
||||
uint32_t maxHookWasmSize(void)
|
||||
{
|
||||
return 0xFFFFU;
|
||||
}
|
||||
|
||||
inline
|
||||
uint32_t maxHookChainLength(void)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
enum TSHFlags : uint8_t
|
||||
{
|
||||
tshNONE = 0b000,
|
||||
@@ -129,6 +159,10 @@ namespace hook
|
||||
WASM_VALIDATION = 81, // a generic error while parsing wasm, usually leb128 overflow
|
||||
HOOK_CBAK_DIFF_TYPES = 82, // hook and cbak function definitions were different
|
||||
PARAMETERS_NAME_REPEATED = 83,
|
||||
NESTING_LIMIT = 84, // the hook nested blocks/loops/ifs beyond 16 levels
|
||||
SECTIONS_OUT_OF_SEQUENCE = 85, // the wasm contained sections out of sequence
|
||||
CUSTOM_SECTION_DISALLOWED = 86, // the wasm contained a custom section (id=0)
|
||||
INTERNAL_ERROR = 87, // an internal error described by the log text
|
||||
// RH NOTE: only HookSet msgs got log codes, possibly all Hook log lines should get a code?
|
||||
};
|
||||
};
|
||||
@@ -165,7 +199,9 @@ namespace hook_api
|
||||
EMITTED_TXN = 22,
|
||||
NFT_OFFER = 23,
|
||||
HOOK_DEFINITION = 24,
|
||||
LAST_KLTYPE = HOOK_DEFINITION
|
||||
HOOK_STATE_DIR = 25,
|
||||
LAST_KLTYPE_V0 = HOOK_DEFINITION,
|
||||
LAST_KLTYPE_V1 = HOOK_STATE_DIR,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -224,6 +260,7 @@ namespace hook_api
|
||||
INVALID_KEY = -41, // user supplied key was not valid
|
||||
NOT_A_STRING = -42, // nul terminator missing from a string argument
|
||||
MEM_OVERLAP = -43, // one or more specified buffers are the same memory
|
||||
TOO_MANY_STATE_MODIFICATIONS = -44, // more than 5000 modified state entires in the combined hook chains
|
||||
};
|
||||
|
||||
enum ExitType : uint8_t
|
||||
@@ -234,354 +271,96 @@ namespace hook_api
|
||||
ACCEPT = 3,
|
||||
};
|
||||
|
||||
const uint16_t max_state_modifications = 256;
|
||||
const uint8_t max_slots = 255;
|
||||
const uint8_t max_nonce = 255;
|
||||
const uint8_t max_emit = 255;
|
||||
const uint8_t max_params = 16;
|
||||
const double fee_base_multiplier = 1.1f;
|
||||
|
||||
|
||||
// RH TODO: there's definitely a mucher nicer way to do this, but it involves modifying the base_uint
|
||||
// class and we don't want to do that yet.
|
||||
static const std::array<ripple::uint256, 256> UINT256_BIT =
|
||||
// RH NOTE: Find descriptions of api functions in ./impl/applyHook.cpp and hookapi.h (include for hooks)
|
||||
// this is a map of the api name to its return code (vec[0] and its parameters vec[>0]) as wasm type codes
|
||||
static const std::map<std::string, std::vector<uint8_t>> import_whitelist
|
||||
{
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000001"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000002"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000004"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000008"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000010"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000020"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000040"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000080"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000100"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000200"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000400"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000800"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000001000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000002000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000004000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000008000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000010000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000020000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000040000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000080000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000100000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000200000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000400000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000800000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000001000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000002000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000004000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000008000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000010000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000020000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000040000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000080000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000100000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000200000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000400000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000800000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000001000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000002000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000004000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000008000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000010000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000020000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000040000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000080000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000100000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000200000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000400000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000800000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000001000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000002000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000004000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000008000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000010000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000020000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000040000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000080000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000100000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000200000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000400000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000800000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000001000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000002000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000004000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000008000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000010000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000020000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000040000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000080000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000100000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000200000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000400000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000800000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000001000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000002000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000004000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000008000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000010000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000020000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000040000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000080000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000100000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000200000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000400000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000800000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000001000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000002000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000004000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000008000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000010000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000020000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000040000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000080000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000100000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000200000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000400000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000800000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000001000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000002000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000004000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000008000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000010000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000020000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000040000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000080000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000100000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000200000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000400000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000800000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000001000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000002000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000004000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000008000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000010000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000020000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000040000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000080000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000100000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000200000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000400000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000800000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000001000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000002000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000004000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000008000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000010000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000020000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000040000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000080000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000100000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000200000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000400000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000800000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000001000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000002000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000004000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000008000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000010000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000020000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000040000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000080000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000100000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000200000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000400000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000800000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000001000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000002000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000004000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000008000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000010000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000020000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000040000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000080000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000100000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000200000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000400000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000800000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000001000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000002000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000004000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000008000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000010000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000020000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000040000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000080000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000100000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000200000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000400000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000800000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000001000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000002000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000004000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000008000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000010000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000020000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000040000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000080000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000100000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000200000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000400000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000800000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000001000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000002000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000004000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000008000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000010000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000020000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000040000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000080000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000100000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000200000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000400000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000800000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000001000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000002000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000004000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000008000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000010000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000020000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000040000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000080000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000100000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000200000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000400000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000800000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000001000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000002000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000004000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000008000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000010000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000020000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000040000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000080000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000100000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000200000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000400000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000800000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000001000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000002000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000004000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000008000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000010000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000020000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000040000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000080000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000100000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000200000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000400000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000800000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000001000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000002000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000004000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000008000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000010000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000020000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000040000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000080000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000100000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000200000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000400000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000800000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0001000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0002000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0004000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0008000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0010000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0020000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0040000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0080000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0100000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0200000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0400000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0800000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("1000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("2000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("4000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("8000000000000000000000000000000000000000000000000000000000000000")
|
||||
{"_g",{0x7FU,0x7FU,0x7FU}},
|
||||
{"accept",{0x7EU,0x7FU,0x7FU,0x7EU}},
|
||||
{"rollback",{0x7EU,0x7FU,0x7FU,0x7EU}},
|
||||
{"util_raddr",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"util_accid",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"util_verify",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"util_sha512h",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"util_keylet",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"sto_validate",{0x7EU,0x7FU,0x7FU}},
|
||||
{"sto_subfield",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"sto_subarray",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"sto_emplace",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"sto_erase",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"etxn_burden",{0x7EU}},
|
||||
{"etxn_details",{0x7EU,0x7FU,0x7FU}},
|
||||
{"etxn_fee_base",{0x7EU,0x7FU,0x7FU}},
|
||||
{"etxn_reserve",{0x7EU,0x7FU}},
|
||||
{"etxn_generation",{0x7EU}},
|
||||
{"etxn_nonce",{0x7EU,0x7FU,0x7FU}},
|
||||
{"emit",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"float_set",{0x7EU,0x7FU,0x7EU}},
|
||||
{"float_multiply",{0x7EU,0x7EU,0x7EU}},
|
||||
{"float_mulratio",{0x7EU,0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"float_negate",{0x7EU,0x7EU}},
|
||||
{"float_compare",{0x7EU,0x7EU,0x7EU,0x7FU}},
|
||||
{"float_sum",{0x7EU,0x7EU,0x7EU}},
|
||||
{"float_sto",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7EU,0x7FU}},
|
||||
{"float_sto_set",{0x7EU,0x7FU,0x7FU}},
|
||||
{"float_invert",{0x7EU,0x7EU}},
|
||||
{"float_divide",{0x7EU,0x7EU,0x7EU}},
|
||||
{"float_one",{0x7EU}},
|
||||
{"float_mantissa",{0x7EU,0x7EU}},
|
||||
{"float_sign",{0x7EU,0x7EU}},
|
||||
{"float_int",{0x7EU,0x7EU,0x7FU,0x7FU}},
|
||||
{"float_log",{0x7EU,0x7EU}},
|
||||
{"float_root",{0x7EU,0x7EU,0x7FU}},
|
||||
{"fee_base",{0x7EU}},
|
||||
{"ledger_seq",{0x7EU}},
|
||||
{"ledger_last_time",{0x7EU}},
|
||||
{"ledger_last_hash",{0x7EU,0x7FU,0x7FU}},
|
||||
{"ledger_nonce",{0x7EU,0x7FU,0x7FU}},
|
||||
{"ledger_keylet",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"hook_account",{0x7EU,0x7FU,0x7FU}},
|
||||
{"hook_hash",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"hook_param_set",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"hook_param",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"hook_again",{0x7EU}},
|
||||
{"hook_skip",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"hook_pos",{0x7EU}},
|
||||
{"slot",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"slot_clear",{0x7EU,0x7FU}},
|
||||
{"slot_count",{0x7EU,0x7FU}},
|
||||
{"slot_set",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"slot_size",{0x7EU,0x7FU}},
|
||||
{"slot_subarray",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"slot_subfield",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"slot_type",{0x7EU,0x7FU,0x7FU}},
|
||||
{"slot_float",{0x7EU,0x7FU}},
|
||||
{"state_set",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"state_foreign_set",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"state",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"state_foreign",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"trace",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"trace_num",{0x7EU,0x7FU,0x7FU,0x7EU}},
|
||||
{"trace_float",{0x7EU,0x7FU,0x7FU,0x7EU}},
|
||||
{"otxn_burden",{0x7EU}},
|
||||
{"otxn_field",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"otxn_generation",{0x7EU}},
|
||||
{"otxn_id",{0x7EU,0x7FU,0x7FU,0x7FU}},
|
||||
{"otxn_type",{0x7EU}},
|
||||
{"otxn_slot",{0x7EU,0x7FU}},
|
||||
{"otxn_param",{0x7EU,0x7FU,0x7FU,0x7FU,0x7FU}},
|
||||
{"meta_slot",{0x7EU,0x7FU}}
|
||||
};
|
||||
|
||||
// RH NOTE: Find descriptions of api functions in ./impl/applyHook.cpp and hookapi.h (include for hooks)
|
||||
static const std::set<std::string> import_whitelist
|
||||
// featureHooks1
|
||||
static const std::map<std::string, std::vector<uint8_t>> import_whitelist_1
|
||||
{
|
||||
"accept",
|
||||
"emit",
|
||||
"etxn_burden",
|
||||
"etxn_details",
|
||||
"etxn_fee_base",
|
||||
"etxn_generation",
|
||||
"etxn_reserve",
|
||||
"etxn_nonce",
|
||||
"float_compare",
|
||||
"float_divide",
|
||||
"float_invert",
|
||||
"float_mantissa",
|
||||
"float_mulratio",
|
||||
"float_multiply",
|
||||
"float_int",
|
||||
"float_negate",
|
||||
"float_one",
|
||||
"float_set",
|
||||
"float_sign",
|
||||
"float_sto",
|
||||
"float_sto_set",
|
||||
"float_sum",
|
||||
"float_log",
|
||||
"float_root",
|
||||
"fee_base",
|
||||
"_g",
|
||||
"hook_account",
|
||||
"hook_hash",
|
||||
"ledger_seq",
|
||||
"ledger_last_hash",
|
||||
"ledger_last_time",
|
||||
"ledger_nonce",
|
||||
"ledger_keylet",
|
||||
"otxn_burden",
|
||||
"otxn_field",
|
||||
"otxn_slot",
|
||||
"otxn_generation",
|
||||
"otxn_id",
|
||||
"otxn_type",
|
||||
"rollback",
|
||||
"slot",
|
||||
"slot_clear",
|
||||
"slot_count",
|
||||
"slot_set",
|
||||
"slot_size",
|
||||
"slot_subarray",
|
||||
"slot_subfield",
|
||||
"slot_type",
|
||||
"slot_float",
|
||||
"state",
|
||||
"state_foreign",
|
||||
"state_set",
|
||||
"state_foreign_set",
|
||||
"trace",
|
||||
"trace_num",
|
||||
"trace_float",
|
||||
"util_accid",
|
||||
"util_raddr",
|
||||
"util_sha512h",
|
||||
"util_verify",
|
||||
"sto_subarray",
|
||||
"sto_subfield",
|
||||
"sto_validate",
|
||||
"sto_emplace",
|
||||
"sto_erase",
|
||||
"util_keylet",
|
||||
"hook_pos",
|
||||
"hook_param",
|
||||
"hook_param_set",
|
||||
"hook_skip",
|
||||
"hook_again",
|
||||
"meta_slot",
|
||||
"str_find",
|
||||
"str_replace",
|
||||
"str_concat",
|
||||
"str_compare"
|
||||
{"xpop_slot",{0x7EU,0x7FU,0x7FU}}
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include "Enum.h"
|
||||
|
||||
using GuardLog = std::optional<std::reference_wrapper<std::basic_ostream<char>>>;
|
||||
@@ -94,7 +95,7 @@ parseSignedLeb128(
|
||||
// this macro will return temMALFORMED if i ever exceeds the end of the hook
|
||||
#define CHECK_SHORT_HOOK()\
|
||||
{\
|
||||
if (i >= hook.size())\
|
||||
if (i >= wasm.size())\
|
||||
{\
|
||||
\
|
||||
GUARDLOG(hook::log::SHORT_HOOK) \
|
||||
@@ -107,7 +108,7 @@ parseSignedLeb128(
|
||||
|
||||
#define REQUIRE(x)\
|
||||
{\
|
||||
if (i + (x) > hook.size())\
|
||||
if (i + (x) > wasm.size())\
|
||||
{\
|
||||
\
|
||||
GUARDLOG(hook::log::SHORT_HOOK) \
|
||||
@@ -123,10 +124,10 @@ parseSignedLeb128(
|
||||
}
|
||||
|
||||
#define LEB()\
|
||||
parseLeb128(hook, i, &i)
|
||||
parseLeb128(wasm, i, &i)
|
||||
|
||||
#define SIGNED_LEB()\
|
||||
parseSignedLeb128(hook, i, &i)
|
||||
parseSignedLeb128(wasm, i, &i)
|
||||
|
||||
#define GUARD_ERROR(msg)\
|
||||
{\
|
||||
@@ -143,36 +144,97 @@ parseSignedLeb128(
|
||||
|
||||
struct WasmBlkInf
|
||||
{
|
||||
uint32_t sanity_check;
|
||||
uint32_t iteration_bound;
|
||||
uint32_t instruction_count;
|
||||
WasmBlkInf* parent;
|
||||
std::vector<WasmBlkInf> children;
|
||||
std::vector<WasmBlkInf*> children;
|
||||
uint32_t start_byte;
|
||||
bool is_root;
|
||||
|
||||
WasmBlkInf(
|
||||
uint32_t iteration_bound_,
|
||||
uint32_t instruction_count_,
|
||||
WasmBlkInf* parent_,
|
||||
uint32_t start_byte_,
|
||||
bool is_root_ = false)
|
||||
:
|
||||
sanity_check(0x1234ABCDU),
|
||||
iteration_bound(iteration_bound_),
|
||||
instruction_count(instruction_count_),
|
||||
parent(parent_),
|
||||
children({}),
|
||||
start_byte(start_byte_),
|
||||
is_root(is_root_)
|
||||
{
|
||||
// all done by the above
|
||||
}
|
||||
|
||||
WasmBlkInf* add_child(uint32_t iteration_bound, uint32_t start_byte)
|
||||
{
|
||||
WasmBlkInf* child = new WasmBlkInf(iteration_bound, 0, this, start_byte, false);
|
||||
children.push_back(child);
|
||||
return child;
|
||||
}
|
||||
|
||||
~WasmBlkInf()
|
||||
{
|
||||
for (WasmBlkInf* child : children)
|
||||
delete child;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#define PRINT_WCE(x)\
|
||||
{\
|
||||
if (DEBUG_GUARD)\
|
||||
printf("[%u]%.*swce=%ld | g=%u, pg=%u, m=%g\n",\
|
||||
x,\
|
||||
level, " ",\
|
||||
worst_case_execution,\
|
||||
blk->iteration_bound,\
|
||||
(blk->parent ? blk->parent->iteration_bound : -1),\
|
||||
multiplier);\
|
||||
printf("%llx:: [%u]%.*swce=%ld | start=%x instcount=%u guard=%u, "\
|
||||
"parent_guard=%d, multiplier=%g parentptr=%llx\n",\
|
||||
&blk,\
|
||||
x,\
|
||||
level, " ",\
|
||||
worst_case_execution,\
|
||||
blk->start_byte,\
|
||||
blk->instruction_count,\
|
||||
blk->iteration_bound,\
|
||||
(blk->parent != 0 ? blk->parent->iteration_bound : -1),\
|
||||
multiplier, &(blk->parent));\
|
||||
}
|
||||
// compute worst case execution time
|
||||
// compute worst case execution time
|
||||
inline
|
||||
uint64_t compute_wce (const WasmBlkInf* blk, int level = 0)
|
||||
uint64_t compute_wce (const WasmBlkInf* blk, int level, bool* recursion_limit_reached)
|
||||
{
|
||||
if (level > 16)
|
||||
{
|
||||
*recursion_limit_reached = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (blk->sanity_check != 0x1234ABCDU)
|
||||
{
|
||||
printf("!!! sanity check failed\n");
|
||||
*recursion_limit_reached = true;
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
|
||||
WasmBlkInf const* parent = blk->parent;
|
||||
|
||||
if (parent && parent->sanity_check != 0x1234ABCDU)
|
||||
{
|
||||
printf("!!! parent sanity check failed\n");
|
||||
*recursion_limit_reached = true;
|
||||
return (uint64_t)-1;
|
||||
}
|
||||
|
||||
uint64_t worst_case_execution = blk->instruction_count;
|
||||
double multiplier = 1.0;
|
||||
|
||||
if (blk->children.size() > 0)
|
||||
for (auto const& child : blk->children)
|
||||
worst_case_execution += compute_wce(&child, level + 1);
|
||||
worst_case_execution += compute_wce(child, level + 1, recursion_limit_reached);
|
||||
|
||||
if (blk->parent == 0 ||
|
||||
blk->parent->iteration_bound == 0) // this condtion should never occur [defensively programmed]
|
||||
if (parent == 0 ||
|
||||
parent->iteration_bound == 0) // this condtion should never occur [defensively programmed]
|
||||
{
|
||||
PRINT_WCE(1);
|
||||
return worst_case_execution;
|
||||
@@ -180,9 +242,9 @@ uint64_t compute_wce (const WasmBlkInf* blk, int level = 0)
|
||||
|
||||
// if the block has a parent then the quotient of its guard and its parent's guard
|
||||
// gives us the loop iterations and thus the multiplier for the instruction count
|
||||
multiplier =
|
||||
multiplier =
|
||||
((double)(blk->iteration_bound)) /
|
||||
((double)(blk->parent->iteration_bound));
|
||||
((double)(parent->iteration_bound));
|
||||
|
||||
worst_case_execution *= multiplier;
|
||||
if (worst_case_execution < 1.0)
|
||||
@@ -200,7 +262,7 @@ uint64_t compute_wce (const WasmBlkInf* blk, int level = 0)
|
||||
inline
|
||||
std::optional<uint64_t>
|
||||
check_guard(
|
||||
std::vector<uint8_t> const& hook,
|
||||
std::vector<uint8_t> const& wasm,
|
||||
int codesec,
|
||||
int start_offset,
|
||||
int end_offset,
|
||||
@@ -210,17 +272,24 @@ check_guard(
|
||||
std::string guardLogAccStr)
|
||||
{
|
||||
|
||||
#define MAX_GUARD_CALLS 1024
|
||||
uint32_t guard_count = 0;
|
||||
|
||||
if (DEBUG_GUARD)
|
||||
printf("\ncheck_guard called with "
|
||||
"codesec=%d start_offset=%d end_offset=%d guard_func_idx=%d last_import_idx=%d\n",
|
||||
codesec, start_offset, end_offset, guard_func_idx, last_import_idx);
|
||||
|
||||
if (end_offset <= 0) end_offset = hook.size();
|
||||
if (end_offset <= 0) end_offset = wasm.size();
|
||||
int block_depth = 0;
|
||||
|
||||
WasmBlkInf root { .iteration_bound = 1, .instruction_count = 0, .parent = 0, .children = {} };
|
||||
|
||||
WasmBlkInf* current = &root;
|
||||
// the root node is constructed in a unique ptr, which will cause its destructor to be called
|
||||
// when the function exits. The destructor of the root node will recursively free all heap allocated children.
|
||||
//WasmBlkInf(uint32_t iteration_bound_, uint32_t instruction_count_,
|
||||
// WasmBlkInf* parent_, uint32_t start_byte_, bool is_root_ = false) :
|
||||
std::unique_ptr<WasmBlkInf> root = std::make_unique<WasmBlkInf>(1, 0, (WasmBlkInf*)0, start_offset, true);
|
||||
|
||||
WasmBlkInf* current = &(*root);
|
||||
|
||||
if (DEBUG_GUARD)
|
||||
printf("\n\n\nstart of guard analysis for codesec %d\n", codesec);
|
||||
@@ -232,12 +301,12 @@ check_guard(
|
||||
{
|
||||
printf("->");
|
||||
for (int z = i; z < 16 + i && z < end_offset; ++z)
|
||||
printf("%02X", hook[z]);
|
||||
printf("%02X", wasm[z]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
REQUIRE(1);
|
||||
uint8_t instr = hook[i];
|
||||
uint8_t instr = wasm[i];
|
||||
ADVANCE(1);
|
||||
|
||||
current->instruction_count++;
|
||||
@@ -260,10 +329,11 @@ check_guard(
|
||||
REQUIRE(1);
|
||||
|
||||
// discard the block return type
|
||||
uint8_t block_type = hook[i];
|
||||
uint8_t block_type = wasm[i];
|
||||
if ((block_type >= 0x7CU && block_type <= 0x7FU) ||
|
||||
block_type == 0x7BU || block_type == 0x70U ||
|
||||
block_type == 0x7BU || block_type == 0x40U)
|
||||
block_type == 0x7BU || block_type == 0x40U ||
|
||||
block_type == 0x6FU)
|
||||
{
|
||||
ADVANCE(1);
|
||||
}
|
||||
@@ -272,7 +342,7 @@ check_guard(
|
||||
SIGNED_LEB();
|
||||
}
|
||||
|
||||
uint32_t iteration_bound = (current->parent == 0 ? 1 : current->parent->iteration_bound);
|
||||
uint32_t iteration_bound = (current->parent == 0 ? 1 : current->iteration_bound);
|
||||
if (instr == 0x03U)
|
||||
{
|
||||
// now look for the guard call
|
||||
@@ -283,45 +353,37 @@ check_guard(
|
||||
|
||||
// first i32
|
||||
REQUIRE(1);
|
||||
if (hook[i] != 0x41U)
|
||||
if (wasm[i] != 0x41U)
|
||||
GUARD_ERROR("Missing first i32.const after loop instruction");
|
||||
ADVANCE(1);
|
||||
SIGNED_LEB(); // this is the ID, we don't need it here
|
||||
|
||||
|
||||
// second i32
|
||||
REQUIRE(1);
|
||||
if (hook[i] != 0x41U)
|
||||
if (wasm[i] != 0x41U)
|
||||
GUARD_ERROR("Missing second i32.const after loop instruction");
|
||||
ADVANCE(1);
|
||||
iteration_bound = LEB(); // second param is the iteration bound, which is important here
|
||||
|
||||
// guard call
|
||||
REQUIRE(1);
|
||||
if (hook[i] != 0x10U)
|
||||
if (wasm[i] != 0x10U)
|
||||
GUARD_ERROR("Missing call to _g after first and second i32.const at loop start");
|
||||
ADVANCE(1);
|
||||
uint64_t call_func_idx = LEB(); // the function being called *must* be the _g function
|
||||
|
||||
//printf("iteration_bound: %d, call_func_idx: %ld, guard_func_idx: %d\n",
|
||||
// iteration_bound, call_func_idx, guard_func_idx);
|
||||
|
||||
if (iteration_bound == 0)
|
||||
GUARD_ERROR("Guard call cannot specify 0 maxiter.");
|
||||
|
||||
if (call_func_idx != guard_func_idx)
|
||||
GUARD_ERROR("Call after first and second i32.const at loop start was not _g");
|
||||
|
||||
if (guard_count++ > MAX_GUARD_CALLS)
|
||||
GUARD_ERROR("Too many guard calls! Limit is 1024");
|
||||
}
|
||||
|
||||
current->children.push_back(
|
||||
{
|
||||
.iteration_bound = iteration_bound,
|
||||
.instruction_count = 0,
|
||||
.parent = current,
|
||||
.children = {}
|
||||
});
|
||||
|
||||
current = current->add_child(iteration_bound, i);
|
||||
block_depth++;
|
||||
current = &(current->children[current->children.size()-1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -334,8 +396,20 @@ check_guard(
|
||||
current = current->parent;
|
||||
if (current == 0 && block_depth == -1 && (i >= end_offset))
|
||||
break; // codesec end
|
||||
else if (current == 0 || block_depth < 0)
|
||||
GUARD_ERROR("Illegal block end");
|
||||
else if (current == 0)
|
||||
{
|
||||
GUARD_ERROR("Illegal block end (current==0)");
|
||||
}
|
||||
else if (block_depth < 0)
|
||||
{
|
||||
GUARD_ERROR("Illegal block end (block_depth<0)");
|
||||
}
|
||||
|
||||
|
||||
if (current->sanity_check != 0x1234ABCDU)
|
||||
{
|
||||
GUARD_ERROR("Sanity check failed (bad pointer)");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -366,8 +440,8 @@ check_guard(
|
||||
LEB();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (instr == 0x0FU) // return
|
||||
|
||||
if (instr == 0x0FU) // return
|
||||
{
|
||||
if (DEBUG_GUARD_VERBOSE)
|
||||
printf("Guard checker - return instruction at %d [%x]\n", i, i);
|
||||
@@ -388,6 +462,14 @@ check_guard(
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// enforce guard call limit
|
||||
if (callee_idx == guard_func_idx)
|
||||
{
|
||||
if (guard_count++ > MAX_GUARD_CALLS)
|
||||
GUARD_ERROR("Too many guard calls! Limit is 1024");
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -398,10 +480,10 @@ check_guard(
|
||||
<< "codesec: " << codesec << " hook byte offset: " << i << "\n";
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
// reference instructions
|
||||
if (instr >= 0xD0U && instr <= 0xD2)
|
||||
if (instr >= 0xD0U && instr <= 0xD2)
|
||||
{
|
||||
if (DEBUG_GUARD_VERBOSE)
|
||||
printf("Guard checker - reference instruction at %d [%x]\n", i, i);
|
||||
@@ -410,7 +492,7 @@ check_guard(
|
||||
{
|
||||
REQUIRE(1);
|
||||
// if it's a ref type it's a single byte
|
||||
if (!(hook[i] == 0x70U || hook[i] == 0x6FU))
|
||||
if (!(wasm[i] == 0x70U || wasm[i] == 0x6FU))
|
||||
GUARD_ERROR("Invalid reftype in 0xD0 instruction");
|
||||
ADVANCE(1);
|
||||
}
|
||||
@@ -420,7 +502,7 @@ check_guard(
|
||||
REQUIRE(1);
|
||||
LEB();
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -431,7 +513,7 @@ check_guard(
|
||||
{
|
||||
if (DEBUG_GUARD_VERBOSE)
|
||||
printf("Guard checker - parametric instruction at %d [%x]\n", i, i);
|
||||
|
||||
|
||||
if (instr == 0x1CU) // select t*
|
||||
{
|
||||
REQUIRE(1);
|
||||
@@ -439,7 +521,7 @@ check_guard(
|
||||
for (uint64_t n = 0; n < vec_count; ++n)
|
||||
{
|
||||
REQUIRE(1);
|
||||
uint8_t v = hook[i];
|
||||
uint8_t v = wasm[i];
|
||||
if ((v >= 0x7BU && v <= 0x7FU) || v == 0x70U || v == 0x6FU)
|
||||
{
|
||||
// fine
|
||||
@@ -477,13 +559,13 @@ check_guard(
|
||||
LEB();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (DEBUG_GUARD_VERBOSE)
|
||||
printf("Guard checker - 0xFC instruction at %d [%x]\n", i, i);
|
||||
|
||||
uint64_t fc_type = LEB();
|
||||
REQUIRE(1);
|
||||
|
||||
|
||||
if (fc_type >= 12 && fc_type <= 17) // table instructions
|
||||
{
|
||||
LEB();
|
||||
@@ -576,8 +658,8 @@ check_guard(
|
||||
REQUIRE(4);
|
||||
ADVANCE(4);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (instr == 0x44U) // f64.const
|
||||
{
|
||||
if (DEBUG_GUARD_VERBOSE)
|
||||
@@ -586,15 +668,15 @@ check_guard(
|
||||
REQUIRE(8);
|
||||
ADVANCE(8);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// even more numeric instructions
|
||||
if (instr >= 0x45U && instr <= 0xC4U)
|
||||
{
|
||||
if (DEBUG_GUARD_VERBOSE)
|
||||
printf("Guard checker - numeric instruction at %d [%x]\n", i, i);
|
||||
|
||||
// these have no arguments
|
||||
|
||||
// these have no arguments
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -634,7 +716,7 @@ check_guard(
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// execution to here is an error, unknown instruction
|
||||
{
|
||||
char ihex[64];
|
||||
@@ -644,7 +726,14 @@ check_guard(
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t wce = compute_wce(&root);
|
||||
bool recursion_limit_reached = false;
|
||||
uint64_t wce = compute_wce(&(*root), 0, &recursion_limit_reached);
|
||||
if (recursion_limit_reached)
|
||||
{
|
||||
GUARDLOG(hook::log::NESTING_LIMIT) << "GuardCheck "
|
||||
<< "Maximum allowable depth of blocks reached (16 levels). Flatten your loops and conditions!.\n";
|
||||
return {};
|
||||
}
|
||||
|
||||
GUARDLOG(hook::log::INSTRUCTION_COUNT) << "GuardCheck "
|
||||
<< "Total worse-case execution count: " << wce << "\n";
|
||||
@@ -668,15 +757,15 @@ std::pair<
|
||||
uint64_t // max instruction count for cbak()
|
||||
>>
|
||||
validateGuards(
|
||||
std::vector<uint8_t> const& hook,
|
||||
bool strict,
|
||||
std::vector<uint8_t> const& wasm,
|
||||
GuardLog guardLog,
|
||||
std::string guardLogAccStr)
|
||||
std::string guardLogAccStr,
|
||||
uint64_t rulesVersion = 0)
|
||||
{
|
||||
uint64_t byteCount = hook.size();
|
||||
uint64_t byteCount = wasm.size();
|
||||
|
||||
// RH TODO compute actual smallest possible hook and update this value
|
||||
if (byteCount < 10)
|
||||
// 63 bytes is the smallest possible valid hook wasm
|
||||
if (byteCount < 63U)
|
||||
{
|
||||
GUARDLOG(hook::log::WASM_TOO_SMALL)
|
||||
<< "Malformed transaction: Hook was not valid webassembly binary. Too small." << "\n";
|
||||
@@ -687,7 +776,7 @@ validateGuards(
|
||||
unsigned char header[8] = { 0x00U, 0x61U, 0x73U, 0x6DU, 0x01U, 0x00U, 0x00U, 0x00U };
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (hook[i] != header[i])
|
||||
if (wasm[i] != header[i])
|
||||
{
|
||||
GUARDLOG(hook::log::WASM_BAD_MAGIC)
|
||||
<< "Malformed transaction: Hook was not valid webassembly binary. "
|
||||
@@ -704,13 +793,14 @@ validateGuards(
|
||||
// this maps function ids to type ids, used for looking up the type of cbak and hook
|
||||
// as established inside the wasm binary.
|
||||
std::map<int, int> func_type_map;
|
||||
|
||||
std::map<int /* type idx */, std::map<int /* import index */, std::string /* api name */>> import_type_map;
|
||||
|
||||
// now we check for guards... first check if _g is imported
|
||||
int guard_import_number = -1;
|
||||
int last_import_number = -1;
|
||||
int import_count = 0;
|
||||
for (int i = 8, j = 0; i < hook.size();)
|
||||
int last_section_type = 0;
|
||||
for (int i = 8, j = 0; i < wasm.size();)
|
||||
{
|
||||
|
||||
if (j == i)
|
||||
@@ -725,8 +815,27 @@ validateGuards(
|
||||
j = i;
|
||||
|
||||
// each web assembly section begins with a single byte section type followed by an leb128 length
|
||||
int section_type = hook[i++];
|
||||
int section_length = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int section_type = wasm[i++];
|
||||
|
||||
if (section_type == 0)
|
||||
{
|
||||
GUARDLOG(hook::log::CUSTOM_SECTION_DISALLOWED)
|
||||
<< "Malformed transaction. "
|
||||
<< "Hook contained a custom section, which is not allowed. Use cleaner.\n";
|
||||
return {};
|
||||
}
|
||||
|
||||
if (section_type <= last_section_type)
|
||||
{
|
||||
GUARDLOG(hook::log::SECTIONS_OUT_OF_SEQUENCE)
|
||||
<< "Malformed transcation. "
|
||||
<< "Hook contained wasm sections that were either repeated or were out of sequence.\n";
|
||||
return {};
|
||||
}
|
||||
|
||||
last_section_type = section_type;
|
||||
|
||||
int section_length = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
//int section_start = i;
|
||||
|
||||
if (DEBUG_GUARD_VERBOSE)
|
||||
@@ -735,10 +844,10 @@ validateGuards(
|
||||
|
||||
int next_section = i + section_length;
|
||||
|
||||
// we are interested in the import section... we need to know if _g is imported and which import# it is
|
||||
if (section_type == 2) // import section
|
||||
{
|
||||
import_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
// we are interested in the import section... we need to know if _g is imported and which import# it is
|
||||
import_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (import_count <= 0)
|
||||
{
|
||||
GUARDLOG(hook::log::IMPORTS_MISSING)
|
||||
@@ -753,8 +862,8 @@ validateGuards(
|
||||
for (int j = 0; j < import_count; ++j)
|
||||
{
|
||||
// first check module name
|
||||
int mod_length = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
if (mod_length < 1 || mod_length > (hook.size() - i))
|
||||
int mod_length = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (mod_length < 1 || mod_length > (wasm.size() - i))
|
||||
{
|
||||
GUARDLOG(hook::log::IMPORT_MODULE_BAD)
|
||||
<< "Malformed transaction. "
|
||||
@@ -762,7 +871,7 @@ validateGuards(
|
||||
return {};
|
||||
}
|
||||
|
||||
if (std::string_view( (const char*)(hook.data() + i), (size_t)mod_length ) != "env")
|
||||
if (std::string_view( (const char*)(wasm.data() + i), (size_t)mod_length ) != "env")
|
||||
{
|
||||
GUARDLOG(hook::log::IMPORT_MODULE_ENV)
|
||||
<< "Malformed transaction. "
|
||||
@@ -773,8 +882,8 @@ validateGuards(
|
||||
i += mod_length; CHECK_SHORT_HOOK();
|
||||
|
||||
// next get import name
|
||||
int name_length = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
if (name_length < 1 || name_length > (hook.size() - i))
|
||||
int name_length = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (name_length < 1 || name_length > (wasm.size() - i))
|
||||
{
|
||||
GUARDLOG(hook::log::IMPORT_NAME_BAD)
|
||||
<< "Malformed transaction. "
|
||||
@@ -782,37 +891,52 @@ validateGuards(
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string import_name { (const char*)(hook.data() + i), (size_t)name_length };
|
||||
std::string import_name { (const char*)(wasm.data() + i), (size_t)name_length };
|
||||
|
||||
i += name_length; CHECK_SHORT_HOOK();
|
||||
|
||||
// next get import type
|
||||
if (hook[i] > 0x00)
|
||||
if (wasm[i] > 0x00)
|
||||
{
|
||||
// not a function import
|
||||
// RH TODO check these other imports for weird stuff
|
||||
i++; CHECK_SHORT_HOOK();
|
||||
parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
continue;
|
||||
GUARDLOG(hook::log::IMPORT_ILLEGAL)
|
||||
<< "Malformed transaction. "
|
||||
<< "Hook attempted to import an import type other than a function.\n";
|
||||
return {};
|
||||
}
|
||||
|
||||
// execution to here means it's a function import
|
||||
i++; CHECK_SHORT_HOOK();
|
||||
/*int type_idx = */
|
||||
parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int type_idx =
|
||||
parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
|
||||
// RH TODO: validate that the parameters of the imported functions are correct
|
||||
if (import_name == "_g")
|
||||
{
|
||||
guard_import_number = func_upto;
|
||||
} else if (hook_api::import_whitelist.find(import_name) == hook_api::import_whitelist.end())
|
||||
{
|
||||
GUARDLOG(hook::log::IMPORT_ILLEGAL)
|
||||
<< "Malformed transaction. "
|
||||
<< "Hook attempted to import a function that does not "
|
||||
<< "appear in the hook_api function set: `" << import_name << "`" << "\n";
|
||||
return {};
|
||||
}
|
||||
else if (hook_api::import_whitelist.find(import_name) == hook_api::import_whitelist.end())
|
||||
{
|
||||
if (rulesVersion > 0 &&
|
||||
hook_api::import_whitelist_1.find(import_name) != hook_api::import_whitelist_1.end())
|
||||
{
|
||||
// PASS, this is a version 1 api
|
||||
}
|
||||
else
|
||||
{
|
||||
GUARDLOG(hook::log::IMPORT_ILLEGAL)
|
||||
<< "Malformed transaction. "
|
||||
<< "Hook attempted to import a function that does not "
|
||||
<< "appear in the hook_api function set: `" << import_name << "`" << "\n";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// add to import map
|
||||
if (import_type_map.find(type_idx) == import_type_map.end())
|
||||
import_type_map[type_idx] = {{ func_upto, std::move(import_name) }};
|
||||
else
|
||||
import_type_map[type_idx].emplace(func_upto, std::move(import_name));
|
||||
|
||||
func_upto++;
|
||||
}
|
||||
|
||||
@@ -834,7 +958,7 @@ validateGuards(
|
||||
} else
|
||||
if (section_type == 7) // export section
|
||||
{
|
||||
int export_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int export_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (export_count <= 0)
|
||||
{
|
||||
GUARDLOG(hook::log::EXPORTS_MISSING)
|
||||
@@ -846,14 +970,14 @@ validateGuards(
|
||||
|
||||
for (int j = 0; j < export_count; ++j)
|
||||
{
|
||||
int name_len = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int name_len = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (name_len == 4)
|
||||
{
|
||||
|
||||
if (hook[i] == 'h' && hook[i+1] == 'o' && hook[i+2] == 'o' && hook[i+3] == 'k')
|
||||
if (wasm[i] == 'h' && wasm[i+1] == 'o' && wasm[i+2] == 'o' && wasm[i+3] == 'k')
|
||||
{
|
||||
i += name_len; CHECK_SHORT_HOOK();
|
||||
if (hook[i] != 0)
|
||||
if (wasm[i] != 0)
|
||||
{
|
||||
GUARDLOG(hook::log::EXPORT_HOOK_FUNC)
|
||||
<< "Malformed transaction. "
|
||||
@@ -862,14 +986,14 @@ validateGuards(
|
||||
}
|
||||
|
||||
i++; CHECK_SHORT_HOOK();
|
||||
hook_func_idx = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
hook_func_idx = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hook[i] == 'c' && hook[i+1] == 'b' && hook[i+2] == 'a' && hook[i+3] == 'k')
|
||||
if (wasm[i] == 'c' && wasm[i+1] == 'b' && wasm[i+2] == 'a' && wasm[i+3] == 'k')
|
||||
{
|
||||
i += name_len; CHECK_SHORT_HOOK();
|
||||
if (hook[i] != 0)
|
||||
if (wasm[i] != 0)
|
||||
{
|
||||
GUARDLOG(hook::log::EXPORT_CBAK_FUNC)
|
||||
<< "Malformed transaction. "
|
||||
@@ -877,13 +1001,13 @@ validateGuards(
|
||||
return {};
|
||||
}
|
||||
i++; CHECK_SHORT_HOOK();
|
||||
cbak_func_idx = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
cbak_func_idx = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
i += name_len + 1;
|
||||
parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
}
|
||||
|
||||
// execution to here means export section was parsed
|
||||
@@ -898,7 +1022,7 @@ validateGuards(
|
||||
}
|
||||
else if (section_type == 3) // function section
|
||||
{
|
||||
int function_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int function_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (function_count <= 0)
|
||||
{
|
||||
GUARDLOG(hook::log::FUNCS_MISSING)
|
||||
@@ -910,7 +1034,7 @@ validateGuards(
|
||||
|
||||
for (int j = 0; j < function_count; ++j)
|
||||
{
|
||||
int type_idx = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int type_idx = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (DEBUG_GUARD)
|
||||
printf("Function map: func %d -> type %d\n", j, type_idx);
|
||||
func_type_map[j] = type_idx;
|
||||
@@ -952,29 +1076,22 @@ validateGuards(
|
||||
int64_t maxInstrCountHook = 0;
|
||||
int64_t maxInstrCountCbak = 0;
|
||||
|
||||
/* printf( "hook_func_idx: %d\ncbak_func_idx: %d\n"
|
||||
"hook_type_idx: %d\ncbak_type_idx: %d\n",
|
||||
*hook_func_idx,
|
||||
*cbak_func_idx,
|
||||
hook_type_idx, *cbak_type_idx);
|
||||
*/
|
||||
|
||||
// second pass... where we check all the guard function calls follow the guard rules
|
||||
// minimal other validation in this pass because first pass caught most of it
|
||||
for (int i = 8; i < hook.size();)
|
||||
for (int i = 8; i < wasm.size();)
|
||||
{
|
||||
|
||||
int section_type = hook[i++];
|
||||
int section_length = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int section_type = wasm[i++];
|
||||
int section_length = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
//int section_start = i;
|
||||
int next_section = i + section_length;
|
||||
|
||||
if (section_type == 1) // type section
|
||||
{
|
||||
int type_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int type_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
for (int j = 0; j < type_count; ++j)
|
||||
{
|
||||
if (hook[i++] != 0x60)
|
||||
if (wasm[i++] != 0x60)
|
||||
{
|
||||
GUARDLOG(hook::log::FUNC_TYPE_INVALID)
|
||||
<< "Invalid function type. "
|
||||
@@ -985,18 +1102,77 @@ validateGuards(
|
||||
}
|
||||
CHECK_SHORT_HOOK();
|
||||
|
||||
int param_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
if (j == hook_type_idx && param_count != 1)
|
||||
// check the consistency of the type
|
||||
std::optional<std::string> first_name;
|
||||
std::optional<std::reference_wrapper<std::vector<uint8_t> const>> first_signature;
|
||||
if (auto const& usage = import_type_map.find(j); usage != import_type_map.end())
|
||||
{
|
||||
GUARDLOG(hook::log::PARAM_HOOK_CBAK)
|
||||
for (auto const& [import_idx, api_name] : usage->second)
|
||||
{
|
||||
|
||||
auto const& api_signature =
|
||||
hook_api::import_whitelist.find(api_name) != hook_api::import_whitelist.end()
|
||||
? hook_api::import_whitelist.find(api_name)->second
|
||||
: hook_api::import_whitelist_1.find(api_name)->second;
|
||||
|
||||
if (!first_signature)
|
||||
{
|
||||
first_name = api_name;
|
||||
first_signature = api_signature;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (api_signature != (*first_signature).get())
|
||||
{
|
||||
GUARDLOG(hook::log::FUNC_TYPE_INVALID)
|
||||
<< "Function type is inconsitent across referenced apis. "
|
||||
<< "This probably means one of your apis has the wrong signature. "
|
||||
<< "(Either: " << *first_name << ", or: " << api_name << ".) "
|
||||
<< "Codesec: " << section_type << " "
|
||||
<< "Local: " << j << " "
|
||||
<< "Offset: " << i << "\n";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (j == hook_type_idx)
|
||||
{
|
||||
// pass
|
||||
}
|
||||
else
|
||||
{
|
||||
// fail
|
||||
GUARDLOG(hook::log::FUNC_TYPE_INVALID)
|
||||
<< "Invalid function type. Not used by any import or hook/cbak func. "
|
||||
<< "Codesec: " << section_type << " "
|
||||
<< "Local: " << j << " "
|
||||
<< "Offset: " << i << "\n";
|
||||
return {};
|
||||
}
|
||||
|
||||
int param_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (j == hook_type_idx)
|
||||
{
|
||||
if (param_count != 1)
|
||||
{
|
||||
GUARDLOG(hook::log::PARAM_HOOK_CBAK)
|
||||
<< "Malformed transaction. "
|
||||
<< "hook and cbak function definition must have exactly one parameter (uint32_t)." << "\n";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else
|
||||
if (param_count != (*first_signature).get().size() - 1)
|
||||
{
|
||||
GUARDLOG(hook::log::FUNC_TYPE_INVALID)
|
||||
<< "Malformed transaction. "
|
||||
<< "hook and cbak function definition must have exactly one parameter (uint32_t)." << "\n";
|
||||
<< "Hook API: " << *first_name << " has the wrong number of parameters.\n";
|
||||
return {};
|
||||
}
|
||||
|
||||
for (int k = 0; k < param_count; ++k)
|
||||
{
|
||||
int param_type = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int param_type = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (param_type == 0x7FU || param_type == 0x7EU ||
|
||||
param_type == 0x7DU || param_type == 0x7CU)
|
||||
{
|
||||
@@ -1018,20 +1194,30 @@ validateGuards(
|
||||
j, *hook_func_idx, *cbak_func_idx, param_count, param_type);
|
||||
|
||||
// hook and cbak parameter check here
|
||||
if (j == hook_type_idx && param_type != 0x7FU /* i32 */)
|
||||
if (j == hook_type_idx)
|
||||
{
|
||||
GUARDLOG(hook::log::PARAM_HOOK_CBAK)
|
||||
if (param_type != 0x7FU /* i32 */)
|
||||
{
|
||||
GUARDLOG(hook::log::PARAM_HOOK_CBAK)
|
||||
<< "Malformed transaction. "
|
||||
<< "hook and cbak function definition must have exactly one uint32_t parameter." << "\n";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((*first_signature).get()[k + 1] != param_type)
|
||||
{
|
||||
GUARDLOG(hook::log::FUNC_PARAM_INVALID)
|
||||
<< "Malformed transaction. "
|
||||
<< "hook and cbak function definition must have exactly one uint32_t parameter." << "\n";
|
||||
<< "Hook API: " << *first_name << " definition parameters incorrect." << "\n";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
int result_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int result_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
|
||||
// RH TODO: enable this for production
|
||||
// this needs a reliable hook cleaner otherwise it will catch most compilers out
|
||||
if (strict && result_count != 1)
|
||||
if (result_count != 1)
|
||||
{
|
||||
GUARDLOG(hook::log::FUNC_RETURN_COUNT)
|
||||
<< "Malformed transaction. "
|
||||
@@ -1043,7 +1229,7 @@ validateGuards(
|
||||
// so for completeness this loop is here but can be taken out in prod
|
||||
for (int k = 0; k < result_count; ++k)
|
||||
{
|
||||
int result_type = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int result_type = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (result_type == 0x7F || result_type == 0x7E ||
|
||||
result_type == 0x7D || result_type == 0x7C)
|
||||
{
|
||||
@@ -1065,17 +1251,29 @@ validateGuards(
|
||||
j, *hook_func_idx, *cbak_func_idx, result_count, result_type);
|
||||
|
||||
// hook and cbak return type check here
|
||||
if (j == hook_type_idx && (result_count != 1 || result_type != 0x7E /* i64 */))
|
||||
if (j == hook_type_idx)
|
||||
{
|
||||
GUARDLOG(hook::log::RETURN_HOOK_CBAK)
|
||||
if (result_count != 1 || result_type != 0x7E /* i64 */)
|
||||
{
|
||||
GUARDLOG(hook::log::RETURN_HOOK_CBAK)
|
||||
<< "Malformed transaction. "
|
||||
<< (j == hook_type_idx ? "hook" : "cbak") << " j=" << j << " "
|
||||
<< " function definition must have exactly one int64_t return type. "
|
||||
<< "resultcount=" << result_count << ", resulttype=" << result_type << ", "
|
||||
<< "paramcount=" << param_count << "\n";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((*first_signature).get()[0] != result_type)
|
||||
{
|
||||
GUARDLOG(hook::log::FUNC_RETURN_INVALID)
|
||||
<< "Malformed transaction. "
|
||||
<< (j == hook_type_idx ? "hook" : "cbak") << " j=" << j << " "
|
||||
<< " function definition must have exactly one int64_t return type. "
|
||||
<< "resultcount=" << result_count << ", resulttype=" << result_type << ", "
|
||||
<< "paramcount=" << param_count << "\n";
|
||||
<< "Hook API: " << *first_name << " definition return type incorrect." << "\n";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1083,19 +1281,19 @@ validateGuards(
|
||||
{
|
||||
// RH TODO: parse anywhere else an expr is allowed in wasm and enforce rules there too
|
||||
// these are the functions
|
||||
int func_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int func_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
|
||||
for (int j = 0; j < func_count; ++j)
|
||||
{
|
||||
// parse locals
|
||||
int code_size = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int code_size = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
int code_end = i + code_size;
|
||||
int local_count = parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
int local_count = parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
for (int k = 0; k < local_count; ++k)
|
||||
{
|
||||
/*int array_size = */
|
||||
parseLeb128(hook, i, &i); CHECK_SHORT_HOOK();
|
||||
if (!(hook[i] >= 0x7C && hook[i] <= 0x7F))
|
||||
parseLeb128(wasm, i, &i); CHECK_SHORT_HOOK();
|
||||
if (!(wasm[i] >= 0x7C && wasm[i] <= 0x7F))
|
||||
{
|
||||
GUARDLOG(hook::log::TYPE_INVALID)
|
||||
<< "Invalid local type. "
|
||||
@@ -1114,7 +1312,7 @@ validateGuards(
|
||||
|
||||
auto valid =
|
||||
check_guard(
|
||||
hook,
|
||||
wasm,
|
||||
j,
|
||||
i,
|
||||
code_end,
|
||||
@@ -1147,22 +1345,4 @@ validateGuards(
|
||||
|
||||
return std::pair<uint64_t, uint64_t>{maxInstrCountHook, maxInstrCountCbak};
|
||||
|
||||
/*
|
||||
GUARDLOG(hook::log::WASM_SMOKE_TEST)
|
||||
<< "Trying to wasm instantiate proposed hook "
|
||||
<< "size = " << hook.size() << "\n";
|
||||
|
||||
std::optional<std::string> result =
|
||||
hook::HookExecutor::validateWasm(hook.data(), (size_t)hook.size());
|
||||
|
||||
if (result)
|
||||
{
|
||||
GUARDLOG(hook::log::WASM_TEST_FAILURE)
|
||||
<< "Tried to set a hook with invalid code. VM error: "
|
||||
<< *result << "\n";
|
||||
return {};
|
||||
}
|
||||
*/
|
||||
|
||||
return std::pair<uint64_t, uint64_t>{maxInstrCountHook, maxInstrCountCbak};
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@
|
||||
R hook_api::F(hook::HookContext& hookCtx, WasmEdge_CallingFrameContext const& frameCtx)
|
||||
|
||||
#define HOOK_SETUP()\
|
||||
try {\
|
||||
[[maybe_unused]] ApplyContext& applyCtx = hookCtx.applyCtx;\
|
||||
[[maybe_unused]] auto& view = applyCtx.view();\
|
||||
[[maybe_unused]] auto j = applyCtx.app.journal("View");\
|
||||
@@ -149,7 +150,18 @@
|
||||
WasmEdge_CallingFrameGetMemoryInstance(&frameCtx, 0);\
|
||||
[[maybe_unused]] unsigned char* memory = WasmEdge_MemoryInstanceGetPointer(memoryCtx, 0, 0);\
|
||||
[[maybe_unused]] const uint64_t memory_length = WasmEdge_MemoryInstanceGetPageSize(memoryCtx) * \
|
||||
WasmEdge_kPageSize;
|
||||
WasmEdge_kPageSize;\
|
||||
if (!memoryCtx || !memory || !memory_length)\
|
||||
return INTERNAL_ERROR;\
|
||||
|
||||
#define HOOK_TEARDOWN()\
|
||||
} catch (const std::exception& e) {\
|
||||
JLOG(hookCtx.applyCtx.app.journal("View").error())\
|
||||
<< "HookError[" << HC_ACC() << "]: "\
|
||||
<< __func__ << " threw uncaught exception, what="\
|
||||
<< e.what();\
|
||||
return INTERNAL_ERROR;\
|
||||
}
|
||||
|
||||
#define WRITE_WASM_MEMORY(bytes_written, guest_dst_ptr, guest_dst_len,\
|
||||
host_src_ptr, host_src_len, host_memory_ptr, guest_memory_length)\
|
||||
@@ -163,8 +175,10 @@
|
||||
<< " bytes past end of wasm memory";\
|
||||
return OUT_OF_BOUNDS;\
|
||||
}\
|
||||
WasmEdge_MemoryInstanceSetData(memoryCtx, \
|
||||
reinterpret_cast<const uint8_t*>(host_src_ptr), guest_dst_ptr, bytes_to_write);\
|
||||
if (!WasmEdge_ResultOK(\
|
||||
WasmEdge_MemoryInstanceSetData(memoryCtx, \
|
||||
reinterpret_cast<const uint8_t*>(host_src_ptr), guest_dst_ptr, bytes_to_write)))\
|
||||
return INTERNAL_ERROR;\
|
||||
bytes_written += bytes_to_write;\
|
||||
}
|
||||
|
||||
@@ -177,34 +191,9 @@
|
||||
return bytes_written;\
|
||||
}
|
||||
|
||||
#define RETURN_HOOK_TRACE(read_ptr, read_len, t)\
|
||||
{\
|
||||
if (j.trace())\
|
||||
{\
|
||||
int rl = read_len;\
|
||||
if (rl > 1024)\
|
||||
rl = 1024;\
|
||||
if (NOT_IN_BOUNDS(read_ptr, read_len, memory_length))\
|
||||
return OUT_OF_BOUNDS;\
|
||||
std::string out;\
|
||||
out.reserve(rl);\
|
||||
if (!(read_ptr == 0 && read_len == 0))\
|
||||
{\
|
||||
out = std::string((const char*)(memory + read_ptr), (size_t)rl);\
|
||||
/* replace all nul chars with spaces */\
|
||||
for (char* ptr = out.data(); ptr < out.data() + out.size(); ++ptr)\
|
||||
if (*ptr == '\0') *ptr = ' ';\
|
||||
}\
|
||||
j.trace()\
|
||||
<< "HookTrace[" << HC_ACC() << "]: "\
|
||||
<< out << (out.empty() ? "" : " ")\
|
||||
<< t;\
|
||||
}\
|
||||
return 0;\
|
||||
}
|
||||
// ptr = pointer inside the wasm memory space
|
||||
#define NOT_IN_BOUNDS(ptr, len, memory_length)\
|
||||
((static_cast<uint64_t>(ptr) > static_cast<uint64_t>(memory_length)) || \
|
||||
((static_cast<uint64_t>(ptr) >= static_cast<uint64_t>(memory_length)) || \
|
||||
((static_cast<uint64_t>(ptr) + static_cast<uint64_t>(len)) > static_cast<uint64_t>(memory_length)))
|
||||
|
||||
#define HOOK_EXIT(read_ptr, read_len, error_code, exit_type)\
|
||||
@@ -233,3 +222,28 @@
|
||||
hookCtx.result.exitCode = error_code;\
|
||||
return (exit_type == hook_api::ExitType::ACCEPT ? RC_ACCEPT : RC_ROLLBACK);\
|
||||
}
|
||||
|
||||
#define WRITE_WASM_MEMORY_OR_RETURN_AS_INT64(write_ptr_in, write_len_in, data_ptr_in, data_len_in, is_account_in)\
|
||||
{\
|
||||
uint8_t* data_ptr = (uint8_t*)(data_ptr_in);\
|
||||
int data_len = (data_len_in);\
|
||||
if (is_account_in)\
|
||||
{\
|
||||
data_len--;\
|
||||
data_ptr++;\
|
||||
}\
|
||||
if (data_len < 0 ||\
|
||||
data_len > (data_len_in) ||\
|
||||
data_ptr < (data_ptr_in))\
|
||||
return INTERNAL_ERROR;\
|
||||
if (data_len == 0)\
|
||||
return 0;\
|
||||
if ((write_ptr_in) == 0)\
|
||||
return data_as_int64(data_ptr, data_len);\
|
||||
if (data_len > (write_len_in))\
|
||||
return TOO_SMALL;\
|
||||
WRITE_WASM_MEMORY_AND_RETURN(\
|
||||
(write_ptr_in), (write_len_in),\
|
||||
data_ptr, data_len,\
|
||||
memory, memory_length);\
|
||||
}
|
||||
|
||||
269
src/ripple/app/hook/Misc.h
Normal file
269
src/ripple/app/hook/Misc.h
Normal file
@@ -0,0 +1,269 @@
|
||||
|
||||
#ifndef HOOKMISC_INCLUDED
|
||||
#define HOOKMISC_INCLUDED 1
|
||||
namespace ripple
|
||||
{
|
||||
// RH TODO: there's definitely a mucher nicer way to do this, but it involves modifying the base_uint
|
||||
// class and we don't want to do that yet.
|
||||
|
||||
static const std::array<ripple::uint256, 256> UINT256_BIT =
|
||||
{
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000001"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000002"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000004"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000008"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000010"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000020"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000040"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000080"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000100"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000200"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000400"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000800"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000001000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000002000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000004000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000008000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000010000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000020000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000040000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000080000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000100000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000200000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000400000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000800000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000001000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000002000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000004000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000008000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000010000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000020000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000040000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000080000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000100000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000200000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000400000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000800000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000001000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000002000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000004000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000008000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000010000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000020000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000040000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000080000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000100000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000200000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000400000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000800000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000001000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000002000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000004000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000008000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000010000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000020000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000040000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000080000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000100000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000200000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000400000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000800000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000001000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000002000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000004000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000008000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000010000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000020000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000040000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000080000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000100000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000200000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000400000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000800000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000001000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000002000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000004000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000008000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000010000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000020000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000040000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000080000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000100000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000200000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000400000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000000800000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000001000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000002000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000004000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000008000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000010000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000020000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000040000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000080000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000100000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000200000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000400000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000000800000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000001000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000002000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000004000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000008000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000010000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000020000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000040000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000080000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000100000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000200000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000400000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000000800000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000001000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000002000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000004000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000008000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000010000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000020000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000040000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000080000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000100000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000200000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000400000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000000800000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000001000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000002000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000004000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000008000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000010000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000020000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000040000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000080000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000100000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000200000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000400000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000000800000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000001000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000002000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000004000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000008000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000010000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000020000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000040000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000080000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000100000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000200000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000400000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000000800000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000001000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000002000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000004000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000008000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000010000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000020000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000040000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000080000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000100000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000200000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000400000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000000800000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000001000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000002000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000004000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000008000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000010000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000020000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000040000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000080000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000100000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000200000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000400000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000000800000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000001000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000002000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000004000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000008000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000010000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000020000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000040000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000080000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000100000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000200000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000400000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000000800000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000001000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000002000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000004000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000008000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000010000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000020000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000040000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000080000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000100000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000200000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000400000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000000800000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000001000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000002000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000004000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000008000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000010000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000020000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000040000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000080000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000100000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000200000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000400000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000000800000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000001000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000002000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000004000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000008000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000010000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000020000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000040000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000080000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000100000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000200000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000400000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000000800000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000001000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000002000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000004000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000008000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000010000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000020000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000040000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000080000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000100000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000200000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000400000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000000800000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000001000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000002000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000004000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000008000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000010000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000020000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000040000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000080000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000100000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000200000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000400000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0000800000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0001000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0002000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0004000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0008000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0010000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0020000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0040000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0080000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0100000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0200000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0400000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("0800000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("1000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("2000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("4000000000000000000000000000000000000000000000000000000000000000"),
|
||||
ripple::uint256("8000000000000000000000000000000000000000000000000000000000000000")
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <ripple/protocol/digest.h>
|
||||
#include <wasmedge/wasmedge.h>
|
||||
#include <ripple/app/hook/Macro.h>
|
||||
#include <ripple/app/hook/Misc.h>
|
||||
#include <ripple/app/hook/Enum.h>
|
||||
|
||||
namespace hook
|
||||
@@ -26,48 +27,60 @@ namespace hook
|
||||
// and is preserved across the execution of the set of hook chains
|
||||
// being executed in the current transaction. It is committed to lgr
|
||||
// only upon tesSuccess for the otxn.
|
||||
using HookStateMap =
|
||||
std::map<
|
||||
ripple::AccountID, // account that owns the state
|
||||
std::pair<
|
||||
int64_t, // remaining available ownercount
|
||||
std::map<ripple::uint256, // namespace
|
||||
std::map<ripple::uint256, // key
|
||||
class HookStateMap :
|
||||
public std::map<
|
||||
ripple::AccountID, // account that owns the state
|
||||
std::pair<
|
||||
bool, // is modified from ledger value
|
||||
ripple::Blob>>>>>; // the value
|
||||
int64_t, // remaining available ownercount
|
||||
std::map<ripple::uint256, // namespace
|
||||
std::map<ripple::uint256, // key
|
||||
std::pair<
|
||||
bool, // is modified from ledger value
|
||||
ripple::Blob>>>>> // the value
|
||||
{
|
||||
public:
|
||||
uint32_t modified_entry_count = 0; // track the number of total modified
|
||||
};
|
||||
|
||||
|
||||
|
||||
using namespace ripple;
|
||||
static const std::map<uint16_t, uint8_t> TSHAllowances =
|
||||
{
|
||||
{ttPAYMENT, tshROLLBACK },
|
||||
{ttESCROW_CREATE, tshROLLBACK },
|
||||
{ttESCROW_FINISH, tshROLLBACK },
|
||||
{ttACCOUNT_SET, tshNONE },
|
||||
{ttESCROW_CANCEL, tshCOLLECT },
|
||||
{ttREGULAR_KEY_SET, tshROLLBACK },
|
||||
{ttOFFER_CREATE, tshCOLLECT },
|
||||
{ttOFFER_CANCEL, tshNONE },
|
||||
{ttTICKET_CREATE, tshNONE },
|
||||
{ttSIGNER_LIST_SET, tshROLLBACK },
|
||||
{ttPAYCHAN_CREATE, tshROLLBACK },
|
||||
{ttPAYCHAN_FUND, tshCOLLECT },
|
||||
{ttPAYCHAN_CLAIM, tshCOLLECT },
|
||||
{ttCHECK_CREATE, tshROLLBACK },
|
||||
{ttCHECK_CASH, tshROLLBACK },
|
||||
{ttCHECK_CANCEL, tshCOLLECT },
|
||||
{ttDEPOSIT_PREAUTH, tshROLLBACK },
|
||||
{ttTRUST_SET, tshCOLLECT },
|
||||
{ttACCOUNT_DELETE, tshROLLBACK },
|
||||
{ttHOOK_SET, tshNONE },
|
||||
{ttNFTOKEN_MINT, tshROLLBACK },
|
||||
{ttNFTOKEN_BURN, tshCOLLECT },
|
||||
{ttNFTOKEN_CREATE_OFFER, tshROLLBACK },
|
||||
{ttNFTOKEN_CANCEL_OFFER, tshCOLLECT },
|
||||
{ttNFTOKEN_ACCEPT_OFFER, tshROLLBACK },
|
||||
{ttCLAIM_REWARD, tshROLLBACK },
|
||||
{ttINVOKE, tshROLLBACK }
|
||||
{ttPAYMENT, tshROLLBACK },
|
||||
{ttESCROW_CREATE, tshROLLBACK },
|
||||
{ttESCROW_FINISH, tshROLLBACK },
|
||||
{ttACCOUNT_SET, tshNONE },
|
||||
{ttESCROW_CANCEL, tshCOLLECT },
|
||||
{ttREGULAR_KEY_SET, tshROLLBACK },
|
||||
{ttOFFER_CREATE, tshCOLLECT },
|
||||
{ttOFFER_CANCEL, tshNONE },
|
||||
{ttTICKET_CREATE, tshNONE },
|
||||
{ttSIGNER_LIST_SET, tshROLLBACK },
|
||||
{ttPAYCHAN_CREATE, tshROLLBACK },
|
||||
{ttPAYCHAN_FUND, tshCOLLECT },
|
||||
{ttPAYCHAN_CLAIM, tshCOLLECT },
|
||||
{ttCHECK_CREATE, tshROLLBACK },
|
||||
{ttCHECK_CASH, tshROLLBACK },
|
||||
{ttCHECK_CANCEL, tshCOLLECT },
|
||||
{ttDEPOSIT_PREAUTH, tshROLLBACK },
|
||||
{ttTRUST_SET, tshCOLLECT },
|
||||
{ttACCOUNT_DELETE, tshROLLBACK },
|
||||
{ttHOOK_SET, tshNONE },
|
||||
{ttNFTOKEN_MINT, tshROLLBACK },
|
||||
{ttNFTOKEN_BURN, tshCOLLECT },
|
||||
{ttNFTOKEN_CREATE_OFFER, tshROLLBACK },
|
||||
{ttNFTOKEN_CANCEL_OFFER, tshCOLLECT },
|
||||
{ttNFTOKEN_ACCEPT_OFFER, tshROLLBACK },
|
||||
{ttCLAIM_REWARD, tshROLLBACK },
|
||||
{ttINVOKE, tshROLLBACK },
|
||||
{ttURITOKEN_MINT, tshNONE },
|
||||
{ttURITOKEN_BURN, tshROLLBACK },
|
||||
{ttURITOKEN_BUY, tshROLLBACK },
|
||||
{ttURITOKEN_CREATE_SELL_OFFER, tshROLLBACK },
|
||||
{ttURITOKEN_CANCEL_SELL_OFFER, tshNONE },
|
||||
{ttIMPORT, tshROLLBACK },
|
||||
{ttGENESIS_MINT, tshCOLLECT },
|
||||
};
|
||||
|
||||
|
||||
@@ -78,9 +91,6 @@ namespace hook
|
||||
namespace hook_api
|
||||
{
|
||||
|
||||
#define TER_TO_HOOK_RETURN_CODE(x)\
|
||||
(((TERtoInt(x)) << 16)*-1)
|
||||
|
||||
// for debugging if you want a lot of output change to 1
|
||||
#define HOOK_DBG 0
|
||||
#define DBG_PRINTF if (HOOK_DBG) printf
|
||||
@@ -199,10 +209,13 @@ namespace hook_api
|
||||
DECLARE_HOOK_FUNCTION(int64_t, otxn_id, uint32_t write_ptr, uint32_t write_len, uint32_t flags );
|
||||
DECLARE_HOOK_FUNCNARG(int64_t, otxn_type );
|
||||
DECLARE_HOOK_FUNCTION(int64_t, otxn_slot, uint32_t slot_no );
|
||||
DECLARE_HOOK_FUNCTION(int64_t, otxn_param, uint32_t write_ptr, uint32_t write_len,
|
||||
uint32_t read_ptr, uint32_t read_len);
|
||||
|
||||
DECLARE_HOOK_FUNCTION(int64_t, meta_slot, uint32_t slot_no );
|
||||
DECLARE_HOOK_FUNCTION(int64_t, xpop_slot, uint32_t slot_no_tx, uint32_t slot_no_meta );
|
||||
|
||||
|
||||
/*
|
||||
DECLARE_HOOK_FUNCTION(int64_t, str_find, uint32_t hread_ptr, uint32_t hread_len,
|
||||
uint32_t nread_ptr, uint32_t nread_len,
|
||||
uint32_t mode, uint32_t n);
|
||||
@@ -217,7 +230,7 @@ namespace hook_api
|
||||
DECLARE_HOOK_FUNCTION(int64_t, str_concat, uint32_t write_ptr, uint32_t write_len,
|
||||
uint32_t read_ptr, uint32_t read_len,
|
||||
uint64_t operand, uint32_t operand_type);
|
||||
|
||||
*/
|
||||
} /* end namespace hook_api */
|
||||
|
||||
namespace hook
|
||||
@@ -257,13 +270,6 @@ namespace hook
|
||||
|
||||
struct HookContext;
|
||||
|
||||
uint32_t maxHookStateDataSize(void);
|
||||
uint32_t maxHookWasmSize(void);
|
||||
uint32_t maxHookParameterKeySize(void);
|
||||
uint32_t maxHookParameterValueSize(void);
|
||||
|
||||
uint32_t maxHookChainLength(void);
|
||||
|
||||
uint32_t computeHookStateOwnerCount(uint32_t hookStateCount);
|
||||
|
||||
|
||||
@@ -385,7 +391,7 @@ namespace hook
|
||||
bool /* retval of true means an error */
|
||||
gatherHookParameters(
|
||||
std::shared_ptr<ripple::STLedgerEntry> const& hookDef,
|
||||
ripple::STObject const* hookObj,
|
||||
ripple::STObject const& hookObj,
|
||||
std::map<std::vector<uint8_t>, std::vector<uint8_t>>& parameters,
|
||||
beast::Journal const& j_);
|
||||
|
||||
@@ -431,31 +437,75 @@ namespace hook
|
||||
|
||||
|
||||
public:
|
||||
HookContext hookCtx;
|
||||
HookContext& hookCtx;
|
||||
WasmEdge_ModuleInstanceContext* importObj;
|
||||
|
||||
class WasmEdgeVM
|
||||
{
|
||||
public:
|
||||
|
||||
WasmEdge_ConfigureContext* conf = NULL;
|
||||
WasmEdge_VMContext* ctx = NULL;
|
||||
|
||||
WasmEdgeVM()
|
||||
{
|
||||
conf = WasmEdge_ConfigureCreate();
|
||||
if (!conf)
|
||||
return;
|
||||
WasmEdge_ConfigureStatisticsSetInstructionCounting(conf, true);
|
||||
ctx = WasmEdge_VMCreate(conf, NULL);
|
||||
}
|
||||
|
||||
bool
|
||||
sane()
|
||||
{
|
||||
return ctx && conf;
|
||||
}
|
||||
|
||||
~WasmEdgeVM()
|
||||
{
|
||||
if (conf)
|
||||
WasmEdge_ConfigureDelete(conf);
|
||||
if (ctx)
|
||||
WasmEdge_VMDelete(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
// if an error occured return a string prefixed with `prefix` followed by the error description
|
||||
static std::optional<std::string> getWasmError(std::string prefix, WasmEdge_Result& res)
|
||||
{
|
||||
if (WasmEdge_ResultOK(res))
|
||||
return {};
|
||||
|
||||
const char* msg = WasmEdge_ResultGetMessage(res);
|
||||
return prefix + ": " + (msg ? msg : "unknown error");
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that a web assembly blob can be loaded by wasmedge
|
||||
*/
|
||||
static std::optional<std::string> validateWasm(const void* wasm, size_t len)
|
||||
{
|
||||
std::optional<std::string> ret;
|
||||
WasmEdge_ConfigureContext* confCtx = WasmEdge_ConfigureCreate();
|
||||
WasmEdge_VMContext* vmCtx = WasmEdge_VMCreate(confCtx, NULL);
|
||||
WasmEdge_Result res = WasmEdge_VMLoadWasmFromBuffer(vmCtx, reinterpret_cast<const uint8_t*>(wasm), len);
|
||||
if (!WasmEdge_ResultOK(res))
|
||||
ret = "VMLoadWasmFromBuffer failed";
|
||||
else
|
||||
{
|
||||
res = WasmEdge_VMValidate(vmCtx);
|
||||
if (!WasmEdge_ResultOK(res))
|
||||
ret = "VMValidate failed";
|
||||
}
|
||||
WasmEdge_VMDelete(vmCtx);
|
||||
WasmEdge_ConfigureDelete(confCtx);
|
||||
return ret;
|
||||
WasmEdgeVM vm;
|
||||
|
||||
if (!vm.sane())
|
||||
return "Could not create WASMEDGE instance";
|
||||
|
||||
WasmEdge_Result res =
|
||||
WasmEdge_VMLoadWasmFromBuffer(vm.ctx, reinterpret_cast<const uint8_t*>(wasm), len);
|
||||
|
||||
if (auto err = getWasmError("VMLoadWasmFromBuffer failed", res); err)
|
||||
return *err;
|
||||
|
||||
res = WasmEdge_VMValidate(vm.ctx);
|
||||
|
||||
if (auto err = getWasmError("VMValidate failed", res); err)
|
||||
return *err;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execute web assembly byte code against the constructed Hook Context
|
||||
* Once execution has occured the exector is spent and cannot be used again and should be destructed
|
||||
@@ -472,61 +522,47 @@ namespace hook
|
||||
JLOG(j.trace())
|
||||
<< "HookInfo[" << HC_ACC() << "]: creating wasm instance";
|
||||
|
||||
WasmEdge_ConfigureContext* confCtx = WasmEdge_ConfigureCreate();
|
||||
WasmEdge_ConfigureStatisticsSetInstructionCounting(confCtx, true);
|
||||
WasmEdge_VMContext* vmCtx = WasmEdge_VMCreate(confCtx, NULL);
|
||||
WasmEdge_LogOff();
|
||||
|
||||
WasmEdge_Result res = WasmEdge_VMRegisterModuleFromImport(vmCtx, this->importObj);
|
||||
if (!WasmEdge_ResultOK(res))
|
||||
WasmEdgeVM vm;
|
||||
|
||||
if (!vm.sane())
|
||||
{
|
||||
JLOG(j.warn())
|
||||
<< "HookError[" << HC_ACC() << "]: Could not create WASMEDGE instance.";
|
||||
|
||||
hookCtx.result.exitType = hook_api::ExitType::WASM_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
WasmEdge_Result res = WasmEdge_VMRegisterModuleFromImport(vm.ctx, this->importObj);
|
||||
|
||||
if (auto err = getWasmError("Import phase failed", res); err)
|
||||
{
|
||||
hookCtx.result.exitType = hook_api::ExitType::WASM_ERROR;
|
||||
JLOG(j.trace())
|
||||
<< "HookError[" << HC_ACC() << "]: Import phase failed "
|
||||
<< WasmEdge_ResultGetMessage(res);
|
||||
JLOG(j.trace()) << "HookError[" << HC_ACC() << "]: " << *err;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
WasmEdge_Value params[1] = { WasmEdge_ValueGenI32((int64_t)wasmParam) };
|
||||
WasmEdge_Value returns[1];
|
||||
|
||||
res =
|
||||
WasmEdge_VMRunWasmFromBuffer(vm.ctx, reinterpret_cast<const uint8_t*>(wasm), len,
|
||||
callback ? cbakFunctionName : hookFunctionName,
|
||||
params, 1, returns, 1);
|
||||
|
||||
if (auto err = getWasmError("WASM VM error", res); err)
|
||||
{
|
||||
|
||||
WasmEdge_Value params[1] = { WasmEdge_ValueGenI32((int64_t)wasmParam) };
|
||||
WasmEdge_Value returns[1];
|
||||
|
||||
/*
|
||||
printf("executing hook wasm:\n");
|
||||
for (int j = 0; j < len; j++)
|
||||
{
|
||||
if (j % 16 == 0)
|
||||
printf("0x%08X:\t", j);
|
||||
|
||||
printf("%02X%s", (reinterpret_cast<const uint8_t*>(wasm))[j],
|
||||
(j % 16 == 15 ? "\n" :
|
||||
(j % 4 == 3 ? " " :
|
||||
(j % 2 == 1 ? " " : ""))));
|
||||
}
|
||||
printf("\n----\n");
|
||||
*/
|
||||
|
||||
res =
|
||||
WasmEdge_VMRunWasmFromBuffer(vmCtx, reinterpret_cast<const uint8_t*>(wasm), len,
|
||||
callback ? cbakFunctionName : hookFunctionName,
|
||||
params, 1, returns, 1);
|
||||
|
||||
if (!WasmEdge_ResultOK(res))
|
||||
{
|
||||
JLOG(j.warn())
|
||||
<< "HookError[" << HC_ACC() << "]: WASM VM error "
|
||||
<< WasmEdge_ResultGetMessage(res);
|
||||
hookCtx.result.exitType = hook_api::ExitType::WASM_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
auto* statsCtx= WasmEdge_VMGetStatisticsContext(vmCtx);
|
||||
hookCtx.result.instructionCount = WasmEdge_StatisticsGetInstrCount(statsCtx);
|
||||
}
|
||||
JLOG(j.warn()) << "HookError[" << HC_ACC() << "]: " << *err;
|
||||
hookCtx.result.exitType = hook_api::ExitType::WASM_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
WasmEdge_ConfigureDelete(confCtx);
|
||||
WasmEdge_VMDelete(vmCtx);
|
||||
auto* statsCtx= WasmEdge_VMGetStatisticsContext(vm.ctx);
|
||||
hookCtx.result.instructionCount = WasmEdge_StatisticsGetInstrCount(statsCtx);
|
||||
|
||||
// RH NOTE: stack unwind will clean up WasmEdgeVM
|
||||
}
|
||||
|
||||
HookExecutor(HookContext& ctx)
|
||||
@@ -583,6 +619,8 @@ namespace hook
|
||||
ADD_HOOK_FUNCTION(otxn_id, ctx);
|
||||
ADD_HOOK_FUNCTION(otxn_type, ctx);
|
||||
ADD_HOOK_FUNCTION(otxn_slot, ctx);
|
||||
ADD_HOOK_FUNCTION(otxn_param, ctx);
|
||||
|
||||
ADD_HOOK_FUNCTION(hook_account, ctx);
|
||||
ADD_HOOK_FUNCTION(hook_hash, ctx);
|
||||
ADD_HOOK_FUNCTION(hook_again, ctx);
|
||||
@@ -618,12 +656,14 @@ namespace hook
|
||||
ADD_HOOK_FUNCTION(trace_float, ctx);
|
||||
|
||||
ADD_HOOK_FUNCTION(meta_slot, ctx);
|
||||
ADD_HOOK_FUNCTION(xpop_slot, ctx);
|
||||
|
||||
|
||||
/*
|
||||
ADD_HOOK_FUNCTION(str_find, ctx);
|
||||
ADD_HOOK_FUNCTION(str_replace, ctx);
|
||||
ADD_HOOK_FUNCTION(str_compare, ctx);
|
||||
ADD_HOOK_FUNCTION(str_concat, ctx);
|
||||
*/
|
||||
|
||||
WasmEdge_TableInstanceContext* hostTable = WasmEdge_TableInstanceCreate(tableType);
|
||||
WasmEdge_ModuleInstanceAddTable(importObj, tableName, hostTable);
|
||||
|
||||
@@ -76,7 +76,7 @@ int main(int argc, char** argv)
|
||||
close(fd);
|
||||
|
||||
auto result =
|
||||
validateGuards(hook, true, std::cout, "");
|
||||
validateGuards(hook, std::cout, "", 1);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1343
src/ripple/app/hook/xahau.h
Normal file
1343
src/ripple/app/hook/xahau.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -66,9 +66,11 @@ ConsensusTransSetSF::gotNode(
|
||||
pap->getOPs().submitTransaction(stx);
|
||||
});
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.warn()) << "Fetched invalid transaction in proposed set";
|
||||
JLOG(j_.warn())
|
||||
<< "Fetched invalid transaction in proposed set. Exception: "
|
||||
<< ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,7 @@ Ledger::Ledger(
|
||||
, txMap_(std::make_shared<SHAMap>(SHAMapType::TRANSACTION, family))
|
||||
, stateMap_(std::make_shared<SHAMap>(SHAMapType::STATE, family))
|
||||
, rules_{config.features}
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.seq = 1;
|
||||
info_.drops = INITIAL_XRP;
|
||||
@@ -209,8 +210,36 @@ Ledger::Ledger(
|
||||
rawInsert(sle);
|
||||
}
|
||||
|
||||
{
|
||||
auto sle = std::make_shared<SLE>(keylet::fees());
|
||||
sle->setFieldU32(sfNetworkID, config.NETWORK_ID);
|
||||
|
||||
// Whether featureXRPFees is supported will depend on startup options.
|
||||
if (std::find(amendments.begin(), amendments.end(), featureXRPFees) !=
|
||||
amendments.end())
|
||||
{
|
||||
sle->at(sfBaseFeeDrops) = config.FEES.reference_fee;
|
||||
sle->at(sfReserveBaseDrops) = config.FEES.account_reserve;
|
||||
sle->at(sfReserveIncrementDrops) = config.FEES.owner_reserve;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (auto const f =
|
||||
config.FEES.reference_fee.dropsAs<std::uint64_t>())
|
||||
sle->at(sfBaseFee) = *f;
|
||||
if (auto const f =
|
||||
config.FEES.account_reserve.dropsAs<std::uint32_t>())
|
||||
sle->at(sfReserveBase) = *f;
|
||||
if (auto const f =
|
||||
config.FEES.owner_reserve.dropsAs<std::uint32_t>())
|
||||
sle->at(sfReserveIncrement) = *f;
|
||||
sle->at(sfReferenceFeeUnits) = Config::FEE_UNITS_DEPRECATED;
|
||||
}
|
||||
rawInsert(sle);
|
||||
}
|
||||
|
||||
stateMap_->flushDirty(hotACCOUNT_NODE);
|
||||
setImmutable(config);
|
||||
setImmutable();
|
||||
}
|
||||
|
||||
Ledger::Ledger(
|
||||
@@ -229,6 +258,7 @@ Ledger::Ledger(
|
||||
std::make_shared<SHAMap>(SHAMapType::STATE, info.accountHash, family))
|
||||
, rules_(config.features)
|
||||
, info_(info)
|
||||
, j_(j)
|
||||
{
|
||||
loaded = true;
|
||||
|
||||
@@ -259,14 +289,15 @@ Ledger::Ledger(
|
||||
txMap_->setImmutable();
|
||||
stateMap_->setImmutable();
|
||||
|
||||
if (!setup(config))
|
||||
defaultFees(config);
|
||||
if (!setup())
|
||||
loaded = false;
|
||||
|
||||
if (!loaded)
|
||||
{
|
||||
info_.hash = calculateLedgerHash(info_);
|
||||
if (acquire && !config.reporting())
|
||||
family.missingNode(info_.hash, info_.seq);
|
||||
family.missingNodeAcquireByHash(info_.hash, info_.seq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +310,7 @@ Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime)
|
||||
, stateMap_(prevLedger.stateMap_->snapShot(true))
|
||||
, fees_(prevLedger.fees_)
|
||||
, rules_(prevLedger.rules_)
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.seq = prevLedger.info_.seq + 1;
|
||||
info_.parentCloseTime = prevLedger.info_.closeTime;
|
||||
@@ -312,6 +344,7 @@ Ledger::Ledger(LedgerInfo const& info, Config const& config, Family& family)
|
||||
std::make_shared<SHAMap>(SHAMapType::STATE, info.accountHash, family))
|
||||
, rules_{config.features}
|
||||
, info_(info)
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.hash = calculateLedgerHash(info_);
|
||||
}
|
||||
@@ -325,15 +358,17 @@ Ledger::Ledger(
|
||||
, txMap_(std::make_shared<SHAMap>(SHAMapType::TRANSACTION, family))
|
||||
, stateMap_(std::make_shared<SHAMap>(SHAMapType::STATE, family))
|
||||
, rules_{config.features}
|
||||
, j_(beast::Journal(beast::Journal::getNullSink()))
|
||||
{
|
||||
info_.seq = ledgerSeq;
|
||||
info_.closeTime = closeTime;
|
||||
info_.closeTimeResolution = ledgerDefaultTimeResolution;
|
||||
setup(config);
|
||||
defaultFees(config);
|
||||
setup();
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::setImmutable(Config const& config, bool rehash)
|
||||
Ledger::setImmutable(bool rehash)
|
||||
{
|
||||
// Force update, since this is the only
|
||||
// place the hash transitions to valid
|
||||
@@ -349,15 +384,14 @@ Ledger::setImmutable(Config const& config, bool rehash)
|
||||
mImmutable = true;
|
||||
txMap_->setImmutable();
|
||||
stateMap_->setImmutable();
|
||||
setup(config);
|
||||
setup();
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::setAccepted(
|
||||
NetClock::time_point closeTime,
|
||||
NetClock::duration closeResolution,
|
||||
bool correctCloseTime,
|
||||
Config const& config)
|
||||
bool correctCloseTime)
|
||||
{
|
||||
// Used when we witnessed the consensus.
|
||||
assert(!open());
|
||||
@@ -365,7 +399,7 @@ Ledger::setAccepted(
|
||||
info_.closeTime = closeTime;
|
||||
info_.closeTimeResolution = closeResolution;
|
||||
info_.closeFlags = correctCloseTime ? 0 : sLCF_NoConsensusTime;
|
||||
setImmutable(config);
|
||||
setImmutable();
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -587,59 +621,96 @@ Ledger::rawTxInsertWithHash(
|
||||
}
|
||||
|
||||
bool
|
||||
Ledger::setup(Config const& config)
|
||||
Ledger::setup()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
fees_.base = config.FEE_DEFAULT;
|
||||
fees_.units = config.TRANSACTION_FEE_BASE;
|
||||
fees_.reserve = config.FEE_ACCOUNT_RESERVE;
|
||||
fees_.increment = config.FEE_OWNER_RESERVE;
|
||||
try
|
||||
{
|
||||
rules_ = makeRulesGivenLedger(*this, rules_);
|
||||
}
|
||||
catch (SHAMapMissingNode const&)
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.error()) << "Exception in " << __func__ << ": " << ex.what();
|
||||
Rethrow();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (auto const sle = read(keylet::fees()))
|
||||
{
|
||||
// VFALCO NOTE Why getFieldIndex and not isFieldPresent?
|
||||
|
||||
if (sle->getFieldIndex(sfBaseFee) != -1)
|
||||
fees_.base = sle->getFieldU64(sfBaseFee);
|
||||
|
||||
if (sle->getFieldIndex(sfReferenceFeeUnits) != -1)
|
||||
fees_.units = sle->getFieldU32(sfReferenceFeeUnits);
|
||||
|
||||
if (sle->getFieldIndex(sfReserveBase) != -1)
|
||||
fees_.reserve = sle->getFieldU32(sfReserveBase);
|
||||
|
||||
if (sle->getFieldIndex(sfReserveIncrement) != -1)
|
||||
fees_.increment = sle->getFieldU32(sfReserveIncrement);
|
||||
bool oldFees = false;
|
||||
bool newFees = false;
|
||||
{
|
||||
auto const baseFee = sle->at(~sfBaseFee);
|
||||
auto const reserveBase = sle->at(~sfReserveBase);
|
||||
auto const reserveIncrement = sle->at(~sfReserveIncrement);
|
||||
if (baseFee)
|
||||
fees_.base = *baseFee;
|
||||
if (reserveBase)
|
||||
fees_.reserve = *reserveBase;
|
||||
if (reserveIncrement)
|
||||
fees_.increment = *reserveIncrement;
|
||||
oldFees = baseFee || reserveBase || reserveIncrement;
|
||||
}
|
||||
{
|
||||
auto const baseFeeXRP = sle->at(~sfBaseFeeDrops);
|
||||
auto const reserveBaseXRP = sle->at(~sfReserveBaseDrops);
|
||||
auto const reserveIncrementXRP =
|
||||
sle->at(~sfReserveIncrementDrops);
|
||||
auto assign = [&ret](
|
||||
XRPAmount& dest,
|
||||
std::optional<STAmount> const& src) {
|
||||
if (src)
|
||||
{
|
||||
if (src->native())
|
||||
dest = src->xrp();
|
||||
else
|
||||
ret = false;
|
||||
}
|
||||
};
|
||||
assign(fees_.base, baseFeeXRP);
|
||||
assign(fees_.reserve, reserveBaseXRP);
|
||||
assign(fees_.increment, reserveIncrementXRP);
|
||||
newFees = baseFeeXRP || reserveBaseXRP || reserveIncrementXRP;
|
||||
}
|
||||
if (oldFees && newFees)
|
||||
// Should be all of one or the other, but not both
|
||||
ret = false;
|
||||
if (!rules_.enabled(featureXRPFees) && newFees)
|
||||
// Can't populate the new fees before the amendment is enabled
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
catch (SHAMapMissingNode const&)
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
Rethrow();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
rules_ = makeRulesGivenLedger(*this, config.features);
|
||||
}
|
||||
catch (SHAMapMissingNode const&)
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j_.error()) << "Exception in " << __func__ << ": " << ex.what();
|
||||
Rethrow();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
Ledger::defaultFees(Config const& config)
|
||||
{
|
||||
assert(fees_.base == 0 && fees_.reserve == 0 && fees_.increment == 0);
|
||||
if (fees_.base == 0)
|
||||
fees_.base = config.FEES.reference_fee;
|
||||
if (fees_.reserve == 0)
|
||||
fees_.reserve = config.FEES.account_reserve;
|
||||
if (fees_.increment == 0)
|
||||
fees_.increment = config.FEES.owner_reserve;
|
||||
}
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
Ledger::peek(Keylet const& k) const
|
||||
{
|
||||
@@ -1044,7 +1115,8 @@ finishLoadByIndexOrHash(
|
||||
if (!ledger)
|
||||
return;
|
||||
|
||||
ledger->setImmutable(config);
|
||||
assert(ledger->read(keylet::fees()));
|
||||
ledger->setImmutable();
|
||||
|
||||
JLOG(j.trace()) << "Loaded ledger: " << to_string(ledger->info().hash);
|
||||
|
||||
|
||||
@@ -266,11 +266,10 @@ public:
|
||||
setAccepted(
|
||||
NetClock::time_point closeTime,
|
||||
NetClock::duration closeResolution,
|
||||
bool correctCloseTime,
|
||||
Config const& config);
|
||||
bool correctCloseTime);
|
||||
|
||||
void
|
||||
setImmutable(Config const& config, bool rehash = true);
|
||||
setImmutable(bool rehash = true);
|
||||
|
||||
bool
|
||||
isImmutable() const
|
||||
@@ -395,7 +394,10 @@ private:
|
||||
class txs_iter_impl;
|
||||
|
||||
bool
|
||||
setup(Config const& config);
|
||||
setup();
|
||||
|
||||
void
|
||||
defaultFees(Config const& config);
|
||||
|
||||
bool mImmutable;
|
||||
|
||||
@@ -408,6 +410,7 @@ private:
|
||||
Fees fees_;
|
||||
Rules rules_;
|
||||
LedgerInfo info_;
|
||||
beast::Journal j_;
|
||||
};
|
||||
|
||||
/** A ledger wrapped in a CachedView. */
|
||||
|
||||
@@ -292,6 +292,10 @@ public:
|
||||
std::optional<LedgerIndex>
|
||||
minSqlSeq();
|
||||
|
||||
// Iff a txn exists at the specified ledger and offset then return its txnid
|
||||
std::optional<uint256>
|
||||
txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex);
|
||||
|
||||
private:
|
||||
void
|
||||
setValidLedger(std::shared_ptr<Ledger const> const& l);
|
||||
|
||||
@@ -74,7 +74,8 @@ public:
|
||||
|
||||
// return value: true = we had the transaction already
|
||||
bool
|
||||
inLedger(uint256 const& hash, std::uint32_t ledger);
|
||||
inLedger(uint256 const& hash, std::uint32_t ledger,
|
||||
std::optional<uint32_t> tseq, std::optional<uint16_t> netID);
|
||||
|
||||
void
|
||||
canonicalize(std::shared_ptr<Transaction>* pTransaction);
|
||||
|
||||
@@ -75,8 +75,8 @@ buildLedgerImpl(
|
||||
built->unshare();
|
||||
|
||||
// Accept ledger
|
||||
built->setAccepted(
|
||||
closeTime, closeResolution, closeTimeCorrect, app.config());
|
||||
assert(built->read(keylet::fees()));
|
||||
built->setAccepted(closeTime, closeResolution, closeTimeCorrect);
|
||||
|
||||
return built;
|
||||
}
|
||||
@@ -116,8 +116,10 @@ applyTransactions(
|
||||
{
|
||||
auto const txid = it->first.getTXID();
|
||||
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
if (pass == 0 && built->txExists(txid))
|
||||
{
|
||||
it = txns.erase(it);
|
||||
@@ -140,13 +142,16 @@ applyTransactions(
|
||||
case ApplyResult::Retry:
|
||||
++it;
|
||||
}
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(j.warn()) << "Transaction " << txid << " throws";
|
||||
JLOG(j.warn())
|
||||
<< "Transaction " << txid << " throws: " << ex.what();
|
||||
failed.insert(txid);
|
||||
it = txns.erase(it);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
JLOG(j.debug()) << (certainRetry ? "Pass: " : "Final pass: ") << pass
|
||||
|
||||
@@ -155,7 +155,8 @@ InboundLedger::init(ScopedLockType& collectionLock)
|
||||
|
||||
JLOG(journal_.debug()) << "Acquiring ledger we already have in "
|
||||
<< " local store. " << hash_;
|
||||
mLedger->setImmutable(app_.config());
|
||||
assert(mLedger->read(keylet::fees()));
|
||||
mLedger->setImmutable();
|
||||
|
||||
if (mReason == Reason::HISTORY || mReason == Reason::SHARD)
|
||||
return;
|
||||
@@ -416,7 +417,8 @@ InboundLedger::tryDB(NodeStore::Database& srcDB)
|
||||
{
|
||||
JLOG(journal_.debug()) << "Had everything locally";
|
||||
complete_ = true;
|
||||
mLedger->setImmutable(app_.config());
|
||||
assert(mLedger->read(keylet::fees()));
|
||||
mLedger->setImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,7 +515,8 @@ InboundLedger::done()
|
||||
|
||||
if (complete_ && !failed_ && mLedger)
|
||||
{
|
||||
mLedger->setImmutable(app_.config());
|
||||
assert(mLedger->read(keylet::fees()));
|
||||
mLedger->setImmutable();
|
||||
switch (mReason)
|
||||
{
|
||||
case Reason::SHARD:
|
||||
|
||||
@@ -341,7 +341,8 @@ LedgerMaster::setValidLedger(std::shared_ptr<Ledger const> const& l)
|
||||
if (!standalone_)
|
||||
{
|
||||
auto validations = app_.validators().negativeUNLFilter(
|
||||
app_.getValidations().getTrustedForLedger(l->info().hash));
|
||||
app_.getValidations().getTrustedForLedger(
|
||||
l->info().hash, l->info().seq));
|
||||
times.reserve(validations.size());
|
||||
for (auto const& val : validations)
|
||||
times.push_back(val->getSignTime());
|
||||
@@ -865,10 +866,11 @@ LedgerMaster::fixMismatch(ReadView const& ledger)
|
||||
{
|
||||
hash = hashOfSeq(ledger, lSeq, m_journal);
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.warn())
|
||||
<< "fixMismatch encounters partial ledger";
|
||||
<< "fixMismatch encounters partial ledger. Exception: "
|
||||
<< ex.what();
|
||||
clearLedger(lSeq);
|
||||
return;
|
||||
}
|
||||
@@ -987,7 +989,7 @@ LedgerMaster::checkAccept(uint256 const& hash, std::uint32_t seq)
|
||||
return;
|
||||
|
||||
auto validations = app_.validators().negativeUNLFilter(
|
||||
app_.getValidations().getTrustedForLedger(hash));
|
||||
app_.getValidations().getTrustedForLedger(hash, seq));
|
||||
valCount = validations.size();
|
||||
if (valCount >= app_.validators().quorum())
|
||||
{
|
||||
@@ -1041,7 +1043,7 @@ LedgerMaster::checkAccept(std::shared_ptr<Ledger const> const& ledger)
|
||||
{
|
||||
// Can we accept this ledger as our new last fully-validated ledger
|
||||
|
||||
JLOG(m_journal.info()) << "=========> checkAccept (" << ledger->info().seq << ")\n";
|
||||
JLOG(m_journal.info()) << "checkAccept (" << ledger->info().seq << ")\n";
|
||||
|
||||
if (!canBeCurrent(ledger))
|
||||
return;
|
||||
@@ -1055,7 +1057,8 @@ LedgerMaster::checkAccept(std::shared_ptr<Ledger const> const& ledger)
|
||||
|
||||
auto const minVal = getNeededValidations();
|
||||
auto validations = app_.validators().negativeUNLFilter(
|
||||
app_.getValidations().getTrustedForLedger(ledger->info().hash));
|
||||
app_.getValidations().getTrustedForLedger(
|
||||
ledger->info().hash, ledger->info().seq));
|
||||
auto const tvc = validations.size();
|
||||
if (tvc < minVal) // nothing we can do
|
||||
{
|
||||
@@ -1072,7 +1075,7 @@ LedgerMaster::checkAccept(std::shared_ptr<Ledger const> const& ledger)
|
||||
ledger->setFull();
|
||||
setValidLedger(ledger);
|
||||
|
||||
JLOG(m_journal.info()) << "=========> checkAccept (" << ledger->info().seq << ") = validated\n";
|
||||
JLOG(m_journal.info()) << "checkAccept (" << ledger->info().seq << ") = validated\n";
|
||||
if (!mPubLedger)
|
||||
{
|
||||
pendSaveValidated(app_, ledger, true, true);
|
||||
@@ -1132,7 +1135,7 @@ LedgerMaster::checkAccept(std::shared_ptr<Ledger const> const& ledger)
|
||||
{
|
||||
// Have not printed the warning before, check if need to print.
|
||||
auto const vals = app_.getValidations().getTrustedForLedger(
|
||||
ledger->info().parentHash);
|
||||
ledger->info().parentHash, ledger->info().seq - 1);
|
||||
std::size_t higherVersionCount = 0;
|
||||
std::size_t rippledCount = 0;
|
||||
for (auto const& v : vals)
|
||||
@@ -1409,10 +1412,11 @@ LedgerMaster::findNewLedgersToPublish(
|
||||
JLOG(m_journal.trace())
|
||||
<< "ready to publish " << ret.size() << " ledgers.";
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.error())
|
||||
<< "Exception while trying to find ledgers to publish.";
|
||||
<< "Exception while trying to find ledgers to publish: "
|
||||
<< ex.what();
|
||||
}
|
||||
|
||||
if (app_.config().LEDGER_REPLAY)
|
||||
@@ -2011,9 +2015,10 @@ LedgerMaster::fetchForHistory(
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.warn()) << "Threw while prefetching";
|
||||
JLOG(m_journal.warn())
|
||||
<< "Threw while prefetching: " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2348,9 +2353,10 @@ LedgerMaster::makeFetchPack(
|
||||
|
||||
peer->send(msg);
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
JLOG(m_journal.warn()) << "Exception building fetch pach";
|
||||
JLOG(m_journal.warn())
|
||||
<< "Exception building fetch pach. Exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2367,4 +2373,25 @@ LedgerMaster::minSqlSeq()
|
||||
return app_.getRelationalDatabase().getMinLedgerSeq();
|
||||
}
|
||||
|
||||
std::optional<uint256>
|
||||
LedgerMaster::txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex)
|
||||
{
|
||||
uint32_t first = 0, last = 0;
|
||||
|
||||
if (!getValidatedRange(first, last) || last < ledgerSeq)
|
||||
return {};
|
||||
|
||||
auto const lgr = getLedgerBySeq(ledgerSeq);
|
||||
if (!lgr || lgr->txs.empty())
|
||||
return {};
|
||||
|
||||
for (auto it = lgr->txs.begin(); it != lgr->txs.end(); ++it)
|
||||
if (it->first && it->second &&
|
||||
it->second->isFieldPresent(sfTransactionIndex) &&
|
||||
it->second->getFieldU32(sfTransactionIndex) == txnIndex)
|
||||
return it->first->getTransactionID();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -192,9 +192,14 @@ fillJsonTx(Object& json, LedgerFill const& fill)
|
||||
appendAll(fill.ledger.txs);
|
||||
}
|
||||
}
|
||||
catch (std::exception const&)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
// Nothing the user can do about this.
|
||||
if (fill.context)
|
||||
{
|
||||
JLOG(fill.context->j.error())
|
||||
<< "Exception in " << __func__ << ": " << ex.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user