Skip to content

Conversation

@Vsevolod-Rusinskiy
Copy link
Collaborator

@Vsevolod-Rusinskiy Vsevolod-Rusinskiy commented Sep 5, 2025

Fix

  • Cached auxData call in a dedicated useEffect to avoid redundant requests.
  • Updated leader calculation formula.

Result

  • Block producer display is now stable.
  • The producer changes once per minute (every 600 blocks), as expected.

Related to QuantumFusion-network/spec#363.

Copy link
Member

Choose a reason for hiding this comment

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

Please check the upstream project file. Seems like we may leave minimal changes in this and put SPIN-specific logic somewhere else to simplify new upstream versions merge later.

const { api } = useApi();

useEffect(() => {
const loadAuxData = async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Redundant function definition? Can we put loadAuxData body into the outer function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

useEffect callback cannot be async directly, that’s why I wrapped it.

}

return null;
return undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You’re right, this change was unnecessary. Returning null was correct in this case.

@Vsevolod-Rusinskiy Vsevolod-Rusinskiy force-pushed the vsevolod/incorrect-block-producer-address branch from 55b69a9 to 8da3f37 Compare September 26, 2025 06:40
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.

3 participants