From 16a5f39c8b818a7f024ecc4c9f9104857fba03b6 Mon Sep 17 00:00:00 2001 From: Bastien CHAMAGNE Date: Mon, 16 Jan 2023 09:25:59 +0100 Subject: [PATCH] un-whitelist get_calls/1 --- lib/archethic/contracts/interpreter/action.ex | 10 +--------- test/archethic/contracts/interpreter/action_test.exs | 8 ++++++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/archethic/contracts/interpreter/action.ex b/lib/archethic/contracts/interpreter/action.ex index 6cf3381b24..44946c318d 100644 --- a/lib/archethic/contracts/interpreter/action.ex +++ b/lib/archethic/contracts/interpreter/action.ex @@ -138,15 +138,7 @@ defmodule Archethic.Contracts.ActionInterpreter do {node, {:ok, %{context | scope: {:function, function, parent_scope}}}} end - # Whitelist the get_calls/1 - defp prewalk( - node = {{:atom, "get_calls"}, _, [_]}, - acc = {:ok, %{scope: {:actions, _}}} - ) do - {node, acc} - end - - # Whitelist the get_calls/0 + # Whitelist the get_calls/0 (this will be expanded to a get_calls(contract.address) in postwalk) defp prewalk( node = {{:atom, "get_calls"}, _, []}, acc = {:ok, %{scope: {:actions, _}}} diff --git a/test/archethic/contracts/interpreter/action_test.exs b/test/archethic/contracts/interpreter/action_test.exs index 80c26f3d68..3a4d3933ac 100644 --- a/test/archethic/contracts/interpreter/action_test.exs +++ b/test/archethic/contracts/interpreter/action_test.exs @@ -455,7 +455,7 @@ defmodule Archethic.Contracts.ActionInterpreterTest do assert %Transaction{data: %TransactionData{content: "1"}} = ~s""" actions triggered_by: transaction do - transactions = get_calls("64F05F5236088FC64D1BB19BD13BC548F1C49A42432AF02AD9024D8A2990B2B4") + transactions = get_calls() set_content size(transactions) end """ @@ -463,6 +463,10 @@ defmodule Archethic.Contracts.ActionInterpreterTest do |> elem(1) |> ActionInterpreter.parse() |> elem(2) - |> ActionInterpreter.execute() + |> ActionInterpreter.execute(%{ + "contract" => %{ + "address" => "64F05F5236088FC64D1BB19BD13BC548F1C49A42432AF02AD9024D8A2990B2B4" + } + }) end end