Files
pezkuwi-subxt/substrate/primitives/statement-store
Oliver Tale-Yazdi 4a44356773 Improve features dev-ex (#1831)
Adds a config file that allows to run `zepter` without any arguments in
the workspace to address all issues.
A secondary workflow for the CI is provided as `zepter run check`. Both
the formatting and linting are now in one check for efficiancy.

The latest version also detects some more things that `featalign` was
already showing.

Error message [in the
CI](https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3916205)
now looks like this:
```pre
...
crate 'test-parachains' (/Users/vados/Documents/work/polkadot-sdk/polkadot/parachain/test-parachains/Cargo.toml)
  feature 'std'
    must propagate to:
      parity-scale-codec
Found 55 issues (run with --fix to fix).
Error: Command 'lint propagate-feature' failed with exit code 1

Polkadot-SDK uses the Zepter CLI to detect abnormalities in the feature configuration.
It looks like one more more checks failed; please check the console output. You can try to automatically address them by running `zepter`.
Otherwise please ask directly in the Merge Request, GitHub Discussions or on Matrix Chat, thank you.

For more information, see:
  - https://github.com/paritytech/polkadot-sdk/issues/1831
  - https://github.com/ggwpez/zepter
```

TODO:
- [x] Check that CI fails correctly

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-10-24 17:59:38 +02:00
..
2023-08-21 14:00:59 +00:00
2023-10-24 17:59:38 +02:00
2023-09-04 12:02:32 +03:00

Statement store

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. In the absence of this field Data should be treated as not encrypted.
  • 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.
  • 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