-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbeaconLocalContent.spec.ts
More file actions
36 lines (35 loc) · 1.03 KB
/
beaconLocalContent.spec.ts
File metadata and controls
36 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { bytesToHex } from '@ethereumjs/util'
import {
BeaconNetworkContentType,
LightClientOptimisticUpdateKey,
encodeBeaconContentKey,
} from 'portalnetwork'
import { assert, afterAll, beforeAll, describe, it } from 'vitest'
import { startRpc } from '../util.js'
const method = 'portal_beaconLocalContent'
describe(`${method} tests`, () => {
describe(`${method} tests`, () => {
let ul
let rp
beforeAll(async () => {
const { ultralight, rpc } = await startRpc({
networks: ['beacon'],
rpcPort: 8547,
port: 9002,
})
ul = ultralight
rp = rpc
})
it('should not find any local content', async () => {
const key = LightClientOptimisticUpdateKey.serialize({ signatureSlot: 7807053n })
const res = await rp.request(method, [
bytesToHex(encodeBeaconContentKey(BeaconNetworkContentType.LightClientOptimisticUpdate, key)),
])
console.log(res)
assert.equal(res.error.code, -32009)
}, 10000)
afterAll(() => {
ul.kill()
})
})
})