fix(test-rpc): handle extra fields in TransactionByHashResponse after CamelModel extra="forbid"#1997
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #1997 +/- ##
================================================
Coverage 86.33% 86.33%
================================================
Files 538 538
Lines 34557 34557
Branches 3222 3222
================================================
Hits 29835 29835
Misses 4148 4148
Partials 574 574
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hey @LouisTsai-Csie. As we discussed, I put up a separate fix in #2000. I think the move here is to loosen restrictions for internal models on extra fields, especially things like RPC classes ( I put up a PR that fixes #1998 as well as #1999 (I created an issue to track this). Let me know what you think. |
|
closing in favor of #2000 |
🗒️ Description
Fixes
TransactionByHashResponseto work correctly after #1989 addedextra="forbid"toCamelModelAfter #1989,
CamelModelnow rejects extra fields. This brokeTransactionByHashResponsewhen parsing RPC responses from execution clients because:transactionIndexfield: Standard field returned by all clients per the Ethereum JSON-RPC specyParity/vfields: Modern clients return both for EIP-1559+ transactionshash:Transaction.strip_hash_from_t8n_outputremoves thehashfield beforeTransactionByHashResponsecan use itSolution
transaction_indexfield to match the standard RPC responsemode="wrap"validator to run BEFORE parent's validators, preservinghashunder_preserved_hashyParitywhen bothvandyParityare presentvalidation_alias=AliasChoices("hash", "_preserved_hash")as fallback for the hash fieldVerified with:
🔗 Related Issues or PRs
N/A.
✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture