Skip to content

Commit

Permalink
Merge pull request #796 from dapphub/fix-checksum-lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
d-xo authored Sep 18, 2021
2 parents c09872a + 6ba5630 commit 084c96b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/dapp-tests/integration/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,52 @@ dapp_testnet() {

# dynamic fee transaction (EIP-1559)
seth send "$A_ADDR" "on()" --gas 0xffff --password /dev/null --from "$ACC" --keystore "$TMPDIR"/8545/keystore --prio-fee 2gwei --gas-price 10gwei

# clean up
killall geth
}

dapp_testnet

# checks that seth send works with both checksummed and unchecksummed addresses
seth_send_address_formats() {
TMPDIR=$(mktemp -d)

dapp testnet --dir "$TMPDIR" &
# give it a few secs to start up
sleep 180
read -r ACC BAL <<< "$(seth ls --keystore "$TMPDIR/8545/keystore")"

lower=$(echo "$ACC" | tr '[:upper:]' '[:lower:]')
export ETH_GAS=0xffff

zero=0x0000000000000000000000000000000000000000

# with checksummed
tx=$(seth send "$zero" --from "$ACC" --password /dev/null --value "$(seth --to-wei 1 ether)" --keystore "$TMPDIR"/8545/keystore --async)
[[ $(seth tx "$tx" from) = "$lower" ]]

# without checksum
tx=$(seth send "$zero" --from "$lower" --password /dev/null --value "$(seth --to-wei 1 ether)" --keystore "$TMPDIR"/8545/keystore --async)
[[ $(seth tx "$tx" from) = "$lower" ]]

# try again with eth_rpc_accounts
export ETH_RPC_ACCOUNTS=true

# with checksummed
tx=$(seth send "$zero" --from "$ACC" --password /dev/null --value "$(seth --to-wei 1 ether)" --keystore "$TMPDIR"/8545/keystore --async)
[[ $(seth tx "$tx" from) = "$lower" ]]

# without checksum
tx=$(seth send "$zero" --from "$lower" --password /dev/null --value "$(seth --to-wei 1 ether)" --keystore "$TMPDIR"/8545/keystore --async)
[[ $(seth tx "$tx" from) = "$lower" ]]

# clean up
killall geth
}

seth_send_address_formats

test_hevm_symbolic() {
solc --bin-runtime -o . --overwrite factor.sol
# should find counterexample
Expand Down
4 changes: 4 additions & 0 deletions src/seth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `seth abi-encode` command returns the ABI encoded values without the function signature
- `seth index` command returns the slot number for the specified mapping type and input data

### Fixed

- Address lookup no longer fails if `ETH_RPC_ACCOUNTS` is set, and `ETH_FROM` is an unchecksummed address

## [0.11.0] - 2021-09-08

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/seth/libexec/seth/seth-send
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function signAndSend() {

if [[ -z $ETH_RPC_ACCOUNTS ]]; then
signAndSend
elif ethsign ls | grep -q $ETH_FROM; then
elif ethsign ls | grep -qI "$ETH_FROM"; then
signAndSend
else
tx=$(seth rpc eth_sendTransaction -- "${jshon[@]}")
Expand Down

0 comments on commit 084c96b

Please sign in to comment.