Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.
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
6 changes: 3 additions & 3 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ USER root

COPY requirements.txt /requirements.txt
RUN apt-get update && apt-get -y install build-essential curl libltdl7 git make \
&& pip install -r /requirements.txt \
&& pip install pytest twine
&& pip install -r /requirements.txt

WORKDIR /app

RUN curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
RUN curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ publish-test:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
@echo done

deps:
@echo generating requirements.txt
dephell deps convert
@echo done

changelog:
@echo build changelog
gitolog -t keepachangelog -s angular . -o CHANGELOG.md
Expand Down
2 changes: 1 addition & 1 deletion aeternity/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

def _base58_encode(data):
"""create a base58 encoded string with checksum"""
return base58.b58encode_check(data)
return base58.b58encode_check(data).decode("ascii")


def _base58_decode(encoded_str):
Expand Down
2 changes: 1 addition & 1 deletion aeternity/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def from_public_private_key_strings(cls, public, private):
"""
kp = cls.from_private_key_string(private)
if kp.get_address() != public:
raise ValueError("Public key and private account mismatch")
raise ValueError(f"Public key mismatch expected: {public} got {kp.get_address()}")
return kp


Expand Down
16 changes: 2 additions & 14 deletions aeternity/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@ def std_fee(tx_raw, fee_idx, base_gas_multiplier=1):
expected = (defaults.BASE_GAS * base_gas_multiplier + len(rlp.encode(tx_copy)) * defaults.GAS_PER_BYTE) * defaults.GAS_PRICE
return actual_fee

def contract_fee(tx_raw, fee_idx, gas, base_gas_multiplier=1):
# estimate the contract creation fee
tx_copy = tx_raw # create a copy of the input
actual_fee = 0
tx_copy[fee_idx] = _int(actual_fee) # replace fee with a byte array of length 1
expected = (defaults.BASE_GAS * base_gas_multiplier + gas + len(rlp.encode(tx_copy)) * defaults.GAS_PER_BYTE) * defaults.GAS_PRICE
while expected != actual_fee:
actual_fee = expected
tx_copy[fee_idx] = _int(expected)
expected = (defaults.BASE_GAS * base_gas_multiplier + gas + len(rlp.encode(tx_copy)) * defaults.GAS_PER_BYTE) * defaults.GAS_PRICE
return actual_fee

def oracle_fee(tx_raw, fee_idx, relative_ttl):
# estimate oracle fees
tx_copy = tx_raw # create a copy of the input
Expand Down Expand Up @@ -349,7 +337,7 @@ def pointer_tag(pointer):
_binary(decode(kwargs.get("call_data"))),
]
# TODO: verify the fee calculation for the contract
min_fee = contract_fee(tx_native, tx_field_fee_index, kwargs.get("gas"), base_gas_multiplier=5)
min_fee = std_fee(tx_native, tx_field_fee_index, base_gas_multiplier=5)
elif op == UNPACK_TX: # unpack transaction
vml = len(tx_native[5]) # this is used to extract the abi and vm version from the 5th field
tx_data = dict(
Expand Down Expand Up @@ -390,7 +378,7 @@ def pointer_tag(pointer):
_int(kwargs.get("gas_price")),
_binary(decode(kwargs.get("call_data"))),
]
min_fee = contract_fee(tx_native, tx_field_fee_index, kwargs.get("gas"), base_gas_multiplier=30)
min_fee = std_fee(tx_native, tx_field_fee_index, base_gas_multiplier=30)
elif op == UNPACK_TX: # unpack transaction
vml = len(tx_native[5]) # this is used to extract the abi and vm version from the 5th field
tx_data = dict(
Expand Down
Loading