Files
pezkuwi-subxt/substrate/primitives/statement-store
Anton 59d8b86450 chore: update libp2p to 0.52.1 (#14429)
* update libp2p to 0.52.0

* proto name now must implement `AsRef<str>`

* update libp2p version everywhere

* ToSwarm, FromBehaviour, ToBehaviour

also LocalProtocolsChange and RemoteProtocolsChange

* new NetworkBehaviour invariants

* replace `Vec<u8>` with `StreamProtocol`

* rename ConnectionHandlerEvent::Custom to NotifyBehaviour

* remove DialError & ListenError invariants

also fix pending_events

* use connection_limits::Behaviour

See https://github.com/libp2p/rust-libp2p/pull/3885

* impl `void::Void` for `BehaviourOut`

also use `Behaviour::with_codec`

* KademliaHandler no longer public

* fix StreamProtocol construction

* update libp2p-identify to 0.2.0

* remove non-existing methods from PollParameters

rename ConnectionHandlerUpgrErr to StreamUpgradeError

* `P2p` now contains `PeerId`, not `Multihash`

* use multihash-codetable crate

* update Cargo.lock

* reformat text

* comment out tests for now

* remove `.into()` from P2p

* confirm observed addr manually

See https://github.com/libp2p/rust-libp2p/blob/master/protocols/identify/CHANGELOG.md#0430

* remove SwarmEvent::Banned

since we're not using `ban_peer_id`, this can be safely removed.
we may want to introduce `libp2p::allow_block_list` module in the future.

* fix imports

* replace `libp2p` with smaller deps in network-gossip

* bring back tests

* finish rewriting tests

* uncomment handler tests

* Revert "uncomment handler tests"

This reverts commit 720a06815887f4e10767c62b58864a7ec3a48e50.

* add a fixme

* update Cargo.lock

* remove extra From

* make void uninhabited

* fix discovery test

* use autonat protocols

confirming external addresses manually is unsafe in open networks

* fix SyncNotificationsClogged invariant

* only set server mode manually in tests

doubt that we need to set it on node since we're adding public addresses

* address @dmitry-markin comments

* remove autonat

* removed unused var

* fix EOL

* update smallvec and sha2

in attempt to compile polkadot

* bump k256

in attempt to build cumulus

---------

Co-authored-by: parity-processbot <>
2023-07-25 11:12:24 +00:00
..
2023-05-04 10:24:32 +00:00

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 absense 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