Skip to content

Commit

Permalink
Small logging change.
Browse files Browse the repository at this point in the history
  • Loading branch information
tilenflare committed Apr 25, 2024
1 parent 3ad9de6 commit 650f0a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 10 additions & 0 deletions go-client/client/client_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ func (client *FastUpdatesClient) submitUpdates(updateProof *sortition.UpdateProo
return err
}

logger.Info("chain feeds values in block %d (before update): %v", client.transactionQueue.CurrentBlockNum, chainValues)
logger.Info("provider feeds values: %v", providerValues)

// calculate deltas for provider and on-chain prices
deltas, deltasString, err := provider.GetDeltas(chainValues, providerValues, supportedFeedIndexes, scale)
if err != nil {
Expand Down Expand Up @@ -237,6 +240,13 @@ func (client *FastUpdatesClient) submitUpdates(updateProof *sortition.UpdateProo
return fmt.Errorf("transaction failed")
}
logger.Info("successful update for block %d replicate %d in block %d", updateProof.BlockNumber, updateProof.Replicate, receipt.BlockNumber.Int64())

// get current prices from on-chain
chainValues, err = client.GetPrices(supportedFeedIndexes)
if err != nil {
return err
}
logger.Info("chain feeds values in block %d (after update): %v", receipt.BlockNumber.Int64(), chainValues)

return nil
}
4 changes: 0 additions & 4 deletions go-client/provider/feed_provider.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package provider

import (
"fast-updates-client/logger"
"math"
"math/big"
"math/rand"
Expand Down Expand Up @@ -29,8 +28,6 @@ func GetDeltas(chainValues []float64, providerValues []float64, valueIndexToFeed
scaleDiff, _ := new(big.Int).Sub(scale, new(big.Int).Exp(big.NewInt(2), big.NewInt(127), nil)).Float64()
scaleDiff = scaleDiff / math.Pow(2, 127)

logger.Info("chain feeds values: %v, provider feeds values: %v", chainValues, providerValues)

lastFeedIndex := valueIndexToFeedIndex[len(valueIndexToFeedIndex)-1]
deltasList := make([]byte, lastFeedIndex+1)
// for index := range deltasList {
Expand Down Expand Up @@ -62,7 +59,6 @@ func GetDeltas(chainValues []float64, providerValues []float64, valueIndexToFeed
}

deltasString := string(deltasList)
logger.Info("deltas: %s", deltasString)
deltas, err := StringToDeltas(deltasString)

return deltas, deltasString, err
Expand Down

0 comments on commit 650f0a9

Please sign in to comment.