-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5354 from oasisprotocol/peternose/feature/propose…
…r-backup go/worker/compute/executor/committee: Support backup proposers
- Loading branch information
Showing
83 changed files
with
4,571 additions
and
4,589 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
go/worker/compute/executor/committee: Support backup proposers | ||
|
||
Starting now, all executor committee workers are permitted to schedule | ||
transactions, each with distinct per-round priority. Priority dictates | ||
the time after which a worker can propose a new batch. The consensus | ||
layer tracks all published executor commitments and tries to build | ||
a new runtime block on a proposal with the highest priority. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package api | ||
|
||
import ( | ||
"bytes" | ||
"sort" | ||
|
||
"github.com/oasisprotocol/oasis-core/go/common" | ||
abciAPI "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/api" | ||
) | ||
|
||
// finalizationPendingRuntimesKey is the block context key. | ||
type finalizationPendingRuntimesKey struct{} | ||
|
||
func (pk finalizationPendingRuntimesKey) NewDefault() interface{} { | ||
return make(map[common.Namespace]struct{}) | ||
} | ||
|
||
// RegisterRuntimeForFinalization appends the given runtime to the list of runtimes considered | ||
// for finalization during the end block. | ||
func RegisterRuntimeForFinalization(ctx *abciAPI.Context, runtimeID common.Namespace) { | ||
rts := ctx.BlockContext().Get(finalizationPendingRuntimesKey{}).(map[common.Namespace]struct{}) | ||
|
||
rts[runtimeID] = struct{}{} | ||
} | ||
|
||
// RuntimesToFinalize returns an ordered list of runtimes to be considered for finalization | ||
// during the end block. | ||
func RuntimesToFinalize(ctx *abciAPI.Context) []common.Namespace { | ||
rts := ctx.BlockContext().Get(finalizationPendingRuntimesKey{}).(map[common.Namespace]struct{}) | ||
|
||
// Ensure deterministic order of runtimes. | ||
sorted := make([]common.Namespace, 0, len(rts)) | ||
for id := range rts { | ||
sorted = append(sorted, id) | ||
} | ||
sort.Slice(sorted, func(i, j int) bool { | ||
return bytes.Compare(sorted[i][:], sorted[j][:]) < 0 | ||
}) | ||
|
||
return sorted | ||
} |
Oops, something went wrong.