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

Emit deterministic gas event #745

Merged
merged 5 commits into from
Dec 14, 2023
Merged

Conversation

wojtek-coreum
Copy link
Collaborator

@wojtek-coreum wojtek-coreum commented Dec 12, 2023

Description

We ant to track real gas consumption by deterministic messages. We decided to emit an event describing deterministic behaviour.

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 December 12, 2023 08:43
@wojtek-coreum wojtek-coreum requested review from dzmitryhil, miladz68 and ysv and removed request for a team December 12, 2023 08:43
miladz68
miladz68 previously approved these changes Dec 12, 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 7 of 8 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dzmitryhil 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 7 of 8 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @dzmitryhil and @wojtek-coreum)


x/deterministicgas/types/gas.go line 152 at r2 (raw file):

	}

	err := oldCtx.EventManager().EmitTypedEvent(&EventGas{

I'm not sure that this is the best place to emit this event.
The idea & name of the func is to report Metric but this code is not related to metric


x/deterministicgas/types/gas.go line 154 at r2 (raw file):

	err := oldCtx.EventManager().EmitTypedEvent(&EventGas{
		MsgURL:           msgURL,
		RealGas:          realGas,

are we sure we want to expose this info ?
lets discuss with the team


x/deterministicgas/types/gas.go line 158 at r2 (raw file):

	})

	if err != nil {

nit: this check is not needed

func WithStack(err error) error {  
if err == nil {  
return nil  
}  
return &withStack{  
err,  
callers(),  
}  
}

but if u find it more obvious I'm ok

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, 3 unresolved discussions (waiting on @dzmitryhil and @ysv)


x/deterministicgas/types/gas.go line 152 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I'm not sure that this is the best place to emit this event.
The idea & name of the func is to report Metric but this code is not related to metric

let's rename the function then


x/deterministicgas/types/gas.go line 154 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

are we sure we want to expose this info ?
lets discuss with the team

why not?


x/deterministicgas/types/gas.go line 158 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

nit: this check is not needed

func WithStack(err error) error {  
if err == nil {  
return nil  
}  
return &withStack{  
err,  
callers(),  
}  
}

but if u find it more obvious I'm ok

I would do it as you propose, but last time someone (Dima?) commented that having this for nil error is counterintuitive

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, 4 unresolved discussions (waiting on @dzmitryhil and @ysv)


x/deterministicgas/types/gas.go line 152 at r2 (raw file):

	}

	err := oldCtx.EventManager().EmitTypedEvent(&EventGas{

include index of the message

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, 4 unresolved discussions (waiting on @dzmitryhil and @ysv)


x/deterministicgas/types/gas.go line 158 at r2 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

I would do it as you propose, but last time someone (Dima?) commented that having this for nil error is counterintuitive

let's remove it

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: 7 of 8 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)


x/deterministicgas/types/gas.go line 152 at r2 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

include index of the message

I have no access to the index there

@dzmitryhil dzmitryhil requested review from miladz68 and ysv December 13, 2023 10:51
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: 7 of 8 files reviewed, 2 unresolved discussions (waiting on @miladz68 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 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @miladz68)

@wojtek-coreum wojtek-coreum merged commit 7374d81 into master Dec 14, 2023
7 checks passed
@wojtek-coreum wojtek-coreum deleted the wojtek/deterministicgas-event branch December 14, 2023 08:53
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