message: Replace no_fees_transaction with no_fees_required

diff:
@@ -26,7 +26,7 @@ defmodule OMG.Fees do
use OMG.Utils.LoggerExt
@type fee_spec_t() :: %{token: Transaction.Payment.currency(), flat_fee: non_neg_integer}
- @type fee_t() :: %{Transaction.Payment.currency() => non_neg_integer} | :no_fees_transaction
+ @type fee_t() :: %{Transaction.Payment.currency() => non_neg_integer} | ::no_fees_required
@doc ~S"""
Checks whether the transaction's inputs cover the fees.
@@ -38,7 +38,7 @@ defmodule OMG.Fees do
"""
@spec covered?(implicit_paid_fee_by_currency :: map(), fees :: fee_t()) :: boolean()
- def covered?(_, :no_fees_transaction), do: true
+ def covered?(_, ::no_fees_required), do: true
def covered?(implicit_paid_fee_by_currency, fees) do
for {input_currency, implicit_paid_fee} <- implicit_paid_fee_by_currency do
@@ -64,7 +64,7 @@ defmodule OMG.Fees do
def for_transaction(transaction, fee_map) do
case MergeTransactionValidator.is_merge_transaction?(transaction) do
true ->
- :no_fees_transaction
+ ::no_fees_required
# TODO: reducing fees to output currencies only is incorrect, let's deffer until fees get large
false ->

diff:
@@ -34,8 +34,8 @@ defmodule OMG.FeesTest do
}
describe "covered?/2" do
- test "does not check the fees when :no_fees_transaction is passed" do
- assert Fees.covered?(%{@eth => 0}, :no_fees_transaction)
+ test "does not check the fees when ::no_fees_required is passed" do
+ assert Fees.covered?(%{@eth => 0}, ::no_fees_required)
end
test "returns true when fees are covered by another currency" do
@@ -77,14 +77,14 @@ defmodule OMG.FeesTest do
end
@tag fixtures: [:alice]
- test "returns :no_fees_transaction for merge transactions",
+ test "returns ::no_fees_required for merge transactions",
%{alice: alice} do
transaction = create_recovered([{1, 0, 0, alice}, {2, 0, 0, alice}], @eth, [{alice, 10}])
- assert Fees.for_transaction(transaction, @fees) == :no_fees_transaction
+ assert Fees.for_transaction(transaction, @fees) == ::no_fees_required
end
@tag fixtures: [:alice]
- test "returns :no_fees_transaction for valid merge transactions with multiple inputs/ouputs",
+ test "returns ::no_fees_required for valid merge transactions with multiple inputs/ouputs",
%{alice: alice} do
transaction =
create_recovered(
@@ -92,7 +92,7 @@ defmodule OMG.FeesTest do
[{alice, @eth, 10}, {alice, @eth, 10}]
)
- assert Fees.for_transaction(transaction, @fees) == :no_fees_transaction
+ assert Fees.for_transaction(transaction, @fees) == ::no_fees_required
end
end
end

diff:
@@ -43,9 +43,9 @@ defmodule OMG.State.CoreTest do
test "can spend deposits", %{alice: alice, bob: bob, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{bob, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{bob, 3}]), ::no_fees_required)
|> success?
end
@@ -55,22 +55,22 @@ defmodule OMG.State.CoreTest do
state1 =
state
|> do_deposit(alice, %{amount: 10, currency: @not_eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @not_eth, [{alice, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @not_eth, [{alice, 7}, {alice, 3}]), ::no_fees_required)
|> success?
state1
- |> Core.exec(create_recovered([{1000, 0, 0, alice}], @eth, [{alice, 9}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1000, 0, 0, alice}], @eth, [{alice, 9}]), ::no_fees_required)
|> fail?(:amounts_do_not_add_up)
state1
|> Core.exec(
create_recovered([{1000, 0, 0, alice}], [{alice, @eth, 9}, {alice, @not_eth, 3}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> fail?(:amounts_do_not_add_up)
state1
- |> Core.exec(create_recovered([{1000, 0, 0, alice}], [{alice, @not_eth, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1000, 0, 0, alice}], [{alice, @not_eth, 3}]), ::no_fees_required)
|> success?
end
@@ -81,10 +81,10 @@ defmodule OMG.State.CoreTest do
# outputs exceed inputs, no fee
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {bob, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {bob, 3}]), ::no_fees_required)
|> fail?(:amounts_do_not_add_up)
|> same?(state)
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 2}, {alice, 8}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 2}, {alice, 8}]), ::no_fees_required)
|> success?
# outputs exceed inputs, with fee
@@ -96,13 +96,13 @@ defmodule OMG.State.CoreTest do
|> same?(state)
|> Core.exec(
create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, [{alice, 9}, {bob, 2}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> fail?(:amounts_do_not_add_up)
|> same?(state)
|> Core.exec(
create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, [{alice, 7}, {bob, 2}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> success?()
end
@@ -221,7 +221,7 @@ defmodule OMG.State.CoreTest do
|> do_deposit(alice, %{amount: 2, currency: @not_eth, blknum: 2})
|> Core.exec(
create_recovered([{1, 0, 0, alice}, {2, 0, 0, alice}], [{bob, @eth, 1}, {bob, @not_eth, 2}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> success?
end
@@ -232,9 +232,9 @@ defmodule OMG.State.CoreTest do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
|> do_deposit(bob, %{amount: 20, currency: @eth, blknum: 2})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 10}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 10}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{2, 0, 0, bob}], @eth, [{alice, 20}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{2, 0, 0, bob}], @eth, [{alice, 20}]), ::no_fees_required)
|> success?
end
@@ -244,7 +244,7 @@ defmodule OMG.State.CoreTest do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
|> do_deposit(bob, %{amount: 20, currency: @eth, blknum: 2})
- |> Core.exec(create_recovered([{1, 0, 0, bob}, {2, 0, 0, alice}], @eth, [{bob, 10}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, bob}, {2, 0, 0, alice}], @eth, [{bob, 10}]), ::no_fees_required)
|> fail?(:unauthorized_spent)
end
@@ -271,7 +271,7 @@ defmodule OMG.State.CoreTest do
state_deposit = state |> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
state_deposit
- |> Core.exec(create_recovered([{1, 1, 0, alice}, {1, 0, 0, alice}], @eth, [{bob, 7}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 1, 0, alice}, {1, 0, 0, alice}], @eth, [{bob, 7}]), ::no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_deposit)
end
@@ -279,10 +279,10 @@ defmodule OMG.State.CoreTest do
@tag fixtures: [:alice, :bob, :state_alice_deposit]
test "can't spend other people's funds", %{alice: alice, bob: bob, state_alice_deposit: state} do
state
- |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{bob, 8}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{bob, 8}, {alice, 3}]), ::no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
- |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{alice, 10}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{alice, 10}]), ::no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
end
@@ -291,19 +291,19 @@ defmodule OMG.State.CoreTest do
test "all inputs must be authorized to be spent", %{alice: alice, bob: bob, state_alice_deposit: state} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?()
state
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, bob}], @eth, []), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, bob}], @eth, []), ::no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}, {@blknum1, 0, 1, alice}], @eth, []), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}, {@blknum1, 0, 1, alice}], @eth, []), ::no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
state
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, []), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, []), ::no_fees_required)
|> success?()
end
@@ -317,9 +317,9 @@ defmodule OMG.State.CoreTest do
for first <- transactions,
second <- transactions do
state
- |> Core.exec(first, :no_fees_transaction)
+ |> Core.exec(first, ::no_fees_required)
|> success?
- |> Core.exec(second, :no_fees_transaction)
+ |> Core.exec(second, ::no_fees_required)
|> fail?(:utxo_not_found)
end
end
@@ -332,15 +332,15 @@ defmodule OMG.State.CoreTest do
state_alice_deposit: state
} do
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{carol, 7}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{carol, 7}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{carol, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{carol, 3}]), ::no_fees_required)
|> success?
|> Core.exec(
create_recovered([{@blknum1, 1, 0, carol}, {@blknum1, 2, 0, carol}], @eth, [{alice, 10}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> success?
end
@@ -351,9 +351,9 @@ defmodule OMG.State.CoreTest do
{:ok, {_, _, _}, state} = form_block_check(state)
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{next_block_height, 0, 0, bob}], @eth, [{bob, 7}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{next_block_height, 0, 0, bob}], @eth, [{bob, 7}]), ::no_fees_required)
|> success?
end
@@ -363,11 +363,11 @@ defmodule OMG.State.CoreTest do
{:ok, {_, _, _}, state} =
state
- |> Core.exec(recovered, :no_fees_transaction)
+ |> Core.exec(recovered, ::no_fees_required)
|> success?
|> form_block_check()
- Core.exec(state, recovered, :no_fees_transaction) |> fail?(:utxo_not_found) |> same?(state)
+ Core.exec(state, recovered, ::no_fees_required) |> fail?(:utxo_not_found) |> same?(state)
end
@tag fixtures: [:alice, :bob, :state_alice_deposit]
@@ -377,9 +377,9 @@ defmodule OMG.State.CoreTest do
assert {:ok, {%Block{hash: block_hash, number: block_number}, triggers, _}, _} =
state
- |> Core.exec(recover1, :no_fees_transaction)
+ |> Core.exec(recover1, ::no_fees_required)
|> success?
- |> Core.exec(recover2, :no_fees_transaction)
+ |> Core.exec(recover2, ::no_fees_required)
|> success?
|> form_block_check()
@@ -395,7 +395,7 @@ defmodule OMG.State.CoreTest do
assert state =
state
- |> Core.exec(recover1, :no_fees_transaction)
+ |> Core.exec(recover1, ::no_fees_required)
|> success?
assert {_, {_block, [%{submited_at_ethheight: 123}], _db_updates}, _} = Core.form_block(@interval, 123, state)
@@ -409,9 +409,9 @@ defmodule OMG.State.CoreTest do
} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{alice, 7}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{alice, 7}]), ::no_fees_required)
|> success?
assert {:ok, {_, [_trigger1, _trigger2], _}, _} = form_block_check(state)
@@ -424,7 +424,7 @@ defmodule OMG.State.CoreTest do
state_alice_deposit: state
} do
state
- |> Core.exec(create_recovered([{1, 1, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 1, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> same?(state)
assert {:ok, {_, [], _}, _} = form_block_check(state)
@@ -447,7 +447,7 @@ defmodule OMG.State.CoreTest do
} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?
assert {:ok, {_, [_trigger], _}, state} = form_block_check(state)
@@ -469,11 +469,11 @@ defmodule OMG.State.CoreTest do
state =
state
- |> Core.exec(recovered_tx_1, :no_fees_transaction)
+ |> Core.exec(recovered_tx_1, ::no_fees_required)
|> success?
- |> Core.exec(recovered_tx_2, :no_fees_transaction)
+ |> Core.exec(recovered_tx_2, ::no_fees_required)
|> success?
- |> Core.exec(recovered_tx_3, :no_fees_transaction)
+ |> Core.exec(recovered_tx_3, ::no_fees_required)
|> success?
assert {:ok,
@@ -501,7 +501,7 @@ defmodule OMG.State.CoreTest do
} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?
{:ok, {_, _, _}, state} = form_block_check(state)
@@ -527,7 +527,7 @@ defmodule OMG.State.CoreTest do
# persistence tested in-depth elsewhere
{:ok, {_, _, [_ | _]}, state} =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
|> success?
|> form_block_check()
@@ -554,7 +554,7 @@ defmodule OMG.State.CoreTest do
state =
state
- |> Core.exec(tx, :no_fees_transaction)
+ |> Core.exec(tx, ::no_fees_required)
|> success?
utxo_pos_exits = [Utxo.position(@blknum1, 0, 0), Utxo.position(@blknum1, 0, 1)]
@@ -590,7 +590,7 @@ defmodule OMG.State.CoreTest do
state
|> Core.exec(
create_recovered([{1, 0, 0, alice}], @eth, [{alice, amount_1}, {alice, amount_2}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> success?
@@ -602,10 +602,10 @@ defmodule OMG.State.CoreTest do
Core.exit_utxos(utxo_pos_exits, state)
state_after_exit
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), ::no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_after_exit)
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), ::no_fees_required)
|> fail?(:utxo_not_found)
end
@@ -614,7 +614,7 @@ defmodule OMG.State.CoreTest do
# persistence tested in-depth elsewhere
tx = create_recovered([{1, 0, 0, alice}], @eth, [{alice, 7}, {alice, 3}])
- state = state |> Core.exec(tx, :no_fees_transaction) |> success?
+ state = state |> Core.exec(tx, ::no_fees_required) |> success?
utxo_pos_exits_in_flight = [%{call_data: %{in_flight_tx: Transaction.raw_txbytes(tx)}}]
utxo_pos_exits_piggyback = [%{tx_hash: Transaction.raw_txhash(tx), output_index: 4}]
@@ -626,10 +626,10 @@ defmodule OMG.State.CoreTest do
Core.exit_utxos(utxo_pos_exits_piggyback, state)
state_after_exit
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), ::no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_after_exit)
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), ::no_fees_required)
|> success?
end
@@ -638,7 +638,7 @@ defmodule OMG.State.CoreTest do
# persistence tested in-depth elsewhere
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 7}, {alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 7}, {alice, 3}]), ::no_fees_required)
|> success?
tx = create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 3}, {alice, 3}])
@@ -650,10 +650,10 @@ defmodule OMG.State.CoreTest do
Core.exit_utxos(utxo_pos_exits_in_flight, state)
state_after_exit
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), ::no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_after_exit)
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), ::no_fees_required)
|> success?
end
@@ -680,7 +680,7 @@ defmodule OMG.State.CoreTest do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), ::no_fees_required)
|> success?
assert not Core.utxo_exists?(Utxo.position(1, 0, 0), state)
@@ -707,7 +707,7 @@ defmodule OMG.State.CoreTest do
{:ok, _, state} =
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), ::no_fees_required)
assert {@blknum1, false} = Core.get_status(state)
@@ -721,9 +721,9 @@ defmodule OMG.State.CoreTest do
test "Output can have a zero value; can't be used as input though", %{alice: alice, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {alice, 0}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {alice, 0}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 0}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 0}]), ::no_fees_required)
|> fail?(:utxo_not_found)
end
@@ -731,9 +731,9 @@ defmodule OMG.State.CoreTest do
test "Output with zero value does not change oindex of other outputs", %{alice: alice, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}, {alice, 8}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}, {alice, 8}]), ::no_fees_required)
|> success?
- |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 1}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 1}]), ::no_fees_required)
|> success?
end
@@ -741,7 +741,7 @@ defmodule OMG.State.CoreTest do
test "Output with zero value will not be written to DB", %{alice: alice, state_alice_deposit: state} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}]), ::no_fees_required)
|> success?
{:ok, {_, _, db_updates}, _} = form_block_check(state)
@@ -752,7 +752,7 @@ defmodule OMG.State.CoreTest do
test "Transaction can have no outputs", %{alice: alice, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, []), :no_fees_transaction)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, []), ::no_fees_required)
|> success?
end
@@ -769,20 +769,20 @@ defmodule OMG.State.CoreTest do
state
|> Core.exec(
create_recovered([{future_deposit_blknum, 0, 0, alice}], @eth, [{bob, 6}, {alice, 4}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> fail?(:input_utxo_ahead_of_state)
state
|> Core.exec(
create_recovered([{1, 0, 0, alice}, {future_deposit_blknum, 0, 0, alice}], @eth, [{bob, 6}, {alice, 4}]),
- :no_fees_transaction
+ ::no_fees_required
)
|> fail?(:input_utxo_ahead_of_state)
# when non-existent input comes with a blknum of the current block fail with :utxo_not_found
state
- |> Core.exec(create_recovered([{@blknum1, 1, 0, alice}], @eth, [{bob, 6}, {alice, 4}]), :no_fees_transaction)
+ |> Core.exec(create_recovered([{@blknum1, 1, 0, alice}], @eth, [{bob, 6}, {alice, 4}]), ::no_fees_required)
|> fail?(:utxo_not_found)
end

diff:
@@ -173,7 +173,7 @@ defmodule OMG.State.PersistenceTest do
end
defp exec(state, tx) do
- assert {:ok, _, state} = Core.exec(state, tx, :no_fees_transaction)
+ assert {:ok, _, state} = Core.exec(state, tx, ::no_fees_required)
state
end

diff:
@@ -410,7 +410,7 @@ defmodule OMG.State.TransactionTest do
defp assert_tx_usable(signed, state_core) do
{:ok, transaction} = signed |> Transaction.Signed.encode() |> Transaction.Recovered.recover_from()
- assert {:ok, {_, _, _}, _state} = State.Core.exec(state_core, transaction, :no_fees_transaction)
+ assert {:ok, {_, _, _}, _state} = State.Core.exec(state_core, transaction, ::no_fees_required)
end
defp parametrized_tester({inputs, outputs}) do

diff:
@@ -55,7 +55,7 @@ defmodule OMG.StateTest do
assert true == State.utxo_exists?(Utxo.position(1, 0, 0))
assert {:ok, _} =
- State.exec(TestHelper.create_recovered([{1, 0, 0, alice}], @eth, [{alice, 3}]), :no_fees_transaction)
+ State.exec(TestHelper.create_recovered([{1, 0, 0, alice}], @eth, [{alice, 3}]), ::no_fees_required)
# block forming & status
assert {blknum, _} = State.get_status()

diff:
@@ -40,7 +40,7 @@ defmodule OMG.ChildChain.FeeServer do
args =
case Application.get_env(:omg_child_chain, :ignore_fees) do
true ->
- :ok = save_fees(:no_fees_transaction, 0)
+ :ok = save_fees(::no_fees_required, 0)
_ = Logger.warn("Fee specs from file are ignored.")
args

diff:
@@ -108,11 +108,11 @@ defmodule OMG.ChildChain.Integration.FeeServerTest do
end
test "fee server ignores file updates" do
- assert {:ok, :no_fees_transaction} == FeeServer.transaction_fees()
+ assert {:ok, ::no_fees_required} == FeeServer.transaction_fees()
assert refresh_fees() =~ "Updates takes no effect"
- assert {:ok, :no_fees_transaction} == FeeServer.transaction_fees()
+ assert {:ok, ::no_fees_required} == FeeServer.transaction_fees()
assert server_alive?()
end
end

diff:
@@ -108,7 +108,7 @@ defmodule OMG.Watcher.BlockGetter do
end
def handle_continue({:apply_block_step, :execute_transactions, block_application}, state) do
- tx_exec_results = for(tx <- block_application.transactions, do: OMG.State.exec(tx, :no_fees_transaction))
+ tx_exec_results = for(tx <- block_application.transactions, do: OMG.State.exec(tx, ::no_fees_required))
case Core.validate_executions(tx_exec_results, block_application, state) do
{:ok, state} ->

diff:
@@ -116,7 +116,7 @@ defmodule OMG.Watcher.BlockGetter.CoreTest do
_} = Core.get_blocks_to_apply(state, [%{blknum: block.number, eth_height: synced_height}], synced_height)
# check feasibility of transactions from block to consume at the OMG.State
- assert {:ok, tx_result, _} = OMG.State.Core.exec(state_alice_deposit, tx, :no_fees_transaction)
+ assert {:ok, tx_result, _} = OMG.State.Core.exec(state_alice_deposit, tx, ::no_fees_required)
assert {:ok, ^state} = Core.validate_executions([{:ok, tx_result}], block, state)


message: Fix failed replace all

change_type: MODIFY

diff:
@@ -26,7 +26,7 @@ defmodule OMG.Fees do
use OMG.Utils.LoggerExt
@type fee_spec_t() :: %{token: Transaction.Payment.currency(), flat_fee: non_neg_integer}
- @type fee_t() :: %{Transaction.Payment.currency() => non_neg_integer} | ::no_fees_required
+ @type fee_t() :: %{Transaction.Payment.currency() => non_neg_integer} | :no_fees_required
@doc ~S"""
Checks whether the transaction's inputs cover the fees.
@@ -38,7 +38,7 @@ defmodule OMG.Fees do
"""
@spec covered?(implicit_paid_fee_by_currency :: map(), fees :: fee_t()) :: boolean()
- def covered?(_, ::no_fees_required), do: true
+ def covered?(_, :no_fees_required), do: true
def covered?(implicit_paid_fee_by_currency, fees) do
for {input_currency, implicit_paid_fee} <- implicit_paid_fee_by_currency do
@@ -64,7 +64,7 @@ defmodule OMG.Fees do
def for_transaction(transaction, fee_map) do
case MergeTransactionValidator.is_merge_transaction?(transaction) do
true ->
- ::no_fees_required
+ :no_fees_required
# TODO: reducing fees to output currencies only is incorrect, let's deffer until fees get large
false ->

diff:
@@ -34,8 +34,8 @@ defmodule OMG.FeesTest do
}
describe "covered?/2" do
- test "does not check the fees when ::no_fees_required is passed" do
- assert Fees.covered?(%{@eth => 0}, ::no_fees_required)
+ test "does not check the fees when :no_fees_required is passed" do
+ assert Fees.covered?(%{@eth => 0}, :no_fees_required)
end
test "returns true when fees are covered by another currency" do
@@ -77,14 +77,14 @@ defmodule OMG.FeesTest do
end
@tag fixtures: [:alice]
- test "returns ::no_fees_required for merge transactions",
+ test "returns :no_fees_required for merge transactions",
%{alice: alice} do
transaction = create_recovered([{1, 0, 0, alice}, {2, 0, 0, alice}], @eth, [{alice, 10}])
- assert Fees.for_transaction(transaction, @fees) == ::no_fees_required
+ assert Fees.for_transaction(transaction, @fees) == :no_fees_required
end
@tag fixtures: [:alice]
- test "returns ::no_fees_required for valid merge transactions with multiple inputs/ouputs",
+ test "returns :no_fees_required for valid merge transactions with multiple inputs/ouputs",
%{alice: alice} do
transaction =
create_recovered(
@@ -92,7 +92,7 @@ defmodule OMG.FeesTest do
[{alice, @eth, 10}, {alice, @eth, 10}]
)
- assert Fees.for_transaction(transaction, @fees) == ::no_fees_required
+ assert Fees.for_transaction(transaction, @fees) == :no_fees_required
end
end
end

diff:
@@ -43,9 +43,9 @@ defmodule OMG.State.CoreTest do
test "can spend deposits", %{alice: alice, bob: bob, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{bob, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{bob, 3}]), :no_fees_required)
|> success?
end
@@ -55,22 +55,22 @@ defmodule OMG.State.CoreTest do
state1 =
state
|> do_deposit(alice, %{amount: 10, currency: @not_eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @not_eth, [{alice, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @not_eth, [{alice, 7}, {alice, 3}]), :no_fees_required)
|> success?
state1
- |> Core.exec(create_recovered([{1000, 0, 0, alice}], @eth, [{alice, 9}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1000, 0, 0, alice}], @eth, [{alice, 9}]), :no_fees_required)
|> fail?(:amounts_do_not_add_up)
state1
|> Core.exec(
create_recovered([{1000, 0, 0, alice}], [{alice, @eth, 9}, {alice, @not_eth, 3}]),
- ::no_fees_required
+ :no_fees_required
)
|> fail?(:amounts_do_not_add_up)
state1
- |> Core.exec(create_recovered([{1000, 0, 0, alice}], [{alice, @not_eth, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1000, 0, 0, alice}], [{alice, @not_eth, 3}]), :no_fees_required)
|> success?
end
@@ -81,10 +81,10 @@ defmodule OMG.State.CoreTest do
# outputs exceed inputs, no fee
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {bob, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {bob, 3}]), :no_fees_required)
|> fail?(:amounts_do_not_add_up)
|> same?(state)
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 2}, {alice, 8}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 2}, {alice, 8}]), :no_fees_required)
|> success?
# outputs exceed inputs, with fee
@@ -96,13 +96,13 @@ defmodule OMG.State.CoreTest do
|> same?(state)
|> Core.exec(
create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, [{alice, 9}, {bob, 2}]),
- ::no_fees_required
+ :no_fees_required
)
|> fail?(:amounts_do_not_add_up)
|> same?(state)
|> Core.exec(
create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, [{alice, 7}, {bob, 2}]),
- ::no_fees_required
+ :no_fees_required
)
|> success?()
end
@@ -221,7 +221,7 @@ defmodule OMG.State.CoreTest do
|> do_deposit(alice, %{amount: 2, currency: @not_eth, blknum: 2})
|> Core.exec(
create_recovered([{1, 0, 0, alice}, {2, 0, 0, alice}], [{bob, @eth, 1}, {bob, @not_eth, 2}]),
- ::no_fees_required
+ :no_fees_required
)
|> success?
end
@@ -232,9 +232,9 @@ defmodule OMG.State.CoreTest do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
|> do_deposit(bob, %{amount: 20, currency: @eth, blknum: 2})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 10}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 10}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{2, 0, 0, bob}], @eth, [{alice, 20}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{2, 0, 0, bob}], @eth, [{alice, 20}]), :no_fees_required)
|> success?
end
@@ -244,7 +244,7 @@ defmodule OMG.State.CoreTest do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
|> do_deposit(bob, %{amount: 20, currency: @eth, blknum: 2})
- |> Core.exec(create_recovered([{1, 0, 0, bob}, {2, 0, 0, alice}], @eth, [{bob, 10}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, bob}, {2, 0, 0, alice}], @eth, [{bob, 10}]), :no_fees_required)
|> fail?(:unauthorized_spent)
end
@@ -271,7 +271,7 @@ defmodule OMG.State.CoreTest do
state_deposit = state |> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
state_deposit
- |> Core.exec(create_recovered([{1, 1, 0, alice}, {1, 0, 0, alice}], @eth, [{bob, 7}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 1, 0, alice}, {1, 0, 0, alice}], @eth, [{bob, 7}]), :no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_deposit)
end
@@ -279,10 +279,10 @@ defmodule OMG.State.CoreTest do
@tag fixtures: [:alice, :bob, :state_alice_deposit]
test "can't spend other people's funds", %{alice: alice, bob: bob, state_alice_deposit: state} do
state
- |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{bob, 8}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{bob, 8}, {alice, 3}]), :no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
- |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{alice, 10}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, bob}], @eth, [{alice, 10}]), :no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
end
@@ -291,19 +291,19 @@ defmodule OMG.State.CoreTest do
test "all inputs must be authorized to be spent", %{alice: alice, bob: bob, state_alice_deposit: state} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?()
state
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, bob}], @eth, []), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, bob}], @eth, []), :no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}, {@blknum1, 0, 1, alice}], @eth, []), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}, {@blknum1, 0, 1, alice}], @eth, []), :no_fees_required)
|> fail?(:unauthorized_spent)
|> same?(state)
state
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, []), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}, {@blknum1, 0, 1, alice}], @eth, []), :no_fees_required)
|> success?()
end
@@ -317,9 +317,9 @@ defmodule OMG.State.CoreTest do
for first <- transactions,
second <- transactions do
state
- |> Core.exec(first, ::no_fees_required)
+ |> Core.exec(first, :no_fees_required)
|> success?
- |> Core.exec(second, ::no_fees_required)
+ |> Core.exec(second, :no_fees_required)
|> fail?(:utxo_not_found)
end
end
@@ -332,15 +332,15 @@ defmodule OMG.State.CoreTest do
state_alice_deposit: state
} do
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{carol, 7}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{carol, 7}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{carol, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{carol, 3}]), :no_fees_required)
|> success?
|> Core.exec(
create_recovered([{@blknum1, 1, 0, carol}, {@blknum1, 2, 0, carol}], @eth, [{alice, 10}]),
- ::no_fees_required
+ :no_fees_required
)
|> success?
end
@@ -351,9 +351,9 @@ defmodule OMG.State.CoreTest do
{:ok, {_, _, _}, state} = form_block_check(state)
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{next_block_height, 0, 0, bob}], @eth, [{bob, 7}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{next_block_height, 0, 0, bob}], @eth, [{bob, 7}]), :no_fees_required)
|> success?
end
@@ -363,11 +363,11 @@ defmodule OMG.State.CoreTest do
{:ok, {_, _, _}, state} =
state
- |> Core.exec(recovered, ::no_fees_required)
+ |> Core.exec(recovered, :no_fees_required)
|> success?
|> form_block_check()
- Core.exec(state, recovered, ::no_fees_required) |> fail?(:utxo_not_found) |> same?(state)
+ Core.exec(state, recovered, :no_fees_required) |> fail?(:utxo_not_found) |> same?(state)
end
@tag fixtures: [:alice, :bob, :state_alice_deposit]
@@ -377,9 +377,9 @@ defmodule OMG.State.CoreTest do
assert {:ok, {%Block{hash: block_hash, number: block_number}, triggers, _}, _} =
state
- |> Core.exec(recover1, ::no_fees_required)
+ |> Core.exec(recover1, :no_fees_required)
|> success?
- |> Core.exec(recover2, ::no_fees_required)
+ |> Core.exec(recover2, :no_fees_required)
|> success?
|> form_block_check()
@@ -395,7 +395,7 @@ defmodule OMG.State.CoreTest do
assert state =
state
- |> Core.exec(recover1, ::no_fees_required)
+ |> Core.exec(recover1, :no_fees_required)
|> success?
assert {_, {_block, [%{submited_at_ethheight: 123}], _db_updates}, _} = Core.form_block(@interval, 123, state)
@@ -409,9 +409,9 @@ defmodule OMG.State.CoreTest do
} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{alice, 7}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, bob}], @eth, [{alice, 7}]), :no_fees_required)
|> success?
assert {:ok, {_, [_trigger1, _trigger2], _}, _} = form_block_check(state)
@@ -424,7 +424,7 @@ defmodule OMG.State.CoreTest do
state_alice_deposit: state
} do
state
- |> Core.exec(create_recovered([{1, 1, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 1, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> same?(state)
assert {:ok, {_, [], _}, _} = form_block_check(state)
@@ -447,7 +447,7 @@ defmodule OMG.State.CoreTest do
} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?
assert {:ok, {_, [_trigger], _}, state} = form_block_check(state)
@@ -469,11 +469,11 @@ defmodule OMG.State.CoreTest do
state =
state
- |> Core.exec(recovered_tx_1, ::no_fees_required)
+ |> Core.exec(recovered_tx_1, :no_fees_required)
|> success?
- |> Core.exec(recovered_tx_2, ::no_fees_required)
+ |> Core.exec(recovered_tx_2, :no_fees_required)
|> success?
- |> Core.exec(recovered_tx_3, ::no_fees_required)
+ |> Core.exec(recovered_tx_3, :no_fees_required)
|> success?
assert {:ok,
@@ -501,7 +501,7 @@ defmodule OMG.State.CoreTest do
} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?
{:ok, {_, _, _}, state} = form_block_check(state)
@@ -527,7 +527,7 @@ defmodule OMG.State.CoreTest do
# persistence tested in-depth elsewhere
{:ok, {_, _, [_ | _]}, state} =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{bob, 7}, {alice, 3}]), :no_fees_required)
|> success?
|> form_block_check()
@@ -554,7 +554,7 @@ defmodule OMG.State.CoreTest do
state =
state
- |> Core.exec(tx, ::no_fees_required)
+ |> Core.exec(tx, :no_fees_required)
|> success?
utxo_pos_exits = [Utxo.position(@blknum1, 0, 0), Utxo.position(@blknum1, 0, 1)]
@@ -590,7 +590,7 @@ defmodule OMG.State.CoreTest do
state
|> Core.exec(
create_recovered([{1, 0, 0, alice}], @eth, [{alice, amount_1}, {alice, amount_2}]),
- ::no_fees_required
+ :no_fees_required
)
|> success?
@@ -602,10 +602,10 @@ defmodule OMG.State.CoreTest do
Core.exit_utxos(utxo_pos_exits, state)
state_after_exit
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), :no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_after_exit)
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), :no_fees_required)
|> fail?(:utxo_not_found)
end
@@ -614,7 +614,7 @@ defmodule OMG.State.CoreTest do
# persistence tested in-depth elsewhere
tx = create_recovered([{1, 0, 0, alice}], @eth, [{alice, 7}, {alice, 3}])
- state = state |> Core.exec(tx, ::no_fees_required) |> success?
+ state = state |> Core.exec(tx, :no_fees_required) |> success?
utxo_pos_exits_in_flight = [%{call_data: %{in_flight_tx: Transaction.raw_txbytes(tx)}}]
utxo_pos_exits_piggyback = [%{tx_hash: Transaction.raw_txhash(tx), output_index: 4}]
@@ -626,10 +626,10 @@ defmodule OMG.State.CoreTest do
Core.exit_utxos(utxo_pos_exits_piggyback, state)
state_after_exit
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), :no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_after_exit)
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), :no_fees_required)
|> success?
end
@@ -638,7 +638,7 @@ defmodule OMG.State.CoreTest do
# persistence tested in-depth elsewhere
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 7}, {alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 7}, {alice, 3}]), :no_fees_required)
|> success?
tx = create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 3}, {alice, 3}])
@@ -650,10 +650,10 @@ defmodule OMG.State.CoreTest do
Core.exit_utxos(utxo_pos_exits_in_flight, state)
state_after_exit
- |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 0, alice}], @eth, [{alice, 7}]), :no_fees_required)
|> fail?(:utxo_not_found)
|> same?(state_after_exit)
- |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 0, 1, alice}], @eth, [{alice, 3}]), :no_fees_required)
|> success?
end
@@ -680,7 +680,7 @@ defmodule OMG.State.CoreTest do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), :no_fees_required)
|> success?
assert not Core.utxo_exists?(Utxo.position(1, 0, 0), state)
@@ -707,7 +707,7 @@ defmodule OMG.State.CoreTest do
{:ok, _, state} =
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 10}]), :no_fees_required)
assert {@blknum1, false} = Core.get_status(state)
@@ -721,9 +721,9 @@ defmodule OMG.State.CoreTest do
test "Output can have a zero value; can't be used as input though", %{alice: alice, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {alice, 0}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 8}, {alice, 0}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 0}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 0}]), :no_fees_required)
|> fail?(:utxo_not_found)
end
@@ -731,9 +731,9 @@ defmodule OMG.State.CoreTest do
test "Output with zero value does not change oindex of other outputs", %{alice: alice, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}, {alice, 8}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}, {alice, 8}]), :no_fees_required)
|> success?
- |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 1}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1000, 0, 1, alice}], @eth, [{alice, 1}]), :no_fees_required)
|> success?
end
@@ -741,7 +741,7 @@ defmodule OMG.State.CoreTest do
test "Output with zero value will not be written to DB", %{alice: alice, state_alice_deposit: state} do
state =
state
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, [{alice, 0}]), :no_fees_required)
|> success?
{:ok, {_, _, db_updates}, _} = form_block_check(state)
@@ -752,7 +752,7 @@ defmodule OMG.State.CoreTest do
test "Transaction can have no outputs", %{alice: alice, state_empty: state} do
state
|> do_deposit(alice, %{amount: 10, currency: @eth, blknum: 1})
- |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, []), ::no_fees_required)
+ |> Core.exec(create_recovered([{1, 0, 0, alice}], @eth, []), :no_fees_required)
|> success?
end
@@ -769,20 +769,20 @@ defmodule OMG.State.CoreTest do
state
|> Core.exec(
create_recovered([{future_deposit_blknum, 0, 0, alice}], @eth, [{bob, 6}, {alice, 4}]),
- ::no_fees_required
+ :no_fees_required
)
|> fail?(:input_utxo_ahead_of_state)
state
|> Core.exec(
create_recovered([{1, 0, 0, alice}, {future_deposit_blknum, 0, 0, alice}], @eth, [{bob, 6}, {alice, 4}]),
- ::no_fees_required
+ :no_fees_required
)
|> fail?(:input_utxo_ahead_of_state)
# when non-existent input comes with a blknum of the current block fail with :utxo_not_found
state
- |> Core.exec(create_recovered([{@blknum1, 1, 0, alice}], @eth, [{bob, 6}, {alice, 4}]), ::no_fees_required)
+ |> Core.exec(create_recovered([{@blknum1, 1, 0, alice}], @eth, [{bob, 6}, {alice, 4}]), :no_fees_required)
|> fail?(:utxo_not_found)
end

diff:
@@ -173,7 +173,7 @@ defmodule OMG.State.PersistenceTest do
end
defp exec(state, tx) do
- assert {:ok, _, state} = Core.exec(state, tx, ::no_fees_required)
+ assert {:ok, _, state} = Core.exec(state, tx, :no_fees_required)
state
end

diff:
@@ -410,7 +410,7 @@ defmodule OMG.State.TransactionTest do
defp assert_tx_usable(signed, state_core) do
{:ok, transaction} = signed |> Transaction.Signed.encode() |> Transaction.Recovered.recover_from()
- assert {:ok, {_, _, _}, _state} = State.Core.exec(state_core, transaction, ::no_fees_required)
+ assert {:ok, {_, _, _}, _state} = State.Core.exec(state_core, transaction, :no_fees_required)
end
defp parametrized_tester({inputs, outputs}) do

diff:
@@ -55,7 +55,7 @@ defmodule OMG.StateTest do
assert true == State.utxo_exists?(Utxo.position(1, 0, 0))
assert {:ok, _} =
- State.exec(TestHelper.create_recovered([{1, 0, 0, alice}], @eth, [{alice, 3}]), ::no_fees_required)
+ State.exec(TestHelper.create_recovered([{1, 0, 0, alice}], @eth, [{alice, 3}]), :no_fees_required)
# block forming & status
assert {blknum, _} = State.get_status()

diff:
@@ -40,7 +40,7 @@ defmodule OMG.ChildChain.FeeServer do
args =
case Application.get_env(:omg_child_chain, :ignore_fees) do
true ->
- :ok = save_fees(::no_fees_required, 0)
+ :ok = save_fees(:no_fees_required, 0)
_ = Logger.warn("Fee specs from file are ignored.")
args

diff:
@@ -108,11 +108,11 @@ defmodule OMG.ChildChain.Integration.FeeServerTest do
end
test "fee server ignores file updates" do
- assert {:ok, ::no_fees_required} == FeeServer.transaction_fees()
+ assert {:ok, :no_fees_required} == FeeServer.transaction_fees()
assert refresh_fees() =~ "Updates takes no effect"
- assert {:ok, ::no_fees_required} == FeeServer.transaction_fees()
+ assert {:ok, :no_fees_required} == FeeServer.transaction_fees()
assert server_alive?()
end
end

diff:
@@ -108,7 +108,7 @@ defmodule OMG.Watcher.BlockGetter do
end
def handle_continue({:apply_block_step, :execute_transactions, block_application}, state) do
- tx_exec_results = for(tx <- block_application.transactions, do: OMG.State.exec(tx, ::no_fees_required))
+ tx_exec_results = for(tx <- block_application.transactions, do: OMG.State.exec(tx, :no_fees_required))
case Core.validate_executions(tx_exec_results, block_application, state) do
{:ok, state} ->

diff:
@@ -116,7 +116,7 @@ defmodule OMG.Watcher.BlockGetter.CoreTest do
_} = Core.get_blocks_to_apply(state, [%{blknum: block.number, eth_height: synced_height}], synced_height)
# check feasibility of transactions from block to consume at the OMG.State
- assert {:ok, tx_result, _} = OMG.State.Core.exec(state_alice_deposit, tx, ::no_fees_required)
+ assert {:ok, tx_result, _} = OMG.State.Core.exec(state_alice_deposit, tx, :no_fees_required)
assert {:ok, ^state} = Core.validate_executions([{:ok, tx_result}], block, state)

license: Apache License 2.0

repo: omgnetwork/elixir-omg

original_message: Fix failed replace all


diff:
@@ -33,9 +33,9 @@ services:
- "8000"
environment:
# DEPLOYER_PRIVATEKEY is the geth dev account initially funded address
- - DEPLOYER_PRIVATEKEY=d885a307e35738f773d8c9c63c7a3f3977819274638d04aaf934a1e1158513ce
- - MAINTAINER_PRIVATEKEY=6f30f140fd4724519e5017c0895f158d68bbbe4a81c0c10dbb25a0006e348807
- - AUTHORITY_PRIVATEKEY=7f30f140fd4724519e5017c0895f158d68bbbe4a81c0c10dbb25a0006e348807
+ - DEPLOYER_PRIVATEKEY=d885a307e35738f773d8c9c63c7a3f3977819274638d04aaf934a1e1158513ce # 0x6de4b3b9c28e9c3e84c2b2d3a875c947a84de68d
+ - MAINTAINER_PRIVATEKEY=6f30f140fd4724519e5017c0895f158d68bbbe4a81c0c10dbb25a0006e348807 # 0x59695413678e19d7d490893810a8ac9fe6cb0f5c
+ - AUTHORITY_PRIVATEKEY=7f30f140fd4724519e5017c0895f158d68bbbe4a81c0c10dbb25a0006e348807 # 0xc0f780dfc35075979b0def588d999225b7ecc56f
- REMOTE_URL=http://geth:8545
- MIN_EXIT_PERIOD=20
depends_on:
@@ -56,11 +56,23 @@ services:
- -c
- |
apk add --update curl
- # Add account to geth dev
+ # Configures geth with the deployer and authority accounts. This includes:
+ # 1. Configuring the deployer's keystore
+ # 2. Configuring the authority's keystore
+ # 3. Configuring the keystores' password
+ # 4. Unlocking the accounts by their indexes
mkdir -p /tmp/geth-dev
echo '{"address":"6de4b3b9c28e9c3e84c2b2d3a875c947a84de68d","crypto":{"cipher":"aes-128-ctr","ciphertext":"1adf32e70f22f7e775255b4e6aa0bb0b9338402f8ee2470b6c2ffce9d7d54918","cipherparams":{"iv":"38103d2e38263399e79884f8448172b0"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"eac5b9eee7c6cdf6557f9d84d02294801fd5d6ad67df6ec25a8fcb4dc0011e72"},"mac":"42bc14b9b00ef8387b46feb3f8599ffee82e50442b9d305ef7bfc0e9480566da"},"id":"8ba88812-cef4-44e7-888e-de40b8881120","version":3}' > /tmp/geth-dev/UTC--2019-10-29T05-54-49.573595611Z--6de4b3b9c28e9c3e84c2b2d3a875c947a84de68d
+ echo '{"address":"c0f780dfc35075979b0def588d999225b7ecc56f","crypto":{"cipher":"aes-128-ctr","ciphertext":"70af4aa4485c8bb750d6cc52800bf61eaef29e16460fb9b1dd3d225affc494d8","cipherparams":{"iv":"cdff3498ff1464bf4945642e80ed5187"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"80405b854cf1c1fa56557d060fc9075176463b47b75b535fce19840612d02b06"},"mac":"54bfa823a4bacb9c6a4cb95088fb72755cd0220e26adee4c356b22285d6a167f"},"id":"40c21866-79a2-46ce-990e-d2d77cf86bc3","version":3}' > /tmp/geth-dev/UTC--2019-11-06T08-20-13.587131000Z--c0f780dfc35075979b0def588d999225b7ecc56f
+ echo "" > /tmp/geth-blank-password
# Starts geth
- geth --miner.gastarget 7500000 --miner.gasprice "10" --dev --dev.period 1 --keystore=/tmp/geth-dev --rpc --rpcapi personal,web3,eth,net --rpcaddr 0.0.0.0 --rpcvhosts=* --rpcport=8545 --ws --wsaddr 0.0.0.0 --wsorigins='*'
+ geth --miner.gastarget 7500000 --miner.gasprice "10" \
+ --dev --dev.period 1 --keystore=/tmp/geth-dev \
+ --password /tmp/geth-blank-password \
+ --unlock "0,1" \
+ --miner.etherbase "0x6de4b3b9c28e9c3e84c2b2d3a875c947a84de68d" \
+ --rpc --rpcapi personal,web3,eth,net --rpcaddr 0.0.0.0 --rpcvhosts=* --rpcport=8545 \
+ --ws --wsaddr 0.0.0.0 --wsorigins='*'
ports:
- "8545:8545"
- "8546:8546"

original_message: fix: load both deployer and authority priv keys into docker-compose's geth (#1109)


diff:
@@ -60,7 +60,7 @@ executors:
metal_watcher_info:
machine: true
environment:
- watcher_info_IMAGE_NAME: "omisego/watcher_info"
+ WATCHER_INFO_IMAGE_NAME: "omisego/watcher_info"
commands:
setup_elixir-omg_workspace:
@@ -499,10 +499,10 @@ jobs:
- run: IMAGE_NAME=$WATCHER_IMAGE_NAME sh .circleci/ci_publish.sh
publish_watcher_info:
- executor: metal_watcher
+ executor: metal_watcher_info
steps:
- checkout
- - run: make docker-watcher_info WATCHER_INFO_IMAGE_NAME=$WATCHER_IMAGE_NAME
+ - run: make docker-watcher_info WATCHER_INFO_IMAGE_NAME=$WATCHER_INFO_IMAGE_NAME
- run: IMAGE_NAME=$WATCHER_INFO_IMAGE_NAME sh .circleci/ci_publish.sh
deploy_child_chain:

original_message: fix: circleci's watcher_info publish using wrong values (#1189)


message:
fix: pin mac brew install to solidity 0.5.11
* feat: pin solidity to 0.5.11 in bin/setup
* fix: temporarily add barebuild_macos to build-deploy workflow for testing
* Revert "fix: temporarily add barebuild_macos to build-deploy workflow for testing"
This reverts commit
* fix: add comment on pinning brew to solidity 0.5.11

old_path: bin/setup

new_path: bin/setup

diff:
@@ -90,7 +90,8 @@ brew "gmp"
brew "libtool"
brew "cmake"
brew "rocksdb"
-brew "solidity"
+# Pins solidity to 0.5.11
+brew "https://raw.githubusercontent.com/ethereum/homebrew-ethereum/7fa7027f20cca27f76c679d0c5b35ee3c565f284/solidity.rb"
EOF
}

original_message:
fix: pin mac brew install to solidity 0.5.11 (#1195)

* feat: pin solidity to 0.5.11 in bin/setup

* fix: temporarily add barebuild_macos to build-deploy workflow for testing

* Revert "fix: temporarily add barebuild_macos to build-deploy workflow for testing"

This reverts commit ba05bec3bfabc2af51304da9f75c6ca9ab90fa0e.

* fix: add comment on pinning brew to solidity 0.5.11


message: feat: add `mix xomg.watcher_info.start`

diff:
defmodule Mix.Tasks.Xomg.ChildChain.Start do
@moduledoc """
- Contains mix.task to run the child chain server
+ Contains mix.task to run the child chain server.
"""
use Mix.Task
import XomgTasks.Utils
- @shortdoc "Start the child chain server. See Mix.Tasks.ChildChain"
+ @shortdoc "Start the child chain server. See Mix.Tasks.Xomg.ChildChain.Start."
def run(args) do
args

diff:
defmodule Mix.Tasks.Xomg.Watcher.Start do
@moduledoc """
- Contains mix.task to run the watcher in different modes:
- a) mix xomg.watcher.start ----> security critical
- b) mix xomg.watcher.start --convenience ----> security critical + convenience api
+ Contains mix.task to run the watcher in security-critical only modes.
See the README.md file.
"""
@@ -24,17 +22,9 @@ defmodule Mix.Tasks.Xomg.Watcher.Start do
import XomgTasks.Utils
- @shortdoc "Starts the watcher. See Mix.Tasks.Watcher for possible options"
-
- def run(["--convenience" | args]) do
- start_watcher(args)
- end
+ @shortdoc "Starts the security-critical watcher. See Mix.Tasks.Watcher."
def run(args) do
- start_watcher(args)
- end
-
- defp start_watcher(args) do
args
|> generic_prepare_args()
|> generic_run([:omg_watcher, :omg_watcher_rpc])

change_type: ADD

diff:
+# Copyright 2019 OmiseGO Pte Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+defmodule Mix.Tasks.Xomg.WatcherInfo.Start do
+ @moduledoc """
+ Contains mix.task to run the watcher in security-critical + informational mode.
+
+ See the README.md file.
+ """
+ use Mix.Task
+
+ import XomgTasks.Utils
+
+ @shortdoc "Starts the security-critical + informational watcher. See Mix.Tasks.Xomg.WatcherInfo.Start."
+
+ def run(args) do
+ args
+ |> generic_prepare_args()
+ |> generic_run([:omg_watcher_info, :omg_watcher_rpc])
+ end
+end

diff:
@@ -60,7 +60,7 @@ defmodule XomgTasks.Utils do
# mix loads entire codebase which fools `Response.add_version`
defp ensure_one_rpc_loaded(apps) do
- if Enum.member?(apps, :omg_watcher) do
+ if Enum.member?(apps, :omg_watcher) || Enum.member?(apps, :omg_watcher_info) do
true = :code.delete(OMG.ChildChainRPC)
:code.purge(OMG.ChildChainRPC)
end

original_message: feat: add `mix xomg.watcher_info.start` (#1205)


diff:
@@ -67,12 +67,6 @@ services:
- ./localchain_contract_addresses.env
environment:
- ETHEREUM_NETWORK=LOCALCHAIN
- - AUTHORITY_ADDRESS=0xc0f780dfc35075979b0def588d999225b7ecc56f
- - TXHASH_CONTRACT=0xcd96b40b8324a4e10b421d6dd9796d200c64f7af6799f85262fa8951aed2f10c
- - CONTRACT_ADDRESS_PLASMA_FRAMEWORK=0xc673e4ffcb8464faff908a6804fe0e635af0ea2f
- - CONTRACT_ADDRESS_ETH_VAULT=0x0433420dee34412b5bf1e29fbf988ad037cc5db7
- - CONTRACT_ADDRESS_ERC20_VAULT=0x04badc20426bc146453c5b879417b25029fa6c73
- - CONTRACT_ADDRESS_PAYMENT_EXIT_GAME=0x1d92a9bef49bd340c7a11da536fb3ac9efbb1806
- ETHEREUM_RPC_URL=http://geth:8545
- ETHEREUM_WS_RPC_URL=ws://geth:8546
- CHILD_CHAIN_URL=http://childchain:9656

original_message: fix: remove orphaned envs that got re-introduced from parallel branches (#1223)


diff:
@@ -43,8 +43,10 @@ defmodule OMG.WatcherInfo.MixProject do
{:spandex, "~> 2.4",
git: "https://github.com/omisego/spandex.git", branch: "fix_dialyzer_in_macro", override: true},
{:distillery, "~> 2.1", runtime: false},
+ {:jason, "~> 1.0"},
# UMBRELLA
+ {:omg, in_umbrella: true},
{:omg_status, in_umbrella: true},
{:omg_utils, in_umbrella: true},

original_message: fix: add :jason and :omg as omg_watcher_info deps (#1284)


diff:
@@ -15,7 +15,6 @@ config :omg_eth,
eth_node: :geth,
child_block_interval: 1000,
min_exit_period_seconds: nil,
- ws_url: "ws://localhost:8546/ws",
ethereum_events_check_interval_ms: 8_000,
ethereum_stalled_sync_threshold_ms: 20_000,
node_logging_in_debug: false

diff:
@@ -21,6 +21,5 @@ config :omg_eth,
# of the umbrella project. This is useful because `mix test` and `mix coveralls --umbrella`
# have different views on the root dir when testing.
umbrella_root_dir: Path.join(__DIR__, "../../.."),
- ws_url: "ws://localhost:8546/ws",
eth_node: :geth,
run_test_eth_dev_node: true

diff:
@@ -26,9 +26,6 @@ defmodule OMG.Eth.ReleaseTasks.SetEthereumClient do
rpc_url = get_ethereum_rpc_url()
Application.put_env(:ethereumex, :url, rpc_url, persistent: true)
- ws_url = get_ethereum_ws_rpc_url()
- Application.put_env(@app, :ws_url, ws_url, persistent: true)
-
rpc_client_type = get_rpc_client_type()
Application.put_env(@app, :eth_node, rpc_client_type, persistent: true)
:ok
@@ -41,14 +38,6 @@ defmodule OMG.Eth.ReleaseTasks.SetEthereumClient do
url
end
- defp get_ethereum_ws_rpc_url() do
- url = validate_string(get_env("ETHEREUM_WS_RPC_URL"), Application.get_env(@app, :ws_url))
-
- _ = Logger.info("CONFIGURATION: App: #{@app} Key: ETHEREUM_WS_RPC_URL Value: #{inspect(url)}.")
-
- url
- end
-
defp get_rpc_client_type() do
rpc_client_type = validate_rpc_client_type(get_env("ETH_NODE"), Application.get_env(@app, :eth_node))
_ = Logger.info("CONFIGURATION: App: #{@app} Key: ETH_NODE Value: #{inspect(rpc_client_type)}.")

diff:
@@ -36,36 +36,29 @@ defmodule OMG.Eth.ReleaseTasks.SetEthereumClientTest do
test "if defaults are used when env vars are not set" do
url = Application.get_env(:ethereumex, :url)
- ws_url = Application.get_env(:omg_eth, :ws_url)
eth_node = Application.get_env(@app, :eth_node)
:ok = SetEthereumClient.init([])
^url = Application.get_env(:ethereumex, :url)
- ^ws_url = Application.get_env(:omg_eth, :ws_url)
^eth_node = Application.get_env(@app, :eth_node)
end
test "if values are used when env vars set" do
- :ok = System.put_env("ETHEREUM_WS_RPC_URL", "ws_url")
:ok = System.put_env("ETHEREUM_RPC_URL", "url")
:ok = System.put_env("ETH_NODE", "geth")
:ok = SetEthereumClient.init([])
"url" = Application.get_env(:ethereumex, :url)
- "ws_url" = Application.get_env(:omg_eth, :ws_url)
:geth = Application.get_env(@app, :eth_node)
:ok = System.put_env("ETH_NODE", "parity")
:ok = SetEthereumClient.init([])
"url" = Application.get_env(:ethereumex, :url)
- "ws_url" = Application.get_env(:omg_eth, :ws_url)
:parity = Application.get_env(@app, :eth_node)
:ok = System.put_env("ETH_NODE", "infura")
:ok = SetEthereumClient.init([])
"url" = Application.get_env(:ethereumex, :url)
- "ws_url" = Application.get_env(:omg_eth, :ws_url)
:infura = Application.get_env(@app, :eth_node)
# cleanup
- :ok = System.delete_env("ETHEREUM_WS_RPC_URL")
:ok = System.delete_env("ETHEREUM_RPC_URL")
:ok = System.delete_env("ETH_NODE")
end

old_path: bin/variables

new_path: bin/variables

diff:
@@ -6,7 +6,6 @@ export APP_ENV=local_development
export HOSTNAME=yolo
export DB_PATH=~/plasma-data/
export ETHEREUM_RPC_URL=http://127.0.0.1:8545
-export ETHEREUM_WS_RPC_URL=ws://127.0.0.1:8546
export ETH_NODE=geth
export ETHEREUM_NETWORK=LOCALCHAIN
export DATABASE_URL=postgresql://omisego_dev:omisego_dev@127.0.0.1:5432/omisego_dev

diff:
@@ -13,13 +13,11 @@ services:
childchain:
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
- PRIVATE_KEY=${AUTHORITY_PRIVATEKEY}
watcher:
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
geth:
# We don't need geth but docker-compose doesn't support overrides to remove or disable a service

diff:
@@ -21,7 +21,6 @@ services:
command: "full_local"
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
- CHILD_CHAIN_URL=https://childchain-pre-lumphini.omg.network/
- ETHEREUM_NETWORK=RINKEBY
- TXHASH_CONTRACT=0xefc216dcfb01223253172514355fbe65e60acc043f214a9cdfad1e6f5cb566b4
@@ -49,7 +48,6 @@ services:
command: "full_local"
environment:
- ETHEREUM_RPC_URL=https://rinkeby.infura.io/v3/${INFURA_API_KEY}
- - ETHEREUM_WS_RPC_URL=wss://rinkeby.infura.io/ws/v3/${INFURA_API_KEY}
- CHILD_CHAIN_URL=https://childchain-pre-lumphini.omg.network/
- ETHEREUM_NETWORK=RINKEBY
- TXHASH_CONTRACT=0xefc216dcfb01223253172514355fbe65e60acc043f214a9cdfad1e6f5cb566b4

diff:
@@ -29,6 +29,7 @@ services:
# 4. Unlocking the accounts by their indexes
echo "" > /tmp/geth-blank-password
# Starts geth
+ # Websocket is not used by the applications but enabled for debugging/testing convenience
geth --miner.gastarget 7500000 \
--miner.gasprice "10" \
--nodiscover \
@@ -65,14 +66,12 @@ services:
environment:
- ETHEREUM_NETWORK=LOCALCHAIN
- ETHEREUM_RPC_URL=http://geth:8545
- - ETHEREUM_WS_RPC_URL=ws://geth:8546
- ERLANG_COOKIE=develop
- NODE_HOST=127.0.0.1
- APP_ENV=local_development
- DD_HOSTNAME=datadog
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- - ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800
- ETHEREUM_STALLED_SYNC_THRESHOLD_MS=20000
- FEE_CLAIMER_ADDRESS=0x3b9f4c1dd26e0be593373b1d36cee2008cbeb837
@@ -99,7 +98,6 @@ services:
environment:
- ETHEREUM_NETWORK=LOCALCHAIN
- ETHEREUM_RPC_URL=http://geth:8545
- - ETHEREUM_WS_RPC_URL=ws://geth:8546
- CHILD_CHAIN_URL=http://childchain:9656
- ERLANG_COOKIE=develop
- NODE_HOST=127.0.0.1
@@ -108,7 +106,6 @@ services:
- DD_HOSTNAME=datadog
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- - ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800
- ETHEREUM_STALLED_SYNC_THRESHOLD_MS=20000
- EXIT_PROCESSOR_SLA_MARGIN=5520
@@ -135,7 +132,6 @@ services:
environment:
- ETHEREUM_NETWORK=LOCALCHAIN
- ETHEREUM_RPC_URL=http://geth:8545
- - ETHEREUM_WS_RPC_URL=ws://geth:8546
- CHILD_CHAIN_URL=http://childchain:9656
- DATABASE_URL=postgresql://omisego_dev:omisego_dev@postgres:5432/omisego_dev
- ERLANG_COOKIE=develop
@@ -145,7 +141,6 @@ services:
- DD_HOSTNAME=datadog
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- - ETHEREUM_HEIGHT_CHECK_INTERVAL_MS=800
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=800
- EXIT_PROCESSOR_SLA_MARGIN=5520
restart: always

diff:
- "APP_ENV" - environment name in which the the application was deployed *mandatory*
- "DB_PATH" - directory of the KV db *mandatory*
- "ETHEREUM_RPC_URL" - address of Geth or Parity instance *mandatory*
-- "ETHEREUM_WS_RPC_URL" - address of Geth or Parity instance with websocket flags *mandatory*
- "ETH_NODE" - Geth, Parity or Infura *mandatory*
- "SENTRY_DSN" - if not set, Sentry is disabled
- "DD_HOSTNAME" - Datadog hostname

original_message: refactor: remove websocket configurations (#1309)


diff:
@@ -27,8 +27,13 @@ defmodule OMG.WatcherRPC.Web.Plugs.SupportedWatcherModes do
@spec call(Plug.Conn.t(), [atom()]) :: Plug.Conn.t()
def call(conn, supported_modes) do
case Application.get_env(@app, :api_mode) in supported_modes do
- true -> conn
- false -> Controller.Fallback.call(conn, {:error, :operation_not_found})
+ true ->
+ conn
+
+ false ->
+ conn
+ |> Controller.Fallback.call({:error, :operation_not_found})
+ |> Plug.Conn.halt()
end
end
end

diff:
@@ -21,13 +21,13 @@ defmodule OMG.WatcherRPC.Web.Router do
end
pipeline :security_api do
- plug(SupportedWatcherModes, [:watcher, :watcher_info])
plug(:accepts, ["json"])
+ plug(SupportedWatcherModes, [:watcher, :watcher_info])
end
pipeline :info_api do
- plug(SupportedWatcherModes, [:watcher_info])
plug(:accepts, ["json"])
+ plug(SupportedWatcherModes, [:watcher_info])
end
# A note on scope ordering.

diff:
+# Copyright 2019-2020 OmiseGO Pte Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+defmodule OMG.WatcherRPC.Web.RouterTest do
+ # async: false as we need to change :api_mode application env.
+ use ExUnitFixtures
+ use ExUnit.Case, async: false
+ use OMG.WatcherInfo.Fixtures
+
+ alias Support.WatcherHelper
+
+ setup do
+ original_mode = Application.get_env(:omg_watcher_rpc, :api_mode)
+ _ = on_exit(fn -> Application.put_env(:omg_watcher_rpc, :api_mode, original_mode) end)
+
+ :ok
+ end
+
+ @tag fixtures: [:phoenix_ecto_sandbox]
+ test "returns a successful response when calling an :info_api endpoint from :watcher_info mode" do
+ :ok = Application.put_env(:omg_watcher_rpc, :api_mode, :watcher_info)
+ assert WatcherHelper.success?("transaction.all", %{})
+ end
+
+ @tag fixtures: [:phoenix_ecto_sandbox]
+ test "returns an error response when calling an :info_api endpoint from :watcher mode" do
+ :ok = Application.put_env(:omg_watcher_rpc, :api_mode, :watcher)
+
+ assert %{
+ "object" => "error",
+ "code" => "operation:not_found",
+ "description" => "Operation cannot be found. Check request URL."
+ } == WatcherHelper.no_success?("transaction.all", %{})
+ end
+end

original_message: fix: internal server error when making calls to unsupported endpoints (#1339)


message: fix: run CircleCI builds on tags

diff:
@@ -665,7 +665,12 @@ workflows:
requires: [build]
build-test-deploy:
jobs:
- - build
+ - build:
+ filters:
+ branches:
+ only: /.+/
+ tags:
+ only: /.+/
- test_barebone_release:
requires: [build]
- notify_services:

original_message: fix: run CircleCI builds on tags (#1366)


diff:
@@ -666,13 +666,14 @@ workflows:
build-test-deploy:
jobs:
- build:
- filters:
+ filters: &all_branches_and_tags
branches:
only: /.+/
tags:
only: /.+/
- test_barebone_release:
requires: [build]
+ filters: *all_branches_and_tags
- notify_services:
requires: [deploy_watcher, deploy_watcher_info, deploy_child_chain]
filters:
@@ -688,26 +689,37 @@ workflows:
- test
- child_chain_coveralls_and_integration_tests:
requires: [build]
+ filters: *all_branches_and_tags
- watcher_coveralls_and_integration_tests:
requires: [build]
+ filters: *all_branches_and_tags
- watcher_info_coveralls_and_integration_tests:
requires: [build]
+ filters: *all_branches_and_tags
- common_coveralls_and_integration_tests:
requires: [build]
+ filters: *all_branches_and_tags
- test_docker_compose_release:
requires: [build]
+ filters: *all_branches_and_tags
- lint:
requires: [build]
+ filters: *all_branches_and_tags
- lint_version:
requires: [build]
+ filters: *all_branches_and_tags
- sobelow:
requires: [build]
+ filters: *all_branches_and_tags
- dialyzer:
requires: [build]
+ filters: *all_branches_and_tags
- test:
requires: [build]
+ filters: *all_branches_and_tags
- property_tests:
requires: [build]
+ filters: *all_branches_and_tags
# Publish in case of master branch, version branches and version tags.
- publish_child_chain:
requires:
@@ -722,7 +734,7 @@ workflows:
lint,
lint_version,
]
- filters:
+ filters: &master_and_version_branches_and_all_tags
branches:
only:
- master
@@ -744,15 +756,7 @@ workflows:
lint,
lint_version,
]
- filters:
- branches:
- only:
- - master
- # vMAJOR.MINOR (e.g. v0.1, v0.2, v1.0, v2.1, etc.)
- - /^v[0-9]+\.[0-9]+/
- tags:
- only:
- - /.+/
+ filters: *master_and_version_branches_and_all_tags
- publish_watcher_info:
requires:
[
@@ -766,15 +770,7 @@ workflows:
lint,
lint_version,
]
- filters:
- branches:
- only:
- - master
- # vMAJOR.MINOR (e.g. v0.1, v0.2, v1.0, v2.1, etc.)
- - /^v[0-9]+\.[0-9]+/
- tags:
- only:
- - /.+/
+ filters: *master_and_version_branches_and_all_tags
# Release deploy to development in case of master branch.
- deploy_child_chain:
requires: [publish_child_chain, publish_watcher, publish_watcher_info]

original_message: fix: add tags filter to CircleCI workflow jobs (#1367)


diff:
@@ -17,12 +17,19 @@ AccountUtxoSchema:
txindex:
type: integer
format: int16
+ otype:
+ type: integer
+ format: int16
oindex:
type: integer
format: int8
utxo_pos:
type: integer
format: int256
+ creating_txhash:
+ type: string
+ spending_txhash:
+ type: string
owner:
type: string
currency:

diff:
@@ -822,10 +822,6 @@ paths:
amount:
type: integer
format: int256
- inserted_at:
- type: string
- updated_at:
- type: string
example:
data:
- blknum: 123000
@@ -836,8 +832,6 @@ paths:
owner: '0xb3256026863eb6ae5b06fa396ab09069784ea8ea'
currency: '0x0000000000000000000000000000000000000000'
amount: 10
- inserted_at: '2020-02-10T12:07:32Z'
- updated_at: '2020-02-15T04:07:57Z'
'500':
description: Returns an internal server error
content:

diff:
@@ -23,7 +23,3 @@ AccountUtxoSchema:
amount:
type: integer
format: int256
- inserted_at:
- type: string
- updated_at:
- type: string

original_message: fixing missing creating_txhash, spending_txhash, others... (#1396)


old_path: Makefile

new_path: Makefile

diff:
@@ -354,6 +354,7 @@ docker-nuke:
docker-compose down --remove-orphans
docker system prune --all
$(MAKE) clean
+ $(MAKE) init-contracts
docker-remote-watcher:
docker-compose exec watcher /watcher_entrypoint bin/watcher remote_console

original_message: feat: make docker-nuke should reset geth snapshot (#1386)


diff:
@@ -34,7 +34,7 @@ services:
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=8000
- - ETHEREUM_STALLED_SYNC_THRESHOLD_MS=60000
+ - ETHEREUM_STALLED_SYNC_THRESHOLD_MS=300000
- ETHEREUM_BLOCK_TIME_SECONDS=15
- EXIT_PROCESSOR_SLA_MARGIN=5520
- EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE
@@ -67,7 +67,7 @@ services:
- DD_DISABLED=true
- DB_PATH=/app/.omg/data
- ETHEREUM_EVENTS_CHECK_INTERVAL_MS=8000
- - ETHEREUM_STALLED_SYNC_THRESHOLD_MS=60000
+ - ETHEREUM_STALLED_SYNC_THRESHOLD_MS=300000
- ETHEREUM_BLOCK_TIME_SECONDS=15
- EXIT_PROCESSOR_SLA_MARGIN=5520
- EXIT_PROCESSOR_SLA_MARGIN_FORCED=TRUE

original_message: feat: update ropsten stall threshold to 300000s (#1456)


diff:
@@ -133,8 +133,8 @@ defmodule OMG.Status.Monitor.MemoryMonitor do
%{
total: Keyword.fetch!(data, :total_memory),
free: Keyword.fetch!(data, :free_memory),
- buffered: Keyword.fetch!(data, :buffered_memory),
- cached: Keyword.fetch!(data, :cached_memory)
+ buffered: Keyword.get(data, :buffered_memory, 0),
+ cached: Keyword.get(data, :cached_memory, 0)
}
end

diff:
@@ -58,6 +58,11 @@ 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
+ set_memsup(total_memory: 1000, free_memory: 100)
+ assert_receive :got_raise_alarm
+ end
+
defp set_memsup(memory_data) do
:sys.replace_state(__MODULE__.Memsup, fn _ -> memory_data end)
end

original_message: fix: allow missing :buffered_memory and :cached_memory (#1486)


diff:
## Unreleased
#### APIs
-- None
+- [Fixed] Proper error message when retrieving In-Flight Exit data for a spent deposit (#1397)
#### Core
-- None
+- [Added] Build adapter to pull fees from the fee feed service (#1373)
+- [Fixed] Add retries to gas cost retrieval (#1434)
#### Miscellaneous
-- None
+- [Added] Move load tests to elixir-omg repo (#1403, #1429)
+- [Changed] Clean up documentation for ExitProcessor, OMG.State and RootChainCoordinator(#1410)
+- [Changed] Update Spandex (tracing library) to 2.4.3 (#1432)
+- [Changed] Move nightly build steps into PR's non-mandatory build steps (#1287)
## [v0.4.6](https://github.com/omisego/elixir-omg/releases/tag/v0.4.6)

old_path: VERSION

new_path: VERSION

original_message: feat: prepare CHANGELOG and VERSION for v0.4.7 (#1442)


diff:
@@ -199,11 +199,11 @@ jobs:
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
- _tagged_version="${CIRCLE_TAG#*v}"
+ _tagged_version_ignoring_pre="${${CIRCLE_TAG#*v}%%-pre.*}"
_filed_version="$(head -n 1 ./VERSION | sed 's/^[ \t]*//;s/[ \t]*$//')"
- if [ "$_tagged_version" != "$_filed_version" ]; then
- echo "The git tag \"${CIRCLE_TAG}\" expects the VERSION to be \"${_tagged_version}\". Got \"${_filed_version}\"."
+ if [ "$_tagged_version_ignoring_pre" != "$_filed_version" ]; then
+ echo "The git tag \"${CIRCLE_TAG}\" expects the VERSION to be \"${_tagged_version_ignoring_pre}\". Got \"${_filed_version}\"."
exit 1
fi
else

original_message: fix: lint_version CI job to let pre-release versions match VERSION (#1443)


message: fix: sentry logging tags should be maps

diff:
@@ -47,14 +47,14 @@ defmodule OMG.Status.ReleaseTasks.SetSentry do
environment_name: app_env,
included_environments: [app_env],
server_name: hostname,
- tags: [
+ tags: %{
application: release,
eth_network: get_env("ETHEREUM_NETWORK"),
eth_node: get_rpc_client_type(),
current_version: "vsn-#{current_version}",
app_env: "#{app_env}",
hostname: "#{hostname}"
- ]
+ }
]
)

diff:
@@ -50,14 +50,14 @@ defmodule OMG.Status.ReleaseTasks.SetSentryTest do
environment_name: yolo,
included_environments: [yolo],
server_name: server_name,
- tags: [
+ tags: %{
application: :watcher,
eth_network: network,
eth_node: :geth,
current_version: "vsn-" <> current_version,
app_env: yolo,
hostname: server_name
- ]
+ }
]
]

original_message: fix: sentry logging tags should be maps (#1489)


diff:
@@ -199,7 +199,8 @@ jobs:
- run:
command: |
if [ -n "$CIRCLE_TAG" ]; then
- _tagged_version_ignoring_pre="${${CIRCLE_TAG#*v}%%-pre.*}"
+ _tagged_version="${CIRCLE_TAG#*v}"
+ _tagged_version_ignoring_pre="${_tagged_version%%-pre.*}"
_filed_version="$(head -n 1 ./VERSION | sed 's/^[ \t]*//;s/[ \t]*$//')"
if [ "$_tagged_version_ignoring_pre" != "$_filed_version" ]; then

original_message: fix: lint_version command compatibility with bash (#1502)


diff:
@@ -39,7 +39,7 @@ defmodule OMG.Status.Mixfile do
{:spandex_datadog, "~> 0.4"},
{:decorator, "~> 1.2"},
{:vmstats, "~> 2.3", runtime: false},
- {:ink, "~> 1.0"},
+ {:ink, "~> 1.1"},
# umbrella apps
{:omg_bus, in_umbrella: true}
]

original_message: feat: update ink to v1.1 to fix Mix module not found (#1504)


diff:
@@ -20,7 +20,7 @@ defmodule OMG.ChildChain.BlockQueue.GasPriceAdjustment do
defstruct eth_gap_without_child_blocks: 2,
gas_price_lowering_factor: 0.9,
gas_price_raising_factor: 2.0,
- max_gas_price: 20_000_000_000,
+ max_gas_price: 85_000_000_000,
last_block_mined: nil
@type t() :: %__MODULE__{

original_message: feat: update max_gas_price to 85_000_000 (#1524)


diff:
@@ -74,7 +74,7 @@ defmodule OMG.ChildChain.Monitor do
# flush
def handle_event(event, state) do
- _ = Logger.info("Monitor got event: #{inspect(event)}. Ignoring.")
+ _ = Logger.info("#{__MODULE__} got event: #{inspect(event)}. Ignoring.")
{:ok, state}
end

diff:
@@ -111,7 +111,7 @@ defmodule OMG.Status.Monitor.MemoryMonitor do
end
def handle_event(event, state) do
- _ = Logger.info("#{inspect(__MODULE__)} got event: #{inspect(event)}. Ignoring.")
+ _ = Logger.info("#{__MODULE__} got event: #{inspect(event)}. Ignoring.")
{:ok, state}
end

diff:
@@ -108,7 +108,7 @@ defmodule OMG.Status.Monitor.StatsdMonitor do
# flush
def handle_event(event, state) do
- _ = Logger.info("inspect(#{__MODULE__}) got event: #{inspect(event)}. Ignoring.")
+ _ = Logger.info("#{__MODULE__} got event: #{inspect(event)}. Ignoring.")
{:ok, state}
end

diff:
@@ -73,7 +73,7 @@ defmodule OMG.Watcher.Monitor do
# flush
def handle_event(event, state) do
- _ = Logger.info("Monitor got event: #{inspect(event)}. Ignoring.")
+ _ = Logger.info("#{__MODULE__} got event: #{inspect(event)}. Ignoring.")
{:ok, state}
end

original_message: refactor: consistent log message for new events (#1534)


diff:
@@ -99,10 +99,7 @@ jobs:
source ~/.bash_profile
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
- asdf install erlang 22.3
- asdf install elixir 1.10.2
- asdf global elixir 1.10.2
- asdf global erlang 22.3
+ asdf install
- run: make init_test
- run:
command: ./bin/setup
@@ -467,10 +464,7 @@ jobs:
source $BASH_ENV
asdf plugin-add erlang || asdf plugin-update erlang
asdf plugin-add elixir || asdf plugin-update elixir
- asdf install erlang 22.3
- asdf install elixir 1.10.2
- asdf global elixir 1.10.2
- asdf global erlang 22.3
+ asdf install
no_output_timeout: 2400
- save_cache:
key: v2-asdf-install
@@ -565,10 +559,7 @@ jobs:
source $BASH_ENV
asdf plugin-add erlang || asdf plugin-update erlang
asdf plugin-add elixir || asdf plugin-update elixir
- asdf install erlang 22.3
- asdf install elixir 1.10.2
- asdf global elixir 1.10.2
- asdf global erlang 22.3
+ asdf install
no_output_timeout: 2400
- save_cache:
key: v2-asdf-install
@@ -628,10 +619,7 @@ jobs:
source $BASH_ENV
asdf plugin-add erlang || asdf plugin-update erlang
asdf plugin-add elixir || asdf plugin-update elixir
- asdf install erlang 22.3
- asdf install elixir 1.10.2
- asdf global elixir 1.10.2
- asdf global erlang 22.3
+ asdf install
no_output_timeout: 2400
- save_cache:
key: v2-asdf-install

old_path: .gitignore

new_path: .gitignore

diff:
@@ -79,7 +79,3 @@ localchain_contract_addresses.env
#vs code
.tool_versions
-
-# asdf version
-.tool-versions
-

new_path: .tool-versions

diff:
+erlang 22.3
+elixir 1.10.2

diff:
@@ -128,10 +128,8 @@ install_deps
#Linux and MacOS
#asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
#asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
-#asdf install erlang 22.3
-#asdf install elixir 1.10.2
-#asdf global elixir 1.10.2
-#asdf global erlang 22.3
+#asdf install
+
if ! command -v mix > /dev/null; then
fancy_echo "It looks like you don't have Elixir installed."
echo "See https://asdf-vm.com/#/core-manage-asdf-vm for instructions."

original_message: feat: pin elixir and erlang versions for asdf (#1648)


diff:
@@ -21,6 +21,7 @@ defmodule OMG.ChildChain.BlockQueue.SubmissionMonitor do
require Logger
defstruct pending_blocks: [],
+ last_mined_blknum: 0,
root_chain_height: 0,
stall_threshold_blocks: 4,
alarm_module: nil,
@@ -31,6 +32,7 @@ defmodule OMG.ChildChain.BlockQueue.SubmissionMonitor do
@type t() :: %__MODULE__{
pending_blocks: [pending_block()],
+ last_mined_blknum: non_neg_integer(),
root_chain_height: non_neg_integer(),
stall_threshold_blocks: pos_integer(),
alarm_module: module(),
@@ -87,16 +89,26 @@ defmodule OMG.ChildChain.BlockQueue.SubmissionMonitor do
{:noreply, %{state | root_chain_height: new_height}}
end
- # Listens for a block being submitted and add it to monitoring if it hasn't been tracked
+ # Listens for :block_submitting and adds its blknum to monitoring if it's not being monitored.
+ #
+ # Sometimes a block is resubmitted even after it's been mined on the rootchain due to
+ # rootchain node and network latency. So we ignore the submitting blknums that are below
+ # :last_mined_blknum while add the rest to monitoring.
+ def handle_info({:internal_event_bus, :block_submitting, blknum}, %{last_mined_blknum: mined} = state)
+ when blknum <= mined do
+ {:noreply, state}
+ end
+
+ # Monitors the rest of :block_submitting that are not mined yet
def handle_info({:internal_event_bus, :block_submitting, blknum}, state) do
pending_blocks = add_new_blknum(state.pending_blocks, blknum, state.root_chain_height)
{:noreply, %{state | pending_blocks: pending_blocks}}
end
- # Listens for a block that got submitted and drop it from monitoring
+ # Listens for a block that got mined and drops it from monitoring
def handle_info({:internal_event_bus, :block_submitted, blknum}, state) do
pending_blocks = remove_blknum(state.pending_blocks, blknum)
- {:noreply, %{state | pending_blocks: pending_blocks}}
+ {:noreply, %{state | pending_blocks: pending_blocks, last_mined_blknum: blknum}}
end
# Ignore unrelated events
@@ -131,9 +143,10 @@ defmodule OMG.ChildChain.BlockQueue.SubmissionMonitor do
end
end
+ # Remove all pending_blknum that are below or equal to the given mined blknum
@spec remove_blknum([{blknum(), any()}], blknum()) :: [pending_block()]
- defp remove_blknum(pending_blocks, blknum) do
- Enum.reject(pending_blocks, fn {pending_blknum, _} -> pending_blknum == blknum end)
+ defp remove_blknum(pending_blocks, mined_blknum) do
+ Enum.reject(pending_blocks, fn {pending_blknum, _} -> pending_blknum <= mined_blknum end)
end
#

diff:
@@ -64,7 +64,23 @@ defmodule OMG.ChildChain.BlockQueue.SubmissionMonitorTest do
# Push the height just below the stalling height
_ = send(context.monitor, {:internal_event_bus, :ethereum_new_height, context.stall_threshold_blocks - 1})
- # Wait for 10x the check interval to make sure it really does not get raised again.
+ # Wait for 10x the check interval to make sure the alarm really does not get raised.
+ refute_receive(:got_raise_alarm, context.check_interval_ms * 10)
+ end)
+ end
+
+ test "does not raise :block_submit_stalled alarm when the submitting block is below the last mined block", context do
+ capture_log(fn ->
+ # Inform the monitor of a mined block
+ _ = send(context.monitor, {:internal_event_bus, :block_submitted, 2000})
+
+ # Inform the monitor of a pending block lower than the mined block
+ _ = send(context.monitor, {:internal_event_bus, :block_submitting, 1000})
+
+ # Push the height to the stalling height
+ _ = send(context.monitor, {:internal_event_bus, :ethereum_new_height, context.stall_threshold_blocks})
+
+ # Wait for 10x the check interval to make sure the alarm really does not get raised.
refute_receive(:got_raise_alarm, context.check_interval_ms * 10)
end)
end

original_message: fix: ignore block_submitting that are above mined blocks (#1703)


message:
fix: recheck PR label on synchronize and reopen
* fix: recheck PR label on synchronize and reopen
* test: a pointless commit to check that the enforce-changelog-label job still passes
* debug: try the fixed
* Revert "debug: try the fixed feefeed"
This reverts commit

diff:
@@ -2,7 +2,7 @@ name: Enforce changelog labels
on:
pull_request:
- types: [opened, labeled, unlabeled]
+ types: [opened, labeled, unlabeled, synchronize, reopened]
branches: [master]
jobs:
@@ -16,7 +16,6 @@ jobs:
id: check-changelog-label
run: |
set -o xtrace
-
# Using the issues API instead of pulls because it can return only the labels
curl "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/labels" \
| grep -o '"name": "[^"]*' \

original_message:
fix: recheck PR label on synchronize and reopen (#1748)

* fix: recheck PR label on synchronize and reopen

* test: a pointless commit to check that the enforce-changelog-label job still passes

* debug: try the fixed feefeed

* Revert "debug: try the fixed feefeed"

This reverts commit a35fc90e8911c41b67aec76821ff73605b1885e5.