anchor.diff:      test_renew_helper(_Config, ModifyF, WaitF),
       true.
   
  -
  -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  -%
  -% helper
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +%
  +% split unit tests
  +%
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +test_split(_Config) ->
  +    NullF = fun (_Id, _Lease) -> ok end,
  +    WaitLeftLeaseF = fun (Id, Lease) ->
  +                              OldEpoch   = l_on_cseq:get_epoch(Lease),
  +                              wait_for_lease_version(Id, OldEpoch+2, 0)
  +                     end,
  +    WaitRightLeaseF = fun (Id) ->
  +                             wait_for_lease_version(Id, 2, 0)
  +                      end,
  +    test_split_helper_for_4_steps(_Config,
  +                                  NullF, NullF,NullF, NullF,
  +                                  WaitLeftLeaseF, WaitRightLeaseF),
  +    true.
  +
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +%
  +% split helper
  +%
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +test_split_helper_for_4_steps(_Config,
  +                              ModifyBeforeStep1, ModifyBeforeStep2,
  +                              ModifyBeforeStep3, ModifyBeforeStep4,
  +                              WaitLeftLease, WaitRightLease) ->
  +    % intercept lease renew
  +    %{l_on_cseq, renew, Old} = intercept_lease_renew(),
  +    %Id = l_on_cseq:get_id(Old),
  +    % prepeare split
  +    DHTNode = pid_groups:find_a(dht_node),
  +    pid_groups:join(pid_groups:group_with(dht_node)),
  +    comm:send_local(DHTNode, {get_state, comm:this(), lease_list}),
  +    L = receive
  +                 {get_state_response, List} ->
  +                     hd(List)
  +             end,
  +    Range = l_on_cseq:get_range(L),
  +    [R1, R2] = intervals:split(Range, 2),
  +    LeftId = id(R1),
  +    RightId = id(R2),
  +    %ct:pal("~p", [[R1, R2]]),
  +    %ct:pal("~p", [[LeftId, RightId, Id]]),
  +    intercept_split_request(),                                   % install intercepts
  +    intercept_split_reply(split_reply_step1),                    %
  +    intercept_split_reply(split_reply_step2),                    %
  +    intercept_split_reply(split_reply_step3),                    %
  +
  +    %ct:pal("start with step1"),
  +    %
  +    % step1
  +    %
  +    l_on_cseq:lease_split(L, R1, R2),                            % trigger step
  +    StartMsg = receive                                           % intercept msg
  +                   M = {l_on_cseq, split, _, _, _} ->
  +                       M
  +               end,
  +    {l_on_cseq, split, Lease, _R1, _R2} = StartMsg,
  +    ModifyBeforeStep1(RightId, Lease),                           % modify world
  +    gen_component:bp_del(DHTNode, block_split_request),
  +    comm:send_local(DHTNode, StartMsg),                          % release msg
  +    % step2
  +    split_helper_do_step(split_reply_step1, ModifyBeforeStep2, LeftId),
  +    % step3
  +    split_helper_do_step(split_reply_step2, ModifyBeforeStep3, RightId),
  +    % step4
  +    split_helper_do_step(split_reply_step3, ModifyBeforeStep4, LeftId),
  +    % wait for result
  +    %ct:pal("wait left"),
  +    WaitLeftLease(LeftId, L),
  +    %ct:pal("wait right"),
  +    WaitRightLease(RightId).
  +
  +split_helper_do_step(StepTag, ModifyBeforeStep, Id) ->
  +    %ct:pal("doing ~p", [StepTag]),
  +    DHTNode = pid_groups:find_a(dht_node),
  +    ReplyMsg = receive
  +                   M = {l_on_cseq, StepTag, Lease, _R1, _R2, _Resp} ->
  +                       M
  +               end,
  +    ModifyBeforeStep(Id, Lease),
  +    gen_component:bp_del(DHTNode, StepTag),
  +    comm:send_local(DHTNode, ReplyMsg).
  +
  +
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +%
  +% renew helper
   %
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
  
positive.code:                     false
              end
      end.
  
negative.code: % intercepting and blocking
  %
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  intercept_split_request() ->
      DHTNode = pid_groups:find_a(dht_node),
      % we wait for the next periodic trigger
      gen_component:bp_set_cond(DHTNode, block_split_request(self()), block_split_request).
  
  intercept_split_reply(StepTag) ->
      DHTNode = pid_groups:find_a(dht_node),
      % we wait for the next periodic trigger
      gen_component:bp_set_cond(DHTNode, block_split_reply(self(), StepTag), StepTag).
  
  intercept_lease_renew() ->
      DHTNode = pid_groups:find_a(dht_node),
  