Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Jan 16, 2025
1 parent 21ee60f commit 3d29a7d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from counterpartycore.lib import exceptions
from counterpartycore.lib.api.apiv1 import APIError

from ..params import ADDR, DP, MULTISIGADDR, P2SH_ADDR

Expand Down Expand Up @@ -510,11 +509,11 @@
},
{
"in": ("balances", None, "barfoo", None, None, None, None, None, 1000, 0, True),
"error": (APIError, "Invalid filter operator (OR, AND)"),
"error": (exceptions.APIError, "Invalid filter operator (OR, AND)"),
},
{
"in": (None, None, "AND", None, None, None, None, None, 1000, 0, True),
"error": (APIError, "Unknown table"),
"error": (exceptions.APIError, "Unknown table"),
},
{
"in": (
Expand All @@ -530,27 +529,27 @@
0,
True,
),
"error": (APIError, "Invalid order direction (ASC, DESC)"),
"error": (exceptions.APIError, "Invalid order direction (ASC, DESC)"),
},
{
"in": ("balances", None, "AND", None, None, None, None, None, 1000.0, 0, True),
"error": (APIError, "Invalid limit"),
"error": (exceptions.APIError, "Invalid limit"),
},
{
"in": ("balances", None, "AND", None, None, None, None, None, 1001, 0, True),
"error": (APIError, "Limit should be lower or equal to 1000"),
"error": (exceptions.APIError, "Limit should be lower or equal to 1000"),
},
{
"in": ("balances", None, "AND", None, None, None, None, None, 1000, 0.0, True),
"error": (APIError, "Invalid offset"),
"error": (exceptions.APIError, "Invalid offset"),
},
{
"in": ("balances", None, "AND", "*", None, None, None, None, 1000, 0, True),
"error": (APIError, "Invalid order_by, must be a field name"),
"error": (exceptions.APIError, "Invalid order_by, must be a field name"),
},
{
"in": ("balances", [0], "AND", None, None, None, None, None, 1000, 0, True),
"error": (APIError, "Unknown filter type"),
"error": (exceptions.APIError, "Unknown filter type"),
},
{
"in": (
Expand All @@ -566,7 +565,7 @@
0,
True,
),
"error": (APIError, "A specified filter is missing the 'value' field"),
"error": (exceptions.APIError, "A specified filter is missing the 'value' field"),
},
{
"in": (
Expand All @@ -582,7 +581,7 @@
0,
True,
),
"error": (APIError, "Invalid value for the field 'bar'"),
"error": (exceptions.APIError, "Invalid value for the field 'bar'"),
},
{
"in": (
Expand All @@ -598,7 +597,7 @@
0,
True,
),
"error": (APIError, "Invalid value for the field 'bar'"),
"error": (exceptions.APIError, "Invalid value for the field 'bar'"),
},
{
"in": (
Expand All @@ -614,7 +613,7 @@
0,
True,
),
"error": (APIError, "Invalid operator for the field 'bar'"),
"error": (exceptions.APIError, "Invalid operator for the field 'bar'"),
},
{
"in": (
Expand All @@ -630,7 +629,7 @@
0,
True,
),
"error": (APIError, "case_sensitive must be a boolean"),
"error": (exceptions.APIError, "case_sensitive must be a boolean"),
},
{
"comment": "standard send with no memo",
Expand Down Expand Up @@ -857,7 +856,7 @@
0,
True,
),
"error": (APIError, "Invalid memo_hex value"),
"error": (exceptions.APIError, "Invalid memo_hex value"),
},
{
"comment": "search by memo hex",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from fractions import Fraction

from counterpartycore.lib import exceptions
from counterpartycore.lib.ledger.ledger import CreditError, DebitError

from ..params import (
ADDR,
Expand All @@ -10,6 +9,22 @@

LEDGER_VECTOR = {
"ledger.ledger": {
"last_message": [
{
"in": (),
"out": {
"message_index": 1743,
"block_index": 310703,
"command": "parse",
"category": "blocks",
"bindings": '{"block_index":310703,"ledger_hash":"3e8ba9968f58a14dd4950aa1a1f02d58edfd246a2ac733a5fac4aa2c04505e3e","messages_hash":"794d8c3df2ea1ce1b68833e0c33f7a846445f6da53dadceaaff41aac66dd5c83","transaction_count":0,"txlist_hash":"c76b69cb9056ed5b35e10737d93aa2fde389690899503f46f3ca18d419ce4dd2"}',
"timestamp": 0,
"event": "BLOCK_PARSED",
"tx_hash": None,
"event_hash": "7c68ff23281790be67a757e3ba0eb0a0bcd57ca2cae307531a1ae9de28f9c939",
},
}
],
"generate_asset_id": [
{"in": ("BTC", DP["default_block_index"]), "out": 0},
{"in": ("XCP", DP["default_block_index"]), "out": 1},
Expand Down Expand Up @@ -50,22 +65,6 @@
{"in": (2**64, 308000), "error": (exceptions.AssetIDError, "too high")},
],
"price": [{"in": (1, 10), "out": Fraction(1, 10)}],
"last_message": [
{
"in": (),
"out": {
"message_index": 1743,
"block_index": 310703,
"command": "parse",
"category": "blocks",
"bindings": '{"block_index":310703,"ledger_hash":"3e8ba9968f58a14dd4950aa1a1f02d58edfd246a2ac733a5fac4aa2c04505e3e","messages_hash":"794d8c3df2ea1ce1b68833e0c33f7a846445f6da53dadceaaff41aac66dd5c83","transaction_count":0,"txlist_hash":"c76b69cb9056ed5b35e10737d93aa2fde389690899503f46f3ca18d419ce4dd2"}',
"timestamp": 0,
"event": "BLOCK_PARSED",
"tx_hash": None,
"event_hash": "7c68ff23281790be67a757e3ba0eb0a0bcd57ca2cae307531a1ae9de28f9c939",
},
}
],
"get_asset_id": [
{"in": ("XCP", DP["default_block_index"]), "out": 1},
{"in": ("BTC", DP["default_block_index"]), "out": 0},
Expand All @@ -85,31 +84,34 @@
{"in": (ADDR[0], "XCP", 1, 0), "out": None},
{
"in": (ADDR[0], "BTC", DP["quantity"], 0),
"error": (DebitError, "Cannot debit bitcoins."),
"error": (exceptions.DebitError, "Cannot debit bitcoins."),
},
{
"in": (ADDR[0], "BTC", -1 * DP["quantity"], 0),
"error": (DebitError, "Negative quantity."),
"error": (exceptions.DebitError, "Negative quantity."),
},
{
"in": (ADDR[0], "BTC", 1.1 * DP["quantity"], 0),
"error": (DebitError, "Quantity must be an integer."),
"error": (exceptions.DebitError, "Quantity must be an integer."),
},
{
"in": (ADDR[0], "XCP", 2**40, 0),
"error": (exceptions.DebitError, "Insufficient funds."),
},
{"in": (ADDR[0], "XCP", 2**40, 0), "error": (DebitError, "Insufficient funds.")},
],
"credit": [
{"in": (ADDR[0], "XCP", 1, 0), "out": None},
{
"in": (ADDR[0], "BTC", DP["quantity"], 0),
"error": (CreditError, "Cannot debit bitcoins."),
"error": (exceptions.CreditError, "Cannot debit bitcoins."),
},
{
"in": (ADDR[0], "BTC", -1 * DP["quantity"], 0),
"error": (CreditError, "Negative quantity."),
"error": (exceptions.CreditError, "Negative quantity."),
},
{
"in": (ADDR[0], "BTC", 1.1 * DP["quantity"], 0),
"error": (CreditError, "Quantity must be an integer."),
"error": (exceptions.CreditError, "Quantity must be an integer."),
},
],
"is_divisible": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import time

import sh
from counterpartycore.lib.exceptions import ComposeError
from regtestcli import atomic_swap
from regtestnode import ComposeError, RegtestNodeThread, print_server_output
from regtestnode import RegtestNodeThread, print_server_output
from scenarios import (
scenario_1_fairminter,
scenario_2_fairminter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import hypothesis
from counterpartycore.lib import config
from counterpartycore.lib.exceptions import ComposeError
from counterpartycore.lib.utils import assetnames
from hypothesis import settings
from properytestnode import PropertyTestNode
from regtestnode import ComposeError

MESSAGE_IDS = [
0,
Expand Down

0 comments on commit 3d29a7d

Please sign in to comment.