Skip to content

Commit

Permalink
chore: upgrade to node 6.11 (#1483)
Browse files Browse the repository at this point in the history
* chore: upgrade to node 6.11

* fix: get node for accounts tree

* test: add mock needed for contract calls
  • Loading branch information
jyeshe authored Sep 5, 2023
1 parent dc0aecc commit dc4d90d
Show file tree
Hide file tree
Showing 26 changed files with 72 additions and 927 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Dockerhub Pipeline

on:
push:
branches:
- develop
tags:
- v*

Expand All @@ -17,13 +19,18 @@ jobs:
with:
fetch-depth: 100

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Extract metadata for docker
id: meta
uses: docker/metadata-action@v4
with:
images: aeternity/ae_mdw
tags: |
type=raw,value=master,enable={{is_default_branch}}
type=raw,value=${{ steps.extract_branch.outputs.branch }},enable=true
type=sha,prefix=,enable={{is_default_branch}}
type=semver,pattern={{version}},enable=true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ WORKDIR /home/aeternity/node
ARG DEV_MODE="false"
ENV DEV_MODE=${DEV_MODE}
ENV NODEROOT=/home/aeternity/node/local
ARG NODE_VERSION=6.8.1
ARG NODE_VERSION=6.11.0
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
2 changes: 1 addition & 1 deletion lib/ae_mdw/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ defmodule AeMdw.Application do

defp init(:meta) do
{:ok, chain_state_code} = Extract.AbsCode.module(:aec_chain_state)
[:header, :hash, :type] = NodeHelper.record_keys(chain_state_code, :node)
[:header, :hash, :type | _txs] = NodeHelper.record_keys(chain_state_code, :node)

{:ok, aetx_code} = Extract.AbsCode.module(:aetx)
{:ok, aeser_code} = Extract.AbsCode.module(:aeser_api_encoder)
Expand Down
3 changes: 1 addition & 2 deletions lib/ae_mdw/contract.ex
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,8 @@ defmodule AeMdw.Contract do

if txs_taken != [] do
header = :aec_blocks.to_header(micro_block)
{:ok, hash} = :aec_headers.hash_header(header)
consensus = :aec_headers.consensus_module(header)
node = {:node, header, hash, :micro}
node = :aec_chain_state.wrap_block(micro_block)
time = :aec_block_insertion.node_time(node)
prev_hash = :aec_block_insertion.node_prev_hash(node)
prev_key_hash = :aec_block_insertion.node_prev_key_hash(node)
Expand Down
9 changes: 6 additions & 3 deletions lib/ae_mdw/db/int_transfer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,24 @@ defmodule AeMdw.Db.IntTransfer do
@typep optional_txi_idx() :: Txs.optional_txi_idx()
@typep height_optional_txi_idx() :: {Blocks.height(), optional_txi_idx()}
@typep kind_suffix() :: :lock_name | :spend_name | :refund_name | :earn_oracle | :refund_oracle
@opaque key_block() :: tuple()

@fee_kinds [:lock_name, :spend_name, :refund_name, :earn_oracle, :refund_oracle]

@reward_block_kind "reward_block"
@reward_dev_kind "reward_dev"

@spec block_rewards_mutations(Blocks.height(), Blocks.key_header(), Blocks.block_hash()) :: [
@spec block_rewards_mutations(key_block()) :: [
Mutation.t()
]
def block_rewards_mutations(height, key_header, key_hash) do
def block_rewards_mutations(key_block) do
height = :aec_blocks.height(key_block)
delay = :aec_governance.beneficiary_reward_delay()
dev_benefs = Enum.map(:aec_dev_reward.beneficiaries(), &elem(&1, 0))

{devs_rewards, miners_rewards} =
{:node, key_header, key_hash, :key}
key_block
|> :aec_chain_state.wrap_block()
|> :aec_chain_state.grant_fees(:aec_trees.new(), delay, false, nil)
|> :aec_trees.accounts()
|> :aeu_mtrees.to_list()
Expand Down
2 changes: 1 addition & 1 deletion lib/ae_mdw/db/sync/block.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ defmodule AeMdw.Db.Sync.Block do
block_rewards_mutation =
if height >= AE.min_block_reward_height() and
:aec_consensus_hc != :aec_consensus.get_genesis_consensus_module() do
IntTransfer.block_rewards_mutations(height, kb_header, kb_hash)
IntTransfer.block_rewards_mutations(key_block)
end

gen_mutations = [
Expand Down
11 changes: 7 additions & 4 deletions lib/ae_mdw/node/db.ex
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,18 @@ defmodule AeMdw.Node.Db do

defp block_accounts_tree(mb_hash) do
{:value, micro_block} = :aec_db.find_block(mb_hash)
header = :aec_blocks.to_header(micro_block)
{:ok, hash} = :aec_headers.hash_header(header)
consensus_mod = :aec_headers.consensus_module(header)
node = {:node, header, hash, :micro}

node = :aec_chain_state.wrap_block(micro_block)
prev_hash = :aec_block_insertion.node_prev_hash(node)

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

consensus_mod =
micro_block
|> :aec_blocks.to_header()
|> :aec_headers.consensus_module()

node
|> consensus_mod.state_pre_transform_micro_node(trees_in)
|> :aec_trees.accounts()
Expand Down
26 changes: 0 additions & 26 deletions priv/migrations/20230217145700_add_template_edition.ex

This file was deleted.

43 changes: 0 additions & 43 deletions priv/migrations/20230329160010_index_inner_tx.ex

This file was deleted.

38 changes: 0 additions & 38 deletions priv/migrations/20230404095010_update_total_supply.ex

This file was deleted.

84 changes: 0 additions & 84 deletions priv/migrations/20230412085004_index_event_supply.ex

This file was deleted.

57 changes: 0 additions & 57 deletions priv/migrations/20230413115004_index_logs_count.ex

This file was deleted.

Loading

0 comments on commit dc4d90d

Please sign in to comment.