Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 5 additions & 75 deletions src/components/AmountAndDepthCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function FetchPriceComponent() {
const [timeError, setTimeError] = useState('');
const [volumeError, setVolumeError] = useState('');

// Effective volume tables from Gyuri's simulations (ν=16, logBucketSize 1-25, i.e. depth 17-41)
// Effective volume tables from Gyuri's simulations (ν=16, logBucketSize 1-18, i.e. depth 17-34)
// These account for batch utilization (0.1% failure quantile), PAC overhead, and erasure coding overhead.
// label: human-readable effective volume, gb: value in GB for comparison
const depthToEffectiveVolume = {
Expand All @@ -42,13 +42,6 @@ function FetchPriceComponent() {
32: { label: "17.07 TB", gb: 17479.68 },
33: { label: "34.36 TB", gb: 35184.64 },
34: { label: "69.04 TB", gb: 70696.96 },
35: { label: "138.54 TB", gb: 141864.96 },
36: { label: "277.72 TB", gb: 284385.28 },
37: { label: "556.35 TB", gb: 569702.40 },
38: { label: "1.11 PB", gb: 1163919.36 },
39: { label: "2.23 PB", gb: 2338324.48 },
40: { label: "4.46 PB", gb: 4676648.96 },
41: { label: "8.93 PB", gb: 9363783.68 },
},
medium: {
17: { label: "41.56 kB", gb: 0.000040 },
Expand All @@ -69,13 +62,6 @@ function FetchPriceComponent() {
32: { label: "15.87 TB", gb: 16250.88 },
33: { label: "31.94 TB", gb: 32706.56 },
34: { label: "64.19 TB", gb: 65730.56 },
35: { label: "128.80 TB", gb: 131891.20 },
36: { label: "258.19 TB", gb: 264386.56 },
37: { label: "517.23 TB", gb: 529643.52 },
38: { label: "1.04 PB", gb: 1090519.04 },
39: { label: "2.07 PB", gb: 2170552.32 },
40: { label: "4.15 PB", gb: 4351590.40 },
41: { label: "8.30 PB", gb: 8703180.80 },
},
strong: {
17: { label: "37.37 kB", gb: 0.000036 },
Expand All @@ -96,13 +82,6 @@ function FetchPriceComponent() {
32: { label: "14.27 TB", gb: 14612.48 },
33: { label: "28.72 TB", gb: 29409.28 },
34: { label: "57.71 TB", gb: 59095.04 },
35: { label: "115.81 TB", gb: 118589.44 },
36: { label: "232.16 TB", gb: 237731.84 },
37: { label: "465.07 TB", gb: 476231.68 },
38: { label: "931.23 TB", gb: 953579.52 },
39: { label: "1.86 PB", gb: 1950351.36 },
40: { label: "3.73 PB", gb: 3911188.48 },
41: { label: "7.46 PB", gb: 7822376.96 },
},
insane: {
17: { label: "33.88 kB", gb: 0.000032 },
Expand All @@ -123,13 +102,6 @@ function FetchPriceComponent() {
32: { label: "12.93 TB", gb: 13240.32 },
33: { label: "26.04 TB", gb: 26664.96 },
34: { label: "52.32 TB", gb: 53575.68 },
35: { label: "104.99 TB", gb: 107509.76 },
36: { label: "210.46 TB", gb: 215511.04 },
37: { label: "421.61 TB", gb: 431728.64 },
38: { label: "844.20 TB", gb: 864460.80 },
39: { label: "1.69 PB", gb: 1772093.44 },
40: { label: "3.38 PB", gb: 3544186.88 },
41: { label: "6.77 PB", gb: 7098859.52 },
},
paranoid: {
17: { label: "13.27 kB", gb: 0.000013 },
Expand All @@ -150,13 +122,6 @@ function FetchPriceComponent() {
32: { label: "5.07 TB", gb: 5191.68 },
33: { label: "10.20 TB", gb: 10444.80 },
34: { label: "20.50 TB", gb: 20992.00 },
35: { label: "41.13 TB", gb: 42117.12 },
36: { label: "82.45 TB", gb: 84428.80 },
37: { label: "165.17 TB", gb: 169134.08 },
38: { label: "330.72 TB", gb: 338657.28 },
39: { label: "661.97 TB", gb: 677857.28 },
40: { label: "1.32 PB", gb: 1384120.32 },
41: { label: "2.65 PB", gb: 2778726.40 },
},
},
encrypted: {
Expand All @@ -179,13 +144,6 @@ function FetchPriceComponent() {
32: { label: "16.93 TB", gb: 17336.32 },
33: { label: "34.09 TB", gb: 34908.16 },
34: { label: "68.50 TB", gb: 70144.00 },
35: { label: "137.45 TB", gb: 140748.80 },
36: { label: "275.53 TB", gb: 282142.72 },
37: { label: "551.97 TB", gb: 565217.28 },
38: { label: "1.11 PB", gb: 1163919.36 },
39: { label: "2.21 PB", gb: 2317352.96 },
40: { label: "4.43 PB", gb: 4645191.68 },
41: { label: "8.86 PB", gb: 9290383.36 },
},
medium: {
17: { label: "40.89 kB", gb: 0.000039 },
Expand All @@ -206,13 +164,6 @@ function FetchPriceComponent() {
32: { label: "15.61 TB", gb: 15984.64 },
33: { label: "31.43 TB", gb: 32184.32 },
34: { label: "63.15 TB", gb: 64665.60 },
35: { label: "126.71 TB", gb: 129751.04 },
36: { label: "254.01 TB", gb: 260106.24 },
37: { label: "508.85 TB", gb: 521062.40 },
38: { label: "1.02 PB", gb: 1069547.52 },
39: { label: "2.04 PB", gb: 2139095.04 },
40: { label: "4.08 PB", gb: 4278190.08 },
41: { label: "8.17 PB", gb: 8566865.92 },
},
strong: {
17: { label: "36.73 kB", gb: 0.000035 },
Expand All @@ -233,13 +184,6 @@ function FetchPriceComponent() {
32: { label: "14.02 TB", gb: 14356.48 },
33: { label: "28.23 TB", gb: 28907.52 },
34: { label: "56.72 TB", gb: 58081.28 },
35: { label: "113.82 TB", gb: 116551.68 },
36: { label: "228.18 TB", gb: 233656.32 },
37: { label: "457.10 TB", gb: 468070.40 },
38: { label: "915.26 TB", gb: 937226.24 },
39: { label: "1.83 PB", gb: 1918894.08 },
40: { label: "3.67 PB", gb: 3848273.92 },
41: { label: "7.34 PB", gb: 7696547.84 },
},
insane: {
17: { label: "33.26 kB", gb: 0.000032 },
Expand All @@ -260,13 +204,6 @@ function FetchPriceComponent() {
32: { label: "12.70 TB", gb: 13004.80 },
33: { label: "25.57 TB", gb: 26183.68 },
34: { label: "51.37 TB", gb: 52602.88 },
35: { label: "103.08 TB", gb: 105553.92 },
36: { label: "206.65 TB", gb: 211609.60 },
37: { label: "413.98 TB", gb: 423915.52 },
38: { label: "828.91 TB", gb: 848803.84 },
39: { label: "1.66 PB", gb: 1740636.16 },
40: { label: "3.32 PB", gb: 3481272.32 },
41: { label: "6.64 PB", gb: 6962544.64 },
},
paranoid: {
17: { label: "13.17 kB", gb: 0.000013 },
Expand All @@ -287,13 +224,6 @@ function FetchPriceComponent() {
32: { label: "5.03 TB", gb: 5150.72 },
33: { label: "10.12 TB", gb: 10362.88 },
34: { label: "20.34 TB", gb: 20828.16 },
35: { label: "40.80 TB", gb: 41779.20 },
36: { label: "81.80 TB", gb: 83763.20 },
37: { label: "163.87 TB", gb: 167802.88 },
38: { label: "328.11 TB", gb: 335984.64 },
39: { label: "656.76 TB", gb: 672522.24 },
40: { label: "1.31 PB", gb: 1373634.56 },
41: { label: "2.63 PB", gb: 2757754.88 },
},
},
};
Expand Down Expand Up @@ -370,7 +300,7 @@ function FetchPriceComponent() {

// Find the smallest depth whose effective volume (in GB) >= requested volume
let foundDepth = null;
for (let d = 17; d <= 41; d++) {
for (let d = 17; d <= 34; d++) {
if (table[d] && table[d].gb >= gigabytes) {
foundDepth = d;
break;
Expand All @@ -397,7 +327,7 @@ function FetchPriceComponent() {
};

const calculateMinimumDepth = (gigabytes) => {
for (let d = 17; d <= 41; d++) {
for (let d = 17; d <= 34; d++) {
if (gigabytes <= Math.pow(2, 12 + d) / (1024 ** 3)) {
return d;
}
Expand Down Expand Up @@ -447,9 +377,9 @@ function FetchPriceComponent() {

// Check against max effective volume for the selected settings
const table = getEffectiveVolumeTable();
const maxGb = table[41].gb;
const maxGb = table[34].gb;
if (gigabytes > maxGb) {
setVolumeError(`Volume exceeds maximum effective volume (${table[41].label}) for the selected encryption and erasure settings.`);
setVolumeError(`Volume exceeds maximum effective volume (${table[34].label}) for the selected encryption and erasure settings.`);
return 0;
}
return gigabytes;
Expand Down
36 changes: 13 additions & 23 deletions src/components/VolumeAndDurationCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,35 @@ export default function DepthCalc() {
21: "2.60 GB", 22: "7.73 GB", 23: "19.94 GB", 24: "47.06 GB",
25: "105.51 GB", 26: "227.98 GB", 27: "476.68 GB", 28: "993.65 GB",
29: "2.04 TB", 30: "4.17 TB", 31: "8.45 TB", 32: "17.07 TB",
33: "34.36 TB", 34: "69.04 TB", 35: "138.54 TB", 36: "277.72 TB",
37: "556.35 TB", 38: "1.11 PB", 39: "2.23 PB", 40: "4.46 PB", 41: "8.93 PB",
33: "34.36 TB", 34: "69.04 TB",
},
medium: {
17: "41.56 kB", 18: "6.19 MB", 19: "104.18 MB", 20: "639.27 MB",
21: "2.41 GB", 22: "7.18 GB", 23: "18.54 GB", 24: "43.75 GB",
25: "98.09 GB", 26: "211.95 GB", 27: "443.16 GB", 28: "923.78 GB",
29: "1.90 TB", 30: "3.88 TB", 31: "7.86 TB", 32: "15.87 TB",
33: "31.94 TB", 34: "64.19 TB", 35: "128.80 TB", 36: "258.19 TB",
37: "517.23 TB", 38: "1.04 PB", 39: "2.07 PB", 40: "4.15 PB", 41: "8.30 PB",
33: "31.94 TB", 34: "64.19 TB",
},
strong: {
17: "37.37 kB", 18: "5.57 MB", 19: "93.68 MB", 20: "574.81 MB",
21: "2.17 GB", 22: "6.46 GB", 23: "16.67 GB", 24: "39.34 GB",
25: "88.20 GB", 26: "190.58 GB", 27: "398.47 GB", 28: "830.63 GB",
29: "1.71 TB", 30: "3.49 TB", 31: "7.07 TB", 32: "14.27 TB",
33: "28.72 TB", 34: "57.71 TB", 35: "115.81 TB", 36: "232.16 TB",
37: "465.07 TB", 38: "931.23 TB", 39: "1.86 PB", 40: "3.73 PB", 41: "7.46 PB",
33: "28.72 TB", 34: "57.71 TB",
},
insane: {
17: "33.88 kB", 18: "5.05 MB", 19: "84.92 MB", 20: "521.09 MB",
21: "1.97 GB", 22: "5.86 GB", 23: "15.11 GB", 24: "35.66 GB",
25: "79.96 GB", 26: "172.77 GB", 27: "361.23 GB", 28: "753.00 GB",
29: "1.55 TB", 30: "3.16 TB", 31: "6.41 TB", 32: "12.93 TB",
33: "26.04 TB", 34: "52.32 TB", 35: "104.99 TB", 36: "210.46 TB",
37: "421.61 TB", 38: "844.20 TB", 39: "1.69 PB", 40: "3.38 PB", 41: "6.77 PB",
33: "26.04 TB", 34: "52.32 TB",
},
paranoid: {
17: "13.27 kB", 18: "1.98 MB", 19: "33.27 MB", 20: "204.14 MB",
21: "771.13 MB", 22: "2.29 GB", 23: "5.92 GB", 24: "13.97 GB",
25: "31.32 GB", 26: "67.68 GB", 27: "141.51 GB", 28: "294.99 GB",
29: "606.90 GB", 30: "1.24 TB", 31: "2.51 TB", 32: "5.07 TB",
33: "10.20 TB", 34: "20.50 TB", 35: "41.13 TB", 36: "82.45 TB",
37: "165.17 TB", 38: "330.72 TB", 39: "661.97 TB", 40: "1.32 PB", 41: "2.65 PB",
33: "10.20 TB", 34: "20.50 TB",
},
},
encrypted: {
Expand All @@ -62,40 +57,35 @@ export default function DepthCalc() {
21: "2.58 GB", 22: "7.67 GB", 23: "19.78 GB", 24: "46.69 GB",
25: "104.68 GB", 26: "226.19 GB", 27: "472.93 GB", 28: "985.83 GB",
29: "2.03 TB", 30: "4.14 TB", 31: "8.39 TB", 32: "16.93 TB",
33: "34.09 TB", 34: "68.50 TB", 35: "137.45 TB", 36: "275.53 TB",
37: "551.97 TB", 38: "1.11 PB", 39: "2.21 PB", 40: "4.43 PB", 41: "8.86 PB",
33: "34.09 TB", 34: "68.50 TB",
},
medium: {
17: "40.89 kB", 18: "6.09 MB", 19: "102.49 MB", 20: "628.91 MB",
21: "2.38 GB", 22: "7.07 GB", 23: "18.24 GB", 24: "43.04 GB",
25: "96.50 GB", 26: "208.52 GB", 27: "435.98 GB", 28: "908.81 GB",
29: "1.87 TB", 30: "3.81 TB", 31: "7.73 TB", 32: "15.61 TB",
33: "31.43 TB", 34: "63.15 TB", 35: "126.71 TB", 36: "254.01 TB",
37: "508.85 TB", 38: "1.02 PB", 39: "2.04 PB", 40: "4.08 PB", 41: "8.17 PB",
33: "31.43 TB", 34: "63.15 TB",
},
strong: {
17: "36.73 kB", 18: "5.47 MB", 19: "92.07 MB", 20: "564.95 MB",
21: "2.13 GB", 22: "6.35 GB", 23: "16.38 GB", 24: "38.66 GB",
25: "86.69 GB", 26: "187.31 GB", 27: "391.64 GB", 28: "816.39 GB",
29: "1.68 TB", 30: "3.43 TB", 31: "6.94 TB", 32: "14.02 TB",
33: "28.23 TB", 34: "56.72 TB", 35: "113.82 TB", 36: "228.18 TB",
37: "457.10 TB", 38: "915.26 TB", 39: "1.83 PB", 40: "3.67 PB", 41: "7.34 PB",
33: "28.23 TB", 34: "56.72 TB",
},
insane: {
17: "33.26 kB", 18: "4.96 MB", 19: "83.38 MB", 20: "511.65 MB",
21: "1.93 GB", 22: "5.75 GB", 23: "14.84 GB", 24: "35.02 GB",
25: "78.51 GB", 26: "169.64 GB", 27: "354.69 GB", 28: "739.37 GB",
29: "1.52 TB", 30: "3.10 TB", 31: "6.29 TB", 32: "12.70 TB",
33: "25.57 TB", 34: "51.37 TB", 35: "103.08 TB", 36: "206.65 TB",
37: "413.98 TB", 38: "828.91 TB", 39: "1.66 PB", 40: "3.32 PB", 41: "6.64 PB",
33: "25.57 TB", 34: "51.37 TB",
},
paranoid: {
17: "13.17 kB", 18: "1.96 MB", 19: "33.01 MB", 20: "202.53 MB",
21: "765.05 MB", 22: "2.28 GB", 23: "5.87 GB", 24: "13.86 GB",
25: "31.08 GB", 26: "67.15 GB", 27: "140.40 GB", 28: "292.67 GB",
29: "602.12 GB", 30: "1.23 TB", 31: "2.49 TB", 32: "5.03 TB",
33: "10.12 TB", 34: "20.34 TB", 35: "40.80 TB", 36: "81.80 TB",
37: "163.87 TB", 38: "328.11 TB", 39: "656.76 TB", 40: "1.31 PB", 41: "2.63 PB",
33: "10.12 TB", 34: "20.34 TB",
},
},
};
Expand Down Expand Up @@ -169,8 +159,8 @@ export default function DepthCalc() {
const amountValue = Number(cleanedAmount);
const minAmount = latestPrice * 17280;

if (!Number.isInteger(depthValue) || depthValue < 17 || depthValue > 41) {
localErrors.depth = "Depth must be an integer greater or equal to 17 and less than or equal to 41.";
if (!Number.isInteger(depthValue) || depthValue < 17 || depthValue > 34) {
localErrors.depth = "Depth must be an integer greater or equal to 17 and less than or equal to 34.";
}
if (!Number.isInteger(amountValue) || amountValue < minAmount) {
localErrors.amount = `Amount must be a positive whole number and at least ${minAmount} PLUR given the current storage price of ${latestPrice} PLUR/chunk/block.`;
Expand Down Expand Up @@ -227,7 +217,7 @@ export default function DepthCalc() {
</label>
<input
id="depthInput"
placeholder="Input batch depth (17 to 41)"
placeholder="Input batch depth (17 to 34)"
value={depth}
onChange={e => setDepth(e.target.value)}
style={{ display: 'block', marginBottom: '5px', padding: '8px' }}
Expand Down
Loading