Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a IsIncomingP2PEnabled Flag #1491

Merged
merged 10 commits into from
Sep 5, 2023
Merged

Add a IsIncomingP2PEnabled Flag #1491

merged 10 commits into from
Sep 5, 2023

Conversation

otherview
Copy link
Contributor

@otherview otherview commented Aug 31, 2023

Why this change is needed

https://github.com/obscuronet/obscuro-internal/issues/2103

To test the system with p2p down.

What changes were made as part of this PR

  • Adds an IsIncomingP2PEnabled
  • Sets one node disabled in both sims
  • Adds an NoIncomingP2P implementation of P2P
  • Fixed a bug where failing to send batches to a host would delay the whole processing of the sequencer

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good in principle.
A couple of questions.

go/enclave/events/subscription_manager.go Outdated Show resolved Hide resolved
go/host/enclave/guardian.go Outdated Show resolved Hide resolved
for _, address := range currentAddresses {
wg.Add(1)
go p.sendBytesWithRetry(&wg, address, msgEncoded) //nolint: errcheck
closureAddr := address
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was the purpose of the WaitGroup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it was to issue the payload to all nodes in parallel and wait until the whole broadcast was finished.
With a 2 min retry and one node with p2p off, this had a weird effect on the sequencer which would not update the host db in proper time.

When running the sim with this code, all nodes (host db) have height ~80 but the sequencer (host db) stays at high ~60

gethlog "github.com/ethereum/go-ethereum/log"
)

type NoInboundP2P struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how much of this is duplicated compared to the normal implementation?
If a lot, then it would make sense to initialise that with a flag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like using a flag, did that in the p2p in-memory; was keeping them separate to make sure I wasn't introducing any bugs in the existing p2p.

I'll push all under a flag tomorrow 👍

Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@otherview otherview merged commit 1978e19 into main Sep 5, 2023
2 checks passed
@otherview otherview deleted the pedro/p2p_disabled_flag branch September 5, 2023 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants