feat: feature/grafana stats#1
Merged
Merged
Conversation
… and enhance checkpoint verification in PlacementRuntimeHelper
…tion, README, and core functionality
…main config schema
…bot monitoring and management
…s, Grafana, and health checks
…n for project setup and guidelines
…ndency rules, and bounded contexts for ORE Supply Farmer Bot
… enhance build scripts in package.json for improved performance
…pply-farmer-bot into feature/grafana-stats
…nto feature/grafana-stats
…nd updating cache
…pply-farmer-bot into feature/grafana-stats
…improve evaluation checks in random search and hill climbing processes
Comment on lines
+36
to
+46
| while (attempts < maxAttempts) { | ||
| // Get authority address from container | ||
| const container = getGlobalContainer(); | ||
| const authorityKey = container.resolve<PublicKey>('AuthorityPublicKey'); | ||
| const authorityAddress = authorityKey.toBase58(); | ||
|
|
||
| // Re-fetch miner to verify checkpoint | ||
| const miner = await this.blockchain.getMiner(authorityAddress); | ||
| if (miner && miner.checkpointId === miner.roundId) { | ||
| this.logger.debug( | ||
| `Round ${roundId}: Miner checkpoint verified (${checkpointDuration}ms + ${attempts * 500}ms wait)`, |
There was a problem hiding this comment.
Bug: The checkpoint verification compares miner.checkpointId with a re-fetched miner.roundId, which may have advanced since the checkpoint transaction was created, causing the check to fail.
Severity: CRITICAL
Suggested Fix
The verification logic should not re-fetch miner.roundId. Instead, it should compare miner.checkpointId against the roundId that was originally targeted by the checkpoint instruction. This target roundId should be passed from the checkpoint creation step to the verification step.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location:
apps/bot/src/application/use-cases/execute-placement/executor/placement-runtime.helper.ts#L36-L46
Potential issue: A race condition exists in the checkpoint verification logic. A
checkpoint transaction is created targeting the `miner.roundId` value at that moment.
However, the subsequent verification loop re-fetches the miner state from the blockchain
and compares `miner.checkpointId` against the *current* `miner.roundId`. If a new round
starts and the on-chain `miner.roundId` advances between transaction submission and
verification, the check `miner.checkpointId === miner.roundId` will fail, causing the
placement to be blocked for that round.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.