-
Notifications
You must be signed in to change notification settings - Fork 108
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
Conversation
if nodeErr.Code == 0 { | ||
return Err(InternalError, err.Error()) | ||
} | ||
return Err(nodeErr.Code, nodeErr.Data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the change here?
There was a problem hiding this comment.
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.
Let's also update the rpc/test/contracts to use sepolia classes |
Fix #573