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

feat: add stacktrace to SSZ #1017

Merged
merged 12 commits into from
Apr 24, 2024
Merged

feat: add stacktrace to SSZ #1017

merged 12 commits into from
Apr 24, 2024

Conversation

avilagaston9
Copy link
Contributor

@avilagaston9 avilagaston9 commented Apr 22, 2024

This PR adds a stacktrace to the Error struct in SSZ.

image

Closes #1004

@avilagaston9 avilagaston9 marked this pull request as ready for review April 23, 2024 14:38
@avilagaston9 avilagaston9 requested a review from a team as a code owner April 23, 2024 14:38
{:error, error} = SszEx.hash_tree_root(execution_payload)

assert "#{error}" ==
"Invalid binary length while merkleizing byte_vector.\nExpected size: 256.\nFound: 3\nStacktrace: Elixir.Types.ExecutionPayload.logs_bloom"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we normalize types so that it says ExecutionPayload.logs_bloom instead of Elixir.Types.ExecutionPayload.logs_bloom?

@@ -18,12 +18,19 @@ defmodule SszEx.Error do
%Error{message: message, stacktrace: [new_trace]}
end

def add_trace(%Error{message: message, stacktrace: stacktrace}, value) when is_struct(value) do
new_trace =
value.__struct__ |> Module.split() |> List.last()
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

@avilagaston9 avilagaston9 merged commit 7a7b5a9 into main Apr 24, 2024
12 checks passed
@avilagaston9 avilagaston9 deleted the ssz-stacktrace branch April 24, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Add a stack trace in SSZ errors
3 participants