Skip to content

Commit

Permalink
more docs, and minor improvements for attested-get (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris authored Feb 3, 2025
1 parent 24c49a8 commit aebd334
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cmd/attested-get/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@ package main
//
// go run cmd/attested-get/main.go --addr=https://instance_ip:port
//
// Can also save the verified measurements and the response body to files:
// Save the verified measurements and the response body to files:
//
// go run cmd/attested-get/main.go --addr=https://instance_ip:port --out-measurements=measurements.json --out-response=response.txt
// go run cmd/attested-get/main.go \
// --addr=https://instance_ip:port \
// --out-measurements=measurements.json \
// --out-response=response.txt
//
// You can also compare the resulting measurements with a list of expected measurements:
// Compare the resulting measurements with a list of expected measurements:
//
// go run cmd/get-measurements/main.go --addr=https://instance_ip:port --expected-measurements=measurements.json
// go run cmd/attested-get/main.go \
// --addr=https://instance_ip:port \
// --expected-measurements=measurements.json
//
// Also works with an URL for expected measurements:
//
// go run cmd/attested-get/main.go \
// --addr=https://buildernet-01-euw.builder.flashbots.net:7936/cert \
// --expected-measurements=https://measurements.builder.flashbots.net
//

import (
Expand Down Expand Up @@ -133,6 +144,7 @@ func runClient(cCtx *cli.Context) (err error) {
if expectedMeasurementsPath != "" {
log.Info("Loading expected measurements from " + expectedMeasurementsPath + " ...")
expectedMeasurements, err = multimeasurements.New(expectedMeasurementsPath)
log.With("measurements", expectedMeasurements.Count()).Info("Measurements loaded")
if err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions multimeasurements/multimeasurements.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ func (m *MultiMeasurements) Contains(measurements map[uint32][]byte) (found bool

return false, nil
}

func (m *MultiMeasurements) Count() (n uint32) {
return uint32(len(m.Measurements))
}

0 comments on commit aebd334

Please sign in to comment.