anchor.diff:      {Result, null}.
   
   is_valid_creation(New) ->
  -%check with info in aux field (epoch from parent lease)
  -%    (Old#lease.epoch == New#lease.epoch) andalso
  -    (nil == New#lease.owner) andalso
  -%    (Old#lease.range == New#lease.range) andalso
  -%    ({aux, {create, ParentId}} == New#lease.aux) andalso
  -    (1 == New#lease.version) andalso
  -    ({0,0,0} == New#lease.timeout).
  +    %% check with info in aux field (epoch from parent lease)
  +    %%    (Old#lease.epoch == New#lease.epoch) andalso
  +    (nil == New#lease.owner)
  +        andalso (1 == New#lease.version)
  +    %%    (Old#lease.range == New#lease.range) andalso
  +    %%    ({aux, {create, ParentId}} == New#lease.aux) andalso
  +        andalso ({0,0,0} == New#lease.timeout).
   
  -is_valid_renewal(Old, New) ->
  -    (Old#lease.id    == New#lease.id) andalso
  -    (Old#lease.epoch == New#lease.epoch) andalso
  -    (Old#lease.owner == New#lease.owner) andalso
  -    (Old#lease.range == New#lease.range) andalso
  -    (Old#lease.aux == New#lease.aux) andalso
  -    (Old#lease.version+1 == New#lease.version) andalso
  -    (Old#lease.timeout < New#lease.timeout) andalso
  -    (os:timestamp() <  New#lease.timeout).
  +-spec is_valid_renewal(lease_entry(), prbr:write_filter(), any()) ->
  +                              {boolean(), null}.
  +is_valid_renewal(Current, _WriteFilter, Next) ->
  +    standard_check(Current, Next)
  +    %% checks for debugging
  +        andalso (Current#lease.epoch == Next#lease.epoch)
  +        andalso (Current#lease.owner == (_Self = pid_groups:get_my(dht_node)))
  +        andalso (Current#lease.owner == Next#lease.owner)
  +        andalso (Current#lease.range == Next#lease.range)
  +        andalso (Current#lease.aux == Next#lease.aux)
  +        andalso (Current#lease.timeout < Next#lease.timeout)
  +        andalso (os:timestamp() <  Next#lease.timeout).
   
  -is_start_complex_op(_Old, _New) ->
  -    false.
  +-spec is_valid_handover(lease_entry(), prbr:write_filter(), any()) ->
  +                              {boolean(), null}.
  +is_valid_handover(Current, _WriteFilter, Next) ->
  +    standard_check(Current, Next)
  +    %% checks for debugging
  +        andalso (Current#lease.epoch+1 == Next#lease.epoch)
  +        andalso (Current#lease.owner == (_Self = pid_groups:get_my(dht_node)))
  +        andalso (Current#lease.owner =/= Next#lease.owner)
  +        andalso (Current#lease.range == Next#lease.range)
  +        andalso (Current#lease.aux == Next#lease.aux)
  +        andalso (Current#lease.timeout < Next#lease.timeout)
  +        andalso (os:timestamp() <  Next#lease.timeout).
   
  +standard_check(Current, Next) ->
  +    %% this serializes all operations on leases
  +    %% additional checks only for debugging the protocol and ensuring
  +    %% valid maintenance of the lease data structure and state machine
  +
  +    %% normal operation incs version
  +    ( ( (Current#lease.version+1 == Next#lease.version)
  +     andalso (Current#lease.epoch == Next#lease.epoch))
  +    %% reset version counter on epoch change
  +        orelse ((0 == Next#lease.version)
  +                andalso (Current#lease.epoch+1 == Next#lease.epoch))
  +    )
  +    %% debugging test
  +        andalso (Current#lease.id == Next#lease.id).
  +
  
positive.code:           timeout = ?required(lease, timeout) :: erlang_timestamp()}).
  -type lease_entry() :: #lease{}.
  
  %% -type ldb_entry() :: lease_entry().
  
  -spec read(lease_id()) -> api_tx:read_result().
  read(Key) ->
  
negative.code: -export([read/1]).
  -export([write/2]).
  
  -export([lease_renew/1]).
  -export([lease_handover/2]).
  
  %% filters and checks for rbr_cseq operations
  %% consistency
  -export([is_valid_state_change/3]).
  -export([is_valid_renewal/3]).
  -export([is_valid_handover/3]).
  
  -type lease_id() :: ?RT:key().
  -type lease_aux() ::
          any().
          %% | {aux, empty}
          %% %% split
          %% | {aux, jhsgjghs} %% 1. L1: 
          %%    | 
          %%    %% merge
  %%.
  
  -record(lease, {
            id      = ?required(lease, id     ) :: lease_id(),
  