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

[SIP-45] Metrics and protocol config changes #20738

Merged
merged 7 commits into from
Dec 31, 2024
Merged

Conversation

shio-coder
Copy link
Contributor

@shio-coder shio-coder commented Dec 26, 2024

Description

This is the change that is proposed from SIP-45.

The change includes:

  • Adds a histogram metric for amplification_factor.
  • Adds K to protocol config. K is set to 5 starting from Protocol Version 71.

Test plan

CI


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@shio-coder shio-coder requested review from a team and mystenmark as code owners December 26, 2024 07:03
Copy link

vercel bot commented Dec 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 31, 2024 5:01am
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Dec 31, 2024 5:01am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Dec 31, 2024 5:01am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Dec 31, 2024 5:01am

crates/sui-protocol-config/src/lib.rs Outdated Show resolved Hide resolved
crates/sui-protocol-config/src/lib.rs Outdated Show resolved Hide resolved
@shio-coder
Copy link
Contributor Author

Hi @mwtian , I have updated the PR.
Please take another look. Thanks!

Copy link
Member

@mwtian mwtian left a comment

Choose a reason for hiding this comment

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

Pushed some changes to fix the tests.

@@ -3076,6 +3083,13 @@ impl ProtocolConfig {

cfg.validator_validate_metadata_cost_base = Some(20000);
}
71 => {
if chain != Chain::Mainnet {
Copy link
Member

Choose a reason for hiding this comment

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

Was there a discussion to roll out the max gas price to testnet and mainnet separately, instead of in the same release? cc @dariorussi @sblackshear

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just being conservative. If rolling out to mainnet at the same time is acceptable then let's do it!

Copy link
Member

Choose a reason for hiding this comment

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

Ok. After looking at the related logic a bit, it seems there are some interactions between gas price and max_tx_gas limit, among other effects of using high gas price. I think being a bit conservative is warranted here. We should definitely try out using very high gas price on testnet first before changing the limit on mainnet. We may need to update max_tx_gas or switch to a different parameter limiting gas unit instead of total gas. They can be done separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I have justed realized there is max_tx_gas as well.
Tried to change it locally and that has just caused so many tests to fail (these tests use max_tx_gas as gas budget if not explicitly set). Looks like we are going to need another PR for it.

Copy link
Member

Choose a reason for hiding this comment

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

Agree let's not change max_tx_gas in this PR. In fact we can postpone changing max_gas_price too if you think just changing it will not be useful. I have asked experts on the gas logic for the best way forward. cc @dariorussi @tzakian

Copy link
Contributor

Choose a reason for hiding this comment

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

please take a look at my main comment

Copy link
Contributor

@dariorussi dariorussi left a comment

Choose a reason for hiding this comment

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

I wondered about the max_tx_gas and I am not too sure.
I think we need some good testing here and let's find out who is going to do that.
Gas tests are here https://github.com/MystenLabs/sui/blob/main/crates/sui-core/src/unit_tests/gas_tests.rs and I think we should add something that plays with budget and price, and also some tests that executes the same transaction with different prices and see that the results are as expected.
Thoughts?

@@ -3076,6 +3083,13 @@ impl ProtocolConfig {

cfg.validator_validate_metadata_cost_base = Some(20000);
}
71 => {
if chain != Chain::Mainnet {
Copy link
Contributor

Choose a reason for hiding this comment

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

please take a look at my main comment

@mwtian
Copy link
Member

mwtian commented Dec 30, 2024

I wondered about the max_tx_gas and I am not too sure. I think we need some good testing here and let's find out who is going to do that. Gas tests are here https://github.com/MystenLabs/sui/blob/main/crates/sui-core/src/unit_tests/gas_tests.rs and I think we should add something that plays with budget and price, and also some tests that executes the same transaction with different prices and see that the results are as expected. Thoughts?

Agree. I see some existing tests on gas budget and prices in the file. We can discuss later on what need to be added, and who should add them. Maybe the change to max gas price can be moved to another PR along with the additional tests and adjustments to other parameters.

@shio-coder
Copy link
Contributor Author

Sounds good folks. I have removed max_gas_price change in this PR.

@shio-coder shio-coder temporarily deployed to sui-typescript-aws-kms-test-env December 31, 2024 02:12 — with GitHub Actions Inactive
@mwtian mwtian requested a review from dariorussi December 31, 2024 02:12
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env December 31, 2024 04:59 — with GitHub Actions Inactive
@dariorussi
Copy link
Contributor

Agree. I see some existing tests on gas budget and prices in the file. We can discuss later on what need to be added, and who should add them. Maybe the change to max gas price can be moved to another PR along with the additional tests and adjustments to other parameters.

to be honest I am not sure how max gas budget and a super high gas price and the coins to provide may interact.
We can look at the code a ton but I feel writing a bunch of tests is the most appropriate way to go.
As far as getting this in without testing I do not understand the reason and it seems a mistake.
I personally would love to see tests (and a great coverage) for this before getting in.
But others may feel otherwise...

@dariorussi
Copy link
Contributor

Agree. I see some existing tests on gas budget and prices in the file. We can discuss later on what need to be added, and who should add them. Maybe the change to max gas price can be moved to another PR along with the additional tests and adjustments to other parameters.

to be honest I am not sure how max gas budget and a super high gas price and the coins to provide may interact. We can look at the code a ton but I feel writing a bunch of tests is the most appropriate way to go. As far as getting this in without testing I do not understand the reason and it seems a mistake. I personally would love to see tests (and a great coverage) for this before getting it in

I actually see that the gas has been entirely removed from the PR and getting it in is entire up to you folks.
Sorry I did not realize

Copy link
Contributor

@mystenmark mystenmark left a comment

Choose a reason for hiding this comment

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

Looks good!

@mwtian mwtian dismissed dariorussi’s stale review December 31, 2024 18:11

no more changes to gas price

@mwtian mwtian merged commit 04a5869 into MystenLabs:main Dec 31, 2024
50 checks 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.

4 participants