From a367fcb1586897df814c026cf164e2fa52f5ad00 Mon Sep 17 00:00:00 2001 From: steffel <87598469+steffenix@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:00:21 +0100 Subject: [PATCH 1/2] fix return value matching the function signature --- .tool-versions | 1 - lib/abi/type_decoder.ex | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.tool-versions b/.tool-versions index 95dea5b..10fd59d 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1 @@ -erlang 25.0.2 elixir 1.14.0-otp-25 \ No newline at end of file diff --git a/lib/abi/type_decoder.ex b/lib/abi/type_decoder.ex index c78974a..5fbbcd0 100644 --- a/lib/abi/type_decoder.ex +++ b/lib/abi/type_decoder.ex @@ -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 From 5a1397eba54583f24cefb84696d8560c39c7ea10 Mon Sep 17 00:00:00 2001 From: steffel <87598469+steffenix@users.noreply.github.com> Date: Sun, 8 Sep 2024 09:51:55 +0200 Subject: [PATCH 2/2] fix removed tool version --- .tool-versions | 1 + 1 file changed, 1 insertion(+) diff --git a/.tool-versions b/.tool-versions index 10fd59d..95dea5b 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ +erlang 25.0.2 elixir 1.14.0-otp-25 \ No newline at end of file