Documentation ¶
Index ¶
- Constants
- func EnsureConnection(client *ethclient.Client) error
- func EstimateGas(client *ethclient.Client, prikey *ecdsa.PrivateKey, chainId *big.Int, ...) (*types.Transaction, error)
- func GetMerkleRoot(elements [][32]byte) ([32]byte, error)
- func IsAddrExist(set []common.Address, find common.Address) bool
- func NewJwtHandler(handle http.Handler, jetSecretKey string) (http.Handler, error)
- func NodeToAddress(publicKey string) (common.Address, error)
- func RollBackHash(startBlock *big.Int) ([]byte, error)
- func SetCmdConfig(cmd *cobra.Command, config Configuration) error
- func SetGroupPubKeyBytes(localKey, poolPubKey []byte) ([]byte, error)
- func SlashBytes(msg, sig []byte) ([]byte, error)
- func SlashMsgBytes(batchIndex uint64, jailNode common.Address, tssNodes []common.Address, ...) ([]byte, error)
- func SlashMsgHash(batchIndex uint64, jailNode common.Address, tssNodes []common.Address, ...) ([]byte, error)
- func StateBatchHash(stateRoots [][32]byte, offsetStartsAtIndex *big.Int) ([]byte, error)
- type AKSKConfig
- type AskResponse
- type BatchSubmitterResponse
- type Configuration
- type JwtHandler
- type KeygenRequest
- type KeygenResponse
- type KmsConfig
- type ManagerConfig
- type Method
- type NodeConfig
- type NodeSignRequest
- type RollBackRequest
- type S3Config
- type SMConfig
- type SecretsManagerConfig
- type ShamirConfig
- type SignResponse
- type SignStateRequest
- type SignatureData
- type SlashMsg
- type SlashRequest
Constants ¶
const ( AskStateBatch Method = "askStateBatch" SignStateBatch Method = "signStateBatch" AskSlash Method = "askSlash" SignSlash Method = "signSlash" SignRollBack Method = "signRollBack" AskRollBack Method = "askRollBack" SlashTypeLiveness byte = 0 SlashTypeCulprit byte = 1 CulpritErrorCode = 100 )
const (
JwtSecretLength = 32
)
Variables ¶
This section is empty.
Functions ¶
func EnsureConnection ¶
Ensure we can actually connect l1
func EstimateGas ¶
func EstimateGas(client *ethclient.Client, prikey *ecdsa.PrivateKey, chainId *big.Int, ctx context.Context, tx *types.Transaction, rawContract *bind.BoundContract, to common.Address) (*types.Transaction, error)
func GetMerkleRoot ¶
GetMerkleRoot Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number of leaves passed in is not a power of two, it pads out the tree with zero hashes. If you do not know the original length of elements for the tree you are verifying, then this may allow empty leaves past elements.length to pass a verification check down the line. Note that the _elements argument is modified, therefore it must not be used again afterwards @param elements Array of hashes from which to generate a merkle root. @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).
func NewJwtHandler ¶
func SetCmdConfig ¶
func SetCmdConfig(cmd *cobra.Command, config Configuration) error
func SetGroupPubKeyBytes ¶
func SlashBytes ¶
func SlashMsgBytes ¶
func SlashMsgHash ¶
Types ¶
type AKSKConfig ¶
type AskResponse ¶
type AskResponse struct {
Result bool `json:"result"`
}
type BatchSubmitterResponse ¶
type Configuration ¶
type Configuration struct { Manager ManagerConfig `json:"manager"` Node NodeConfig `json:"node"` L1Url string `json:"l1_url" mapstructure:"l1_url"` SccContractAddress string `json:"scc_contract_address" mapstructure:"scc_contract_address"` TssGroupContractAddress string `json:"tss_group_contract_address" mapstructure:"tss_group_contract_address"` TssStakingSlashContractAddress string `json:"tss_staking_slash_contract_address" mapstructure:"tss_staking_slash_contract_address"` TimedTaskInterval string `json:"timed_task_interval" mapstructure:"timed_task_interval"` L1ReceiptConfirmTimeout string `json:"l1_receipt_confirm_timeout" mapstructure:"l1_receipt_confirm_timeout"` L1ConfirmBlocks int `json:"l1_confirm_blocks" mapstructure:"l1_confirm_blocks"` L1StartBlockNumber string `json:"l1_start_block_number" mapstructure:"l1_start_block_number"` MissSignedNumber int `json:"miss_signed_number" mapstructure:"miss_signed_number"` }
func DefaultConfiguration ¶
func DefaultConfiguration() Configuration
func GetConfigFromCmd ¶
func GetConfigFromCmd(cmd *cobra.Command) Configuration
func LoadConfig ¶
func LoadConfig(file string) (Configuration, error)
type JwtHandler ¶
type JwtHandler struct {
// contains filtered or unexported fields
}
func (*JwtHandler) ServeHTTP ¶
func (handler *JwtHandler) ServeHTTP(out http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type KeygenRequest ¶
type KeygenResponse ¶
type KeygenResponse struct {
ClusterPublicKey string `json:"cluster_public_key"`
}
type KmsConfig ¶
type KmsConfig struct { KeyId string `json:"key_id" mapstructure:"key_id"` Region string `json:"region" mapstructure:"region"` Aksk AKSKConfig `json:"aksk" mapstructure:"aksk"` }
type ManagerConfig ¶
type ManagerConfig struct { WsAddr string `json:"ws_addr" mapstructure:"ws_addr"` HttpAddr string `json:"http_addr" mapstructure:"http_addr"` JwtSecret string `json:"jwt_secret" mapstructure:"jwt_secret"` DBDir string `json:"db_dir" mapstructure:"db_dir"` PrivateKey string `json:"private_key" mapstructure:"private_key"` KeygenTimeout string `json:"keygen_timeout" mapstructure:"keygen_timeout"` CPKConfirmTimeout string `json:"cpk_confirm_timeout" mapstructure:"cpk_confirm_timeout"` AskTimeout string `json:"ask_timeout" mapstructure:"ask_timeout"` SignTimeout string `json:"sign_timeout" mapstructure:"sign_timeout"` }
type NodeConfig ¶
type NodeConfig struct { BaseDir string `json:"base_dir" mapstructure:"base_dir"` DBDir string `json:"db_dir" mapstructure:"db_dir"` WsAddr string `json:"ws_addr" mapstructure:"ws_addr"` HttpAddr string `json:"http_addr" mapstructure:"http_addr"` JwtSecret string `json:"jwt_secret" mapstructure:"jwt_secret"` L2EthRpc string `json:"l2_eth_rpc" mapstructure:"l2_eth_rpc"` DisableHTTP2 bool `json:"disable_http2" mapstructure:"disable_http2"` PrivateKey string `json:"private_key" mapstructure:"private_key"` PreParamFile string `json:"pre_param_file" mapstructure:"pre_param_file"` P2PPort string `json:"p2p_port" mapstructure:"p2p_port"` BootstrapPeers string `json:"bootstrap_peers" mapstructure:"bootstrap_peers"` ExternalIP string `json:"external_ip" mapstructure:"external_ip"` KeyGenTimeout time.Duration `json:"key_gen_timeout" mapstructure:"key_gen_timeout"` KeySignTimeout time.Duration `json:"key_sign_timeout" mapstructure:"key_sign_timeout"` PreParamTimeout time.Duration `json:"pre_param_timeout" mapstructure:"pre_param_timeout"` GasLimitScaler int `json:"gas_limit_scaler" mapstructure:"gas_limit_scaler"` Secrets SecretsManagerConfig `json:"secrets" mapstructure:"secrets"` Shamir ShamirConfig `json:"shamir" mapstructure:"shamir"` }
type NodeSignRequest ¶
type RollBackRequest ¶
type S3Config ¶
type S3Config struct { Region string `json:"region" mapstructure:"region"` Buckets string `json:"buckets" mapstructure:"buckets"` Aksk AKSKConfig `json:"aksk" mapstructure:"aksk"` }
type SMConfig ¶
type SMConfig struct { Region string `json:"region" mapstructure:"region"` SecretIds string `json:"secretIds" mapstructure:"secretIds"` Aksk AKSKConfig `json:"aksk" mapstructure:"aksk"` }
type SecretsManagerConfig ¶
type ShamirConfig ¶
type SignResponse ¶
type SignResponse struct {
Signature []byte `json:"signature"`
}
type SignStateRequest ¶
type SignStateRequest struct { Type uint64 `json:"type"` StartBlock *big.Int `json:"start_block"` OffsetStartsAtIndex *big.Int `json:"offset_starts_at_index"` Challenge string `json:"challenge"` StateRoots [][32]byte `json:"state_roots"` ElectionId uint64 `json:"election_id"` }
func (SignStateRequest) String ¶
func (ssr SignStateRequest) String() string
type SignatureData ¶
type SignatureData struct { // Ethereum-style recovery byte; only the first byte is relevant SignatureRecovery []byte `json:"signature_recovery,omitempty"` // Signature components R, S R []byte `json:"r,omitempty"` S []byte `json:"s,omitempty"` // M represents the original message digest that was signed M M []byte `json:"m,omitempty"` }