Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
meevee98 committed Jun 20, 2023
2 parents 9c3e636 + 27d46f6 commit 5ce4520
Show file tree
Hide file tree
Showing 240 changed files with 1,626 additions and 2,223 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ workflows:
only: /.*/
branches:
only:
- development
- staging
- master
- publish-docs:
context: aws
Expand All @@ -197,5 +197,5 @@ workflows:
only: /.*/
branches:
only:
- development
- staging
- master
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]


## [0.14.0] - 2023-06-20
> This version has breaking changes. Please refer to our [migration guide](/docs/migration-guide-v0.14.0.md) to update your smart contracts.
### Changed
- Moved `ByteString` class methods `to_int`, `to_str`, `to_bytes` and `to_bool` to the module `boa3.builtin.type.helper`

### Removed
- Removed `ByteString` type.
- Removed `to_int` implementation from `str` and `bytes` types.
- Removed `to_bytes` implementation from `int` and `bytes` types.
- Removed `to_str` implementation from `bytes` types.
- Removed `to_bool` implementation from `bytes` type.

### Fixed
- Fixed debugging information for symbols of imported modules.
- Fixed incorrect import error caused by root folder path.
- Fixed generation of static variables that were duplicated.
- Fixed code generation for method calls on `return` statements in void methods.
- Fixed compilation failure caused by imports in the file where `NeoMetadata` is defined.
- Fixed standard validations when using imported symbols.


## [0.13.1] - 2023-05-29
### Changed
- Imported contract interfaces are included on metadata permissions to ensure the expected executing behaviour
Expand Down Expand Up @@ -454,7 +476,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.0.2] - 2020-06-13


[Unreleased]: https://github.com/CityOfZion/neo3-boa/tree/development
[Unreleased]: https://github.com/CityOfZion/neo3-boa/compare/master...staging
[0.14.0]: https://github.com/CityOfZion/neo3-boa/releases/tag/v0.14.0
[0.13.1]: https://github.com/CityOfZion/neo3-boa/releases/tag/v0.13.1
[0.13.0]: https://github.com/CityOfZion/neo3-boa/releases/tag/v0.13.0
[0.12.3]: https://github.com/CityOfZion/neo3-boa/releases/tag/v0.12.3
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

<br/>

> Note: The latest release (v0.14.0) has breaking changes with contracts written using previous versions. Please refer to our [migration guide](/docs/migration-guide-v0.14.0.md) to update your smart contracts.
## Table of Contents
- [Overview](#overview)
- [Quickstart](#quickstart)
Expand Down
13 changes: 11 additions & 2 deletions boa3/builtin/compile_time/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
__all__ = [
'CreateNewEvent',
'public',
'metadata',
'contract',
'display_name',
'NeoMetadata',
]

from typing import List, Dict, Any, Union, Optional, Tuple

from boa3.builtin.type import ByteString, Event
from boa3.builtin.type import Event


def CreateNewEvent(arguments: List[Tuple[str, type]] = [], event_name: str = '') -> Event:
Expand Down Expand Up @@ -40,7 +49,7 @@ def metadata(*args):
pass


def contract(script_hash: ByteString):
def contract(script_hash: Union[str, bytes]):
"""
This decorator identifies a class that should be interpreted as an interface to an existing contract.
Expand Down
13 changes: 11 additions & 2 deletions boa3/builtin/contract/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
__all__ = [
'Nep5TransferEvent',
'Nep11TransferEvent',
'Nep17TransferEvent',
'abort',
'NeoAccountState',
'to_script_hash',
]

from typing import Union, Any

from boa3.builtin.compile_time import CreateNewEvent
from boa3.builtin.type import ByteString, ECPoint, UInt160, Event
from boa3.builtin.type import ECPoint, UInt160, Event

Nep5TransferEvent: Event = CreateNewEvent(
[
Expand All @@ -23,7 +32,7 @@
('from', Union[UInt160, None]),
('to', Union[UInt160, None]),
('amount', int),
('tokenId', ByteString)
('tokenId', Union[str, bytes])
],
'Transfer'
)
Expand Down
16 changes: 16 additions & 0 deletions boa3/builtin/interop/blockchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
__all__ = [
'Block',
'Signer',
'Transaction',
'VMState',
'get_contract',
'get_block',
'get_transaction',
'get_transaction_from_block',
'get_transaction_height',
'get_transaction_signers',
'get_transaction_vm_state',
'current_hash',
'current_index',
]

from typing import List, Union

from boa3.builtin.interop.blockchain.block import Block
Expand Down
4 changes: 4 additions & 0 deletions boa3/builtin/interop/blockchain/block.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__all__ = [
'Block'
]

from boa3.builtin.type import UInt160, UInt256


Expand Down
9 changes: 9 additions & 0 deletions boa3/builtin/interop/blockchain/signer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
__all__ = [
"Signer",
"WitnessRule",
"WitnessCondition",
"WitnessConditionType",
"WitnessRuleAction",
"WitnessScope",
]

from typing import List

from boa3.builtin.type import UInt160
Expand Down
4 changes: 4 additions & 0 deletions boa3/builtin/interop/blockchain/transaction.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__all__ = [
'Transaction',
]

from boa3.builtin.type import UInt160, UInt256


Expand Down
18 changes: 18 additions & 0 deletions boa3/builtin/interop/contract/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
__all__ = [
'CallFlags',
'Contract',
'ContractManifest',
'call_contract',
'create_contract',
'update_contract',
'destroy_contract',
'get_minimum_deployment_fee',
'get_call_flags',
'create_standard_account',
'create_multisig_account',
'NEO',
'GAS',
]


from typing import Any, List, Sequence

from boa3.builtin.interop.contract.callflagstype import CallFlags
from boa3.builtin.interop.contract.contract import Contract
from boa3.builtin.interop.contract.contractmanifest import ContractManifest
from boa3.builtin.type import ECPoint, UInt160


Expand Down
4 changes: 4 additions & 0 deletions boa3/builtin/interop/contract/contract.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__all__ = [
'Contract',
]

from boa3.builtin.interop.contract.contractmanifest import ContractManifest
from boa3.builtin.type import UInt160

Expand Down
12 changes: 12 additions & 0 deletions boa3/builtin/interop/contract/contractmanifest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
__all__ = [
'ContractManifest',
'ContractPermission',
'ContractPermissionDescriptor',
'ContractGroup',
'ContractAbi',
'ContractMethodDescriptor',
'ContractEventDescriptor',
'ContractParameterDefinition',
'ContractParameterType',
]

from typing import List, Optional

from boa3.builtin.type import ECPoint, UInt160
Expand Down
27 changes: 20 additions & 7 deletions boa3/builtin/interop/crypto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
__all__ = [
'NamedCurve',
'sha256',
'ripemd160',
'hash160',
'hash256',
'check_sig',
'check_multisig',
'verify_with_ecdsa',
'murmur32',
]


from typing import Any, List

from boa3.builtin.interop.crypto.namedcurve import NamedCurve
from boa3.builtin.type import ByteString, ECPoint
from boa3.builtin.type import ECPoint


def sha256(key: Any) -> bytes:
Expand Down Expand Up @@ -80,12 +93,12 @@ def check_multisig(pubkeys: List[ECPoint], signatures: List[bytes]) -> bool:
pass


def verify_with_ecdsa(message: Any, pubkey: ECPoint, signature: ByteString, curve: NamedCurve) -> bool:
def verify_with_ecdsa(message: bytes, pubkey: ECPoint, signature: bytes, curve: NamedCurve) -> bool:
"""
Using the elliptic curve, it checks if the signature of the any item was originally produced by the public key.
Using the elliptic curve, it checks if the signature of the message was originally produced by the public key.
:param message: the encrypted message
:type message: Any
:type message: bytes
:param pubkey: the public key that might have created the item
:type pubkey: ECPoint
:param signature: the signature of the item
Expand All @@ -98,15 +111,15 @@ def verify_with_ecdsa(message: Any, pubkey: ECPoint, signature: ByteString, curv
pass


def murmur32(data: ByteString, seed: int) -> ByteString:
def murmur32(data: bytes, seed: int) -> bytes:
"""
Computes the hash value for the specified byte array using the murmur32 algorithm.
:param data: the input to compute the hash code for
:type data: ByteString
:type data: bytes
:param seed: the seed of the murmur32 hash function
:type seed: int
:return: the hash value
:rtype: ByteString
:rtype: bytes
"""
pass
5 changes: 5 additions & 0 deletions boa3/builtin/interop/iterator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from __future__ import annotations

__all__ = [
'Iterator',
]


from typing import Any


Expand Down
6 changes: 6 additions & 0 deletions boa3/builtin/interop/json/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
__all__ = [
'json_serialize',
'json_deserialize',
]


from typing import Any


Expand Down
8 changes: 8 additions & 0 deletions boa3/builtin/interop/policy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
__all__ = [
'get_exec_fee_factor',
'get_fee_per_byte',
'get_storage_price',
'is_blocked',
]


from boa3.builtin.type import UInt160


Expand Down
6 changes: 6 additions & 0 deletions boa3/builtin/interop/role/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
__all__ = [
'Role',
'get_designated_by_role',
]


from boa3.builtin.interop.role.roletype import Role
from boa3.builtin.type import ECPoint

Expand Down
28 changes: 26 additions & 2 deletions boa3/builtin/interop/runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
__all__ = [
'Notification',
'TriggerType',
'check_witness',
'notify',
'log',
'get_trigger',
'get_notifications',
'get_network',
'burn_gas',
'get_random',
'load_script',
'address_version',
'executing_script_hash',
'calling_script_hash',
'time',
'gas_left',
'platform',
'invocation_counter',
'entry_script_hash',
'script_container',
]


from typing import Any, List, Union, Sequence

from boa3.builtin.interop.contract.callflagstype import CallFlags
from boa3.builtin.interop.runtime.notification import Notification
from boa3.builtin.interop.runtime.triggertype import TriggerType
from boa3.builtin.type import ECPoint, UInt160, ByteString
from boa3.builtin.type import ECPoint, UInt160


def check_witness(hash_or_pubkey: Union[UInt160, ECPoint]) -> bool:
Expand Down Expand Up @@ -95,7 +119,7 @@ def get_random() -> int:
pass


def load_script(script: ByteString, args: Sequence = (), flags: CallFlags = CallFlags.NONE) -> Any:
def load_script(script: bytes, args: Sequence = (), flags: CallFlags = CallFlags.NONE) -> Any:
"""
Loads a script at runtime.
"""
Expand Down
3 changes: 3 additions & 0 deletions boa3/builtin/interop/runtime/notification.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
__all__ = ['Notification']


from boa3.builtin.type import UInt160


Expand Down
Loading

0 comments on commit 5ce4520

Please sign in to comment.