Skip to content

Commit

Permalink
some smaller changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kishansagathiya committed Sep 5, 2024
1 parent ca16b01 commit a2f7fb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
1 change: 0 additions & 1 deletion dot/parachain/backing/candidate_backing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
candidatevalidation "github.com/ChainSafe/gossamer/dot/parachain/candidate-validation"
collatorprotocolmessages "github.com/ChainSafe/gossamer/dot/parachain/collator-protocol/messages"
provisionermessages "github.com/ChainSafe/gossamer/dot/parachain/provisioner/messages"

parachaintypes "github.com/ChainSafe/gossamer/dot/parachain/types"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/crypto/sr25519"
Expand Down
3 changes: 3 additions & 0 deletions dot/parachain/overseer/overseer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ChainSafe/gossamer/dot/parachain/chainapi"
collatorprotocolmessages "github.com/ChainSafe/gossamer/dot/parachain/collator-protocol/messages"
networkbridgemessages "github.com/ChainSafe/gossamer/dot/parachain/network-bridge/messages"
provisionermessages "github.com/ChainSafe/gossamer/dot/parachain/provisioner/messages"
parachain "github.com/ChainSafe/gossamer/dot/parachain/runtime"
parachaintypes "github.com/ChainSafe/gossamer/dot/parachain/types"
"github.com/ChainSafe/gossamer/dot/parachain/util"
Expand Down Expand Up @@ -144,6 +145,8 @@ func (o *OverseerSystem) processMessages() {

case chainapi.ChainAPIMessage[util.Ancestors], chainapi.ChainAPIMessage[chainapi.BlockHeader]:
subsystem = o.nameToSubsystem[parachaintypes.ChainAPI]
case provisionermessages.RequestInherentData, provisionermessages.ProvisionableData:
subsystem = o.nameToSubsystem[parachaintypes.Provisioner]

case parachain.RuntimeAPIMessage:
// TODO: this should be handled by the parachain runtime subsystem, see issue #3940
Expand Down
27 changes: 6 additions & 21 deletions dot/parachain/provisioner/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ var logger = log.NewFromGlobal(log.AddContext("pkg", "provisioner"))
const INHERENT_TIMEOUT = time.Millisecond * 2000

type Provisioner struct {
// TODO This doesn't have to be a channel with buffer.
// TODO #4162
// This doesn't have to be a channel with buffer.
// The idea is to send a relay parent hash on this channel after INHERENT_TIMEOUT, open to design changes
inherentAfterDelay chan common.Hash
}

func (p Provisioner) Run(ctx context.Context, overseerToSubSystem <-chan any) {
// TODO https://github.com/paritytech/polkadot-sdk/blob/e1460b5ee5f4490b428035aa4a72c1c99a262459/polkadot/node/core/provisioner/src/lib.rs#L177

for {
select {
// TODO: polkadot-rust changes reputation in batches, so we do the same?
case msg, ok := <-overseerToSubSystem:
if !ok {
return
Expand All @@ -37,7 +35,7 @@ func (p Provisioner) Run(ctx context.Context, overseerToSubSystem <-chan any) {
}
case <-p.inherentAfterDelay:
// This inherentAfterDelay gets populated while handling active leaves update signal
// TODO https://github.com/paritytech/polkadot-sdk/blob/e1460b5ee5f4490b428035aa4a72c1c99a262459/polkadot/node/core/provisioner/src/lib.rs#L181
// TODO #4162
}

}
Expand All @@ -46,9 +44,9 @@ func (p Provisioner) Run(ctx context.Context, overseerToSubSystem <-chan any) {
func (p Provisioner) processMessage(msg any) error {
switch msg.(type) {
case provisionermessages.RequestInherentData:
// TODO https://github.com/paritytech/polkadot-sdk/blob/e1460b5ee5f4490b428035aa4a72c1c99a262459/polkadot/node/core/provisioner/src/lib.rs#L253
// TODO #4159
case provisionermessages.ProvisionableData:
// TODO https://github.com/paritytech/polkadot-sdk/blob/e1460b5ee5f4490b428035aa4a72c1c99a262459/polkadot/node/core/provisioner/src/lib.rs#L271
// TODO #4160
default:
return parachaintypes.ErrUnknownOverseerMessage
}
Expand All @@ -62,8 +60,7 @@ func (p Provisioner) Name() parachaintypes.SubSystemName {
}

func (p Provisioner) ProcessActiveLeavesUpdateSignal(parachaintypes.ActiveLeavesUpdateSignal) error {
// TODO https://github.com/paritytech/polkadot-sdk/blob/e1460b5ee5f4490b428035aa4a72c1c99a262459/polkadot/node/core/provisioner/src/lib.rs#L173
// https://github.com/paritytech/polkadot-sdk/blob/e1460b5ee5f4490b428035aa4a72c1c99a262459/polkadot/node/core/provisioner/src/lib.rs#L201
// TODO #4061
return nil
}

Expand All @@ -73,15 +70,3 @@ func (p Provisioner) ProcessBlockFinalizedSignal(parachaintypes.BlockFinalizedSi
}

func (p Provisioner) Stop() {}

type RequestInherentData struct {
RelayParent common.Hash
ProvisionerInherentData chan ProvisionerInherentData
}

type ProvisionerInherentData struct {
}

type ProvisionableData struct {
RelayParent common.Hash
}

0 comments on commit a2f7fb2

Please sign in to comment.