Skip to content

Conversation

@xav
Copy link

@xav xav commented Dec 23, 2025

Description

This PR adds proper transactional handling for start slot metadata updates in the bids service and comprehensive unit test coverage.

Changes

  • Implement transactional start slot metadata updates with per-provider slot tracking
  • Replace simple slot assignment with BeginTx/SetMetadata/CommitTx pattern for atomicity and consistency
  • Add mock implementations for relay clients, chaintime service, and database setters
  • Add comprehensive unit tests covering bid handling, metadata management, parameter validation, and service initialization

Motivation

This work ensures that start slot metadata updates are handled transactionally, maintaining consistency across relay providers, and provides test coverage for core bids service functionality.

Testing

All new tests pass and validate the implementation across multiple scenarios including success cases, error handling, and edge cases.

xav added 2 commits December 23, 2025 16:09
- Replace simple LatestSlot assignment with new updateStartSlot() function
  that properly handles per-provider slot tracking
- Implement transaction-based metadata updates using BeginTx/SetMetadata/CommitTx
  pattern for atomicity and consistency
- Set LatestSlots for each relay provider instead of single LatestSlot field
- Add proper error handling with context cancellation on transaction failure
- Generate mock implementations for `chaintime`, relay client providers,
  and comptrollerdb setters using testify/mockery
- Add handler_test.go with tests for bid handling, deduplication, and error cases
- Add metadata_test.go with tests for metadata get/set and format upgrades
- Add parameters_test.go with tests for parameter validation and startSlot handling
- Add service_test.go with tests for Service initialization, transaction handling,
  and start slot logic
@xav xav requested a review from Bez625 December 23, 2025 15:17
- Add optional expectation for ReceivedHandler.BidsReceived() call in
  TestCatchupProviderSlot_WithHandlers test
- Ensures mock handler properly handles invocations during slot catchup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants