go-ethereum/accounts
cuiweixie 39a9e49233 accounts/abi: copy selector in Pack to avoid aliasing cached method.ID
ABI.Pack returned `append(method.ID, arguments...)`. method.ID is derived
from crypto.Keccak256(sig)[:4], which yields a slice of length 4 but
capacity 32 (the full keccak hash buffer), and it is computed once and
cached on the parsed method. When a method takes no arguments, the append
has nothing to copy and returns method.ID's own backing array.

The caller therefore received calldata that aliased the ABI's cached
selector. Mutating that calldata, or a concurrent Pack of the same no-arg
method, corrupted the cached selector and broke every subsequent encode
of that method. (Methods with arguments always pack to >=32 bytes, so
4+32 > 32 forces a reallocation and they were never affected.)

Copy method.ID into a fresh slice before appending the arguments so the
returned calldata never shares storage with the cached selector. Add a
regression test that packs a no-arg method, mutates the result, and
verifies both the cached selector and a subsequent pack are unaffected.
2026-06-11 20:00:00 +08:00
..
abi accounts/abi: copy selector in Pack to avoid aliasing cached method.ID 2026-06-11 20:00:00 +08:00
external all: implement eip-7702 set code tx (#30078) 2024-12-16 11:29:37 +01:00
keystore accounts/keystore: enable fsnotify watcher on linux/arm64 (#34834) 2026-04-28 15:36:01 +02:00
scwallet accounts/scwallet: truncate before write (#34815) 2026-04-27 16:13:42 +02:00
usbwallet accounts/usbwallet: check ledger versions for typed txs (#35044) 2026-05-29 08:11:42 +02:00
accounts.go crypto/keccak: vendor in golang.org/x/crypto/sha3 (#33323) 2026-02-03 14:55:27 -07:00
accounts_test.go accounts: run tests in parallel (#28544) 2023-12-04 14:55:06 +01:00
errors.go accounts: fix typo in comments (#24805) 2022-05-03 08:49:41 +02:00
hd.go build: upgrade to go 1.19 (#25726) 2022-09-10 13:25:40 +02:00
hd_test.go accounts: run tests in parallel (#28544) 2023-12-04 14:55:06 +01:00
manager.go accounts: fix data race when closing manager (#31982) 2025-06-17 14:44:51 +02:00
sort.go accounts, console: frendly card errors, support pin unblock 2019-04-08 13:19:37 +02:00
url.go build: upgrade to go 1.19 (#25726) 2022-09-10 13:25:40 +02:00
url_test.go accounts: run tests in parallel (#28544) 2023-12-04 14:55:06 +01:00