github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/evm/emulator/signer.go (about)

     1  package emulator
     2  
     3  import (
     4  	"math/big"
     5  
     6  	"github.com/onflow/go-ethereum/core/types"
     7  )
     8  
     9  var defaultBlockNumberForEVMRules = big.NewInt(1) // anything bigger than 0
    10  
    11  // GetDefaultSigner returns a signer which is compatible with the default config
    12  func GetDefaultSigner() types.Signer {
    13  	cfg := NewConfig(WithBlockNumber(defaultBlockNumberForEVMRules))
    14  	return GetSigner(cfg)
    15  }
    16  
    17  // GetSigner returns a evm signer object that is compatible with the given config
    18  //
    19  // Despite its misleading name, signer encapsulates transaction signature validation functionality and
    20  // does not provide actual signing functionality.
    21  // we kept the same name to be consistent with EVM naming.
    22  func GetSigner(cfg *Config) types.Signer {
    23  	return types.MakeSigner(
    24  		cfg.ChainConfig,
    25  		cfg.BlockContext.BlockNumber,
    26  		cfg.BlockContext.Time,
    27  	)
    28  }