Skip to content

feat: state transition conversion - #844

Merged
QuantumExplorer merged 38 commits into
v0.24-devfrom
feat/stateTransitionConversion
Mar 29, 2023
Merged

QuantumExplorer merged 38 commits into
v0.24-devfrom
feat/stateTransitionConversion

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Mar 22, 2023 •

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

What was done?

This PR contains a lot of changes needed for Rs-Drive-Abci to work as the executor.

How Has This Been Tested?

CI passing.

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@QuantumExplorer
QuantumExplorer marked this pull request as ready for review March 29, 2023 06:30
use crate::data_contract::DataContract;
use serde::{Deserialize, Serialize};

pub const DATA_CONTRACT_UPDATE_TRANSITION_ACTION_VERSION: u32 = 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do you need version?

if maybe_existing_data_contract.is_none()
|| state_transition.get_execution_context().is_dry_run()
{
let action: DataContractCreateTransitionAction = state_transition.into();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't a mistake?

@@ -65,7 +67,8 @@ pub async fn validate_data_contract_update_transition_state(
.map_err(Into::into)?;

if state_transition.execution_context.is_dry_run() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All other validation functions now return actions? Doesn't the validation function should only validate?

@shumkov
shumkov dismissed their stale review March 29, 2023 13:07

I still do not agree with having validate state function which creates action

@antouhou antouhou left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So we have a very long discussion about whether the function that validates state transition against the state should or shouldn't return a TransitionAction as a result, or should it just return the errors and the conversion from state transition into action should be a separate step that's done after the validation. I was a proponent of the idea that it should be two separate steps, and @QuantumExplorer was a proponent of the idea that it should be one step and the conversion of the ST into action should happen inside the validation function. We couldn't agree on that, so we added three more people to the discussion: @shumkov, @fominok, and @shotonoff. At the end of the discussion, we had a vote with three people out of five who voted that the validation function should perform a conversion of the StateTransition into an Action. So we are going ahead and merging this PR as is. I want also to set up a precedent for the governing of the architectural decisions with this one: although the solution I've proposed has lost the vote, I have no hard feelings about it, and should a disagreement on any other topic arise we should follow the same decision-making protocol, and I expect anybody who lost the consensus vote on a topic to do the same thing as I did :) Thank you, guys!

@QuantumExplorer
QuantumExplorer merged commit 28b60ad into v0.24-dev Mar 29, 2023
@QuantumExplorer
QuantumExplorer deleted the feat/stateTransitionConversion branch March 29, 2023 13:27
@shumkov

shumkov commented Mar 29, 2023 •

Copy link
Copy Markdown
Collaborator

For the future, I would propose to have ADR for design changes so people don't feel pressure because the code is already written and not having it merged blocks other tasks.

QuantumExplorer added a commit that referenced this pull request Aug 31, 2026
…mit lifting

Rework on grovedb 33a3ad34 (#844/#845): the limited inner page and the
derived outer by-ids fetch are now proven as a SINGLE merged grovedb
proof — prove_query_many merges them, with the inner query's global
limit lifted into its branch's per-instance Query::limit (exact: the
branch executes once). One proof means one root by construction, so
the two-proof envelope, the verifier's root-equality check, and the
Option<outer_proof> shape are gone.

Verification becomes one pass: the caller supplies the server's
CLAIMED join values as an untrusted bootstrap hint, the verifier
re-derives the outer component from it, re-merges at the same grove
version, and runs GroveDb::verify_query — grovedb enforces the lifted
instance cap and range completeness, and the exact-set assembly
against the PROVEN join values refuses any hint lie (dropped,
injected, or substituted ids all covered by tests).

The root-hash bracket survives in a smaller role: materialize and
prove must read the same committed state or the proof's own branches
disagree; the failure is now server-side only.

ChainedProofBundle is gone; the with-proof surfaces return the merged
proof bytes. proof_path_queries is the ONE component builder both
prover and verifier call, so the merged query is byte-identical on
both sides.

Co-Authored-By: Claude Fable 5 <[email protected]>
QuantumExplorer added a commit that referenced this pull request Aug 31, 2026
…mit lifting

Rework on grovedb 33a3ad34 (#844/#845): the limited inner page and the
derived outer by-ids fetch are now proven as a SINGLE merged grovedb
proof — prove_query_many merges them, with the inner query's global
limit lifted into its branch's per-instance Query::limit (exact: the
branch executes once). One proof means one root by construction, so
the two-proof envelope, the verifier's root-equality check, and the
Option<outer_proof> shape are gone.

Verification becomes one pass: the caller supplies the server's
CLAIMED join values as an untrusted bootstrap hint, the verifier
re-derives the outer component from it, re-merges at the same grove
version, and runs GroveDb::verify_query — grovedb enforces the lifted
instance cap and range completeness, and the exact-set assembly
against the PROVEN join values refuses any hint lie (dropped,
injected, or substituted ids all covered by tests).

The root-hash bracket survives in a smaller role: materialize and
prove must read the same committed state or the proof's own branches
disagree; the failure is now server-side only.

ChainedProofBundle is gone; the with-proof surfaces return the merged
proof bytes. proof_path_queries is the ONE component builder both
prover and verifier call, so the merged query is byte-identical on
both sides.

Co-Authored-By: Claude Fable 5 <[email protected]>
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.

4 participants