github.com/koko1123/flow-go-1@v0.29.6/module/epochs/mock_qc_client.go (about)

     1  package epochs
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/rs/zerolog"
     7  
     8  	"github.com/koko1123/flow-go-1/consensus/hotstuff/model"
     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 MockQCContractClient struct {
    22  	log zerolog.Logger
    23  }
    24  
    25  func NewMockQCContractClient(log zerolog.Logger) *MockQCContractClient {
    26  	log = log.With().Str("component", "mock_qc_contract_client").Logger()
    27  	return &MockQCContractClient{log: log}
    28  }
    29  
    30  func (c *MockQCContractClient) SubmitVote(ctx context.Context, vote *model.Vote) error {
    31  	c.log.Fatal().Msg("caution: missing machine account configuration, but machine account used (SubmitVote)")
    32  	return nil
    33  }
    34  
    35  func (c *MockQCContractClient) Voted(ctx context.Context) (bool, error) {
    36  	c.log.Fatal().Msg("caution: missing machine account configuration, but machine account used (Voted)")
    37  	return false, nil
    38  }