@xyo-network/chain-validation 1.12.13 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateHydratedBlockState.bench.d.ts","sourceRoot":"","sources":["../../../../src/hydratedBlockState/spec/validateHydratedBlockState.bench.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/chain-validation",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.13.0",
|
|
5
5
|
"description": "XYO Layer One SDK Validation",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"src"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xylabs/hex": "~5.0.
|
|
40
|
-
"@xylabs/typeof": "~5.0.
|
|
39
|
+
"@xylabs/hex": "~5.0.11",
|
|
40
|
+
"@xylabs/typeof": "~5.0.11",
|
|
41
41
|
"@xyo-network/boundwitness-model": "~5.0.7",
|
|
42
|
-
"@xyo-network/chain-protocol": "~1.
|
|
42
|
+
"@xyo-network/chain-protocol": "~1.13.0",
|
|
43
43
|
"@xyo-network/payload-model": "~5.0.7",
|
|
44
44
|
"@xyo-network/schema-payload-plugin": "~5.0.7",
|
|
45
45
|
"@xyo-network/xl1-protocol": "~1.10.15",
|
|
46
|
-
"@xyo-network/xl1-protocol-sdk": "~1.
|
|
47
|
-
"@xyo-network/xl1-schema": "~1.
|
|
48
|
-
"@xyo-network/xl1-validation": "~1.
|
|
46
|
+
"@xyo-network/xl1-protocol-sdk": "~1.13.0",
|
|
47
|
+
"@xyo-network/xl1-schema": "~1.13.0",
|
|
48
|
+
"@xyo-network/xl1-validation": "~1.13.0",
|
|
49
49
|
"ajv": "~8.17.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "~24.3.0",
|
|
53
|
-
"@xylabs/assert": "~5.0.
|
|
54
|
-
"@xylabs/promise": "~5.0.
|
|
53
|
+
"@xylabs/assert": "~5.0.11",
|
|
54
|
+
"@xylabs/promise": "~5.0.11",
|
|
55
55
|
"@xylabs/ts-scripts-yarn3": "~7.1.7",
|
|
56
56
|
"@xylabs/tsconfig": "~7.1.7",
|
|
57
57
|
"@xyo-network/account": "~5.0.7",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Account } from '@xyo-network/account'
|
|
2
|
+
import { buildRandomChain } from '@xyo-network/chain-protocol'
|
|
3
|
+
import type {
|
|
4
|
+
AccountBalanceServiceV2,
|
|
5
|
+
Chain,
|
|
6
|
+
HydratedBlock,
|
|
7
|
+
HydratedBlockStateValidationFunctionV2,
|
|
8
|
+
} from '@xyo-network/xl1-protocol'
|
|
9
|
+
import {
|
|
10
|
+
bench, describe, vi,
|
|
11
|
+
} from 'vitest'
|
|
12
|
+
|
|
13
|
+
import { validateHydratedBlockState } from '../validateHydratedBlockState.ts'
|
|
14
|
+
|
|
15
|
+
let block: HydratedBlock
|
|
16
|
+
|
|
17
|
+
const chainId = 'dd381FBB392C85160d8B0453E446757b12384046' as Chain
|
|
18
|
+
|
|
19
|
+
const mockServices: { accountBalance: AccountBalanceServiceV2 } = {
|
|
20
|
+
accountBalance: {
|
|
21
|
+
getBalance: vi.fn(() => BigInt(1000)),
|
|
22
|
+
// add any other required methods from AccountBalanceServiceV2
|
|
23
|
+
} as unknown as AccountBalanceServiceV2,
|
|
24
|
+
}
|
|
25
|
+
const sut: HydratedBlockStateValidationFunctionV2 = validateHydratedBlockState
|
|
26
|
+
|
|
27
|
+
// Setup function for bench
|
|
28
|
+
const asyncSetup = async () => {
|
|
29
|
+
const producer = await Account.random()
|
|
30
|
+
const [chain] = await buildRandomChain(producer, 1)
|
|
31
|
+
block = chain
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe('validateHydratedBlockState', () => {
|
|
35
|
+
describe('with mock services', () => {
|
|
36
|
+
bench(
|
|
37
|
+
'validateHydratedBlockState',
|
|
38
|
+
async () => {
|
|
39
|
+
await sut(block, chainId, mockServices)
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
setup: asyncSetup, warmupIterations: 10, iterations: 100,
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
})
|
|
46
|
+
})
|