Skip to content

Commit

Permalink
go/worker/keymanager: Generate secrets immediately with mock beacon
Browse files Browse the repository at this point in the history
  • Loading branch information
peternose committed Dec 12, 2024
1 parent 6ffc735 commit 7f22dad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Empty file added .changelog/5971.trivial.md
Empty file.
8 changes: 8 additions & 0 deletions go/worker/keymanager/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/oasisprotocol/oasis-core/go/common/version"
consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
"github.com/oasisprotocol/oasis-core/go/keymanager/api"
cmdFlags "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common/flags"
"github.com/oasisprotocol/oasis-core/go/p2p/rpc"
registry "github.com/oasisprotocol/oasis-core/go/registry/api"
enclaverpc "github.com/oasisprotocol/oasis-core/go/runtime/enclaverpc/api"
Expand Down Expand Up @@ -315,6 +316,13 @@ func (w *Worker) selectBlockHeight(epoch beacon.EpochTime, from uint8, to uint8)
}
interval := params.Interval()

// Use a zero interval when mocking epoch time, as the interval is untrusted.
// It is set in genesis to a fixed value, but the real interval can vary
// between epochs.
if cmdFlags.DebugDontBlameOasis() && params.DebugMockBackend {
interval = 0
}

// Pick a random block from the given percentile.
offset := interval * int64(from) / 100
span := interval * int64(to-from) / 100
Expand Down

0 comments on commit 7f22dad

Please sign in to comment.