Skip to content

Commit a406d4b

Browse files
authored
Merge pull request #4197 from sisuresh/phase1-testnet
Update soroban settings files and utils Reviewed-by: dmkozh
2 parents ccd6f55 + 8b1d8f1 commit a406d4b

File tree

7 files changed

+321
-28
lines changed

7 files changed

+321
-28
lines changed

docs/software/soroban-settings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ how the settings upgrade mechanism works internally. **If you are just being ask
1515
to vote for an upgrade, please move on to the [Examine a proposed upgrade](#examine-a-proposed-upgrade) step for details on how to examine a
1616
proposed upgrade.**
1717

18-
1. Using the stellar-xdr rust tool and a JSON file as input, run `stellar-xdr encode --type ConfigUpgradeSet JSON_FILE`. [phase1.json](../../soroban-settings/phase1.json) can be used as a template to propose upgrades.
18+
1. Using the stellar-xdr rust tool and a JSON file as input, run `stellar-xdr encode --type ConfigUpgradeSet JSON_FILE`. [pubnet_phase1.json](../../soroban-settings/pubnet_phase1.json) can be used as a template to propose upgrades.
1919
- Example output - `AAAAAQAAAAsAAAAM` (note that this string can be much larger depending on the settings you're upgrading)
2020
- stellar-xdr can be installed with brew (`brew install stellar/tap/stellar-xdr`) or cargo (``cargo install --locked stellar-xdr --features cli``). You can also download the binary for your system here https://github.com/stellar/rs-stellar-xdr/releases/latest.
2121

soroban-settings/phase1.json soroban-settings/pubnet_phase1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"fee_read_ledger_entry": 6250,
2525
"fee_write_ledger_entry": 10000,
2626
"fee_read1_kb": 1786,
27-
"bucket_list_target_size_bytes": 13958643712,
27+
"bucket_list_target_size_bytes": 13000000000,
2828
"write_fee1_kb_bucket_list_low": -1234673,
2929
"write_fee1_kb_bucket_list_high": 115390,
3030
"bucket_list_write_fee_growth_factor": 1000
+315
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
{
2+
"updated_entry": [
3+
{
4+
"contract_max_size_bytes": 65536
5+
},
6+
{
7+
"contract_compute_v0": {
8+
"ledger_max_instructions": 100000000,
9+
"tx_max_instructions": 100000000,
10+
"fee_rate_per_instructions_increment": 25,
11+
"tx_memory_limit": 41943040
12+
}
13+
},
14+
{
15+
"contract_ledger_cost_v0": {
16+
"ledger_max_read_ledger_entries": 40,
17+
"ledger_max_read_bytes": 133120,
18+
"ledger_max_write_ledger_entries": 25,
19+
"ledger_max_write_bytes": 66560,
20+
"tx_max_read_ledger_entries": 40,
21+
"tx_max_read_bytes": 133120,
22+
"tx_max_write_ledger_entries": 25,
23+
"tx_max_write_bytes": 66560,
24+
"fee_read_ledger_entry": 6250,
25+
"fee_write_ledger_entry": 10000,
26+
"fee_read1_kb": 1786,
27+
"bucket_list_target_size_bytes": 200000000,
28+
"write_fee1_kb_bucket_list_low": -12034,
29+
"write_fee1_kb_bucket_list_high": 115390,
30+
"bucket_list_write_fee_growth_factor": 1000
31+
}
32+
},
33+
{
34+
"contract_historical_data_v0": {
35+
"fee_historical1_kb": 16235
36+
}
37+
},
38+
{
39+
"contract_events_v0": {
40+
"tx_max_contract_events_size_bytes": 8198,
41+
"fee_contract_events1_kb": 10000
42+
}
43+
},
44+
{
45+
"contract_bandwidth_v0": {
46+
"ledger_max_txs_size_bytes": 71680,
47+
"tx_max_size_bytes": 71680,
48+
"fee_tx_size1_kb": 1624
49+
}
50+
},
51+
{
52+
"contract_cost_params_cpu_instructions": [
53+
{
54+
"ext": "v0",
55+
"const_term": 4,
56+
"linear_term": 0
57+
},
58+
{
59+
"ext": "v0",
60+
"const_term": 434,
61+
"linear_term": 16
62+
},
63+
{
64+
"ext": "v0",
65+
"const_term": 42,
66+
"linear_term": 16
67+
},
68+
{
69+
"ext": "v0",
70+
"const_term": 44,
71+
"linear_term": 16
72+
},
73+
{
74+
"ext": "v0",
75+
"const_term": 295,
76+
"linear_term": 0
77+
},
78+
{
79+
"ext": "v0",
80+
"const_term": 60,
81+
"linear_term": 0
82+
},
83+
{
84+
"ext": "v0",
85+
"const_term": 221,
86+
"linear_term": 26
87+
},
88+
{
89+
"ext": "v0",
90+
"const_term": 331,
91+
"linear_term": 4369
92+
},
93+
{
94+
"ext": "v0",
95+
"const_term": 3636,
96+
"linear_term": 7013
97+
},
98+
{
99+
"ext": "v0",
100+
"const_term": 40256,
101+
"linear_term": 0
102+
},
103+
{
104+
"ext": "v0",
105+
"const_term": 377551,
106+
"linear_term": 4059
107+
},
108+
{
109+
"ext": "v0",
110+
"const_term": 417482,
111+
"linear_term": 45712
112+
},
113+
{
114+
"ext": "v0",
115+
"const_term": 417482,
116+
"linear_term": 45712
117+
},
118+
{
119+
"ext": "v0",
120+
"const_term": 1945,
121+
"linear_term": 0
122+
},
123+
{
124+
"ext": "v0",
125+
"const_term": 6481,
126+
"linear_term": 5943
127+
},
128+
{
129+
"ext": "v0",
130+
"const_term": 711,
131+
"linear_term": 0
132+
},
133+
{
134+
"ext": "v0",
135+
"const_term": 2314804,
136+
"linear_term": 0
137+
},
138+
{
139+
"ext": "v0",
140+
"const_term": 4176,
141+
"linear_term": 0
142+
},
143+
{
144+
"ext": "v0",
145+
"const_term": 4716,
146+
"linear_term": 0
147+
},
148+
{
149+
"ext": "v0",
150+
"const_term": 4680,
151+
"linear_term": 0
152+
},
153+
{
154+
"ext": "v0",
155+
"const_term": 4256,
156+
"linear_term": 0
157+
},
158+
{
159+
"ext": "v0",
160+
"const_term": 884,
161+
"linear_term": 0
162+
},
163+
{
164+
"ext": "v0",
165+
"const_term": 1059,
166+
"linear_term": 502
167+
}
168+
]
169+
},
170+
{
171+
"contract_cost_params_memory_bytes": [
172+
{
173+
"ext": "v0",
174+
"const_term": 0,
175+
"linear_term": 0
176+
},
177+
{
178+
"ext": "v0",
179+
"const_term": 16,
180+
"linear_term": 128
181+
},
182+
{
183+
"ext": "v0",
184+
"const_term": 0,
185+
"linear_term": 0
186+
},
187+
{
188+
"ext": "v0",
189+
"const_term": 0,
190+
"linear_term": 0
191+
},
192+
{
193+
"ext": "v0",
194+
"const_term": 0,
195+
"linear_term": 0
196+
},
197+
{
198+
"ext": "v0",
199+
"const_term": 0,
200+
"linear_term": 0
201+
},
202+
{
203+
"ext": "v0",
204+
"const_term": 242,
205+
"linear_term": 384
206+
},
207+
{
208+
"ext": "v0",
209+
"const_term": 0,
210+
"linear_term": 384
211+
},
212+
{
213+
"ext": "v0",
214+
"const_term": 0,
215+
"linear_term": 0
216+
},
217+
{
218+
"ext": "v0",
219+
"const_term": 0,
220+
"linear_term": 0
221+
},
222+
{
223+
"ext": "v0",
224+
"const_term": 0,
225+
"linear_term": 0
226+
},
227+
{
228+
"ext": "v0",
229+
"const_term": 132773,
230+
"linear_term": 4903
231+
},
232+
{
233+
"ext": "v0",
234+
"const_term": 132773,
235+
"linear_term": 4903
236+
},
237+
{
238+
"ext": "v0",
239+
"const_term": 14,
240+
"linear_term": 0
241+
},
242+
{
243+
"ext": "v0",
244+
"const_term": 0,
245+
"linear_term": 0
246+
},
247+
{
248+
"ext": "v0",
249+
"const_term": 0,
250+
"linear_term": 0
251+
},
252+
{
253+
"ext": "v0",
254+
"const_term": 181,
255+
"linear_term": 0
256+
},
257+
{
258+
"ext": "v0",
259+
"const_term": 99,
260+
"linear_term": 0
261+
},
262+
{
263+
"ext": "v0",
264+
"const_term": 99,
265+
"linear_term": 0
266+
},
267+
{
268+
"ext": "v0",
269+
"const_term": 99,
270+
"linear_term": 0
271+
},
272+
{
273+
"ext": "v0",
274+
"const_term": 99,
275+
"linear_term": 0
276+
},
277+
{
278+
"ext": "v0",
279+
"const_term": 99,
280+
"linear_term": 0
281+
},
282+
{
283+
"ext": "v0",
284+
"const_term": 0,
285+
"linear_term": 0
286+
}
287+
]
288+
},
289+
{
290+
"contract_data_key_size_bytes": 300
291+
},
292+
{
293+
"contract_data_entry_size_bytes": 65536
294+
},
295+
{
296+
"state_archival": {
297+
"max_entry_ttl": 3110400,
298+
"min_temporary_ttl": 17280,
299+
"min_persistent_ttl": 2073600,
300+
"persistent_rent_rate_denominator": 535680,
301+
"temp_rent_rate_denominator": 5356800,
302+
"max_entries_to_archive": 100,
303+
"bucket_list_size_window_sample_size": 30,
304+
"bucket_list_window_sample_period": 64,
305+
"eviction_scan_size": 100000,
306+
"starting_eviction_scan_level": 7
307+
}
308+
},
309+
{
310+
"contract_execution_lanes": {
311+
"ledger_max_tx_count": 100
312+
}
313+
}
314+
]
315+
}

src/main/SettingsUpgradeUtils.cpp

+2-11
Original file line numberDiff line numberDiff line change
@@ -141,21 +141,12 @@ getCreateTx(PublicKey const& publicKey, LedgerKey const& contractCodeLedgerKey,
141141
void
142142
validateConfigUpgradeSet(ConfigUpgradeSet const& upgradeSet)
143143
{
144-
// As of 12/22/2023, this is roughly the size of the buckets. This is used
145-
// in a safety check to prevent us from accidentally reducing the target
146-
// size to a point where upgrade becomes prohibitively expensive. We also
147-
// make sure the growth factor has an upper bound here. This file is just
148-
// used by our command line tooling, so we can update this value whenever we
149-
// want.
150-
static const uint64_t CURRENT_LEDGER_SIZE = 12'500'000'000;
151144
for (auto const& entry : upgradeSet.updatedEntry)
152145
{
153146
if (entry.configSettingID() == CONFIG_SETTING_CONTRACT_LEDGER_COST_V0)
154147
{
155-
if (entry.contractLedgerCost().bucketListTargetSizeBytes <
156-
CURRENT_LEDGER_SIZE * .95 ||
157-
entry.contractLedgerCost().bucketListWriteFeeGrowthFactor >
158-
50'000)
148+
if (entry.contractLedgerCost().bucketListWriteFeeGrowthFactor >
149+
50'000)
159150
{
160151
throw std::runtime_error("Invalid contractLedgerCost");
161152
}

src/transactions/test/InvokeHostFunctionTests.cpp

+2-13
Original file line numberDiff line numberDiff line change
@@ -2679,7 +2679,8 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]")
26792679

26802680
// We're writing the latest cpu and mem settings below to makes sure
26812681
// they don't brick the settings upgrade process. We would ideally pull
2682-
// this from phase1.json, but core doesn't know how to parse JSON XDR.
2682+
// this from pubnet_phase1.json, but core doesn't know how to parse JSON
2683+
// XDR.
26832684
auto const& vals = xdr::xdr_traits<ContractCostType>::enum_values();
26842685
if (entry.current().data.configSetting().configSettingID() ==
26852686
CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS)
@@ -3139,18 +3140,6 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]")
31393140
CONFIG_SETTING_CONTRACT_LEDGER_COST_V0;
31403141
});
31413142

3142-
SECTION("Invalid bucketListTargetSizeBytes")
3143-
{
3144-
// 10GB is too low due to the check in validateConfigUpgradeSet
3145-
costEntryIter->contractLedgerCost().bucketListTargetSizeBytes =
3146-
10'000'000'000;
3147-
REQUIRE_THROWS_AS(
3148-
getInvokeTx(a1.getPublicKey(), contractCodeLedgerKey,
3149-
contractSourceRefLedgerKey, contractID, upgradeSet,
3150-
a1.getLastSequenceNumber() + 3),
3151-
std::runtime_error);
3152-
}
3153-
31543143
SECTION("Invalid bucketListWriteFeeGrowthFactor")
31553144
{
31563145
// Value is too high due to the check in validateConfigUpgradeSet

test-tx-meta-baseline-current/InvokeHostFunctionTests.json

-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,6 @@
13371337
"TByXElZpITE=",
13381338
"TByXElZpITE=",
13391339
"TByXElZpITE=",
1340-
"TByXElZpITE=",
13411340
"TByXElZpITE="
13421341
],
13431342
"state archival" :

0 commit comments

Comments
 (0)