Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
729e524
WIP Statement store
arkpar Mar 14, 2023
7591d22
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Mar 15, 2023
ff1edaa
Sync with networking changes in master
arkpar Mar 15, 2023
8407e40
WIP statement pallet
arkpar Mar 15, 2023
21c9aaf
Statement validation
arkpar Mar 16, 2023
c706097
pallet tests
arkpar Mar 16, 2023
e066abe
Validation queue
arkpar Mar 17, 2023
bfbbc5b
Store maintenance
arkpar Mar 20, 2023
d36a867
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Mar 21, 2023
d610e62
Basic statement refactoring + tests + docs
arkpar Mar 21, 2023
0b73266
Store metrics
arkpar Mar 22, 2023
66b9c98
Store tests
arkpar Mar 22, 2023
c8f0467
Store maintenance test
arkpar Mar 23, 2023
9bc6773
cargo fmt
arkpar Mar 23, 2023
8263aa4
Build fix
arkpar Mar 23, 2023
7779458
OCW Api
arkpar Mar 23, 2023
f01160e
Offchain worker
arkpar Mar 23, 2023
7431f55
Enable host functions
arkpar Mar 23, 2023
5cc24b2
fmt
arkpar Mar 23, 2023
dea2dea
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Mar 24, 2023
4febbea
Minor tweaks
arkpar Mar 24, 2023
b06e356
Fixed a warning
arkpar Mar 24, 2023
c6f2b53
Removed tracing
arkpar Mar 24, 2023
50b583d
Manual expiration
arkpar Mar 24, 2023
e141eb7
Reworked constraint management
arkpar Mar 28, 2023
c5555e9
Updated pallet constraint calculation
arkpar Mar 28, 2023
1171ba0
Added small test
arkpar Mar 28, 2023
399cbbd
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Mar 30, 2023
365e5e8
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 1, 2023
3d571ca
Added remove function to the APIs
arkpar Apr 1, 2023
85a31c9
Copy-paste spec into readme
arkpar Apr 1, 2023
b07775f
Comments
arkpar Apr 1, 2023
659b494
Made the store optional
arkpar Apr 2, 2023
25f3771
Removed network protocol controller
arkpar Apr 2, 2023
27e73cc
fmt
arkpar Apr 3, 2023
39f0145
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 3, 2023
51b16ff
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 3, 2023
0e84775
Clippy fixes
arkpar Apr 3, 2023
312a07e
fmt
arkpar Apr 3, 2023
9c21172
fmt
arkpar Apr 3, 2023
0d95b2e
More clippy fixes
arkpar Apr 3, 2023
61f6e5f
More clippy fixes
arkpar Apr 3, 2023
d93493a
More clippy fixes
arkpar Apr 3, 2023
f06ac25
Update client/statement-store/README.md
arkpar Apr 5, 2023
3c2373d
Apply suggestions from code review
arkpar Apr 5, 2023
a13e2c0
Removed sstore from node-template
arkpar Apr 5, 2023
ac499ab
Sort out data path
arkpar Apr 5, 2023
e562b65
Added offline check
arkpar Apr 5, 2023
06f3376
Removed dispatch_statement
arkpar Apr 5, 2023
167c4ad
Renamed into_generic
arkpar Apr 5, 2023
4c840c0
Fixed commit placement
arkpar Apr 5, 2023
03906c8
Use HashSet for tracking peers/statements
arkpar Apr 5, 2023
f33942c
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 5, 2023
206488d
fmt
arkpar Apr 5, 2023
2625783
Use ExtendedHostFunctions
arkpar Apr 5, 2023
a7f652a
Fixed benches
arkpar Apr 5, 2023
0bf748e
Tweaks
arkpar Apr 5, 2023
8c883a7
Apply suggestions from code review
arkpar Apr 17, 2023
c05e3d7
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 17, 2023
6c15ce9
Fixed priority mixup
arkpar Apr 17, 2023
f383ab6
Rename
arkpar Apr 17, 2023
a978b2a
newtypes for priorities
arkpar Apr 18, 2023
83f343f
Added MAX_TOPICS
arkpar Apr 18, 2023
94b10a7
Fixed key filtering logic
arkpar Apr 18, 2023
1c22fef
Remove empty entrie
arkpar Apr 18, 2023
f08810b
Removed prefix from signing
arkpar Apr 18, 2023
7849cc8
More documentation
arkpar Apr 18, 2023
64ac7f5
fmt
arkpar Apr 18, 2023
f05f5a3
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 19, 2023
21dd020
Moved store setup from sc-service to node
arkpar Apr 19, 2023
d72290c
Handle maintenance task in sc-statement-store
arkpar Apr 19, 2023
16e469e
Use statement iterator
arkpar Apr 19, 2023
8d18b5e
Renamed runtime API mod
arkpar Apr 19, 2023
9d3add2
fmt
arkpar Apr 19, 2023
cd7c9dc
Remove dump_encoded
arkpar Apr 19, 2023
d29ebc7
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 24, 2023
38d893d
fmt
arkpar Apr 24, 2023
fdb43c5
Apply suggestions from code review
arkpar Apr 24, 2023
74e4945
Apply suggestions from code review
arkpar Apr 24, 2023
4f1ac76
Fixed build after applying review suggestions
arkpar Apr 24, 2023
2f2d4f8
License exceptions
arkpar Apr 25, 2023
75ee1bf
fmt
arkpar Apr 25, 2023
b501198
Store options
arkpar Apr 25, 2023
692f58a
Moved pallet consts to config trait
arkpar Apr 25, 2023
704d53a
Removed global priority
arkpar Apr 25, 2023
71b39cf
Validate fields when decoding
arkpar Apr 25, 2023
a798b08
Limit validation channel size
arkpar Apr 25, 2023
7af3b5a
Made a comment into module doc
arkpar Apr 25, 2023
47a8e6b
Removed submit_encoded
arkpar Apr 25, 2023
4fb2aee
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 25, 2023
df2df2a
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar Apr 25, 2023
f81511d
Merge branch 'master' of github.com:paritytech/substrate into a-state…
arkpar May 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Copy-paste spec into readme
  • Loading branch information
arkpar authored Apr 1, 2023
commit 85a31c9f194a9c91d7663d083a3e132d5008765c
39 changes: 37 additions & 2 deletions primitives/statement-store/README.md
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.
Copy link
Member

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?

Copy link
Member Author

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.

- 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
Copy link
Member

Choose a reason for hiding this comment

The 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 u8 as topic.

Copy link
Member Author

Choose a reason for hiding this comment

The 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