Skip to content

Commit

Permalink
Remove compact ranges from configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutchinson committed Oct 23, 2024
1 parent 02e4ab6 commit 0152b0a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 63 deletions.
37 changes: 17 additions & 20 deletions internal/http/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ var (
const logOrigin = "Log Checkpoint v0"

type logOpts struct {
ID string
origin string
PK string
useCompact bool
ID string
origin string
PK string
}

func newWitness(t *testing.T, logs []logOpts) *witness.Witness {
Expand All @@ -88,10 +87,9 @@ func newWitness(t *testing.T, logs []logOpts) *witness.Witness {
t.Fatalf("couldn't create a log verifier: %v", err)
}
logInfo := witness.LogInfo{
Origin: log.origin,
SigV: logV,
Hasher: h,
UseCompact: log.useCompact,
Origin: log.origin,
SigV: logV,
Hasher: h,
}
logMap[log.ID] = logInfo
}
Expand Down Expand Up @@ -165,10 +163,9 @@ func TestGetLogs(t *testing.T) {
logs := make([]logOpts, len(test.logIDs))
for i, logID := range test.logIDs {
logs[i] = logOpts{
ID: logID,
origin: logOrigin,
PK: test.logPKs[i],
useCompact: false,
ID: logID,
origin: logOrigin,
PK: test.logPKs[i],
}
}
w := newWitness(t, logs)
Expand Down Expand Up @@ -250,10 +247,10 @@ func TestGetChkpt(t *testing.T) {
ctx := context.Background()
// Set up witness.
w := newWitness(t, []logOpts{{
ID: test.setID,
origin: logOrigin,
PK: test.setPK,
useCompact: false}})
ID: test.setID,
origin: logOrigin,
PK: test.setPK,
}})
// Set a checkpoint for the log if we want to for this test.
if test.c != nil {
if _, err := w.Update(ctx, test.setID, test.c, nil); err != nil {
Expand Down Expand Up @@ -323,10 +320,10 @@ func TestUpdate(t *testing.T) {
logID := "monkeys"
// Set up witness.
w := newWitness(t, []logOpts{{
ID: logID,
origin: logOrigin,
PK: mPK,
useCompact: false}})
ID: logID,
origin: logOrigin,
PK: mPK,
}})
// Set an initial checkpoint for the log.
if _, err := w.Update(ctx, logID, test.initC, nil); err != nil {
t.Errorf("failed to set checkpoint: %v", err)
Expand Down
3 changes: 0 additions & 3 deletions internal/witness/witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ type LogInfo struct {
Origin string
// The hash strategy that should be used in verifying consistency.
Hasher merkle.LogHasher
// An indicator of whether the log should be verified using consistency
// proofs or compact ranges.
UseCompact bool
}

// Witness consists of a database for storing checkpoints, a signer, and a list
Expand Down
37 changes: 17 additions & 20 deletions internal/witness/witness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ var (
const logOrigin = "Log Checkpoint v0"

type logOpts struct {
ID string
origin string
PK string
useCompact bool
ID string
origin string
PK string
}

func newWitness(t *testing.T, logs []logOpts) *Witness {
Expand All @@ -88,10 +87,9 @@ func newWitness(t *testing.T, logs []logOpts) *Witness {
t.Fatalf("couldn't create a log verifier: %v", err)
}
logInfo := LogInfo{
Origin: log.origin,
SigV: logV,
Hasher: h,
UseCompact: log.useCompact,
Origin: log.origin,
SigV: logV,
Hasher: h,
}
logMap[log.ID] = logInfo
}
Expand Down Expand Up @@ -149,10 +147,9 @@ func TestGetLogs(t *testing.T) {
logs := make([]logOpts, len(test.logIDs))
for i, logID := range test.logIDs {
logs[i] = logOpts{
ID: logID,
origin: logOrigin,
PK: test.logPKs[i],
useCompact: false,
ID: logID,
origin: logOrigin,
PK: test.logPKs[i],
}
}
w := newWitness(t, logs)
Expand Down Expand Up @@ -221,10 +218,10 @@ func TestGetChkpt(t *testing.T) {
ctx := context.Background()
// Set up witness.
w := newWitness(t, []logOpts{{
ID: test.setID,
origin: logOrigin,
PK: test.setPK,
useCompact: false}})
ID: test.setID,
origin: logOrigin,
PK: test.setPK,
}})
// Set a checkpoint for the log if we want to for this test.
if test.c != nil {
if _, err := w.Update(ctx, test.setID, test.c, nil); err != nil {
Expand Down Expand Up @@ -356,10 +353,10 @@ func TestUpdate(t *testing.T) {
logID := "monkeys"
// Set up witness.
w := newWitness(t, []logOpts{{
ID: logID,
origin: logOrigin,
PK: mPK,
useCompact: false}})
ID: logID,
origin: logOrigin,
PK: mPK,
}})
// Set an initial checkpoint for the log.
if _, err := w.Update(ctx, logID, test.initC, nil); err != nil {
t.Errorf("failed to set checkpoint: %v", err)
Expand Down
16 changes: 7 additions & 9 deletions omniwitness/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ func (config LogConfig) AsLogMap() (map[string]witness.LogInfo, error) {
return nil, fmt.Errorf("failed to create signature verifier: %v", err)
}
logInfo := witness.LogInfo{
SigV: logV,
Origin: log.Origin,
Hasher: h,
UseCompact: log.UseCompact,
SigV: logV,
Origin: log.Origin,
Hasher: h,
}
logID := logfmt.ID(log.Origin)
if oldLog, found := logMap[logID]; found {
Expand All @@ -62,9 +61,8 @@ func (config LogConfig) AsLogMap() (map[string]witness.LogInfo, error) {

// LogInfo contains the details about a log.
type LogInfo struct {
Origin string `yaml:"Origin"`
PublicKey string `yaml:"PublicKey"`
URL string `yaml:"URL"`
Feeder Feeder `yaml:"Feeder"`
UseCompact bool `yaml:"UseCompact"`
Origin string `yaml:"Origin"`
PublicKey string `yaml:"PublicKey"`
URL string `yaml:"URL"`
Feeder Feeder `yaml:"Feeder"`
}
11 changes: 0 additions & 11 deletions omniwitness/logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,47 @@ Logs:
URL: https://sum.golang.org
PublicKey: sum.golang.org+033de0ae+Ac4zctda0e5eza+HJyk9SxEdh+s3Ux18htTTAD8OuAn8
Feeder: sumdb
UseCompact: false
- Origin: Armory Drive Prod 2
URL: https://raw.githubusercontent.com/f-secure-foundry/armory-drive-log/master/log/
PublicKey: armory-drive-log+16541b8f+AYDPmG5pQp4Bgu0a1mr5uDZ196+t8lIVIfWQSPWmP+Jv
Feeder: serverless
UseCompact: false
- Origin: rekor.sigstore.dev - 3904496407287907110
URL: https://rekor.sigstore.dev?treeID=3904496407287907110
PublicKeyType: ecdsa
PublicKey: rekor.sigstore.dev+c0d23d6a+AjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNhtmPtrWm3U1eQXBogSMdGvXwBcK5AW5i0hrZLOC96l+smGNM7nwZ4QvFK/4sueRoVj//QP22Ni4Qt9DPfkWLc=
Feeder: rekor
UseCompact: false
- Origin: rekor.sigstore.dev - 2605736670972794746
URL: https://rekor.sigstore.dev?treeID=2605736670972794746
PublicKeyType: ecdsa
PublicKey: rekor.sigstore.dev+c0d23d6a+AjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNhtmPtrWm3U1eQXBogSMdGvXwBcK5AW5i0hrZLOC96l+smGNM7nwZ4QvFK/4sueRoVj//QP22Ni4Qt9DPfkWLc=
Feeder: rekor
UseCompact: false
- Origin: rekor.sigstore.dev - 1193050959916656506
URL: https://rekor.sigstore.dev?treeID=1193050959916656506
PublicKeyType: ecdsa
PublicKey: rekor.sigstore.dev+c0d23d6a+AjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABNhtmPtrWm3U1eQXBogSMdGvXwBcK5AW5i0hrZLOC96l+smGNM7nwZ4QvFK/4sueRoVj//QP22Ni4Qt9DPfkWLc=
Feeder: rekor
UseCompact: false
- Origin: developers.google.com/android/binary_transparency/0
URL: https://developers.google.com/android/binary_transparency/
PublicKeyType: ecdsa
PublicKey: pixel_transparency_log+72c878db+AjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABFPN7lzVIk2BOd3Nk33VpqqVttGwV8uChH+RX/HVfBiypVQFyh8o8Ny6fSdxNMgkSf9/VynrgADBeys0r4Q9uPA=
Feeder: pixel
UseCompact: false
- Origin: lvfs
URL: https://fwupd.org/ftlog/lvfs/
PublicKey: lvfs+7908d142+ASnlGgOh+634tcE/2Lp3wV7k/cLoU6ncawmb/BLC1oMU
Feeder: serverless
UseCompact: false
- Origin: transparency.dev/armored-witness/firmware_transparency/prod/1
URL: https://api.transparency.dev/armored-witness-firmware/prod/log/1/
PublicKey: transparency.dev-aw-ftlog-prod-1+3e6d87ee+Aa3qdhefd2cc/98jV3blslJT2L+iFR8WKHeGcgFmyjnt
Feeder: serverless
UseCompact: false
- Origin: transparency.dev/armored-witness/firmware_transparency/ci/2
URL: https://api.transparency.dev/armored-witness-firmware/ci/log/2/
PublicKey: transparency.dev-aw-ftlog-ci-2+f77c6276+AZXqiaARpwF4MoNOxx46kuiIRjrML0PDTm+c7BLaAMt6
Feeder: serverless
UseCompact: false
- Origin: transparency.dev/armored-witness/firmware_transparency/ci/3
URL: https://api.transparency.dev/armored-witness-firmware/ci/log/3/
PublicKey: transparency.dev-aw-ftlog-ci-3+3f689522+Aa1Eifq6rRC8qiK+bya07yV1fXyP156pEMsX7CFBC6gg
Feeder: serverless
UseCompact: false
- Origin: sigsum.org/v1/tree/44ad38f8226ff9bd27629a41e55df727308d0a1cd8a2c31d3170048ac1dd22a1
URL: https://seasalp.glasklar.is
PublicKey: sigsum.org/v1/tree/44ad38f8226ff9bd27629a41e55df727308d0a1cd8a2c31d3170048ac1dd22a1+682b49db+AQ7H4WhDEZsSA3enOROsasvC0D2CQy4sNrhBsJqVhB8l
Feeder: none
UseCompact: false

0 comments on commit 0152b0a

Please sign in to comment.