github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/dkg/mock_client.go (about) 1 package dkg 2 3 import ( 4 "github.com/onflow/crypto" 5 "github.com/rs/zerolog" 6 7 "github.com/onflow/flow-go/model/flow" 8 model "github.com/onflow/flow-go/model/messages" 9 ) 10 11 // TEMPORARY: The functionality to allow starting up a node without a properly configured 12 // machine account is very much intended to be temporary. 13 14 // This is required to support the very first mainnet spork with the epoch smart contract. 15 // At the beginning of the spork, operators will not have been able to generate their machine account 16 // because the smart contracts to do so have not been deployed yet. Therefore, for the duration of the spork, 17 // we allow this config to be omitted. For all subsequent sporks, it will be required. 18 // Implemented by: https://github.com/dapperlabs/flow-go/issues/5585 19 // Will be reverted by: https://github.com/dapperlabs/flow-go/issues/5619 20 21 type MockClient struct { 22 log zerolog.Logger 23 } 24 25 func NewMockClient(log zerolog.Logger) *MockClient { 26 27 log = log.With().Str("component", "mock_dkg_contract_client").Logger() 28 return &MockClient{log: log} 29 } 30 31 func (c *MockClient) Broadcast(msg model.BroadcastDKGMessage) error { 32 c.log.Fatal().Msg("caution: missing machine account configuration, but machine account used (Broadcast)") 33 return nil 34 } 35 36 func (c *MockClient) ReadBroadcast(fromIndex uint, referenceBlock flow.Identifier) ([]model.BroadcastDKGMessage, error) { 37 c.log.Fatal().Msg("caution: missing machine account configuration, but machine account used (ReadBroadcast)") 38 return nil, nil 39 } 40 41 func (c *MockClient) SubmitResult(groupPublicKey crypto.PublicKey, publicKeys []crypto.PublicKey) error { 42 c.log.Fatal().Msg("caution: missing machine account configuration, but machine account used (SubmitResult)") 43 return nil 44 }