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

Changed the handler returns to OrderInfoResponse & Added Signed Effects #130

Merged
merged 6 commits into from
Jan 9, 2022

Conversation

gdanezis
Copy link
Collaborator

@gdanezis gdanezis commented Jan 6, 2022

  • Now the order and certificate handlers in authority return an OrderInfoResponse struct, containing the signed order, certificate and signed effects.
  • A structure SignedOrderEffects binds the TransactionDigest with the mutated and deleted ObjectRefs. Since an ObjectRef contains the ObjectDigest a quorum of these could be used for light clients.
  • We also store the SignedOrderEffects to return them if a certificate is submitted again.
  • Ensure the handlers are idempotent.
  • Review the error return conditions from handlers.

Future PR / out of scope:

  • Review any additional info to return to help clients sync other lagging authorities (such as the parent TxDigests of Objects needed?).

Perf impact: bench 9100 tx/s -> 8500 tx/s.

pub mutated: Vec<ObjectRef>,
// Object Refs of objects now deleted (the old refs).
pub deleted: Vec<ObjectRef>,
// TODO: add events here too.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think gas used and status code would also make sense here (more details in #120)

Copy link
Collaborator Author

@gdanezis gdanezis Jan 7, 2022

Choose a reason for hiding this comment

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

Ok, I am now including a Result<(), FastPayError> returned by move_call or module_publish.

.certificates
.get(transaction_digest)
.map_err(|_| FastPayError::StorageError)?,
signed_effects: self
Copy link
Collaborator

Choose a reason for hiding this comment

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

Somewhat tangential, but I'm wondering how signed_orders and signed_effects work w.r.t state sync. The other components of AuthorityStore should be the same on every authority, but signed_orders and signed_effects are a bit odd in that they're inherently specific to the single authority providing the signature. So specifically:

  • Does a full node need to pick a particular authority to sync all of its signed_orders and signed_effects from? Or can it not serve queries that require reading from these stores?
  • Same question, but for a new authority joining the network

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that this depend on the degree of re-validation an authority that syncs wishes to perform.

  • At the extreme end it wants to re-validate everything: in this case the only set it syncs are the certificates, and then re-executes them all, therefore deriving the effects and objects on the way.
  • Somewhere in the middle and authority wants to trust a quorum but not re-execute. In this case it downloads the effects from f+1 authorities, and if they agree it just applies them. This ensures that one authority at least was honest.
  • At the lower end of assurance an authority can just pick a random set of other authorities (sample 3-5 by stake) and apply the effects that all agree on.
  • Then finally an authority can fully trust another authority: and just copy the effects.

Thinking about it: is there a reason to sync the full history of effects? I guess only to serve authenticated reads on the events down the line when we have them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PS: SignedOrder may be different between authorities, but SignedEffects should not be (if processing is determnistic), besides the signature being from a different authority.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess only to serve authenticated reads on the events down the line when we have them?

Yes, authenticated reads of both events and other order effects (e.g., "did this order create object O"?)

PS: SignedOrder may be different between authorities, but SignedEffects should not be (if processing is determnistic), besides the signature being from a different authority.

Ah, interesting... Is SignedOrder only different (besides name/signature) between authorities when a client equivocates?

Copy link
Contributor

@huitseeker huitseeker Jan 9, 2022

Choose a reason for hiding this comment

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

Without at minimum arguing that some actors in the system (which may be authorities, or "fishermen" incentivized for this explicit purpose) download both certificates & effects, re-validate everything, and are able to submit a fraud proof when they disagree with the effects they receive, can we argue that the execution of orders in FastNFT has any sort of computational integrity?

Note: the standard I'm suggesting above is the weakest available, that of optimistic rollups. I don't suggest we adopt it.

@gdanezis gdanezis force-pushed the fix-handle-returns branch from d8f318f to 4af6f46 Compare January 7, 2022 15:28
@gdanezis gdanezis marked this pull request as ready for review January 7, 2022 15:46
@gdanezis gdanezis force-pushed the fix-handle-returns branch from e63b644 to b429486 Compare January 7, 2022 19:13
@gdanezis gdanezis changed the title Changed the handler returns to OrderInfo & Added Signed Effects Changed the handler returns to OrderInfoResponse & Added Signed Effects Jan 7, 2022
@oxade
Copy link
Contributor

oxade commented Jan 8, 2022

@huitseeker Any feedback on this PR?
Hoping to merge it soon to unblock some client changes for multi-object orders and Move calls.

Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

The code LGTM. The question of SignedOrderEffects being part of state sync deserves a separate discussion, but as Sam mentioned, it's tangential to the point of this PR.

@gdanezis
Copy link
Collaborator Author

gdanezis commented Jan 9, 2022

Ok merging!

@gdanezis gdanezis merged commit 9e6a9bc into main Jan 9, 2022
@gdanezis gdanezis deleted the fix-handle-returns branch January 9, 2022 15:49
mwtian pushed a commit that referenced this pull request Sep 12, 2022
Subscriber client
mwtian pushed a commit to mwtian/sui that referenced this pull request Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants