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

fix max seat number computation #12

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

telezhnaya
Copy link

Fixes #11

It's still not 100% accurate, but it would give the result closer to the truth.

It's still not 100% accurate, but it would give the result closer to the truth
std::cmp::max(
seats_before_statelessnet,
protocol_config.num_chunk_only_producer_seats,
)
Copy link
Author

@telezhnaya telezhnaya Mar 8, 2024

Choose a reason for hiding this comment

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

I'm not sure if we should sum up these numbers or taking the maximum. Current value is for sure smaller than we need.

current <= maximum <= sum

For Statelessnet, the values are 20, 300, 320.

Instead of spending hours on the investigation, I suggest starting using maximum and fix it later again if we see the other issues here.

protocol_config.num_chunk_only_producer_seats,
)
}

/// This implementation is ported from near-api-js:
/// https://github.com/near/near-api-js/blob/bdbf839f54fbc399d7299da8cf9966bbdc426238/packages/utils/src/validators.ts#L24-L50
fn find_seat_price_for_protocol_before_49(
Copy link
Author

Choose a reason for hiding this comment

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

Also, I think we don't need to check protocol version for the current change because protocol_config.num_chunk_only_producer_seats will be zero for older protocol versions, so it will not affect the result.

@frol
Copy link
Contributor

frol commented Apr 25, 2024

@telezhnaya I checked it on mainnet and it does not look right to me:

image

The 100th seat (the last block producer seat is 816k NEAR at the moment, so you only need that to be the block producer, and you need even less to be a chunk producer!)

To be fair, the main branch version is even more off:

image

@frol
Copy link
Contributor

frol commented Aug 21, 2024

@telezhnaya What is our final call here? Do we need this PR to be merged? Can you double-check that the numbers match the expectations?

@telezhnaya
Copy link
Author

No, not now
Right now, we have a bug with seat price computation logic in nearcore, so I suggest not to touch this PR
I keep it in mind
After the bug in near core is fixed, I hope to finish this PR one day as well

@frol frol marked this pull request as draft August 21, 2024 14:44
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.

Wrong seat price computation with stateless validation feature enabled
2 participants