Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
ARG ELIXIR_VERSION=1.17.3
ARG OTP_VERSION=26.2.5.3
ARG NODE_VERSION=7.3.0-rc5
ARG NODE_VERSION=7.3.0-rc7

ARG NODE_IMAGE=aeternity/aeternity:v${NODE_VERSION}
ARG UBUNTU_VERSION=focal-20240918
Expand Down Expand Up @@ -114,8 +114,8 @@ RUN mix release
FROM ${RUNNER_IMAGE}

RUN apt-get update -y && apt-get install -y git curl libstdc++6 openssl libncurses5 locales libncurses5 libsodium-dev libgmp10 libsnappy-dev libgflags2.2 \
&& ldconfig \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
&& ldconfig \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*

# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
Expand Down
2 changes: 2 additions & 0 deletions lib/ae_mdw/db/hardfork_presets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ defmodule AeMdw.Db.HardforkPresets do
defp accounts(:roma), do: :aec_fork_block_settings.genesis_accounts()
defp accounts(:minerva), do: :aec_fork_block_settings.minerva_accounts()
defp accounts(:fortuna), do: :aec_fork_block_settings.fortuna_accounts()

defp accounts(:lima) do
contract_account =
Node.lima_contracts()
Expand All @@ -59,6 +60,7 @@ defmodule AeMdw.Db.HardforkPresets do
Node.lima_accounts() ++
Node.lima_extra_accounts()
end

defp accounts(:iris), do: %{}
defp accounts(:ceres), do: %{}

Expand Down
14 changes: 7 additions & 7 deletions lib/ae_mdw/node.ex
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,13 @@ defmodule AeMdw.Node do

defmemop token_supply_delta() do
:aec_hard_forks.protocols()
|> Map.keys()
|> Enum.sort()
|> Enum.map(fn proto ->
proto_vsn = :aec_hard_forks.protocol_vsn_name(proto)
{HardforkPresets.hardfork_height(proto_vsn), HardforkPresets.mint_sum(proto_vsn)}
end)
|> Map.new()
|> Map.keys()
|> Enum.sort()
|> Enum.map(fn proto ->
proto_vsn = :aec_hard_forks.protocol_vsn_name(proto)
{HardforkPresets.hardfork_height(proto_vsn), HardforkPresets.mint_sum(proto_vsn)}
end)
|> Map.new()
end

defmemop tx_ids_positions() do
Expand Down
2 changes: 1 addition & 1 deletion lib/ae_mdw/transfers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defmodule AeMdw.Transfers do
@typep pagination :: Collection.direction_limit()
@typep range :: {:gen, Range.t()} | {:txi, Range.t()} | nil

@hardforks_accounts ~w(accounts_genesis accounts_minerva accounts_fortuna accounts_lima)
@hardforks_accounts ~w(accounts_roma accounts_minerva accounts_fortuna accounts_lima)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

accounts_genesis to accounts_roma renaming is needed because of #2163
They ran only the commit message linter in CI, so they probably missed broken tests
CI tests failed in the release after that change 🙈

@kinds ~w(fee_lock_name fee_refund_name fee_spend_name reward_block reward_dev reward_oracle) ++
@hardforks_accounts

Expand Down
21 changes: 16 additions & 5 deletions lib/ae_mdw_web/websocket/broadcaster.ex
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,23 @@ defmodule AeMdwWeb.Websocket.Broadcaster do
type = :aec_headers.type(header)
channel = Map.fetch!(@block_subs, type)

with {:ok, block} <- serialize_block(header, type, source, version) do
block
|> Map.merge(counters)
|> encode_message(channel, source)
|> broadcast(channel, source, version)
case serialize_block(header, type, source, version) do
{:ok, block} ->
block
|> Map.merge(counters)
|> encode_message(channel, source)
|> broadcast(channel, source, version)

{:error, reason} ->
require Logger
Logger.warning("[broadcaster] serialize_block failed: #{inspect(reason)}")
{:error, reason}
end
rescue
e ->
require Logger
Logger.warning("[broadcaster] do_broadcast_block exception: #{inspect(e)}")
{:error, e}
end

defp serialize_block(header, :key, :mdw, version) when version in [:v2, :v3] do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
defmodule AeMdw.Migrations.AddRomaAccountBalancesToTotalSupply do
@moduledoc """
Adds Roma hardfork account balances to total supply for all heights.
"""

alias AeMdw.Db.HardforkPresets
alias AeMdw.Db.Model
alias AeMdw.Db.RocksDbCF
Expand All @@ -13,11 +17,12 @@ defmodule AeMdw.Migrations.AddRomaAccountBalancesToTotalSupply do
Model.TotalStat
|> RocksDbCF.stream()
|> Enum.map(fn Model.total_stat(index: height, total_supply: old_total_supply) ->
new_total_supply = old_total_supply + HardforkPresets.mint_sum(:roma)
WriteMutation.new(
Model.TotalStat,
Model.total_stat(index: height, total_supply: new_total_supply)
)
new_total_supply = old_total_supply + HardforkPresets.mint_sum(:roma)

WriteMutation.new(
Model.TotalStat,
Model.total_stat(index: height, total_supply: new_total_supply)
)
end)

_state = State.commit_db(state, mutations)
Expand Down
8 changes: 4 additions & 4 deletions test/ae_mdw/db/hardfork_presets_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ defmodule AeMdw.Db.HardforkPresetsTest do
State.new()
|> Collection.stream(
Model.KindIntTransferTx,
{"accounts_genesis", nil, nil, nil}
{"accounts_roma", nil, nil, nil}
)
|> Stream.take_while(&match?({"accounts_genesis", _bi, _target, _txi}, &1))
|> Stream.take_while(&match?({"accounts_roma", _bi, _target, _txi}, &1))
|> Enum.count()

assert 325 ==
Expand Down Expand Up @@ -79,9 +79,9 @@ defmodule AeMdw.Db.HardforkPresetsTest do
State.new()
|> Collection.stream(
Model.KindIntTransferTx,
{"accounts_genesis", nil, nil, nil}
{"accounts_roma", nil, nil, nil}
)
|> Stream.take_while(&match?({"accounts_genesis", _bi, _target, _txi}, &1))
|> Stream.take_while(&match?({"accounts_roma", _bi, _target, _txi}, &1))
|> Enum.count()

assert 3 ==
Expand Down
4 changes: 2 additions & 2 deletions test/ae_mdw_web/controllers/transfer_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule AeMdwWeb.TransferControllerTest do
assert Enum.count(response["data"]) == 100

assert Enum.all?(response["data"], fn %{"kind" => kind, "height" => height} ->
kind == "accounts_genesis" and height == 0
kind == "accounts_roma" and height == 0
end)

conn_next = get(conn, response["next"])
Expand All @@ -29,7 +29,7 @@ defmodule AeMdwWeb.TransferControllerTest do
assert Enum.count(response_next["data"]) == 100

assert Enum.all?(response_next["data"], fn %{"kind" => kind, "height" => height} ->
kind == "accounts_genesis" and height == 0
kind == "accounts_roma" and height == 0
end)
end

Expand Down
Loading