Skip to content

Commit

Permalink
Update tests with actual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed Jul 28, 2023
1 parent af49c06 commit f55b32c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/portalnetwork/test/subprotocols/beacon/beacon.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ tape('portal network spec test vectors', (t) => {
const forkDigest = ssz.ForkDigest.deserialize(serializedOptimistincUpdate.slice(0, 4))

const config = createBeaconConfig(defaultChainConfig, genesisRoot)
console.log(config.forkDigest2ForkName(forkDigest))
t.equal(config.forkDigest2ForkName(forkDigest), 'capella', 'derived correct fork')
const deserializedOptimisticUpdate = ssz.capella.LightClientOptimisticUpdate.deserialize(
serializedOptimistincUpdate.slice(4)
)
console.log(deserializedOptimisticUpdate)
t.equal(deserializedOptimisticUpdate.attestedHeader.beacon.slot, 6718463, 'deserialized optimistic update')
const finalityUpdate = fromHexString(specTestVectors.finalityUpdate['6718463'].content_value)
const deserializedFinalityUpdate = ssz.capella.LightClientFinalityUpdate.deserialize(
finalityUpdate.slice(4)
)
console.log(deserializedFinalityUpdate)
t.equal(deserializedFinalityUpdate.attestedHeader.beacon.slot, 6718463, 'deserialized finality update')
const bootstrap = specTestVectors.bootstrap['6718368']
const deserializedBootstrap = ssz.capella.LightClientBootstrap.deserialize(
fromHexString(bootstrap.content_value).slice(4)
)
console.log(deserializedBootstrap)
t.equal(deserializedBootstrap.header.beacon.slot, 6718368, 'deserialized bootstrap')

const updateByRange = fromHexString(specTestVectors.updateByRange['6684738'].content_value)
const newforkDigest = ssz.ForkDigest.deserialize(serializedOptimistincUpdate.slice(0, 4))
// TODO: Figure out how to deserialize updatesByRange
t.end()
})

0 comments on commit f55b32c

Please sign in to comment.