diff --git a/apps/omg_status/test/omg_status/monitor/memory_monitor_test.exs b/apps/omg_status/test/omg_status/monitor/memory_monitor_test.exs index 83ee117ec1..e6c1938a60 100644 --- a/apps/omg_status/test/omg_status/monitor/memory_monitor_test.exs +++ b/apps/omg_status/test/omg_status/monitor/memory_monitor_test.exs @@ -58,7 +58,7 @@ defmodule OMG.Status.Monitor.MemoryMonitorTest do assert_receive :got_clear_alarm end - test "works with :buffered_memory and :cached_memory values are not provided", context do + test "works with :buffered_memory and :cached_memory values are not provided" do set_memsup(total_memory: 1000, free_memory: 100) assert_receive :got_raise_alarm end diff --git a/apps/omg_watcher/lib/omg_watcher/api/configuration.ex b/apps/omg_watcher/lib/omg_watcher/api/configuration.ex index 6afdb84be4..65d0be043f 100644 --- a/apps/omg_watcher/lib/omg_watcher/api/configuration.ex +++ b/apps/omg_watcher/lib/omg_watcher/api/configuration.ex @@ -22,7 +22,7 @@ defmodule OMG.Watcher.API.Configuration do @spec get_configuration() :: {:ok, map()} def get_configuration() do configuration = %{ - exit_processor_sla_margin: Configuration.exit_processor_sla_margin(), + exit_processor_sla_seconds: Configuration.exit_processor_sla_seconds(), deposit_finality_margin: OMG.Configuration.deposit_finality_margin(), contract_semver: OMG.Eth.Configuration.contract_semver(), network: OMG.Eth.Configuration.network() diff --git a/apps/omg_watcher/lib/omg_watcher/configuration.ex b/apps/omg_watcher/lib/omg_watcher/configuration.ex index 9c264bf683..f72d7217b4 100644 --- a/apps/omg_watcher/lib/omg_watcher/configuration.ex +++ b/apps/omg_watcher/lib/omg_watcher/configuration.ex @@ -17,8 +17,8 @@ defmodule OMG.Watcher.Configuration do Provides access to applications configuration """ @app :omg_watcher - def exit_processor_sla_margin() do - Application.fetch_env!(@app, :exit_processor_sla_margin) + def exit_processor_sla_seconds() do + Application.fetch_env!(@app, :exit_processor_sla_seconds) end def exit_processor_sla_margin_forced() do diff --git a/apps/omg_watcher/lib/omg_watcher/exit_processor.ex b/apps/omg_watcher/lib/omg_watcher/exit_processor.ex index 74d48b79f6..eb5769a81b 100644 --- a/apps/omg_watcher/lib/omg_watcher/exit_processor.ex +++ b/apps/omg_watcher/lib/omg_watcher/exit_processor.ex @@ -251,20 +251,18 @@ defmodule OMG.Watcher.ExitProcessor do Reads the exit data from `OMG.DB`. Options: - - `exit_processor_sla_margin`: number of blocks after exit start before it's considered late (and potentially: + - `exit_processor_sla_seconds`: seconds after exit start before it's considered late (and potentially: unchallenged) - - `exit_processor_sla_margin_forced`: if `true` will override the check of `exit_processor_sla_margin` against + - `exit_processor_sla_margin_forced`: if `true` will override the check of `exit_processor_sla_seconds` against `min_exit_period_seconds` - `min_exit_period_seconds`: should reflect the value of this parameter for the specific child chain watched, - - `ethereum_block_time_seconds`: just to relate blocks to seconds for the `exit_processor_sla_margin` check - `metrics_collection_interval`: how often are the metrics sent to `telemetry` (in milliseconds) """ def init( - exit_processor_sla_margin: exit_processor_sla_margin, + exit_processor_sla_seconds: exit_processor_sla_seconds, exit_processor_sla_margin_forced: exit_processor_sla_margin_forced, metrics_collection_interval: metrics_collection_interval, min_exit_period_seconds: min_exit_period_seconds, - ethereum_block_time_seconds: ethereum_block_time_seconds, child_block_interval: child_block_interval ) do {:ok, db_exits} = PaymentExitInfo.all_exit_infos() @@ -272,11 +270,10 @@ defmodule OMG.Watcher.ExitProcessor do {:ok, db_competitors} = DB.competitors_info() :ok = - Core.check_sla_margin( - exit_processor_sla_margin, + Core.check_sla_seconds( + exit_processor_sla_seconds, exit_processor_sla_margin_forced, - min_exit_period_seconds, - ethereum_block_time_seconds + min_exit_period_seconds ) {:ok, processor} = @@ -286,7 +283,7 @@ defmodule OMG.Watcher.ExitProcessor do db_competitors, min_exit_period_seconds, child_block_interval, - exit_processor_sla_margin + exit_processor_sla_seconds ) {:ok, _} = :timer.send_interval(metrics_collection_interval, self(), :send_metrics) @@ -630,12 +627,13 @@ defmodule OMG.Watcher.ExitProcessor do Core.find_ifes_in_blocks(state, prepared_request) end - defp run_status_gets(%ExitProcessor.Request{eth_height_now: nil, blknum_now: nil} = request) do + defp run_status_gets(%ExitProcessor.Request{eth_timestamp_now: nil, blknum_now: nil} = request) do {:ok, eth_height_now} = EthereumHeight.get() + {:ok, eth_timestamp_now} = Eth.get_block_timestamp_by_number(eth_height_now) {blknum_now, _} = State.get_status() - _ = Logger.debug("eth_height_now: #{inspect(eth_height_now)}, blknum_now: #{inspect(blknum_now)}") - %{request | eth_height_now: eth_height_now, blknum_now: blknum_now} + _ = Logger.debug("eth_timestamp_now: #{inspect(eth_timestamp_now)}, blknum_now: #{inspect(blknum_now)}") + %{request | eth_timestamp_now: eth_timestamp_now, blknum_now: blknum_now} end defp get_utxo_existence(%ExitProcessor.Request{utxos_to_check: positions} = request), diff --git a/apps/omg_watcher/lib/omg_watcher/exit_processor/canonicity.ex b/apps/omg_watcher/lib/omg_watcher/exit_processor/canonicity.ex index 455f4781b3..4ec33e45c0 100644 --- a/apps/omg_watcher/lib/omg_watcher/exit_processor/canonicity.ex +++ b/apps/omg_watcher/lib/omg_watcher/exit_processor/canonicity.ex @@ -67,11 +67,11 @@ defmodule OMG.Watcher.ExitProcessor.Canonicity do @doc """ Returns a tuple with byzantine events: first element is a list of events for ifes with competitor - and the second is the same list filtered for late ifes past sla margin + and the second is the same list filtered for late ifes past sla seconds """ @spec get_ife_txs_with_competitors(Core.t(), KnownTx.known_txs_by_input_t(), pos_integer()) :: {list(Event.NonCanonicalIFE.t()), list(Event.UnchallengedNonCanonicalIFE.t())} - def get_ife_txs_with_competitors(state, known_txs_by_input, eth_height_now) do + def get_ife_txs_with_competitors(state, known_txs_by_input, eth_timestamp_now) do non_canonical_ifes = state.in_flight_exits |> Map.values() @@ -87,13 +87,13 @@ defmodule OMG.Watcher.ExitProcessor.Canonicity do |> Enum.uniq() |> Enum.map(fn txbytes -> %Event.NonCanonicalIFE{txbytes: txbytes} end) - past_sla_margin = fn {ife, _double_spend} -> - ife.eth_height + state.sla_margin <= eth_height_now + past_sla_seconds = fn {ife, _double_spend} -> + ife.timestamp + state.sla_seconds <= eth_timestamp_now end late_non_canonical_ife_events = non_canonical_ifes - |> Stream.filter(past_sla_margin) + |> Stream.filter(past_sla_seconds) |> Stream.map(fn {ife, _double_spend} -> Transaction.raw_txbytes(ife.tx) end) |> Enum.uniq() |> Enum.map(fn txbytes -> %Event.UnchallengedNonCanonicalIFE{txbytes: txbytes} end) diff --git a/apps/omg_watcher/lib/omg_watcher/exit_processor/core.ex b/apps/omg_watcher/lib/omg_watcher/exit_processor/core.ex index da8b4f8a62..2939981938 100644 --- a/apps/omg_watcher/lib/omg_watcher/exit_processor/core.ex +++ b/apps/omg_watcher/lib/omg_watcher/exit_processor/core.ex @@ -44,8 +44,7 @@ defmodule OMG.Watcher.ExitProcessor.Core do use OMG.Utils.LoggerExt - @default_sla_margin 10 - + @default_sla_seconds 10 @zero_address OMG.Eth.zero_address() @max_inputs Transaction.Payment.max_inputs() @@ -70,7 +69,7 @@ defmodule OMG.Watcher.ExitProcessor.Core do @type new_piggyback_event_t() :: new_piggyback_input_event_t() | new_piggyback_output_event_t() defstruct [ - :sla_margin, + :sla_seconds, :min_exit_period_seconds, :child_block_interval, exits: %{}, @@ -80,7 +79,7 @@ defmodule OMG.Watcher.ExitProcessor.Core do ] @type t :: %__MODULE__{ - sla_margin: non_neg_integer(), + sla_seconds: non_neg_integer(), exits: %{Utxo.Position.t() => ExitInfo.t()}, in_flight_exits: %{Transaction.tx_hash() => InFlightExitInfo.t()}, # NOTE: maps only standard exit_ids to the natural keys of standard exits (input pointers/utxo_pos) @@ -114,7 +113,7 @@ defmodule OMG.Watcher.ExitProcessor.Core do db_competitors :: [{Transaction.tx_hash(), CompetitorInfo.t()}], min_exit_period_seconds :: non_neg_integer(), child_block_interval :: non_neg_integer, - sla_margin :: non_neg_integer + sla_seconds :: non_neg_integer ) :: {:ok, t()} def init( db_exits, @@ -122,7 +121,7 @@ defmodule OMG.Watcher.ExitProcessor.Core do db_competitors, min_exit_period_seconds, child_block_interval, - sla_margin \\ @default_sla_margin + sla_seconds \\ @default_sla_seconds ) do exits = db_exits |> Enum.map(&ExitInfo.from_db_kv/1) |> Map.new() @@ -134,32 +133,32 @@ defmodule OMG.Watcher.ExitProcessor.Core do in_flight_exits: db_in_flight_exits |> Enum.map(&InFlightExitInfo.from_db_kv/1) |> Map.new(), exit_ids: exit_ids, competitors: db_competitors |> Enum.map(&CompetitorInfo.from_db_kv/1) |> Map.new(), - sla_margin: sla_margin, + sla_seconds: sla_seconds, min_exit_period_seconds: min_exit_period_seconds, child_block_interval: child_block_interval }} end @doc """ - Use to check if the settings regarding the `:exit_processor_sla_margin` config of `:omg_watcher` are OK. + Use to check if the settings regarding the `:exit_processor_sla_seconds` config of `:omg_watcher` are OK. Since there are combinations of our configuration that may lead to a dangerous setup of the Watcher - (in particular - muting the reports of unchallenged_exits), we're enforcing that the `exit_processor_sla_margin` + (in particular - muting the reports of unchallenged_exits), we're enforcing that the `exit_processor_sla_seconds` be not larger than `min_exit_period`. """ - @spec check_sla_margin(pos_integer(), boolean(), pos_integer(), pos_integer()) :: :ok | {:error, :sla_margin_too_big} - def check_sla_margin(sla_margin, sla_margin_forced, min_exit_period_seconds, ethereum_block_time_seconds) + @spec check_sla_seconds(pos_integer(), boolean(), pos_integer()) :: :ok | {:error, :sla_margin_too_big} + def check_sla_seconds(sla_seconds, sla_margin_forced, min_exit_period_seconds) - def check_sla_margin(sla_margin, true, min_exit_period_seconds, ethereum_block_time_seconds) do + def check_sla_seconds(sla_seconds, true, min_exit_period_seconds) do _ = - if !sla_margin_safe?(sla_margin, min_exit_period_seconds, ethereum_block_time_seconds), - do: Logger.warn("Allowing unsafe sla margin of #{sla_margin} blocks") + if !sla_seconds_safe?(sla_seconds, min_exit_period_seconds), + do: Logger.warn("Allowing unsafe sla margin of #{sla_seconds} seconds") :ok end - def check_sla_margin(sla_margin, false, min_exit_period_seconds, ethereum_block_time_seconds) do - if sla_margin_safe?(sla_margin, min_exit_period_seconds, ethereum_block_time_seconds), + def check_sla_seconds(sla_seconds, false, min_exit_period_seconds) do + if sla_seconds_safe?(sla_seconds, min_exit_period_seconds), do: :ok, else: {:error, :sla_margin_too_big} end @@ -460,17 +459,16 @@ defmodule OMG.Watcher.ExitProcessor.Core do @spec check_validity(ExitProcessor.Request.t(), t()) :: check_validity_result_t() def check_validity( %ExitProcessor.Request{ - eth_height_now: eth_height_now, + eth_timestamp_now: eth_timestamp_now, utxos_to_check: utxos_to_check, utxo_exists_result: utxo_exists_result, blocks_result: blocks }, %__MODULE__{} = state - ) - when not is_nil(eth_height_now) do + ) do utxo_exists? = Enum.zip(utxos_to_check, utxo_exists_result) |> Map.new() - {invalid_exits, late_invalid_exits} = StandardExit.get_invalid(state, utxo_exists?, eth_height_now) + {invalid_exits, late_invalid_exits} = StandardExit.get_invalid(state, utxo_exists?, eth_timestamp_now) invalid_exit_events = invalid_exits @@ -483,12 +481,12 @@ defmodule OMG.Watcher.ExitProcessor.Core do known_txs_by_input = KnownTx.get_all_from_blocks_appendix(blocks, state) {non_canonical_ife_events, late_non_canonical_ife_events} = - ExitProcessor.Canonicity.get_ife_txs_with_competitors(state, known_txs_by_input, eth_height_now) + ExitProcessor.Canonicity.get_ife_txs_with_competitors(state, known_txs_by_input, eth_timestamp_now) invalid_ife_challenges_events = ExitProcessor.Canonicity.get_invalid_ife_challenges(state) {invalid_piggybacks_events, late_invalid_piggybacks_events} = - ExitProcessor.Piggyback.get_invalid_piggybacks_events(state, known_txs_by_input, eth_height_now) + ExitProcessor.Piggyback.get_invalid_piggybacks_events(state, known_txs_by_input, eth_timestamp_now) available_piggybacks_events = state @@ -627,6 +625,7 @@ defmodule OMG.Watcher.ExitProcessor.Core do address != @zero_address end - defp sla_margin_safe?(exit_processor_sla_margin, min_exit_period_seconds, ethereum_block_time_seconds), - do: exit_processor_sla_margin * ethereum_block_time_seconds < min_exit_period_seconds + defp sla_seconds_safe?(exit_processor_sla_seconds, min_exit_period_seconds) do + exit_processor_sla_seconds < min_exit_period_seconds + end end diff --git a/apps/omg_watcher/lib/omg_watcher/exit_processor/piggyback.ex b/apps/omg_watcher/lib/omg_watcher/exit_processor/piggyback.ex index ed16c2ece1..3b30112c2c 100644 --- a/apps/omg_watcher/lib/omg_watcher/exit_processor/piggyback.ex +++ b/apps/omg_watcher/lib/omg_watcher/exit_processor/piggyback.ex @@ -87,15 +87,15 @@ defmodule OMG.Watcher.ExitProcessor.Piggyback do end @doc """ - Returns a tuple of ivalid piggybacks and invalid piggybacks that are past SLA margin. - This is inclusive, invalid piggybacks past SLA margin are included in the invalid piggybacks list. + Returns a tuple of ivalid piggybacks and invalid piggybacks that are past SLA seconds. + This is inclusive, invalid piggybacks past SLA seconds are included in the invalid piggybacks list. """ @spec get_invalid_piggybacks_events(Core.t(), KnownTx.known_txs_by_input_t(), pos_integer()) :: {list(Event.InvalidPiggyback.t()), list(Event.UnchallengedPiggyback.t())} def get_invalid_piggybacks_events( - %Core{sla_margin: sla_margin, in_flight_exits: ifes}, + %Core{sla_seconds: sla_seconds, in_flight_exits: ifes}, known_txs_by_input, - eth_height_now + eth_timestamp_now ) do invalid_piggybacks_by_ife = ifes @@ -104,13 +104,13 @@ defmodule OMG.Watcher.ExitProcessor.Piggyback do invalid_piggybacks_events = to_events(invalid_piggybacks_by_ife, &to_invalid_piggyback_event/1) - past_sla_margin = fn {ife, _type, _materials} -> - ife.eth_height + sla_margin <= eth_height_now + past_sla_seconds = fn {ife, _type, _materials} -> + ife.timestamp + sla_seconds <= eth_timestamp_now end unchallenged_piggybacks_events = invalid_piggybacks_by_ife - |> Enum.filter(past_sla_margin) + |> Enum.filter(past_sla_seconds) |> to_events(&to_unchallenged_piggyback_event/1) {invalid_piggybacks_events, unchallenged_piggybacks_events} diff --git a/apps/omg_watcher/lib/omg_watcher/exit_processor/request.ex b/apps/omg_watcher/lib/omg_watcher/exit_processor/request.ex index 9c9c07f603..20d2107833 100644 --- a/apps/omg_watcher/lib/omg_watcher/exit_processor/request.ex +++ b/apps/omg_watcher/lib/omg_watcher/exit_processor/request.ex @@ -23,7 +23,7 @@ defmodule OMG.Watcher.ExitProcessor.Request do alias OMG.Utxo defstruct [ - :eth_height_now, + :eth_timestamp_now, :blknum_now, utxos_to_check: [], spends_to_get: [], @@ -41,7 +41,7 @@ defmodule OMG.Watcher.ExitProcessor.Request do ] @type t :: %__MODULE__{ - eth_height_now: nil | pos_integer, + eth_timestamp_now: nil | pos_integer, blknum_now: nil | pos_integer, utxos_to_check: list(Utxo.Position.t()), spends_to_get: list(Utxo.Position.t()), diff --git a/apps/omg_watcher/lib/omg_watcher/exit_processor/standard_exit.ex b/apps/omg_watcher/lib/omg_watcher/exit_processor/standard_exit.ex index a31176c388..5e23204ec5 100644 --- a/apps/omg_watcher/lib/omg_watcher/exit_processor/standard_exit.ex +++ b/apps/omg_watcher/lib/omg_watcher/exit_processor/standard_exit.ex @@ -67,7 +67,11 @@ defmodule OMG.Watcher.ExitProcessor.StandardExit do """ @spec get_invalid(Core.t(), %{Utxo.Position.t() => boolean}, pos_integer()) :: {%{Utxo.Position.t() => ExitInfo.t()}, %{Utxo.Position.t() => ExitInfo.t()}} - def get_invalid(%Core{sla_margin: sla_margin} = state, utxo_exists?, eth_height_now) do + def get_invalid( + state, + utxo_exists?, + eth_timestamp_now + ) do active_exits = active_exits(state) exits_invalid_by_ife = @@ -93,8 +97,8 @@ defmodule OMG.Watcher.ExitProcessor.StandardExit do # get exits which are still invalid and after the SLA margin late_invalid_exits = - Enum.filter(invalid_exits, fn {_, %ExitInfo{eth_height: eth_height}} -> - eth_height + sla_margin <= eth_height_now + Enum.filter(invalid_exits, fn {_, %ExitInfo{block_timestamp: block_timestamp}} -> + block_timestamp + state.sla_seconds <= eth_timestamp_now end) {Map.new(invalid_exits), Map.new(late_invalid_exits)} diff --git a/apps/omg_watcher/lib/omg_watcher/release_tasks/set_exit_processor_sla_margin.ex b/apps/omg_watcher/lib/omg_watcher/release_tasks/set_exit_processor_sla_margin.ex index a0c32ca97d..5e3cda1a13 100644 --- a/apps/omg_watcher/lib/omg_watcher/release_tasks/set_exit_processor_sla_margin.ex +++ b/apps/omg_watcher/lib/omg_watcher/release_tasks/set_exit_processor_sla_margin.ex @@ -18,8 +18,8 @@ defmodule OMG.Watcher.ReleaseTasks.SetExitProcessorSLAMargin do require Logger @app :omg_watcher - @system_env_name_margin "EXIT_PROCESSOR_SLA_MARGIN" - @app_env_name_margin :exit_processor_sla_margin + @system_env_name "EXIT_PROCESSOR_SLA_SECONDS" + @app_env_name :exit_processor_sla_seconds @system_env_name_force "EXIT_PROCESSOR_SLA_MARGIN_FORCED" @app_env_name_force :exit_processor_sla_margin_forced @@ -33,15 +33,15 @@ defmodule OMG.Watcher.ReleaseTasks.SetExitProcessorSLAMargin do Config.Reader.merge(config, omg_watcher: [ - exit_processor_sla_margin: get_exit_processor_sla_margin(), + exit_processor_sla_seconds: get_exit_processor_sla_seconds(), exit_processor_sla_margin_forced: get_exit_processor_sla_forced() ] ) end - defp get_exit_processor_sla_margin() do - config_value = validate_int(get_env(@system_env_name_margin), Application.get_env(@app, @app_env_name_margin)) - _ = Logger.info("CONFIGURATION: App: #{@app} Key: #{@system_env_name_margin} Value: #{inspect(config_value)}.") + defp get_exit_processor_sla_seconds() do + config_value = validate_int(get_env(@system_env_name), Application.get_env(@app, @app_env_name)) + _ = Logger.info("CONFIGURATION: App: #{@app} Key: #{@system_env_name} Value: #{inspect(config_value)}.") config_value end @@ -66,7 +66,7 @@ defmodule OMG.Watcher.ReleaseTasks.SetExitProcessorSLAMargin do defp to_int(value) do case Integer.parse(value) do {result, ""} -> result - _ -> exit("#{@system_env_name_margin} must be an integer.") + _ -> exit("#{@system_env_name} must be an integer.") end end end diff --git a/apps/omg_watcher/lib/omg_watcher/sync_supervisor.ex b/apps/omg_watcher/lib/omg_watcher/sync_supervisor.ex index 5920227b63..ba3a4c298c 100644 --- a/apps/omg_watcher/lib/omg_watcher/sync_supervisor.ex +++ b/apps/omg_watcher/lib/omg_watcher/sync_supervisor.ex @@ -69,7 +69,7 @@ defmodule OMG.Watcher.SyncSupervisor do defp children(args) do contract_deployment_height = Keyword.fetch!(args, :contract_deployment_height) - exit_processor_sla_margin = Configuration.exit_processor_sla_margin() + exit_processor_sla_seconds = Configuration.exit_processor_sla_seconds() exit_processor_sla_margin_forced = Configuration.exit_processor_sla_margin_forced() metrics_collection_interval = Configuration.metrics_collection_interval() finality_margin = Configuration.exit_finality_margin() @@ -77,7 +77,6 @@ defmodule OMG.Watcher.SyncSupervisor do ethereum_events_check_interval_ms = OMG.Configuration.ethereum_events_check_interval_ms() coordinator_eth_height_check_interval_ms = OMG.Configuration.coordinator_eth_height_check_interval_ms() min_exit_period_seconds = OMG.Eth.Configuration.min_exit_period_seconds() - ethereum_block_time_seconds = OMG.Eth.Configuration.ethereum_block_time_seconds() child_block_interval = OMG.Eth.Configuration.child_block_interval() contracts = OMG.Eth.Configuration.contracts() @@ -91,11 +90,10 @@ defmodule OMG.Watcher.SyncSupervisor do )}, {ExitProcessor, [ - exit_processor_sla_margin: exit_processor_sla_margin, + exit_processor_sla_seconds: exit_processor_sla_seconds, exit_processor_sla_margin_forced: exit_processor_sla_margin_forced, metrics_collection_interval: metrics_collection_interval, min_exit_period_seconds: min_exit_period_seconds, - ethereum_block_time_seconds: ethereum_block_time_seconds, child_block_interval: child_block_interval ]}, %{ diff --git a/apps/omg_watcher/test/omg_watcher/exit_processor/canonicity_test.exs b/apps/omg_watcher/test/omg_watcher/exit_processor/canonicity_test.exs index 117ac5d05b..d5b1e19d32 100644 --- a/apps/omg_watcher/test/omg_watcher/exit_processor/canonicity_test.exs +++ b/apps/omg_watcher/test/omg_watcher/exit_processor/canonicity_test.exs @@ -48,7 +48,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do test "none if input never spent elsewhere", %{processor_filled: processor} do assert {:ok, []} = - %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5} |> check_validity_filtered(processor, exclude: [Event.PiggybackAvailable]) end @@ -58,11 +58,11 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do processor = processor |> start_ife_from(comp) assert {:ok, []} = - %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5} |> check_validity_filtered(processor, exclude: [Event.PiggybackAvailable]) assert {:error, :competitor_not_found} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.get_competitor_for_ife(processor, txbytes) end @@ -72,7 +72,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do exit_processor_request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp], 3000)] } @@ -88,7 +88,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do exit_processor_request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([tx1], 3000)] } @@ -106,11 +106,11 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do processor = processor |> start_ife_from(tx) assert {:ok, []} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> check_validity_filtered(processor, exclude: [Event.PiggybackAvailable]) assert {:error, :competitor_not_found} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.get_competitor_for_ife(processor, txbytes) end @@ -121,7 +121,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do processor = processor |> start_ife_from(comp) assert {:ok, events} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> check_validity_filtered(processor, only: [Event.NonCanonicalIFE]) assert_events(events, [%Event.NonCanonicalIFE{txbytes: txbytes}, %Event.NonCanonicalIFE{txbytes: comp_txbytes}]) @@ -136,7 +136,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do competing_tx_pos: Utxo.position(0, 0, 0), competing_proof: "" }} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.get_competitor_for_ife(processor, txbytes) end @@ -150,7 +150,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do challenge_event = ife_challenge(tx2, comp) {processor, _} = Core.new_ife_challenges(processor, [challenge_event]) - exit_processor_request = %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + exit_processor_request = %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} assert {:ok, [%Event.NonCanonicalIFE{txbytes: ^txbytes}]} = exit_processor_request |> check_validity_filtered(processor, only: [Event.NonCanonicalIFE]) @@ -173,7 +173,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do exit_processor_request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp], other_blknum)] } @@ -205,7 +205,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp, comp], other_blknum)], ife_input_spending_blocks_result: [Block.hashed_txs_at([comp, comp], other_blknum)] } @@ -249,7 +249,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do comp1 = TestHelper.create_recovered([{1, 0, 0, alice}], [{alice, @eth, 1}]) comp2 = TestHelper.create_recovered([{1, 0, 0, alice}], [{alice, @eth, 2}]) txbytes = txbytes(tx1) - request = %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} processor = processor |> start_ife_from(comp1) |> start_ife_from(comp2) # before any challenge @@ -272,7 +272,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx1], other_blknum)] } @@ -292,7 +292,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([tx1, comp], other_blknum)], ife_input_spending_blocks_result: [Block.hashed_txs_at([tx1, comp], other_blknum)] } @@ -310,7 +310,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp, tx1], other_blknum)], ife_input_spending_blocks_result: [Block.hashed_txs_at([comp, tx1], other_blknum)] } @@ -330,7 +330,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5 + processor.sla_margin, + eth_timestamp_now: 5 + processor.sla_seconds, blocks_result: [Block.hashed_txs_at([comp, tx1], other_blknum)], ife_input_spending_blocks_result: [Block.hashed_txs_at([comp, tx1], other_blknum)] } @@ -349,7 +349,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [block1, block2], # note the flipped order here, all still works as the blocks should be processed starting from oldest ife_input_spending_blocks_result: [block2, block1] @@ -370,7 +370,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp], other_blknum)] } @@ -420,7 +420,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do exit_processor_request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([other_recovered], 3000)] } @@ -448,7 +448,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do exit_processor_request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp], 3000)] } @@ -471,7 +471,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do exit_processor_request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([recovered_oldest], 2000), Block.hashed_txs_at([recovered_recent], 3000)] } @@ -552,7 +552,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do txbytes = txbytes(tx) processor = processor |> start_ife_from(comp) - request = %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5} assert {:ok, %{input_tx: "input_tx", input_utxo_pos: Utxo.position(1, 0, 0)}} = Core.get_competitor_for_ife(request, processor, txbytes) @@ -568,7 +568,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do test "none if input not yet created during sync", %{processor_filled: processor} do assert %{utxos_to_check: to_check} = - %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 13} + %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 13} |> Core.determine_utxo_existence_to_get(processor) assert Utxo.position(9000, 0, 1) not in to_check @@ -579,14 +579,14 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do txbytes = Transaction.raw_txbytes(tx) assert {:error, :ife_not_known_for_tx} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.get_competitor_for_ife(processor, txbytes) end test "for malformed input txbytes doesn't crash", %{processor_empty: processor} do assert {:error, :malformed_transaction} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.get_competitor_for_ife(processor, <<0>>) end end @@ -600,7 +600,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at(txs, other_blknum)] } @@ -621,20 +621,20 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do test "proving canonical for nonexistent tx doesn't crash", %{processor_empty: processor, transactions: [tx | _]} do txbytes = Transaction.raw_txbytes(tx) - request = %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} processor = processor |> Core.find_ifes_in_blocks(request) assert {:error, :ife_not_known_for_tx} = Core.prove_canonical_for_ife(processor, txbytes) end test "for malformed input txbytes doesn't crash", %{processor_empty: processor} do - request = %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} processor = processor |> Core.find_ifes_in_blocks(request) assert {:error, :malformed_transaction} = Core.prove_canonical_for_ife(processor, <<0>>) end test "none if ifes are fresh and canonical by default", %{processor_filled: processor} do assert {:ok, []} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> check_validity_filtered(processor, exclude: [Event.PiggybackAvailable]) end @@ -650,7 +650,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at(txs, other_blknum)] } @@ -667,7 +667,7 @@ defmodule OMG.Watcher.ExitProcessor.CanonicityTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, # NOTE: `tx` is included twice ife_input_spending_blocks_result: [Block.hashed_txs_at([tx, tx], other_blknum)] } diff --git a/apps/omg_watcher/test/omg_watcher/exit_processor/core/state_interaction_test.exs b/apps/omg_watcher/test/omg_watcher/exit_processor/core/state_interaction_test.exs index 2eb35b4dec..845cc6e0c6 100644 --- a/apps/omg_watcher/test/omg_watcher/exit_processor/core/state_interaction_test.exs +++ b/apps/omg_watcher/test/omg_watcher/exit_processor/core/state_interaction_test.exs @@ -74,7 +74,7 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do processor = start_se_from(processor, standard_exit_tx, @utxo_pos1) assert {:ok, [%Event.InvalidExit{utxo_pos: ^exiting_position}]} = - %ExitProcessor.Request{eth_height_now: 5, blknum_now: @late_blknum} + %ExitProcessor.Request{eth_timestamp_now: 5, blknum_now: @late_blknum} |> Core.determine_utxo_existence_to_get(processor) |> mock_utxo_exists(state) |> Core.check_validity(processor) @@ -86,7 +86,7 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do processor = start_se_from(processor, standard_exit_tx, Utxo.position(@late_blknum, 0, 0)) assert {:ok, []} = - %ExitProcessor.Request{eth_height_now: 13, blknum_now: @early_blknum} + %ExitProcessor.Request{eth_timestamp_now: 13, blknum_now: @early_blknum} |> Core.determine_utxo_existence_to_get(processor) |> mock_utxo_exists(state) |> Core.check_validity(processor) @@ -100,7 +100,7 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do processor = processor |> start_se_from(standard_exit_tx1, @utxo_pos1, exit_id: 1) - |> start_se_from(standard_exit_tx2, @utxo_pos2, eth_height: 4, exit_id: 2) + |> start_se_from(standard_exit_tx2, @utxo_pos2, block_timestamp: 4, exit_id: 2) # exits invalidly finalize and continue/start emitting events and complain {:ok, {_, two_spend}, state_after_spend} = @@ -112,7 +112,7 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do assert {processor, _} = Core.finalize_exits(processor, two_spend) assert {{:error, :unchallenged_exit}, [_event1, _event2, _event3]} = - %ExitProcessor.Request{eth_height_now: 12, blknum_now: @late_blknum} + %ExitProcessor.Request{eth_timestamp_now: 12, blknum_now: @late_blknum} |> Core.determine_utxo_existence_to_get(processor) |> mock_utxo_exists(state_after_spend) |> Core.check_validity(processor) @@ -126,14 +126,14 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do processor = start_se_from(processor, standard_exit_tx, @utxo_pos1) assert {:ok, []} = - %ExitProcessor.Request{eth_height_now: 5, blknum_now: @late_blknum} + %ExitProcessor.Request{eth_timestamp_now: 5, blknum_now: @late_blknum} |> Core.determine_utxo_existence_to_get(processor) |> mock_utxo_exists(state) |> Core.check_validity(processor) # go into the future - old exits work the same assert {:ok, []} = - %ExitProcessor.Request{eth_height_now: 105, blknum_now: @late_blknum} + %ExitProcessor.Request{eth_timestamp_now: 105, blknum_now: @late_blknum} |> Core.determine_utxo_existence_to_get(processor) |> mock_utxo_exists(state) |> Core.check_validity(processor) @@ -197,7 +197,7 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do {:ok, {block, _}, state} = State.Core.form_block(state) - request = %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5, ife_input_spending_blocks_result: [block]} + request = %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5, ife_input_spending_blocks_result: [block]} processor = processor @@ -235,7 +235,7 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do ife_id = 1 # ife tx cannot be found in blocks, hence `ife_input_spending_blocks_result: []` - request = %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5, ife_input_spending_blocks_result: []} + request = %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5, ife_input_spending_blocks_result: []} processor = processor @@ -268,7 +268,7 @@ defmodule OMG.Watcher.ExitProcessor.Core.StateInteractionTest do {:ok, {_, _, _}, state} = State.Core.exec(state, spending_tx, @fee) {:ok, {block, _}, state} = State.Core.form_block(state) - request = %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5, ife_input_spending_blocks_result: [block]} + request = %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5, ife_input_spending_blocks_result: [block]} processor = processor diff --git a/apps/omg_watcher/test/omg_watcher/exit_processor/core_test.exs b/apps/omg_watcher/test/omg_watcher/exit_processor/core_test.exs index 0760b3ccf2..f3429e2485 100644 --- a/apps/omg_watcher/test/omg_watcher/exit_processor/core_test.exs +++ b/apps/omg_watcher/test/omg_watcher/exit_processor/core_test.exs @@ -116,15 +116,15 @@ defmodule OMG.Watcher.ExitProcessor.CoreTest do end end - describe "check_sla_margin/4" do + describe "check_sla_margin/3" do test "allows only safe margins if not forcing" do - assert {:error, :sla_margin_too_big} = Core.check_sla_margin(10, false, 100, 15) - assert :ok = Core.check_sla_margin(10, false, 300, 15) + assert {:error, :sla_margin_too_big} = Core.check_sla_seconds(150, false, 100) + assert :ok = Core.check_sla_seconds(150, false, 300) end test "allows anything if forcing" do - capture_log(fn -> assert :ok = Core.check_sla_margin(10, true, 100, 15) end) - assert :ok = Core.check_sla_margin(10, true, 300, 15) + capture_log(fn -> assert :ok = Core.check_sla_seconds(150, true, 100) end) + assert :ok = Core.check_sla_seconds(150, true, 300) end end @@ -204,7 +204,7 @@ defmodule OMG.Watcher.ExitProcessor.CoreTest do describe "finding IFE txs in blocks" do test "handles well situation when syncing is in progress", %{processor_filled: state} do assert %ExitProcessor.Request{utxos_to_check: [], ife_input_utxos_to_check: []} = - %ExitProcessor.Request{eth_height_now: 13, blknum_now: 0} + %ExitProcessor.Request{eth_timestamp_now: 13, blknum_now: 0} |> Core.determine_ife_input_utxos_existence_to_get(state) |> Core.determine_utxo_existence_to_get(state) end @@ -212,7 +212,7 @@ defmodule OMG.Watcher.ExitProcessor.CoreTest do test "seeks all IFE txs' inputs spends in blocks", %{processor_filled: processor, transactions: txs} do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5 + eth_timestamp_now: 5 } # for one piggybacked output, we're asking for its inputs positions to check utxo existence @@ -237,7 +237,7 @@ defmodule OMG.Watcher.ExitProcessor.CoreTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5 + eth_timestamp_now: 5 } # for one piggybacked output, we're asking for its inputs positions to check utxo existence @@ -251,7 +251,7 @@ defmodule OMG.Watcher.ExitProcessor.CoreTest do %{processor_filled: processor, transactions: [tx1, tx2]} do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx1], 3000)] } diff --git a/apps/omg_watcher/test/omg_watcher/exit_processor/finalizations_test.exs b/apps/omg_watcher/test/omg_watcher/exit_processor/finalizations_test.exs index 28beb9de98..fbb4ece208 100644 --- a/apps/omg_watcher/test/omg_watcher/exit_processor/finalizations_test.exs +++ b/apps/omg_watcher/test/omg_watcher/exit_processor/finalizations_test.exs @@ -51,7 +51,7 @@ defmodule OMG.Watcher.ExitProcessor.FinalizationsTest do # both IFE txs are inlcuded in one of the blocks and picked up by the `ExitProcessor` request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx1], tx1_blknum)] } @@ -88,7 +88,7 @@ defmodule OMG.Watcher.ExitProcessor.FinalizationsTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [] } @@ -121,7 +121,7 @@ defmodule OMG.Watcher.ExitProcessor.FinalizationsTest do # both IFE txs are inlcuded in one of the blocks and picked up by the `ExitProcessor` request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx1, tx2], tx2_blknum)] } diff --git a/apps/omg_watcher/test/omg_watcher/exit_processor/piggyback_test.exs b/apps/omg_watcher/test/omg_watcher/exit_processor/piggyback_test.exs index 1d9432ef59..d0710c69e4 100644 --- a/apps/omg_watcher/test/omg_watcher/exit_processor/piggyback_test.exs +++ b/apps/omg_watcher/test/omg_watcher/exit_processor/piggyback_test.exs @@ -108,7 +108,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do txbytes_2 = Transaction.raw_txbytes(tx2) assert {:ok, events} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.check_validity(processor) assert_events(events, [ @@ -133,7 +133,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do processor = processor |> start_ife_from(tx) assert {:ok, [%Event.PiggybackAvailable{txbytes: ^txbytes}]} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.check_validity(processor) end @@ -148,7 +148,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do processor = processor |> start_ife_from(signed_tx, sigs: sigs) assert {:ok, [%Event.PiggybackAvailable{txbytes: ^txbytes}]} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> Core.check_validity(processor) end @@ -158,7 +158,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx1], 3000)] } @@ -183,7 +183,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do txbytes: ^txbytes } ]} = - check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5}, processor, + check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5}, processor, only: [Event.PiggybackAvailable] ) end @@ -201,7 +201,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do available_outputs: [%{index: 0}] } ]} = - check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5}, processor, + check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5}, processor, only: [Event.PiggybackAvailable] ) end @@ -219,7 +219,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do available_outputs: [] } ]} = - check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5}, processor, + check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5}, processor, only: [Event.PiggybackAvailable] ) end @@ -242,7 +242,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do available_outputs: [] } ]} = - check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5}, processor, + check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5}, processor, only: [Event.PiggybackAvailable] ) end @@ -256,7 +256,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do {:ok, processor, _} = Core.finalize_in_flight_exits(processor, [finalization], %{}) assert {:ok, []} = - check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5}, processor, + check_validity_filtered(%ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5}, processor, only: [Event.PiggybackAvailable] ) end @@ -264,12 +264,12 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do test "challenged IFEs emit the same piggybacks as canonical ones", %{processor_filled: processor, transactions: [tx | _], competing_tx: comp} do assert {:ok, events_canonical} = - Core.check_validity(%ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5}, processor) + Core.check_validity(%ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5}, processor) {challenged_processor, _} = Core.new_ife_challenges(processor, [ife_challenge(tx, comp)]) assert {:ok, events_challenged} = - Core.check_validity(%ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5}, challenged_processor) + Core.check_validity(%ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5}, challenged_processor) assert_events(events_canonical, events_challenged) end @@ -281,7 +281,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do processor = processor |> start_ife_from(comp) assert {:ok, []} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> check_validity_filtered(processor, only: [Event.InvalidPiggyback]) end @@ -294,7 +294,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)] } @@ -302,7 +302,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do processor = processor |> start_ife_from(comp) |> Core.find_ifes_in_blocks(request) assert {:ok, []} = - %ExitProcessor.Request{blknum_now: 5000, eth_height_now: 5} + %ExitProcessor.Request{blknum_now: 5000, eth_timestamp_now: 5} |> check_validity_filtered(processor, only: [Event.InvalidPiggyback]) end @@ -311,7 +311,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do txbytes = txbytes(tx) {comp_txbytes, other_sig} = {txbytes(comp), sig(comp, 1)} state = state |> start_ife_from(comp) |> piggyback_ife_from(ife_id, 0, :input) - request = %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5} assert {:ok, [%Event.InvalidPiggyback{txbytes: ^txbytes, inputs: [0], outputs: []}]} = check_validity_filtered(request, state, only: [Event.InvalidPiggyback]) @@ -341,7 +341,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do %{} ) - request = %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5} assert {:ok, [%Event.InvalidPiggyback{txbytes: ^txbytes, inputs: [0], outputs: []}]} = check_validity_filtered(request, state, only: [Event.InvalidPiggyback]) @@ -357,7 +357,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do |> piggyback_ife_from(tx_hash, 0, :input) |> Core.challenge_piggybacks([%{tx_hash: tx_hash, output_index: 0, omg_data: %{piggyback_type: :input}}]) - request = %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5} assert {:ok, []} = check_validity_filtered(request, state, only: [Event.InvalidPiggyback]) @@ -374,7 +374,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp], comp_blknum)] } @@ -405,7 +405,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)] } @@ -440,7 +440,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5 + state.sla_margin, + eth_timestamp_now: 5 + state.sla_seconds, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)] } @@ -465,7 +465,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)] } @@ -492,7 +492,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)] } @@ -524,7 +524,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)], blocks_result: [Block.hashed_txs_at([comp], comp_blknum)] } @@ -560,7 +560,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)], blocks_result: [Block.hashed_txs_at([comp], comp_blknum)] } @@ -595,7 +595,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)], blocks_result: [Block.hashed_txs_at([comp], comp_blknum)] } @@ -631,7 +631,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([other_tx, tx], tx_blknum)], blocks_result: [Block.hashed_txs_at([comp], comp_blknum)] } @@ -659,7 +659,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do # NOTE: the piggybacked index is the second one, compared to the invalid piggyback situation request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [Block.hashed_txs_at([comp], 4000)] } @@ -678,7 +678,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)], blocks_result: [Block.hashed_txs_at([comp], 4000)] } @@ -692,7 +692,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do %{processor_filled: state, transactions: [tx | _], ife_tx_hashes: [ife_id | _]} do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], 3000)] } @@ -719,7 +719,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do request = %ExitProcessor.Request{ blknum_now: 4000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], tx_blknum)] } @@ -771,7 +771,7 @@ defmodule OMG.Watcher.ExitProcessor.PiggybackTest do txbytes = txbytes(tx) state = state |> start_ife_from(comp) |> piggyback_ife_from(ife_id, 0, :input) - request = %ExitProcessor.Request{blknum_now: 1000, eth_height_now: 5} + request = %ExitProcessor.Request{blknum_now: 1000, eth_timestamp_now: 5} assert {:ok, %{input_tx: "input_tx", input_utxo_pos: Utxo.position(1, 0, 0)}} = Core.get_input_challenge_data(request, state, txbytes, 0) diff --git a/apps/omg_watcher/test/omg_watcher/exit_processor/standard_exit_test.exs b/apps/omg_watcher/test/omg_watcher/exit_processor/standard_exit_test.exs index cc8430b097..65c68db5c9 100644 --- a/apps/omg_watcher/test/omg_watcher/exit_processor/standard_exit_test.exs +++ b/apps/omg_watcher/test/omg_watcher/exit_processor/standard_exit_test.exs @@ -33,7 +33,6 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do only: [start_ife_from: 2, start_se_from: 3, start_se_from: 4, check_validity_filtered: 3] @eth OMG.Eth.zero_address() - @deposit_blknum 1 @deposit_blknum2 2 @early_blknum 1_000 @@ -367,7 +366,7 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do standard_exit_tx = TestHelper.create_recovered([{@blknum, 0, 0, alice}], @eth, [{alice, 10}]) request = %ExitProcessor.Request{ - eth_height_now: 5, + eth_timestamp_now: 5, blknum_now: @late_blknum, utxos_to_check: [exiting_pos], utxo_exists_result: [false] @@ -394,7 +393,7 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do standard_exit_tx = TestHelper.create_recovered([{@blknum, 0, 0, alice}], @eth, [{alice, 10}]) request = %ExitProcessor.Request{ - eth_height_now: 50, + eth_timestamp_now: 50, blknum_now: @late_blknum, utxos_to_check: [exiting_pos], utxo_exists_result: [false] @@ -419,7 +418,7 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do standard_exit_tx = TestHelper.create_recovered([{@deposit_blknum, 0, 0, alice}], @eth, [{alice, 10}]) request = %ExitProcessor.Request{ - eth_height_now: 13, + eth_timestamp_now: 13, blknum_now: @late_blknum, utxos_to_check: [exiting_pos], utxo_exists_result: [false] @@ -437,7 +436,7 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do processor = processor |> start_se_from(standard_exit_tx, exiting_pos) assert %ExitProcessor.Request{utxos_to_check: []} = - %ExitProcessor.Request{eth_height_now: 13, blknum_now: @early_blknum} + %ExitProcessor.Request{eth_timestamp_now: 13, blknum_now: @early_blknum} |> Core.determine_utxo_existence_to_get(processor) end @@ -450,7 +449,9 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do processor = processor |> start_se_from(standard_exit_tx, exiting_pos) |> start_ife_from(tx) assert {:ok, [%Event.InvalidExit{utxo_pos: ^exiting_pos_enc, spending_txhash: ^tx_hash}]} = - check_validity_filtered(%ExitProcessor.Request{eth_height_now: 5, blknum_now: @late_blknum}, processor, + check_validity_filtered( + %ExitProcessor.Request{eth_timestamp_now: 5, blknum_now: @late_blknum}, + processor, only: [Event.InvalidExit] ) end @@ -464,7 +465,7 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do assert %{utxos_to_check: [_, Utxo.position(1, 2, 1), @utxo_pos_tx]} = exit_processor_request = - %ExitProcessor.Request{eth_height_now: 5, blknum_now: @late_blknum} + %ExitProcessor.Request{eth_timestamp_now: 5, blknum_now: @late_blknum} |> Core.determine_utxo_existence_to_get(processor) block_updates = [{:put, :block, %{number: @blknum, hash: <<0::160>>, transactions: [signed_tx_bytes]}}] @@ -492,7 +493,7 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do # doesn't check the challenged SE utxo assert %{utxos_to_check: [_, Utxo.position(1, 2, 1)]} = exit_processor_request = - %ExitProcessor.Request{eth_height_now: 5, blknum_now: @late_blknum} + %ExitProcessor.Request{eth_timestamp_now: 5, blknum_now: @late_blknum} |> Core.determine_utxo_existence_to_get(processor) # doesn't alert on the challenged SE, despite it being a double-spend wrt the IFE @@ -509,7 +510,7 @@ defmodule OMG.Watcher.ExitProcessor.StandardExitTest do assert %{utxos_to_check: [_, Utxo.position(1, 2, 1), @utxo_pos_tx]} = exit_processor_request = - %ExitProcessor.Request{eth_height_now: 5, blknum_now: @late_blknum} + %ExitProcessor.Request{eth_timestamp_now: 5, blknum_now: @late_blknum} |> Core.determine_utxo_existence_to_get(processor) assert {:ok, []} = diff --git a/apps/omg_watcher/test/omg_watcher/integration/block_getter_test.exs b/apps/omg_watcher/test/omg_watcher/integration/block_getter_test.exs index c71fe4072e..60190a3b76 100644 --- a/apps/omg_watcher/test/omg_watcher/integration/block_getter_test.exs +++ b/apps/omg_watcher/test/omg_watcher/integration/block_getter_test.exs @@ -105,7 +105,7 @@ defmodule OMG.Watcher.Integration.BlockGetterTest do end @tag fixtures: [:in_beam_watcher, :stable_alice, :mix_based_child_chain, :token, :stable_alice_deposits, :test_server] - test "transaction which is spending an exiting output before the `sla_margin` causes an invalid_exit event only", + test "transaction which is spending an exiting output before the `sla_seconds` causes an invalid_exit event only", %{stable_alice: alice, stable_alice_deposits: {deposit_blknum, _}, test_server: context} do tx = OMG.TestHelper.create_encoded([{deposit_blknum, 0, 0, alice}], @eth, [{alice, 9}]) %{"blknum" => exit_blknum} = WatcherHelper.submit(tx) @@ -145,14 +145,14 @@ defmodule OMG.Watcher.Integration.BlockGetterTest do # Here we're manually submitting invalid block to the root chain # NOTE: this **must** come after `start_exit` is mined (see just above) but still not later than - # `sla_margin` after exit start, hence the `config/test.exs` entry for the margin is rather high + # `sla_seconds` after exit start, hence the `config/test.exs` entry for the margin is rather high {:ok, _} = Eth.submit_block(bad_block_hash, 2, 1) IntegrationTest.wait_for_byzantine_events([%Event.InvalidExit{}.name], @timeout) end @tag fixtures: [:in_beam_watcher, :stable_alice, :mix_based_child_chain, :token, :stable_alice_deposits, :test_server] - test "transaction which is spending an exiting output after the `sla_margin` causes an unchallenged_exit event", + test "transaction which is spending an exiting output after the `sla_seconds` causes an unchallenged_exit event", %{stable_alice: alice, stable_alice_deposits: {deposit_blknum, _}, test_server: context} do tx = OMG.TestHelper.create_encoded([{deposit_blknum, 0, 0, alice}], @eth, [{alice, 9}]) %{"blknum" => exit_blknum} = WatcherHelper.submit(tx) @@ -181,7 +181,7 @@ defmodule OMG.Watcher.Integration.BlockGetterTest do "utxo_pos" => utxo_pos } = WatcherHelper.get_exit_data(exit_blknum, 0, 0) - {:ok, %{"status" => "0x1", "blockNumber" => eth_height}} = + {:ok, %{"status" => "0x1"}} = RootChainHelper.start_exit( utxo_pos, txbytes, @@ -190,8 +190,9 @@ defmodule OMG.Watcher.Integration.BlockGetterTest do ) |> DevHelper.transact_sync!() - exit_processor_sla_margin = Application.fetch_env!(:omg_watcher, :exit_processor_sla_margin) - DevHelper.wait_for_root_chain_block(eth_height + exit_processor_sla_margin, @timeout) + exit_processor_sla_seconds = Application.fetch_env!(:omg_watcher, :exit_processor_sla_seconds) + exit_processor_sla_ms = exit_processor_sla_seconds * 1000 + Process.sleep(exit_processor_sla_ms) # checking if both machines and humans learn about the byzantine condition assert WatcherHelper.capture_log(fn -> diff --git a/apps/omg_watcher/test/omg_watcher/integration/invalid_exit_test.exs b/apps/omg_watcher/test/omg_watcher/integration/invalid_exit_test.exs index b13e2ee53f..73bed0e066 100644 --- a/apps/omg_watcher/test/omg_watcher/integration/invalid_exit_test.exs +++ b/apps/omg_watcher/test/omg_watcher/integration/invalid_exit_test.exs @@ -20,6 +20,7 @@ defmodule OMG.Watcher.Integration.InvalidExitTest do use Plug.Test alias OMG.Utxo + alias OMG.Watcher.Configuration alias OMG.Watcher.Event alias OMG.Watcher.Integration.TestHelper, as: IntegrationTest alias Support.DevHelper @@ -96,7 +97,7 @@ defmodule OMG.Watcher.Integration.InvalidExitTest do end @tag fixtures: [:in_beam_watcher, :stable_alice, :mix_based_child_chain, :token, :stable_alice_deposits] - test "invalid_exit without a challenge raises unchallenged_exit after sla_margin had passed, can be challenged", + test "invalid_exit without a challenge raises unchallenged_exit after sla_seconds had passed, can be challenged", %{stable_alice: alice, stable_alice_deposits: {deposit_blknum, _}} do %{"blknum" => first_tx_blknum} = OMG.TestHelper.create_encoded([{deposit_blknum, 0, 0, alice}], @eth, [{alice, 9}]) |> WatcherHelper.submit() @@ -109,14 +110,16 @@ defmodule OMG.Watcher.Integration.InvalidExitTest do %{"txbytes" => txbytes, "proof" => proof, "utxo_pos" => tx_utxo_pos} = WatcherHelper.get_exit_data(first_tx_blknum, 0, 0) - {:ok, %{"status" => "0x1", "blockNumber" => eth_height}} = + {:ok, %{"status" => "0x1"}} = RootChainHelper.start_exit(tx_utxo_pos, txbytes, proof, alice.addr) |> DevHelper.transact_sync!() IntegrationTest.wait_for_byzantine_events([%Event.InvalidExit{}.name], @timeout) - exit_processor_sla_margin = Application.fetch_env!(:omg_watcher, :exit_processor_sla_margin) - DevHelper.wait_for_root_chain_block(eth_height + exit_processor_sla_margin, @timeout) + exit_processor_sla_seconds = OMG.Watcher.Configuration.exit_processor_sla_seconds() + exit_processor_sla_ms = exit_processor_sla_seconds * 1000 + # after exit, the event fetch time + waiting for sla_seconds goes beyond the required time + Process.sleep(exit_processor_sla_ms) IntegrationTest.wait_for_byzantine_events([%Event.InvalidExit{}.name, %Event.UnchallengedExit{}.name], @timeout) # after the notification has been received, a challenged is composed and sent, regardless of it being late diff --git a/apps/omg_watcher/test/omg_watcher/release_tasks/set_exit_processor_sla_margin_test.exs b/apps/omg_watcher/test/omg_watcher/release_tasks/set_exit_processor_sla_margin_test.exs index 5c98e76c4d..4ebbcb4557 100644 --- a/apps/omg_watcher/test/omg_watcher/release_tasks/set_exit_processor_sla_margin_test.exs +++ b/apps/omg_watcher/test/omg_watcher/release_tasks/set_exit_processor_sla_margin_test.exs @@ -19,37 +19,37 @@ defmodule OMG.Watcher.ReleaseTasks.SetExitProcessorSLAMarginTest do @app :omg_watcher test "if environment variables get applied in the configuration" do - :ok = System.put_env("EXIT_PROCESSOR_SLA_MARGIN", "15") + :ok = System.put_env("EXIT_PROCESSOR_SLA_SECONDS", "15") :ok = System.put_env("EXIT_PROCESSOR_SLA_MARGIN_FORCED", "TRUE") config = SetExitProcessorSLAMargin.load([], []) - exit_processor_sla_margin = config |> Keyword.fetch!(@app) |> Keyword.fetch!(:exit_processor_sla_margin) + exit_processor_sla_seconds = config |> Keyword.fetch!(@app) |> Keyword.fetch!(:exit_processor_sla_seconds) exit_processor_sla_margin_forced = config |> Keyword.fetch!(@app) |> Keyword.fetch!(:exit_processor_sla_margin_forced) - assert exit_processor_sla_margin == 15 + assert exit_processor_sla_seconds == 15 assert exit_processor_sla_margin_forced == true end test "if default configuration is used when there's no environment variables" do - :ok = System.delete_env("EXIT_PROCESSOR_SLA_MARGIN") + :ok = System.delete_env("EXIT_PROCESSOR_SLA_SECONDS") :ok = System.delete_env("EXIT_PROCESSOR_SLA_MARGIN_FORCED") config = SetExitProcessorSLAMargin.load([], []) - exit_processor_sla_margin = config |> Keyword.fetch!(@app) |> Keyword.fetch!(:exit_processor_sla_margin) + exit_processor_sla_seconds = config |> Keyword.fetch!(@app) |> Keyword.fetch!(:exit_processor_sla_seconds) exit_processor_sla_margin_forced = config |> Keyword.fetch!(@app) |> Keyword.fetch!(:exit_processor_sla_margin_forced) - exit_processor_sla_margin_updated = Application.get_env(@app, :exit_processor_sla_margin) + exit_processor_sla_seconds_updated = Application.get_env(@app, :exit_processor_sla_seconds) exit_processor_sla_margin_forced_updated = Application.get_env(@app, :exit_processor_sla_margin_forced) - assert exit_processor_sla_margin == exit_processor_sla_margin_updated + assert exit_processor_sla_seconds == exit_processor_sla_seconds_updated assert exit_processor_sla_margin_forced == exit_processor_sla_margin_forced_updated end test "if exit is thrown when faulty margin configuration is used" do - :ok = System.put_env("EXIT_PROCESSOR_SLA_MARGIN", "15a") + :ok = System.put_env("EXIT_PROCESSOR_SLA_SECONDS", "15a") catch_exit(SetExitProcessorSLAMargin.load([], [])) - :ok = System.delete_env("EXIT_PROCESSOR_SLA_MARGIN") + :ok = System.delete_env("EXIT_PROCESSOR_SLA_SECONDS") end test "if exit is thrown when faulty margin force configuration is used" do diff --git a/apps/omg_watcher/test/support/exit_processor/case.ex b/apps/omg_watcher/test/support/exit_processor/case.ex index f6605eac08..e0e0d3e141 100644 --- a/apps/omg_watcher/test/support/exit_processor/case.ex +++ b/apps/omg_watcher/test/support/exit_processor/case.ex @@ -85,7 +85,7 @@ defmodule OMG.Watcher.ExitProcessor.Case do defp invalid_piggyback_on_input(state, [tx | _], [ife_id | _], competing_tx) do request = %ExitProcessor.Request{ blknum_now: 4000, - eth_height_now: 5, + eth_timestamp_now: 5, ife_input_spending_blocks_result: [Block.hashed_txs_at([tx], 3000)] } @@ -118,7 +118,7 @@ defmodule OMG.Watcher.ExitProcessor.Case do request = %ExitProcessor.Request{ blknum_now: 5000, - eth_height_now: 5, + eth_timestamp_now: 5, blocks_result: [block], ife_input_spending_blocks_result: [block, Block.hashed_txs_at([comp], comp_blknum)] } diff --git a/apps/omg_watcher/test/support/exit_processor/test_helper.ex b/apps/omg_watcher/test/support/exit_processor/test_helper.ex index 9e3d5ad496..9073b5fb33 100644 --- a/apps/omg_watcher/test/support/exit_processor/test_helper.ex +++ b/apps/omg_watcher/test/support/exit_processor/test_helper.ex @@ -43,7 +43,7 @@ defmodule OMG.Watcher.ExitProcessor.TestHelper do exit_id = Keyword.get(opts, :exit_id, @exit_id) call_data = %{utxo_pos: enc_pos, output_tx: txbytes} root_chain_txhash = <<1::256>> - block_timestamp = :os.system_time(:second) + block_timestamp = Keyword.get(opts, :block_timestamp, 2) scheduled_finalization_time = block_timestamp + 100 event = %{ diff --git a/apps/omg_watcher_rpc/priv/swagger/info_api_specs.yaml b/apps/omg_watcher_rpc/priv/swagger/info_api_specs.yaml index cd0960add9..ae19b18f1e 100644 --- a/apps/omg_watcher_rpc/priv/swagger/info_api_specs.yaml +++ b/apps/omg_watcher_rpc/priv/swagger/info_api_specs.yaml @@ -234,7 +234,7 @@ paths: format: int256 contract_semver: type: string - exit_processor_sla_margin: + exit_processor_sla_seconds: type: integer format: int256 network: @@ -243,7 +243,7 @@ paths: data: - deposit_finality_margin: 10 contract_semver: 1.0.0.1+a1s29s8 - exit_processor_sla_margin: 5520 + exit_processor_sla_seconds: 5520 network: RINKEBY '500': description: Returns an internal server error diff --git a/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/configuration_schema.yml b/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/configuration_schema.yml index a58c232b09..702aa3ed0e 100644 --- a/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/configuration_schema.yml +++ b/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/configuration_schema.yml @@ -7,6 +7,6 @@ components: type: string network: type: string - exit_processor_sla_margin: + exit_processor_sla_seconds: type: integer format: int256 \ No newline at end of file diff --git a/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/response_schemas.yaml b/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/response_schemas.yaml index ae84108a80..ab5ebc3a01 100644 --- a/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/response_schemas.yaml +++ b/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/response_schemas.yaml @@ -12,5 +12,5 @@ ConfigurationResponseSchema: - deposit_finality_margin: 10 contract_semver: "1.0.0.1+a1s29s8" - exit_processor_sla_margin: 5520 + exit_processor_sla_seconds: 82800 network: "RINKEBY" diff --git a/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/schemas.yaml b/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/schemas.yaml index 62d50a372e..eaf6b21566 100644 --- a/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/schemas.yaml +++ b/apps/omg_watcher_rpc/priv/swagger/info_api_specs/configuration/schemas.yaml @@ -7,7 +7,7 @@ ConfigurationSchema: contract_semver: type: string - exit_processor_sla_margin: + exit_processor_sla_seconds: type: integer format: int256 network: diff --git a/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs.yaml b/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs.yaml index f10e7e17bc..fe2b3d6061 100644 --- a/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs.yaml +++ b/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs.yaml @@ -233,7 +233,7 @@ paths: format: int256 contract_semver: type: string - exit_processor_sla_margin: + exit_processor_sla_seconds: type: integer format: int256 network: diff --git a/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/configuration_schema.yml b/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/configuration_schema.yml index be4e0508ce..bf1419fe75 100644 --- a/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/configuration_schema.yml +++ b/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/configuration_schema.yml @@ -4,7 +4,7 @@ components: type: integer contract_semver: type: string - exit_processor_sla_margin: + exit_processor_sla_seconds: type: integer network: type: string diff --git a/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/schemas.yaml b/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/schemas.yaml index 62d50a372e..eaf6b21566 100644 --- a/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/schemas.yaml +++ b/apps/omg_watcher_rpc/priv/swagger/security_critical_api_specs/configuration/schemas.yaml @@ -7,7 +7,7 @@ ConfigurationSchema: contract_semver: type: string - exit_processor_sla_margin: + exit_processor_sla_seconds: type: integer format: int256 network: diff --git a/bin/variables b/bin/variables index 5e23c036c5..15ab0e4aba 100755 --- a/bin/variables +++ b/bin/variables @@ -10,7 +10,7 @@ export CHILD_CHAIN_URL=http://127.0.0.1:9656 export ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800 export ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800 export ETHEREUM_STALLED_SYNC_THRESHOLD_MS=20000 -export EXIT_PROCESSOR_SLA_MARGIN=5520 +export EXIT_PROCESSOR_SLA_SECONDS=5520 export FEE_CLAIMER_ADDRESS=0x3b9f4c1dd26e0be593373b1d36cee2008cbeb837 export FEE_ADAPTER=file export FEE_SPECS_FILE_PATH=./priv/dev-artifacts/fee_specs.dev.json diff --git a/bin/variables_test_barebone b/bin/variables_test_barebone index 25c1392a5f..efa27d913b 100755 --- a/bin/variables_test_barebone +++ b/bin/variables_test_barebone @@ -4,7 +4,7 @@ # setup of our services # test_barebone_release taylored values. Compare also with priv/cabbage/docker-compose-cabbage.yml -export EXIT_PROCESSOR_SLA_MARGIN=30 +export EXIT_PROCESSOR_SLA_SECONDS=30 # the rest stays same as bin/variables export APP_ENV=local-development @@ -18,6 +18,7 @@ export CHILD_CHAIN_URL=http://127.0.0.1:9656 export ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800 export ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800 export ETHEREUM_STALLED_SYNC_THRESHOLD_MS=20000 +export ETHEREUM_BLOCK_TIME_SECONDS=1 export FEE_CLAIMER_ADDRESS=0x3b9f4c1dd26e0be593373b1d36cee2008cbeb837 export FEE_ADAPTER=file # Fee specs file path needs to be an absolute path as the childchain will start deep in the _build subdirectory diff --git a/config/config.exs b/config/config.exs index 28a1e85c1f..fe317dba12 100644 --- a/config/config.exs +++ b/config/config.exs @@ -154,9 +154,9 @@ config :os_mon, config :omg_watcher, child_chain_url: "http://localhost:9656" config :omg_watcher, - # 23 hours worth of blocks - this is how long the child chain server has to block spends from exiting utxos - exit_processor_sla_margin: 23 * 60 * 4, - # this means we don't want the `sla_margin` above be larger than the `min_exit_period` + # 23 hours - this is how long the child chain server has to block spends from exiting utxos + exit_processor_sla_seconds: 23 * 60 * 60, + # this means we don't want the `sla_seconds` above be larger than the `min_exit_period` exit_processor_sla_margin_forced: false, maximum_block_withholding_time_ms: 15 * 60 * 60 * 1000, maximum_number_of_unapplied_blocks: 50, diff --git a/config/dev.exs b/config/dev.exs index 081fb5e2c4..69f929b220 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -44,9 +44,9 @@ config :omg_watcher_info, OMG.WatcherInfo.Tracer, config :omg_watcher, environment: :dev config :omg_watcher, - # 1 hour of Ethereum blocks - exit_processor_sla_margin: 60 * 4, - # this means we allow the `sla_margin` above be larger than the `min_exit_period` + # 1 hour + exit_processor_sla_seconds: 60 * 60, + # this means we allow the `sla_seconds` above be larger than the `min_exit_period` exit_processor_sla_margin_forced: true config :omg_watcher, OMG.Watcher.Tracer, diff --git a/config/test.exs b/config/test.exs index a5ce57d19b..9b93bf1b8b 100644 --- a/config/test.exs +++ b/config/test.exs @@ -135,7 +135,7 @@ config :omg_watcher, child_chain_url: "http://localhost:9657" config :omg_watcher, # NOTE `exit_processor_sla_margin` can't be made shorter. At 8 it sometimes # causes unchallenged exits events because `geth --dev` is too fast - exit_processor_sla_margin: 10, + exit_processor_sla_seconds: 10, # this means we allow the `sla_margin` above be larger than the `min_exit_period` exit_processor_sla_margin_forced: true, # NOTE: `maximum_block_withholding_time_ms` must be here - one of our integration tests diff --git a/docker-compose-watcher.yml b/docker-compose-watcher.yml index 0041417a0a..21d333f72a 100644 --- a/docker-compose-watcher.yml +++ b/docker-compose-watcher.yml @@ -36,7 +36,7 @@ services: - ETHEREUM_EVENTS_CHECK_INTERVAL_MS=8000 - ETHEREUM_STALLED_SYNC_THRESHOLD_MS=300000 - ETHEREUM_BLOCK_TIME_SECONDS=15 - - EXIT_PROCESSOR_SLA_MARGIN=5520 + - EXIT_PROCESSOR_SLA_SECONDS=82800 - EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE - LOGGER_BACKEND=console - DD_HOSTNAME=datadog @@ -69,7 +69,7 @@ services: - ETHEREUM_EVENTS_CHECK_INTERVAL_MS=8000 - ETHEREUM_STALLED_SYNC_THRESHOLD_MS=300000 - ETHEREUM_BLOCK_TIME_SECONDS=15 - - EXIT_PROCESSOR_SLA_MARGIN=5520 + - EXIT_PROCESSOR_SLA_SECONDS=82800 - EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE - LOGGER_BACKEND=console - DD_HOSTNAME=datadog diff --git a/docker-compose.yml b/docker-compose.yml index 4a5ae849dc..c0d7c705cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -118,7 +118,7 @@ services: - ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800 - ETHEREUM_STALLED_SYNC_THRESHOLD_MS=20000 - ETHEREUM_BLOCK_TIME_SECONDS=1 - - EXIT_PROCESSOR_SLA_MARGIN=5520 + - EXIT_PROCESSOR_SLA_SECONDS=5520 - EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE - LOGGER_BACKEND=console - RELEASE_COOKIE=development @@ -158,7 +158,7 @@ services: - DB_PATH=/data - ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800 - ETHEREUM_BLOCK_TIME_SECONDS=1 - - EXIT_PROCESSOR_SLA_MARGIN=5520 + - EXIT_PROCESSOR_SLA_SECONDS=5520 - EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE - LOGGER_BACKEND=console - RELEASE_COOKIE=development diff --git a/docs/deployment_configuration.md b/docs/deployment_configuration.md index 71b055b0e3..6321cf9c8a 100644 --- a/docs/deployment_configuration.md +++ b/docs/deployment_configuration.md @@ -34,7 +34,7 @@ ***Watcher and Watcher Info only*** - "CHILD_CHAIN_URL" - Location of the Child Chain API. *mandatory* -- "EXIT_PROCESSOR_SLA_MARGIN" - Number of Ethereum blocks since start of an invalid exit, before `unchallenged_exit` is reported to prompt to mass exit. Must be smaller than "MIN_EXIT_PERIOD_SECONDS", unless "EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE". +- "EXIT_PROCESSOR_SLA_SECONDS" - Seconds since start of an invalid exit, before `unchallenged_exit` is reported to prompt to mass exit. Must be smaller than "MIN_EXIT_PERIOD_SECONDS", unless "EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE". ***Watcher Info only*** diff --git a/docs/details.md b/docs/details.md index 827901f030..48a6b67999 100644 --- a/docs/details.md +++ b/docs/details.md @@ -217,14 +217,14 @@ Options of the fee adapter, depends on adapter ## Watcher configuration - `:omg_watcher` app -* **`exit_processor_sla_margin`** - the margin to define the notion of a "late", invalid exit. +* **`exit_processor_sla_seconds`** - the margin to define the notion of a "late", invalid exit. After this margin passes, every invalid exit is deemed a critical failure of the child chain (`unchallenged_exit`). Such event will prompt a mass exit and stop processing new blocks. See [exit validation documentation](docs/exit_validation.md) for details. Cannot be larger than `min_exit_period_seconds` because otherwise it leads to a dangerous setup of the Watcher (in particular - muting the reports of unchallenged_exits). -Override using the `EXIT_PROCESSOR_SLA_MARGIN` system environment variable. +Override using the `EXIT_PROCESSOR_SLA_SECONDS` system environment variable. -* **`exit_processor_sla_margin_forced`** - if set to `true`, will allow one to set a `exit_processor_sla_margin` that is larger than the `min_exit_period_seconds` of the child chain we're running for. +* **`exit_processor_sla_margin_forced`** - if set to `true`, will allow one to set a `exit_processor_sla_seconds` that is larger than the `min_exit_period_seconds` of the child chain we're running for. Set to `true` only when you know what you are doing. Defaults to `false`, override using the `EXIT_PROCESSOR_SLA_MARGIN_FORCED` system environment variable. diff --git a/docs/exit_validation.md b/docs/exit_validation.md index 47bda3e90b..263a49ea92 100644 --- a/docs/exit_validation.md +++ b/docs/exit_validation.md @@ -10,9 +10,9 @@ This document describes the exit validation (processing) done by the Watcher in * **unchallenged exit tolerance** - a Watcher's tolerance to an invalid exit not having a challenge for a long time since its start. - **NOTE**: in practice, violation of the child chain exit recognition SLA and violation of the unchallenged exit tolerance are similar. The correct reaction to both is a prompt to mass exit and a challenge of the invalid exit. - Because of this, only `sla_margin` is used as a configurable setting on the Watcher, covering for both conditions. -* **`sla_margin`** - margin of the child chain exit recognition SLA (in Ethereum blocks). -This is a number of blocks after the start of an exit (or piggyback), during which a Child Chain Server still might include a transaction invalidating a previously valid exit, without violating the child chain exit recognition SLA. + Because of this, only `sla_seconds` is used as a configurable setting on the Watcher, covering for both conditions. +* **`sla_seconds`** - margin of the child chain exit recognition SLA (in seconds). +This is the time (in seconds) after the start of an exit (or piggyback), during which a Child Chain Server still might include a transaction invalidating a previously valid exit, without violating the child chain exit recognition SLA. Similarly, this is a number of blocks after the start of an exit (or piggyback), during which the Watcher will not report [unchallenged exits](#unchallenged_exit-condition). ## Notes on the Child Chain Server @@ -31,34 +31,34 @@ The child chain becomes insolvent if any invalid exit gets finalized, which lead - **NOTE**: This immediacy is limited because the server must process deposits before exits and deposits _must_ wait for finality on the root chain. There are scenarios, when a race condition/reorg on the root chain might make the Child Chain Server prohibit spending of a particular UTXO **late**, regardless of the immediacy mentioned above. -This is acceptable as long as the delay doesn't exceed the `sla_margin`. +This is acceptable as long as the delay doesn't exceed the `sla_seconds`. ## Watcher -### Choice of the `sla_margin` setting value +### Choice of the `sla_seconds` setting value -`sla_margin` is a set on the Watcher (via [`exit_processor_sla_margin`/`EXIT_PROCESSOR_SLA_MARGIN`](./details.md#configuration-parameters)), which needs to be determined correctly for various deployments and environments. +`sla_seconds` is a set on the Watcher (via [`exit_processor_sla_seconds`/`EXIT_PROCESSOR_SLA_SECONDS`](./details.md#configuration-parameters)), which needs to be determined correctly for various deployments and environments. It should reflect the exit period and the intended usage patterns and security requirements of the environment. -`sla margin` should be large enough: +`sla_seconds` should be large enough: - for the Child Chain Server (that runs the child chain the Watcher validates), to recognize exiting UTXOs, to prevent an invalidating transaction going through - for anyone concerned with challenging to challenge invalid exits. -`sla_margin` should be tight enough: +`sla_seconds` should be tight enough: - to allow a successful mass exit in case of an [`unchallenged_exit` condition](#unchallenged_exit-condition). -**NOTE** The `sla_margin` is usually much larger and unrelated to any margins that the Child Chain Server may wait before recognizing exits. -So, if everything is functioning correctly, the spending of exiting UTXOs is blocked _much_ earlier than the `sla_margin`. -In other words, `sla_margin` is usually picked to be ample (to avoid spurious mass exit prompts), and this doesn't impact the immediacy of the Child Chain Server's reaction to exits. +**NOTE** The `sla_seconds` is usually much larger and unrelated to any margins that the Child Chain Server may wait before recognizing exits. +So, if everything is functioning correctly, the spending of exiting UTXOs is blocked _much_ earlier than the `sla_seconds`. +In other words, `sla_seconds` is usually picked to be ample (to avoid spurious mass exit prompts), and this doesn't impact the immediacy of the Child Chain Server's reaction to exits. ### Standard Exits #### Actions that the Watcher should prompt 1. If an exit is known to be invalid it should be challenged. The Watcher prompts by an `:invalid_exit` event. -2. If an exit is invalidated with a transaction submitted *before* `start_eth_height + sla_margin` it must be challenged (`:invalid_exit` event) -3. If an exit is invalidated with a transaction submitted *after* `start_eth_height + sla_margin` it must be challenged **AND** the Watcher prompts to exit. The Watcher prompts by both `:invalid_exit` and `:unchallenged_exit` events. Users should not deposit or spend -4. If an exit is invalid and remains unchallenged *after* `start_eth_height + sla_margin` it must be challenged **AND** the Watcher prompts to exit. The Watcher prompts by both `:invalid_exit` and `:unchallenged_exit` events. Users should not deposit or spend. +2. If an exit is invalidated with a transaction submitted *before* `sla_seconds` it must be challenged (`:invalid_exit` event) +3. If an exit is invalidated with a transaction submitted *after* `sla_seconds` it must be challenged **AND** the Watcher prompts to exit. The Watcher prompts by both `:invalid_exit` and `:unchallenged_exit` events. Users should not deposit or spend +4. If an exit is invalid and remains unchallenged *after* `sla_seconds` it must be challenged **AND** the Watcher prompts to exit. The Watcher prompts by both `:invalid_exit` and `:unchallenged_exit` events. Users should not deposit or spend. 5. The `unchallenged_exit` event also covers the case where the invalid exit finalizes, causing an insolvent chain until [issue #1318 is solved](github.com/omisego/elixir-omg/issues/1318). More on the [`unchallenged_exit` condition](#unchallenged_exit-condition). @@ -75,7 +75,7 @@ Assumptions: 3. For every open exit request run `OMG.State.utxo_exists?` method * if `true` -> noop, * if `false` -> emit `:invalid_exit` event prompts to challenge - * if `false` and exit is older than `sla_margin` -> emit additionally an `:unchallenged_exit` event which promts mass exit + * if `false` and exit is older than `sla_seconds` -> emit additionally an `:unchallenged_exit` event which promts mass exit 4. Spend UTXOs in `OMG.State` on exit finalization * if the spent UTXO is present at the moment, forget the exit from validation - this is a valid finalization * if the spent UTXO is missing, keep on emitting `:unchallenged_exit` (until [issue #1318 is solved](github.com/omisego/elixir-omg/issues/1318)) - this is an invalid finalization. @@ -132,5 +132,5 @@ An alternative is to always check the current status of every exit, before takin All the above rules will apply analogically to in-flight exits. See [MoreVP](./morevp.md) for specs and introduction to in-flight exits. Invalid attempts to do an in-flight related action prompt challenges. -Absence of challenges within the `sla_margin`, as well as invalid finalization, should result in client prompting to mass exit (to be implemented in [issue #1275](github.com/omisego/elixir-omg/issues/1275)). +Absence of challenges within the `sla_seconds`, as well as invalid finalization, should result in client prompting to mass exit (to be implemented in [issue #1275](github.com/omisego/elixir-omg/issues/1275)). `OMG.State` is modified on IFE finalization. diff --git a/priv/cabbage/apps/itest/lib/api_model/watcher_security_critical_configuration.ex b/priv/cabbage/apps/itest/lib/api_model/watcher_security_critical_configuration.ex index a059f439ab..f834fe06da 100644 --- a/priv/cabbage/apps/itest/lib/api_model/watcher_security_critical_configuration.ex +++ b/priv/cabbage/apps/itest/lib/api_model/watcher_security_critical_configuration.ex @@ -15,13 +15,13 @@ defmodule Itest.ApiModel.WatcherSecurityCriticalConfiguration do @moduledoc """ The purpose of this module is to represent a specific API response as a struct and validates it's response """ - defstruct [:contract_semver, :deposit_finality_margin, :network, :exit_processor_sla_margin] + defstruct [:contract_semver, :deposit_finality_margin, :network, :exit_processor_sla_seconds] @type t() :: %__MODULE__{ deposit_finality_margin: non_neg_integer(), contract_semver: binary(), network: binary(), - exit_processor_sla_margin: non_neg_integer() + exit_processor_sla_seconds: non_neg_integer() } def to_struct(attrs) do @@ -42,7 +42,7 @@ defmodule Itest.ApiModel.WatcherSecurityCriticalConfiguration do defp is_valid(struct) do is_integer(struct.deposit_finality_margin) && is_binary(struct.contract_semver) && - is_integer(struct.exit_processor_sla_margin) && + is_integer(struct.exit_processor_sla_seconds) && is_binary(struct.network) end end diff --git a/priv/cabbage/apps/itest/test/itest/configuration_api_test.exs b/priv/cabbage/apps/itest/test/itest/configuration_api_test.exs index 70581b7c01..cae73ca91b 100644 --- a/priv/cabbage/apps/itest/test/itest/configuration_api_test.exs +++ b/priv/cabbage/apps/itest/test/itest/configuration_api_test.exs @@ -32,7 +32,7 @@ defmodule ConfigurationRetrievalTests do "contract_semver" => contract_semver, "deposit_finality_margin" => 10, "network" => "LOCALCHAIN", - "exit_processor_sla_margin" => 30 + "exit_processor_sla_seconds" => 30 }, child_chain_assert_response: %{ "contract_semver" => contract_semver, diff --git a/priv/cabbage/docker-compose-cabbage.yml b/priv/cabbage/docker-compose-cabbage.yml index d692c22c5a..d51274beb7 100644 --- a/priv/cabbage/docker-compose-cabbage.yml +++ b/priv/cabbage/docker-compose-cabbage.yml @@ -4,7 +4,7 @@ version: "2.3" services: watcher: environment: - - EXIT_PROCESSOR_SLA_MARGIN=30 + - EXIT_PROCESSOR_SLA_SECONDS=30 watcher_info: environment: - - EXIT_PROCESSOR_SLA_MARGIN=30 + - EXIT_PROCESSOR_SLA_SECONDS=30