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

Reestimate deterministic gas #646

Merged
merged 30 commits into from
Oct 11, 2023
Merged

Reestimate deterministic gas #646

merged 30 commits into from
Oct 11, 2023

Conversation

wojtek-coreum
Copy link
Collaborator

@wojtek-coreum wojtek-coreum commented Sep 11, 2023

Description

Here are the metrics after reestimating:

coreum.asset.ft.v1.MsgBurn		1.09	1.00
coreum.asset.ft.v1.MsgFreeze		1.20	1.00
coreum.asset.ft.v1.MsgGloballyFreeze	1.15	0.98
coreum.asset.ft.v1.MsgGloballyUnfreeze	1.08	0.97
coreum.asset.ft.v1.MsgIssue		1.30	0.80
coreum.asset.ft.v1.MsgMint		1.12	1.00
coreum.asset.ft.v1.MsgSetWhitelistedLimit	1.17	0.43
coreum.asset.ft.v1.MsgUnfreeze		2.73	0.99
coreum.asset.nft.v1.MsgAddToWhitelist	1.10	1.10
coreum.asset.nft.v1.MsgBurn		1.05	1.00
coreum.asset.nft.v1.MsgFreeze		1.01	0.94
coreum.asset.nft.v1.MsgIssueClass	1.74	0.92
coreum.asset.nft.v1.MsgMint		1.72	0.73
coreum.asset.nft.v1.MsgRemoveFromWhitelist	1.04	0.99
coreum.asset.nft.v1.MsgUnfreeze		0.99	0.95
coreum.nft.v1beta1.MsgSend		1.06	0.91
cosmos.authz.v1beta1.MsgExec		1.06	1.02
cosmos.authz.v1beta1.MsgGrant		1.01	1.00
cosmos.authz.v1beta1.MsgRevoke		1.00	1.00
cosmos.bank.v1beta1.MsgMultiSend	2.20	0.64
cosmos.bank.v1beta1.MsgSend		3.76	0.63
cosmos.distribution.v1beta1.MsgFundCommunityPool	1.00	1.00
cosmos.distribution.v1beta1.MsgSetWithdrawAddress	0.89	0.89
cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward	1.21	1.21
cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission	1.07	1.07
cosmos.feegrant.v1beta1.MsgGrantAllowance	1.00	1.00
cosmos.feegrant.v1beta1.MsgRevokeAllowance	1.02	1.02
cosmos.gov.v1.MsgVote			1.00	1.00
cosmos.gov.v1.MsgVoteWeighted		1.00	1.00
cosmos.gov.v1beta1.MsgDeposit		1.00	1.00
cosmos.gov.v1beta1.MsgVote		0.88	0.88
cosmos.staking.v1beta1.MsgBeginRedelegate	1.00	1.00
cosmos.staking.v1beta1.MsgCreateValidator	1.02	1.00
cosmos.staking.v1beta1.MsgDelegate	1.00	0.86
cosmos.staking.v1beta1.MsgEditValidator	0.99	0.99
cosmos.staking.v1beta1.MsgUndelegate	1.26	0.97
cosmos.vesting.v1beta1.MsgCreateVestingAccount	1.40	1.01
cosmwasm.wasm.v1.MsgClearAdmin		1.01	1.01
cosmwasm.wasm.v1.MsgUpdateAdmin		1.00	1.00
ibc.applications.transfer.v1.MsgTransfer	2.14	1.00

Some transactions can't be estimated because have no integration tests using them, we should add:

slashingtypes.MsgUnjail
govtypesv1.MsgDeposit

Also we should discuss how we approach these messages:

coreum.asset.nft.v1.MsgIssueClass
coreum.asset.nft.v1.MsgMint
cosmos.bank.v1beta1.MsgMultiSend
cosmos.bank.v1beta1.MsgSend

Reviewers checklist:

  • Try to write more meaningful comments with clear actions to be taken.
  • Nit-picking should be unblocking. Focus on core issues.

Authors checklist

  • Provide a concise and meaningful description
  • Review the code yourself first, before making the PR.
  • Annotate your PR in places that require explanation.
  • Think and try to split the PR to smaller PR if it is big.

This change is Reviewable

@wojtek-coreum wojtek-coreum requested a review from a team as a code owner September 11, 2023 12:13
@wojtek-coreum wojtek-coreum requested review from dzmitryhil, vertex451, miladz68 and ysv and removed request for a team September 11, 2023 12:13
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @miladz68, @vertex451, and @ysv)

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vertex451, @wojtek-coreum, and @ysv)


x/deterministicgas/config.go line 147 at r1 (raw file):

		[]sdk.Msg{
			// auth
			&authtypes.MsgUpdateParams{}, // This is non-deterministic because all the goc proposals are non-deterministic anyway

replace all goc with gov in the comments.

Copy link
Collaborator Author

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @miladz68, @vertex451, and @ysv)


x/deterministicgas/config.go line 147 at r1 (raw file):

Previously, miladz68 (milad) wrote…

replace all goc with gov in the comments.

Done.

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vertex451, @wojtek-coreum, and @ysv)


x/deterministicgas/spec/README.md line 74 at r4 (raw file):

| `/cosmos.bank.v1beta1.MsgMultiSend`                                    | [special case](#special-cases) |
| `/cosmos.bank.v1beta1.MsgSend`                                         | [special case](#special-cases) |
| `/coreum.asset.ft.v1.MsgBurn`                                          | 34960                          |

I think round thiese numbers to the closest factor of 1000 .

@ysv ysv requested a review from miladz68 September 13, 2023 12:58
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r3, 1 of 1 files at r4, 2 of 2 files at r5, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @miladz68, @vertex451, and @wojtek-coreum)


integration-tests/modules/bank_test.go line 820 at r5 (raw file):

// Spreadsheet example might be found here: https://docs.google.com/spreadsheets/d/1qoKa8udTPYdS_-ofJ8xNbnZFDh-gqGb4n0_OgcTHUOA/edit?usp=sharing
// Keep in mind that to estimate the gas you need to move bank send message to nondeterministic section inside deterministic gas config.
func TestBankSendEstimation(t *testing.T) {

I don't think it makes sense to run this test under normal circumstances in our CI & integration tests

Maybe it makes sense to put it into different file and use another //go:build tag for it ?


x/deterministicgas/config.go line 123 at r5 (raw file):

		MsgToMsgURL(&govtypesv1.MsgVote{}):         constantGasFunc(7000 * 0.88),
		MsgToMsgURL(&govtypesv1.MsgVoteWeighted{}): constantGasFunc(9000 * 0.72),
		// FIXME (v47-deterministic): We must add integration test executing this message to have data to analyze

will you do close all these todos in scope of this task ? (should be separate PR from this one I think)


x/deterministicgas/config.go line 155 at r5 (raw file):

		[]sdk.Msg{
			// auth
			&authtypes.MsgUpdateParams{}, // This is non-deterministic because all the gov proposals are non-deterministic anyway

nit: one comment on top is enought for all of them instead of adding this // This is non-deterministic because all the gov proposals are non-deterministic anyway to each msg

I think it makes sene to group them


x/deterministicgas/README.md line 6 at r5 (raw file):

To do it:
1. Go to our Grafana dashboard

but first you run integration tests ?
Or you use production data ?


x/deterministicgas/README.md line 8 at r5 (raw file):

1. Go to our Grafana dashboard
2. Take values for deterministic gas factors reported there
3. Recalculate the deterministic gas by multiplying it by the minimum value taken from the metric.

so you mean that you take min for a specific msg and multiply it by current value present in deterministic gas ?


x/deterministicgas/spec/README.md line 74 at r4 (raw file):

Previously, miladz68 (milad) wrote…

I think round thiese numbers to the closest factor of 1000 .

I agree

Copy link
Collaborator Author

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @miladz68, @vertex451, and @ysv)


x/deterministicgas/config.go line 123 at r5 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

will you do close all these todos in scope of this task ? (should be separate PR from this one I think)

No, they will be a separate PR


x/deterministicgas/config.go line 155 at r5 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

nit: one comment on top is enought for all of them instead of adding this // This is non-deterministic because all the gov proposals are non-deterministic anyway to each msg

I think it makes sene to group them

I disagree, not all those messages are named like MsgUpdateParams, so it's not necessarily obvious that they are executed by gov only


x/deterministicgas/README.md line 8 at r5 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

so you mean that you take min for a specific msg and multiply it by current value present in deterministic gas ?

yes

Copy link
Collaborator Author

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: 3 of 4 files reviewed, 6 unresolved discussions (waiting on @miladz68, @vertex451, and @ysv)


x/deterministicgas/README.md line 6 at r5 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

but first you run integration tests ?
Or you use production data ?

clarified

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @vertex451 and @ysv)

Copy link
Collaborator Author

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 4 files reviewed, 6 unresolved discussions (waiting on @miladz68, @vertex451, and @ysv)


x/deterministicgas/spec/README.md line 74 at r4 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I agree

Done.

miladz68
miladz68 previously approved these changes Sep 18, 2023
Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r8, 1 of 1 files at r9, 2 of 2 files at r10, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @vertex451 and @wojtek-coreum)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r11, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @vertex451, and @wojtek-coreum)

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r11, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @vertex451, and @wojtek-coreum)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @vertex451, @wojtek-coreum, and @ysv)


x/deterministicgas/spec/README.md line 35 at r8 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

Lets discuss after daily
I don't think we have another option except increasing it but I want to make sure we don't brake everything

OK, let's discuss.

miladz68
miladz68 previously approved these changes Sep 19, 2023
Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @vertex451, @wojtek-coreum, and @ysv)

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r11, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vertex451 and @wojtek-coreum)

Wojtek added 2 commits October 5, 2023 08:12
# Conflicts:
#	integration-tests/modules/authz_test.go
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r12, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vertex451 and @wojtek-coreum)

Copy link
Collaborator Author

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: 8 of 10 files reviewed, 1 unresolved discussion (waiting on @vertex451 and @ysv)


integration-tests/modules/bank_test.go line 820 at r5 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I don't think it makes sense to run this test under normal circumstances in our CI & integration tests

Maybe it makes sense to put it into different file and use another //go:build tag for it ?

Done.

ysv
ysv previously approved these changes Oct 6, 2023
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r13, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vertex451)

miladz68
miladz68 previously approved these changes Oct 10, 2023
Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 5 files at r12, 2 of 2 files at r13, 2 of 2 files at r14, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vertex451)

@wojtek-coreum wojtek-coreum dismissed stale reviews from miladz68 and ysv via 0cec10a October 11, 2023 08:03
Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r15, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vertex451 and @wojtek-coreum)


x/deterministicgas/spec/README.md line 105 at r15 (raw file):

| `/cosmos.gov.v1beta1.MsgVote`                                          | 6000                           |
| `/cosmos.gov.v1beta1.MsgVoteWeighted`                                  | 9000                           |
| `/cosmos.nft.v1beta1.MsgSend`                                          | 25000                          |

cosmos and coreum nft send should be identical I guess. why do we have 25k and 16k for them which are different ?

Copy link
Collaborator Author

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @miladz68 and @vertex451)


x/deterministicgas/spec/README.md line 105 at r15 (raw file):

Previously, miladz68 (milad) wrote…

cosmos and coreum nft send should be identical I guess. why do we have 25k and 16k for them which are different ?

ah, yes, because this PR updated the values for old module but you introduced new module in master.

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r16, 1 of 1 files at r17, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vertex451)

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r16, 1 of 1 files at r17, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vertex451)

@wojtek-coreum wojtek-coreum merged commit e13e057 into master Oct 11, 2023
@wojtek-coreum wojtek-coreum deleted the wojtek/reestimate-gas branch October 11, 2023 11:26
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