From fa08d6c7d8331962edd2fe346b37f56d4baf376c Mon Sep 17 00:00:00 2001 From: Maelkum Date: Thu, 5 Oct 2023 20:11:02 +0200 Subject: [PATCH] Use noop logger for pebble --- cmd/node/main.go | 4 ++-- cmd/node/pebble_noop_logger.go | 7 +++++++ models/execute/request.go | 2 +- node/node.go | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 cmd/node/pebble_noop_logger.go diff --git a/cmd/node/main.go b/cmd/node/main.go index c17f0943..b71b7c35 100644 --- a/cmd/node/main.go +++ b/cmd/node/main.go @@ -70,7 +70,7 @@ func run() int { cfg.Workspace = workspace // Open the pebble peer database. - pdb, err := pebble.Open(cfg.PeerDatabasePath, &pebble.Options{}) + pdb, err := pebble.Open(cfg.PeerDatabasePath, &pebble.Options{Logger: &pebbleNoopLogger{}}) if err != nil { log.Error().Err(err).Str("db", cfg.PeerDatabasePath).Msg("could not open pebble peer database") return failure @@ -168,7 +168,7 @@ func run() int { } // Open the pebble function database. - fdb, err := pebble.Open(cfg.FunctionDatabasePath, &pebble.Options{}) + fdb, err := pebble.Open(cfg.FunctionDatabasePath, &pebble.Options{Logger: &pebbleNoopLogger{}}) if err != nil { log.Error().Err(err).Str("db", cfg.FunctionDatabasePath).Msg("could not open pebble function database") return failure diff --git a/cmd/node/pebble_noop_logger.go b/cmd/node/pebble_noop_logger.go new file mode 100644 index 00000000..edb54f8b --- /dev/null +++ b/cmd/node/pebble_noop_logger.go @@ -0,0 +1,7 @@ +package main + +type pebbleNoopLogger struct{} + +func (p *pebbleNoopLogger) Infof(_ string, _ ...any) {} + +func (p *pebbleNoopLogger) Fatalf(_ string, _ ...any) {} diff --git a/models/execute/request.go b/models/execute/request.go index 532af75b..402fdafd 100644 --- a/models/execute/request.go +++ b/models/execute/request.go @@ -53,7 +53,7 @@ type ResultAggregation struct { type Attributes struct { // Values specify which attributes the node in question should have. // At the moment we support strict equality only, so no `if RAM >= 16GB` types of conditions. - Values []Parameter `json:"attributes,omitempty"` + Values []Parameter `json:"values,omitempty"` // Should we accept nodes whose attributes are not attested? AttestationRequired bool `json:"attestation_required,omitempty"` diff --git a/node/node.go b/node/node.go index 66169e73..491f4c26 100644 --- a/node/node.go +++ b/node/node.go @@ -81,6 +81,7 @@ func New(log zerolog.Logger, host *host.Host, peerStore PeerStore, fstore FStore } n.attributes = &attributes + n.log.Info().Interface("attributes", n.attributes).Msg("node loaded attributes") } err := n.ValidateConfig()