# Final block approval in symbiotic relation ## Orchestrator to Pandora and Vanguard This document should represent possible (technical) solution about final block approval. ### Connectivity and Relations `Orchestrator` can have multiple connections accross both `execution` and `consensus` layer For those whom orchestrator trust we estabilish `subscription` via `pub/sub` https://geth.ethereum.org/docs/rpc/pubsub `Orchestrator` will have have the following connectivity: * `Pandora Client` * `Vanguard Client` * `Orchestrator Server` In flow we have `Trusted` role for `Pandora` and `Vanguard` Those are to whom orchestrator subscribe ### Final approve during block synchronisation (PULL) ```gherkin= @Scenario Final approve during block synchronization @Given Trusted Pandora has received execution block from its peers @And Trusted Vanguard has received consensus block from its peers @And Orchestrator is notified about execution block @And Orchestrator is notified about consensus block # Pandora check @When Pandora asks about validity of execution block @Then Orchestrator compares hash of the execution block @And Notifies Pandora about validity @And Vanguard asks about validity of execution block @Then Orchestrator compares hash of the execution block @And Notifies Vanguard about validity of the execution block ``` ### Push strategy > [name=This part may be redundant] > > `Subscribents` will listen to following orchestrator event(s): > * `orc_newBlockPairConfirmed` > ```go= > type ValidBlockPair { > ConsensusHash common.Hash{} `json:"consensusHash"` > ExecutionHashes [int]common.Hash{} `json:"executionHashes"` > } > > func (blockPair *ValidBlockPair) Hash() (blockPairHash common.Hash) { > hasher := sha3.NewLegacyKeccak256() > rlp.Encode(hasher, blockPair) > hasher.Sum(blockPairHash[:0]) > > return > } > ``` > > In that approach we should have multiple subscribers listening to those events and if those clients have queue system awaiting for this information. This will be helpful when new block is produced and you are a peer awaiting for confirmation on any side (`Pandora` or `Vanguard`) > > > > ### Final approve during block creation (PUSH) > ```gherkin= > @Scenario > Final approve during block creation > > @Given Pandora has received valid signature from Vanguard > @And Pandora is ready to insert block into its db > @And Vanguard is ready to insert block into its db > @When Orchestrator received information from Pandora and Vanguard > @Then Orchestrator pushes it into its database > @And Orchestrator notifies all subscribers about valid block >```