MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestClientLargeBisectionVerification

Function TestClientLargeBisectionVerification

light/client_test.go:384–407  ·  view source on GitHub ↗

start from a large light block to make sure that the pivot height doesn't select a height outside the appropriate range

(t *testing.T)

Source from the content-addressed store, hash-verified

382// start from a large light block to make sure that the pivot height doesn't select a height outside
383// the appropriate range
384func TestClientLargeBisectionVerification(t *testing.T) {
385 veryLargeFullNode := mockp.New(genMockNode(chainID, 100, 3, 0, bTime))
386 trustedLightBlock, err := veryLargeFullNode.LightBlock(ctx, 5)
387 require.NoError(t, err)
388 c, err := light.NewClient(
389 ctx,
390 chainID,
391 light.TrustOptions{
392 Period: 4 * time.Hour,
393 Height: trustedLightBlock.Height,
394 Hash: trustedLightBlock.Hash(),
395 },
396 veryLargeFullNode,
397 []provider.Provider{veryLargeFullNode},
398 dbs.New(dbm.NewMemDB(), chainID),
399 light.SkippingVerification(light.DefaultTrustLevel),
400 )
401 require.NoError(t, err)
402 h, err := c.Update(ctx, bTime.Add(100*time.Minute))
403 assert.NoError(t, err)
404 h2, err := veryLargeFullNode.LightBlock(ctx, 100)
405 require.NoError(t, err)
406 assert.Equal(t, h, h2)
407}
408
409func TestClientBisectionBetweenTrustedHeaders(t *testing.T) {
410 c, err := light.NewClient(

Callers

nothing calls this directly

Calls 8

UpdateMethod · 0.95
NewClientFunction · 0.92
SkippingVerificationFunction · 0.92
genMockNodeFunction · 0.85
LightBlockMethod · 0.65
HashMethod · 0.65
EqualMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected