Skip to content

Commit

Permalink
Merge pull request #2432 from CounterpartyXCP/develop
Browse files Browse the repository at this point in the history
v10.5.0-alpha.1
  • Loading branch information
ouziel-slama authored Oct 18, 2024
2 parents 34d4436 + 7637a95 commit 1b2ac23
Show file tree
Hide file tree
Showing 16 changed files with 5,039 additions and 4,772 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docker Compose

on:
push:
branches: ['develop', 'master', 'fixutxo']
branches: ['develop', 'master', 'fixes']

jobs:
build:
Expand Down
5,030 changes: 2,545 additions & 2,485 deletions apiary.apib

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions counterparty-core/counterpartycore/lib/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,11 +1023,11 @@ def database_version(db):
else config.NEED_REPARSE_IF_MINOR_IS_LESS_THAN
)
if need_reparse_from is not None:
min_version_minor, min_version_block_index = need_reparse_from
if version_minor < min_version_minor:
raise DatabaseVersionError(
message=message,
required_action="reparse",
from_block_index=min_version_block_index,
)
for min_version_minor, min_version_block_index in need_reparse_from:
if version_minor < min_version_minor:
raise DatabaseVersionError(
message=message,
required_action="reparse",
from_block_index=min_version_block_index,
)
raise DatabaseVersionError(message=message, required_action=None)
6 changes: 3 additions & 3 deletions counterparty-core/counterpartycore/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


# Semantic Version
__version__ = "10.4.8" # for hatch
__version__ = "10.5.0-alpha.1" # for hatch
VERSION_STRING = __version__
version = VERSION_STRING.split("-")[0].split(".")
VERSION_MAJOR = int(version[0])
Expand All @@ -20,8 +20,8 @@
# Fo example:
# NEED_REPARSE_IF_MINOR_IS_LESS_THAN = (1, 800000)
# means that we need to reparse from block 800000 if database minor version is less than 1
NEED_REPARSE_IF_MINOR_IS_LESS_THAN = (3, 0)
NEED_REPARSE_IF_MINOR_IS_LESS_THAN_TESTNET = (3, 0)
NEED_REPARSE_IF_MINOR_IS_LESS_THAN = [(3, 0), (9, 865999)]
NEED_REPARSE_IF_MINOR_IS_LESS_THAN_TESTNET = [(3, 0), (9, 2925799)]
# Counterparty protocol
TXTYPE_FORMAT = ">I"
SHORT_TXTYPE_FORMAT = "B"
Expand Down
4 changes: 2 additions & 2 deletions counterparty-core/counterpartycore/lib/messages/fairminter.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def parse(db, tx, message):
# if the asset is a subasset and does not exist we generate a random numeric name
# subassets are free
if existing_asset is None:
asset_name = util.generate_random_asset()
asset_name = util.deterministic_random_asset_name(db, asset_longname)
else:
asset_name = existing_asset["asset"]
else:
Expand Down Expand Up @@ -473,7 +473,7 @@ def parse(db, tx, message):
"tx_index": tx["tx_index"],
"tx_hash": tx["tx_hash"],
"block_index": tx["block_index"],
"asset": asset,
"asset": asset_name,
"quantity": premint_quantity,
"divisible": divisible,
"source": tx["source"],
Expand Down
26 changes: 26 additions & 0 deletions counterparty-core/counterpartycore/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,32 @@ def generate_random_asset(subasset_longname=None):
return "A" + str(random.randint(26**12 + 1, 2**64 - 1)) # nosec B311 # noqa: S311


def gen_random_asset_name(seed, add=0):
return "A" + str(
int(hashlib.shake_256(bytes(seed, "utf8")).hexdigest(4), 16) + 26**12 + 1 + add
)


def asset_exists(db, name):
cursor = db.cursor()
cursor.execute(
"SELECT * FROM issuances WHERE asset = ?",
(name,),
)
if cursor.fetchall():
return True
return False


def deterministic_random_asset_name(db, seed):
asset_name = gen_random_asset_name(seed)
add = 0
while asset_exists(db, asset_name):
asset_name = gen_random_asset_name(seed, add=add)
add += 1
return asset_name


def parse_options_from_string(string):
"""Parse options integer from string, if exists."""
string_list = string.split(" ")
Expand Down
4,596 changes: 2,328 additions & 2,268 deletions counterparty-core/counterpartycore/test/regtest/apidoc/apicache.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Returns server information and the list of documented routes in JSON format.
"result": {
"server_ready": true,
"network": "mainnet",
"version": "10.4.8",
"version": "10.5.0-alpha.1",
"backend_height": 850214,
"counterparty_height": 850214,
"documentation": "https://counterpartycore.docs.apiary.io/",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
SCENARIO = [
{
"title": "Create numeric sub asset fairminter",
"transaction": "fairminter",
"source": "$ADDRESS_1",
"params": {
"asset": "SUBMYASSETA",
"asset_parent": "MYASSETA",
"price": 1,
"quantity_by_price": 5,
},
"controls": [
{
"url": "blocks/$BLOCK_INDEX/events?event_name=ASSET_ISSUANCE,ASSET_CREATION,NEW_FAIRMINTER",
"result": [
{
"event": "ASSET_ISSUANCE",
"event_index": "$EVENT_INDEX_5",
"params": {
"asset": "A95428958968845068",
"asset_events": "open_fairminter",
"asset_longname": "MYASSETA.SUBMYASSETA",
"block_index": "$BLOCK_INDEX",
"call_date": 0,
"call_price": 0,
"callable": False,
"description": "",
"divisible": True,
"fair_minting": True,
"fee_paid": 0,
"issuer": "$ADDRESS_1",
"locked": False,
"quantity": 0,
"reset": False,
"source": "$ADDRESS_1",
"status": "valid",
"transfer": False,
"tx_hash": "$TX_HASH",
"tx_index": 42,
},
"tx_hash": "$TX_HASH",
},
{
"event": "ASSET_CREATION",
"event_index": "$EVENT_INDEX_4",
"params": {
"asset_id": "95428958968845068",
"asset_longname": "MYASSETA.SUBMYASSETA",
"asset_name": "A95428958968845068",
"block_index": "$BLOCK_INDEX",
},
"tx_hash": "$TX_HASH",
},
{
"event": "NEW_FAIRMINTER",
"event_index": "$EVENT_INDEX_3",
"params": {
"asset": "A95428958968845068",
"asset_longname": "MYASSETA.SUBMYASSETA",
"asset_parent": "MYASSETA",
"block_index": "$BLOCK_INDEX",
"burn_payment": False,
"description": "",
"divisible": True,
"end_block": 0,
"hard_cap": 0,
"lock_description": False,
"lock_quantity": False,
"max_mint_per_tx": 0,
"minted_asset_commission_int": 0,
"pre_minted": False,
"premint_quantity": 0,
"price": 1,
"quantity_by_price": 5,
"soft_cap": 0,
"soft_cap_deadline_block": 0,
"source": "$ADDRESS_1",
"start_block": 0,
"status": "open",
"tx_hash": "$TX_HASH",
"tx_index": 42,
},
"tx_hash": "$TX_HASH",
},
],
},
],
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
scenario_13_cancel,
scenario_14_sweep,
scenario_15_destroy,
scenario_16_fairminter,
scenario_last_mempool,
)
from termcolor import colored
Expand All @@ -37,6 +38,7 @@
SCENARIOS += scenario_5_dispenser.SCENARIO
SCENARIOS += scenario_6_dispenser.SCENARIO
SCENARIOS += scenario_7_utxo.SCENARIO
SCENARIOS += scenario_16_fairminter.SCENARIO
SCENARIOS += scenario_8_atomicswap.SCENARIO
SCENARIOS += scenario_9_issuance.SCENARIO
SCENARIOS += scenario_10_orders.SCENARIO
Expand Down
2 changes: 1 addition & 1 deletion counterparty-core/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ JSON-log-formatter==1.0
yoyo-migrations==8.2.0
gunicorn==23.0.0
waitress==3.0.0
counterparty-rs==10.4.8
counterparty-rs==10.5.0-alpha.1
2 changes: 1 addition & 1 deletion counterparty-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion counterparty-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "counterparty-rs"
version = "10.4.8"
version = "10.5.0-alpha.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion counterparty-wallet/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ colorlog==6.8.0
python-dateutil==2.8.2
requests==2.32.0
termcolor==2.4.0
counterparty-core==10.4.8
counterparty-core==10.5.0-alpha.1
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ x-addrindexrs-common: &addrindexrs-common
restart: unless-stopped

x-counterparty-common: &counterparty-common
image: counterparty/counterparty:v10.4.8
image: counterparty/counterparty:v10.5.0-alpha.1
stop_grace_period: 1m
volumes:
- data:/root/.bitcoin
Expand Down
30 changes: 30 additions & 0 deletions release-notes/release-notes-v10.5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Release Notes - Counterparty Core v10.5.0 (2024-10-18)

This is a hotfix release to fix non-determinitic bug is asset name generation.

# Upgrading

This update requires an automatic reparse from block 865999

# ChangeLog

## Bugfixes

- Fix non-determinitic bug is asset name generation
- Fix sub-asset name in `issuances` table when created by a fairminter

## Codebase

- Support several required reparsing by major version

## API

## CLI



# Credits

* Ouziel Slama
* Warren Puffett
* Adam Krellenstein

0 comments on commit 1b2ac23

Please sign in to comment.