Skip to content

statesync: convert apphash to hex string in log#9591

Merged
mergify[bot] merged 10 commits intotendermint:mainfrom
JayT106:hex-log-apphash
Nov 24, 2022
Merged

statesync: convert apphash to hex string in log#9591
mergify[bot] merged 10 commits intotendermint:mainfrom
JayT106:hex-log-apphash

Conversation

@JayT106
Copy link
Contributor

@JayT106 JayT106 commented Oct 18, 2022

noticed this place is still printing unreadable apphash, convert to hex string


PR checklist

  • Tests written/updated, or no tests needed
  • CHANGELOG_PENDING.md updated, or no changelog entry needed
  • Updated relevant documentation (docs/) and code comments, or no
    documentation updates needed

@JayT106 JayT106 requested a review from a team October 18, 2022 20:29
@JayT106 JayT106 changed the title statesync: convert apphash to hex strings in log statesync: convert apphash to hex string in log Oct 18, 2022
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

Can we use the LazySprintf method used in #9471. Otherwise looks good

@JayT106
Copy link
Contributor Author

JayT106 commented Oct 24, 2022

Can we use the LazySprintf method used in #9471. Otherwise looks good

#9591 (comment)
I am good in both ways, any rule we should follow in the future?

@sergio-mena
Copy link
Contributor

Can we use the LazySprintf method used in #9471. Otherwise looks good

#9591 (comment) I am good in both ways, any rule we should follow in the future?

The rule of thumb is to use the LazySprintf in positive paths (those that are hit often), and doing without in error paths, because LazySprintf has some implications on the variables passed to it, so we don't want to use it where it is not needed.

@JayT106
Copy link
Contributor Author

JayT106 commented Nov 3, 2022

there is only one place that might hit multiple times during statesync, changed to use LazySprintf
https://github.com/tendermint/tendermint/pull/9591/files#diff-eea04842848003e0afe2c270bd1838ce5cc471dc4fcec1c853e6197d7a750322R514

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale for use by stalebot label Nov 14, 2022
@sergio-mena sergio-mena removed the stale for use by stalebot label Nov 14, 2022
h.logger.Info("ABCI Handshake App Info",
"height", blockHeight,
"hash", appHash,
"hash", fmt.Sprintf("%X", appHash),
Copy link
Contributor

Choose a reason for hiding this comment

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

In regards to:

The rule of thumb is to use the LazySprintf in positive paths (those that are hit often)

Isn't this an example of something that hits often i.e. once per start up (or would we not consider this often) (cc @sergio-mena )

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right. This is a "positive path".
@JayT106 would you mind using the LazySprintf here?

Copy link
Contributor

Choose a reason for hiding this comment

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

In the interest of speeding this up, I've just done the change. Let me know if anything else is needed @sergio-mena else you can merge it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @cmwaters, LGTM

@thanethomson thanethomson added the S:automerge Automatically merge PR when requirements pass label Nov 24, 2022
@mergify mergify bot merged commit 4af7568 into tendermint:main Nov 24, 2022
@sergio-mena
Copy link
Contributor

Thanks @thanethomson , I updated the branch to merge it several times, but then always got distracted with something else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S:automerge Automatically merge PR when requirements pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants