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

Update tests to Sepolia #589

Merged
merged 13 commits into from
Aug 15, 2024
Merged

Update tests to Sepolia #589

merged 13 commits into from
Aug 15, 2024

Conversation

thiagodeev
Copy link
Collaborator

@thiagodeev thiagodeev commented Jul 5, 2024

Fix #573

rpc/types_block_test.go Outdated Show resolved Hide resolved
@thiagodeev thiagodeev marked this pull request as ready for review August 13, 2024 05:10
Comment on lines +64 to +67
if nodeErr.Code == 0 {
return Err(InternalError, err.Error())
}
return Err(nodeErr.Code, nodeErr.Data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the change here?

Copy link
Collaborator Author

@thiagodeev thiagodeev Aug 13, 2024

Choose a reason for hiding this comment

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

Because the previous version was like "If this error isn't one of these passed by the parameter, I'll set it to internal error without checking if it is a valid error of another type".

The code unmarshals the error to an RPCError in the nodeErr var so if the "nodeErr.Code" is zero (default int value, meaning that it hasn't a code) that means that it is not a valid RPCError, so we consider as "Internal error". But, if it is not zero, that means that this error is an existing error, so let's at least pass it to the "Err" function (in this function, the default value is InternalError anyway).

I did this because I faced a situation where the error was "InvalidParams", a valid case in the switch of the "Err" function but the code was hardcoding "InternalError" without even validating it.

rpc/types_block_test.go Outdated Show resolved Hide resolved
@rianhughes
Copy link
Contributor

Let's also update the rpc/test/contracts to use sepolia classes

@thiagodeev thiagodeev merged commit 69c22bf into main Aug 15, 2024
6 checks passed
@thiagodeev thiagodeev deleted the thiagodeev/upgrade-remaining-tests branch August 15, 2024 12:50
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.

Fix RPC tests
2 participants