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

[Access] Improve script exec compare logging #4936

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

peterargue
Copy link
Contributor

This PR improves the log messages emitted when comparing script exec between ANs and ENs.

  • Add duration
  • Add script args
  • Improve error message comparisons to handle different levels of message truncation

@codecov-commenter
Copy link

codecov-commenter commented Nov 3, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (18134c5) 55.77% compared to head (74d9e4e) 55.78%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4936   +/-   ##
=======================================
  Coverage   55.77%   55.78%           
=======================================
  Files         953      953           
  Lines       88420    88445   +25     
=======================================
+ Hits        49317    49336   +19     
+ Misses      35398    35394    -4     
- Partials     3705     3715   +10     
Flag Coverage Δ
unittests 55.78% <63.82%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
engine/access/rpc/backend/backend_scripts.go 69.66% <63.82%> (-0.18%) ⬇️

... and 14 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterargue peterargue self-assigned this Nov 3, 2023
Comment on lines 334 to 335
execParts := strings.Split(execErr.Error(), "failed to execute script at block")
localParts := strings.Split(localErr.Error(), "failed to execute script at block")
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make this string into a constant

localErr error,
blockID flow.Identifier,
script []byte,
arguments [][]byte,
insecureScriptHash [md5.Size]byte,
) {
// record errors caused by missing local data
if localErr != nil && status.Code(localErr) == codes.OutOfRange {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I wonder if it makes sense to create an error model for this since the logic is getting quite complex, something like: scriptExecutionError and then we could have exeErr.isOutOfRange() and lower exeErr.compare(err) which would encapsulate all messy details of splitting error strings. If you think it's fine this way it's fine with me.

Str("script", string(script)).
Hex("script_hash", insecureScriptHash[:])
Strs("args", args)
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a case where args might contain some confidential information or secret values? In case you have your own AN deployment and you might not be aware things are getting logged. Just thinking out loud.

Copy link
Contributor

@sideninja sideninja left a comment

Choose a reason for hiding this comment

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

Left some minor comments

@peterargue peterargue added this pull request to the merge queue Nov 7, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2023
@peterargue
Copy link
Contributor Author

@sideninja thanks for your comments. I refactored a bit to address them in a separate PR: #4956

@peterargue peterargue added this pull request to the merge queue Nov 8, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2023
@peterargue peterargue added this pull request to the merge queue Nov 8, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2023
@peterargue peterargue added this pull request to the merge queue Nov 8, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2023
@peterargue peterargue added this pull request to the merge queue Nov 8, 2023
Merged via the queue into master with commit 1990e2f Nov 8, 2023
36 checks passed
@peterargue peterargue deleted the petera/4798-improve-compare-logging branch November 8, 2023 18:20
peterargue added a commit that referenced this pull request Nov 14, 2023
[Access] Improve script exec compare logging
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