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

[fastpath] support locking transactions and returning effects without signatures #20128

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

mwtian
Copy link
Member

@mwtian mwtian commented Oct 31, 2024

Description

  • Allow locking transactions without getting back a signed transaction.
  • Allow getting back unsigned effects for previously executed transactions.
  • Add basic types to support using finalized effects without aggregated effects sigs.
  • Handle ConsensusTransactionKind::UserTransaction in callsites that already handle ConsensusTransactionKind::CertifiedTransaction.
  • Support reconfiguring components other than QuorumDriver, in reconfig observers.
  • Remove some unused code.

Test plan

CI


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

@mwtian mwtian requested review from a team and mystenmark as code owners October 31, 2024 23:41
Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2024 6:49pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 7, 2024 6:49pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 7, 2024 6:49pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Nov 7, 2024 6:49pm

@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env November 1, 2024 00:07 — with GitHub Actions Inactive
@mwtian mwtian removed the request for review from a team November 1, 2024 00:07
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env November 1, 2024 00:10 — with GitHub Actions Inactive
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env November 1, 2024 01:13 — with GitHub Actions Inactive
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env November 1, 2024 01:44 — with GitHub Actions Inactive
@mwtian mwtian changed the title [fastpath] supporting locking transactions and returning effects without signatures [fastpath] support locking transactions and returning effects without signatures Nov 1, 2024
return Err(SuiError::UnexpectedMessage(
"ConsensusTransactionKind::UserTransaction is unsupported".to_string(),
)
.into());
}
// TODO(fastpath): implement verification for uncertified user transactions.
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this todo no longer required? Is it because we verify when we vote?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I was thinking the verifications in vote_transactions() make this TODO obsolete. But it may be better to still keep track of the TODO to move those checks here.

@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env November 1, 2024 04:27 — with GitHub Actions Inactive
Copy link
Contributor

@akichidis akichidis left a comment

Choose a reason for hiding this comment

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

I am good to approved but let's catch up regarding the QuorumExecuted changes , would like to make sure I understand this correctly

@@ -1062,7 +1079,7 @@ impl AuthorityState {

pub(crate) fn check_system_overload(
&self,
consensus_adapter: &Arc<ConsensusAdapter>,
consensus_overload_checker: &(impl ConsensusOverloadChecker + ?Sized),
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that is legit, but why not an Arc<dyn ConsensusOverloadChecker> ?

Copy link
Member Author

Choose a reason for hiding this comment

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

That will require a clone of the Arc<> at the callsite, which seems unnecessary. Also &Arc<dyn ConsensusOverloadChecker> does not work which is my initial attempt.

transaction_digest: &TransactionDigest,
) -> SuiResult<Option<(TransactionEffects, TransactionEvents)>> {
let effects = self
.get_transaction_cache_reader()
Copy link
Contributor

Choose a reason for hiding this comment

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

Haven't followed the cache work semantics, but my understanding is that it will guarantee to check in storage if data are not in cache, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

As clarified by @mystenmark, yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, apologies, that was a comment that I put yesterday before our discussion. All good.

@@ -781,7 +773,7 @@ impl ValidatorService {
ConsensusTransactionKind::CertifiedTransaction(tx) => {
tx.contains_shared_object()
}
ConsensusTransactionKind::UserTransaction(_) => true,
ConsensusTransactionKind::UserTransaction(tx) => tx.contains_shared_object(),
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to have for the UserTransaction without a shared obj a separate metric I guess?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah this metric is not too useful so far. For what it is measuring, maybe removing all the conditional is better.

crates/sui-core/src/consensus_adapter.rs Show resolved Hide resolved
crates/sui-core/src/consensus_handler.rs Outdated Show resolved Hide resolved
consensus/core/src/transaction.rs Show resolved Hide resolved
async fn run(&mut self, quorum_driver: Arc<QuorumDriver<NetworkAuthorityClient>>) {
async fn run(
&mut self,
updatable: Arc<dyn AuthorityAggregatorUpdatable<NetworkAuthorityClient>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the updatable is a bit generic. Why not just authority_aggregator?

Copy link
Member Author

Choose a reason for hiding this comment

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

This value is not authority_aggregator itself, but a value that supports updating its underneath authority_aggregator, including QuorumDriver and TransactionDriver later. Renamed this to driver.

Comment on lines +760 to +768
if let Some(signed_transaction) = signed_transaction {
batch.insert_batch(
&self.signed_transactions,
std::iter::once((
*signed_transaction.digest(),
signed_transaction.serializable_ref(),
)),
)?;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is my understanding correct that we'll no longer need for fastpath the signed_transactions anyways since we do not individually sign the transactions anymore? Looking on the read path this is mostly being used to tell via our APIs whether the transaction has been signed or not. Not sure if those APIs will be used in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

Transactions will not be signed with BLS any more. But if there are use cases for handle_transaction_info_request() other than getting effects, we will have to figure out ways to migrate the existing users. I will leave a TODO over that API.

Comment on lines -150 to -158
pub struct VerifiedExecuteTransactionResponseV3 {
pub effects: VerifiedCertifiedTransactionEffects,
pub events: Option<TransactionEvents>,
// Input objects will only be populated in the happy path
pub input_objects: Option<Vec<Object>>,
// Output objects will only be populated in the happy path
pub output_objects: Option<Vec<Object>>,
pub auxiliary_data: Option<Vec<u8>>,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is dead code but is it ok to remove?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since there is no reference to this type else where, it should be safe to remove.

@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env November 7, 2024 18:47 — with GitHub Actions Inactive
@mwtian mwtian enabled auto-merge (squash) November 7, 2024 18:48
@mwtian mwtian merged commit d7b6639 into main Nov 7, 2024
52 checks passed
@mwtian mwtian deleted the tmw/fastpath-lock branch November 7, 2024 19:16
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