I am currently working with the erc-1271 standard and encountered an issue when calling the isValidSignature function from the contract. The function returns the bytes4 constant internal MAGICVALUE which is 0x1626ba7e. However, it appears that the method signature is 0x1626ba7e. It is being removed from the returned value before decoding, leading to decoding failures.
My current workaround is, could you tell me if that makes sense to you?
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
I am currently working with the
erc-1271
standard and encountered an issue when calling theisValidSignature
function from the contract. The function returns thebytes4
constant internalMAGICVALUE
which is0x1626ba7e
. However, it appears that the method signature is0x1626ba7e
. It is being removed from the returned value before decoding, leading to decoding failures.https://github.com/poanetwork/ex_abi/blob/5c8c205fe43786663a682bcb2de34e458ba0b150/lib/abi/type_decoder.ex#L154-L155
My current workaround is, could you tell me if that makes sense to you?
I have made a PR if that is good for you: https://github.com/poanetwork/ex_abi/pull/174