Closed leonz789 closed 2 months ago
The changes across the x/oracle/keeper
package involve renaming and modifying the PrepareRound
method to PrepareRoundBeginBlock
, along with adjustments to block calculation logic for feeders. Logging enhancements have been made to price proposal processing, and various updates to context preparation and round handling in multiple files.
File | Change Summary |
---|---|
x/oracle/keeper/aggregator/context.go |
Renamed PrepareRound method to PrepareRoundBeginBlock with new block calculation logic. |
x/oracle/keeper/aggregator/context_test.go |
Reflected the renaming of PrepareRound to PrepareRoundBeginBlock and updated related test logic. |
x/oracle/keeper/msg_server_create_price.go |
Added logging with additional context during price proposal processing within CreatePrice function. |
x/oracle/keeper/single.go |
Adjusted block calculations and replaced PrepareRound with PrepareRoundBeginBlock across multiple functions. |
x/oracle/module.go |
Updated BeginBlock to include new preparation logic for oracle rounds and modified EndBlock to update logging and context reset. |
sequenceDiagram
participant User
participant OracleModule
participant AggregatorContext
participant Cache
User->>OracleModule: Send BeginBlock
OracleModule->>Cache: Retrieve AggregatorContext
OracleModule->>AggregatorContext: PrepareRoundBeginBlock
OracleModule->>User: Acknowledge BeginBlock
User->>OracleModule: Send EndBlock
OracleModule->>AggregatorContext: Seal active rounds
OracleModule->>AggregatorContext: Reset context
OracleModule->>User: Respond with new validator updates
In the realm of code so fine,
PrepareRound
takes on a new design.
Logs now whisper, more context to bear,
Oracle’s heart beats with care.
Round by round, each block stands tall,
Keeper’s changes bless us all.
🌟🐰🚀
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
merged into #118
Description
Move
prepareRound
fromEndBlock
intoBeginblock
. Currently we invokeprepareRound
in theEndBlock
of every block after all transaction executed. When there'recreate-price
transactions in the first block since a node restart(like when a node restart from some heightx
, and somecreate-price
messages are included in heightx
by other validators), theaggregator
will be initialized/recached when the first message executed, this will consume extra gas which will conduct different gasUsed compared to other validators/nodes execution. In this fix, we put theprepareRound
intoBeginBlock
. In this way, avoid the initialization ofaggregator
be executed inside transaction.Closes #XXX
Summary by CodeRabbit
New Features
Refactor
PrepareRound
method toPrepareRoundBeginBlock
across various functionalities to improve clarity in block calculation logic.Bug Fixes
Chores
AppModule
to include additional logic for preparing and resetting the oracle round.