Functionally test new Requesting/Request/Response pattern introduced in MAID-3282

Description

Note that PackedEvent has constructors available now to help create invalid/malicious events.

When failures happen in tests below, check accusations are raised with the appropriate invalid event packed in them, and that the invalid events aren't added to graphs.

Invalid/Duplicate Request

Wrong recipient

  1. Alice construct Requesting(Carol) via Parsec::create_gossip(Carol) -> msg.

  2. Call Bob handle_request(msg) - Bob should not create a Response event.

  3. Bob construct invalid packed Request via PackedEvent::new_request() with this Requesting as other parent.

  4. Call Alice unpack_and_add_events(vec![Bob's Request]) - should fail.

  5. Call Dave unpack_and_add_events(vec![Alice's Requesting, Bob's Request]) - should fail.

Wrong type of other-parent

  1. Alice construct Requesting(Bob) via Parsec::create_gossip(Bob).

  2. Bob construct invalid packed Request with Alice's 2nd last event as other parent (ensure it's not a Requesting(Bob)).

  3. Call Alice unpack_and_add_events(vec![Bob's Request]) - should fail.

  4. Call Carol unpack_and_add_events(vec![Alice's Requesting, Bob's Request]) - should fail.

Duplicate Request

  1. Alice construct Requesting(Bob) via Parsec::create_gossip(Bob) -> msg.

  2. Bob construct valid Request via Parsec::handle_request(msg).

  3. Bob construct invalid packed Request via PackedEvent::new_request() with Alice's already-answered Requesting as other parent.

  4. Call Alice unpack_and_add_events(vec![Bob's Request1, Bob's Request2]) - Request2 should fail.

  5. Call Carol unpack_and_add_events(vec![Alice's Requesting, Bob's Request1, Bob's Request2]) - Request2 should fail.

Invalid/Duplicate Response

Wrong recipient

  1. Alice construct Requesting(Bob) via Parsec::create_gossip(Bob) -> msg.

  2. Bob construct valid Request via Parsec::handle_request(msg) -> msg.

  3. Call Carol handle_response(msg) - Carol should not create a Response event.

  4. Carol construct invalid packed Response via PackedEvent::new_response() with this Request as other parent.

  5. Call Bob unpack_and_add_events(vec![Carol's Response]) - should fail.

  6. Call Dave unpack_and_add_events(vec![Alice's Requesting, Bob's Request, Carol's Response]) - should fail.

Wrong type of other-parent

  1. Alice construct Requesting(Bob) via Parsec::create_gossip(Bob) -> msg.

  2. Bob construct valid Request via Parsec::handle_request(msg) -> msg.

  3. Alice construct invalid packed Response with Bob's 2nd last event as other parent.

  4. Call Bob unpack_and_add_events(vec![Alice's Response]) - should fail.

  5. Call Carol unpack_and_add_events(vec![Alice's Requesting, Bob's Request, Alice's Response]) - should fail.

Duplicate Response

  1. Alice construct Requesting(Bob) via Parsec::create_gossip(Bob) -> msg.

  2. Bob construct valid Request via Parsec::handle_request(msg) -> msg.

  3. Alice construct valid Response via Parsec::handle_response(msg).

  4. Alice construct invalid packed Response via PackedEvent::new_response() with Bob's already-answered Request as other parent.

  5. Call Bob unpack_and_add_events(vec![Alice's Response1, Alice's Response2]) - Response2 should fail.
    1. Call Carol unpack_and_add_events(vec![Alice's Requesting, Bob's Request, Alice's Response1, Alice's Response2]) - Response2 should fail.

Environment

None

Status

Assignee

Fraser Hutchison

Reporter

Pierre Chevalier

Labels

External issue URL

None

External issue ID

None

Start date

2019/03/26

End date

2019/03/26

Task progress

None

Baseline start date

None

Baseline end date

None

Story Points

6

Components

Priority

Major
Configure