MCPcopy Create free account
hub / github.com/akash-network/node / TestHappyPathMessages

Function TestHappyPathMessages

x/verification/keeper/msg_test.go:22–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestHappyPathMessages(t *testing.T) {
23 bank := &recordingBank{}
24 ctx, k := setupStoreKeeperWithOptions(t, WithAuthority("gov"), WithBankKeeper(bank))
25 provider := testutil.AccAddress(t)
26 auditor := testutil.AccAddress(t)
27 params := k.GetParams(ctx)
28
29 err := k.RegisterAuditor(ctx, "gov", auditor, vtypes.TierTrusted, []byte("auditor-meta"))
30 require.NoError(t, err)
31
32 err = k.PostAuditorBond(ctx, auditor, params.BondL4)
33 require.NoError(t, err)
34
35 err = k.PostProviderBond(ctx, provider, sdk.NewInt64Coin(bondDenom, 200000000))
36 require.NoError(t, err)
37
38 resources := vtypes.ResourceSummary{
39 TotalGPUs: 2,
40 TotalVCPUs: 4,
41 TotalMemoryMB: 2048,
42 TotalStorageMB: 1048576,
43 }
44 err = k.PostSnapshotHash(ctx, provider, testHash(), resources, ctx.BlockTime())
45 require.NoError(t, err)
46
47 escrowID, err := k.OpenAuditEscrow(
48 ctx,
49 provider,
50 vtypes.TierVerified,
51 []vtypes.CapabilityFlag{vtypes.CapabilityTEEHardwareAttestation},
52 params.MinFeeL2,
53 params.ProviderAuditDeposit,
54 ctx.BlockTime().Add(params.TtlL2),
55 []byte("escrow-meta"),
56 )
57 require.NoError(t, err)
58 require.Equal(t, uint64(1), escrowID)
59
60 err = k.SubmitAttestation(
61 ctx,
62 provider,
63 auditor,
64 vtypes.TierVerified,
65 []vtypes.CapabilityFlag{vtypes.CapabilityTEEHardwareAttestation},
66 testHash(),
67 params.MinFeeL2,
68 params.AttestationDeposit,
69 escrowID,
70 )
71 require.NoError(t, err)
72
73 attestation, found := k.GetAttestation(ctx, provider, auditor)
74 require.True(t, found)
75 require.Equal(t, vtypes.AttestationStatusValid, attestation.Status)
76 require.Equal(t, vtypes.TierVerified, attestation.Tier)
77
78 escrow, found := k.GetAuditEscrow(ctx, escrowID)
79 require.True(t, found)

Callers

nothing calls this directly

Calls 15

WithAuthorityFunction · 0.85
WithBankKeeperFunction · 0.85
testHashFunction · 0.85
GetParamsMethod · 0.65
RegisterAuditorMethod · 0.65
PostAuditorBondMethod · 0.65
PostProviderBondMethod · 0.65
PostSnapshotHashMethod · 0.65
OpenAuditEscrowMethod · 0.65
SubmitAttestationMethod · 0.65
GetAttestationMethod · 0.65

Tested by

no test coverage detected