Skip to content

Commit

Permalink
chore: update node to 6.8.1 (#1223)
Browse files Browse the repository at this point in the history
* chore: update node to 6.8.1

* fix: ignore errored event transactions

* fix: avoid reverting events and use Call.clone fnames for contracts

* fix: always include contract create function call events
  • Loading branch information
sborrazas committed May 15, 2023
1 parent b953668 commit f96f56c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ WORKDIR /home/aeternity/node

# Download, and unzip latest aeternity release archive
ENV NODEROOT=/home/aeternity/node/local
ARG NODE_VERSION=6.7.0
ARG NODE_VERSION=6.8.1
ARG NODE_URL=https://github.com/aeternity/aeternity/releases/download/v${NODE_VERSION}/aeternity-v${NODE_VERSION}-ubuntu-x86_64.tar.gz
ENV NODEDIR=/home/aeternity/node/local/rel/aeternity
RUN mkdir -p ./local/rel/aeternity/data/mnesia
Expand Down
7 changes: 5 additions & 2 deletions lib/ae_mdw/contract.ex
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,17 @@ defmodule AeMdw.Contract do
prev_hash = :aec_block_insertion.node_prev_hash(node)
prev_key_hash = :aec_block_insertion.node_prev_key_hash(node)
{:value, prev_key_header} = :aec_db.find_header(prev_key_hash)
{:value, trees_in, _, _, _, _} = :aec_db.find_block_state_and_data(prev_hash, true)

{:value, trees_in, _difficulty, _fork_id, _fees, _fraud} =
:aec_db.find_block_state_and_data(prev_hash, true)

trees_in = consensus.state_pre_transform_micro_node(node, trees_in)
env = :aetx_env.tx_env_from_key_header(prev_key_header, prev_key_hash, time, prev_hash)

{:ok, _, _, events} =
:aec_block_micro_candidate.apply_block_txs_strict(txs_taken, trees_in, env)

Enum.reverse(events)
events
else
[]
end
Expand Down
18 changes: 14 additions & 4 deletions lib/ae_mdw/db/sync/contract.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ defmodule AeMdw.Db.Sync.Contract do

@type call_record() :: tuple()

@contract_create_fnames ~w(Chain.create Chain.clone Call.clone)

@spec child_contract_mutations(
Contract.fun_arg_res_or_error(),
Blocks.block_index(),
Expand Down Expand Up @@ -55,6 +57,16 @@ defmodule AeMdw.Db.Sync.Contract do
Mutation.t()
]
def events_mutations(events, block_index, call_txi, call_tx_hash, contract_pk) do
events =
Enum.filter(
events,
&match?(
{{:internal_call_tx, fname}, %{info: aetx}}
when is_tuple(aetx) or fname in @contract_create_fnames,
&1
)
)

shifted_events = [nil | events]

# This function relies on a property that every Chain.clone and Chain.create
Expand All @@ -63,10 +75,8 @@ defmodule AeMdw.Db.Sync.Contract do
{chain_events, non_chain_events} =
shifted_events
|> Enum.zip(events)
|> Enum.split_with(fn
{_prev_event, {{:internal_call_tx, "Chain.create"}, _info}} -> true
{_prev_event, {{:internal_call_tx, "Chain.clone"}, _info}} -> true
{_prev_event, {{:internal_call_tx, _fname}, _info}} -> false
|> Enum.split_with(fn {_prev_event, {{:internal_call_tx, fname}, _info}} ->
fname in @contract_create_fnames
end)

chain_mutations =
Expand Down

0 comments on commit f96f56c

Please sign in to comment.