Skip to content

Commit

Permalink
Merge pull request #46 from NethermindEth/ElijahVlasov/horus-version-…
Browse files Browse the repository at this point in the history
…json

Add Horus version to output
  • Loading branch information
ElijahVlasov authored Jan 17, 2023
2 parents 9c8a091 + 7ad099e commit 5c5e04b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ skip_gitignore = true

[tool.poetry]
name = "horus-compile"
version = "0.0.6.3"
version = "0.0.6.4"
authors = ["Nethermind <[email protected]>"]
description = "Use formally verified annotations in your Cairo code"
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion src/horus/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.6.3"
__version__ = "0.0.6.4"
6 changes: 5 additions & 1 deletion src/horus/compiler/contract_definition.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from dataclasses import field
from typing import Dict, List
from typing import Dict, List, Optional

import marshmallow.fields as mfields
import marshmallow_dataclass
Expand All @@ -12,6 +12,7 @@
from starkware.cairo.lang.compiler.scoped_name import ScopedName, ScopedNameAsStr
from starkware.starknet.services.api.contract_class import ContractClass

import horus
from horus.compiler.var_names import *
from horus.utils import z3And

Expand Down Expand Up @@ -100,6 +101,9 @@ class FunctionAnnotations:

@marshmallow_dataclass.dataclass(frozen=True)
class HorusDefinition(ContractClass):
horus_version: Optional[str] = field(
metadata=dict(marshmallow_field=mfields.String()), default=horus.__version__
)
specifications: Dict[ScopedName, FunctionAnnotations] = field(
metadata=dict(
marshmallow_field=mfields.Dict(
Expand Down
1 change: 1 addition & 0 deletions src/horus/compiler/horus_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def assemble_horus_contract(

return HorusDefinition(
**contract_definition.__dict__,
horus_version=horus.__version__,
specifications=preprocessed_program.specifications,
invariants=preprocessed_program.invariants,
storage_vars=preprocessed_program.storage_vars,
Expand Down

0 comments on commit 5c5e04b

Please sign in to comment.