Line data Source code
1 : #include "../shared/fd_config.h"
2 : #include "../../util/pod/fd_pod_format.h"
3 :
4 : #include "../../flamenco/runtime/fd_txncache.h"
5 : #include "../../flamenco/runtime/fd_blockstore.h"
6 : #include "../../flamenco/runtime/fd_runtime.h"
7 : #include "../../flamenco/runtime/fd_runtime_public.h"
8 :
9 0 : #define VAL(name) (__extension__({ \
10 0 : ulong __x = fd_pod_queryf_ulong( topo->props, ULONG_MAX, "obj.%lu.%s", obj->id, name ); \
11 0 : if( FD_UNLIKELY( __x==ULONG_MAX ) ) FD_LOG_ERR(( "obj.%lu.%s was not set", obj->id, name )); \
12 0 : __x; }))
13 :
14 : static ulong
15 : runtime_pub_footprint( fd_topo_t const * topo,
16 0 : fd_topo_obj_t const * obj ) {
17 0 : (void)topo;
18 0 : return fd_runtime_public_footprint( VAL("mem_max") );
19 0 : }
20 :
21 : static ulong
22 : runtime_pub_align( fd_topo_t const * topo FD_FN_UNUSED,
23 0 : fd_topo_obj_t const * obj FD_FN_UNUSED ) {
24 0 : return fd_runtime_public_align();
25 0 : }
26 :
27 : static void
28 : runtime_pub_new( fd_topo_t const * topo,
29 0 : fd_topo_obj_t const * obj ) {
30 0 : FD_TEST( fd_runtime_public_new( fd_topo_obj_laddr( topo, obj->id ), VAL("mem_max") ) );
31 0 : }
32 :
33 : fd_topo_obj_callbacks_t fd_obj_cb_runtime_pub = {
34 : .name = "runtime_pub",
35 : .footprint = runtime_pub_footprint,
36 : .align = runtime_pub_align,
37 : .new = runtime_pub_new,
38 : };
39 :
40 : static ulong
41 : banks_footprint( fd_topo_t const * topo,
42 0 : fd_topo_obj_t const * obj ) {
43 0 : return fd_banks_footprint( VAL("max_banks") );
44 0 : }
45 :
46 : static ulong
47 : banks_align( fd_topo_t const * topo FD_FN_UNUSED,
48 0 : fd_topo_obj_t const * obj FD_FN_UNUSED ) {
49 0 : return fd_banks_align();
50 0 : }
51 :
52 : static void
53 : banks_new( fd_topo_t const * topo,
54 0 : fd_topo_obj_t const * obj ) {
55 0 : FD_TEST( fd_banks_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_banks") ) );
56 0 : }
57 :
58 : fd_topo_obj_callbacks_t fd_obj_cb_banks = {
59 : .name = "banks",
60 : .footprint = banks_footprint,
61 : .align = banks_align,
62 : .new = banks_new,
63 : };
64 :
65 : static ulong
66 : bh_cmp_footprint( fd_topo_t const * topo,
67 0 : fd_topo_obj_t const * obj ) {
68 0 : (void)topo; (void)obj;
69 0 : return fd_bank_hash_cmp_footprint();
70 0 : }
71 :
72 : static ulong
73 : bh_cmp_align( fd_topo_t const * topo,
74 0 : fd_topo_obj_t const * obj ) {
75 0 : (void)topo; (void)obj;
76 0 : return fd_bank_hash_cmp_align();
77 0 : }
78 :
79 : static void
80 : bh_cmp_new( fd_topo_t const * topo,
81 0 : fd_topo_obj_t const * obj ) {
82 0 : (void)topo; (void)obj;
83 0 : FD_TEST( fd_bank_hash_cmp_new( fd_topo_obj_laddr( topo, obj->id ) ) );
84 0 : }
85 :
86 : fd_topo_obj_callbacks_t fd_obj_cb_bank_hash_cmp = {
87 : .name = "bh_cmp",
88 : .footprint = bh_cmp_footprint,
89 : .align = bh_cmp_align,
90 : .new = bh_cmp_new,
91 : };
92 :
93 : static ulong
94 : funk_align( fd_topo_t const * topo,
95 0 : fd_topo_obj_t const * obj ) {
96 0 : (void)topo; (void)obj;
97 0 : return fd_funk_align();
98 0 : }
99 :
100 : static ulong
101 : funk_footprint( fd_topo_t const * topo,
102 0 : fd_topo_obj_t const * obj ) {
103 0 : (void)topo;
104 0 : return fd_funk_footprint( VAL("txn_max"), VAL("rec_max") );
105 0 : }
106 :
107 : static ulong
108 : funk_loose( fd_topo_t const * topo,
109 0 : fd_topo_obj_t const * obj ) {
110 0 : (void)topo;
111 0 : return VAL("heap_max");
112 0 : }
113 :
114 : static void
115 : funk_new( fd_topo_t const * topo,
116 0 : fd_topo_obj_t const * obj ) {
117 0 : (void)topo;
118 0 : ulong funk_seed = fd_pod_queryf_ulong( topo->props, 0UL, "obj.%lu.seed", obj->id );
119 0 : if( !funk_seed ) FD_TEST( fd_rng_secure( &funk_seed, sizeof(ulong) ) );
120 0 : FD_TEST( fd_funk_new( fd_topo_obj_laddr( topo, obj->id ), 2UL, funk_seed, VAL("txn_max"), VAL("rec_max") ) );
121 0 : }
122 :
123 : fd_topo_obj_callbacks_t fd_obj_cb_funk = {
124 : .name = "funk",
125 : .footprint = funk_footprint,
126 : .loose = funk_loose,
127 : .align = funk_align,
128 : .new = funk_new,
129 : };
130 :
131 : static ulong
132 : blockstore_footprint( fd_topo_t const * topo,
133 0 : fd_topo_obj_t const * obj ) {
134 0 : return fd_blockstore_footprint( VAL("shred_max"), VAL("block_max"), VAL("idx_max"), VAL("txn_max") ) + VAL("alloc_max");
135 0 : }
136 :
137 : static ulong
138 : blockstore_align( fd_topo_t const * topo FD_FN_UNUSED,
139 0 : fd_topo_obj_t const * obj FD_FN_UNUSED ) {
140 0 : return fd_blockstore_align();
141 0 : }
142 :
143 : static void
144 : blockstore_new( fd_topo_t const * topo,
145 0 : fd_topo_obj_t const * obj ) {
146 0 : FD_TEST( fd_blockstore_new( fd_topo_obj_laddr( topo, obj->id ), VAL("wksp_tag"), VAL("seed"), VAL("shred_max"), VAL("block_max"), VAL("idx_max"), VAL("txn_max") ) );
147 0 : }
148 :
149 : fd_topo_obj_callbacks_t fd_obj_cb_blockstore = {
150 : .name = "blockstore",
151 : .footprint = blockstore_footprint,
152 : .align = blockstore_align,
153 : .new = blockstore_new,
154 : };
155 :
156 : static ulong
157 : fec_sets_footprint( fd_topo_t const * topo,
158 0 : fd_topo_obj_t const * obj ) {
159 0 : return VAL("sz");
160 0 : }
161 :
162 : static ulong
163 : fec_sets_align( fd_topo_t const * topo FD_FN_UNUSED,
164 0 : fd_topo_obj_t const * obj FD_FN_UNUSED ) {
165 0 : return fd_dcache_align();
166 0 : }
167 :
168 : static void
169 : fec_sets_new( FD_PARAM_UNUSED fd_topo_t const * topo,
170 0 : FD_PARAM_UNUSED fd_topo_obj_t const * obj ) {
171 0 : FD_TEST( fd_topo_obj_laddr( topo, obj->id ) );
172 0 : }
173 :
174 : fd_topo_obj_callbacks_t fd_obj_cb_fec_sets = {
175 : .name = "fec_sets",
176 : .footprint = fec_sets_footprint,
177 : .align = fec_sets_align,
178 : .new = fec_sets_new,
179 : };
180 :
181 : static ulong
182 : txncache_footprint( fd_topo_t const * topo,
183 0 : fd_topo_obj_t const * obj ) {
184 0 : return fd_txncache_footprint( VAL("max_rooted_slots"), VAL("max_live_slots"), VAL("max_txn_per_slot"), VAL("max_constipated_slots") );
185 0 : }
186 :
187 : static ulong
188 : txncache_align( fd_topo_t const * topo FD_FN_UNUSED,
189 0 : fd_topo_obj_t const * obj FD_FN_UNUSED ) {
190 0 : return fd_txncache_align();
191 0 : }
192 :
193 : static void
194 : txncache_new( fd_topo_t const * topo,
195 0 : fd_topo_obj_t const * obj ) {
196 0 : FD_TEST( fd_txncache_new( fd_topo_obj_laddr( topo, obj->id ), VAL("max_rooted_slots"), VAL("max_live_slots"), VAL("max_txn_per_slot"), VAL("max_constipated_slots") ) );
197 0 : }
198 :
199 : fd_topo_obj_callbacks_t fd_obj_cb_txncache = {
200 : .name = "txncache",
201 : .footprint = txncache_footprint,
202 : .align = txncache_align,
203 : .new = txncache_new,
204 : };
205 :
206 : static ulong
207 : exec_spad_footprint( fd_topo_t const * topo FD_FN_UNUSED,
208 0 : fd_topo_obj_t const * obj FD_FN_UNUSED ) {
209 0 : return fd_spad_footprint( FD_RUNTIME_TRANSACTION_EXECUTION_FOOTPRINT_DEFAULT );
210 0 : }
211 :
212 : static ulong
213 : exec_spad_align( fd_topo_t const * topo FD_FN_UNUSED,
214 0 : fd_topo_obj_t const * obj FD_FN_UNUSED ) {
215 0 : return fd_spad_align();
216 0 : }
217 :
218 : static void
219 : exec_spad_new( fd_topo_t const * topo,
220 0 : fd_topo_obj_t const * obj ) {
221 0 : FD_TEST( fd_spad_new( fd_topo_obj_laddr( topo, obj->id ), FD_RUNTIME_TRANSACTION_EXECUTION_FOOTPRINT_DEFAULT ) );
222 0 : }
223 :
224 : fd_topo_obj_callbacks_t fd_obj_cb_exec_spad = {
225 : .name = "exec_spad",
226 : .footprint = exec_spad_footprint,
227 : .align = exec_spad_align,
228 : .new = exec_spad_new,
229 : };
230 :
231 : #undef VAL
|