Skip to content

Commit

Permalink
fix return value matching the function signature
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenix committed Aug 19, 2024
1 parent 5c8c205 commit a367fcb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
erlang 25.0.2
elixir 1.14.0-otp-25
13 changes: 10 additions & 3 deletions lib/abi/type_decoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,16 @@ defmodule ABI.TypeDecoder do

def decode(encoded_data, %FunctionSelector{returns: types, method_id: method_id}, :output)
when is_binary(method_id) do
case ABI.Util.split_method_id(encoded_data) do
{:ok, ^method_id, rest} -> decode_raw(rest, types)
_ -> decode_raw(encoded_data, types)
if rem(byte_size(encoded_data), 32) == 0 do
decode_raw(encoded_data, types)
else
case ABI.Util.split_method_id(encoded_data) do
{:ok, ^method_id, rest} ->
decode_raw(rest, types)

_ ->
decode_raw(encoded_data, types)
end
end
end

Expand Down

0 comments on commit a367fcb

Please sign in to comment.