Skip to content

Commit

Permalink
Merge #2936
Browse files Browse the repository at this point in the history
2936: [BFT Testing] Corrupting ingress traffic (part-3, process ingress message) r=gomisha a=gomisha

This PR:
- connects all the ingress traffic mechanism to the Corrupt Network, Attack Orchestrator, Orchestrator Network, Message Processor
- updates and standardizes testing framework component names
- does NOT cover adding new unit tests for ingress traffic - that will be done in the next PR (part 4).

Details:
- added `HandleIngressEvent()` to `insecure.AttackOrchestrator` interface
- added `SendIngress()` to `orchestrator.OrchestratorNetwork` interface
- updated implementation for `HandleIncomingEvent()` for `insecure.IngressController` to return `bool` depending on whether attacker is registered with the corrupted network
- renamed `WithAttacker()` to `Register()` in `AttackOrchestrator` interface
- updated dummy and Wintermute orchestrators to panic on ingress messages (needs implementation and testing that will be done in separate PR)
- renamed `attacknetwork` package to `orchestrator`
- renamed `attacknetwork.AttackNetwork` to `orchestrator.OrchestratorNetwork` which implements `insecure.OrchestratorNetwork` interface
- changed all references from `attack network` / `attackNetwork` to `orchestrator network` / `orchestratorNetwork`
- changed many (not all) references from `attacker` to `attack orchestrator`
- changed many (not all) references from `corrupted` / `corruptible` to `corrupt`

Co-authored-by: Yahya <yahya@dapperlabs.com>
Co-authored-by: Yahya <yhassanzadeh13@ku.edu.tr>
  • Loading branch information
3 people authored Aug 23, 2022
2 parents ef8531b + 23ae842 commit 395422b
Show file tree
Hide file tree
Showing 42 changed files with 946 additions and 1,010 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/flaky-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,26 @@ env:
GO_VERSION: 1.18

jobs:
unit-test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Run tests
if: github.actor != 'bors[bot]'
run: make ci
integration-test:
name: Integration Tests
strategy:
fail-fast: false
matrix:
test-category:
- integration-epochs
- integration-bft
env:
TEST_CATEGORY: ${{ matrix.test-category }}
runs-on: ubuntu-latest
Expand Down
17 changes: 0 additions & 17 deletions insecure/attackNetwork.go

This file was deleted.

13 changes: 0 additions & 13 deletions insecure/attackOrchestrator.go

This file was deleted.

18 changes: 18 additions & 0 deletions insecure/attack_orchestrator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package insecure

// AttackOrchestrator represents the stateful interface that implements a certain type of attack, e.g., wintermute attack.
type AttackOrchestrator interface {
// HandleEgressEvent implements logic of processing the outgoing events received from a corrupted node.
// Corrupted nodes relay all their outgoing events to the orchestrator instead of dispatching them to the network.
//
// Note: as a design assumption, this method is invoked sequentially by the OrchestratorNetwork to pass the
// events of corrupted nodes. Hence, no extra concurrency-safe consideration is needed.
HandleEgressEvent(*EgressEvent) error

Register(OrchestratorNetwork)

// HandleIngressEvent implements the logic of processing an incoming event to a corrupted node.
// Note: as a design assumption, this method is invoked sequentially by the OrchestratorNetwork to pass the
// events of corrupted nodes. Hence, no extra concurrency-safe consideration is needed.
HandleIngressEvent(*IngressEvent) error
}
79 changes: 41 additions & 38 deletions insecure/attacker.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions insecure/attacker.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,26 @@ message Message {
IngressMessage Ingress = 2;
}

// EgressMessage represents the message exchanged between the CorruptibleConduitFactory and Attacker services.
// EgressMessage represents an outgoing message from a corrupt node to another (honest or corrupt) node.
// The exchanged message is between the CorruptibleConduitFactory and Attacker services.
message EgressMessage {
string ChannelID = 1;
bytes OriginID = 2;

// CorruptOriginID represents the corrupt node id where the outgoing message is coming from.
bytes CorruptOriginID = 2;
uint32 TargetNum = 3;
repeated bytes TargetIDs = 4;
bytes Payload = 5;
Protocol protocol = 6;
}

// OriginID for IngressMessage represents the node id where the message is coming from - that node could be corrupted or honest.
// IngressMessage represents an incoming message from another node (honest or corrupt) to a corrupt node.
message IngressMessage {
string ChannelID = 1;

// OriginID represents the node id where the incoming message is coming from - that node could be corrupt or honest.
bytes OriginID = 2;
bytes TargetID = 3;
bytes CorruptTargetID = 3;
bytes Payload = 4;
}

Expand Down
Loading

0 comments on commit 395422b

Please sign in to comment.