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

Add root chain transaction hash to InvalidExit and UnchallengedExit events #1479

Merged
merged 14 commits into from
Apr 22, 2020

Conversation

kalouo
Copy link

@kalouo kalouo commented Apr 20, 2020

#1480

Overview

This adds a rootchain_txhash property to the invalid_exit and unchallenged_exit events, referring to the Ethereum transaction hash of the exit in question.

As seen by running the cabbage tests locally:

{
        "details": {
          "amount": 12000000000000000000,
          "currency": "0x0000000000000000000000000000000000000000",
          "eth_height": 899,
          "name": "unchallenged_exit",
          "owner": "0x37d5c1fbfa32b6582b425d5ea8d724478dac0aee",
          "root_chain_txhash": "0x5ebfbd6caff8d53e74590a646ffa5018e8776445c78ed735e29bdb52e55edd9c",
          "utxo_pos": 2001000000000
        },
        "event": "unchallenged_exit"
      },
      {
        "details": {
          "amount": 12000000000000000000,
          "currency": "0x0000000000000000000000000000000000000000",
          "eth_height": 899,
          "name": "invalid_exit",
          "owner": "0x37d5c1fbfa32b6582b425d5ea8d724478dac0aee",
          "root_chain_txhash": "0x5ebfbd6caff8d53e74590a646ffa5018e8776445c78ed735e29bdb52e55edd9c",
          "utxo_pos": 2001000000000
        },
        "event": "invalid_exit"
      }

Changes

  • Changes in exit_processor/exit_info.ex to persist the root chain transaction hash in the database.
  • Changes in omg_watcher/event.ex to add root chain transaction hash to the event struct.

Testing

  • No tests added but exit test helper updated to include a transaction hash of <<0::256. Open question whether we'd like a more advanced logic there in this PR.

Note to @DmitryDao to update documentation here and here once this is merged.

@coveralls
Copy link

coveralls commented Apr 20, 2020

Coverage Status

Coverage increased (+0.09%) to 77.999% when pulling 999b0d5 on 1471-byzantine-reporting-enhancements into f2ba5e0 on master.

@kalouo kalouo changed the title [WIP] : Byzantine Event Reporting enhancements Add root chain transaction hash to InvalidExit and UnchallengedExit events Apr 21, 2020
@kalouo
Copy link
Author

kalouo commented Apr 22, 2020

Also added dialyzer specs in exit_info with an addition of module_t() in events.ex to use for the spec of make_event_data/3

}

def new(contract_status, %{eth_height: eth_height, call_data: %{output_tx: txbytes}, exit_id: exit_id} = event) do
@spec new(map(), map()) :: t()
def new(contract_status, event) do
Copy link
Contributor

Choose a reason for hiding this comment

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

wait... this input is not a struct. it's a map. Who is calling this?

Copy link
Contributor

Choose a reason for hiding this comment

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

my comment (to use a dot access modifier was strictly for internal type structs ExitInfo

Copy link
Author

Choose a reason for hiding this comment

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

clear reverted back thanks

is_binary(currency) and is_binary(owner) and is_integer(exit_id) and is_binary(exiting_txbytes) and
is_boolean(is_active) do
@spec make_db_update({Utxo.Position.t(), t()}) :: Utxo.Position.db_t()
def make_db_update({position, event}) do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def make_db_update({position, event}) do
def make_db_update({position, exit_info}) do

Copy link
Author

Choose a reason for hiding this comment

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

Both make sense to me but exit_info is clearer. Changed in other methods for consistency except using exit_event for new/2

@kalouo kalouo merged commit 49a0bb0 into master Apr 22, 2020
@kalouo kalouo deleted the 1471-byzantine-reporting-enhancements branch April 22, 2020 12:29
kalouo added a commit that referenced this pull request Apr 22, 2020
kalouo pushed a commit that referenced this pull request Apr 22, 2020
@unnawut unnawut added api API-level issues enhancement New feature or request labels Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API-level issues enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants