Skip to content

Commit

Permalink
stop adding tss to zetacore
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Jan 18, 2024
1 parent 27303ee commit d5d06fe
Showing 1 changed file with 49 additions and 43 deletions.
92 changes: 49 additions & 43 deletions zetaclient/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,28 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation(
}

func (b *ZetaCoreBridge) SetTSS(tssPubkey string, keyGenZetaHeight int64, status common.ReceiveStatus) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
msg := types.NewMsgCreateTSSVoter(signerAddress, tssPubkey, keyGenZetaHeight, status)

authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}

zetaTxHash := ""
for i := 0; i <= DefaultRetryCount; i++ {
zetaTxHash, err = b.Broadcast(DefaultGasLimit, authzMsg, authzSigner)
if err == nil {
return zetaTxHash, nil
}
b.logger.Debug().Err(err).Msgf("SetTSS broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}

return "", fmt.Errorf("set tss failed | err %s", err.Error())
log := fmt.Sprintf("TSS not reported , tssPubkey : %s , keygenZetaHeight %d , status %s", tssPubkey, keyGenZetaHeight, status.String())
b.logger.Info().Msg(log)
return log, nil
//signerAddress := b.keys.GetOperatorAddress().String()
//msg := types.NewMsgCreateTSSVoter(signerAddress, tssPubkey, keyGenZetaHeight, status)
//
//authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
//if err != nil {
// return "", err
//}
//
//zetaTxHash := ""
//for i := 0; i <= DefaultRetryCount; i++ {
// zetaTxHash, err = b.Broadcast(DefaultGasLimit, authzMsg, authzSigner)
// if err == nil {
// return zetaTxHash, nil
// }
// b.logger.Debug().Err(err).Msgf("SetTSS broadcast fail | Retry count : %d", i+1)
// time.Sleep(DefaultRetryInterval * time.Second)
//}
//
//return "", fmt.Errorf("set tss failed | err %s", err.Error())
}

func (b *ZetaCoreBridge) ConfigUpdater(cfg *config.Config) {
Expand All @@ -243,30 +246,33 @@ func (b *ZetaCoreBridge) ConfigUpdater(cfg *config.Config) {
}

func (b *ZetaCoreBridge) PostBlameData(blame *blame.Blame, chainID int64, index string) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
zetaBlame := &observerTypes.Blame{
Index: index,
FailureReason: blame.FailReason,
Nodes: observerTypes.ConvertNodes(blame.BlameNodes),
}
msg := observerTypes.NewMsgAddBlameVoteMsg(signerAddress, chainID, zetaBlame)

authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
if err != nil {
return "", err
}

var gasLimit uint64 = PostBlameDataGasLimit

for i := 0; i < DefaultRetryCount; i++ {
zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner)
if err == nil {
return zetaTxHash, nil
}
b.logger.Error().Err(err).Msgf("PostBlame broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount)
log := fmt.Sprintf("Blame not reported , blame : %s , chainID %d , index %s", blame.String(), chainID, index)
b.logger.Info().Msg(log)
return log, nil
//signerAddress := b.keys.GetOperatorAddress().String()
//zetaBlame := &observerTypes.Blame{
// Index: index,
// FailureReason: blame.FailReason,
// Nodes: observerTypes.ConvertNodes(blame.BlameNodes),
//}
//msg := observerTypes.NewMsgAddBlameVoteMsg(signerAddress, chainID, zetaBlame)
//
//authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg)
//if err != nil {
// return "", err
//}
//
//var gasLimit uint64 = PostBlameDataGasLimit
//
//for i := 0; i < DefaultRetryCount; i++ {
// zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner)
// if err == nil {
// return zetaTxHash, nil
// }
// b.logger.Error().Err(err).Msgf("PostBlame broadcast fail | Retry count : %d", i+1)
// time.Sleep(DefaultRetryInterval * time.Second)
//}
//return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount)
}

func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, blockHash []byte, height int64, header common.HeaderData) (string, error) {
Expand Down

0 comments on commit d5d06fe

Please sign in to comment.