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

Algorand/upgrade #3529

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
24 changes: 21 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,31 @@ jobs:

algorand:
runs-on: ubuntu-20.04
env:
algorand-node-url: https://github.com/algorand/go-algorand/releases/download/v3.19.0-stable/node_stable_linux-amd64_3.19.0.tar.gz
ALGORAND_GOAL_BIN: ${{ github.workspace }}/algorand/tools/bin/goal
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- run: pip install -r algorand/requirements.txt
- run: cd algorand && make test
- uses: actions/cache@v3
id: cache-algorand-tools
with:
path: algorand/tools
key: ${{ env.algorand-node-url }}
- if: ${{ steps.cache-algorand-tools.outputs.cache-hit != 'true' }}
working-directory: algorand
run: |
mkdir -p tools
cd tools
wget ${{ env.algorand-node-url }}
tar --extract --file node_stable_linux-amd64_3.19.0.tar.gz bin/goal
rm node_stable_linux-amd64_3.19.0.tar.gz
- working-directory: algorand
run: make test

ethereum:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions algorand/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ COPY README.md cert.pem* /certs/
# Debian
RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/certs/ca-certificates.crt; fi

RUN python3 -m pip install virtualenv
RUN wget https://github.com/algorand/go-algorand/releases/download/v3.19.0-stable/node_stable_linux-amd64_3.19.0.tar.gz
RUN tar --extract --file node_stable_linux-amd64_3.19.0.tar.gz bin/goal && rm node_stable_linux-amd64_3.19.0.tar.gz

RUN apt-get update
RUN apt-get -y install netcat

COPY Pipfile.lock Pipfile.lock
COPY Pipfile Pipfile
RUN mkdir teal
COPY Pipfile Pipfile.lock ./

RUN python3 -m pip install pipenv
RUN pipenv install
RUN mkdir teal

COPY *.py .
COPY test/*.json .
Expand Down
13 changes: 7 additions & 6 deletions algorand/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM docker.io/python:3.10@sha256:eeed7cac682f9274d183f8a7533ee1360a26acb3616aa712b2be7896f80d8c5f as algorand-contracts-build

RUN python3 -m pip install virtualenv
COPY Pipfile.lock Pipfile.lock
COPY Pipfile Pipfile
RUN wget https://github.com/algorand/go-algorand/releases/download/v3.19.0-stable/node_stable_linux-amd64_3.19.0.tar.gz
RUN tar --extract --file node_stable_linux-amd64_3.19.0.tar.gz bin/goal && rm node_stable_linux-amd64_3.19.0.tar.gz

RUN mkdir teal
COPY Pipfile Pipfile.lock ./

RUN python3 -m pip install pipenv
RUN pipenv install
RUN mkdir teal
COPY *.py .

RUN pipenv run python3 admin.py --mainnet --genTeal
COPY *.py ./
RUN pipenv run python3 admin.py --mainnet --genTeal

FROM scratch AS algorand-contracts-export
COPY --from=algorand-contracts-build /teal/* .
Expand Down
2 changes: 1 addition & 1 deletion algorand/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pycryptodomex = "==3.12.0"
pydantic = "==1.9.0"
pyparsing = "==3.0.6"
pyteal = "==v0.11.1"
py-algorand-sdk = "==1.10.0b1"
pytest = "==6.2.5"
pytest-depends = "==1.0.1"
pytest-forked = "==1.4.0"
Expand All @@ -31,6 +30,7 @@ coincurve = "==16.0.0"
PyNaCl = "==1.5.0"
PyYAML = "==6.0"
eth-utils = "*"
py-algorand-sdk = "==2.5.0"

[dev-packages]

Expand Down
230 changes: 129 additions & 101 deletions algorand/Pipfile.lock

Large diffs are not rendered by default.

26 changes: 6 additions & 20 deletions algorand/TmplSig.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
from time import time, sleep
from typing import List, Tuple, Dict, Any, Optional, Union
from base64 import b64decode
import base64
import random
import hashlib
import uuid
import sys
import json
# import json
import uvarint
import pprint
# import pprint

from local_blob import LocalBlob
from algosdk.transaction import LogicSigAccount
from pyteal import compileTeal, Mode, Bytes

from algosdk.v2client.algod import AlgodClient
from algosdk.kmd import KMDClient
from algosdk import account, mnemonic
from algosdk.encoding import decode_address
from algosdk.future import transaction
from pyteal import compileTeal, Mode, Expr
from pyteal import *
from algosdk.logic import get_application_address

from algosdk.future.transaction import LogicSigAccount

class TmplSig:
"""KeySig class reads in a json map containing assembly details of a template smart signature and allows you to populate it with the variables
Expand All @@ -47,7 +33,7 @@ def __init__(self, name):
}


self.src = base64.b64decode(self.map["bytecode"])
self.src = b64decode(self.map["bytecode"])
self.sorted = dict(
sorted(
self.map["template_labels"].items(),
Expand All @@ -58,7 +44,7 @@ def __init__(self, name):
def populate(self, values: Dict[str, Union[str, int]]) -> LogicSigAccount:
"""populate uses the map to fill in the variable of the bytecode and returns a logic sig with the populated bytecode"""
# Get the template source
contract = list(base64.b64decode(self.map["bytecode"]))
contract = list(b64decode(self.map["bytecode"]))

shift = 0
for k, v in self.sorted.items():
Expand Down
Loading
Loading