Skip to content

feat: feature/grafana stats#1

Merged
RedBoardDev merged 14 commits into
mainfrom
feature/grafana-stats
Mar 5, 2026
Merged

feat: feature/grafana stats#1
RedBoardDev merged 14 commits into
mainfrom
feature/grafana-stats

Conversation

@RedBoardDev
Copy link
Copy Markdown
Owner

No description provided.

Comment thread apps/bot/src/infrastructure/adapters/blockchain/solana.adapter.ts
@RedBoardDev RedBoardDev merged commit 945f810 into main Mar 5, 2026
2 checks passed
@RedBoardDev RedBoardDev deleted the feature/grafana-stats branch March 5, 2026 12:31
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)`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

1 participant