Skip to content

Commit

Permalink
Merge branch 'release/v2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Algo-devops-service committed Aug 17, 2023
2 parents 894c699 + 0265b9b commit fc25cc6
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
python-version:
type: string
machine:
image: "ubuntu-2004:202104-01"
image: "ubuntu-2204:2022.04.2"
steps:
- checkout
- run: PYTHON_VERSION=<< parameters.python-version >> make docker-test
Expand Down
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# .git-blame-ignore-revs
# Exclude formatting commits made by black
# more black formatting Aug 17, 2021
a9facdf30ca467b6e16d13ce88d8889bba7f2e1c
# formatting Aug 16, 2021
ea81ba259216b8be7fb86ef5d3e9c151a94edf87
# apply black Aug 11, 2021
81fe44f0dd9785b1665bbbea047aed591912534b
74 changes: 23 additions & 51 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
fi
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v3.5.3
with:
fetch-depth: 0

Expand Down Expand Up @@ -78,52 +78,25 @@ jobs:
fi
- name: Build Changelog
uses: mikepenz/release-changelog-builder-action@v3.7.2
id: build-changelog
env:
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
with:
fromTag: ${{ env.PREVIOUS_VERSION }}
toTag: ${{ env.RELEASE_BRANCH }}
failOnError: true
configurationJson: |
{
"categories": [
{
"title": "## New Features",
"labels": [
"New Feature"
]
},
{
"title": "## Enhancement",
"labels": [
"Enhancement"
]
},
{
"title": "## Bug Fixes",
"labels": [
"Bug-Fix"
]
},
{
"title": "## Not Yet Enabled",
"labels": [
"Not-Yet-Enabled"
]
}
],
"ignore_labels": [
"Skip-Release-Notes"
],
"sort": {
"order": "ASC",
"on_property": "mergedAt"
},
"template": "#{{CHANGELOG}}",
"pr_template": "- #{{TITLE}} by #{{AUTHOR}} in ##{{NUMBER}}"
}
run: |
CHANGELOG=$(curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
-d '{"tag_name":"${{ env.RELEASE_VERSION }}","target_commitish":"${{ env.RELEASE_BRANCH }}","previous_tag_name":"${{ env.PREVIOUS_VERSION }}","configuration_file_path":".github/release.yml"}' \
| jq -r '.body')
# The EOF steps are used to save multiline string in github:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "changelog<<$EOF" >> $GITHUB_OUTPUT
echo -e "${CHANGELOG}" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Update Changelog
if: ${{ env.PRE_RELEASE_VERSION == '' }}
Expand All @@ -132,7 +105,7 @@ jobs:
PREVIOUS_VERSION: ${{ steps.get-release.outputs.latest-tag }}
run: |
echo "$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md
echo -e "# Changelog\n\n# ${RELEASE_VERSION}\n\n${CHANGELOG_CONTENT}**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_VERSION}...${RELEASE_VERSION}" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md
echo -e "# Changelog\n\n# ${RELEASE_VERSION}\n\n${CHANGELOG_CONTENT}" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md
- name: Update version in setup.py
env:
Expand All @@ -154,14 +127,12 @@ jobs:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.set-release.outputs.release-tag }}
run: |
echo -e "# ${RELEASE_TAG}\n\n${CHANGELOG_CONTENT}**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_VERSION}...${RELEASE_TAG}" > tmp_msg_body.txt
export msg_body=$(cat tmp_msg_body.txt)
rm tmp_msg_body.txt
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395
PULL_REQUEST_URL=$(gh pr create --base "master" \
--title "FOR REVIEW ONLY: py-algorand-sdk $RELEASE_TAG" \
--title "FOR REVIEW ONLY: ${{ github.event.repository.name }} $RELEASE_TAG" \
--label "Skip-Release-Notes" \
--body "$msg_body" | tail -n 1)
--label "Team Hyper Flow" \
--body "${CHANGELOG_CONTENT}" | tail -n 1)
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then
PULL_REQUEST_NUM=$(echo $PULL_REQUEST_URL | sed 's:.*/::')
echo "pull-request-master=$PULL_REQUEST_URL" >> $GITHUB_ENV
Expand All @@ -180,8 +151,9 @@ jobs:
run: |
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395
PULL_REQUEST_URL=$(gh pr create --base "develop" \
--title "FOR REVIEW ONLY: Merge back py-algorand-sdk $RELEASE_TAG to develop" \
--title "FOR REVIEW ONLY: Merge back ${{ github.event.repository.name }} $RELEASE_TAG to develop" \
--label "Skip-Release-Notes" \
--label "Team Hyper Flow" \
--body "Merge back version changes to develop." | tail -n 1)
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then
echo "Pull request to Develop created: $PULL_REQUEST_URL"
Expand Down
2 changes: 1 addition & 1 deletion .test-env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configs for testing repo download:
SDK_TESTING_URL="https://github.com/algorand/algorand-sdk-testing"
SDK_TESTING_BRANCH="master"
SDK_TESTING_BRANCH="V2"
SDK_TESTING_HARNESS="test-harness"

INSTALL_ONLY=0
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

# v2.4.0

<!-- Release notes generated using configuration in .github/release.yml at release/v2.4.0 -->

## What's Changed
### Bugfixes
* bug-fix: include currency-greater-than param for 0 value by @shiqizng in https://github.com/algorand/py-algorand-sdk/pull/508
### New Features
* Simulation: Execution trace (PC/Stack/Scratch) support by @ahangsu in https://github.com/algorand/py-algorand-sdk/pull/505
### Enhancements
* other: Ignore formatting commits in git blame by @algochoi in https://github.com/algorand/py-algorand-sdk/pull/485


**Full Changelog**: https://github.com/algorand/py-algorand-sdk/compare/v2.3.0...v2.4.0

# v2.3.0

## New Features
Expand Down
13 changes: 11 additions & 2 deletions algosdk/atomic_transaction_composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def __init__(
tx_ids: List[str],
results: List[SimulateABIResult],
eval_overrides: Optional[SimulateEvalOverrides] = None,
exec_trace_config: Optional[models.SimulateTraceConfig] = None,
) -> None:
self.version = version
self.failure_message = failure_message
Expand All @@ -323,6 +324,7 @@ def __init__(
self.tx_ids = tx_ids
self.abi_results = results
self.eval_overrides = eval_overrides
self.exec_trace_config = exec_trace_config


class AtomicTransactionComposer:
Expand Down Expand Up @@ -796,8 +798,6 @@ def simulate(
# build up data structure with fields we'd want
sim_results = []
for idx, result in enumerate(method_results):
sim_txn: Dict[str, Any] = txn_group["txn-results"][idx]

sim_results.append(
SimulateABIResult(
tx_id=result.tx_id,
Expand All @@ -809,6 +809,14 @@ def simulate(
)
)

exec_trace_config: Optional[models.SimulateTraceConfig] = (
None
if "exec-trace-config" not in simulation_result
else models.SimulateTraceConfig.undictify(
simulation_result["exec-trace-config"]
)
)

return SimulateAtomicTransactionResponse(
version=simulation_result.get("version", 0),
failure_message=txn_group.get("failure-message", ""),
Expand All @@ -819,6 +827,7 @@ def simulate(
eval_overrides=SimulateEvalOverrides.from_simulation_result(
simulation_result
),
exec_trace_config=exec_trace_config,
)

def execute(
Expand Down
10 changes: 5 additions & 5 deletions algosdk/v2client/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def accounts(
query["limit"] = limit
if next_page:
query["next"] = next_page
if min_balance:
if min_balance is not None:
query["currency-greater-than"] = min_balance
if max_balance:
query["currency-less-than"] = max_balance
Expand Down Expand Up @@ -204,7 +204,7 @@ def asset_balances(
query["limit"] = limit
if next_page:
query["next"] = next_page
if min_balance:
if min_balance is not None:
query["currency-greater-than"] = min_balance
if max_balance:
query["currency-less-than"] = max_balance
Expand Down Expand Up @@ -548,7 +548,7 @@ def search_transactions(
query["before-time"] = end_time
if start_time:
query["after-time"] = start_time
if min_amount:
if min_amount is not None:
query["currency-greater-than"] = min_amount
if max_amount:
query["currency-less-than"] = max_amount
Expand Down Expand Up @@ -650,7 +650,7 @@ def search_transactions_by_address(
query["before-time"] = end_time
if start_time:
query["after-time"] = start_time
if min_amount:
if min_amount is not None:
query["currency-greater-than"] = min_amount
if max_amount:
query["currency-less-than"] = max_amount
Expand Down Expand Up @@ -752,7 +752,7 @@ def search_asset_transactions(
query["before-time"] = end_time
if start_time:
query["after-time"] = start_time
if min_amount:
if min_amount is not None:
query["currency-greater-than"] = min_amount
if max_amount:
query["currency-less-than"] = max_amount
Expand Down
2 changes: 2 additions & 0 deletions algosdk/v2client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from algosdk.v2client.models.simulate_request import (
SimulateRequest,
SimulateRequestTransactionGroup,
SimulateTraceConfig,
)

__all__ = [
Expand All @@ -52,4 +53,5 @@
"TealValue",
"SimulateRequest",
"SimulateRequestTransactionGroup",
"SimulateTraceConfig",
]
44 changes: 41 additions & 3 deletions algosdk/v2client/models/simulate_request.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import List, Dict, Any, TYPE_CHECKING
from typing import List, Dict, Any, TYPE_CHECKING, Optional

if TYPE_CHECKING:
from algosdk import transaction


class SimulateRequestTransactionGroup(object):
class SimulateRequestTransactionGroup:
txns: "List[transaction.GenericSignedTransaction]"

def __init__(
Expand All @@ -16,11 +16,44 @@ def dictify(self) -> Dict[str, Any]:
return {"txns": [txn.dictify() for txn in self.txns]}


class SimulateRequest(object):
class SimulateTraceConfig:
enable: bool
stack_change: bool
scratch_change: bool

def __init__(
self,
*,
enable: bool = False,
stack_change: bool = False,
scratch_change: bool = False,
) -> None:
self.enable = enable
self.stack_change = stack_change
self.scratch_change = scratch_change

def dictify(self) -> Dict[str, Any]:
return {
"enable": self.enable,
"stack-change": self.stack_change,
"scratch-change": self.scratch_change,
}

@staticmethod
def undictify(d: Dict[str, Any]) -> "SimulateTraceConfig":
return SimulateTraceConfig(
enable="enable" in d and d["enable"],
stack_change="stack-change" in d and d["stack-change"],
scratch_change="scratch-change" in d and d["scratch-change"],
)


class SimulateRequest:
txn_groups: List[SimulateRequestTransactionGroup]
allow_more_logs: bool
allow_empty_signatures: bool
extra_opcode_budget: int
exec_trace_config: SimulateTraceConfig

def __init__(
self,
Expand All @@ -29,11 +62,15 @@ def __init__(
allow_more_logs: bool = False,
allow_empty_signatures: bool = False,
extra_opcode_budget: int = 0,
exec_trace_config: Optional[SimulateTraceConfig] = None,
) -> None:
self.txn_groups = txn_groups
self.allow_more_logs = allow_more_logs
self.allow_empty_signatures = allow_empty_signatures
self.extra_opcode_budget = extra_opcode_budget
self.exec_trace_config = (
exec_trace_config if exec_trace_config else SimulateTraceConfig()
)

def dictify(self) -> Dict[str, Any]:
return {
Expand All @@ -43,4 +80,5 @@ def dictify(self) -> Dict[str, Any]:
"allow-more-logging": self.allow_more_logs,
"allow-empty-signatures": self.allow_empty_signatures,
"extra-opcode-budget": self.extra_opcode_budget,
"exec-trace-config": self.exec_trace_config.dictify(),
}
9 changes: 9 additions & 0 deletions scripts/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

import argparse
import re
import sys


def check_version(new_version):
if not re.fullmatch(r"[0-9]+\.[0-9]+\.[a-z.0-9]+", new_version):
sys.exit(
"The version does not match the regex(major.minor.patch): [0-9]+\.[0-9]+\.[a-z.0-9]+"
)


def bump_version(new_version, setup_py_path):
Expand Down Expand Up @@ -31,4 +39,5 @@ def bump_version(new_version, setup_py_path):

args = parser.parse_args()

check_version(args.new_version)
bump_version(args.new_version, args.setup_py_path)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
description="Algorand SDK in Python",
author="Algorand",
author_email="pypiservice@algorand.com",
version="2.3.0",
version="2.4.0",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/algorand/py-algorand-sdk",
Expand Down
1 change: 1 addition & 0 deletions tests/integration.tags
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
@simulate
@simulate.lift_log_limits
@simulate.extra_opcode_budget
@simulate.exec_trace_with_stack_scratch

0 comments on commit fc25cc6

Please sign in to comment.