diff --git a/go/enclave/components/shared_secret_process.go b/go/enclave/components/shared_secret_process.go index 260a4f458..135d595b0 100644 --- a/go/enclave/components/shared_secret_process.go +++ b/go/enclave/components/shared_secret_process.go @@ -2,6 +2,8 @@ package components import ( "context" + "crypto/elliptic" + "encoding/hex" "fmt" gethcommon "github.com/ethereum/go-ethereum/common" @@ -149,5 +151,8 @@ func (ssp *SharedSecretProcessor) storeAttestation(ctx context.Context, att *com if err != nil { return fmt.Errorf("could not store attested key. Cause: %w", err) } + + bytes := elliptic.Marshal(key.Curve, key.X, key.Y) + ssp.logger.Info(fmt.Sprintf("Stored attested key for enclave %s: %s", att.EnclaveID, hex.EncodeToString(bytes))) return nil } diff --git a/go/enclave/components/sigverifier.go b/go/enclave/components/sigverifier.go index 51a5b881a..030d16a61 100644 --- a/go/enclave/components/sigverifier.go +++ b/go/enclave/components/sigverifier.go @@ -51,16 +51,20 @@ func (sigChecker *SignatureValidator) CheckSequencerSignature(hash gethcommon.Ha sigChecker.logger.Error("Could not get public key for sequencer. Should not happen", "sequencerID", seqID, "error", err) continue // skip if we can't get the public key for this sequencer } + sigChecker.logger.Info(fmt.Sprintf("Retrieved attestation for sequencer %s: %s", seqID, attestedEnclave.String())) err = signature.VerifySignature(attestedEnclave.PubKey, hash.Bytes(), sig) if err != nil { sigChecker.logger.Warn("Could not verify signature", "sequencerID", seqID, "error", err) // todo - as a temporary fix we remmove the sig verification - // continue // skip + continue // skip } // signature matches + sigChecker.logger.Info("Signature verified successfully") return nil } - return fmt.Errorf("could not verify the signature against any of the stored sequencer enclave keys") + sigChecker.logger.Error("Could not verify the signature against any of the stored sequencer enclave keys") + //return fmt.Errorf("could not verify the signature against any of the stored sequencer enclave keys") + return nil } diff --git a/go/enclave/enclave_admin_service.go b/go/enclave/enclave_admin_service.go index 6ce9781e3..628b9c57e 100644 --- a/go/enclave/enclave_admin_service.go +++ b/go/enclave/enclave_admin_service.go @@ -580,6 +580,7 @@ func (e *enclaveAdminService) getNodeType(ctx context.Context) common.NodeType { e.logger.Trace("could not read enclave pub key. Defaulting to validator type", log.ErrKey, err) return common.Validator } + e.logger.Info(fmt.Sprintf("getNodeType: Retrieved pubKey for %s: %s", id.Hex(), attestedEnclave.String())) return attestedEnclave.Type } diff --git a/go/enclave/storage/storage.go b/go/enclave/storage/storage.go index 0cc7ea05a..c73a2c24d 100644 --- a/go/enclave/storage/storage.go +++ b/go/enclave/storage/storage.go @@ -4,7 +4,9 @@ import ( "bytes" "context" "crypto/ecdsa" + "crypto/elliptic" "database/sql" + "encoding/hex" "encoding/json" "errors" "fmt" @@ -53,6 +55,10 @@ type AttestedEnclave struct { Type common.NodeType } +func (a *AttestedEnclave) String() string { + return fmt.Sprintf("Enclave %s with public key %s", a.EnclaveID, hex.EncodeToString(elliptic.Marshal(a.PubKey.Curve, a.PubKey.X, a.PubKey.Y))) +} + // todo - this file needs splitting up based on concerns type storageImpl struct { db enclavedb.EnclaveDB @@ -521,7 +527,9 @@ func (s *storageImpl) GetEnclavePubKey(ctx context.Context, enclaveId common.Enc return nil, fmt.Errorf("could not parse key from db. Cause: %w", err) } - return &AttestedEnclave{PubKey: publicKey, Type: nodeType, EnclaveID: &enclaveId}, nil + attestedEnclave := &AttestedEnclave{PubKey: publicKey, Type: nodeType, EnclaveID: &enclaveId} + s.logger.Info(fmt.Sprintf("Retrieved from database attestation: %s", attestedEnclave.String())) + return attestedEnclave, nil }) }