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

chore: extra orchestrator debug logs #633

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (orch Orchestrator) StartNewEventsListener(
if err != nil {
return err
}
orch.Logger.Debug("recovered connection")
return nil
})
if err != nil {
Expand Down Expand Up @@ -308,16 +309,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 @@ -333,6 +337,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 @@ -341,7 +346,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 @@ -369,12 +376,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 @@ -385,6 +394,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 @@ -398,11 +408,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
Loading