Skip to content

Update JSON schema for multiple types to use anyOf - #5396

Merged
wemeetagain merged 1 commit into
unstablefrom
nflaig/update-multi-type-schemas
Apr 21, 2023
Merged

Update JSON schema for multiple types to use anyOf#5396
wemeetagain merged 1 commit into
unstablefrom
nflaig/update-multi-type-schemas

Conversation

@nflaig

@nflaig nflaig commented Apr 21, 2023

Copy link
Copy Markdown
Member

Motivation

With update to Fastify v4 in #5369, Ajv has been upgraded to v8, meaning "type" keywords with multiple types other than "null" are now prohibited.

This change gets rid of the following warning logs

strict mode: use allowUnionTypes to allow union type keyword at "#/properties/id/items" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/id/items" (strictTypes)

Description

Updates JSON schema for multiple types to use anyOf as recommended in Fastify v4 migration guide.

@nflaig
nflaig requested a review from a team as a code owner April 21, 2023 13:02
@nflaig
nflaig force-pushed the nflaig/update-multi-type-schemas branch from 331f77e to 3ad6687 Compare April 21, 2023 13:03
@github-actions

github-actions Bot commented Apr 21, 2023

Copy link
Copy Markdown
Contributor

Performance Report

鉁旓笍 no performance regression detected

Full benchmark results
Benchmark suite Current: 873a358 Previous: fb192bf Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 821.25 us/op 721.78 us/op 1.14
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 46.831 us/op 48.913 us/op 0.96
BLS verify - blst-native 1.2322 ms/op 1.2447 ms/op 0.99
BLS verifyMultipleSignatures 3 - blst-native 2.5100 ms/op 2.5650 ms/op 0.98
BLS verifyMultipleSignatures 8 - blst-native 5.4352 ms/op 5.5203 ms/op 0.98
BLS verifyMultipleSignatures 32 - blst-native 20.559 ms/op 19.837 ms/op 1.04
BLS aggregatePubkeys 32 - blst-native 26.866 us/op 26.935 us/op 1.00
BLS aggregatePubkeys 128 - blst-native 102.44 us/op 103.38 us/op 0.99
getAttestationsForBlock 61.011 ms/op 64.471 ms/op 0.95
isKnown best case - 1 super set check 285.00 ns/op 279.00 ns/op 1.02
isKnown normal case - 2 super set checks 270.00 ns/op 275.00 ns/op 0.98
isKnown worse case - 16 super set checks 262.00 ns/op 273.00 ns/op 0.96
CheckpointStateCache - add get delete 5.2280 us/op 6.2390 us/op 0.84
validate gossip signedAggregateAndProof - struct 2.8228 ms/op 2.8864 ms/op 0.98
validate gossip attestation - struct 1.3386 ms/op 1.3822 ms/op 0.97
pickEth1Vote - no votes 1.3052 ms/op 1.4212 ms/op 0.92
pickEth1Vote - max votes 10.170 ms/op 10.615 ms/op 0.96
pickEth1Vote - Eth1Data hashTreeRoot value x2048 9.1126 ms/op 9.4887 ms/op 0.96
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 14.356 ms/op 17.723 ms/op 0.81
pickEth1Vote - Eth1Data fastSerialize value x2048 699.83 us/op 804.53 us/op 0.87
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.8092 ms/op 9.3120 ms/op 0.52
bytes32 toHexString 546.00 ns/op 952.00 ns/op 0.57
bytes32 Buffer.toString(hex) 403.00 ns/op 461.00 ns/op 0.87
bytes32 Buffer.toString(hex) from Uint8Array 628.00 ns/op 697.00 ns/op 0.90
bytes32 Buffer.toString(hex) + 0x 397.00 ns/op 476.00 ns/op 0.83
Object access 1 prop 0.17400 ns/op 0.24000 ns/op 0.72
Map access 1 prop 0.17000 ns/op 0.17700 ns/op 0.96
Object get x1000 6.6570 ns/op 8.3250 ns/op 0.80
Map get x1000 0.61100 ns/op 0.73300 ns/op 0.83
Object set x1000 58.022 ns/op 86.286 ns/op 0.67
Map set x1000 46.517 ns/op 64.053 ns/op 0.73
Return object 10000 times 0.25500 ns/op 0.30460 ns/op 0.84
Throw Error 10000 times 4.4316 us/op 4.7827 us/op 0.93
fastMsgIdFn sha256 / 200 bytes 3.6700 us/op 3.8580 us/op 0.95
fastMsgIdFn h32 xxhash / 200 bytes 323.00 ns/op 358.00 ns/op 0.90
fastMsgIdFn h64 xxhash / 200 bytes 487.00 ns/op 546.00 ns/op 0.89
fastMsgIdFn sha256 / 1000 bytes 12.066 us/op 12.280 us/op 0.98
fastMsgIdFn h32 xxhash / 1000 bytes 436.00 ns/op 515.00 ns/op 0.85
fastMsgIdFn h64 xxhash / 1000 bytes 542.00 ns/op 601.00 ns/op 0.90
fastMsgIdFn sha256 / 10000 bytes 104.24 us/op 108.73 us/op 0.96
fastMsgIdFn h32 xxhash / 10000 bytes 1.9650 us/op 2.1120 us/op 0.93
fastMsgIdFn h64 xxhash / 10000 bytes 1.4420 us/op 1.5380 us/op 0.94
enrSubnets - fastDeserialize 64 bits 1.5490 us/op 1.9040 us/op 0.81
enrSubnets - ssz BitVector 64 bits 499.00 ns/op 696.00 ns/op 0.72
enrSubnets - fastDeserialize 4 bits 190.00 ns/op 243.00 ns/op 0.78
enrSubnets - ssz BitVector 4 bits 580.00 ns/op 707.00 ns/op 0.82
prioritizePeers score -10:0 att 32-0.1 sync 2-0 132.35 us/op 129.23 us/op 1.02
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 157.19 us/op 181.94 us/op 0.86
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 200.03 us/op 239.46 us/op 0.84
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 397.64 us/op 374.13 us/op 1.06
prioritizePeers score 0:0 att 64-1 sync 4-1 432.19 us/op 435.76 us/op 0.99
array of 16000 items push then shift 1.6766 us/op 1.7801 us/op 0.94
LinkedList of 16000 items push then shift 9.0880 ns/op 10.026 ns/op 0.91
array of 16000 items push then pop 111.29 ns/op 114.63 ns/op 0.97
LinkedList of 16000 items push then pop 8.9430 ns/op 9.5000 ns/op 0.94
array of 24000 items push then shift 2.4212 us/op 2.4945 us/op 0.97
LinkedList of 24000 items push then shift 8.9700 ns/op 10.233 ns/op 0.88
array of 24000 items push then pop 81.993 ns/op 92.094 ns/op 0.89
LinkedList of 24000 items push then pop 8.7780 ns/op 10.441 ns/op 0.84
intersect bitArray bitLen 8 13.565 ns/op 32.375 ns/op 0.42
intersect array and set length 8 94.841 ns/op 102.72 ns/op 0.92
intersect bitArray bitLen 128 45.175 ns/op 70.377 ns/op 0.64
intersect array and set length 128 1.2015 us/op 1.3294 us/op 0.90
Buffer.concat 32 items 2.7650 us/op 3.2410 us/op 0.85
Uint8Array.set 32 items 2.5440 us/op 2.7410 us/op 0.93
pass gossip attestations to forkchoice per slot 3.2613 ms/op 3.4681 ms/op 0.94
computeDeltas 3.1427 ms/op 3.4194 ms/op 0.92
computeProposerBoostScoreFromBalances 1.7721 ms/op 1.8748 ms/op 0.95
altair processAttestation - 250000 vs - 7PWei normalcase 2.1898 ms/op 3.4719 ms/op 0.63
altair processAttestation - 250000 vs - 7PWei worstcase 3.3327 ms/op 4.7791 ms/op 0.70
altair processAttestation - setStatus - 1/6 committees join 145.13 us/op 150.73 us/op 0.96
altair processAttestation - setStatus - 1/3 committees join 280.62 us/op 284.46 us/op 0.99
altair processAttestation - setStatus - 1/2 committees join 368.96 us/op 394.67 us/op 0.93
altair processAttestation - setStatus - 2/3 committees join 470.78 us/op 478.49 us/op 0.98
altair processAttestation - setStatus - 4/5 committees join 673.75 us/op 687.19 us/op 0.98
altair processAttestation - setStatus - 100% committees join 780.96 us/op 786.03 us/op 0.99
altair processBlock - 250000 vs - 7PWei normalcase 17.188 ms/op 19.866 ms/op 0.87
altair processBlock - 250000 vs - 7PWei normalcase hashState 27.178 ms/op 29.611 ms/op 0.92
altair processBlock - 250000 vs - 7PWei worstcase 58.903 ms/op 57.298 ms/op 1.03
altair processBlock - 250000 vs - 7PWei worstcase hashState 67.826 ms/op 78.047 ms/op 0.87
phase0 processBlock - 250000 vs - 7PWei normalcase 2.0140 ms/op 2.4653 ms/op 0.82
phase0 processBlock - 250000 vs - 7PWei worstcase 28.586 ms/op 31.087 ms/op 0.92
altair processEth1Data - 250000 vs - 7PWei normalcase 466.20 us/op 643.19 us/op 0.72
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 6.9380 us/op 10.827 us/op 0.64
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 23.102 us/op 32.762 us/op 0.71
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 10.461 us/op 15.159 us/op 0.69
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 6.9380 us/op 13.689 us/op 0.51
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 101.43 us/op 113.98 us/op 0.89
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 670.63 us/op 778.15 us/op 0.86
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 914.20 us/op 1.0975 ms/op 0.83
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 924.94 us/op 941.57 us/op 0.98
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.4265 ms/op 3.1660 ms/op 0.77
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.4913 ms/op 1.7494 ms/op 0.85
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 3.9238 ms/op 4.4430 ms/op 0.88
Tree 40 250000 create 320.92 ms/op 582.73 ms/op 0.55
Tree 40 250000 get(125000) 186.54 ns/op 203.38 ns/op 0.92
Tree 40 250000 set(125000) 1.0759 us/op 1.3292 us/op 0.81
Tree 40 250000 toArray() 18.159 ms/op 29.882 ms/op 0.61
Tree 40 250000 iterate all - toArray() + loop 18.340 ms/op 28.727 ms/op 0.64
Tree 40 250000 iterate all - get(i) 73.922 ms/op 80.826 ms/op 0.91
MutableVector 250000 create 10.470 ms/op 11.643 ms/op 0.90
MutableVector 250000 get(125000) 6.3010 ns/op 7.1360 ns/op 0.88
MutableVector 250000 set(125000) 259.83 ns/op 521.70 ns/op 0.50
MutableVector 250000 toArray() 3.3132 ms/op 4.4363 ms/op 0.75
MutableVector 250000 iterate all - toArray() + loop 3.4929 ms/op 4.8298 ms/op 0.72
MutableVector 250000 iterate all - get(i) 1.5418 ms/op 1.6995 ms/op 0.91
Array 250000 create 3.0058 ms/op 4.3538 ms/op 0.69
Array 250000 clone - spread 1.2063 ms/op 1.4609 ms/op 0.83
Array 250000 get(125000) 0.61000 ns/op 0.91300 ns/op 0.67
Array 250000 set(125000) 0.63800 ns/op 1.1750 ns/op 0.54
Array 250000 iterate all - loop 105.39 us/op 113.18 us/op 0.93
effectiveBalanceIncrements clone Uint8Array 300000 31.715 us/op 69.333 us/op 0.46
effectiveBalanceIncrements clone MutableVector 300000 357.00 ns/op 490.00 ns/op 0.73
effectiveBalanceIncrements rw all Uint8Array 300000 164.31 us/op 186.87 us/op 0.88
effectiveBalanceIncrements rw all MutableVector 300000 81.971 ms/op 122.13 ms/op 0.67
phase0 afterProcessEpoch - 250000 vs - 7PWei 118.30 ms/op 130.81 ms/op 0.90
phase0 beforeProcessEpoch - 250000 vs - 7PWei 35.499 ms/op 47.385 ms/op 0.75
altair processEpoch - mainnet_e81889 325.43 ms/op 335.21 ms/op 0.97
mainnet_e81889 - altair beforeProcessEpoch 64.782 ms/op 73.165 ms/op 0.89
mainnet_e81889 - altair processJustificationAndFinalization 18.440 us/op 24.808 us/op 0.74
mainnet_e81889 - altair processInactivityUpdates 5.7386 ms/op 6.7402 ms/op 0.85
mainnet_e81889 - altair processRewardsAndPenalties 54.422 ms/op 57.333 ms/op 0.95
mainnet_e81889 - altair processRegistryUpdates 2.4530 us/op 3.0200 us/op 0.81
mainnet_e81889 - altair processSlashings 521.00 ns/op 614.00 ns/op 0.85
mainnet_e81889 - altair processEth1DataReset 593.00 ns/op 1.1780 us/op 0.50
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2574 ms/op 1.3751 ms/op 0.91
mainnet_e81889 - altair processSlashingsReset 4.7190 us/op 6.8620 us/op 0.69
mainnet_e81889 - altair processRandaoMixesReset 4.4240 us/op 9.4580 us/op 0.47
mainnet_e81889 - altair processHistoricalRootsUpdate 1.5630 us/op 1.3070 us/op 1.20
mainnet_e81889 - altair processParticipationFlagUpdates 2.3010 us/op 4.6160 us/op 0.50
mainnet_e81889 - altair processSyncCommitteeUpdates 513.00 ns/op 1.0110 us/op 0.51
mainnet_e81889 - altair afterProcessEpoch 129.25 ms/op 132.70 ms/op 0.97
phase0 processEpoch - mainnet_e58758 359.27 ms/op 405.91 ms/op 0.89
mainnet_e58758 - phase0 beforeProcessEpoch 132.81 ms/op 166.15 ms/op 0.80
mainnet_e58758 - phase0 processJustificationAndFinalization 18.477 us/op 22.853 us/op 0.81
mainnet_e58758 - phase0 processRewardsAndPenalties 63.232 ms/op 68.801 ms/op 0.92
mainnet_e58758 - phase0 processRegistryUpdates 8.6390 us/op 11.140 us/op 0.78
mainnet_e58758 - phase0 processSlashings 462.00 ns/op 652.00 ns/op 0.71
mainnet_e58758 - phase0 processEth1DataReset 482.00 ns/op 652.00 ns/op 0.74
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 994.47 us/op 1.2026 ms/op 0.83
mainnet_e58758 - phase0 processSlashingsReset 4.7110 us/op 7.6120 us/op 0.62
mainnet_e58758 - phase0 processRandaoMixesReset 5.4000 us/op 5.1890 us/op 1.04
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.0900 us/op 599.00 ns/op 1.82
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.1600 us/op 4.4810 us/op 0.93
mainnet_e58758 - phase0 afterProcessEpoch 104.06 ms/op 101.59 ms/op 1.02
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3649 ms/op 1.2813 ms/op 1.07
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5178 ms/op 1.4880 ms/op 1.02
altair processInactivityUpdates - 250000 normalcase 25.139 ms/op 26.792 ms/op 0.94
altair processInactivityUpdates - 250000 worstcase 19.435 ms/op 29.661 ms/op 0.66
phase0 processRegistryUpdates - 250000 normalcase 8.0500 us/op 11.689 us/op 0.69
phase0 processRegistryUpdates - 250000 badcase_full_deposits 280.37 us/op 286.11 us/op 0.98
phase0 processRegistryUpdates - 250000 worstcase 0.5 107.01 ms/op 142.73 ms/op 0.75
altair processRewardsAndPenalties - 250000 normalcase 60.535 ms/op 71.428 ms/op 0.85
altair processRewardsAndPenalties - 250000 worstcase 67.890 ms/op 81.181 ms/op 0.84
phase0 getAttestationDeltas - 250000 normalcase 8.5524 ms/op 8.7636 ms/op 0.98
phase0 getAttestationDeltas - 250000 worstcase 6.9807 ms/op 8.6102 ms/op 0.81
phase0 processSlashings - 250000 worstcase 3.8244 ms/op 3.8264 ms/op 1.00
altair processSyncCommitteeUpdates - 250000 193.11 ms/op 194.82 ms/op 0.99
BeaconState.hashTreeRoot - No change 319.00 ns/op 294.00 ns/op 1.09
BeaconState.hashTreeRoot - 1 full validator 56.454 us/op 56.637 us/op 1.00
BeaconState.hashTreeRoot - 32 full validator 531.21 us/op 621.98 us/op 0.85
BeaconState.hashTreeRoot - 512 full validator 5.9417 ms/op 5.8540 ms/op 1.01
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 66.071 us/op 68.699 us/op 0.96
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.0304 ms/op 949.64 us/op 1.09
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 13.414 ms/op 13.139 ms/op 1.02
BeaconState.hashTreeRoot - 1 balances 54.725 us/op 54.735 us/op 1.00
BeaconState.hashTreeRoot - 32 balances 531.88 us/op 469.46 us/op 1.13
BeaconState.hashTreeRoot - 512 balances 4.5921 ms/op 4.6164 ms/op 0.99
BeaconState.hashTreeRoot - 250000 balances 75.349 ms/op 74.579 ms/op 1.01
aggregationBits - 2048 els - zipIndexesInBitList 22.146 us/op 18.266 us/op 1.21
regular array get 100000 times 45.320 us/op 35.059 us/op 1.29
wrappedArray get 100000 times 36.250 us/op 39.886 us/op 0.91
arrayWithProxy get 100000 times 16.598 ms/op 15.968 ms/op 1.04
ssz.Root.equals 641.00 ns/op 601.00 ns/op 1.07
byteArrayEquals 598.00 ns/op 600.00 ns/op 1.00
shuffle list - 16384 els 7.1755 ms/op 7.1355 ms/op 1.01
shuffle list - 250000 els 109.24 ms/op 104.35 ms/op 1.05
processSlot - 1 slots 10.492 us/op 9.3710 us/op 1.12
processSlot - 32 slots 1.6120 ms/op 1.3898 ms/op 1.16
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 37.823 ms/op 38.503 ms/op 0.98
getCommitteeAssignments - req 1 vs - 250000 vc 3.0489 ms/op 2.9863 ms/op 1.02
getCommitteeAssignments - req 100 vs - 250000 vc 4.3048 ms/op 4.3075 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 4.7270 ms/op 4.7006 ms/op 1.01
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.1400 ns/op 5.0700 ns/op 1.01
state getBlockRootAtSlot - 250000 vs - 7PWei 635.72 ns/op 1.1022 us/op 0.58
computeProposers - vc 250000 11.025 ms/op 11.485 ms/op 0.96
computeEpochShuffling - vc 250000 110.38 ms/op 105.82 ms/op 1.04
getNextSyncCommittee - vc 250000 181.79 ms/op 195.01 ms/op 0.93
computeSigningRoot for AttestationData 14.035 us/op 15.162 us/op 0.93
hash AttestationData serialized data then Buffer.toString(base64) 2.5377 us/op 2.5687 us/op 0.99
toHexString serialized data 1.1191 us/op 1.8395 us/op 0.61
Buffer.toString(base64) 357.37 ns/op 386.75 ns/op 0.92

by benchmarkbot/action

@wemeetagain
wemeetagain merged commit a65f035 into unstable Apr 21, 2023
@wemeetagain
wemeetagain deleted the nflaig/update-multi-type-schemas branch April 21, 2023 13:28
@wemeetagain

Copy link
Copy Markdown
Member

馃帀 This PR is included in v1.8.0 馃帀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants