Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fix consensus ordering for cross-chains #275
Fix consensus ordering for cross-chains #275
Changes from all commits
0f4db24
4d4078a
5ff9821
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 337 in src/vm/contract.rs
Codecov / codecov/patch
src/vm/contract.rs#L335-L337
Check warning on line 376 in src/vm/contract.rs
Codecov / codecov/patch
src/vm/contract.rs#L375-L376
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here #117 you said:
but this code isn't doing this, is the code incomplete or the documentation old? To me it seems a rule we should keep, to allow ordering of TXs in the same block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not get: the code is exactly compares the block height, i.e. is doing what is said
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it seems it's comparing just the block height, not the position of the TX in the block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see now.
#117 is outdated. In reality it happened that it is impossible to use position in the block since it is hard to compute from indexer's data. So instead we have started using
opid
value, which can be seen from theOpOrd
structure (the ultimate operation ordering) below in this file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain how the
OpId
helps ordering TXs mined in the same block? From what I see theOpId
is the commitment hash of the RGB operation, it seems unrelated to the mining status of the TX.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to order operations, not transactions. We just utilize anchors and witness transaction to order operations, but we are not locked to just transaction information.
Since witness transactions may contain multiple operations (two anchors, a bundle per anchor, multiple state transitions per bundle, plus arbitrary large number of state extensions) txid or inside-block ordering won't help anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still I don't understand how the
OpId
should allow a meaningful ordering of operations, since its just a hash. Could you please clarify this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opid is just one of the factors of ordering. You asked "why we do not account for block position of witness transaction" and the answer here is "we do not need it".
Consensus ordering of operations takes many factors (listed in their priority):
1-2 are related to witness transactions, and 3-5 to operations themselves. Normally you use nonce (which we discussed a lot with you!) to do definite ordering within the same block! But if you misused nonce and gave two different state transition the same one, then (and only then!) opid comes into play. Yes, this is not a meaningful, but at least deterministic. For meaningful ordering one must use nonce properly.
Check warning on line 380 in src/vm/contract.rs
Codecov / codecov/patch
src/vm/contract.rs#L378-L380
Check warning on line 385 in src/vm/contract.rs
Codecov / codecov/patch
src/vm/contract.rs#L383-L385
Check warning on line 387 in src/vm/contract.rs
Codecov / codecov/patch
src/vm/contract.rs#L387
Check warning on line 389 in src/vm/contract.rs
Codecov / codecov/patch
src/vm/contract.rs#L389
Check warning on line 397 in src/vm/contract.rs
Codecov / codecov/patch
src/vm/contract.rs#L393-L397