Open nathanielhourt opened 5 years ago
IMHO deprecating old operations is not a good idea. I had an idea before: do not deprecate the operations or change the old (or default) behavior, but introduce new behaviors if one (new) special extension or more is present. With this approach, old clients do not need to upgrade.
Agree with @abitmore . We don't gain much from deprecating old operations, because we will have to support them anyway.
Side note: some of your new operations are missing an extensions
field.
Right, I would like to avoid deprecating operations as well, but only account_update_operation
has the field to be removed as an optional. So it doesn't have to be deprecated, we can just require the optional to be null.
The others unconditionally require the excess fields. Thus there's no way to remove them. The operations simply have to be deprecated.
They're missing a lot of things; I omitted everything that wasn't salient to the BSIP discussion to keep the code clean and easy to read. I'll add all the boilerplate in for the actual implementation.
The operations simply have to be deprecated.
We can simply ignore the field when applying the operation, for example, when an optional ignore_xxx_field
is set in extensions
. This bloat the chain a bit though. Related discussion: https://github.com/bitshares/bitshares-core/issues/167#issuecomment-435041882.
...I am most definitely not going to implement that.
I assume this can be closed?
assume this can be closed?
I don't think so.
Abstract
The BitShares protocol specifies a number of operations to update objects within the database. Many of these operations contain several fields, all of which must be specified, even if only one or a few of them are being updated. This requires the operation to redundantly specify old values of fields for which no change is desired, which is wasteful of valuable blockchain storage space. Moreover, this strategy makes stateless analysis of such updates, i.e. to discern which fields are being modified, impossible.
This BSIP proposes to replace object update operations which contain many non-optional fields with new versions which specify all updated fields optionally. This will reduce the storage size of affected operations and make stateless analysis of their effects possible. Following a grace period, the old operations may be deprecated to require usage of the newer, more efficient versions.
Motivation
The size of the BitShares blockchain history is growing rapidly. Moreover, the rate of usage is increasing, causing the growth to accelerate. While the long term solution is the development of improved storage and handling of historical data, in the meantime it behooves stakeholders to eliminate frivolous waste of storage space. Several of the database update operations currently require the superfluous specification of all fields rather than only the particular fields the user wishes to modify. This results in storage space being consumed by redundant information which provides no benefit whatsoever to the stakeholders or software.
Another compelling motivation to adopt this change is that it supports other desirable use cases. BSIP 40 is a proposal to add a new authority type to the blockchain, the "Custom Active Authority," which grants limited privileges to sub-authorities rather than requiring full active authority for all operations. One important use case for this feature is to allow the creation of a limited authority capable of updating, for example, an account's memo key, but not its votes. With the current design of
account_update_operation
, however, an update to the memo key must also specify the votes, and it cannot be determined whether the new votes are identical to the old ones without accessing chain state.As currently specified, BSIP 40 cannot provide for this use case, and modifying the proposal to support analysis of the operations with access to chain state increases its implementation complexity dramatically and may have detrimental impacts on future blockchain scalability improvements. The addition of new update operations that specify field updates optionally is a comparatively small modification to the blockchain protocol, and it enables BSIP 40 to support this critical use case with no alterations to its current specification.
Rationale
BitShares operations are designed according to some loosely defined principles, one of which is that they should facilitate stateless analysis of their effects. For instance, operations which modify an account balance are expected to explicitly state the amount and asset type being moved, even when these can be inferred from chain state, so that programs can track the balance of accounts by looking at operation history alone, without requiring access to chain state. This principle can also be extended to update operations to require that such operations facilitate stateless analysis of their changes -- in particular, the ability to determine which specific fields are being changed.
An update to a field can be expressed in two ways: a delta of change, or a replacement value. Thus the question is raised, which is more important to stateless analysis -- the delta of change, or the new value? This proposal suggests to use the new value for simple field updates, but adjustment of asset balances must always be specified as a delta, as these adjustments represent movement of asset rather than arbitrary specification of a value. Updates to sets will support both a delta (items to add/remove) and a new value (complete replacement set), with the requirement that only one of these options be specified in a given operation.
The complete set of update operations presently defined by the protocol is as follows:
account_update_operation
asset_update_operation
asset_update_bitasset_operation
asset_update_feed_producers_operation
asset_update_issuer_operation
call_order_update_operation
committee_member_update_operation
committee_member_update_global_parameters_operation
proposal_update_operation
withdraw_permission_update_operation
witness_update_operation
htlc_extend_operation
Several of these operations are already complicit with the above principle. Only the following require alteration or replacement to comply:
account_update_operation
asset_update_operation
asset_update_bitasset_operation
committee_member_update_global_parameters_operation
withdraw_permission_update_operation
Note:
call_order_update_operation
is an edge case, as it requires specification of bothdelta_collateral
anddelta_debt
; however, these are deltas and therefore support stateless analysis, and the size advantage gained by specifying only one of these values versus both of them is not deemed sufficient to justify replacing and deprecating the operation.Specification
Two hardfork dates will be specified for the implementation of this BSIP: one is the activation date for the new operations/extensions, and the other is the cutoff date for the old operations/fields.
To reduce boilerplate around set updates, which may be expressed either as a delta or a complete replacement set, the following template will be defined:
A discussion of the proposed modifications are described for each affected operation below.
Account update
Of the operations requiring alteration,
account_update_operation
stands out since all of its update fields are already optional; however, one field in the operation,new_options
, is an object with several non-optional sub-fields.Since all fields on the operation itself are already optional, the existing operation does not need to be deprecated; instead, new operation extensions can be defined which update each sub-field in
new_options
individually, andnew_options
can subsequently be required to be a null optional after the cutoff date. Extensions are always optional, thus satisfying the optional updates design principle.The
account_update_operation::new_options
field is an optional of typeaccount_options
. The fields ofaccount_options
are:The following extensions will be added to
account_update_operation
to support updating these fields without usingnew_options
:The evaluator will be updated to verify that, if
num_witness
ornum_committee
or the votes are updated, then the desired number of witness/committee seats does not exceed the number of votes.Asset Updates
Of the operations requiring alteration, the
asset_update_operation
also stands out, as it only has two update fields, one of which,new_issuer
, is already optional, but is also required to be null as it has already been replaced with the dedicatedasset_update_issuer_operation
. The other field is a struct calledasset_options
. The fields in this struct are listed below:A new
asset_options_update_operation
, which does not contain the deprecatednew_issuer
field, will be defined with the fields specified below. After the cutoff date, theasset_update_operation
will be deprecated and disabled from use.A second asset updating operation,
asset_update_bitasset_operation
, must be modified as well. This operation bundles all of its fields for updating into a single struct field of typebitasset_options
:A new operation,
asset_update_bitasset_options_operation
, will be defined with the fields listed below. After the cutoff date,asset_update_bitasset_operation
will be deprecated and disabled from use.Global Parameters Update
The
committee_member_update_global_parameters_operation
contains all of its updates in thechain_parameters
struct:A new operation,
global_parameters_update_operation
will be defined with the fields listed below. After the cutoff date,committee_member_update_global_parameters_operation
will be deprecated and disabled from use.Withdraw Permission Update
The fields of
withdraw_permission_update_operation
are listed below.A new operation,
withdraw_permission_update_options_operation
, will be defined with the fields listed below. After the cutoff date,withdraw_permission_update_operation
will be deprecated and disabled from use.Discussion and Summary for Shareholders
The main cost of accepting this proposal is the addition of four new operations to the protocol, and the deprecation of four old ones, as well as the addition of several extensions to one operation and the deprecation of one of its fields. In return, however, the new operation versions will be much smaller, which is advantageous in the face of rapidly accelerating blockchain history growth. It should be noted, however, that these operations are not major contributors to the chain growth rate, and thus this improvement will be minor and will not substantially decrease the rate of growth, nor the acceleration of growth.
The main advantage gained by accepting this proposal is that the new operation versions are more self-describing. It will be possible to determine exactly which fields are updated merely by examining the operations themselves, rather than needing to simultaneously examine the blockchain database. This paves the road for critical use cases within the already-accepted BSIP 40 proposal, which are otherwise unsupportable.
Copyright
Intellectual Property is BS. Those who wish to pretend otherwise are hereby directed to treat this document as public domain.
See Also
BSIP 40