Skip to content

Commit

Permalink
Release 0.36.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankC01 committed Sep 16, 2023
1 parent 2e910c1 commit 4479167
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 55 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.36.0] - 2023-09-16

### Added

- Sui RPC 1.11.0 support

### Fixed

### Changed

### Removed

- Sui RPC 1.6.0 support
- `legacy_digest` option from `sui_utils.publish_build`

## [0.35.1] - Unpublished

### Added

- Sui RPC 1.11.0 support

### Fixed

- [bug](https://github.com/FrankC01/pysui/issues/163) uleb128 encoding of
Expand All @@ -21,6 +38,9 @@ pure vectors (i.e. vector<u8>, etc.)

### Removed

- Sui RPC 1.6.0 support
- `legacy_digest` option from `sui_utils.publish_build`

## [0.35.0] - 2023-08-28

### Added
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

Python Client SDK for Sui blockchain

- Supports _SUI 1.10.x RPC API_
- Backwards compatable to _Sui 1.6.x RPC API_
- Supports _SUI 1.11.x RPC API_
- Backwards compatable to _Sui 1.7.x RPC API_

### pysui SDK Dependencies

Expand All @@ -20,13 +20,13 @@ See [Strategies](https://github.com/FrankC01/pysui/blob/main/OP_STRATEGIES.md)

## pysui SDK current (github)

**Release-0.35.1**
**Release-0.36.0**

See [CHANGELOG](https://github.com/FrankC01/pysui/blob/main/CHANGELOG.md)

## PyPi current

**Release-0.35.0**
**Release-0.36.0**

- [Latest PyPi Version](https://pypi.org/project/pysui/)

Expand Down
4 changes: 2 additions & 2 deletions pysui/sui/sui_clients/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ class _ClientMixin(Provider):
constructor consistency as well as utility functions
"""

_RPC_MINIMAL_VERSION: str = "1.6.0"
_RPC_REQUIRED_VERSION: str = "1.10.0"
_RPC_MINIMAL_VERSION: str = "1.7.0"
_RPC_REQUIRED_VERSION: str = "1.11.0"

@versionchanged(
version="0.26.1",
Expand Down
12 changes: 8 additions & 4 deletions pysui/sui/sui_txn/async_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,16 @@ async def _move_call(
version="0.20.0",
reason="Removed recipient. Transfer of UpgradeCap up to user as per Sui best practice.",
)
@versionchanged(
version="0.36.0",
reason="Drop legacy_digest. No longer supported by Sui.",
)
async def publish(
self,
*,
project_path: str,
with_unpublished_dependencies: bool = False,
skip_fetch_latest_git_deps: bool = False,
legacy_digest: bool = False,
) -> bcs.Argument:
"""publish Creates a publish command.
Expand All @@ -715,7 +718,6 @@ async def publish(
project_path,
with_unpublished_dependencies,
skip_fetch_latest_git_deps,
legacy_digest,
)
return self.builder.publish(modules, dependencies)

Expand All @@ -742,6 +744,10 @@ async def _verify_upgrade_cap(self, upgrade_cap: str) -> ObjectRead:
version="0.20.0",
reason="Added package compiled digest control as per Sui 1.0.0.",
)
@versionchanged(
version="0.36.0",
reason="Drop legacy_digest. No longer supported by Sui.",
)
async def publish_upgrade(
self,
*,
Expand All @@ -750,7 +756,6 @@ async def publish_upgrade(
upgrade_cap: Union[str, ObjectID, ObjectRead],
with_unpublished_dependencies: bool = False,
skip_fetch_latest_git_deps: bool = False,
legacy_digest: bool = False,
) -> bcs.Argument:
"""publish_upgrade Authorize, publish and commit upgrade of package.
Expand Down Expand Up @@ -779,7 +784,6 @@ async def publish_upgrade(
project_path,
with_unpublished_dependencies,
skip_fetch_latest_git_deps,
legacy_digest,
)
# Verify get/upgrade cap details
if not isinstance(upgrade_cap, ObjectRead):
Expand Down
14 changes: 8 additions & 6 deletions pysui/sui/sui_txn/sync_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,16 @@ def _move_call(
version="0.20.0",
reason="Removed recipient. Transfer of UpgradeCap up to user as per Sui best practice.",
)
@versionchanged(
version="0.36.0",
reason="Removed legacy_digest. No longer supported in Sui.",
)
def publish(
self,
*,
project_path: str,
with_unpublished_dependencies: bool = False,
skip_fetch_latest_git_deps: bool = False,
legacy_digest: bool = False,
) -> bcs.Argument:
"""publish Creates a publish command.
Expand All @@ -734,7 +737,6 @@ def publish(
project_path,
with_unpublished_dependencies,
skip_fetch_latest_git_deps,
legacy_digest,
)
return self.builder.publish(modules, dependencies)

Expand All @@ -761,6 +763,10 @@ def _verify_upgrade_cap(self, upgrade_cap: str) -> ObjectRead:
version="0.20.0",
reason="Added package compiled digest control as per Sui 1.0.0.",
)
@versionchanged(
version="0.36.0",
reason="Dropped legacy_digest. No longer supported in Sui.",
)
def publish_upgrade(
self,
*,
Expand All @@ -769,7 +775,6 @@ def publish_upgrade(
upgrade_cap: Union[str, ObjectID, ObjectRead],
with_unpublished_dependencies: bool = False,
skip_fetch_latest_git_deps: bool = False,
legacy_digest: bool = False,
) -> bcs.Argument:
"""publish_upgrade Authorize, publish and commit upgrade of package.
Expand All @@ -785,8 +790,6 @@ def publish_upgrade(
:param skip_fetch_latest_git_deps: Flag indicating to skip compiliation fetch of
package dependencies, defaults to False
:type skip_fetch_latest_git_deps: bool, optional
:param legacy_digest: Flag indicating to create a digest the old way
:type legacy_digest: bool, optional
:return: The Result Argument
:rtype: bcs.Argument
"""
Expand All @@ -798,7 +801,6 @@ def publish_upgrade(
project_path,
with_unpublished_dependencies,
skip_fetch_latest_git_deps,
legacy_digest,
)
# Verify get/upgrade cap details
if not isinstance(upgrade_cap, ObjectRead):
Expand Down
2 changes: 0 additions & 2 deletions pysui/sui/sui_txn/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,13 @@ def _compile_source(
project_path: str,
with_unpublished_dependencies: bool,
skip_fetch_latest_git_deps: bool,
legacy_digest: bool,
) -> tuple[list[str], list[str], bcs.Digest]:
"""."""
src_path = Path(os.path.expanduser(project_path))
compiled_package = publish_build(
src_path,
with_unpublished_dependencies,
skip_fetch_latest_git_deps,
legacy_digest,
)
modules = list(
map(self._to_bytes_from_str, compiled_package.compiled_modules)
Expand Down
37 changes: 3 additions & 34 deletions pysui/sui/sui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,37 +163,11 @@ def _build_dep_info(build_path: str) -> Union[CompiledPackage, Exception]:
raise ValueError("Corrupt publish build information")


@versionadded(
version="0.17.0",
reason="Added true package hash (digest) to CompiledPacakge.",
)
def _package_digest(
package: CompiledPackage, readers: list[ModuleReader]
) -> None:
"""Converts compiled module bytes for publishing and digest calculation."""
mod_strs: list = []
all_bytes: list = []
# Get the bytes for digest and string for publishing
for mod_bytes in readers:
mr_bytes = mod_bytes.reader.getvalue()
all_bytes.append(mr_bytes)
mod_strs.append(SuiString(base64.b64encode(mr_bytes).decode()))
for dep_str in package.dependencies:
all_bytes.append(binascii.unhexlify(dep_str[2:]))

all_bytes.sort()
hasher = hashlib.blake2b(digest_size=32)
for bblock in all_bytes:
hasher.update(bblock)
package.package_digest = hasher.digest()
package.compiled_modules = mod_strs


@versionadded(
version="0.20.0",
reason="Sui move build introduced hashing the modules first.",
)
def _new_package_digest(
def _package_digest(
package: CompiledPackage, readers: list[ModuleReader]
) -> None:
"""Converts compiled module bytes for publishing and digest calculation."""
Expand Down Expand Up @@ -228,7 +202,6 @@ def publish_build(
path_to_package: Path,
include_unpublished: bool = False,
skip_git_dependencie: bool = False,
legacy_digest: bool = False,
) -> Union[CompiledPackage, Exception]:
"""Build and collect module base64 strings and dependencies ObjectIDs."""
if os.environ[PYSUI_EXEC_ENV] == EMPEHMERAL_PATH:
Expand Down Expand Up @@ -257,10 +230,7 @@ def publish_build(
# Construct initial package
cpackage = _build_dep_info(build_subdir[0].path)
# Set module bytes as base64 strings and generate package digest
if legacy_digest:
_package_digest(cpackage, _modules_bytes(byte_modules))
else:
_new_package_digest(cpackage, _modules_bytes(byte_modules))
_package_digest(cpackage, _modules_bytes(byte_modules))
return cpackage


Expand Down Expand Up @@ -742,5 +712,4 @@ def as_sui_txdigest(in_data: Any) -> Union[SuiTransactionDigest, ValueError]:
}

if __name__ == "__main__":
ppath = Path(os.path.expanduser("~/frankc01/sui-track"))
stuff = publish_build(ppath)
pass
2 changes: 1 addition & 1 deletion pysui/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# -*- coding: utf-8 -*-

"""Pysui Version."""
__version__ = "0.35.1"
__version__ = "0.36.0"
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pylint==2.17.4
pydocstyle==6.3.0
pytest==7.3.1
black >= 23.3.0
black >= 23.8.0
mypy==1.4.1
types-Deprecated==1.2.9.3
build==0.10.0
Expand Down
1 change: 0 additions & 1 deletion samples/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
GetTx,
)

from pysui.sui.sui_utils import publish_build
from pysui.sui.sui_excepts import (
SuiMiisingBuildFolder,
SuiPackageBuildFail,
Expand Down

0 comments on commit 4479167

Please sign in to comment.