@@ -24,6 +24,7 @@ import (
2424 roothash "github.com/oasisprotocol/oasis-core/go/roothash/api"
2525 "github.com/oasisprotocol/oasis-core/go/roothash/api/block"
2626 runtime "github.com/oasisprotocol/oasis-core/go/runtime/api"
27+ "github.com/oasisprotocol/oasis-core/go/runtime/bundle"
2728 "github.com/oasisprotocol/oasis-core/go/runtime/host"
2829 runtimeRegistry "github.com/oasisprotocol/oasis-core/go/runtime/registry"
2930 "github.com/oasisprotocol/oasis-core/go/runtime/txpool"
@@ -58,14 +59,15 @@ type Node struct {
5859
5960 HostNode control.NodeController
6061
61- Identity * identity.Identity
62- KeyManager keymanager.Backend
63- KeyManagerClient * KeyManagerClientWrapper
64- Consensus consensus.Service
65- LightProvider consensus.LightProvider
66- Group * Group
67- P2P p2pAPI.Service
68- TxPool txpool.TransactionPool
62+ Identity * identity.Identity
63+ WillRegisterComputeRuntime bool
64+ KeyManager keymanager.Backend
65+ KeyManagerClient * KeyManagerClientWrapper
66+ Consensus consensus.Service
67+ LightProvider consensus.LightProvider
68+ Group * Group
69+ P2P p2pAPI.Service
70+ TxPool txpool.TransactionPool
6971
7072 services * service.Group
7173 roflNotifier * runtimeRegistry.ROFLNotifier
@@ -391,7 +393,8 @@ func (n *Node) worker() { //nolint: gocyclo
391393
392394 // Provision all known components.
393395 for _ , comp := range bundleRegistry .Components (n .Runtime .ID ()) {
394- if err := n .ProvisionHostedRuntimeComponent (comp ); err != nil {
396+ attestCfg := n .attestationCfg (comp )
397+ if err := n .ProvisionHostedRuntimeComponent (comp , attestCfg ); err != nil {
395398 n .logger .Error ("failed to provision runtime component" ,
396399 "err" , err ,
397400 "id" , comp .ID (),
@@ -474,7 +477,8 @@ func (n *Node) worker() { //nolint: gocyclo
474477 switch {
475478 case compNotify .Added != nil :
476479 // Received a new version of a runtime component.
477- if err := n .ProvisionHostedRuntimeComponent (compNotify .Added ); err != nil {
480+ attestCfg := n .attestationCfg (compNotify .Added )
481+ if err := n .ProvisionHostedRuntimeComponent (compNotify .Added , attestCfg ); err != nil {
478482 n .logger .Error ("failed to provision hosted runtime" ,
479483 "err" , err ,
480484 "id" , compNotify .Added .ID (),
@@ -498,6 +502,12 @@ func (n *Node) worker() { //nolint: gocyclo
498502 }
499503}
500504
505+ func (n * Node ) attestationCfg (comp * bundle.ExplodedComponent ) host.AttestationCfg {
506+ return host.AttestationCfg {
507+ UseComputePolicy : comp .ID ().IsRONL () && n .WillRegisterComputeRuntime ,
508+ }
509+ }
510+
501511func (n * Node ) handleCommittee (ctx context.Context , committee * scheduler.Committee ) {
502512 if committee .Kind != scheduler .KindComputeExecutor {
503513 return
@@ -637,6 +647,7 @@ func NewNode(
637647 provisioner host.Provisioner ,
638648 rtRegistry runtimeRegistry.Registry ,
639649 identity * identity.Identity ,
650+ willRegisterComputeRuntime bool ,
640651 keymanager keymanager.Backend ,
641652 consensus consensus.Service ,
642653 lightProvider consensus.LightProvider ,
@@ -659,24 +670,25 @@ func NewNode(
659670 txTopic := p2pProtocol .NewTopicKindTxID (chainContext , runtime .ID ())
660671
661672 n := & Node {
662- ChainContext : chainContext ,
663- HostNode : hostNode ,
664- Runtime : runtime ,
665- RuntimeRegistry : rtRegistry ,
666- Identity : identity ,
667- KeyManager : keymanager ,
668- Consensus : consensus ,
669- LightProvider : lightProvider ,
670- Group : group ,
671- P2P : p2pHost ,
672- txTopic : txTopic ,
673- ctx : ctx ,
674- cancelCtx : cancel ,
675- stopCh : make (chan struct {}),
676- quitCh : make (chan struct {}),
677- initCh : make (chan struct {}),
678- dispatchInfoCh : make (chan struct {}, 1 ),
679- logger : logging .GetLogger ("worker/common/committee" ).With ("runtime_id" , runtime .ID ()),
673+ ChainContext : chainContext ,
674+ HostNode : hostNode ,
675+ Runtime : runtime ,
676+ RuntimeRegistry : rtRegistry ,
677+ Identity : identity ,
678+ WillRegisterComputeRuntime : willRegisterComputeRuntime ,
679+ KeyManager : keymanager ,
680+ Consensus : consensus ,
681+ LightProvider : lightProvider ,
682+ Group : group ,
683+ P2P : p2pHost ,
684+ txTopic : txTopic ,
685+ ctx : ctx ,
686+ cancelCtx : cancel ,
687+ stopCh : make (chan struct {}),
688+ quitCh : make (chan struct {}),
689+ initCh : make (chan struct {}),
690+ dispatchInfoCh : make (chan struct {}, 1 ),
691+ logger : logging .GetLogger ("worker/common/committee" ).With ("runtime_id" , runtime .ID ()),
680692 }
681693
682694 // Prepare the key manager client wrapper.
0 commit comments