-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Undoing the mixup between Chain ID and Network ID #777
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,14 @@ | |
|
||
@curry | ||
def validate_chain_id(web3, chain_id): | ||
if chain_id == web3.version.network: | ||
return None | ||
if chain_id == web3.net.chainId: | ||
return chain_id | ||
else: | ||
raise ValidationError( | ||
"The transaction declared chain ID %r, " | ||
"but the connected node is on %r" % ( | ||
chain_id, | ||
web3.version.network, | ||
"UNKNOWN", | ||
) | ||
) | ||
|
||
|
@@ -33,7 +33,6 @@ def transaction_normalizer(transaction): | |
|
||
def validation_middleware(make_request, web3): | ||
transaction_validator = apply_formatters_to_dict({ | ||
'chainId': validate_chain_id(web3), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that this is the cause for using xfail! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes. Once we can reliably discover the chainID from the connected node, then we should validate chainID again. |
||
}) | ||
|
||
transaction_sanitizer = compose(transaction_normalizer, transaction_validator) | ||
|
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.
@carver why did you mark this as xfail?
shouldn't the above code give
ValidationError
forchainId
? In fact validation middleware doesn't seem to do what it is expected to do.I'm not very sure if this is a regression but I'm fixing this in #756.