Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coretime Broker on Coretime Chain - Update after Coretime Polkadot release #10947

Merged
merged 10 commits into from
Sep 26, 2024

Conversation

piggydoughnut
Copy link
Contributor

@piggydoughnut piggydoughnut commented Sep 24, 2024

Coretime has been released to the Polkadot Relay chain, but since the data was relying on the Workload pallet call, there is not data shown in the Network -> Coretime broker(Experimental) Tab currently.

In the initial sales period (sale 0), the Coretime chain isn't actively driving the relay chain; it's essentially in the same state as it was prior to the transition. During the bootstrapping phase, things operate a bit differently, but after the 28-day period, the workload will align with the current state of the relay chain moving forward.

This PR changes data organization, and takes the coreCount from broker.status call as the truth to how many cores are there, instead of relying on Workload to provide information about the cores.

Other changes:

  • added cores sold/offered to the summary above the table
  • fixed the tasks/pools/idles graph which had pools and idles swapped
  • improved calculation of start and end dates for Bulk Coretime tasks
  • double checked the calculations for time estimations and all seems to be correct, I added information on calculations in the code and also in my notes.

My Coretime notes

@piggydoughnut piggydoughnut changed the title Dm coretime UI coretime chain update Coretime Broker on Coretime Chain - Update after Coretime Polkadot release Sep 24, 2024
if (parachainId) {
return load?.filter(({ info }) => info.task === parachainId);
return data.filter(({ workload }) => !!workload?.filter(({ info }) => info.task === parachainId).length);
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't !!workload here just return a boolean?

Copy link
Contributor Author

@piggydoughnut piggydoughnut Sep 25, 2024

Choose a reason for hiding this comment

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

Yes, that is exactly what I am going for :) Coz I need to see if the is a workload with parachainId that I am looking for :) Then I can filter out objects of CoreInfo

export interface CoreInfo {
  core: number,
  workload: CoreWorkloadType[] | undefined,
  workplan: CoreWorkplanType[] | undefined
}


useEffect(() => {
setWorkLoad(formatLoad(workloadInfos, leaseMap, reservationMap));
}, [workloadInfos, leaseMap, reservationMap]);
!!workplanInfos && !!workloadInfos && !!coreCount && !!leaseMap && !!reservationMap &&
Copy link
Member

Choose a reason for hiding this comment

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

I dont think we need the double bangs on any of these values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typescript begs to differ (for some of them) 😊 I might have thrown in some extras just in case 😅

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

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

Overally super nice! Great job.

Just some nits, and I think generally we don't all the double bangs, but if you prefer them for readability (explicit booleans for checks) then I am okay with it.

@piggydoughnut
Copy link
Contributor Author

piggydoughnut commented Sep 25, 2024

I love my double bangs 😆 They leave no room for other interpretation 😊

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

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

LGTM, approving so Im not a blocker while Im OOO. Great job

@piggydoughnut piggydoughnut merged commit 859ba48 into master Sep 26, 2024
5 checks passed
@piggydoughnut piggydoughnut deleted the dm-coretime-ui-coretime-chain-update branch September 26, 2024 09:25
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants