Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
chore: extra orchestrator debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Nov 30, 2023
1 parent 2496504 commit a5927d5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func (orch Orchestrator) StartNewEventsListener(
if err != nil {
return err
}
orch.Logger.Debug("recovered connection")
return nil
})
if err != nil {
Expand Down Expand Up @@ -287,16 +288,19 @@ func (orch Orchestrator) Process(ctx context.Context, nonce uint64) error {
if err == nil && previousValset != nil {
// add the valset to the p2p network
// it's alright if this fails, we can expect other nodes to do it successfully
orch.Logger.Debug("providing previous valset to P2P network", "nonce", previousValset.Nonce)
_ = orch.Broadcaster.ProvideLatestValset(ctx, *types.ToLatestValset(*previousValset))
}
}

switch castedAtt := att.(type) {
case *celestiatypes.Valset:
orch.Logger.Debug("creating valset sign bytes", "nonce", castedAtt.Nonce)
signBytes, err := castedAtt.SignBytes()
if err != nil {
return err
}
orch.Logger.Debug("checking if a signature has already been provided to the P2P network", "nonce", castedAtt.Nonce)
resp, err := orch.P2PQuerier.QueryValsetConfirmByEVMAddress(ctx, nonce, orch.EvmAccount.Address.Hex(), signBytes.Hex())
if err != nil {
return errors.Wrap(err, fmt.Sprintf("valset %d", nonce))
Expand All @@ -312,6 +316,7 @@ func (orch Orchestrator) Process(ctx context.Context, nonce uint64) error {
return nil

case *celestiatypes.DataCommitment:
orch.Logger.Debug("querying data commitment from core", "nonce", castedAtt.Nonce, "begin_block", castedAtt.BeginBlock, "end_block", castedAtt.EndBlock)
commitment, err := orch.TmQuerier.QueryCommitment(
ctx,
castedAtt.BeginBlock,
Expand All @@ -320,7 +325,9 @@ func (orch Orchestrator) Process(ctx context.Context, nonce uint64) error {
if err != nil {
return err
}
orch.Logger.Debug("creating data commitment sign bytes", "nonce", castedAtt.Nonce)
dataRootHash := types.DataCommitmentTupleRootSignBytes(big.NewInt(int64(castedAtt.Nonce)), commitment)
orch.Logger.Debug("checking if a signature has already been provided to the P2P network", "nonce", nonce)
resp, err := orch.P2PQuerier.QueryDataCommitmentConfirmByEVMAddress(
ctx,
castedAtt.Nonce,
Expand Down Expand Up @@ -348,12 +355,14 @@ func (orch Orchestrator) Process(ctx context.Context, nonce uint64) error {
func (orch Orchestrator) ProcessValsetEvent(ctx context.Context, valset celestiatypes.Valset) error {
// add the valset to the p2p network
// it's alright if this fails, we can expect other nodes to do it successfully
orch.Logger.Debug("providing the latest valset to P2P network", "nonce", valset.Nonce)
_ = orch.Broadcaster.ProvideLatestValset(ctx, *types.ToLatestValset(valset))

signBytes, err := valset.SignBytes()
if err != nil {
return err
}
orch.Logger.Debug("signing valset", "nonce", valset.Nonce)
signature, err := evm.NewEthereumSignature(signBytes.Bytes(), orch.EvmKeyStore, *orch.EvmAccount)
if err != nil {
return err
Expand All @@ -364,6 +373,7 @@ func (orch Orchestrator) ProcessValsetEvent(ctx context.Context, valset celestia
orch.EvmAccount.Address,
ethcmn.Bytes2Hex(signature),
)
orch.Logger.Debug("providing the valset confirm to P2P network", "nonce", valset.Nonce)
err = orch.Broadcaster.ProvideValsetConfirm(ctx, valset.Nonce, *msg, signBytes.Hex())
if err != nil {
return err
Expand All @@ -377,11 +387,13 @@ func (orch Orchestrator) ProcessDataCommitmentEvent(
dc celestiatypes.DataCommitment,
dataRootTupleRoot ethcmn.Hash,
) error {
orch.Logger.Debug("signing data commitment", "nonce", dc.Nonce)
dcSig, err := evm.NewEthereumSignature(dataRootTupleRoot.Bytes(), orch.EvmKeyStore, *orch.EvmAccount)
if err != nil {
return err
}
msg := types.NewDataCommitmentConfirm(ethcmn.Bytes2Hex(dcSig), orch.EvmAccount.Address)
orch.Logger.Debug("providing the data commitment confirm to P2P network", "nonce", dc.Nonce)
err = orch.Broadcaster.ProvideDataCommitmentConfirm(ctx, dc.Nonce, *msg, dataRootTupleRoot.Hex())
if err != nil {
return err
Expand Down

0 comments on commit a5927d5

Please sign in to comment.