Repository navigation
Return EIP-55 checksummed addresses everywhere - #312
Merged
Merged
Conversation
The action was not mapped to an RPC method, so batch requests sent an unknown `deployed_address` method to the node. Map it to `eth_getTransactionReceipt` like the direct call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
Sending or signing with `from` in one casing and `signer_opts[:from]` in another raised "different from address" although both name the same account. Compare the decoded addresses instead of the strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
Some return values passed the node's casing (usually lowercase) or the configured casing through, so the same address compared unequal depending on where it came from. Checksum them like the rest of the library already does: - `Ethers.Event` `address` (get_logs, batch get_logs, decode, find_and_decode, CombinedEventFilter.decode_logs) - `Ethers.deployed_address/2` and its batch action - `Ethers.Signer.JsonRPC.accounts/1` - contract `default_address` (normalised at compile time) Values from the node that are not a well-formed address are returned unchanged instead of raising, so log scanning gains no new failure modes. Inputs keep accepting any casing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
Fetched EIP-7702 authorization addresses and `eth_config` addresses were passed straight to `to_checksum_address/1`, which raises on `nil` and mangles other malformed values. Use the tolerant helper so a fetched transaction with a malformed authorization address returns the `Ethers.Authorization` validation error and fork configs keep the node's value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
alisinabh
added a commit
that referenced
this pull request
Nov 15, 2026
Since #312, `Ethers.Event.address` and `Ethers.deployed_address/2` are checksummed, so the receipt tests compare them with the receipt's addresses directly. The default address case uses a lowercase address to keep covering case-insensitive matching in `decode_logs/2`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
alisinabh
added a commit
that referenced
this pull request
Nov 16, 2026
Decoded events carry an EIP-55 checksummed `address` since #312, so system_address/0 returns the checksummed form too and compares equal to the `address` of an ETH transfer log. eth_transfer_log?/1 still compares case-insensitively. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
alisinabh
added a commit
that referenced
this pull request
Nov 16, 2026
* Return an Ethers.Receipt struct from get_transaction_receipt/2
`Ethers.get_transaction_receipt/2` returned the node's JSON untouched: a
string-keyed map with hex quantities. It now returns an `Ethers.Receipt`
struct decoded after the execution-apis `ReceiptInfo` schema:
- quantities (including `type`, the EIP-2718 type id, also for types
the library has no module for) are integers
- `status` is `:success | :failure`, `nil` for pre-Byzantium receipts,
which carry `root` instead
- addresses are checksummed, hashes stay `0x` hex strings, `logs_bloom`
is a binary and `logs` are kept as returned by the node
- omitted members are `nil`, unknown members are ignored and the node's
map is kept in `raw` for chain specific members (OP Stack L1 fees...)
- a member not matching the schema returns
`{:error, {:invalid_receipt_member, member}}` instead of raising
The `:get_transaction_receipt` batch action now works and returns the
same struct: it was not mapped to `eth_getTransactionReceipt`, so the
node answered "Method not found".
This is a breaking change for 1.0.0.
Issue: #294
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
* Add Ethers.Receipt.decode_logs/2
A receipt holds the logs of every contract the transaction called, so
its logs are kept as returned by the node. `decode_logs/2` decodes the
ones matching an event filter, a combined event filter or a contract's
EventFilters module into `%Ethers.Event{}` structs, in emission order.
A log matches like with `eth_getLogs` (topic_0, indexed argument values
with `nil` as a wildcard, the filter's default address compared case
insensitively) plus two checks receipts need: the topic count must equal
1 + the number of indexed arguments, so ERC-20 and ERC-721 `Transfer`
logs are not decoded as each other, and logs whose data does not ABI
decode as the event are skipped instead of raising. Logs matching none
of the events are skipped.
Also note in the typedoc that some nodes (anvil) return `blobGasPrice`
for non-blob transactions.
Issue: #294
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
* Add changelog and upgrade guide entries for Ethers.Receipt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
* Replace Ethers.Receipt raw with extra
`raw` duplicated the whole node map, including every member the struct
already decodes. It is replaced by `extra`, which holds only the members
this version of the library does not decode (the receipt map minus every
member of the decoder table, present or not): chain specific members such
as the OP Stack L1 fee fields, and node extras such as anvil's
`blockTimestamp`. Keys and values stay as returned by the node, and it is
`%{}` when there are none. A member can move from `extra` to a struct
field in a later release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
* Expect checksummed event and deployed addresses in receipt tests
Since #312, `Ethers.Event.address` and `Ethers.deployed_address/2` are
checksummed, so the receipt tests compare them with the receipt's
addresses directly. The default address case uses a lowercase address to
keep covering case-insensitive matching in `decode_logs/2`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
alisinabh
added a commit
that referenced
this pull request
Nov 16, 2026
…309) * Add helpers to identify EIP-7708 ETH transfer logs Under EIP-7708 (Glamsterdam) every non-zero ETH transfer emits a Transfer(address,address,uint256) log from SYSTEM_ADDRESS (0xff...fe), which ERC-20 Transfer filters decode as a token transfer. Ethers.Event.system_address/0 returns that emitter and Ethers.Event.eth_transfer_log?/1 tells such events apart (emitter and Transfer topic, case-insensitive). get_logs/2 is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6 * Document that Transfer event filters match EIP-7708 ETH transfer logs Without an address, a Transfer(address,address,uint256) filter (ERC-20, ERC-777, or a combined filter including it) also returns native ETH transfers on networks with EIP-7708 active. Warn about it on Ethers.get_logs/2, Ethers.EventFilter, Ethers.CombinedEventFilter, the README and in the generated docs of event filters with that signature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6 * Return the checksummed system address from Ethers.Event.system_address/0 Decoded events carry an EIP-55 checksummed `address` since #312, so system_address/0 returns the checksummed form too and compares equal to the `address` of an ETH transfer log. eth_transfer_log?/1 still compares case-insensitively. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every address the library returns is now EIP-55 checksummed. Some return values used to keep the node's casing (usually lowercase) or the casing they were configured with, so the same address could compare unequal depending on where it came from:
Inputs still accept any casing.
This PR also fixes two small things in the same area:
:deployed_addressinEthers.batch/2was not mapped to an RPC method, so the node received an unknowndeployed_addressmethod and answered -32601 "Method not found". It now maps toeth_getTransactionReceipt, like the direct call.fromin one casing andsigner_opts[:from]in another raisedArgumentError("different from address"), although both name the same account. The two are now compared as decoded bytes.Breaking change
These return values are now EIP-55 checksummed strings. Before, they kept the node's casing or the configured casing:
addressofEthers.Event, everywhere it is produced:Ethers.get_logs/2,get_logs!/2,:get_logsinEthers.batch/2,Ethers.Event.decode/2,Ethers.Event.find_and_decode/2andEthers.CombinedEventFilter.decode_logs/2Ethers.deployed_address/2, and:deployed_addressinEthers.batch/2accounts/1ofEthers.Signer.JsonRPC(the result ofeth_accounts)default_addressof contract modules:__default_address__/0, and thedefault_addressof theEthers.TxData,Ethers.EventFilterandEthers.CombinedEventFilterstructs those modules build. This also changes the defaulttoaddress returned byEthers.Multicall.aggregate2_encode_data/1andaggregate3_encode_data/1.Code that compares these values against lowercase string literals breaks.
guides/upgrading.mdhas a Before (0.8.x) / After (1.0.0) entry that shows how to compare safely, withEthers.Utils.to_checksum_address/1orEthers.Utils.decode_address!/1.Audit of returned addresses
"Node casing" means whatever the node sent, usually lowercase.
Ethers.Eventaddress(Event.decode/2,find_and_decode/2)log["address"]from the nodeget_logs/2,get_logs!/2, batch:get_logs,CombinedEventFilter.decode_logs/2Event.decode/2Event.decode/2Eventtopics/dataaddress valuesUtils.human_arg/2topics_raw/data_rawstay raw by designEthers.deployed_address/2contractAddress:deployed_addresseth_getTransactionReceipt, result checksummedget_transaction/2,Transaction.from_rpc_map/1:tonew/1validationfromaccess_listaddressesaddressto_checksum_address/1nilraised and malformed values were mangledEthers.Authorizationvalidation error (:missing_address,:invalid_address_lengthor:invalid_address)Transaction.Signed.from_address/1,Transaction.decode/1(to, authorizations)encode_addressSigner.Local.accounts/1public_key_to_address/2Signer.JsonRPC.accounts/1eth_accounts(anvil returns lowercase)create_access_list/2NameService.resolve/2,resolve!/2human_arg/2NameService.reverse_resolve/2Multicalldecode functionshuman_arg/2Multicall.aggregate2_encode_data/1,aggregate3_encode_data/1to:input ordefault_addressto:passes through as givenEthers.call/2Siwe.new/1Siwe.parse/1,verify/3:invalid_addressSiwe.validate/2Signature.verify_*TypedData.recover_signer/2,to_eip712_json/1encode_address!Domain.verifying_contractis user input echoed back and is left alonePersonalMessage.recover/2,recover!/2Authorization.new/1,clear/1,Authorization.Signed.recover_authority/1ForkConfigprecompiles / system contractsto_checksum_address/1Utils.public_key_to_address/2Utils.encode_address/1,Utils.human_arg/2__default_address__/0, anddefault_addressof theTxData/EventFilter/CombinedEventFilterstructs a contract module buildsuse Ethers.Contract, default_address:optiondefault_addressset by hand on a structInspectforTxData,EventFilter,CombinedEventFilterdefault_address; topics throughhuman_arg/2Inspectfor errorshuman_arg/2{sender}placeholderget_transaction_receipt/2Places where the library compares addresses internally:
fromandsigner_opts[:from]. It is fixed in this PR and covered by a test.PersonalMessage.verify/3,TypedData.valid_signature?/3,Siwe.validate/2,Signatureand theNameServiceforward-resolution check already compared case-insensitively.Design decisions
Ethers.Utils.maybe_checksum_address/1(@doc false) calls the existingto_checksum_address/1. It checksums only a0x/0Xprefix followed by 40 hex characters, and returns anything else unchanged (nil, wrong length, non-hex).address,deployed_address, JSON-RPC signer accounts, EIP-7702 authorization addresses and fork configs.new/1), the error now comes back as{:error, reason}instead of aFunctionClauseError.default_addressis normalised at compile time, inEthers.Contract.__before_compile__.__default_address__/0is a value the library returns. Without this,MyContract.__default_address__() == event.addresswould be false whenever the address is configured in lowercase.:keccak_modulemust be loadable when those modules compile.Domain.verifying_contract, a hand-builtSiwe.Message, a hand-setdefault_address, the multicallto:option. Combining filters keeps the first default address as given.topics_raw,data_raw, receipt maps.{sender}(EIP-3668).Overlaps with open PRs
deployed_address/2andEvent.addressare checksummed, matching the addresses ofEthers.Receipt.Ethers.Receiptreturns an error for a malformed address member, while this PR passes such values through. Both are reasonable: one is a schema decoder, the other covers passthrough sites.Event.decode/2now returns the emitter checksummed, so:Ethers.Event.system_address/0should return"0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE".address: "0xfffffffffffffffffffffffffffffffffffffffe", must use the checksummed form.eth_transfer_log?/1compares case-insensitively, so it keeps working.Ethers.Transaction.Unknownalready checksumsfromandto. It turns invalid values intonil, a different malformed-value rule; it could adoptmaybe_checksum_address/1later.get_codeand delegation):get_delegation/2returns a checksummed address, which matches this change. Add Ethers.get_code/2 and EIP-7702 delegation helpers #305 also maps:get_balancefor batch, so that fix is not repeated here.Out of scope, found during the audit
Ethers.NameService.resolve/2returns a bare:error, not a tuple, when no resolver exists all the way up to the top-level domain. This contradicts its spec.Ethers.Types.t_address()for address fields, but the decoded values are 20-byte binaries.Ethers.TypedData.recover_signer/2returns a bare address instead of{:ok, address}.Testing
create_access_list/2revert test, which needs a newer anvil than the local one.mix format --check-formatted,mix credo --strictandmix dialyzerpass.mix docsadds no new warnings.Not verified
Closes #311
🤖 Generated with Claude Code
https://claude.ai/code/session_012hqvX8DbbP3mgXy5hVEDc6