-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add proposer info to block, add new endpoint to fetch last prop… #55
feat: add proposer info to block, add new endpoint to fetch last prop… #55
Conversation
WalkthroughThe recent changes introduce an additional endpoint Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant StakingController
participant StakingService
participant StakingCache
participant StakingGateway
Client->>+StakingController: GET /recently-proposed-blocks
StakingController->>+StakingService: getRecentlyProposedBlocks()
StakingService->>+StakingCache: getRecentlyProposedBlocks()
StakingCache-->>-StakingService: [blocks]
StakingService-->>-StakingController: [blocks]
StakingController-->>-Client: [blocks]
Client->>+StakingService: newBlock(blockInfo)
StakingService->>StakingService: Process blockInfo
StakingService->>+StakingCache: setValidatorRecentlyProposedBlock(blockInfo)
StakingService-->>-Client: Block Processed
StakingService->>+StakingGateway: Emit "proposed_block"
Tip AI model upgrade
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/modules/staking/enums/staking-endpoints.enum.ts (1 hunks)
- src/modules/staking/services/staking.cache.ts (1 hunks)
- src/modules/staking/services/staking.service.ts (4 hunks)
- src/modules/staking/staking.controller.ts (1 hunks)
- src/modules/staking/staking.gateway.ts (1 hunks)
Additional comments not posted (11)
src/modules/staking/enums/staking-endpoints.enum.ts (1)
10-10
: Add a comment for the new endpoint.Consider adding a comment to describe the purpose of the new
RECENTLY_PROPOSED_BLOCKS
endpoint for better readability and maintainability.// Endpoint to fetch recently proposed blocks RECENTLY_PROPOSED_BLOCKS = '/recently-proposed-blocks',src/modules/staking/staking.gateway.ts (1)
22-22
: Ensure proper handling of WebSocket events.The addition of a general event emission for
proposed_block
is a good update. Make sure that this does not lead to any unintended side effects or performance issues due to the increased number of event listeners.src/modules/staking/staking.controller.ts (1)
78-81
: Add error handling for the new endpoint.Ensure that the new
getRecentlyProposedBlocks
endpoint has proper error handling to manage potential failures gracefully.src/modules/staking/services/staking.cache.ts (2)
83-87
: Ensure proper TTL for caching recently proposed blocks.Verify that the TTL (time-to-live) for caching recently proposed blocks is set appropriately to balance between performance and data freshness.
96-102
: Ensure consistency in caching mechanisms.Verify that the caching mechanisms used in
getRecentlyProposedBlocks
are consistent with other similar methods to maintain uniformity and avoid potential issues.src/modules/staking/services/staking.service.ts (6)
345-351
: LGTM!The function correctly uses the new
findSingleValidator
method and handles the case where the validator is not found.
353-358
: LGTM!The new method
findSingleValidator
is implemented correctly to find a validator by address.
Line range hint
359-399
: LGTM!The
newBlock
method now includes logic to handle validators and caching, including caching recently proposed blocks and emitting events. The integration appears correct.
Line range hint
521-528
: LGTM!The method correctly uses
getValidatorRecentlyProposedBlocks
from the cache, and the sorting logic remains intact.
553-555
: LGTM!The new method
getRecentlyProposedBlocks
is implemented correctly to retrieve recently proposed blocks from the cache.
Line range hint
511-514
: LGTM!The function correctly retrieves and returns recently proposed blocks for a specific validator.
9abb18e
to
787529d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/modules/staking/enums/staking-endpoints.enum.ts (1 hunks)
- src/modules/staking/services/staking.cache.ts (1 hunks)
- src/modules/staking/services/staking.service.ts (4 hunks)
- src/modules/staking/staking.controller.ts (1 hunks)
- src/modules/staking/staking.gateway.ts (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- src/modules/staking/enums/staking-endpoints.enum.ts
- src/modules/staking/services/staking.cache.ts
- src/modules/staking/services/staking.service.ts
- src/modules/staking/staking.controller.ts
- src/modules/staking/staking.gateway.ts
…cks, websocket event
787529d
to
6de82ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/modules/staking/enums/staking-endpoints.enum.ts (1 hunks)
- src/modules/staking/services/staking.cache.ts (1 hunks)
- src/modules/staking/services/staking.service.ts (4 hunks)
- src/modules/staking/staking.controller.ts (1 hunks)
- src/modules/staking/staking.gateway.ts (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- src/modules/staking/enums/staking-endpoints.enum.ts
- src/modules/staking/services/staking.cache.ts
- src/modules/staking/services/staking.service.ts
- src/modules/staking/staking.controller.ts
- src/modules/staking/staking.gateway.ts
…osed blocks, add new websocket event