Skip to content

Develop port#127

Closed
F1r3Hydr4nt wants to merge 247 commits intomasterfrom
develop-port
Closed

Develop port#127
F1r3Hydr4nt wants to merge 247 commits intomasterfrom
develop-port

Conversation

@F1r3Hydr4nt
Copy link
Copy Markdown
Collaborator

@F1r3Hydr4nt F1r3Hydr4nt commented Nov 19, 2025

Description of Changes

Added

  • Complete Wallet infrastructure with serializers, substrates, and implementations for full wallet functionality
  • Authentication system including peer authentication, certificates, session management, and HTTP transport
  • Enhanced BEEF infrastructure with dedicated builder, serializer, and validator modules
  • Script interpreter with comprehensive opcode support, stack operations, and script execution engine
  • Storage interfaces and implementations for data upload/download with encryption support
  • Overlay tools including lookup resolver, SHIP broadcaster, historian, and host reputation tracker
  • Registry client for overlay network management
  • Identity client with contacts manager for identity and contact management
  • Headers client for blockchain header synchronization
  • Keystore with local key-value store implementation supporting encrypted storage
  • Additional cryptographic primitives: Schnorr signatures, DRBG (Deterministic Random Bit Generator), AES-GCM encryption
  • Compatibility modules for BSM (Bitcoin Signed Message) and ECIES encryption
  • TOTP (Time-based One-Time Password) support for two-factor authentication
  • BIP-276 payment destination encoding support
  • PushDrop token protocol implementation
  • Teranode broadcaster support

Testing Procedure

Testing, along with coverage has been upgraded to a better structure. Legacy tests were ensured still pass.

  • I have added new unit tests
  • All tests pass locally
  • I have tested manually in my local environment

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have updated CHANGELOG.md with my changes
  • I have run the linter

jo7ueb and others added 30 commits August 13, 2025 11:58
…ption, master_certificate, peer_session, requested_certificate_set, verifiable_certificate) and remove sys.path hack in keys
…llet integration and callbacks\n\n- Closes #55, #54, #53, #52, #51, #50, #49, #48\n- Implement session manager + helpers and re-export PeerSession\n- Handshake (nonce-based), general message sign/verify, cert req/resp\n- Integrate wallet interface for HMAC/sign/verify + encryption hooks\n- Callback registration APIs and safer invocation (snapshot)\n- Reduce cognitive complexity and add defensive checks\n- Best-effort stop() and secure_send() delegate
Refactor SimplifiedHTTPTransport: improve error handling and payload …
fix(utils): Update utils module with latest changes and absolute imports
feat(auth/clients): Add and update client modules under auth/clients
feat(auth/transports): Add and update modules under auth/transports
refactor(chaintrackers): update imports to absolute paths and clean u…
chore(registry): translate comments to English and clean up code
@github-actions
Copy link
Copy Markdown

Test Coverage Report

📊 Coverage: 84.4%

View the full coverage report in the build artifacts.

@F1r3Hydr4nt F1r3Hydr4nt requested a review from Copilot January 16, 2026 05:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 114 out of 541 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return {}

def set_state(self, state: dict) -> None:
return
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The set_state method in NopStateHandler returns None explicitly but this is redundant. In Python, functions/methods return None by default if no return statement is specified. Simply use pass instead for cleaner null object pattern implementation.

Suggested change
return
pass

Copilot uses AI. Check for mistakes.
@F1r3Hydr4nt F1r3Hydr4nt requested a review from Copilot January 16, 2026 06:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 114 out of 541 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

raise TypeError("unsupported script type")
# An array of script chunks that make up the script.
self.chunks: List[ScriptChunk] = []
self.chunks: list[ScriptChunk] = []
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation uses lowercase list which requires Python 3.9+. For consistency with other files in the PR that use List from typing (e.g., bsv/script/interpreter/thread.py line 7), consider using List[ScriptChunk] from the typing module to maintain compatibility.

Suggested change
self.chunks: list[ScriptChunk] = []
self.chunks: List[ScriptChunk] = []

Copilot uses AI. Check for mistakes.
elif self.prev_output is not None:
locking_script = self.prev_output.locking_script
else:
return Error(ErrorCode.ERR_INVALID_PARAMS, "no locking script available")
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message could be more specific about why the locking script is unavailable. Consider updating to 'no locking script available: neither opts.locking_script nor prev_output.locking_script is set' to help developers diagnose the issue.

Suggested change
return Error(ErrorCode.ERR_INVALID_PARAMS, "no locking script available")
return Error(
ErrorCode.ERR_INVALID_PARAMS,
"no locking script available: neither opts.locking_script nor prev_output.locking_script is set",
)

Copilot uses AI. Check for mistakes.
return {}

def set_state(self, state: dict) -> None:
# Returning None is equivalent to passing an empty dictionary because NOP is a no-op
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment 'Returning None is equivalent to passing an empty dictionary because NOP is a no-op' is misleading. The method doesn't return anything (implicit None), and the comment doesn't accurately describe the null object pattern implementation. Consider revising to 'No-op implementation: state updates are intentionally ignored' for clarity.

Suggested change
# Returning None is equivalent to passing an empty dictionary because NOP is a no-op
# No-op implementation: state updates are intentionally ignored

Copilot uses AI. Check for mistakes.

# Convert to integer and check if > curve.n // 2
s_value = int.from_bytes(s_bytes, byteorder="big")
curve_order = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curve order constant is hardcoded as a magic number. This value appears to be the secp256k1 curve order and should be imported from the curve module (e.g., from bsv.curve import curve and use curve.n) for consistency and maintainability.

Suggested change
curve_order = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
curve_order = curve.n

Copilot uses AI. Check for mistakes.
import secrets
from typing import Union

from Cryptodome.Cipher import AES
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import uses Cryptodome which may not be consistent with other parts of the codebase. Verify that this is the intended cryptography library and that it's properly documented as a dependency. Consider adding a try/except with a clear error message if the library is not installed.

Suggested change
from Cryptodome.Cipher import AES
try:
# Preferred namespace used by PyCryptodome
from Cryptodome.Cipher import AES
except ImportError as e:
try:
# Fallback to the older/alternative namespace if available
from Crypto.Cipher import AES # type: ignore[no-redef]
except ImportError:
raise ImportError(
"SymmetricKey requires an AES implementation from the 'pycryptodome' "
"package. Please install it with:\n\n pip install pycryptodome\n"
) from e

Copilot uses AI. Check for mistakes.
pub = self.wallet.get_public_key({"identityKey": True}, self.originator) or {}
operator = cast(str, pub.get("publicKey") or "")

_ = _map_definition_type_to_wallet_protocol(data.definition_type) # Reserved for future use
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of _map_definition_type_to_wallet_protocol is assigned to _ indicating it's unused, with a comment 'Reserved for future use'. If the function call is only for validation, clarify this in the comment. Otherwise, consider removing the call until it's actually needed to avoid unnecessary computation.

Suggested change
_ = _map_definition_type_to_wallet_protocol(data.definition_type) # Reserved for future use
_map_definition_type_to_wallet_protocol(data.definition_type) # Validate definition_type; mapping reserved for future use

Copilot uses AI. Check for mistakes.
import aiohttp

if not url.startswith("https:") and not self.allow_http:
raise ValueError('HTTPS facilitator can only use URLs that start with "https:"')
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message should clarify that HTTP is allowed when allow_http=True. Consider updating to 'HTTPS facilitator requires URLs starting with "https:" (allow_http=False)' to make the condition explicit.

Suggested change
raise ValueError('HTTPS facilitator can only use URLs that start with "https:"')
raise ValueError('HTTPS facilitator requires URLs starting with "https:" (allow_http=False)')

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

Test Coverage Report

📊 Coverage: 84.4%

View the full coverage report in the build artifacts.

1 similar comment
@github-actions
Copy link
Copy Markdown

Test Coverage Report

📊 Coverage: 84.4%

View the full coverage report in the build artifacts.

@F1r3Hydr4nt F1r3Hydr4nt requested a review from Copilot January 16, 2026 06:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 114 out of 541 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

bsv/script/interpreter/operations.py:1

  • The NOSONAR comment 'Mathematical notation' appears to suppress a naming violation. Consider whether the suppression is necessary or if the variable could be renamed to follow conventions while remaining clear (e.g., commitment_r).
"""

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +46 to +61
"""No-op debugger implementation."""

def before_stack_push(self, data: bytes) -> None:
# No-op implementation for null object pattern
pass

def after_stack_push(self, data: bytes) -> None:
# No-op implementation for null object pattern
pass

def before_stack_pop(self) -> None:
# No-op implementation for null object pattern
pass

def after_stack_pop(self, data: bytes) -> None:
# No-op implementation for null object pattern
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NopDebugger class methods have repetitive comments explaining the null object pattern. Consider consolidating this into a single class-level docstring to reduce redundancy and improve maintainability.

Suggested change
"""No-op debugger implementation."""
def before_stack_push(self, data: bytes) -> None:
# No-op implementation for null object pattern
pass
def after_stack_push(self, data: bytes) -> None:
# No-op implementation for null object pattern
pass
def before_stack_pop(self) -> None:
# No-op implementation for null object pattern
pass
def after_stack_pop(self, data: bytes) -> None:
# No-op implementation for null object pattern
"""No-op debugger implementation following the null object pattern.
All methods intentionally perform no operations; they exist to satisfy
the Debugger interface without affecting interpreter behavior.
"""
def before_stack_push(self, data: bytes) -> None:
pass
def after_stack_push(self, data: bytes) -> None:
pass
def before_stack_pop(self) -> None:
pass
def after_stack_pop(self, data: bytes) -> None:

Copilot uses AI. Check for mistakes.
Comment on lines +295 to +299
failed_hosts = getattr(self, "_failed_hosts", None)
if failed_hosts is None:
failed_hosts = set()
self._failed_hosts = failed_hosts
failed_hosts.add(host)
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure tracking logic uses dynamic attribute creation with getattr and manual initialization. Consider initializing _failed_hosts in __init__ to make the instance state more explicit and predictable.

Suggested change
failed_hosts = getattr(self, "_failed_hosts", None)
if failed_hosts is None:
failed_hosts = set()
self._failed_hosts = failed_hosts
failed_hosts.add(host)
if not hasattr(self, "_failed_hosts"):
self._failed_hosts = set()
self._failed_hosts.add(host)

Copilot uses AI. Check for mistakes.
@F1r3Hydr4nt F1r3Hydr4nt requested a review from Copilot January 16, 2026 06:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 114 out of 541 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

Test Coverage Report

📊 Coverage: 84.4%

View the full coverage report in the build artifacts.

- Update __version__ to 2.0.0b1
- Update CHANGELOG.md with 2.0.0b1 release notes
- Add beta version notice to README.md
- Clarify camelCase changes apply only to BRC-100 modules
@github-actions
Copy link
Copy Markdown

Test Coverage Report

📊 Coverage: 84.4%

View the full coverage report in the build artifacts.

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Test Coverage Report

📊 Coverage: 84.4%

View the full coverage report in the build artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants