diff --git a/client-libs/kaitai-struct-files/files/alpha__constants.ksy b/client-libs/kaitai-struct-files/files/alpha__constants.ksy index 59eef651e2a363f592560e4b063725cd554cb2cb..aa31d5efc87b7421680df605b00b8dd968af8001 100644 --- a/client-libs/kaitai-struct-files/files/alpha__constants.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__constants.ksy @@ -364,6 +364,3 @@ seq: - id: direct_ticket_spending_enable type: u1 enum: bool -- id: sponsored_operations_enable - type: u1 - enum: bool diff --git a/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy b/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy index d77179ffe36be4905c3dcac1a3311a3acf447215..24e10472e4856e3efdc59f5748fc309e4dc4ec71 100644 --- a/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__constants__parametric.ksy @@ -336,6 +336,3 @@ seq: - id: direct_ticket_spending_enable type: u1 enum: bool -- id: sponsored_operations_enable - type: u1 - enum: bool diff --git a/client-libs/kaitai-struct-files/files/alpha__operation.ksy b/client-libs/kaitai-struct-files/files/alpha__operation.ksy index 65b86b4cb701482233d735a3bf1a2057035512a5..2c8c5dc05a2ff9c6ddcf4ceaccaa0e7605cf491a 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation.ksy @@ -238,9 +238,6 @@ types: - id: zk_rollup_update type: zk_rollup_update if: (alpha__operation__alpha__contents_or_signature_prefix_tag == alpha__operation__alpha__contents_or_signature_prefix_tag::zk_rollup_update) - - id: host - type: host - if: (alpha__operation__alpha__contents_or_signature_prefix_tag == alpha__operation__alpha__contents_or_signature_prefix_tag::host) alpha__per_block_votes: seq: - id: alpha__per_block_votes_tag @@ -483,37 +480,6 @@ types: - id: destination type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - guest_signature: - seq: - - id: signature__v1 - size-eos: true - guest_signature_0: - seq: - - id: len_guest_signature - type: u4be - valid: - max: 1073741823 - - id: guest_signature - type: guest_signature - size: len_guest_signature - host: - seq: - - id: source - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: fee - type: alpha__mutez - - id: counter - type: n - - id: gas_limit - type: n - - id: storage_limit - type: n - - id: guest - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: guest_signature - type: guest_signature_0 inbox__proof: seq: - id: level @@ -1938,7 +1904,6 @@ enums: 112: set_deposits_limit 113: increase_paid_storage 114: update_consensus_key - 115: host 158: transfer_ticket 200: smart_rollup_originate 201: smart_rollup_add_messages diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy index ebc8ac948603eab79f1d2e9fb778a05dcb94e236..9af256a2106977c7a4c8cc51ee9b60ab5d4f39a2 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy @@ -227,9 +227,6 @@ types: - id: zk_rollup_update type: zk_rollup_update if: (alpha__operation__alpha__contents_tag == alpha__operation__alpha__contents_tag::zk_rollup_update) - - id: host - type: host - if: (alpha__operation__alpha__contents_tag == alpha__operation__alpha__contents_tag::host) alpha__per_block_votes: seq: - id: alpha__per_block_votes_tag @@ -460,37 +457,6 @@ types: - id: destination type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - guest_signature: - seq: - - id: signature__v1 - size-eos: true - guest_signature_0: - seq: - - id: len_guest_signature - type: u4be - valid: - max: 1073741823 - - id: guest_signature - type: guest_signature - size: len_guest_signature - host: - seq: - - id: source - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: fee - type: alpha__mutez - - id: counter - type: n - - id: gas_limit - type: n - - id: storage_limit - type: n - - id: guest - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: guest_signature - type: guest_signature_0 inbox__proof: seq: - id: level @@ -1915,7 +1881,6 @@ enums: 112: set_deposits_limit 113: increase_paid_storage 114: update_consensus_key - 115: host 158: transfer_ticket 200: smart_rollup_originate 201: smart_rollup_add_messages diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy index a594a289581f0cc26cb7946caebd897b3a7f4d8c..6c10ba5fa716b449fcf74c8974e718c397fb1f65 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy @@ -227,9 +227,6 @@ types: - id: zk_rollup_update type: zk_rollup_update if: (alpha__operation__alpha__contents_tag == alpha__operation__alpha__contents_tag::zk_rollup_update) - - id: host - type: host - if: (alpha__operation__alpha__contents_tag == alpha__operation__alpha__contents_tag::host) alpha__operation__contents_list_entries: seq: - id: alpha__operation__alpha__contents @@ -464,37 +461,6 @@ types: - id: destination type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - guest_signature: - seq: - - id: signature__v1 - size-eos: true - guest_signature_0: - seq: - - id: len_guest_signature - type: u4be - valid: - max: 1073741823 - - id: guest_signature - type: guest_signature - size: len_guest_signature - host: - seq: - - id: source - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: fee - type: alpha__mutez - - id: counter - type: n - - id: gas_limit - type: n - - id: storage_limit - type: n - - id: guest - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: guest_signature - type: guest_signature_0 inbox__proof: seq: - id: level @@ -1919,7 +1885,6 @@ enums: 112: set_deposits_limit 113: increase_paid_storage 114: update_consensus_key - 115: host 158: transfer_ticket 200: smart_rollup_originate 201: smart_rollup_add_messages diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy index 7b5ca8adeb46f55a7a4eb0a81402a3b45aff75e5..6029ec16621e6d2482ba7de8640c467608877788 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy @@ -238,9 +238,6 @@ types: - id: zk_rollup_update type: zk_rollup_update if: (alpha__operation__alpha__contents_or_signature_prefix_tag == alpha__operation__alpha__contents_or_signature_prefix_tag::zk_rollup_update) - - id: host - type: host - if: (alpha__operation__alpha__contents_or_signature_prefix_tag == alpha__operation__alpha__contents_or_signature_prefix_tag::host) alpha__per_block_votes: seq: - id: alpha__per_block_votes_tag @@ -483,37 +480,6 @@ types: - id: destination type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - guest_signature: - seq: - - id: signature__v1 - size-eos: true - guest_signature_0: - seq: - - id: len_guest_signature - type: u4be - valid: - max: 1073741823 - - id: guest_signature - type: guest_signature - size: len_guest_signature - host: - seq: - - id: source - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: fee - type: alpha__mutez - - id: counter - type: n - - id: gas_limit - type: n - - id: storage_limit - type: n - - id: guest - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: guest_signature - type: guest_signature_0 inbox__proof: seq: - id: level @@ -1938,7 +1904,6 @@ enums: 112: set_deposits_limit 113: increase_paid_storage 114: update_consensus_key - 115: host 158: transfer_ticket 200: smart_rollup_originate 201: smart_rollup_add_messages diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy index c6cdf6b20f4ffc88e9da952e9cb4fb4da7d60bc3..55743ab0d306c2005733e7d4cb75078dd06973b5 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy @@ -227,9 +227,6 @@ types: - id: zk_rollup_update type: zk_rollup_update if: (alpha__operation__alpha__contents_tag == alpha__operation__alpha__contents_tag::zk_rollup_update) - - id: host - type: host - if: (alpha__operation__alpha__contents_tag == alpha__operation__alpha__contents_tag::host) alpha__operation__alpha__unsigned_operation: seq: - id: alpha__operation__alpha__unsigned_operation @@ -471,37 +468,6 @@ types: - id: destination type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - guest_signature: - seq: - - id: signature__v1 - size-eos: true - guest_signature_0: - seq: - - id: len_guest_signature - type: u4be - valid: - max: 1073741823 - - id: guest_signature - type: guest_signature - size: len_guest_signature - host: - seq: - - id: source - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: fee - type: alpha__mutez - - id: counter - type: n - - id: gas_limit - type: n - - id: storage_limit - type: n - - id: guest - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: guest_signature - type: guest_signature_0 inbox__proof: seq: - id: level @@ -1926,7 +1892,6 @@ enums: 112: set_deposits_limit 113: increase_paid_storage 114: update_consensus_key - 115: host 158: transfer_ticket 200: smart_rollup_originate 201: smart_rollup_add_messages diff --git a/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name.ksy b/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name.ksy index 5aec0b0ad558251f73be33822012689c313e13c6..db9b45ad4dc0385fe7b5ea32035918665e9c3a10 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name.ksy @@ -231,9 +231,6 @@ types: - id: zk_rollup_update type: zk_rollup_update if: (alpha__operation__alpha__contents_or_signature_prefix_tag == alpha__operation__alpha__contents_or_signature_prefix_tag::zk_rollup_update) - - id: host - type: host - if: (alpha__operation__alpha__contents_or_signature_prefix_tag == alpha__operation__alpha__contents_or_signature_prefix_tag::host) alpha__operation_with_legacy_attestation_name__alpha__contents_and_signature: seq: - id: contents_and_signature_prefix @@ -483,37 +480,6 @@ types: - id: destination type: public_key_hash doc: A Ed25519, Secp256k1, P256, or BLS public key hash - guest_signature: - seq: - - id: signature__v1 - size-eos: true - guest_signature_0: - seq: - - id: len_guest_signature - type: u4be - valid: - max: 1073741823 - - id: guest_signature - type: guest_signature - size: len_guest_signature - host: - seq: - - id: source - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: fee - type: alpha__mutez - - id: counter - type: n - - id: gas_limit - type: n - - id: storage_limit - type: n - - id: guest - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: guest_signature - type: guest_signature_0 inbox__proof: seq: - id: level @@ -1938,7 +1904,6 @@ enums: 112: set_deposits_limit 113: increase_paid_storage 114: update_consensus_key - 115: host 158: transfer_ticket 200: smart_rollup_originate 201: smart_rollup_add_messages diff --git a/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name__unsigned.ksy b/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name__unsigned.ksy index 111badff4af4fa8eb1898a8a40160ea60697be0d..aee0ae625059b1b310030ec2aab2c748df93326f 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name__unsigned.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation_with_legacy_attestation_name__unsigned.ksy @@ -227,9 +227,6 @@ types: - id: zk_rollup_update type: zk_rollup_update if: (alpha__operation_with_legacy_attestation_name__alpha__contents_tag == alpha__operation_with_legacy_attestation_name__alpha__contents_tag::zk_rollup_update) - - id: host - type: host - if: (alpha__operation_with_legacy_attestation_name__alpha__contents_tag == alpha__operation_with_legacy_attestation_name__alpha__contents_tag::host) alpha__operation_with_legacy_attestation_name__alpha__unsigned_operation: seq: - id: alpha__operation_with_legacy_attestation_name__alpha__unsigned_operation @@ -471,37 +468,6 @@ types: size: 32 - id: dal_attestation type: z - guest_signature: - seq: - - id: signature__v1 - size-eos: true - guest_signature_0: - seq: - - id: len_guest_signature - type: u4be - valid: - max: 1073741823 - - id: guest_signature - type: guest_signature - size: len_guest_signature - host: - seq: - - id: source - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: fee - type: alpha__mutez - - id: counter - type: n - - id: gas_limit - type: n - - id: storage_limit - type: n - - id: guest - type: public_key_hash - doc: A Ed25519, Secp256k1, P256, or BLS public key hash - - id: guest_signature - type: guest_signature_0 inbox__proof: seq: - id: level @@ -1926,7 +1892,6 @@ enums: 112: set_deposits_limit 113: increase_paid_storage 114: update_consensus_key - 115: host 158: transfer_ticket 200: smart_rollup_originate 201: smart_rollup_add_messages diff --git a/client-libs/kaitai-struct-files/files/alpha__parameters.ksy b/client-libs/kaitai-struct-files/files/alpha__parameters.ksy index b82efa63f9396be58f61884a1c33a3b518977c90..bb6605b920ba7ed7f84d98bad13f780bf0de8c09 100644 --- a/client-libs/kaitai-struct-files/files/alpha__parameters.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__parameters.ksy @@ -614,6 +614,3 @@ seq: - id: direct_ticket_spending_enable type: u1 enum: bool -- id: sponsored_operations_enable - type: u1 - enum: bool diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index c5a91dd8947ad044bef78b9914bcb85f4b278e2f..906bf4f1b240f3eeb82d77b7d4abd641c8e1f04c 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -74,10 +74,6 @@ Errors counters. The error messages have been updated accordingly, but the error IDs remain unchanged. (MR :gl:`!13138`) -- The message of the ``validate.operation.incorrect_reveal_position`` - error has been updated to specify that the incorrectly placed - revelation concerns the fee payer. (MR :gl:`!13290`) - Protocol parameters ------------------- @@ -127,67 +123,6 @@ following quantities are kept the same: - ``1733333`` - ``1386666`` -Sponsored Operations --------------------- - -The following changes are under the ``sponsored_operations_enable`` -feature flag. (MR :gl:`!11207`) This feature flag is currently -disabled, so these changes are purely internal at this time. - -- Added a new manager operation kind named ``host`` with two fields: a - public key hash ``guest`` and a signature ``guest_signature``. (MR - :gl:`!11209`) - -- Updated the validation of operations to account for the new ``host`` - operation: - - - A batch may now contain multiple sources, if it has ``host`` - operations. (MR :gl:`!13138`) However: - - - All operations in between two ``host`` operations, or after the - last ``host`` operation of the batch, must have the ``guest`` of - the previous ``host`` operation as their source. - - - The ``host`` operations themselves, and any operations appearing - before the first ``host`` operation in the batch, must all share - the same source. This source will be the fee payer for the whole - batch, also known as the sponsor or host of the batch. Note that - if the batch contains no ``host`` operations, this means that - all operations must have the same source who will pay the fees, - as before the introduction of Sponsored Operations. - - - The same guest must not appear in two separate ``host`` - operations. Moreover, the fee payer must not appear as guest in - a ``host`` operation. - - - The counter of each individual operation in a batch relates to the - source of this particular operation. For every source in the - batch, all counters associated with that source must be increasing - and consecutive. Moreover, the counter of the first operation in - the batch, whose source is always the fee payer, must be the next - expected counter for the fee payer in the context of the - blockchain. There is no such requirement for the first counters of - any guest sources. (MR :gl:`!13138`) - - - Before Sponsored Operations, the only allowed position for a - ``reveal`` operation was as the very first operation of the - batch. Now, a ``reveal`` operation must either be the first - operation of the whole batch, or come immediately after a ``host`` - operation. In other words, a guest operation can be a ``reveal``, - provided that it is the guest's first operation in the batch. (MR - :gl:`!13290`) - -- Added the following errors: - - - ``validate.operation.guest_operation_wrong_source`` (MR :gl:`!13138`) - - - ``validate.operation.guest_hosted_twice`` (MR :gl:`!13138`) - - - ``validate.operation.guest_is_sponsor`` (MR :gl:`!13138`) - - - ``validate.operation.guest_incorrect_reveal_position`` (MR - :gl:`!13290`) - Bug Fixes --------- diff --git a/manifest/product_octez.ml b/manifest/product_octez.ml index 87cf96266ee4b296ea4fc843546a8c83379bb6fa..77405f2b4d2c03adaec44775d5f805f2dbe83c7a 100644 --- a/manifest/product_octez.ml +++ b/manifest/product_octez.ml @@ -5298,7 +5298,6 @@ end = struct ("test_voting", true); ("test_zk_rollup", true); ("test_transfer_ticket", N.(number >= 016)); - ("test_host_operation", N.(number >= 021)); ] |> conditional_list in diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index d03a16982e35f6e23f4836535ef9f1e6301d6188..eb7fa79c4f813f2475c3e5d93f0253100e9551c2 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -358,8 +358,7 @@ let estimated_gas_single (type kind) Ok consumed_gas | Zk_rollup_origination_result {consumed_gas; _} -> Ok consumed_gas | Zk_rollup_publish_result {consumed_gas; _} -> Ok consumed_gas - | Zk_rollup_update_result {consumed_gas; _} -> Ok consumed_gas - | Host_result {consumed_gas} -> Ok consumed_gas) + | Zk_rollup_update_result {consumed_gas; _} -> Ok consumed_gas) | Skipped _ -> error_with "Cannot estimate gas of skipped operation" (* There must be another error for this to happen, and it should not @@ -431,7 +430,7 @@ let estimated_storage_single (type kind) ~origination_size *) | Sc_rollup_cement_result _ | Sc_rollup_publish_result _ | Sc_rollup_refute_result _ | Sc_rollup_timeout_result _ - | Sc_rollup_recover_bond_result _ | Host_result _ -> + | Sc_rollup_recover_bond_result _ -> Ok Z.zero) | Skipped _ -> error_with "Cannot estimate storage of skipped operation" @@ -510,8 +509,7 @@ let originated_contracts_single (type kind) | Sc_rollup_refute_result _ | Sc_rollup_timeout_result _ | Sc_rollup_execute_outbox_message_result _ | Sc_rollup_recover_bond_result _ | Zk_rollup_origination_result _ - | Zk_rollup_publish_result _ | Zk_rollup_update_result _ | Host_result _ - -> + | Zk_rollup_publish_result _ | Zk_rollup_update_result _ -> return_nil) | Skipped _ -> error_with "Cannot know originated contracts of skipped operation" diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index e6a43ca554335e7567323060f24613a3259644d6..3654b22538d66ee125317fc1b5b0ceb1758877fa 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -356,14 +356,6 @@ let pp_manager_operation_content (type kind) source ppf Format.fprintf ppf "Epoxy publish:@,From: %a" Contract.pp source | Zk_rollup_update _ -> Format.fprintf ppf "Epoxy update:@,From: %a" Contract.pp source - | Host {guest; _} -> - Format.fprintf - ppf - "Host:@,From: %a@,Guest: %a" - Contract.pp - source - Signature.Public_key_hash.pp - guest let pp_balance_updates ppf balance_updates = let open Receipt in @@ -817,9 +809,6 @@ let pp_manager_operation_contents_result ppf op_result = pp_paid_storage_size_diff ppf paid_storage_size_diff ; pp_balance_updates ppf balance_updates in - let pp_host_result (Host_result {consumed_gas}) = - pp_consumed_gas ppf consumed_gas - in let manager_operation_name (type kind) (result : kind successful_manager_operation_result) = @@ -847,7 +836,6 @@ let pp_manager_operation_contents_result ppf op_result = | Zk_rollup_origination_result _ -> "epoxy originate" | Zk_rollup_publish_result _ -> "epoxy publish" | Zk_rollup_update_result _ -> "epoxy update" - | Host_result _ -> "host" in let pp_manager_operation_contents_result (type kind) ppf (result : kind successful_manager_operation_result) = @@ -882,7 +870,6 @@ let pp_manager_operation_contents_result ppf op_result = | Zk_rollup_origination_result _ as op -> pp_zk_rollup_origination_result op | Zk_rollup_publish_result _ as op -> pp_zk_rollup_publish_result op | Zk_rollup_update_result _ as op -> pp_zk_rollup_update_result op - | Host_result _ as op -> pp_host_result op in pp_operation_result ~operation_name:manager_operation_name diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index e900aabad5ec4334500eb28600d09ff3363357c0..0bfaa4e27d8e37a16fc6e6e29015ca351db35d0c 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -313,7 +313,6 @@ let constants_mainnet : Constants.Parametric.t = - Split [allow_forged] into [allow_tickets] and [allow_lazy_storage_id]: #2964 - Introduce a new Ticket constructor in Michelson: #6643 *) direct_ticket_spending_enable = false; - sponsored_operations_enable = false; } let constants_sandbox = diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 7b68e75c6818e8a58fce1765c34d8a7b5c3f8c10..b9a12fdfe476291d85842b847c4665edbf984d30 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -946,7 +946,6 @@ module Constants : sig zk_rollup : zk_rollup; adaptive_issuance : adaptive_issuance; direct_ticket_spending_enable : bool; - sponsored_operations_enable : bool; } val encoding : t Data_encoding.t @@ -1079,8 +1078,6 @@ module Constants : sig val direct_ticket_spending_enable : context -> bool - val sponsored_operations_enable : context -> bool - (** All constants: fixed and parametric *) type t = private {fixed : fixed; parametric : Parametric.t} @@ -4461,8 +4458,6 @@ module Kind : sig type zk_rollup_update = Zk_rollup_update_kind - type host = Host_kind - type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -4487,7 +4482,6 @@ module Kind : sig | Zk_rollup_origination_manager_kind : zk_rollup_origination manager | Zk_rollup_publish_manager_kind : zk_rollup_publish manager | Zk_rollup_update_manager_kind : zk_rollup_update manager - | Host_manager_kind : host manager end (** All the definitions below are re-exported from {!Operation_repr}. *) @@ -4696,11 +4690,6 @@ and _ manager_operation = update : Zk_rollup.Update.t; } -> Kind.zk_rollup_update manager_operation - | Host : { - guest : Signature.Public_key_hash.t; - guest_signature : Signature.t; - } - -> Kind.host manager_operation type packed_manager_operation = | Manager : 'kind manager_operation -> packed_manager_operation @@ -4904,8 +4893,6 @@ module Operation : sig val zk_rollup_update_case : Kind.zk_rollup_update Kind.manager case - val host_case : Kind.host Kind.manager case - module Manager_operations : sig type 'b case = | MCase : { @@ -4962,8 +4949,6 @@ module Operation : sig val zk_rollup_publish_case : Kind.zk_rollup_publish case val zk_rollup_update_case : Kind.zk_rollup_update case - - val host_case : Kind.host case end end diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index add25bdc4430910f7a3f692a237f5ddeae7dab41..461cc5673b60936d18b0aaa3c3f79d07e8025719 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1623,9 +1623,6 @@ let apply_manager_operation : Zk_rollup_apply.publish ~ctxt_before_op ~ctxt ~zk_rollup ~l2_ops:ops | Zk_rollup_update {zk_rollup; update} -> Zk_rollup_apply.update ~ctxt_before_op ~ctxt ~zk_rollup ~update - | Host _ -> - (* This feature is disabled *) - assert false type success_or_failure = Success of context | Failure @@ -1871,9 +1868,6 @@ let burn_manager_storage_fees : ( ctxt, storage_limit, Zk_rollup_update_result {payload with balance_updates} ) - | Host_result _ -> - (* This feature is disabled *) - assert false (** [burn_internal_storage_fees ctxt smopr storage_limit payer] burns the storage fees associated to an internal operation result [smopr]. diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 77b3394e8a65fb9cfb9706e6dbc6b9c28585f8ac..49ff68eba509b6b27092a8f1b4cc914a00c5c3b9 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -154,10 +154,6 @@ type _ successful_manager_operation_result = paid_storage_size_diff : Z.t; } -> Kind.zk_rollup_update successful_manager_operation_result - | Host_result : { - consumed_gas : Gas.Arith.fp; - } - -> Kind.host successful_manager_operation_result let migration_origination_result_to_successful_manager_operation_result ({ @@ -844,18 +840,6 @@ module Manager_result = struct (balance_updates, consumed_gas)) ~inj:(fun (balance_updates, consumed_gas) -> Sc_rollup_recover_bond_result {balance_updates; consumed_gas}) - - let host_case = - make - ~op_case:Operation.Encoding.Manager_operations.host_case - ~encoding: - Data_encoding.( - obj1 (dft "consumed_milligas" Gas.Arith.n_fp_encoding Gas.Arith.zero)) - ~select:(function - | Successful_manager_result (Host_result _ as op) -> Some op | _ -> None) - ~kind:Kind.Host_manager_kind - ~proj:(function Host_result {consumed_gas} -> consumed_gas) - ~inj:(fun consumed_gas -> Host_result {consumed_gas}) end let successful_manager_operation_result_encoding : @@ -886,7 +870,6 @@ let successful_manager_operation_result_encoding : make Manager_result.set_deposits_limit_case; make Manager_result.increase_paid_storage_case; make Manager_result.sc_rollup_originate_case; - make Manager_result.host_case; ] type 'kind contents_result = @@ -1027,8 +1010,6 @@ let equal_manager_kind : | Kind.Zk_rollup_update_manager_kind, Kind.Zk_rollup_update_manager_kind -> Some Eq | Kind.Zk_rollup_update_manager_kind, _ -> None - | Kind.Host_manager_kind, Kind.Host_manager_kind -> Some Eq - | Kind.Host_manager_kind, _ -> None module Encoding = struct let consensus_result_encoding power_name = @@ -1781,16 +1762,6 @@ module Encoding = struct -> Some (op, res) | _ -> None) - - let host_manager_case = - make_manager_case - Operation.Encoding.host_case - Manager_result.host_case - (function - | Contents_and_result - ((Manager_operation {operation = Host _; _} as op), res) -> - Some (op, res) - | _ -> None) end let common_cases = @@ -1824,7 +1795,6 @@ let common_cases = zk_rollup_origination_case; zk_rollup_publish_case; zk_rollup_update_case; - host_manager_case; ] let contents_cases = @@ -2606,25 +2576,6 @@ let kind_equal : } ) -> Some Eq | Manager_operation {operation = Zk_rollup_update _; _}, _ -> None - | ( Manager_operation {operation = Host _; _}, - Manager_operation_result {operation_result = Applied (Host_result _); _} ) - -> - Some Eq - | ( Manager_operation {operation = Host _; _}, - Manager_operation_result - {operation_result = Backtracked (Host_result _, _); _} ) -> - Some Eq - | ( Manager_operation {operation = Host _; _}, - Manager_operation_result - {operation_result = Failed (Alpha_context.Kind.Host_manager_kind, _); _} - ) -> - Some Eq - | ( Manager_operation {operation = Host _; _}, - Manager_operation_result - {operation_result = Skipped Alpha_context.Kind.Host_manager_kind; _} ) - -> - Some Eq - | Manager_operation {operation = Host _; _}, _ -> None let rec kind_equal_list : type kind kind2. diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index c3cc463f13469648ed5a70256960323d8c759ccc..b0a09087030c1e44d1c52d463da6300f662a3bc7 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -261,10 +261,6 @@ and _ successful_manager_operation_result = paid_storage_size_diff : Z.t; } -> Kind.zk_rollup_update successful_manager_operation_result - | Host_result : { - consumed_gas : Gas.Arith.fp; - } - -> Kind.host successful_manager_operation_result and packed_successful_manager_operation_result = | Successful_manager_result : diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index 7392fadaeb73b28d4f3e8f1e1c980cbe5173dcb4..0141e837797a6ec7f6e6f801d5fa5ef5823ab868 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -249,7 +249,6 @@ type t = { zk_rollup : zk_rollup; adaptive_issuance : adaptive_issuance; direct_ticket_spending_enable : bool; - sponsored_operations_enable : bool; } let sc_rollup_encoding = @@ -589,9 +588,8 @@ let encoding = c.cache_sampler_state_cycles ), ( c.dal, ( (c.sc_rollup, c.zk_rollup), - ( c.adaptive_issuance, - ( c.direct_ticket_spending_enable, - c.sponsored_operations_enable ) ) ) ) ) ) ) ) )) + (c.adaptive_issuance, c.direct_ticket_spending_enable) ) ) + ) ) ) ) )) (fun ( ( ( consensus_rights_delay, blocks_preservation_cycles, delegate_parameters_activation_delay ), @@ -632,9 +630,8 @@ let encoding = cache_sampler_state_cycles ), ( dal, ( (sc_rollup, zk_rollup), - ( adaptive_issuance, - ( direct_ticket_spending_enable, - sponsored_operations_enable ) ) ) ) ) ) ) ) ) -> + (adaptive_issuance, direct_ticket_spending_enable) ) ) ) + ) ) ) ) -> { consensus_rights_delay; blocks_preservation_cycles; @@ -679,7 +676,6 @@ let encoding = zk_rollup; adaptive_issuance; direct_ticket_spending_enable; - sponsored_operations_enable; }) (merge_objs (merge_objs @@ -745,8 +741,7 @@ let encoding = (merge_objs sc_rollup_encoding zk_rollup_encoding) (merge_objs adaptive_issuance_encoding - ((obj2 (req "direct_ticket_spending_enable" bool)) - (req "sponsored_operations_enable" bool)))))))))) + (obj1 (req "direct_ticket_spending_enable" bool)))))))))) let update_sc_rollup_parameter ratio_i32 c = (* Constants remain small enough to fit in [int32] after update (as a diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index 9c967537a4262a90393cdff20ae27b0b761ca59f..b4515db0ebce48fa72d21207121fdae8e82033ed 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -228,7 +228,6 @@ type t = { zk_rollup : zk_rollup; adaptive_issuance : adaptive_issuance; direct_ticket_spending_enable : bool; - sponsored_operations_enable : bool; } val encoding : t Data_encoding.encoding diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index 038bde819651f0f220ad30fc07de6160f834e21f..783d0fd2548fb1f0af4a4164c5e7f469a0ded501 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -298,6 +298,3 @@ let adaptive_issuance_ns_enable c = (adaptive_issuance c).ns_enable let direct_ticket_spending_enable c = (Raw_context.constants c).direct_ticket_spending_enable - -let sponsored_operations_enable c = - (Raw_context.constants c).sponsored_operations_enable diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index 88b5f97946798887eee08f23f99f1ce41c6a8b07..1e402c3044be8ea4d4f0038fd58c7f8a68e7bc38 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -184,5 +184,3 @@ val consensus_key_activation_delay : Raw_context.t -> int slashing of the funds that are currently in its frozen deposit. *) val slashable_deposits_period : Raw_context.t -> int - -val sponsored_operations_enable : Raw_context.t -> bool diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 8b280086bf74246eb0aa3e06ab37f72fa0e8e32a..7c59bfc4596c605524c9c10f55cc40f16c1cf948 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -110,8 +110,6 @@ module Kind = struct type zk_rollup_update = Zk_rollup_update_kind - type host = Host_kind - type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -136,7 +134,6 @@ module Kind = struct | Zk_rollup_origination_manager_kind : zk_rollup_origination manager | Zk_rollup_publish_manager_kind : zk_rollup_publish manager | Zk_rollup_update_manager_kind : zk_rollup_update manager - | Host_manager_kind : host manager end type 'a consensus_operation_type = @@ -402,11 +399,6 @@ and _ manager_operation = update : Zk_rollup_update_repr.t; } -> Kind.zk_rollup_update manager_operation - | Host : { - guest : Signature.Public_key_hash.t; - guest_signature : Signature.t; - } - -> Kind.host manager_operation let manager_kind : type kind. kind manager_operation -> kind Kind.manager = function @@ -432,7 +424,6 @@ let manager_kind : type kind. kind manager_operation -> kind Kind.manager = | Zk_rollup_origination _ -> Kind.Zk_rollup_origination_manager_kind | Zk_rollup_publish _ -> Kind.Zk_rollup_publish_manager_kind | Zk_rollup_update _ -> Kind.Zk_rollup_update_manager_kind - | Host _ -> Kind.Host_manager_kind type packed_manager_operation = | Manager : 'kind manager_operation -> packed_manager_operation @@ -555,8 +546,6 @@ let zk_rollup_operation_publish_tag = zk_rollup_operation_tag_offset + 1 let zk_rollup_operation_update_tag = zk_rollup_operation_tag_offset + 2 -let host_tag = 115 - module Encoding = struct open Data_encoding @@ -1004,22 +993,6 @@ module Encoding = struct (fun (sc_rollup, staker) -> Sc_rollup_recover_bond {sc_rollup; staker}); } - - let host_case = - MCase - { - tag = host_tag; - name = "host"; - encoding = - obj2 - (req "guest" Signature.Public_key_hash.encoding) - (req "guest_signature" (dynamic_size Signature.encoding)); - select = (function Manager (Host _ as op) -> Some op | _ -> None); - proj = - (function - | Host {guest; guest_signature} -> (guest, guest_signature)); - inj = (fun (guest, guest_signature) -> Host {guest; guest_signature}); - } end type 'b case = @@ -1607,8 +1580,6 @@ module Encoding = struct let update_consensus_key_case = make_manager_case 114 Manager_operations.update_consensus_key_case - let host_case = make_manager_case host_tag Manager_operations.host_case - let transfer_ticket_case = make_manager_case transfer_ticket_tag @@ -1707,7 +1678,6 @@ module Encoding = struct PCase zk_rollup_origination_case; PCase zk_rollup_publish_case; PCase zk_rollup_update_case; - PCase host_case; ] let contents_cases = @@ -2185,8 +2155,6 @@ let equal_manager_operation_kind : | Zk_rollup_publish _, _ -> None | Zk_rollup_update _, Zk_rollup_update _ -> Some Eq | Zk_rollup_update _, _ -> None - | Host _, Host _ -> Some Eq - | Host _, _ -> None let equal_contents_kind : type a b. a contents -> b contents -> (a, b) eq option = diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index 6f475709012c534211c90e16a30843282eea2e60..bfe9e8bff835c75b7d9a38b47299b22fcd0c5a6f 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -55,7 +55,6 @@ - zk rollup origination - zk rollup publish - zk rollup update - - host Each of them can be encoded as raw bytes. Operations are distinguished at type level using phantom type parameters. [packed_operation] type allows @@ -145,8 +144,6 @@ module Kind : sig type zk_rollup_update = Zk_rollup_update_kind - type host = Host_kind - type 'a manager = | Reveal_manager_kind : reveal manager | Transaction_manager_kind : transaction manager @@ -171,7 +168,6 @@ module Kind : sig | Zk_rollup_origination_manager_kind : zk_rollup_origination manager | Zk_rollup_publish_manager_kind : zk_rollup_publish manager | Zk_rollup_update_manager_kind : zk_rollup_update manager - | Host_manager_kind : host manager end type 'a consensus_operation_type = @@ -503,11 +499,6 @@ and _ manager_operation = update : Zk_rollup_update_repr.t; } -> Kind.zk_rollup_update manager_operation - | Host : { - guest : Signature.Public_key_hash.t; - guest_signature : Signature.t; - } - -> Kind.host manager_operation type packed_manager_operation = | Manager : 'kind manager_operation -> packed_manager_operation @@ -773,8 +764,6 @@ module Encoding : sig val zk_rollup_update_case : Kind.zk_rollup_update Kind.manager case - val host_case : Kind.host Kind.manager case - module Manager_operations : sig type 'b case = | MCase : { @@ -831,8 +820,6 @@ module Encoding : sig val zk_rollup_publish_case : Kind.zk_rollup_publish case val zk_rollup_update_case : Kind.zk_rollup_update case - - val host_case : Kind.host case end end diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 3f8385ad4c9e45736c46a568c51c403d7c982cf2..0ff7eb24dd68e71f789d87fc97011d89b9b3c136 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -1151,7 +1151,6 @@ let prepare_first_block ~level ~timestamp _chain_id ctxt = in let direct_ticket_spending_enable = false in - let sponsored_operations_enable = false in let Constants_repr.Generated.{max_slashing_threshold; _} = Constants_repr.Generated.generate ~consensus_committee_size:c.consensus_committee_size @@ -1210,7 +1209,6 @@ let prepare_first_block ~level ~timestamp _chain_id ctxt = zk_rollup; adaptive_issuance; direct_ticket_spending_enable; - sponsored_operations_enable; } in let block_time_is_at_least_5s = diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 18490234e775c23e0cd9e278e5f434b0c3705c69..8664588fb43619683ca014cd66ac92a06e63fded 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -560,7 +560,7 @@ let prepare_initial_context_params ?consensus_committee_size ?cycles_per_voting_period ?sc_rollup_arith_pvm_enable ?sc_rollup_private_enable ?sc_rollup_riscv_pvm_enable ?dal_enable ?zk_rollup_enable ?hard_gas_limit_per_block ?nonce_revelation_threshold ?dal - ?adaptive_issuance ?consensus_rights_delay ?sponsored_operations_enable () = + ?adaptive_issuance ?consensus_rights_delay () = let open Lwt_result_syntax in let open Tezos_protocol_alpha_parameters in let constants = Default_parameters.constants_test in @@ -633,11 +633,6 @@ let prepare_initial_context_params ?consensus_committee_size consensus_rights_delay in - let sponsored_operations_enable = - Option.value - sponsored_operations_enable - ~default:constants.sponsored_operations_enable - in let constants = { constants with @@ -662,7 +657,6 @@ let prepare_initial_context_params ?consensus_committee_size hard_gas_limit_per_block; nonce_revelation_threshold; consensus_rights_delay; - sponsored_operations_enable; } in let* () = check_constants_consistency constants in @@ -696,8 +690,8 @@ let genesis ?commitments ?consensus_committee_size ?consensus_threshold ?cycles_per_voting_period ?sc_rollup_arith_pvm_enable ?sc_rollup_private_enable ?sc_rollup_riscv_pvm_enable ?dal_enable ?zk_rollup_enable ?hard_gas_limit_per_block ?nonce_revelation_threshold ?dal - ?adaptive_issuance ?sponsored_operations_enable - (bootstrap_accounts : Parameters.bootstrap_account list) = + ?adaptive_issuance (bootstrap_accounts : Parameters.bootstrap_account list) + = let open Lwt_result_syntax in let* constants, shell, hash = prepare_initial_context_params @@ -719,7 +713,6 @@ let genesis ?commitments ?consensus_committee_size ?consensus_threshold ?nonce_revelation_threshold ?dal ?adaptive_issuance - ?sponsored_operations_enable () in let* () = @@ -825,45 +818,37 @@ let detect_manager_failure : type kind. kind Apply_results.operation_metadata -> _ = let open Result_syntax in let rec detect_manager_failure : - type kind. hosted:bool -> kind Apply_results.contents_result_list -> _ = + type kind. kind Apply_results.contents_result_list -> _ = let open Apply_results in let open Apply_operation_result in let open Apply_internal_results in - let detect_manager_failure_single (type kind) ~hosted + let detect_manager_failure_single (type kind) (Manager_operation_result {operation_result; internal_operation_results; _} : kind Kind.manager Apply_results.contents_result) = let detect_manager_failure (type kind) (result : (kind, _, _) operation_result) = - if hosted then return_unit - else - match result with - | Applied _ -> return_unit - | Skipped _ -> assert false - | Backtracked (_, None) -> - (* there must be another error for this to happen *) - return_unit - | Backtracked (_, Some errs) -> fail errs - | Failed (_, errs) -> fail errs + match result with + | Applied _ -> return_unit + | Skipped _ -> assert false + | Backtracked (_, None) -> + (* there must be another error for this to happen *) + return_unit + | Backtracked (_, Some errs) -> fail errs + | Failed (_, errs) -> fail errs in let* () = detect_manager_failure operation_result in List.iter_e (fun (Internal_operation_result (_, r)) -> detect_manager_failure r) internal_operation_results in - fun ~hosted -> function - | Single_result (Manager_operation_result _ as res) -> - detect_manager_failure_single ~hosted res - | Single_result _ -> return_unit - | Cons_result - ( (Manager_operation_result - {operation_result = Applied (Host_result _); _} as res), - rest ) -> - let* () = detect_manager_failure_single ~hosted:false res in - detect_manager_failure ~hosted:true rest - | Cons_result (res, rest) -> - let* () = detect_manager_failure_single ~hosted res in - detect_manager_failure ~hosted rest + function + | Single_result (Manager_operation_result _ as res) -> + detect_manager_failure_single res + | Single_result _ -> return_unit + | Cons_result (res, rest) -> + let* () = detect_manager_failure_single res in + detect_manager_failure rest in fun {contents} -> detect_manager_failure contents @@ -911,7 +896,7 @@ let apply_with_metadata ?(policy = By_round 0) ?(check_size = true) match result with | No_operation_metadata -> return (state, contents_result) | Operation_metadata metadata -> - let*? () = detect_manager_failure ~hosted:false metadata in + let*? () = detect_manager_failure metadata in return (state, result :: contents_result)) (vstate, []) operations @@ -1113,8 +1098,7 @@ let balance_update_of_operation_result : | Sc_rollup_publish_result _ | Sc_rollup_refute_result _ | Sc_rollup_timeout_result _ | Sc_rollup_execute_outbox_message_result _ | Sc_rollup_recover_bond_result _ | Zk_rollup_origination_result _ - | Zk_rollup_publish_result _ | Zk_rollup_update_result _ | Host_result _ - -> + | Zk_rollup_publish_result _ | Zk_rollup_update_result _ -> [] | Delegation_result {balance_updates; _} | Transaction_result @@ -1235,8 +1219,7 @@ let bake_n_with_origination_results ?baking_mode ?policy n b = | Successful_manager_result (Sc_rollup_recover_bond_result _) | Successful_manager_result (Zk_rollup_origination_result _) | Successful_manager_result (Zk_rollup_publish_result _) - | Successful_manager_result (Zk_rollup_update_result _) - | Successful_manager_result (Host_result _) -> + | Successful_manager_result (Zk_rollup_update_result _) -> origination_results_rev | Successful_manager_result (Origination_result x) -> Origination_result x :: origination_results_rev) diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.mli b/src/proto_alpha/lib_protocol/test/helpers/block.mli index 1e0e0f59909a8078101866ad9dcd4efd3a52c088..ff649bd1412026944867a3bb8ad69d52e02ae6de 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/block.mli @@ -146,7 +146,6 @@ val genesis : ?nonce_revelation_threshold:int32 -> ?dal:Constants.Parametric.dal -> ?adaptive_issuance:Constants.Parametric.adaptive_issuance -> - ?sponsored_operations_enable:bool -> Parameters.bootstrap_account list -> block tzresult Lwt.t @@ -417,7 +416,6 @@ val prepare_initial_context_params : ?dal:Constants.Parametric.dal -> ?adaptive_issuance:Constants.Parametric.adaptive_issuance -> ?consensus_rights_delay:int -> - ?sponsored_operations_enable:bool -> unit -> ( Constants.Parametric.t * Block_header.shell_header * Block_hash.t, tztrace ) diff --git a/src/proto_alpha/lib_protocol/test/helpers/constants_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/constants_helpers.ml index fb46b426dac4442b1235df12fdb3f7cd667c76df..bb06992ed0e0c035592238d05934a3428ac4c4f7 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/constants_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/constants_helpers.ml @@ -191,7 +191,4 @@ module Set = struct c end end - - let sponsored_operations_enable sponsored_operations_enable (c : t) = - {c with sponsored_operations_enable} end diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 2ac842f836dcf386f6b69401bd42fb9fe053b82f..42d8b87fa7a2504c6bb43231e9ece352ca6f01df 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -657,7 +657,7 @@ let init_gen tup ?rng_state ?commitments ?bootstrap_balances ?cycles_per_voting_period ?sc_rollup_arith_pvm_enable ?sc_rollup_private_enable ?sc_rollup_riscv_pvm_enable ?dal_enable ?zk_rollup_enable ?hard_gas_limit_per_block ?nonce_revelation_threshold ?dal - ?adaptive_issuance ?sponsored_operations_enable () = + ?adaptive_issuance () = let open Lwt_result_syntax in let n = tup_n tup in let*? accounts = Account.generate_accounts ?rng_state n in @@ -693,7 +693,6 @@ let init_gen tup ?rng_state ?commitments ?bootstrap_balances ?nonce_revelation_threshold ?dal ?adaptive_issuance - ?sponsored_operations_enable bootstrap_accounts in (blk, tup_get tup contracts) diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.mli b/src/proto_alpha/lib_protocol/test/helpers/context.mli index 13d0b646c9f7770260a217fd22f718a489354275..17e4813cc4ed164b91e9a99c86659bdda5578c9a 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/context.mli @@ -375,7 +375,6 @@ type 'accounts init := ?nonce_revelation_threshold:int32 -> ?dal:Constants.Parametric.dal -> ?adaptive_issuance:Constants.Parametric.adaptive_issuance -> - ?sponsored_operations_enable:bool -> unit -> (Block.t * 'accounts) tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/test/helpers/error_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/error_helpers.ml index 112cfbaf2cf931eb04c038ca9234a202e0e4675f..daf4515c5604a3a7e4ae0462034210d61979de32 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/error_helpers.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/error_helpers.ml @@ -25,9 +25,9 @@ let check_error_constructor_name ~loc ~expected errs = (** Identifies the [Inconsistent_sources] error. *) let check_inconsistent_sources ~first_source ~source = function - | [Inconsistent_sources {fee_payer; source = s}] -> + | [Inconsistent_sources {expected_source; source = s}] -> Signature.Public_key_hash.( - fee_payer = Account.pkh_of_contract_exn first_source + expected_source = Account.pkh_of_contract_exn first_source && s = Account.pkh_of_contract_exn source) | _ -> false @@ -66,17 +66,6 @@ let expect_inconsistent_counters_int ~loc ~source ~previous_counter ~counter in expect_inconsistent_counters ~loc ~source ~previous_counter ~counter errs -(** To be used as the [expect_failure] argument of - {!Incremental.add_operation} when expecting the - [Guest_operation_wrong_source] error. *) -let expect_guest_operation_wrong_source ~loc ~guest ~unexpected_source errs = - Assert.expect_error ~loc errs (function - | [Guest_operation_wrong_source {guest = g; source}] -> - Signature.Public_key_hash.( - g = Account.pkh_of_contract_exn guest - && source = Account.pkh_of_contract_exn unexpected_source) - | _ -> false) - (** To be used as the [expect_failure] argument of {!Incremental.add_operation} when expecting the [Incorrect_reveal_position] error. *) @@ -85,15 +74,6 @@ let expect_incorrect_reveal_position ~loc errs = | [Incorrect_reveal_position] -> true | _ -> false) -(** To be used as the [expect_failure] argument of - {!Incremental.add_operation} when expecting the - [Guest_incorrect_reveal_position] error. *) -let expect_guest_incorrect_reveal_position ~loc ~guest errs = - Assert.expect_error ~loc errs (function - | [Guest_incorrect_reveal_position {guest = g}] -> - Signature.Public_key_hash.(g = Account.pkh_of_contract_exn guest) - | _ -> false) - let expect_forbidden_delegate ~loc ~delegate errs = Assert.expect_error ~loc errs (function | [Validate_errors.Consensus.Forbidden_delegate d] -> diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index 9c267c19620753ad1bfaa25c79c04e9802682afb..91ff5534a84d92873c44b2bef79098f7d87af2e6 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -179,64 +179,6 @@ let preattestation ?delegate ?slot ?level ?round ?block_payload_hash ?branch let sign ?watermark sk ctxt (Contents_list contents) = Operation.pack (sign ?watermark sk ctxt contents) -let resign_hosted_batches ctxt operations = - let open Lwt_result_syntax in - let rec partition acc curr : packed_contents list -> packed_contents_list list - = function - | [] -> - let batch = - match Operation.of_list (List.rev curr) with - | Ok x -> x - | Error _ -> assert false - in - List.rev (batch :: acc) - | (Contents (Manager_operation {operation = Host _; _}) as op) :: r -> - if curr = [] then partition acc [op] r - else - let batch = - match Operation.of_list (List.rev curr) with - | Ok x -> x - | Error _ -> assert false - in - partition (batch :: acc) [op] r - | (Contents (Manager_operation _) as op) :: r -> - partition acc (op :: curr) r - | _ -> assert false - in - let partitions = partition [] [] operations in - let resign_partition (Contents_list contents) = - match contents with - | Cons (Manager_operation ({operation = Host {guest; _}; _} as host_op), r) - -> - let sponsor_unsigned_contents = - Cons - ( Manager_operation - { - host_op with - operation = Host {guest; guest_signature = Signature.zero}; - }, - r ) - in - let* guest_account = Context.Contract.manager ctxt (Implicit guest) in - let guest_signature = - raw_sign - guest_account.sk - (Context.branch ctxt) - (Contents_list sponsor_unsigned_contents) - in - return - (Operation.to_list - (Contents_list - (Cons - ( Manager_operation - {host_op with operation = Host {guest; guest_signature}}, - r )))) - | Single (Manager_operation _ as op) -> return [Contents op] - | _ -> assert false - in - let* l = List.map_es resign_partition partitions in - return (List.concat l) - let batch_operations ?(recompute_counters = false) ~source ctxt (operations : packed_operation list) = let open Lwt_result_wrap_syntax in @@ -269,28 +211,21 @@ let batch_operations ?(recompute_counters = false) ~source ctxt CounterMap.add pkh (Manager_counter.succ next_counter) map ) in (* Update counters and transform into a contents_list *) - let* has_host, _, rev_operations = + let* _counter_map, rev_operations = List.fold_left_es - (fun (has_host, counter_map, acc) -> function + (fun (counter_map, acc) -> function | Contents (Manager_operation m) -> - let has_host = - has_host - || match m.operation with Host _ -> true | _ -> false - in let* counter, counter_map = return_and_incr_counter counter_map m.source in return - ( has_host, - counter_map, + ( counter_map, Contents (Manager_operation {m with counter}) :: acc ) - | x -> return (has_host, counter_map, x :: acc)) - (false, counter_map, []) + | x -> return (counter_map, x :: acc)) + (counter_map, []) operations in - let operations = List.rev rev_operations in - if has_host then resign_hosted_batches ctxt operations - else return operations + return (List.rev rev_operations) else return operations in let* account = Context.Contract.manager ctxt source in @@ -1156,44 +1091,4 @@ let zk_rollup_update ?force_reveal ?counter ?fee ?gas_limit ?storage_limit ctxt let+ account = Context.Contract.manager ctxt src in sign account.sk (Context.branch ctxt) to_sign_op -let append_manager_contents content packed_contents = - match packed_contents with - | Contents_list (Single (Manager_operation _) as op) -> - Contents_list (Cons (content, op)) - | Contents_list (Cons (_, _) as cont_list) -> - Contents_list (Cons (content, cont_list)) - | _ -> assert false - -let host ?recompute_counters ?counter ?fee ?gas_limit ?storage_limit ctxt - ~(host : Contract.t) ~(guest : Contract.t) ~ops = - let open Lwt_result_syntax in - let* guest = Context.Contract.manager ctxt guest in - let* to_sign_op = - manager_operation - ~force_reveal:false - ?counter - ?fee - ?gas_limit - ?storage_limit - ~source:host - ctxt - (Host {guest = guest.pkh; guest_signature = Signature.zero}) - in - match to_sign_op with - | Contents_list (Single (Manager_operation _ as op)) -> - let* ops = batch_operations ?recompute_counters ~source:host ctxt ops in - let {protocol_data = Operation_data {contents; _}; _} = ops in - let contents = Contents_list contents in - let batch = append_manager_contents op contents in - let guest_signature = raw_sign guest.sk (Context.branch ctxt) batch in - let (Manager_operation op) = op in - let op = - Manager_operation - {op with operation = Host {guest = guest.pkh; guest_signature}} - in - let contents = append_manager_contents op contents in - let* host_account = Context.Contract.manager ctxt host in - return @@ sign host_account.sk (Context.branch ctxt) contents - | _ -> assert false - module Micheline = Micheline diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.mli b/src/proto_alpha/lib_protocol/test/helpers/op.mli index 33c25d87c9635f649da3d4720340e60bc6336780..28c88c7074598b6a58599627c0cab03ab9ab964e 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/op.mli @@ -670,20 +670,4 @@ val zk_rollup_update : update:Zk_rollup.Update.t -> Operation.packed tzresult Lwt.t -(** [host ctxt ~host ~guest ~ops] takes a list of operations to sponsor, - and creates a new batched operation by appending a host operation before it. - The initial batch is signed by [guest], the signature is included in - the [Host] manager operation, and the full batch is signed by [host]. *) -val host : - ?recompute_counters:bool -> - ?counter:Manager_counter.t -> - ?fee:Tez.t -> - ?gas_limit:gas_limit -> - ?storage_limit:Z.t -> - Context.t -> - host:Contract.t -> - guest:Contract.t -> - ops:packed_operation list -> - packed_operation tzresult Lwt.t - module Micheline = Micheline diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/dune b/src/proto_alpha/lib_protocol/test/integration/operations/dune index 74d09139226ca4146d13807e6c19b7e38993c2d7..6c9cc4be1dceec8eb3843ca03e0d75349659a68b 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/dune +++ b/src/proto_alpha/lib_protocol/test/integration/operations/dune @@ -37,8 +37,7 @@ test_transfer test_voting test_zk_rollup - test_transfer_ticket - test_host_operation)) + test_transfer_ticket)) (executable (name main) diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_combined_operations.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_combined_operations.ml index eeded037bf02c7b2c426de42305b6a0f33b3643b..297cbafffdc33d1a0542613ad9a3e56d2f2cb003 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_combined_operations.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_combined_operations.ml @@ -28,21 +28,22 @@ Component: Protocol (combined operations) Invocation: dune exec src/proto_alpha/lib_protocol/test/integration/operations/main.exe \ -- --file test_combined_operations.ml - Subject: Multiple operations can be grouped in one ensuring their - deterministic application. - Only manager operations are allowed in batches of more - than one operation. This file only tests batches where - all operations belong to the same manager. See - {!Test_host_operation} for tests involving multiple - managers. + Subject: Multiple manager operations can be grouped in one + batch, ensuring their ordered and atomic application + (that is, either they all succeed, or none of them is + applied). - For single-manager batches, if an invalid operation is - present in this group of operations then the - previously applied operations are backtracked, leaving - the context unchanged, and the following operations - are skipped. Fees attributed to the operations are - collected by the baker nonetheless. + More precisely, if any operation in the batch fails at + application time, then the previously applied + operations are backtracked, leaving the context + unchanged, and the remaining operations are + skipped. However, note that the fees for the batch are + collected by the baker regardless of the success or + failure of the application of the batch. + + All manager operations in a batch must have the same + source. There may be overlap with [lib_protocol/test/integration/validate/test_validation_batch.ml]. diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_host_operation.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_host_operation.ml deleted file mode 100644 index 703603836dfb9b51843de1c252981e8136b1da13..0000000000000000000000000000000000000000 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_host_operation.ml +++ /dev/null @@ -1,589 +0,0 @@ -(*****************************************************************************) -(* *) -(* SPDX-License-Identifier: MIT *) -(* Copyright (c) 2024 Marigold *) -(* Copyright (c) 2024 Nomadic Labs, *) -(* *) -(*****************************************************************************) - -open Protocol -open Alpha_context -open Validate_errors.Manager - -(** Testing - ------- - Component: Host operation - Invocation: dune exec src/proto_alpha/lib_protocol/test/integration/operations/main.exe \ - -- --file test_host_operation.ml - - Subject: Test the host manager operation, which allows a manager - operation batch to contain multiple sources. -*) - -(** Helpers *) - -let default_constants = - let open Constants_helpers.Set in - Context.default_test_constants - |> sponsored_operations_enable true - |> consensus_threshold 0 |> origination_size 0 - |> Issuance_weights.base_total_issued_per_minute Tez.zero - |> liquidity_baking_subsidy Tez.zero - -let context_init ?(constants = default_constants) n = - Context.init_with_constants_n constants n - -let context_init_1 ?constants () = - let open Lwt_result_syntax in - let* r = context_init ?constants 1 in - match r with b, [c1] -> return (b, c1) | _ -> assert false - -let context_init_2 ?constants () = - let open Lwt_result_syntax in - let* r = context_init ?constants 2 in - match r with b, [c1; c2] -> return (b, (c1, c2)) | _ -> assert false - -let context_init_3 ?constants () = - let open Lwt_result_syntax in - let* r = context_init ?constants 3 in - match r with b, [c1; c2; c3] -> return (b, (c1, c2, c3)) | _ -> assert false - -let context_init_4 ?constants () = - let open Lwt_result_syntax in - let* r = context_init ?constants 4 in - match r with - | b, [c1; c2; c3; c4] -> return (b, (c1, c2, c3, c4)) - | _ -> assert false - -let originate_contract ~b source = - let open Lwt_result_syntax in - let local_fact_path = "../michelson/contracts/rec_fact.tz" in - let root_fact_path = - "./src/proto_alpha/lib_protocol/test/integration/michelson/contracts/rec_fact.tz" - in - let resolved_fact_path = - if Sys.file_exists local_fact_path then local_fact_path else root_fact_path - in - let contract = Contract_helpers.load_script ~storage:"0" resolved_fact_path in - let* op, c = Op.contract_origination (B b) ~script:contract source in - let* b = Block.bake b ~operation:op in - return (b, c) - -let validate_single_operation ?expect_failure c op = - let open Lwt_result_syntax in - let* inc = - match c with - | Context.B b -> Incremental.begin_construction b - | I i -> return i - in - Incremental.validate_operation ?expect_failure inc op - -let pp_operation fmt (op : packed_operation) = - Format.fprintf - fmt - "%a@." - Data_encoding.Json.pp - (Data_encoding.Json.construct Operation.encoding op) - -(** Injects a standalone [Host] operation (with no guest operations): - { - Hosted by [host] - } - - Expects: [Sponsored_transaction_feature_disabled]. - Note: this batch would NOT be valid even if the feature flag were enabled - (but the validation error would be different). - *) -let test_disable_feature_flag () = - let open Lwt_result_syntax in - let* b, (host, guest) = - Context.init2 ~consensus_threshold:0 ~sponsored_operations_enable:false () - in - let ctxt = Context.B b in - let* guest = Context.Contract.manager ctxt guest in - let* to_sign_op = - Op.manager_operation - ~source:host - ctxt - (Host {guest = guest.pkh; guest_signature = Signature.zero}) - in - let* account = Context.Contract.manager ctxt host in - let op = Op.sign account.sk (Context.branch ctxt) to_sign_op in - let*! b = Block.bake ~operation:op b in - Assert.proto_error ~loc:__LOC__ b (function - | Sponsored_transaction_feature_disabled -> true - | _ -> false) - -(** Injects one [batch] : - { - Hosted by [host] - { - [guest] calls [Op.dummy_script] - } - } - - Expects: [Sponsored_transaction_feature_disabled]. - Note: this operation would be valid if the feature flag were enabled. - *) -let test_disable_feature_flag_simple_batch () = - let open Lwt_result_syntax in - let* b, (host, guest) = - Context.init2 ~consensus_threshold:0 ~sponsored_operations_enable:false () - in - let fee = Tez_helpers.of_int 10 in - let* op, contract = - Op.contract_origination (B b) host ~fee ~script:Op.dummy_script - in - let* b = Block.bake b ~operation:op in - let* op1 = Op.transaction (B b) ~fee guest contract Tez.zero in - let* batch = Op.host (B b) ~host ~guest ~ops:[op1] in - let*! b = Block.bake ~operation:batch b in - Assert.proto_error ~loc:__LOC__ b (function - | Sponsored_transaction_feature_disabled -> true - | _ -> false) - -(** Host operation is not the first operation of a batch - { // the following operations are baked in one block - [other_contract] calls [Op.dummy_script]; - { // the batch for [host] starts here - [host] transfers 50 tez to [other_contract]; - Hosted by [host] - { - [guest] calls [Op.dummy_script] - } - } - } - - Expects: [Sponsored_transaction_feature_disabled]. - Note: the sponsored batch would be valid if the feature flag were enabled. - *) -let test_disable_feature_flag_complex_batch () = - let open Lwt_result_syntax in - let* b, (host, guest, other_contract) = - Context.init3 ~consensus_threshold:0 ~sponsored_operations_enable:false () - in - let fee = Tez_helpers.of_int 10 in - let* op, contract = - Op.contract_origination (B b) host ~fee ~script:Op.dummy_script - in - let* b = Block.bake b ~operation:op in - let* op1 = - Op.transaction (B b) ~fee host other_contract (Tez_helpers.of_int 50) - in - let* op2 = Op.transaction (B b) ~fee other_contract contract Tez.zero in - let* op3 = Op.transaction (B b) ~fee guest contract Tez.zero in - let* op4 = Op.host (B b) ~host ~guest ~ops:[op3] in - let* batch = Op.batch_operations ~source:host (B b) [op1; op4] in - let*! b = Block.bake ~operations:[op2; batch] b in - Assert.proto_error ~loc:__LOC__ b (function - | Sponsored_transaction_feature_disabled -> true - | _ -> false) - -(** Validation KO: Source consistency *) - -(** Guest = Sponsor - - Test that a sponsor cannot be a guest. - - Expects: [Guest_is_sponsor]. - *) -let test_guest_equal_sponsor () = - let open Lwt_result_syntax in - let* b, host = context_init_1 () in - let* b, fact = originate_contract ~b host in - let* host_counter = Context.Contract.counter (B b) host in - let* op1 = - Op.transaction - (B b) - ~counter:Manager_counter.(succ host_counter) - host - fact - Tez.zero - in - let* batch = Op.host (B b) ~host ~guest:host ~ops:[op1] in - let*! r = validate_single_operation (B b) batch in - Assert.proto_error ~loc:__LOC__ r (function - | Guest_is_sponsor pkh -> - Signature.Public_key_hash.(pkh = Account.pkh_of_contract_exn host) - | _ -> false) - -(** Same guest twice - - Test that a sponsor cannot include two batches from a same guest. - - Expects: [Sponsored_transaction_source_hosted_twice]. - *) -let test_same_guest_twice () = - let open Lwt_result_syntax in - let* b, (host, guest) = context_init_2 () in - let* b, fact = originate_contract ~b host in - let* op1 = - Op.transaction (B b) guest fact Tez.zero ~fee:Tez_helpers.one_mutez - in - let* batch1 = Op.host (B b) ~host ~guest ~ops:[op1] in - let* op2 = - Op.transaction (B b) guest fact Tez.zero ~fee:Tez_helpers.one_cent - in - let* batch2 = Op.host (B b) ~host ~guest ~ops:[op2] in - let* operation = - Op.batch_operations - ~recompute_counters:true - ~source:host - (B b) - [batch1; batch2] - in - let guest_pkh = Account.pkh_of_contract_exn guest in - let*! r = validate_single_operation (B b) operation in - Assert.proto_error ~loc:__LOC__ r (function - | Guest_hosted_twice {guest} -> - Signature.Public_key_hash.(guest = guest_pkh) - | _ -> false) - -(** Wrong source for the host - - Tests that an operation cannot have two different sponsors. - - Expects: [Inconsistent_sources]. - *) -let test_wrong_source_for_host () = - let open Lwt_result_syntax in - let* b, (host1, host2, guest1, guest2) = context_init_4 () in - let* b, fact = originate_contract ~b host1 in - let* op1 = - Op.transaction (B b) guest1 fact Tez.zero ~fee:Tez_helpers.one_mutez - in - let* batch1 = Op.host (B b) ~host:host1 ~guest:guest1 ~ops:[op1] in - let* op2 = - Op.transaction (B b) guest2 fact Tez.zero ~fee:Tez_helpers.one_cent - in - let* batch2 = Op.host (B b) ~host:host2 ~guest:guest2 ~ops:[op2] in - let* operation = - Op.batch_operations - ~recompute_counters:true - ~source:host1 - (B b) - [batch1; batch2] - in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_inconsistent_sources - ~loc:__LOC__ - ~first_source:host1 - ~source:host2 - in - validate_single_operation ~expect_failure (B b) operation - in - (* Now signed by host2. *) - let* operation = - Op.batch_operations - ~recompute_counters:true - ~source:host2 - (B b) - [batch1; batch2] - in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_inconsistent_sources - ~loc:__LOC__ - ~first_source:host1 - ~source:host2 - in - validate_single_operation ~expect_failure (B b) operation - in - return_unit - -(** Guest operation before host operation - - Tests that a guest operation cannot occur before a host operation. - - Expects: [Inconsistent_sources]. - *) -let test_guest_operation_before_host () = - let open Lwt_result_syntax in - let* b, (host, guest) = context_init_2 () in - let* b, fact = originate_contract ~b host in - let* op1 = - Op.transaction (B b) guest fact Tez.zero ~fee:Tez_helpers.one_mutez - in - let* op2 = - Op.transaction (B b) guest fact Tez.zero ~fee:Tez_helpers.one_cent - in - let* batch = Op.host (B b) ~host ~guest ~ops:[op2] in - (* Whole batch is signed by the host *) - let* operation = - Op.batch_operations ~recompute_counters:true ~source:host (B b) [op1; batch] - in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_inconsistent_sources - ~loc:__LOC__ - ~first_source:guest - ~source:host - in - validate_single_operation ~expect_failure (B b) operation - in - (* Whole batch is signed by the guest *) - let* operation = - Op.batch_operations - ~recompute_counters:true - ~source:guest - (B b) - [op1; batch] - in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_inconsistent_sources - ~loc:__LOC__ - ~first_source:guest - ~source:host - in - validate_single_operation ~expect_failure (B b) operation - in - return_unit - -(** Unexpected guest in hosted guest batch - - Tests that an unexpected guest is not allowed. - - Expects: [Guest_operation_wrong_source]. - *) -let test_unexpected_guest_in_batch () = - let open Lwt_result_syntax in - let* b, (host, unexpected_guest, expected_guest) = context_init_3 () in - let* b, fact = originate_contract ~b host in - let* op = - Op.transaction - (B b) - unexpected_guest - fact - Tez.zero - ~fee:Tez_helpers.one_mutez - in - let* batch = Op.host (B b) ~host ~guest:expected_guest ~ops:[op] in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_guest_operation_wrong_source - ~loc:__LOC__ - ~guest:expected_guest - ~unexpected_source:unexpected_guest - in - validate_single_operation ~expect_failure (B b) batch - in - return_unit - -(** No sponsor operation in a guest subbatch - - Tests when a sponsor operation is the first or last operation in a guest subbatch. - - Expects: [Guest_operation_wrong_source]. -*) -let test_no_sponsor_operation_in_guest_subbatch () = - let open Lwt_result_syntax in - let* b, (host, guest) = context_init_2 () in - let* b, fact = originate_contract ~b host in - let* op_host = Op.transaction (B b) host fact Tez.zero in - let* op_guest = Op.transaction (B b) guest fact Tez.zero in - let* batch = Op.host (B b) ~host ~guest ~ops:[op_host; op_guest] in - let* batch = - Op.batch_operations (B b) ~recompute_counters:true ~source:host [batch] - in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_guest_operation_wrong_source - ~loc:__LOC__ - ~guest - ~unexpected_source:host - in - validate_single_operation ~expect_failure (B b) batch - in - let* batch = Op.host (B b) ~host ~guest ~ops:[op_guest; op_host] in - let* batch = - Op.batch_operations (B b) ~recompute_counters:true ~source:host [batch] - in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_guest_operation_wrong_source - ~loc:__LOC__ - ~guest - ~unexpected_source:host - in - validate_single_operation ~expect_failure (B b) batch - in - return_unit - -(** Counter consistency for sponsor counters *) - -(** Wrong counter in hosts operations - - Tests that unexpected host counters make the operation invalid. - - Expects: [Counter_in_the_future, Counter_in_the_past, Inconsistent_counters]. - *) -let test_wrong_counter_in_hosts () = - let open Lwt_result_syntax in - let* b, (host, guest, guest') = context_init_3 () in - let* b, fact = originate_contract ~b host in - let* host_counter = Context.Contract.counter (B b) host in - let* guest'_counter = Context.Contract.counter (B b) guest' in - let* op = - Op.transaction (B b) guest fact Tez.zero ~fee:Tez_helpers.one_mutez - in - let mk_host ~guest ~op counter = - Op.host (B b) ~counter ~host ~guest ~ops:[op] - in - let* single_host_batch_counter_ahead = - mk_host ~guest ~op (Manager_counter.succ host_counter) - in - let*! r = validate_single_operation (B b) single_host_batch_counter_ahead in - let* () = - Assert.proto_error ~loc:__LOC__ r (function - | Contract_storage.Counter_in_the_future _ -> true - | _ -> false) - in - let* single_host_batch_counter_in_the_past = - mk_host ~guest ~op (Manager_counter.Internal_for_tests.of_int 0) - in - let*! r = - validate_single_operation (B b) single_host_batch_counter_in_the_past - in - let* () = - Assert.proto_error ~loc:__LOC__ r (function - | Contract_storage.Counter_in_the_past _ -> true - | _ -> false) - in - (* Test an invalid counter on the second host operation *) - let* op2 = - Op.transaction - (B b) - guest' - ~counter:(Manager_counter.succ guest'_counter) - fact - Tez.zero - ~fee:Tez_helpers.one_mutez - in - let* host1 = mk_host ~guest ~op host_counter in - let* host2 = - mk_host ~guest:guest' ~op:op2 Manager_counter.(succ (succ host_counter)) - in - let* batch = Op.batch_operations (B b) ~source:host [host1; host2] in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_inconsistent_counters - ~loc:__LOC__ - ~source:host - ~previous_counter:(Manager_counter.succ host_counter) - ~counter:Manager_counter.(succ (succ (succ host_counter))) - in - validate_single_operation ~expect_failure (B b) batch - in - return_unit - -(** Wrong counter in host operations after sponsor tx - - Expects: [Inconsistent_counters]. - *) -let test_bad_host_counter_after_sponsor_tx () = - let open Lwt_result_syntax in - let* b, (host, guest, guest') = context_init_3 () in - let* b, fact = originate_contract ~b host in - let* op_host = - Op.transaction (B b) host fact Tez.zero ~fee:Tez_helpers.one_mutez - in - let* op_guest = - Op.transaction (B b) guest fact Tez.zero ~fee:Tez_helpers.one_mutez - in - let bad_counter = Manager_counter.Internal_for_tests.(of_int 1000) in - let* host1 = - Op.host (B b) ~counter:bad_counter ~host ~guest ~ops:[op_guest] - in - let* op_guest' = - Op.transaction (B b) guest' fact Tez.zero ~fee:Tez_helpers.one_mutez - in - let* host2 = - Op.host - (B b) - ~counter:Manager_counter.(succ bad_counter) - ~host - ~guest:guest' - ~ops:[op_guest'] - in - let* batched_op = - Op.batch_operations (B b) ~source:host [op_host; host1; host2] - in - let* (_ : Incremental.t) = - let* host_counter = Context.Contract.counter (B b) host in - let expect_failure = - Error_helpers.expect_inconsistent_counters - ~loc:__LOC__ - ~source:host - ~previous_counter:(Manager_counter.succ host_counter) - ~counter:(Manager_counter.succ bad_counter) - in - validate_single_operation ~expect_failure (B b) batched_op - in - return_unit - -(** Counter consistency for guest counters *) - -(** Test guest counters for consistency - - Expects: [Inconsistent_counters]. - *) -let test_wrong_counter_in_guest_operations () = - let open Lwt_result_syntax in - let* b, (host, guest) = context_init_2 () in - let* b, fact = originate_contract ~b host in - let* guest_counter = Context.Contract.counter (B b) guest in - let* op1 = Op.transaction (B b) guest fact Tez.zero ~fee:Tez.one_cent in - let* op2 = - Op.transaction - ~counter:Manager_counter.(succ (succ guest_counter)) - (B b) - guest - fact - Tez.zero - ~fee:Tez.one_mutez - in - let* batch = Op.host (B b) ~host ~guest ~ops:[op1; op2] in - let* (_ : Incremental.t) = - let expect_failure = - Error_helpers.expect_inconsistent_counters - ~loc:__LOC__ - ~source:guest - ~previous_counter:(Manager_counter.succ guest_counter) - ~counter:Manager_counter.(succ (succ (succ guest_counter))) - in - validate_single_operation ~expect_failure (B b) batch - in - return_unit - -let tests = - let open Tztest in - List.map - (fun (s, f) -> tztest s `Quick f) - [ - ( "Check feature flag is disabled (Host operation alone)", - test_disable_feature_flag ); - ( "Check feature flag is disabled (simple valid batch)", - test_disable_feature_flag_simple_batch ); - ( "Check feature flag is disabled (complex valid batch)", - test_disable_feature_flag_complex_batch ); - ("Validation KO: guest equal sponsor", test_guest_equal_sponsor); - ("Validation KO: same guest twice", test_same_guest_twice); - ("Validation KO: test wrong source for host", test_wrong_source_for_host); - ( "Validation KO: test guest operation before host", - test_guest_operation_before_host ); - ( "Validation KO: test unexpected guest in batch", - test_unexpected_guest_in_batch ); - ( "Validation KO: no sponsor operation in guest subbatch", - test_no_sponsor_operation_in_guest_subbatch ); - ("Validation KO: wrong counter in hosts", test_wrong_counter_in_hosts); - ( "Validation KO: bad host counter after sponsor tx", - test_bad_host_counter_after_sponsor_tx ); - ( "Validation KO: wrong counter in guest operations", - test_wrong_counter_in_guest_operations ); - ] - -let () = - Alcotest_lwt.run ~__FILE__ Protocol.name [("Host operation", tests)] - |> Lwt_main.run diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml b/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml index 612d0ea0cedb60f2e411f74c173ba0aa1d8aa091..ca7954b2728b38de1d8269ba392b6f4605126c0d 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml @@ -73,8 +73,7 @@ let ensure_kind infos kind = | Sc_rollup_add_messages _ | Sc_rollup_refute _ | Sc_rollup_timeout _ | Sc_rollup_execute_outbox_message _ | Sc_rollup_recover_bond _ | Dal_publish_commitment _ | Zk_rollup_origination _ - | Zk_rollup_publish _ | Zk_rollup_update _ - | Host _ (* TODO: https://gitlab.com/tezos/tezos/-/issues/7139 *) ), + | Zk_rollup_publish _ | Zk_rollup_update _ ), _ ) -> assert false) | Single _ -> assert false diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index 6eab910c8f7277f1a3c922b9860af47b9dbfea87..726cc48694a968dd199b291103262f25360bda3d 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -1835,13 +1835,13 @@ module Manager = struct let* acc = f init (Elt contents) in batch_fold_left_e ~f ~init:acc ~batch:tail - let check_source_is_fee_payer ~fee_payer ~source = + let check_source ~expected_source ~source = Option.iter_e - (fun fee_payer -> + (fun expected_source -> error_unless - (Signature.Public_key_hash.equal source fee_payer) - (Inconsistent_sources {fee_payer; source})) - fee_payer + (Signature.Public_key_hash.equal source expected_source) + (Inconsistent_sources {expected_source; source})) + expected_source let check_counter ~previous_counter ~counter ~source = Option.iter_e @@ -1853,25 +1853,12 @@ module Manager = struct (** Used in [check_consistency] below. *) type consistency_state = { - fee_payer : public_key_hash option; + source : public_key_hash option; (** [None] while checking the first operation in the batch, - then the source of the first operation in the batch, who - will pay the fees for the whole batch. *) - fee_payer_previous_counter : Manager_counter.t option; + then the source of the first operation in the batch. *) + previous_counter : Manager_counter.t option; (** [None] while checking the first operation in the batch, - then the counter of the last encountered operation from - [fee_payer]. *) - current_guest : public_key_hash option; - (** [None] if no [Host] operations have been encountered, else - the guest indicated inside the last encountered [Host] - operation. *) - current_guest_previous_counter : Manager_counter.t option; - (** [None] when [current_guest] is [None], or when no - operations with source [current_guest] have been - encountered yet. Otherwise, contains the counter of the - last seen operation from [current_guest]. *) - previous_guests : Signature.Public_key_hash.Set.t; - (** Set of all the guests seen inside [Host] operations. *) + then the counter of the last encountered operation. *) } (** Checks that a batch of manager operations is well-formed. @@ -1884,252 +1871,64 @@ module Manager = struct Accordingly, all potential errors here should be [`Permanent]. - {b Source consistency -- first source aka fee payer aka sponsor} + {b Source consistency} - - The source of the very first operation in the batch (which may - or may not be a [Host] operation) is called the [fee_payer], - because it will pay the fees for all the operations in the - batch, regardless of their own sources. The [fee_payer] is also - known as the {i sponsor} or {i host} of the batch. - - - All [Host] operations in the batch must have the [fee_payer] - as their source. - - - Any operations before the first [Host] operation must also - have the [fee_payer] as their source. - - In particular, note that if a batch contains no [Host] - operations, then all its operations must have the [fee_payer] as - their source. In other words, a non-sponsored batch always has a - single source (who obviously pays all the fees). - - {b Source consistency -- guests} - - - After a [Host {guest; _}] operation, all operations must have - [guest] as their source, until the next [Host] operation is - encountered or the batch ends. - - - The same guest must not appear in two separate [Host] - operations. - - - The [fee_payer] must not appear as guest in a [Host] - operation. + All operations in the batch must have the same source. {b Counter consistency} - The [counter] of an individual operation relates to the [source] - of this operation. For every source in the batch, all counters - associated with that source must be increasing and consecutive. + The counters must be increasing and consecutive. {b Reveal position} - A [Reveal] operation must always be either the very first - operation of the whole batch (in which case its source is the - [fee_payer] as specified above), or must come immediately after - a [Host] operation (in which case its source is the [Host] - operation's [guest]). - - All other [Reveal] positions are forbidden. + A [Reveal] operation is only allowed if it is the very first + operation in the batch. --- This function can return the following errors: - - [Inconsistent_sources] when a [Host] operation, or an - operation before the first [Host] operation, has a source other - than [fee_payer]. + - [Inconsistent_sources] when the batch contains multiple + sources. - - [Guest_operation_wrong_source] when an operation after a - [Host] operation has a source other than the guest. + - [Inconsistent_counters] when the counters are not increasing and consecutive. - - [Guest_hosted_twice] when the same guest appears in two [Host] - operations. - - - [Guest_is_sponsor] when the [fee_payer] appears as guest in - a [Host] operation. - - - [Inconsistent_counters] when the counters for a source - (whether it be the first source or a guest) are not consecutive. - - - [Incorrect_reveal_position] when a [Reveal] operation is - neither the first operation of the whole batch, nor right after - a [Host] operation. - *) + - [Incorrect_reveal_position] when a [Reveal] operation is not + the first operation of the whole batch. *) let check_consistency batch = let open Result_syntax in - let initial_state = - { - fee_payer = None; - fee_payer_previous_counter = None; - current_guest = None; - current_guest_previous_counter = None; - previous_guests = Signature.Public_key_hash.Set.empty; - } - in - let check_elt - { - fee_payer; - fee_payer_previous_counter; - current_guest; - current_guest_previous_counter; - previous_guests; - } (Elt (Manager_operation {source; counter; operation; _})) = + let initial_state = {source = None; previous_counter = None} in + let check_elt {source = expected_source; previous_counter} + (Elt (Manager_operation {source; counter; operation; _})) = (* Checks an individual operation of the batch. Relies on the given {!consistency_state} (see the type definition for invariants), and returns the appropriate {!consistency_state} for the next operation in the batch. *) - match operation with - | Host {guest; guest_signature = _} -> - let* () = check_source_is_fee_payer ~fee_payer ~source in - let* () = - check_counter - ~previous_counter:fee_payer_previous_counter - ~counter - ~source - in - let* () = - error_when - Signature.Public_key_hash.(guest = source) - (Guest_is_sponsor guest) - in - let* () = - error_when - (Signature.Public_key_hash.Set.mem guest previous_guests) - (Guest_hosted_twice {guest}) - in - return - { - fee_payer = Some source; - fee_payer_previous_counter = Some counter; - current_guest = Some guest; - current_guest_previous_counter = None; - previous_guests = - Signature.Public_key_hash.Set.add guest previous_guests; - } - | _ (* Not a [Host] operation *) -> ( - match current_guest with - | None -> - (* No [Host] operations have been encountered yet, so - [source] must be the [fee_payer] of the batch. *) - let* () = check_source_is_fee_payer ~fee_payer ~source in - let* () = - check_counter - ~previous_counter:fee_payer_previous_counter - ~counter - ~source - in - let* () = - match operation with - | Reveal _ -> ( - (* A [Reveal] operation is only allowed as either - the first operation of the whole batch, or - immediately after a [Host] operation. - - But we know that no [Host] operations have been - encountered yet, so this [Reveal] isn't right - after a [Host] operation. - - To check whether it is the first operation of - the whole batch, we look at the [fee_payer] - field. Indeed, the invariants of - {!consistency_state} guarantee that [fee_payer] - is [None] when checking the first operation, - then [Some _] for other operations. *) - match fee_payer with - | None -> (* First op in the whole batch: OK *) return_unit - | Some _ -> tzfail Incorrect_reveal_position) - | _ -> return_unit - in - return - { - fee_payer = Some source; - fee_payer_previous_counter = Some counter; - current_guest; - current_guest_previous_counter; - previous_guests; - } - | Some guest -> - (* This means that the last encountered [Host] operation - contained [guest]. - - Moreover, recall that the current operation is not - itself a [Host] operation, thanks to the outermost - pattern matching. - - Therefore, the [source] must be [guest], and the - [counter] is also [guest]'s. *) - let* () = - error_unless - (Signature.Public_key_hash.equal source guest) - (Guest_operation_wrong_source {guest; source}) - in - let* () = - check_counter - ~previous_counter:current_guest_previous_counter - ~counter - ~source - in - let* () = - match operation with - | Reveal _ -> ( - (* A [Reveal] operation is only allowed as either - the first operation of the whole batch, or - immediately after a [Host] operation. - - A [Host] operation has already been - encountered, so this [Reveal] is not the first - operation in the batch. - - To know whether it is right after a [Host] - operation, we look at the - [current_guest_previous_counter] field. Indeed, - it is reset to [None] when a [Host] operation - is encountered, then set to [Some _] after - operations from the new guest have been - seen. *) - match current_guest_previous_counter with - | None -> (* Right after a [Host] op: OK *) return_unit - | Some _ -> tzfail (Guest_incorrect_reveal_position {guest}) - ) - | _ -> return_unit - in - return - { - fee_payer; - fee_payer_previous_counter; - current_guest; - current_guest_previous_counter = Some counter; - previous_guests; - }) + let* () = check_source ~expected_source ~source in + let* () = check_counter ~previous_counter ~counter ~source in + let* () = + match operation with + | Reveal _ -> ( + (* A [Reveal] operation is only allowed if it is + the first operation of the whole batch. The + invariants of {!consistency_state} guarantee + that [expected_source] is [None] if and only if + we are currently checking the first + operation. *) + match expected_source with + | None -> (* First op in the whole batch: OK *) return_unit + | Some _ -> tzfail Incorrect_reveal_position) + | _ -> return_unit + in + return {source = Some source; previous_counter = Some counter} in batch_fold_left_e ~f:check_elt ~init:initial_state ~batch - let assert_sponsored_operations_feature_enabled vi = - error_unless - (Constants.sponsored_operations_enable vi.ctxt) - Sponsored_transaction_feature_disabled - - let rec check_for_hosted_ops : - type kind. _ -> kind Kind.manager contents_list -> unit tzresult = - fun vi contents_list -> - let open Result_syntax in - match contents_list with - | Single (Manager_operation {operation = Host _; _}) -> - assert_sponsored_operations_feature_enabled vi - | Single (Manager_operation _) -> return_unit - | Cons (Manager_operation {operation = Host _; _}, _) -> - assert_sponsored_operations_feature_enabled vi - | Cons (Manager_operation _, rest) -> check_for_hosted_ops vi rest - (** Check a few simple properties of the batch, and return the initial {!batch_state} and the contract public key. Invariants checked: - - The feature flag for sponsored operations (ie fail if the - batch contains a [Host] operation but the feature flag is - disabled). - - The batch is well formed: see {!check_consistency}. - The source's contract is allocated. @@ -2146,7 +1945,6 @@ module Manager = struct let check_sanity_and_find_public_key vi (type kind) (contents_list : kind Kind.manager contents_list) = let open Lwt_result_syntax in - let*? () = check_for_hosted_ops vi contents_list in let*? (_ : consistency_state) = check_consistency contents_list in let source, first_counter = match contents_list with @@ -2303,7 +2101,6 @@ module Manager = struct Dal_apply.validate_publish_commitment vi.ctxt slot_header | Zk_rollup_origination _ | Zk_rollup_publish _ | Zk_rollup_update _ -> assert_zk_rollup_feature_enabled vi - | Host _ -> assert_sponsored_operations_feature_enabled vi let check_contents (type kind) vi batch_state (contents : kind Kind.manager contents) ~consume_gas_for_sig_check diff --git a/src/proto_alpha/lib_protocol/validate_errors.ml b/src/proto_alpha/lib_protocol/validate_errors.ml index 73b4575935d1db09b13dc65b970b2ca65094aacd..47514dfb2c08a955f4f36e24364e58e883848c3e 100644 --- a/src/proto_alpha/lib_protocol/validate_errors.ml +++ b/src/proto_alpha/lib_protocol/validate_errors.ml @@ -1093,7 +1093,7 @@ module Manager = struct conflict : operation_conflict; } | Inconsistent_sources of { - fee_payer : public_key_hash; + expected_source : public_key_hash; source : public_key_hash; } | Inconsistent_counters of { @@ -1107,14 +1107,6 @@ module Manager = struct | Sc_rollup_arith_pvm_disabled | Sc_rollup_riscv_pvm_disabled | Zk_rollup_feature_disabled - | Sponsored_transaction_feature_disabled - | Guest_operation_wrong_source of { - guest : public_key_hash; - source : public_key_hash; - } - | Guest_hosted_twice of {guest : public_key_hash} - | Guest_is_sponsor of public_key_hash - | Guest_incorrect_reveal_position of {guest : public_key_hash} let () = register_error_kind @@ -1145,32 +1137,25 @@ module Manager = struct ~id:"validate.operation.inconsistent_sources" ~title:"Inconsistent sources in operation batch" ~description: - "Unexpected source encountered in a non-guest operation of a batch." - ~pp:(fun ppf (first_source, source) -> - Format.fprintf - ppf - "Unexpected source encountered in a non-guest operation. Expected %a \ - (the source of the very first operation in the batch, who is the \ - fee payer, a.k.a. the sponsor), but got %a." - Signature.Public_key_hash.pp - first_source - Signature.Public_key_hash.pp - source) + "Inconsistent sources in operation batch. All operations in a batch \ + must have the same source." Data_encoding.( obj2 (req "first_source" Signature.Public_key_hash.encoding) (req "unexpected_source" Signature.Public_key_hash.encoding)) (function - | Inconsistent_sources {fee_payer; source} -> Some (fee_payer, source) + | Inconsistent_sources {expected_source; source} -> + Some (expected_source, source) | _ -> None) - (fun (fee_payer, source) -> Inconsistent_sources {fee_payer; source}) ; + (fun (expected_source, source) -> + Inconsistent_sources {expected_source; source}) ; register_error_kind `Permanent ~id:"validate.operation.inconsistent_counters" ~title:"Inconsistent counters in operation" ~description: - "Inconsistent counters in operation batch. Counters for the same \ - source must be consecutive." + "Inconsistent counters in operation batch. Counters must be increasing \ + and consecutive." ~pp:(fun ppf (source, previous_counter, counter) -> Format.fprintf ppf @@ -1193,8 +1178,8 @@ module Manager = struct (fun (source, previous_counter, counter) -> Inconsistent_counters {source; previous_counter; counter}) ; let incorrect_reveal_description = - "Incorrect reveal operation position in batch: revelation of the fee \ - payer's public key is only allowed in first position." + "Incorrect reveal operation position in batch: only allowed in first \ + position." in register_error_kind `Permanent @@ -1270,95 +1255,7 @@ module Manager = struct ~pp:(fun ppf () -> Format.fprintf ppf "%s" zkru_disabled_description) Data_encoding.unit (function Zk_rollup_feature_disabled -> Some () | _ -> None) - (fun () -> Zk_rollup_feature_disabled) ; - - let sptx_disabled = - "Sponsored transactions will be enabled in a future proposal." - in - register_error_kind - `Permanent - ~id:"validate.operation.sponsored_transactions_disabled" - ~title:"Sponsored transactions are disabled" - ~description:sptx_disabled - ~pp:(fun ppf () -> Format.fprintf ppf "%s" sptx_disabled) - Data_encoding.unit - (function Sponsored_transaction_feature_disabled -> Some () | _ -> None) - (fun () -> Sponsored_transaction_feature_disabled) ; - register_error_kind - `Permanent - ~id:"validate.operation.guest_operation_wrong_source" - ~title:"Wrong source in guest operation" - ~description: - "The source of an operation does not match the last hosted guest in \ - the batch." - ~pp:(fun ppf (guest, source) -> - Format.fprintf - ppf - "Found an operation with source %a at a position where the source \ - should be the last hosted guest: %a." - Signature.Public_key_hash.pp - source - Signature.Public_key_hash.pp - guest) - Data_encoding.( - obj2 - (req "current_guest" Signature.Public_key_hash.encoding) - (req "wrong_source" Signature.Public_key_hash.encoding)) - (function - | Guest_operation_wrong_source {guest; source} -> Some (guest, source) - | _ -> None) - (fun (guest, source) -> Guest_operation_wrong_source {guest; source}) ; - register_error_kind - `Permanent - ~id:"validate.operation.guest_hosted_twice" - ~title:"Guest hosted twice" - ~description:"The same guest is hosted twice in the same sponsored batch." - ~pp:(fun ppf guest -> - Format.fprintf - ppf - "Guest %a is hosted twice." - Signature.Public_key_hash.pp - guest) - Data_encoding.(obj1 (req "guest" Signature.Public_key_hash.encoding)) - (function Guest_hosted_twice {guest} -> Some guest | _ -> None) - (fun guest -> Guest_hosted_twice {guest}) ; - register_error_kind - `Permanent - ~id:"validate.operation.guest_is_sponsor" - ~title:"Guest is sponsor" - ~description:"The sponsor also appears as a guest." - ~pp:(fun ppf pkh -> - Format.fprintf - ppf - "The sponsor %a also appears as a guest." - Signature.Public_key_hash.pp - pkh) - Data_encoding.( - obj1 (req "sponsor_and_guest" Signature.Public_key_hash.encoding)) - (function Guest_is_sponsor pkh -> Some pkh | _ -> None) - (fun pkh -> Guest_is_sponsor pkh) ; - register_error_kind - `Permanent - ~id:"validate.operation.guest_incorrect_reveal_position" - ~title:"Incorrect guest reveal position" - ~description: - "Incorrect position of a Reveal operation for a guest in the sponsored \ - batch. A guest Reveal operation is only allowed as the first \ - operation from this guest, that is, right after the Host operation \ - introducing this guest." - ~pp:(fun ppf guest -> - Format.fprintf - ppf - "Incorrect position of a Reveal operation for guest %a in the \ - sponsored batch. A guest Reveal operation is only allowed as the \ - first operation from this guest, that is, right after the Host \ - operation introducing this guest." - Signature.Public_key_hash.pp - guest) - Data_encoding.(obj1 (req "guest" Signature.Public_key_hash.encoding)) - (function - | Guest_incorrect_reveal_position {guest} -> Some guest | _ -> None) - (fun guest -> Guest_incorrect_reveal_position {guest}) + (fun () -> Zk_rollup_feature_disabled) end type error += Failing_noop_error diff --git a/src/proto_alpha/lib_protocol/validate_errors.mli b/src/proto_alpha/lib_protocol/validate_errors.mli index 589ffc88b4e59766362d60f708e3361096298934..b3f7956f56ea7cc1589a6a43eae5248b02eb780c 100644 --- a/src/proto_alpha/lib_protocol/validate_errors.mli +++ b/src/proto_alpha/lib_protocol/validate_errors.mli @@ -184,7 +184,7 @@ module Manager : sig conflict : operation_conflict; } | Inconsistent_sources of { - fee_payer : public_key_hash; + expected_source : public_key_hash; source : public_key_hash; } | Inconsistent_counters of { @@ -198,14 +198,6 @@ module Manager : sig | Sc_rollup_arith_pvm_disabled | Sc_rollup_riscv_pvm_disabled | Zk_rollup_feature_disabled - | Sponsored_transaction_feature_disabled - | Guest_operation_wrong_source of { - guest : public_key_hash; - source : public_key_hash; - } - | Guest_hosted_twice of {guest : public_key_hash} - | Guest_is_sponsor of public_key_hash - | Guest_incorrect_reveal_position of {guest : public_key_hash} end type error += Failing_noop_error diff --git a/src/proto_alpha/lib_sc_rollup_node/daemon_helpers.ml b/src/proto_alpha/lib_sc_rollup_node/daemon_helpers.ml index 5e5496569043a91f0c03f6b8e6068ab73f9278cf..8a0da88b0c8a1c131ea7bc5016c47f8332e612c2 100644 --- a/src/proto_alpha/lib_sc_rollup_node/daemon_helpers.ml +++ b/src/proto_alpha/lib_sc_rollup_node/daemon_helpers.ml @@ -294,8 +294,7 @@ let process_l1_operation (type kind) ~catching_up node_ctxt | Reveal _ | Transaction _ | Origination _ | Delegation _ | Update_consensus_key _ | Register_global_constant _ | Set_deposits_limit _ | Increase_paid_storage _ | Transfer_ticket _ | Sc_rollup_originate _ - | Zk_rollup_origination _ | Zk_rollup_publish _ | Zk_rollup_update _ - | Host _ -> + | Zk_rollup_origination _ | Zk_rollup_publish _ | Zk_rollup_update _ -> false in (* Only look at operations that are for the node's rollup *) diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out index d106e2ec2a29c9e673f2330225192ae891e378a3..c15fdf7a44aff1c1db88e70ee16c9331fb52ddd1 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- misc_protocol.out @@ -76,8 +76,7 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "autostaking_enable": true, "adaptive_issuance_force_activation": false, - "ns_enable": true, "direct_ticket_spending_enable": false, - "sponsored_operations_enable": false } + "ns_enable": true, "direct_ticket_spending_enable": false } ./octez-client rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 2, "delegate": "[PUBLIC_KEY_HASH]", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out index 01dc3d0fb64aa1460a13c71955702acc6536135b..c24db87341ca792eeab65f5894506fa1ad1bd2dc 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- misc_protocol.out @@ -76,8 +76,7 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "autostaking_enable": true, "adaptive_issuance_force_activation": false, - "ns_enable": true, "direct_ticket_spending_enable": false, - "sponsored_operations_enable": false } + "ns_enable": true, "direct_ticket_spending_enable": false } ./octez-client --mode light rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 2, "delegate": "[PUBLIC_KEY_HASH]", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out index 02316725458c68f298ac81f5eac0253d7984e0a2..c40986c91f793f6cab9d178829b204a4e4155af2 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- misc_protocol.out @@ -76,8 +76,7 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "autostaking_enable": true, "adaptive_issuance_force_activation": false, - "ns_enable": true, "direct_ticket_spending_enable": false, - "sponsored_operations_enable": false } + "ns_enable": true, "direct_ticket_spending_enable": false } ./octez-client --mode proxy rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 2, "delegate": "[PUBLIC_KEY_HASH]", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out index efb77f1b61a5e90ce361e3c5f7e2850a0c77dbb7..16599d6513486846e70a53d5013c74865fb9ceb5 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- misc_protocol.out @@ -76,8 +76,7 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "autostaking_enable": true, "adaptive_issuance_force_activation": false, - "ns_enable": true, "direct_ticket_spending_enable": false, - "sponsored_operations_enable": false } + "ns_enable": true, "direct_ticket_spending_enable": false } ./octez-client rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 3, "delegate": "[PUBLIC_KEY_HASH]", diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out index efb77f1b61a5e90ce361e3c5f7e2850a0c77dbb7..16599d6513486846e70a53d5013c74865fb9ceb5 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- misc_protocol.out @@ -76,8 +76,7 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "autostaking_enable": true, "adaptive_issuance_force_activation": false, - "ns_enable": true, "direct_ticket_spending_enable": false, - "sponsored_operations_enable": false } + "ns_enable": true, "direct_ticket_spending_enable": false } ./octez-client rpc get /chains/main/blocks/head/helpers/baking_rights [ { "level": 3, "delegate": "[PUBLIC_KEY_HASH]", diff --git a/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out b/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out index d5419890f96bb024f55914b8a8b108534ec88696..e48a56ec8340c0e462eeef9637f57b7557d3a450 100644 --- a/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out +++ b/tezt/tests/expected/protocol_migration.ml/Alpha- weeklynet regression test.out @@ -66,5 +66,4 @@ "radius_dz": { "numerator": "1", "denominator": "50" } }, "adaptive_issuance_activation_vote_enable": true, "autostaking_enable": true, "adaptive_issuance_force_activation": false, - "ns_enable": true, "direct_ticket_spending_enable": false, - "sponsored_operations_enable": false } + "ns_enable": true, "direct_ticket_spending_enable": false }