params

package
v0.0.0-...-9f791b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ContractBalanceProofMessageLength balance proof  length
	ContractBalanceProofMessageLength = "176"
	//ContractBalanceProofDelegateMessageLength update balance proof delegate length
	ContractBalanceProofDelegateMessageLength = "144"
	//ContractCooperativeSettleMessageLength cooperative settle channel proof length
	ContractCooperativeSettleMessageLength = "176"
	//ContractDisposedProofMessageLength annouce disposed proof length
	ContractDisposedProofMessageLength = "136"
	//ContractWithdrawProofMessageLength withdraw proof length
	ContractWithdrawProofMessageLength = "156"
	//ContractUnlockDelegateProofMessageLength unlock delegate proof length
	ContractUnlockDelegateProofMessageLength = "188"
)
View Source
const AliasFragment = "discovery"

AliasFragment is discovery AliasFragment

View Source
const ChannelSettleTimeoutMax = 2700000

ChannelSettleTimeoutMax The maximum settle timeout is chosen as something above

1 year with the assumption of very fast block times of 12 seconds.
There is a maximum to avoidpotential overflows as described here:
https://github.com/Photon/photon/issues/1038
View Source
const ChannelSettleTimeoutMin = 6

ChannelSettleTimeoutMin min settle timeout

View Source
const DefaultGasLimit = 3141592 //den's gasLimit.

DefaultGasLimit max gas usage for photon tx

View Source
const DefaultGasPrice = params.Shannon * 20

DefaultGasPrice from ethereum

View Source
const DefaultInitialChannelTarget = 3

DefaultInitialChannelTarget channels to create

View Source
const DefaultJoinableFundsTarget = 0.4

DefaultJoinableFundsTarget for connection api

View Source
const DefaultPollTimeout = 180 * time.Second

DefaultPollTimeout request wait time

View Source
const DefaultSettleTimeout = 600

DefaultSettleTimeout settle time of channel

View Source
const DefaultTestXMPPServer = "193.112.248.133:5222" //"182.254.155.208:5222"

DefaultTestXMPPServer xmpp server for test only

View Source
const DefaultTxTimeout = 5 * time.Minute //15seconds for one block,it may take sever minutes

DefaultTxTimeout args

View Source
const DefaultXMPPServer = "193.112.248.133:5222"

DefaultXMPPServer xmpp server

View Source
const DiscoveryServer = "transport01.smartmesh.cn"

DiscoveryServer is discovery server

View Source
const InitialPort = 40001

InitialPort listening port for communication bewtween nodes

View Source
const MaxRequestTimeout = 20 * time.Minute //longest time for a request ,for example ,settle all channles?

MaxRequestTimeout args

View Source
const MinBalanceofPubChannel = 1

MinBalanceofPubChannel 单位10^18gwei

View Source
const NameBalanceProofUpdated = "BalanceProofUpdated"

NameBalanceProofUpdated update balance proof event of token network

View Source
const NameChannelClosed = "ChannelClosed"

NameChannelClosed event ChannelClosed(bytes32 indexed channel_identifier, address indexed closing_participant);

View Source
const NameChannelCooperativeSettled = "ChannelCooperativeSettled"

NameChannelCooperativeSettled represents channel cooperatively settled

View Source
const NameChannelNewDeposit = "ChannelNewDeposit"

NameChannelNewDeposit deposit event of token network

View Source
const NameChannelOpenedAndDeposit = "ChannelOpenedAndDeposit"

NameChannelOpenedAndDeposit new channel and deposit event of token network

View Source
const NameChannelPunished = "ChannelPunished"

NameChannelPunished punish event of token network

View Source
const NameChannelSettled = "ChannelSettled"

NameChannelSettled settle channel event of token network

View Source
const NameChannelUnlocked = "ChannelUnlocked"

NameChannelUnlocked unlock event of token network

View Source
const NameChannelWithdraw = "ChannelWithdraw"

NameChannelWithdraw withdraw event of token network

View Source
const NameSecretRevealed = "SecretRevealed"

NameSecretRevealed name from contract

View Source
const NameTokenNetworkCreated = "TokenNetworkCreated"

NameTokenNetworkCreated event TokenNetworkCreated(address indexed token_address, address indexed token_network_address);

View Source
const SMTTokenName = "SMTToken"

SMTTokenName SMTToken名,固定

View Source
const UDPMaxMessageSize = 1200

UDPMaxMessageSize message size

Variables

View Source
var ChainID = DefaultChainID

ChainID of this tokenNetwork

View Source
var ContractSignaturePrefix = []byte("\x19Spectrum Signed Message:\n")

ContractSignaturePrefix for EIP191 https://github.com/ethereum/EIPs/blob/master/EIPS/eip-191.md

View Source
var ContractVersionPrefix = "0.6"

ContractVersionPrefix :

View Source
var DefaultChainID = big.NewInt(0)

DefaultChainID :

View Source
var DefaultConfig = Config{
	Port:          InitialPort,
	RevealTimeout: DefaultRevealTimeout,
	SettleTimeout: DefaultSettleTimeout,
	Protocol: protocolConfig{
		RetryInterval:        defaultprotocolRetryInterval,
		RetriesBeforeBackoff: defaultProtocolRetiesBeforeBackoff,
		ThrottleCapacity:     defaultProtocolRhrottleCapacity,
		ThrottleFillRate:     defaultProtocolThrottleFillRate,
	},
	UseRPC:            true,
	UseConsole:        false,
	MsgTimeout:        100 * time.Second,
	EnableHealthCheck: false,
	XMPPServer:        DefaultXMPPServer,
}

DefaultConfig default config

View Source
var DefaultEthRPCPollPeriod = 7500 * time.Millisecond

DefaultEthRPCPollPeriod :

View Source
var DefaultEthRPCPollPeriodForTest = 500 * time.Millisecond

DefaultEthRPCPollPeriodForTest :

View Source
var DefaultMDNSKeepalive = 20 * time.Second

DefaultMDNSKeepalive 默认mdns下20秒内检测不到在线,将该节点标志为下线

View Source
var DefaultMDNSQueryInterval = time.Second

DefaultMDNSQueryInterval 默认轮询间隔是1s,在测试代码中会更改他,以提高效率

View Source
var DefaultRevealTimeout = 30

DefaultRevealTimeout blocks needs to update transfer this time is used for a participant to register secret on chain and unlock the lock if need.

View Source
var EnableForkConfirm = false

EnableForkConfirm : 事件延迟确认开关

View Source
var EnableMDNS = true

EnableMDNS 是否启用mdns

View Source
var EthRPCTimeout = 3 * time.Second

EthRPCTimeout :

View Source
var ForkConfirmNumber int64 = 17

ForkConfirmNumber : 分叉确认块数量,BlockNumber < 最新块-ForkConfirmNumber的事件被认为无分叉的风险

View Source
var GenesisBlockHashToDefaultRegistryAddress = map[common.Hash]common.Address{

	common.HexToHash("0x57e682b80257aad73c4f3ad98d20435b4e1644d8762ef1ea1ff2806c27a5fa3d"): common.HexToAddress("0x08b7d79ec4ebd53e5b89c7c062cc64bb09d063e3"),

	common.HexToHash("0xd011e2cc7f241996a074e2c48307df3971f5f1fe9e1f00cfa704791465d5efc3"): common.HexToAddress("0xc479184abeb8c508ee96e4c093ee47af2256cbbf"),

	common.HexToHash("0x88e96d4537bea4d9c05d12549907b32561d3bf31f45aae734cdc119f13406cb6"): utils.EmptyAddress,

	common.HexToHash("0x41800b5c3f1717687d85fc9018faac0a6e90b39deaa0b99e7fe4fe796ddeb26a"): utils.EmptyAddress,

	common.HexToHash("0x38a88a9ddffe522df5c07585a7953f8c011c94327a494188bd0cc2410dc40a1a"): common.HexToAddress("0x2907b8bf0fF92dA818E2905fB5218b1A8323Ffb4"),
}

GenesisBlockHashToDefaultRegistryAddress :

View Source
var GenesisBlockHashToPFS = map[common.Address]string{

	common.HexToAddress("0x08b7d79ec4ebd53e5b89c7c062cc64bb09d063e3"): "http://transport01.smartmesh.cn:7000",

	common.HexToAddress("0xc479184abeb8c508ee96e4c093ee47af2256cbbf"): "http://transport01.smartmesh.cn:7001",

	common.HexToAddress("0x2907b8bf0fF92dA818E2905fB5218b1A8323Ffb4"): "http://transport01.smartmesh.cn:7002",
}

GenesisBlockHashToPFS : default pfs provider

View Source
var InTest = true

InTest are we test now?

View Source
var MatrixServerConfig = map[string]string{
	"transport01.smartmesh.cn": "http://transport01.smartmesh.cn:8008",

	"transport13.smartmesh.cn": "http://transport13.smartmesh.cn:8008",
}

MatrixServerConfig matrix server config

View Source
var MaxTransferDataLen = 256

MaxTransferDataLen : 交易附件信息最大长度

View Source
var MobileMode bool

MobileMode works on mobile device, 移动设备模式,这时候 photon 并不是一个独立的进程,这时候很多工作模式要发生变化. 比如: 1.不能任意退出 2. 对于网络通信的处理要更谨慎 3. 对于资源的消耗如何控制?

  • MobileMode : a boolean value to adapt with mobile modes. *
  • Note : if true, then photon is not an individual process, work mode is about to change.
  • 1. not support exit arbitrarily.
  • 2. handle internet communication more prudent.
  • 3. How to control amount of resource consumption.
View Source
var NETWORKNAME = "ropsten"

NETWORKNAME Specify the network name of the Ethereum network to run Photon on

View Source
var PunishBlockNumber int64

PunishBlockNumber is punish_block_number of contract,default is 257

View Source
var SettleTimeoutSuperNode = 40000

SettleTimeoutSuperNode for supernode (unit:block)

View Source
var TestLogServer = "http://transport01.smartmesh.cn:8008"

TestLogServer only for test, enabled if --debug flag is set

View Source
var TestPrivateChainID int64 = 8888

TestPrivateChainID :

View Source
var TestPrivateChainID2 int64 = 7888

TestPrivateChainID2 : for travis fast test

View Source
var TokenAddress = common.HexToAddress("0x6601F810eaF2fa749EEa10533Fd4CC23B8C791dc")

tokenAddress

Functions

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir default work directory

func DefaultKeyStoreDir

func DefaultKeyStoreDir() string

DefaultKeyStoreDir keystore path of ethereum

Types

type ConditionQuit

type ConditionQuit struct {
	QuitEvent  string //name match
	IsBefore   bool   //quit before event occur
	RandomQuit bool   //random exit
}

ConditionQuit is for test

type Config

type Config struct {
	EthRPCEndPoint            string
	Host                      string
	Port                      int
	PrivateKey                *ecdsa.PrivateKey
	RevealTimeout             int
	SettleTimeout             int
	DataBasePath              string
	MsgTimeout                time.Duration
	Protocol                  protocolConfig
	UseRPC                    bool
	UseConsole                bool
	APIHost                   string
	APIPort                   int
	RegistryAddress           common.Address
	DataDir                   string
	MyAddress                 common.Address
	Debug                     bool
	DebugCrash                bool          //for test only,work with conditionQuit
	ConditionQuit             ConditionQuit //for test only
	NetworkMode               NetworkMode
	EnableMediationFee        bool //default false. which means no fee at all.
	IgnoreMediatedNodeRequest bool // true: this node will ignore any mediated transfer who's target is not me.
	EnableHealthCheck         bool //send ping periodically?
	XMPPServer                string
	IsMeshNetwork             bool   //is mesh now?
	PfsHost                   string // pathfinder server host
	HTTPUsername              string
	HTTPPassword              string
	PubAddress                common.Address
	RewardPeriod              int
	PubApiHost                string

	TokensPerLike        int64
	EffectiveLikesPerDay int

	TokensPerDailyLogin                  int64
	EffectiveDailyLoginNumberPerDay      int
	TokensPerDailyPost                   int64
	EffectiveDailyPostNumberPerDay       int
	TokensPerDailyComment                int64
	EffectiveDailyCommentNumberPerDay    int
	TokensPerDailyCreatedNft             int64
	EffectiveDailyCreatedNftNumberPerDay int
}

Config is configuration for Photon,

type NetworkMode

type NetworkMode int

NetworkMode is transport status

const (
	//NoNetwork 节点不对外暴露网络接口,仅供测试使用
	// NoNetwork : Node does not expose interface, just for case.
	NoNetwork NetworkMode = iota + 1
	//UDPOnly 通过udp ip 端口对外暴露服务,可以使用 stun,upnp 等方式,依赖节点发现合约或者直接告知其他节点 ip 端口
	// UDPOnly : expose service via udp ip, we can use stun, upnp and node to find contracts or tell other nodes with ip port.
	UDPOnly
	//XMPPOnly 通过XMPP服务器进行通信
	// XMPPOnly : communicate via XMPP server.
	XMPPOnly
	//MixUDPXMPP 适应无网通信需要,将上面两种方式混合使用,有网时使用 ice 建立连接,无网时则使用 udp 直接暴露 ip 端口
	// MixUDPXMPP : used for Internet-free network, combining UDPOnly and XMPPOnly.
	// While Internet, it use ice to create connection; while Internet-free, it use udp to expose ip port.
	MixUDPXMPP
	//MixUDPMatrix Matrix and UDP at the same time
	MixUDPMatrix
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL