Skip to content

Demo v2#11

Merged
gunnarmiller merged 1 commit intomainfrom
demo_v2
Feb 24, 2026
Merged

Demo v2#11
gunnarmiller merged 1 commit intomainfrom
demo_v2

Conversation

@gunnarmiller
Copy link
Collaborator

Working version of the Demo intended for use at Qubits. Know issues that still need attention are noted below. The first two are formatting issues and should be quick and easy for anyone with the relevant experience with html and CSS. The last one is more serious, with several possible approaches.

KNOWN ISSUES:
Graph Layout:
--The most recent set of changes to enable switching graph views also broke the graph formatting--probably because they created new html.Div wrappers that aren't targeted by the relevant CSS. Someone more conversant with CSS should take a few minutes to fix them. Currently, the graph overlaps with the miner table, and the aspect ratio is not fixed (which it should be). In particular, it elongates enormously if the number of miners is increased too far.

Miner Table:
--There's now a conditional extra column on the miner table, which only appears when one of the "randomized" solver options are selected (which should be often, as they are the defaults). It current lacks a table header section and should have one. It also ends up with widely varying column widths. Ideally, column widths should just be fixed to match the largest entry that could appear in that column.

Pause/Restart Crashes:
There's an elusive issue that occurs sometimes, but not all the time during pausing and restarting the code. It seems to occur much more often with the Bootstrapped solvers, but it does occur occasionally with the QPU solvers, so I think it's worth the time to address even though we want to default the bootstrapped solvers to disabled. I've investigated the issue enough to be reasonably sure that it results from some of the simulation data not being properly saved in the "blockchain-structure" dcc.Store object. Currently, the simulation is supposed to save a full dataset for every block mined so that it can refer back to it when restarting after a pause. There end up being small gaps in the record: some miners missing scores for some blocks, which prevents a clean restart and crashes the demo.

An ideal fix would be to figure out how to save the information more reliably: either troubleshooting the problems with the dcc.Store or finding another way to save it. Failing at that, I could write a patch that could either guess or re-compute a miner's score if it is found to be missing; the down side is that this would result in the restarted chain state being slightly different from the state before the pause, which might be noticeable in some cases. I might be able to work around that. Finally, if both of these prove too difficult, I could simply remove the "Pause" functionality altogether.

@jackraymond
Copy link
Collaborator

The helper functions cited in the README.md for energy-time rescaling and embedding are being reviewed here, and should be straightforward (simplified) pull request here once merged in the more complex context:
https://git.dwavesys.local/users/dkinn/repos/quantum-blockchain/pull-requests/29/overview

Copy link

@dankinn dankinn left a comment

Choose a reason for hiding this comment

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

Will review this in bursts. A couple of errors, one in testing and one when running app.py.

Copy link
Contributor

@k8culver k8culver left a comment

Choose a reason for hiding this comment

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

Thanks for all your work on this @gunnarmiller!!

Just did a first pass of the UI so far. I'll make a commit to clean up the interface in the next couple days

This is review doesn't include running the demo, just looking at the code right now

Copy link

@dankinn dankinn left a comment

Choose a reason for hiding this comment

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

Another batch of comments (I'm still working through the whole codebase).

Copy link
Contributor

@thisac thisac left a comment

Choose a reason for hiding this comment

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

Thanks for all the hard work @gunnarmiller. I've just had a general look at the code structure. Will do a more thorough review later.

I'm getting quite a few:

Exception: Block 84b95097ef5db8fb19c27b3259e9bd23597a3330acd0a57333d88efe713ad8d8 has predecessor 42ed2371065bf3876890a713c10385b0743c9b0e0263551f847e552573071660 which is not found in the tree.

when running the demo.

Also, the miner table isn't scaling properly when switching miner view.

Very neat demo, but there's some further clean-up required as well as fixing a couple of issues. I can help out with some fixes if needed.

Copy link

@dankinn dankinn left a comment

Choose a reason for hiding this comment

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

Adding another batch of comments

)
def toggle_left_column(collapse_trigger: int, to_collapse_class: str) -> tuple[str, str]:
"""Toggles a 'collapsed' class that hides and shows some aspect of the UI.
def simulation(
Copy link

Choose a reason for hiding this comment

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

This function should be refactored to reduce complexity.

Suggestions:

  • The code block under if len(blockchain_structure) > 0: can be moved into a separate function (restart_trial, perhaps?)
  • Plotting can be moved into a separate function
  • Trial iterations can be moved into a separate function


# TODO figure out what to do if mining fails

raise Exception(f"TrialManager exceeded max mining attempts of {self.max_mining_attempts} without {self.mining_miner_id} finding mining a valid block.")
Copy link

Choose a reason for hiding this comment

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

Line length too long.

This should raise a more specific Exception


return traces

def draw_spiral(self, active_blocks: list[str], active_block_cutoff: int | None = None, mining_block: BlockNode | None = None):
Copy link

Choose a reason for hiding this comment

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

Function is quite long - consider refactoring to reduce complexity

Copy link
Collaborator

@jackraymond jackraymond left a comment

Choose a reason for hiding this comment

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

The changes I am proposing are covered by:
#13
Definitely worth eyeballing the PR differences before merging. I think they shouldn't conflict with other review requests, and resolve several of them.

Copy link
Collaborator

@jackraymond jackraymond left a comment

Choose a reason for hiding this comment

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

LGTM for purposes of PRA reference

Co-authored-by: Jack Raymond <10591246+jackraymond@users.noreply.github.com>
Co-authored-by: Kate Culver <kateeculver@gmail.com>
@gunnarmiller gunnarmiller merged commit e3e9f38 into main Feb 24, 2026
1 check passed
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.

6 participants