Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmanzanera committed Dec 18, 2024
1 parent 637d900 commit 966098e
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lib/archethic/contracts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ defmodule Archethic.Contracts do
Each smart contract is register and supervised as long running process to interact with later on.
"""

alias __MODULE__.InterpretedContract
alias __MODULE__.Interpreter.Conditions, as: ConditionsInterpreter
alias __MODULE__.Interpreter.Constants, as: ConstantsInterpreter
alias __MODULE__.Contract.ActionWithoutTransaction
Expand All @@ -14,6 +13,7 @@ defmodule Archethic.Contracts do
alias __MODULE__.Contract.State
alias __MODULE__.Interpreter
alias __MODULE__.Interpreter.Library
alias __MODULE__.Interpreter.Contract, as: InterpretedContract
alias __MODULE__.Loader

alias __MODULE__.WasmContract
Expand Down
4 changes: 2 additions & 2 deletions lib/archethic/contracts/interpreter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ defmodule Archethic.Contracts.Interpreter do
alias __MODULE__.Legacy
alias __MODULE__.Scope
alias Archethic.Contracts
alias Archethic.Contracts.Intepreter.Conditions.Subjects, as: ConditionsSubjects
alias Archethic.Contracts.Interpreter.Conditions.Subjects, as: ConditionsSubjects
alias Archethic.Contracts.Interpreter.Constants
alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Contract.State
alias Archethic.TransactionChain.Transaction
alias Archethic.TransactionChain.TransactionData.Recipient
Expand Down
2 changes: 1 addition & 1 deletion lib/archethic/contracts/interpreter/action_interpreter.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule Archethic.Contracts.Interpreter.ActionInterpreter do
@moduledoc false

alias Archethic.Contracts.Contract
alias Archethic.Contracts.Contract.State
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Interpreter.ASTHelper, as: AST
alias Archethic.Contracts.Interpreter.CommonInterpreter
alias Archethic.Contracts.Interpreter.FunctionKeys
Expand Down
2 changes: 1 addition & 1 deletion lib/archethic/contracts/interpreter/contract.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Archethic.Contracts.InterpretedContract do
defmodule Archethic.Contracts.Interpreter.Contract do
@moduledoc """
Represents a smart contract
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/archethic/contracts/interpreter/legacy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Archethic.Contracts.Interpreter.Legacy do
alias __MODULE__.ConditionInterpreter

alias Archethic.Contracts
alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Interpreter.Conditions.Subjects, as: ConditionsSubjects
alias Archethic.Contracts.Interpreter

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Archethic.Contracts.Interpreter.Legacy.ActionInterpreter do
@moduledoc false
alias Archethic.Contracts.Contract
alias Archethic.Contracts.Interpreter
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Interpreter.Legacy.TransactionStatements
alias Archethic.Contracts.Interpreter.Legacy.UtilsInterpreter

Expand Down
6 changes: 3 additions & 3 deletions lib/archethic/contracts/wasm/contract.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Archethic.Contracts.WasmContract do

@type t() :: %__MODULE__{
version: integer(),
module: WasmModule.t(),
module: nil | WasmModule.t(),
state: State.t(),
transaction: Transaction.t()
}
Expand Down Expand Up @@ -79,8 +79,8 @@ defmodule Archethic.Contracts.WasmContract do
def from_transaction(tx = %Transaction{data: %TransactionData{contract: contract}})
when contract != nil do
case parse(contract) do
{:ok, contract} ->
{:ok, %{contract | state: get_state_from_tx(tx), transaction: tx}}
{:ok, module} ->
{:ok, %{module | state: get_state_from_tx(tx), transaction: tx}}

{:error, _} = e ->
e
Expand Down
2 changes: 1 addition & 1 deletion lib/archethic/contracts/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Archethic.Contracts.Worker do

alias Archethic.ContractRegistry
alias Archethic.Contracts
alias Archethic.Contracts.InterpretedContract
alias Archethic.Contracts.Interpreter.Contract, as: InterpretedContract
alias Archethic.Contracts.WasmSpec
alias Archethic.Contracts.WasmContract
alias Archethic.Contracts.WasmModule
Expand Down
4 changes: 2 additions & 2 deletions lib/archethic/crypto.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ defmodule Archethic.Crypto do
"""
@spec aggregate_signatures(signatures :: list(binary()), public_keys :: list(key())) :: binary()
def aggregate_signatures(signatures, public_keys) do
BlsEx.aggregate_signatures(
BlsEx.aggregate_signatures!(
signatures,
Enum.map(public_keys, fn <<_::8, _::8, public_key::binary>> -> public_key end)
)
Expand All @@ -1451,7 +1451,7 @@ defmodule Archethic.Crypto do
def aggregate_mining_public_keys(public_keys) do
public_keys
|> Enum.map(fn <<_::8, _::8, public_key::binary>> -> public_key end)
|> BlsEx.aggregate_public_keys()
|> BlsEx.aggregate_public_keys!()
|> ID.prepend_key(:bls)
end
end
2 changes: 1 addition & 1 deletion lib/archethic/mining/proof_of_work.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Archethic.Mining.ProofOfWork do

alias Archethic.Contracts
alias Archethic.Contracts.Interpreter
alias Archethic.Contracts.InterpretedContract
alias Archethic.Contracts.Interpreter.Contract, as: InterpretedContract

alias Archethic.Crypto

Expand Down
2 changes: 1 addition & 1 deletion lib/archethic/mining/smart_contract_validation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Archethic.Mining.SmartContractValidation do
alias Archethic.Contracts
alias Archethic.Contracts.Contract.State
alias Archethic.Contracts.Contract.Context
alias Archethic.Contracts.InterpretedContract
alias Archethic.Contracts.Interpreter.Contract, as: InterpretedContract
alias Archethic.Contracts.WasmContract
alias Archethic.Contracts.WasmModule
alias Archethic.Contracts.Wasm.ReadResult
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
defmodule Archethic.Contracts.InterpretedContractTest do
defmodule Archethic.Contracts.Interpreter.ContractTest do
use ArchethicCase
# import ArchethicCase

alias Archethic.ContractFactory
alias Archethic.Contracts
alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Contract.ActionWithTransaction
alias Archethic.Contracts.Contract.State
alias Archethic.Contracts.Interpreter
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Crypto
alias Archethic.TransactionChain.Transaction
alias Archethic.TransactionChain.TransactionData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ defmodule Archethic.Contracts.Interpreter.Library.Common.CryptoTest do

use ArchethicCase

alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Interpreter
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Interpreter.Library
alias Archethic.Contracts.Interpreter.Library.Common.Crypto

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ defmodule Archethic.Contracts.Interpreter.Library.Common.HttpImplTest do
describe "request_many/2" do
test "should return a status -4001 for timeout" do
assert [
%{"status" => 200},
%{"status" => -4001}
%{"status" => -4001},
%{"status" => 200}
] =
HttpImpl.request_many(
[
Expand All @@ -234,6 +234,7 @@ defmodule Archethic.Contracts.Interpreter.Library.Common.HttpImplTest do
],
false
)
|> Enum.sort_by(fn %{"status" => status} -> status end)
end

test "should return a status -4004 for non https" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ defmodule Archethic.Contracts.Interpreter.Library.Common.TimeTest do

alias Archethic.ContractFactory
alias Archethic.Contracts
alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Contract.ActionWithTransaction
alias Archethic.Contracts.Contract.ConditionRejected
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Interpreter.Library.Common.Time
alias Archethic.TransactionChain.Transaction
alias Archethic.TransactionChain.TransactionData
Expand Down
2 changes: 1 addition & 1 deletion test/archethic/contracts/interpreter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Archethic.Contracts.InterpreterTest do
alias Archethic.ContractFactory
alias Archethic.Contracts.Interpreter.Conditions
alias Archethic.Contracts.Interpreter.Constants
alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Contract.State
alias Archethic.Contracts.Interpreter
alias Archethic.Contracts.Interpreter.Library
Expand Down
2 changes: 1 addition & 1 deletion test/archethic/contracts/loader_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Archethic.Contracts.LoaderTest do
alias Archethic.ContractRegistry
alias Archethic.ContractSupervisor

alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Loader
alias Archethic.Contracts.Worker
alias Archethic.Contracts.Contract.Context
Expand Down
2 changes: 1 addition & 1 deletion test/archethic/contracts/worker_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Archethic.Contracts.WorkerTest do
alias Archethic.PubSub

alias Archethic.ContractSupervisor
alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Worker

alias Archethic.P2P.Message.StartMining
Expand Down
2 changes: 1 addition & 1 deletion test/archethic/contracts_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Archethic.ContractsTest do
use ArchethicCase

alias Archethic.Contracts
alias Archethic.Contracts.InterpretedContract, as: Contract
alias Archethic.Contracts.Interpreter.Contract
alias Archethic.Contracts.Contract.ActionWithTransaction
alias Archethic.Contracts.Contract.ActionWithoutTransaction
alias Archethic.Contracts.Contract.ConditionRejected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ defmodule Archethic.Mining.PendingTransactionValidationTest do
tx =
TransactionFactory.create_non_valided_transaction(
type: :data,
content: :crypto.strong_rand_bytes(3_145_711)
content: :crypto.strong_rand_bytes(3_145_700)
)

assert :ok = PendingTransactionValidation.validate_size(tx)
Expand Down

0 comments on commit 966098e

Please sign in to comment.