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

Initial support for parallel Soroban phase XDR. #4364

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

dmkozh
Copy link
Contributor

@dmkozh dmkozh commented Jun 26, 2024

Description

I've tried to minimize the scope of the changes; specifically this doesn't contain any actual logic for the parallel execution (such as data dependency validation and building parallel stages). However, there is still some refactoring that needed to happen in order to support new, more complex tx sets.

I've also removed some legacy surge pricing logic and the corresponding tests - we should no longer need the surge pricing logic that covers more than one source account per tx set.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@dmkozh dmkozh force-pushed the parallel_txset2 branch from 073814b to 1ca680d Compare June 26, 2024 16:41
Copy link
Contributor

@sisuresh sisuresh left a comment

Choose a reason for hiding this comment

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

Just an initial review

@marta-lokhova marta-lokhova self-requested a review June 28, 2024 23:23
Copy link
Contributor

@marta-lokhova marta-lokhova left a comment

Choose a reason for hiding this comment

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

Thanks, parallel application of Soroban txs is exciting! I did an initial preliminary review. My main question is around scope and motivation:

  • It's a bit hard to imagine how the refactored tx set is going to be used, because ledger close logic isn't wired up yet. As a result, I can't tell if the access/usage patterns are right in the context of multi-threading. Is there a reason to introduce apply-order changes before parallel application?
  • (related) can you clarify the scope of this PR? if it's just refactoring tx set to be more general, then it'd be easier to make TxSetFrame more generalized internally, but continue exposing old API to make it easy for consumers. Changes to application order should probably be an isolated protocol change. This should help ship this work incrementally.
  • There are some changes that I think should be factored out into a separate PR (surge pricing, test cleanup). There is no reason to block those changes on tx set refactor.

@marta-lokhova
Copy link
Contributor

(I should mention that this is my first time tapping into soroban parallelization work, so please bear with me if I'm missing context)

@dmkozh
Copy link
Contributor Author

dmkozh commented Jul 10, 2024

It's a bit hard to imagine how the refactored tx set is going to be used, because ledger close logic isn't wired up yet. As a result, I can't tell if the access/usage patterns are right in the context of multi-threading. Is there a reason to introduce apply-order changes before parallel application?

This PR actually has to go first, because we can't properly wire up the parallel application logic if we don't have a proper schedule to use. FWIW there is no multi-threading here at all; the only meaningful interface change is that we'll expose the 'parallel' application schedule from the respective phase (instead of a transaction sequence). I probably mentioned this elsewhere, but to be clear we have to build a tx set in a proper fashion in order to be able to apply it in parallel (specifically we need to run the transactions with data dependencies in the same thread or different stages).

(related) can you clarify the scope of this PR? if it's just refactoring tx set to be more general, then it'd be easier to make TxSetFrame more generalized internally, but continue exposing old API to make it easy for consumers. Changes to application order should probably be an isolated protocol change. This should help ship this work incrementally.

The idea here is to provide support for a new phase type in the TxSetFrame; I've tried to limit the API changes as much as possible and basically the main change is that instead of exposing all the transactions at once we expose the phases separately (that just required an additional loop in a few places).

I realize that some stuff could be moved to separate PRs; I'll at least move all the surge-pricing related stuff. That said, I'm not sure the interface changes would make much sense without at least the stub for supporting the new XDR (otherwise it's hard to tell what's the motivation of the changes and whether they look reasonable). I could try separating that as well, but I'm not sure it will help reviewing the design decisions.

@dmkozh dmkozh force-pushed the parallel_txset2 branch 4 times, most recently from f38272f to fcf19f2 Compare August 9, 2024 15:17
Copy link
Contributor Author

@dmkozh dmkozh left a comment

Choose a reason for hiding this comment

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

I've rebased and updated the PR. There is no rush to merge it into the minor release, so I suppose it'll need to wait more.

@dmkozh dmkozh force-pushed the parallel_txset2 branch 3 times, most recently from ac3b7db to 93c9541 Compare September 18, 2024 17:41
@dmkozh dmkozh force-pushed the parallel_txset2 branch 4 times, most recently from 8bd3d36 to b930f32 Compare November 6, 2024 22:34
@dmkozh
Copy link
Contributor Author

dmkozh commented Nov 7, 2024

This PR should be rebased on top of the most recent changes, including the tx set nomination tests that should add some confidence in the refactoring.

@dmkozh dmkozh force-pushed the parallel_txset2 branch 3 times, most recently from 8ce0064 to 6afbc17 Compare November 27, 2024 19:30
@sisuresh
Copy link
Contributor

Do you have a testcase that pushes a vnext valid parallel tx set in v22?

@dmkozh
Copy link
Contributor Author

dmkozh commented Dec 13, 2024

Do you have a testcase that pushes a vnext valid parallel tx set in v22?

Parallel tx sets are not supported in v22, but if you meant v23, there are several tests covering it: generalized tx set XDR conversion for basic XDR conversion, generalized tx set fees for the basic nomination, tx_set/v_next.csv changes for randomized nomination tests (that demonstrate that only structure changes, but not the overall contents).

@sisuresh
Copy link
Contributor

Do you have a testcase that pushes a vnext valid parallel tx set in v22?

Parallel tx sets are not supported in v22, but if you meant v23, there are several tests covering it: generalized tx set XDR conversion for basic XDR conversion, generalized tx set fees for the basic nomination, tx_set/v_next.csv changes for randomized nomination tests (that demonstrate that only structure changes, but not the overall contents).

Once we deploy a version with v23 xdr, but before the v23 protocol upgrade, it'll be possible to receive a parallel tx set over the wire that we should toss right? That's the scenario I'm referring to.

@dmkozh
Copy link
Contributor Author

dmkozh commented Dec 13, 2024

Once we deploy a version with v23 xdr, but before the v23 protocol upgrade, it'll be possible to receive a parallel tx set over the wire that we should toss right? That's the scenario I'm referring to.

Yeah, good catch, I've added a test that verifies the phase format<->protocol version correspondence.

@dmkozh dmkozh force-pushed the parallel_txset2 branch 2 times, most recently from 053aa57 to 7ec454d Compare December 18, 2024 19:29
marta-lokhova
marta-lokhova previously approved these changes Dec 24, 2024
Copy link
Contributor

@marta-lokhova marta-lokhova left a comment

Choose a reason for hiding this comment

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

lgtm! I've resolved all my comments

@dmkozh dmkozh force-pushed the parallel_txset2 branch 3 times, most recently from 1282509 to bda218d Compare January 7, 2025 00:37
sisuresh
sisuresh previously approved these changes Jan 7, 2025
@dmkozh dmkozh enabled auto-merge January 7, 2025 00:45
I've tried to minimize the scope of the changes; specifically this doesn't contain any actual logic for the parallel execution (such as data dependency validation and building parallel stages). However, there is still some refactoring that needed to happen in order to support new, more complex tx sets.
@dmkozh dmkozh added this pull request to the merge queue Jan 7, 2025
Merged via the queue into stellar:master with commit d89edf1 Jan 7, 2025
13 checks passed
@dmkozh dmkozh deleted the parallel_txset2 branch January 7, 2025 18:38
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