Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Horus version to output #46

Merged
merged 2 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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