diff --git a/hathor/nanocontracts/context.py b/hathor/nanocontracts/context.py index dc7b0a5a8..7ed05df81 100644 --- a/hathor/nanocontracts/context.py +++ b/hathor/nanocontracts/context.py @@ -149,14 +149,6 @@ def get_caller_contract_id(self) -> ContractId | None: case _: # pragma: no cover assert_never(self.caller_id) - @property - def timestamp(self) -> int: - """ - Get the timestamp of the block executing the nano transaction. - DEPRECATED: Use `ctx.block.timestamp` instead. - """ - return self.block.timestamp - @property def actions(self) -> MappingProxyType[TokenUid, tuple[NCAction, ...]]: """Get a mapping of actions per token.""" diff --git a/hathor/nanocontracts/resources/blueprint.py b/hathor/nanocontracts/resources/blueprint.py index 242f3beab..27da56d61 100644 --- a/hathor/nanocontracts/resources/blueprint.py +++ b/hathor/nanocontracts/resources/blueprint.py @@ -23,7 +23,7 @@ from hathor.nanocontracts import types as nc_types from hathor.nanocontracts.blueprint import NC_FIELDS_ATTR from hathor.nanocontracts.context import Context -from hathor.nanocontracts.exception import BlueprintDoesNotExist +from hathor.nanocontracts.exception import BlueprintDoesNotExist, OCBBlueprintNotConfirmed from hathor.nanocontracts.types import blueprint_id_from_bytes from hathor.nanocontracts.utils import is_nc_public_method, is_nc_view_method from hathor.utils.api import ErrorResponse, QueryParams, Response @@ -94,6 +94,10 @@ def render_GET(self, request: 'Request') -> bytes: request.setResponseCode(404) error_response = ErrorResponse(success=False, error=f'Blueprint not found: {params.blueprint_id}') return error_response.json_dumpb() + except OCBBlueprintNotConfirmed: + request.setResponseCode(404) + error_response = ErrorResponse(success=False, error=f'Blueprint found but not confirmed: {params.blueprint_id}') + return error_response.json_dumpb() attributes: dict[str, str] = {} fields = getattr(blueprint_class, NC_FIELDS_ATTR) diff --git a/tests/nanocontracts/test_exposed_properties.py b/tests/nanocontracts/test_exposed_properties.py index 3732fa706..be7930f5b 100644 --- a/tests/nanocontracts/test_exposed_properties.py +++ b/tests/nanocontracts/test_exposed_properties.py @@ -37,7 +37,6 @@ 'hathor.nanocontracts.context.Context.get_caller_contract_id', 'hathor.nanocontracts.context.Context.get_single_action', 'hathor.nanocontracts.context.Context.some_new_attribute', - 'hathor.nanocontracts.context.Context.timestamp', 'hathor.nanocontracts.context.Context.to_json', 'hathor.nanocontracts.context.Context.vertex', 'hathor.nanocontracts.exception.NCFail.add_note',