This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Statement store #13701
Merged
Merged
Statement store #13701
Changes from 1 commit
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
729e524
WIP Statement store
arkpar 7591d22
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar ff1edaa
Sync with networking changes in master
arkpar 8407e40
WIP statement pallet
arkpar 21c9aaf
Statement validation
arkpar c706097
pallet tests
arkpar e066abe
Validation queue
arkpar bfbbc5b
Store maintenance
arkpar d36a867
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar d610e62
Basic statement refactoring + tests + docs
arkpar 0b73266
Store metrics
arkpar 66b9c98
Store tests
arkpar c8f0467
Store maintenance test
arkpar 9bc6773
cargo fmt
arkpar 8263aa4
Build fix
arkpar 7779458
OCW Api
arkpar f01160e
Offchain worker
arkpar 7431f55
Enable host functions
arkpar 5cc24b2
fmt
arkpar dea2dea
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 4febbea
Minor tweaks
arkpar b06e356
Fixed a warning
arkpar c6f2b53
Removed tracing
arkpar 50b583d
Manual expiration
arkpar e141eb7
Reworked constraint management
arkpar c5555e9
Updated pallet constraint calculation
arkpar 1171ba0
Added small test
arkpar 399cbbd
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 365e5e8
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 3d571ca
Added remove function to the APIs
arkpar 85a31c9
Copy-paste spec into readme
arkpar b07775f
Comments
arkpar 659b494
Made the store optional
arkpar 25f3771
Removed network protocol controller
arkpar 27e73cc
fmt
arkpar 39f0145
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 51b16ff
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 0e84775
Clippy fixes
arkpar 312a07e
fmt
arkpar 9c21172
fmt
arkpar 0d95b2e
More clippy fixes
arkpar 61f6e5f
More clippy fixes
arkpar d93493a
More clippy fixes
arkpar f06ac25
Update client/statement-store/README.md
arkpar 3c2373d
Apply suggestions from code review
arkpar a13e2c0
Removed sstore from node-template
arkpar ac499ab
Sort out data path
arkpar e562b65
Added offline check
arkpar 06f3376
Removed dispatch_statement
arkpar 167c4ad
Renamed into_generic
arkpar 4c840c0
Fixed commit placement
arkpar 03906c8
Use HashSet for tracking peers/statements
arkpar f33942c
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 206488d
fmt
arkpar 2625783
Use ExtendedHostFunctions
arkpar a7f652a
Fixed benches
arkpar 0bf748e
Tweaks
arkpar 8c883a7
Apply suggestions from code review
arkpar c05e3d7
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 6c15ce9
Fixed priority mixup
arkpar f383ab6
Rename
arkpar a978b2a
newtypes for priorities
arkpar 83f343f
Added MAX_TOPICS
arkpar 94b10a7
Fixed key filtering logic
arkpar 1c22fef
Remove empty entrie
arkpar f08810b
Removed prefix from signing
arkpar 7849cc8
More documentation
arkpar 64ac7f5
fmt
arkpar f05f5a3
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 21dd020
Moved store setup from sc-service to node
arkpar d72290c
Handle maintenance task in sc-statement-store
arkpar 16e469e
Use statement iterator
arkpar 8d18b5e
Renamed runtime API mod
arkpar 9d3add2
fmt
arkpar cd7c9dc
Remove dump_encoded
arkpar d29ebc7
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar 38d893d
fmt
arkpar fdb43c5
Apply suggestions from code review
arkpar 74e4945
Apply suggestions from code review
arkpar 4f1ac76
Fixed build after applying review suggestions
arkpar 2f2d4f8
License exceptions
arkpar 75ee1bf
fmt
arkpar b501198
Store options
arkpar 692f58a
Moved pallet consts to config trait
arkpar 704d53a
Removed global priority
arkpar 71b39cf
Validate fields when decoding
arkpar a798b08
Limit validation channel size
arkpar 7af3b5a
Made a comment into module doc
arkpar 47a8e6b
Removed submit_encoded
arkpar 4fb2aee
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar df2df2a
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar f81511d
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy-paste spec into readme
- Loading branch information
commit 85a31c9f194a9c91d7663d083a3e132d5008765c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,39 @@ | ||
| A crate which contains primitives related to the statement store. This mainly | ||
| includes the statement structure. | ||
| Statement store is an off-chain data-store for signed statements accessible via RPC and OCW. | ||
|
|
||
| Nodes hold a number of statements with a proof of authenticity owing to an account ID. OCWs can place items in the data-store (with valid signatures) for any accounts whose keys they control. Users can also submit pre-signed statements via RPC. Statements can also be submitted from on-chain logic through an on-chain event. | ||
|
|
||
| A new system event `NewStatement` is added to the runtime. This event allows any account on-chain to declare that they want to make a statement for the store. Within the node store and for broadcasting, the statement would be accompanied with the hash of the block and index of the event within it, essentially taking the place of a real signature. | ||
|
|
||
| Statements comprise an optional proof of authenticity (e.g. a signature) and a number of fields. For statements without a proof, nodes would gossip statements randomly with a rate-limiter to minimise the chance of being overrun by a misbehaving node. These will generally be disregarded by nodes unless they are gossiped by several different peers or if a peer pays for it somehow (e.g. gossiping something valuable). | ||
|
|
||
| Each field is effectively a key/value pair. Fields must be sorted and the same field type may not be repeated. Depending on which keys are present, clients may index the message for ease of retrieval. | ||
|
|
||
| Formally, `Statement` is equivalent to the type `Vec<Field>` and `Field` is the SCALE-encoded enumeration: | ||
| - 0: `AuthenticityProof(Proof)`: The signature of the message. For cryptography where the public key cannot be derived from the signature together with the message data, then this will also include the signer's public key. The message data is all fields of the messages fields except the signature concatenated together *without the length prefix that a `Vec` would usually imply*. This is so that the signature can be derived without needing to re-encode the statement. | ||
| - 1: `DecryptionKey([u8; 32])`: The decryption key identifier which should be used to decrypt the statement's data. | ||
| - 2: `Priority(u32)`: Priority specifier. Higher priority statements should be kept around at the cost of lower priority statements if multiple statements from the same sender are competing for persistence or transport. Nodes should disregard when considering unsigned statements. | ||
| - 3: `Channel([u8; 32])`: The channel identifier. Only one message of a given channel should be retained at once (the one of highest priority). Nodes should disregard when considering unsigned statements. | ||
| - 4: `Topic1([u8; 32]))`: First topic identifier. | ||
| - 5: `Topic2([u8; 32]))`: Second topic identifier. | ||
| - 6: `Topic3([u8; 32]))`: Third topic identifier. | ||
| - 7: `Topic4([u8; 32]))`: Fourth topic identifier. | ||
|
Comment on lines
+16
to
+19
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4 is probably enough, but not sure if I would have just made it "generic" by having a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The topics are there for indexing. Ideally they should be mapped to database indexes, if the database supports them. Having arbitrary topic numbers might be complicated to implement. |
||
| - 8: `Data(Vec<u8>)`: General data segment. No special meaning. | ||
|
|
||
| `Proof` is defined as the SCALE-encoded enumeration: | ||
| - 0: `Sr25519 { signature: [u8; 64], signer: [u8; 32] }` | ||
| - 1: `Ed25519 { signature: [u8; 64], signer: [u8; 32] )` | ||
| - 2: `Secp256k1Ecdsa { signature: [u8; 65], signer: [u8; 33] )` | ||
| - 3: `OnChain { who: [u8; 32], block_hash: [u8; 32], event_index: u64 }` | ||
|
|
||
| ### Potential uses | ||
|
|
||
| Potential use-cases are various and include: | ||
| - ring-signature aggregation; | ||
| - messaging; | ||
| - state-channels; | ||
| - deferral of the initial "advertising" phase of multi-party transactions; | ||
| - publication of preimage data whose hash is referenced on-chain; | ||
| - effective transferal of fee payment to a second-party. | ||
|
|
||
|
|
||
| License: Apache-2.0 | ||
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.
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.
If this field isn't present, it means that any attached data is not encrypted?
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.
Yes, I'll add a clarification.