github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/ibc-go/testing/config.go (about)

     1  package ibctesting
     2  
     3  import (
     4  	"time"
     5  
     6  	connectiontypes "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/03-connection/types"
     7  	channeltypes "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/04-channel/types"
     8  	"github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/exported"
     9  	ibctmtypes "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/light-clients/07-tendermint/types"
    10  	"github.com/fibonacci-chain/fbc/libs/ibc-go/testing/mock"
    11  )
    12  
    13  type ClientConfig interface {
    14  	GetClientType() string
    15  }
    16  
    17  type TendermintConfig struct {
    18  	TrustLevel                   ibctmtypes.Fraction
    19  	TrustingPeriod               time.Duration
    20  	UnbondingPeriod              time.Duration
    21  	MaxClockDrift                time.Duration
    22  	AllowUpdateAfterExpiry       bool
    23  	AllowUpdateAfterMisbehaviour bool
    24  }
    25  
    26  func NewTendermintConfig() *TendermintConfig {
    27  	return &TendermintConfig{
    28  		TrustLevel:                   DefaultTrustLevel,
    29  		TrustingPeriod:               TrustingPeriod,
    30  		UnbondingPeriod:              UnbondingPeriod,
    31  		MaxClockDrift:                MaxClockDrift,
    32  		AllowUpdateAfterExpiry:       false,
    33  		AllowUpdateAfterMisbehaviour: false,
    34  	}
    35  }
    36  
    37  func (tmcfg *TendermintConfig) GetClientType() string {
    38  	return exported.Tendermint
    39  }
    40  
    41  type ConnectionConfig struct {
    42  	DelayPeriod uint64
    43  	Version     *connectiontypes.Version
    44  }
    45  
    46  func NewConnectionConfig() *ConnectionConfig {
    47  	return &ConnectionConfig{
    48  		DelayPeriod: DefaultDelayPeriod,
    49  		Version:     ConnectionVersion,
    50  	}
    51  }
    52  
    53  type ChannelConfig struct {
    54  	PortID  string
    55  	Version string
    56  	Order   channeltypes.Order
    57  }
    58  
    59  func NewChannelConfig() *ChannelConfig {
    60  	return &ChannelConfig{
    61  		PortID:  mock.ModuleName,
    62  		Version: DefaultChannelVersion,
    63  		Order:   channeltypes.UNORDERED,
    64  	}
    65  }