Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get call_data and rename it #1635

Merged
merged 4 commits into from
Jul 9, 2020
Merged

Conversation

InoMurko
Copy link
Contributor

@InoMurko InoMurko commented Jul 9, 2020

#1632

Overview

Get call data from fast exit contract and rename the fields so that we're able to use them.

Changes

Testing

Copy link
Contributor

@boolafish boolafish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor request, can we put the linked issue inside the code as comment or doc. People would totally get lost in the future potentially on this.

@InoMurko InoMurko requested a review from unnawut July 9, 2020 11:11
@@ -90,6 +90,14 @@ defmodule OMG.Eth.RootChain.Abi do
|> Fields.rename(function_spec)
end

# workaround for https://github.com/omgnetwork/elixir-omg/issues/1632
defp decode_function_call_result(%{function: "startExit"} = function_spec, values) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not well versed in this but notice that we had a separate ... [values]) when is_tuple(values) in the prior code.

Any chance we would get decode_function_call_result(%{function: "startExit"} = function_spec, [values]) and so the above function would catch the startExit before this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirelly sure what you mean, so I'll address everything:
the values in this function clause is a list:

[
  1768000000000000,
  <<248, 124, 1, 225, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 6, 71, 19, 191, 81, 112, 1, 246, 245, 1, 243, 148, 88,
    65, 40, 202, 209, 77, ...>>,
  <<199, 150, 50, 182, 108, 54, 104, 59, 238, 120, 114, 135, 4, 49, 219, 228,
    157, 221, 120, 21, 129, 53, 190, 121, 41, 240, 137, 122, 171, 246, 253, 247,
    78, 213, 192, 45, 109, 72, 200, 147, 36, 134, 201, 157, 58, 217, 153, ...>>,
  <<248, 179, 1, 225, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 6, 68, 89, 65, 98, 64, 0, 248, 108, 245, 1, 243, 148,
    74, 104, 72, ...>>,
  <<11, 251, 191, 14, 56, 34, 69, 197, 207, 118, 133, 53, 9, 53, 58, 36, 248,
    60, 239, 202, 126, 239, 198, 16, 145, 115, 232, 115, 149, 11, 70, 34, 78,
    213, 192, 45, 109, 72, 200, 147, 36, 134, 201, 157, 58, ...>>,
  1767000000000001
]

where as in the top decode_function_call_result/2, its a list with a tuple:

[{<<248, 83, 1, 192, 238, 237, 1, 235, 148, 140, 7, 214, 39, 36, 232, 102, 145,
   82, 184, 199, 23, 67, 29, 135, 188, 216, 208, 23, 89, 148, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>, 1000000000,
 <<248, 163, 1, 225, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59, 154, 202, 0, 248, 92, 237, 1, 235, 148,
   140, 7, 214, 39, ...>>, 0,
 <<248, 116, 1, 225, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59, 154, 202, 0, 238, 237, 1, 235, 148, 130,
   28, 224, ...>>, 0, 0, "",
 <<213, 14, 110, 137, 144, 125, 5, 4, 94, 64, 55, 85, 66, 96, 210, 166, 41, 110,
   42, 187, 199, 54, 83, 228, 31, 85, 4, 44, 153, 33, 56, 182, 104, 35, 67, 129,
   11, 98, 78, 229, 81, ...>>}]

the reason for that is that the input arguments in "startExit" are:

types: [{:uint, 256}, :bytes, :bytes, :bytes, :bytes, {:uint, 256}]

where as in others, they're tuples, for example "startStandardExit":

types: [tuple: [{:uint, 256}, :bytes, :bytes]]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha aha I see so startExit function signature should never fall into ..., [values]) when is_tuple(values) case

@boolafish boolafish merged commit 57d4048 into master Jul 9, 2020
@boolafish boolafish deleted the inomurko/1632-liquidity-contract branch July 9, 2020 13:02
@unnawut unnawut added the bug Something isn't working label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants