Skip to content

Commit

Permalink
set EnclaveDebug field of QueryAvailableEnclaveKeysRequest
Browse files Browse the repository at this point in the history
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
  • Loading branch information
bluele committed Feb 16, 2025
1 parent cc4ce32 commit 330760b
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 64 deletions.
155 changes: 95 additions & 60 deletions relay/enclave/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions relay/lcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,17 @@ func (pr *Prover) loadEKIAndCheckUpdateNeeded(ctx context.Context, counterparty

// selectNewEnclaveKey selects a new enclave key from the LCP service
func (pr *Prover) selectNewEnclaveKey(ctx context.Context) (*enclave.EnclaveKeyInfo, error) {
res, err := pr.lcpServiceClient.AvailableEnclaveKeys(ctx, &enclave.QueryAvailableEnclaveKeysRequest{Mrenclave: pr.config.GetMrenclave(), RaType: uint32(pr.getRAType())})
req := enclave.QueryAvailableEnclaveKeysRequest{
Mrenclave: pr.config.GetMrenclave(),
EnclaveDebug: pr.config.IsDebugEnclave,
RaType: uint32(pr.getRAType()),
}
pr.getLogger().Debug("query available enclave keys", "mrenclave", hex.EncodeToString(req.Mrenclave), "debug", req.EnclaveDebug, "ra_type", req.RaType)
res, err := pr.lcpServiceClient.AvailableEnclaveKeys(ctx, &req)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to call AvailableEnclaveKeys: mr_enclave=%v debug=%v ra_type=%v %w", hex.EncodeToString(req.Mrenclave), req.EnclaveDebug, req.RaType, err)
} else if len(res.Keys) == 0 {
return nil, fmt.Errorf("no available enclave keys")
return nil, fmt.Errorf("no available enclave keys: mrenclave=%v debug=%v ra_type=%v", hex.EncodeToString(req.Mrenclave), req.EnclaveDebug, req.RaType)
}

for _, eki := range res.Keys {
Expand Down

0 comments on commit 330760b

Please sign in to comment.