Skip to content

Commit

Permalink
enable margin (#1622)
Browse files Browse the repository at this point in the history
* enable margin

* enable margin

* make sure you walk behind depositor
  • Loading branch information
Ino Murko authored Jul 7, 2020
1 parent 32f22b7 commit d666cd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions apps/omg_child_chain/lib/omg_child_chain/coordinator_setup.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ defmodule OMG.ChildChain.CoordinatorSetup do
],
%{
depositor: [finality_margin: deposit_finality_margin],
exiter: [waits_for: :depositor, finality_margin: 0],
in_flight_exit: [waits_for: :depositor, finality_margin: 0],
piggyback: [waits_for: :in_flight_exit, finality_margin: 0]
exiter: [waits_for: :depositor, finality_margin: deposit_finality_margin],
in_flight_exit: [waits_for: :depositor, finality_margin: deposit_finality_margin],
piggyback: [waits_for: :in_flight_exit, finality_margin: deposit_finality_margin]
}}
end
end
18 changes: 9 additions & 9 deletions apps/omg_child_chain/test/omg_child_chain/supervisor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ defmodule OMG.ChildChain.SupervisorTest do

# start - only depositor and getter allowed to move
assert %{sync_height: 9, root_chain_height: 9} = Core.get_synced_info(state, pid[:depositor])
assert %{sync_height: 0, root_chain_height: 10} = Core.get_synced_info(state, pid[:exiter])
assert %{sync_height: 0, root_chain_height: 10} = Core.get_synced_info(state, pid[:in_flight_exit])
assert %{sync_height: 0, root_chain_height: 9} = Core.get_synced_info(state, pid[:exiter])
assert %{sync_height: 0, root_chain_height: 9} = Core.get_synced_info(state, pid[:in_flight_exit])

# depositor advances
assert {:ok, state} = Core.check_in(state, pid[:depositor], 10, :depositor)
assert %{sync_height: 10, root_chain_height: 10} = Core.get_synced_info(state, pid[:exiter])
assert %{sync_height: 10, root_chain_height: 10} = Core.get_synced_info(state, pid[:in_flight_exit])
assert %{sync_height: 9, root_chain_height: 9} = Core.get_synced_info(state, pid[:exiter])
assert %{sync_height: 9, root_chain_height: 9} = Core.get_synced_info(state, pid[:in_flight_exit])

# in_flight_exit advances
assert %{sync_height: 0, root_chain_height: 10} = Core.get_synced_info(state, pid[:piggyback])
assert %{sync_height: 0, root_chain_height: 9} = Core.get_synced_info(state, pid[:piggyback])
assert {:ok, state} = Core.check_in(state, pid[:in_flight_exit], 10, :in_flight_exit)
assert %{sync_height: 10, root_chain_height: 10} = Core.get_synced_info(state, pid[:piggyback])
assert %{sync_height: 9, root_chain_height: 9} = Core.get_synced_info(state, pid[:piggyback])

# root chain advances
assert {:ok, state} = Core.update_root_chain_height(state, 100)
assert %{sync_height: 99, root_chain_height: 99} = Core.get_synced_info(state, pid[:depositor])
assert %{sync_height: 10, root_chain_height: 100} = Core.get_synced_info(state, pid[:exiter])
assert %{sync_height: 10, root_chain_height: 100} = Core.get_synced_info(state, pid[:in_flight_exit])
assert %{sync_height: 10, root_chain_height: 100} = Core.get_synced_info(state, pid[:piggyback])
assert %{sync_height: 10, root_chain_height: 99} = Core.get_synced_info(state, pid[:exiter])
assert %{sync_height: 10, root_chain_height: 99} = Core.get_synced_info(state, pid[:in_flight_exit])
assert %{sync_height: 10, root_chain_height: 99} = Core.get_synced_info(state, pid[:piggyback])
end

defp initial_check_in(state, services, pid) do
Expand Down

0 comments on commit d666cd0

Please sign in to comment.