diff --git a/lib/archethic/account/mem_tables_loader.ex b/lib/archethic/account/mem_tables_loader.ex index fdae6d8f2..eacb93c0f 100644 --- a/lib/archethic/account/mem_tables_loader.ex +++ b/lib/archethic/account/mem_tables_loader.ex @@ -40,7 +40,8 @@ defmodule ArchEthic.Account.MemTablesLoader do :oracle, :oracle_summary, :node_shared_secrets, - :origin_shared_secrets + :origin_shared_secrets, + :on_chain_wallet ] def start_link(args \\ []) do diff --git a/lib/archethic/crypto.ex b/lib/archethic/crypto.ex index 7082fa28f..bd2ccaf71 100755 --- a/lib/archethic/crypto.ex +++ b/lib/archethic/crypto.ex @@ -63,7 +63,7 @@ defmodule ArchEthic.Crypto do @typedoc """ List of the supported key origins """ - @type supported_origin :: :software | :tpm + @type supported_origin :: :software | :tpm | :on_chain_wallet @typedoc """ Binary representing a hash prepend by a single byte to identify the algorithm of the generated hash @@ -346,12 +346,12 @@ defmodule ArchEthic.Crypto do iex> {pub, _} = Crypto.generate_deterministic_keypair("myseed") iex> pub - <<0, 0, 91, 43, 89, 132, 233, 51, 190, 190, 189, 73, 102, 74, 55, 126, 44, 117, 50, + <<0, 1, 91, 43, 89, 132, 233, 51, 190, 190, 189, 73, 102, 74, 55, 126, 44, 117, 50, 36, 220, 249, 242, 73, 105, 55, 83, 190, 3, 75, 113, 199, 247, 165>> iex> {pub, _} = Crypto.generate_deterministic_keypair("myseed", :secp256r1) iex> pub - <<1, 0, 4, 140, 235, 188, 198, 146, 160, 92, 132, 81, 177, 113, 230, 39, 220, 122, + <<1, 1, 4, 140, 235, 188, 198, 146, 160, 92, 132, 81, 177, 113, 230, 39, 220, 122, 112, 231, 18, 90, 66, 156, 47, 54, 192, 141, 44, 45, 223, 115, 28, 30, 48, 105, 253, 171, 105, 87, 148, 108, 150, 86, 128, 28, 102, 163, 51, 28, 57, 33, 133, 109, 49, 202, 92, 184, 138, 187, 26, 123, 45, 5, 94, 180, 250>> @@ -923,14 +923,6 @@ defmodule ArchEthic.Crypto do |> ID.prepend_curve(curve_type) end - @doc """ - Hash the data using the storage nonce stored in memory - """ - @spec hash_with_storage_nonce(data :: iodata()) :: binary() - def hash_with_storage_nonce(data) when is_binary(data) or is_list(data) do - hash([storage_nonce(), data]) - end - @doc """ Return the size of key using the curve id @@ -1156,6 +1148,9 @@ defmodule ArchEthic.Crypto do :software -> true + + :on_chain_wallet -> + true end end @@ -1184,6 +1179,9 @@ defmodule ArchEthic.Crypto do false iex> Crypto.authorized_key_origin?(<<0::8, 1::8, :crypto.strong_rand_bytes(32)::binary>>, [:tpm]) + false + + iex> Crypto.authorized_key_origin?(<<0::8, 2::8, :crypto.strong_rand_bytes(32)::binary>>, [:tpm]) true iex> Crypto.authorized_key_origin?(<<0::8, 0::8, :crypto.strong_rand_bytes(32)::binary>>, []) diff --git a/lib/archethic/crypto/id.ex b/lib/archethic/crypto/id.ex index 59822ef43..67db6b63a 100755 --- a/lib/archethic/crypto/id.ex +++ b/lib/archethic/crypto/id.ex @@ -58,22 +58,27 @@ defmodule ArchEthic.Crypto.ID do ## Examples - iex> ID.from_origin(:software) + iex> ID.from_origin(:on_chain_wallet) 0 - iex> ID.from_origin(:tpm) + iex> ID.from_origin(:software) 1 + + iex> ID.from_origin(:tpm) + 2 """ @spec from_origin(Crypto.supported_origin()) :: integer() - def from_origin(:software), do: 0 - def from_origin(:tpm), do: 1 + def from_origin(:on_chain_wallet), do: 0 + def from_origin(:software), do: 1 + def from_origin(:tpm), do: 2 @doc """ Get a origin from an identification """ @spec to_origin(integer()) :: Crypto.supported_origin() - def to_origin(0), do: :software - def to_origin(1), do: :tpm + def to_origin(0), do: :on_chain_wallet + def to_origin(1), do: :software + def to_origin(2), do: :tpm @doc """ Prepend hash by the algorithm identification byte @@ -107,9 +112,9 @@ defmodule ArchEthic.Crypto.ID do ...> 172, 79, 60, 159, 89, 230, 31, 254, 187, 176, 70, 166, 119, 96, 87, 194>> ...> }, :ed25519) { - <<0, 0, 38, 59, 8, 1, 172, 20, 74, 63, 15, 72, 206, 129, 140, 212, 188, 102, 203, 51, + <<0, 1, 38, 59, 8, 1, 172, 20, 74, 63, 15, 72, 206, 129, 140, 212, 188, 102, 203, 51, 188, 207, 135, 134, 211, 3, 87, 148, 178, 162, 118, 208, 109, 96>>, - <<0, 0, 21, 150, 237, 25, 119, 159, 16, 128, 43, 48, 169, 243, 214, 246, 102, 147, + <<0, 1, 21, 150, 237, 25, 119, 159, 16, 128, 43, 48, 169, 243, 214, 246, 102, 147, 172, 79, 60, 159, 89, 230, 31, 254, 187, 176, 70, 166, 119, 96, 87, 194>> } """ diff --git a/lib/archethic/election.ex b/lib/archethic/election.ex index a38e50613..2d3663a89 100755 --- a/lib/archethic/election.ex +++ b/lib/archethic/election.ex @@ -107,10 +107,10 @@ defmodule ArchEthic.Election do ...> %ValidationConstraints{ validation_number: fn _, 6 -> 3 end, min_geo_patch: fn -> 2 end } ...> ) [ + %Node{last_public_key: "node1", geo_patch: "AAA"}, %Node{last_public_key: "node6", geo_patch: "ECA"}, %Node{last_public_key: "node2", geo_patch: "DEF"}, - %Node{last_public_key: "node3", geo_patch: "AA0"}, - %Node{last_public_key: "node5", geo_patch: "F10"}, + %Node{last_public_key: "node5", geo_patch: "F10"} ] """ @spec validation_nodes( @@ -269,10 +269,12 @@ defmodule ArchEthic.Election do min_geo_patch_avg_availability = min_geo_patch_avg_availability_fun.() min_geo_patch = min_geo_patch_fun.() + storage_nonce = Crypto.storage_nonce() + storage_nodes = nodes |> Enum.sort_by(&Map.get(&1, :authorized?), :desc) - |> sort_storage_nodes_by_key_rotation(address) + |> sort_storage_nodes_by_key_rotation(address, storage_nonce) |> Enum.reduce_while( %{ nb_nodes: 0, @@ -330,11 +332,14 @@ defmodule ArchEthic.Election do nb_nodes: nb_nodes, zones: zones }) do - length(Map.keys(zones)) >= min_geo_patch and - Enum.all?(zones, fn {_, avg_availability} -> - avg_availability >= min_geo_patch_avg_availability - end) and - nb_nodes >= nb_replicas + if nb_nodes >= nb_replicas do + fullfilled_zones = + Enum.filter(zones, fn {_, avg} -> avg >= min_geo_patch_avg_availability end) + + length(fullfilled_zones) >= min_geo_patch + else + false + end end # Provide an unpredictable and reproducible list of allowed nodes using a rotating key algorithm @@ -347,18 +352,18 @@ defmodule ArchEthic.Election do # It requires the daily nonce or the storage nonce to be loaded in the Crypto keystore defp sort_validation_nodes_by_key_rotation(nodes, sorting_seed, hash) do nodes - |> Stream.map(fn node = %Node{last_public_key: last_public_key} -> - rotated_key = Crypto.hash([last_public_key, hash, sorting_seed]) + |> Stream.map(fn node = %Node{last_public_key: <<_::8, _::8, public_key::binary>>} -> + rotated_key = :crypto.hash(:sha256, [public_key, hash, sorting_seed]) {rotated_key, node} end) |> Enum.sort_by(fn {rotated_key, _} -> rotated_key end) |> Enum.map(fn {_, n} -> n end) end - defp sort_storage_nodes_by_key_rotation(nodes, hash) do + defp sort_storage_nodes_by_key_rotation(nodes, hash, storage_nonce) do nodes - |> Stream.map(fn node = %Node{first_public_key: last_public_key} -> - rotated_key = Crypto.hash_with_storage_nonce([last_public_key, hash]) + |> Stream.map(fn node = %Node{first_public_key: <<_::8, _::8, public_key::binary>>} -> + rotated_key = :crypto.hash(:sha256, [public_key, hash, storage_nonce]) {rotated_key, node} end) |> Enum.sort_by(fn {rotated_key, _} -> rotated_key end) diff --git a/lib/archethic/shared_secrets/mem_tables/network_lookup.ex b/lib/archethic/shared_secrets/mem_tables/network_lookup.ex index 7847387fb..c85ef4f5e 100644 --- a/lib/archethic/shared_secrets/mem_tables/network_lookup.ex +++ b/lib/archethic/shared_secrets/mem_tables/network_lookup.ex @@ -40,7 +40,7 @@ defmodule ArchEthic.SharedSecrets.MemTables.NetworkLookup do [ {:network_pool_address, <<120, 232, 56, 47, 135, 12, 110, 76, 250, 5, 240, 210, 92, 165, 151, 239, 181, 101, 24, 29, 24, 245, 231, 225, 47, 78, 103, 57, 254, 206, 159, 217>>}, - {{:daily_nonce, 0}, <<0, 0, 207, 10, 216, 159, 45, 111, 246, 18, 53, 128, 31, 127, 69, 104, 136, 74, 244, 225, 71, 122, 199, 230, 122, 233, 123, 61, 92, 150, 157, 139, 218, 8>>} + {{:daily_nonce, 0}, <<0, 1, 207, 10, 216, 159, 45, 111, 246, 18, 53, 128, 31, 127, 69, 104, 136, 74, 244, 225, 71, 122, 199, 230, 122, 233, 123, 61, 92, 150, 157, 139, 218, 8>>} ] """ @spec set_network_pool_address(binary()) :: :ok @@ -86,7 +86,7 @@ defmodule ArchEthic.SharedSecrets.MemTables.NetworkLookup do ...> 21, 248, 239, 162, 234, 35, 220, 113, 133, 73, 255, 58, 134, 225, 30>>, ~U[2021-04-07 08:36:41Z]) iex> :ets.tab2list(:archethic_shared_secrets_network) [ - {{:daily_nonce, 0}, <<0, 0, 207, 10, 216, 159, 45, 111, 246, 18, 53, 128, 31, 127, 69, 104, 136, 74, 244, 225, 71, 122, 199, 230, 122, 233, 123, 61, 92, 150, 157, 139, 218, 8>>}, + {{:daily_nonce, 0}, <<0, 1, 207, 10, 216, 159, 45, 111, 246, 18, 53, 128, 31, 127, 69, 104, 136, 74, 244, 225, 71, 122, 199, 230, 122, 233, 123, 61, 92, 150, 157, 139, 218, 8>>}, {{:daily_nonce, 1617698201}, <<0, 0, 57, 24, 251, 164, 133, 168, 109, 154, 9, 77, 197, 254, 138, 187, 250, 200, 37, 115, 182, 174, 90, 206, 161, 228, 197, 77, 184, 101, 183, 164, 187, 96>>}, {{:daily_nonce, 1617784601}, <<0, 0, 52, 242, 87, 194, 41, 203, 59, 163, 197, 116, 83, 28, 134, 140, 48, 74, 66, @@ -106,19 +106,19 @@ defmodule ArchEthic.SharedSecrets.MemTables.NetworkLookup do iex> NetworkLookup.start_link() iex> NetworkLookup.get_daily_nonce_public_key() - <<0, 0, 207, 10, 216, 159, 45, 111, 246, 18, 53, 128, 31, 127, 69, 104, 136, 74, 244, 225, 71, 122, 199, 230, 122, 233, 123, 61, 92, 150, 157, 139, 218, 8>> + <<0, 1, 207, 10, 216, 159, 45, 111, 246, 18, 53, 128, 31, 127, 69, 104, 136, 74, 244, 225, 71, 122, 199, 230, 122, 233, 123, 61, 92, 150, 157, 139, 218, 8>> iex> NetworkLookup.start_link() - iex> NetworkLookup.set_daily_nonce_public_key(<<0, 0, 57, 24, 251, 164, 133, 168, 109, 154, 9, 77, 197, 254, 138, 187, 250, 200, 37, + iex> NetworkLookup.set_daily_nonce_public_key(<<0, 1, 57, 24, 251, 164, 133, 168, 109, 154, 9, 77, 197, 254, 138, 187, 250, 200, 37, ...> 115, 182, 174, 90, 206, 161, 228, 197, 77, 184, 101, 183, 164, 187, 96>>, ~U[2021-04-06 08:36:41Z]) - iex> NetworkLookup.set_daily_nonce_public_key(<<0, 0, 52, 242, 87, 194, 41, 203, 59, 163, 197, 116, 83, 28, 134, 140, 48, 74, 66, + iex> NetworkLookup.set_daily_nonce_public_key(<<0, 1, 52, 242, 87, 194, 41, 203, 59, 163, 197, 116, 83, 28, 134, 140, 48, 74, 66, ...> 21, 248, 239, 162, 234, 35, 220, 113, 133, 73, 255, 58, 134, 225, 30>>, ~U[2021-04-07 08:36:41Z]) iex> NetworkLookup.get_daily_nonce_public_key(~U[2021-04-07 10:00:00Z]) - <<0, 0, 52, 242, 87, 194, 41, 203, 59, 163, 197, 116, 83, 28, 134, 140, 48, 74, 66, 21, 248, 239, 162, 234, 35, 220, 113, 133, 73, 255, 58, 134, 225, 30>> + <<0, 1, 52, 242, 87, 194, 41, 203, 59, 163, 197, 116, 83, 28, 134, 140, 48, 74, 66, 21, 248, 239, 162, 234, 35, 220, 113, 133, 73, 255, 58, 134, 225, 30>> iex> NetworkLookup.get_daily_nonce_public_key(~U[2021-04-07 08:36:41Z]) - <<0, 0, 57, 24, 251, 164, 133, 168, 109, 154, 9, 77, 197, 254, 138, 187, 250, 200, 37, 115, 182, 174, 90, 206, 161, 228, 197, 77, 184, 101, 183, 164, 187, 96>> + <<0, 1, 57, 24, 251, 164, 133, 168, 109, 154, 9, 77, 197, 254, 138, 187, 250, 200, 37, 115, 182, 174, 90, 206, 161, 228, 197, 77, 184, 101, 183, 164, 187, 96>> iex> NetworkLookup.get_daily_nonce_public_key(~U[2021-04-07 00:00:00Z]) - <<0, 0, 57, 24, 251, 164, 133, 168, 109, 154, 9, 77, 197, 254, 138, 187, 250, 200, 37, 115, 182, 174, 90, 206, 161, 228, 197, 77, 184, 101, 183, 164, 187, 96>> + <<0, 1, 57, 24, 251, 164, 133, 168, 109, 154, 9, 77, 197, 254, 138, 187, 250, 200, 37, 115, 182, 174, 90, 206, 161, 228, 197, 77, 184, 101, 183, 164, 187, 96>> """ @spec get_daily_nonce_public_key(DateTime.t()) :: Crypto.key() diff --git a/lib/archethic/shared_secrets/mem_tables_loader.ex b/lib/archethic/shared_secrets/mem_tables_loader.ex index bae00cf27..e1ce2da8c 100644 --- a/lib/archethic/shared_secrets/mem_tables_loader.ex +++ b/lib/archethic/shared_secrets/mem_tables_loader.ex @@ -65,6 +65,9 @@ defmodule ArchEthic.SharedSecrets.MemTablesLoader do :tpm -> :hardware + + :on_chain_wallet -> + :software end :ok = OriginKeyLookup.add_public_key(family, previous_public_key) @@ -140,6 +143,9 @@ defmodule ArchEthic.SharedSecrets.MemTablesLoader do :tpm -> :hardware + + :on_chain_wallet -> + :software end get_origin_public_keys( diff --git a/lib/archethic/transaction_chain/transaction/data/ownership.ex b/lib/archethic/transaction_chain/transaction/data/ownership.ex index d5d717663..7c834a68b 100644 --- a/lib/archethic/transaction_chain/transaction/data/ownership.ex +++ b/lib/archethic/transaction_chain/transaction/data/ownership.ex @@ -23,7 +23,7 @@ defmodule ArchEthic.TransactionChain.TransactionData.Ownership do iex> %Ownership{authorized_keys: authorized_keys} = Ownership.new(secret, secret_key, [pub]) iex> Map.keys(authorized_keys) [ - <<0, 0, 241, 101, 225, 229, 247, 194, 144, 229, 47, 46, 222, 243, 251, 171, 96, 203, 174, 116, 191, 211, + <<0, 1, 241, 101, 225, 229, 247, 194, 144, 229, 47, 46, 222, 243, 251, 171, 96, 203, 174, 116, 191, 211, 39, 79, 142, 94, 225, 222, 51, 69, 201, 84, 161,102>> ] """ diff --git a/lib/archethic/utils/testnet.ex b/lib/archethic/utils/testnet.ex index 2ed592207..4b6fdccf5 100644 --- a/lib/archethic/utils/testnet.ex +++ b/lib/archethic/utils/testnet.ex @@ -150,7 +150,7 @@ defmodule ArchEthic.Utils.Testnet do "node1" => %{ environment: %{ "ARCHETHIC_CRYPTO_SEED" => "node1", - "ARCHETHIC_P2P_BOOTSTRAPPING_SEEDS" => "1.2.3.2:30002:00001D967D71B2E135C84206DDD108B5925A2CD99C8EBC5AB5D8FD2EC9400CE3C98A:tcp", + "ARCHETHIC_P2P_BOOTSTRAPPING_SEEDS" => "1.2.3.2:30002:00011D967D71B2E135C84206DDD108B5925A2CD99C8EBC5AB5D8FD2EC9400CE3C98A:tcp", "ARCHETHIC_STATIC_IP" => "1.2.3.2", "ARCHETHIC_DB_HOST" => "scylladb1:9042", "ARCHETHIC_NETWORKING_IMPL" => "STATIC", @@ -187,7 +187,7 @@ defmodule ArchEthic.Utils.Testnet do depends_on: ["node1"], environment: %{ "ARCHETHIC_CRYPTO_SEED" => "node2", - "ARCHETHIC_P2P_BOOTSTRAPPING_SEEDS" => "1.2.3.2:30002:00001D967D71B2E135C84206DDD108B5925A2CD99C8EBC5AB5D8FD2EC9400CE3C98A:tcp", + "ARCHETHIC_P2P_BOOTSTRAPPING_SEEDS" => "1.2.3.2:30002:00011D967D71B2E135C84206DDD108B5925A2CD99C8EBC5AB5D8FD2EC9400CE3C98A:tcp", "ARCHETHIC_STATIC_IP" => "1.2.3.3", "ARCHETHIC_DB_HOST" => "scylladb2:9042", "ARCHETHIC_NETWORKING_IMPL" => "STATIC", @@ -229,7 +229,7 @@ defmodule ArchEthic.Utils.Testnet do depends_on: ["node1"], environment: %{ "ARCHETHIC_CRYPTO_SEED" => "node3", - "ARCHETHIC_P2P_BOOTSTRAPPING_SEEDS" => "1.2.3.2:30002:00001D967D71B2E135C84206DDD108B5925A2CD99C8EBC5AB5D8FD2EC9400CE3C98A:tcp", + "ARCHETHIC_P2P_BOOTSTRAPPING_SEEDS" => "1.2.3.2:30002:00011D967D71B2E135C84206DDD108B5925A2CD99C8EBC5AB5D8FD2EC9400CE3C98A:tcp", "ARCHETHIC_STATIC_IP" => "1.2.3.4", "ARCHETHIC_DB_HOST" => "scylladb3:9042", "ARCHETHIC_NETWORKING_IMPL" => "STATIC", diff --git a/test/archethic/beacon_chain_test.exs b/test/archethic/beacon_chain_test.exs index a340772ee..95836c0f7 100644 --- a/test/archethic/beacon_chain_test.exs +++ b/test/archethic/beacon_chain_test.exs @@ -35,13 +35,13 @@ defmodule ArchEthic.BeaconChainTest do end test "summary_transaction_address/2 should return a address using the storage nonce a subset and a date" do - assert <<0, 0, 141, 146, 109, 188, 197, 248, 255, 123, 14, 172, 53, 198, 233, 233, 205, 180, - 221, 95, 244, 203, 222, 149, 194, 205, 73, 214, 9, 207, 197, 55, 59, - 182>> = BeaconChain.summary_transaction_address(<<1>>, ~U[2021-01-13 00:00:00Z]) + assert <<0, 0, 126, 16, 248, 223, 156, 176, 229, 102, 1, 100, 203, 172, 176, 243, 188, 41, 20, + 170, 58, 159, 173, 181, 185, 11, 231, 174, 223, 115, 196, 88, 243, + 197>> = BeaconChain.summary_transaction_address(<<1>>, ~U[2021-01-13 00:00:00Z]) - assert <<0, 0, 25, 97, 166, 116, 204, 210, 75, 152, 0, 193, 90, 253, 228, 140, 38, 248, 49, - 160, 210, 186, 181, 32, 203, 157, 110, 67, 255, 181, 80, 96, 160, - 239>> = BeaconChain.summary_transaction_address(<<1>>, ~U[2021-01-14 00:00:00Z]) + assert <<0, 0, 68, 143, 226, 144, 77, 189, 180, 194, 80, 63, 131, 127, 130, 140, 137, 97, 76, + 39, 74, 19, 34, 182, 174, 179, 89, 117, 149, 203, 58, 89, 67, + 68>> = BeaconChain.summary_transaction_address(<<1>>, ~U[2021-01-14 00:00:00Z]) end test "add_end_of_node_sync/2 should register a end of synchronization inside a subset" do diff --git a/test/archethic/crypto_test.exs b/test/archethic/crypto_test.exs index 6390c14a6..d497d512c 100644 --- a/test/archethic/crypto_test.exs +++ b/test/archethic/crypto_test.exs @@ -46,10 +46,6 @@ defmodule CryptoTest do end end - test "hash_with_storage_nonce/1 should hash a data using the storage nonce" do - assert Crypto.hash(["nonce", "hello"]) == Crypto.hash_with_storage_nonce("hello") - end - test "decrypt_and_set_storage_nonce/1 should decrypt storage nonce using node last key and and load storage nonce" do storage_nonce = :crypto.strong_rand_bytes(32) diff --git a/test/archethic/election_test.exs b/test/archethic/election_test.exs index 5c2ffed01..3d81a1135 100644 --- a/test/archethic/election_test.exs +++ b/test/archethic/election_test.exs @@ -181,18 +181,16 @@ defmodule ArchEthic.ElectionTest do ] assert [ - %Node{first_public_key: "Node5", geo_patch: "E3A", average_availability: 0.9}, + %Node{first_public_key: "Node1", geo_patch: "CCC", average_availability: 0.1}, + %Node{first_public_key: "Node3", geo_patch: "AFC", average_availability: 0.8}, %Node{first_public_key: "Node2", geo_patch: "BBB", average_availability: 0.9}, - %Node{first_public_key: "Node0", geo_patch: "AAA", average_availability: 0.7}, - %Node{first_public_key: "Node6", geo_patch: "F1A", average_availability: 0.5}, - %Node{first_public_key: "Node4", geo_patch: "FBA", average_availability: 0.4}, - %Node{first_public_key: "Node3", geo_patch: "AFC", average_availability: 0.8} + %Node{first_public_key: "Node5", geo_patch: "E3A", average_availability: 0.9} ] = Election.storage_nodes("address", available_nodes, %StorageConstraints{ number_replicas: fn _ -> 3 end, - min_geo_patch: fn -> 4 end, + min_geo_patch: fn -> 3 end, min_geo_patch_average_availability: fn -> 0.8 end }) end diff --git a/test/archethic/self_repair/sync_test.exs b/test/archethic/self_repair/sync_test.exs index eb594278d..ee0c2d944 100644 --- a/test/archethic/self_repair/sync_test.exs +++ b/test/archethic/self_repair/sync_test.exs @@ -114,9 +114,7 @@ defmodule ArchEthic.SelfRepair.SyncTest do geo_patch: "BBB", network_patch: "BBB", reward_address: <<0::8, 0::8, :crypto.strong_rand_bytes(32)::binary>>, - enrollment_date: DateTime.utc_now(), - authorized?: true, - authorization_date: DateTime.utc_now() |> DateTime.add(-(86_400 * 10)) + enrollment_date: DateTime.utc_now() }, %Node{ ip: {127, 0, 0, 1}, @@ -127,9 +125,7 @@ defmodule ArchEthic.SelfRepair.SyncTest do geo_patch: "BBB", network_patch: "BBB", reward_address: :crypto.strong_rand_bytes(32), - enrollment_date: DateTime.utc_now(), - authorized?: true, - authorization_date: DateTime.utc_now() |> DateTime.add(-(86_400 * 10)) + enrollment_date: DateTime.utc_now() } ] diff --git a/test/archethic/shared_secrets/mem_tables_loader_test.exs b/test/archethic/shared_secrets/mem_tables_loader_test.exs index bba731609..80161b212 100644 --- a/test/archethic/shared_secrets/mem_tables_loader_test.exs +++ b/test/archethic/shared_secrets/mem_tables_loader_test.exs @@ -66,7 +66,7 @@ defmodule ArchEthic.SharedSecrets.MemTablesLoaderTest do type: :origin_shared_secrets, data: %TransactionData{ content: - <<0, 1, 39, 103, 38, 51, 71, 159, 74, 33, 122, 134, 153, 147, 202, 66, 229, 213, 140, + <<0, 2, 39, 103, 38, 51, 71, 159, 74, 33, 122, 134, 153, 147, 202, 66, 229, 213, 140, 129, 186, 156, 39, 168, 129, 94, 161, 133, 2, 177, 176, 158, 246, 10, 0, 0, 44, 109, 55, 248, 40, 227, 68, 248, 1, 34, 31, 172, 75, 3, 244, 11, 58, 245, 170, 246, 70, 204, 242, 12, 14, 36, 248, 240, 71, 218, 245, 78>> @@ -79,14 +79,14 @@ defmodule ArchEthic.SharedSecrets.MemTablesLoaderTest do [ <<0, 0, 44, 109, 55, 248, 40, 227, 68, 248, 1, 34, 31, 172, 75, 3, 244, 11, 58, 245, 170, 246, 70, 204, 242, 12, 14, 36, 248, 240, 71, 218, 245, 78>>, - <<0, 1, 39, 103, 38, 51, 71, 159, 74, 33, 122, 134, 153, 147, 202, 66, 229, 213, 140, + <<0, 2, 39, 103, 38, 51, 71, 159, 74, 33, 122, 134, 153, 147, 202, 66, 229, 213, 140, 129, 186, 156, 39, 168, 129, 94, 161, 133, 2, 177, 176, 158, 246, 10>> ] ++ @origin_genesis_public_keys assert Enum.all?(OriginKeyLookup.list_public_keys(), &(&1 in expected_keys)) assert [ - <<0, 1, 39, 103, 38, 51, 71, 159, 74, 33, 122, 134, 153, 147, 202, 66, 229, 213, + <<0, 2, 39, 103, 38, 51, 71, 159, 74, 33, 122, 134, 153, 147, 202, 66, 229, 213, 140, 129, 186, 156, 39, 168, 129, 94, 161, 133, 2, 177, 176, 158, 246, 10>> ] == OriginKeyLookup.list_public_keys(:hardware) end