Skip to content

Commit

Permalink
ref, typo
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Feb 6, 2025
1 parent 9faa7c3 commit c58c7b8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion x/oracle/keeper/feedermanagement/caches.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (c *caches) GetTokenFeederForFeederID(feederID int64) (tokenFeeder *oraclet
return
}

// SkipCommit skip real commit by setting the updage flag to false
// SkipCommit skip real commit by setting the update flag to false
func (c *caches) SkipCommit() {
c.validators.update = false
c.params.update = false
Expand Down
6 changes: 3 additions & 3 deletions x/oracle/keeper/feedermanagement/feedermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (f *FeederManager) EndBlock(ctx sdk.Context) {
// update params and validator set if necessary in caches and commit all updated information
addedValidators := f.updateAndCommitCaches(ctx)

// update Slashing related records (reportInfo, missCountBitArray), handle case for 1. reseetSlashing, 2. new validators added for validatorset change
// update Slashing related records (reportInfo, missCountBitArray), handle case for 1. resetSlashing, 2. new validators added for validatorset change
f.updateBehaviorRecordsForNextBlock(ctx, addedValidators)

// update rounds including create new rounds based on params change, remove expired rounds
Expand All @@ -96,7 +96,7 @@ func (f *FeederManager) EndBlock(ctx sdk.Context) {

// set status to open for rounds before their quoting window
feederIDs := f.prepareRounds(ctx)
// remove nocnes for closing quoting-window and set nonces for opening quoting-window
// remove nonces for closing quoting-window and set nonces for opening quoting-window
f.setupNonces(ctx, feederIDs)

f.ResetFlags()
Expand Down Expand Up @@ -243,7 +243,7 @@ func (f *FeederManager) commitRoundsInRecovery() {
r.FinalPrice()
r.status = roundStatusClosed
}
// close all quotingWindow to skip current rounds' 'handlQuotingMisBehavior'
// close all quotingWindow to skip current rounds' 'handleQuotingMisBehavior'
if f.forceSeal {
r.closeQuotingWindow()
}
Expand Down
11 changes: 3 additions & 8 deletions x/oracle/keeper/feedermanagement/prices.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,10 @@ func (ps *priceSource) Add(psNew *priceSource) (*priceSource, error) {
if len(psNew.prices) == 0 {
return nil, errors.New("failed to add ProtoPriceSource for NS, psNew.prices is empty")
}

// this is not ds, then just set the final price or overwrite if the input has a later timestamp
if ps.finalPrice == nil {
ps.finalPrice = psNew.prices[0].PriceResult()
ps.prices = append(ps.prices, psNew.prices[0])
psNew.prices = psNew.prices[:1]
return psNew, nil
}
// equivalent to After, just overwrite the old value
if psNew.prices[0].Timestamp > ps.finalPrice.Timestamp {
if ps.finalPrice == nil ||
ps.finalPrice.Timestamp < psNew.prices[0].Timestamp {
ps.finalPrice = psNew.prices[0].PriceResult()
ps.prices = append(ps.prices, psNew.prices[0])
psNew.prices = psNew.prices[:1]
Expand Down
4 changes: 2 additions & 2 deletions x/oracle/keeper/feedermanagement/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type recordsDS struct {

// each source will get a final price independently, the order of sources does not matter, map is safe
// recordsDSs is the price records for all deterministic sources
// threshold indicates the threshold definition to detemin final price for each source
// threshold indicates the threshold defined to decide final price for each source
type recordsDSs struct {
t *threshold
dsMap map[int64]*recordsDS
Expand Down Expand Up @@ -216,7 +216,7 @@ type round struct {
status roundStatus
// aggregator is the price aggregator for current round
a *aggregator
// cache is the cache reader for current round to provid params, validators information
// cache is the cache reader for current round to provide params, validators information
cache CacheReader
// algo is the aggregation algorithm for current round to get final price
algo AggAlgorithm
Expand Down
4 changes: 0 additions & 4 deletions x/oracle/keeper/msg_server_create_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ func (ms msgServer) CreatePrice(goCtx context.Context, msg *types.MsgCreatePrice
return nil, types.ErrPriceProposalFormatInvalid.Wrap(err.Error())
}

if err := ms.ValidateMsg(msg); err != nil {
logger.Error("failed to validate msg", append(logQuote, "error", err)...)
return nil, err
}
// core logic and functionality of Price Aggregation
finalPrice, err := ms.ProcessQuote(ctx, msg, ctx.IsCheckTx())
if err != nil {
Expand Down

0 comments on commit c58c7b8

Please sign in to comment.