Skip to content

Conversation

@drskalman
Copy link
Contributor

@drskalman drskalman commented Oct 10, 2024

  • Implement ProofOfPossession traits with default implementation.

  • Implement their derive macro in a new proc-macro crate in pubkeycrypto create which eventually should contains all pubkey crypto scheme as recommended by Move crypto implementations out of sp-core #1975

  • Derive ProofOfPossession for all pubkey crypto type beside BLS.

  • Implement Nugget BLS proof of possession which should certifies that the unique secret key known to the prover is used to generate both public keys in G1 and G2.

  • Implement sign Host function for BLS12-381 necessary to be able to generate proof of possion through runtime.

  • Implement generation and verification of proof of possession functions in all RuntimeApp and RuntimeAppPublic s.

- Derive ProofOfPossession for all pubkey crypto type beside BLS.
@davxy davxy self-requested a review October 10, 2024 12:33
@burdges
Copy link

burdges commented Oct 10, 2024

We added backcerts of operator keys alraedy, no? Or was that an RFC but not yet implemented?

We could use backcerts for proof-of-possession. Ideally, we should place system randomness into those backcerts and place them on-chain, but this requires tweaking ed25519 I guess.

@drskalman
Copy link
Contributor Author

@burdges Could you point to the backcerts PR or its RFC so I can take a look? Thank you.

@burdges
Copy link

burdges commented Oct 10, 2024

polkadot-fellows/RFCs#48

It's seemingly just ownership proofs, but really they should sign the operators key, making them backcerts.

I proposed having some master session key too, but that's a bigger change. We could simply back certify both the operators' key and some piece of system randomness sampled at node startup.

@davxy
Copy link
Member

davxy commented Oct 11, 2024

@drskalman, as we discussed, I believe that, along with the code (and prior to merging this PR), an amendment to the aforementioned RFC should be proposed and integrated.

@burdges
Copy link

burdges commented Oct 13, 2024

It's offten that backcerts get forgotten because we do not see them in TLS since the handshake itself represents the backcert, meaning the site itself sent you their certificate in the authenticated channel, so they approved that certificate.

If we lack them in polkadot, then an adversary could pull tricks like claiming someone else's grandpa key was their grandpa key, maybe some unelected node, and then ignore grandpa themselves. We've no idea what bugs exist in substrate under such scenarios, but even if we handle them gracefully they still cause problems elsewhere.

Copy link
Contributor

@coax1d coax1d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far so good

@bkchr
Copy link
Member

bkchr commented May 20, 2025

/cmd fmt

@github-actions
Copy link
Contributor

Command "fmt" has failed ❌! See logs here

@bkchr bkchr enabled auto-merge May 21, 2025 13:51
auto-merge was automatically disabled May 21, 2025 14:50

Head branch was pushed to by a user without write access

@bkchr bkchr enabled auto-merge May 21, 2025 14:55
@bkchr bkchr added this pull request to the merge queue May 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 21, 2025
@davxy davxy enabled auto-merge May 28, 2025 10:20
@davxy davxy added this pull request to the merge queue May 28, 2025
Merged via the queue into paritytech:master with commit b4b7439 May 28, 2025
180 of 181 checks passed
pgherveou pushed a commit that referenced this pull request Jun 11, 2025
…pes (#6010)

- Implement `ProofOfPossession` traits with default implementation.
- Implement their derive macro in a new proc-macro crate in
`pubkeycrypto` create which eventually should contains all pubkey crypto
scheme as recommended by #1975
- Derive ProofOfPossession for all pubkey crypto type beside BLS.

- [x] Implement Nugget BLS proof of possession which should certifies
that the unique secret key known to the prover is used to generate both
public keys in G1 and G2.
- [x] Implement sign Host function for BLS12-381 necessary to be able to
generate proof of possion through runtime.
- [x] Implement generation and verification of proof of possession
functions in all RuntimeApp and RuntimeAppPublic s.

---------

Co-authored-by: Andrew Burger <[email protected]>
Co-authored-by: Davide Galassi <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Aug 20, 2025
# Description

Adds a few crate bumps associated to PRs which missed to bump them, and
updates parity-publish version across the board to 0.10.6 (to support
rustc 1.88).

Additionally, makes it so that parity-publish-check-compile runs first
on all unreleased prdocs to bump associated crates, and only after
moving those to an `unreleased` directory, runs on the current PR's
prdoc. This is so that we first create a "local release" based on the
unreleased prdocs, and then we follow with a "patch" release based on
the previous local release, considering only the prdoc pushed with the
current PR. If the workflow fails at the end it means current PR missed
certain bumps. If we don't do the plan/apply twice we risk to miss bumps
due to all prdocs being considered (current PR's prdoc + unreleased
ones) when running parity-publish plan/apply, which might result in a
set of crate bumps which are sufficient, but once some unreleased prdocs
will be moved to a stable prodoc directory, because they will be part of
a stable release, then the ones left will not be enough from a bump
perspective (e.g. like it happened in #9320). That's why it is important
to check every PR that adds a prdoc whether it is self-sufficient from a
crates bumping perspective.

If no prdoc is provided, the parity-publish does not need to be taken
into consideration, but it should also pass nonetheless.

## Integration

N/A

## Review Notes

There seems to a be a corner case parity-publish can not easily catch.
All bumps below are a manifestation of it. More details below:

* #8714 - a major bump is necessary for `sp-wasm-interface` - context
here:
#8714 (comment)
* `sp-keystore` was bumped during 2506 in #6010 , and the relevant prdoc
got moved to stable2506 dir in #9320. This moved prdoc coexisted
alongside other unreleased prdocs, and covered a needed patch bump for
`sp-keystore`, that is not easily visible, and also required for crates
publishing IIUC:
1. `sp-io` is major bumped because its direct dependency,
`sp-state-machine`, was major bumped.
2. `sp-io` has a direct dependency on `sp-core` (minor bumped), and
`sp-keystore` (not touched, not bumped by now)
3. `sp-io` fails to compile because it pulls same types from different
`sp-core` versions (it implements `Keystore` trait from `sp-keystore`
with methods signatures referencing types from `sp-core 38.0.0` by using
the `sp-core 0.38.1` - unreleased yet - types, which confuses rustc).
* `sp-rpc` needs a bump too due to pulling `sp-core 38.0.0`, like
`sp-keystore`, and it is an indirect dependency of `polkadot-cli`, which
has also a direct dependency on unreleased `sp-core 38.1.0`, so again,
if we don't bump `sp-rpc` (historically it has been bumped only with
major, but I think we can go with patch on this one), `polkadot-cli`
can't compile.
* `sc-storage-monitor` is in a similar situation as
`sp-rpc`/`sp-keystore` - `polkadot-cli` depends on `sc-storage-monitor`
(which is not bumped, and has a dependency on `sp-core 38.0.0`), but it
also depends on `sp-core 38.1.0`. And yet again, something is used in
`polkadot-cli` from the two different `sp-core` versions, which confuses
rustc.

---------

Signed-off-by: Iulian Barbu <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexander Samusev <[email protected]>
pepoviola pushed a commit that referenced this pull request Aug 26, 2025
# Description

Adds a few crate bumps associated to PRs which missed to bump them, and
updates parity-publish version across the board to 0.10.6 (to support
rustc 1.88).

Additionally, makes it so that parity-publish-check-compile runs first
on all unreleased prdocs to bump associated crates, and only after
moving those to an `unreleased` directory, runs on the current PR's
prdoc. This is so that we first create a "local release" based on the
unreleased prdocs, and then we follow with a "patch" release based on
the previous local release, considering only the prdoc pushed with the
current PR. If the workflow fails at the end it means current PR missed
certain bumps. If we don't do the plan/apply twice we risk to miss bumps
due to all prdocs being considered (current PR's prdoc + unreleased
ones) when running parity-publish plan/apply, which might result in a
set of crate bumps which are sufficient, but once some unreleased prdocs
will be moved to a stable prodoc directory, because they will be part of
a stable release, then the ones left will not be enough from a bump
perspective (e.g. like it happened in #9320). That's why it is important
to check every PR that adds a prdoc whether it is self-sufficient from a
crates bumping perspective.

If no prdoc is provided, the parity-publish does not need to be taken
into consideration, but it should also pass nonetheless.

## Integration

N/A

## Review Notes

There seems to a be a corner case parity-publish can not easily catch.
All bumps below are a manifestation of it. More details below:

* #8714 - a major bump is necessary for `sp-wasm-interface` - context
here:
#8714 (comment)
* `sp-keystore` was bumped during 2506 in #6010 , and the relevant prdoc
got moved to stable2506 dir in #9320. This moved prdoc coexisted
alongside other unreleased prdocs, and covered a needed patch bump for
`sp-keystore`, that is not easily visible, and also required for crates
publishing IIUC:
1. `sp-io` is major bumped because its direct dependency,
`sp-state-machine`, was major bumped.
2. `sp-io` has a direct dependency on `sp-core` (minor bumped), and
`sp-keystore` (not touched, not bumped by now)
3. `sp-io` fails to compile because it pulls same types from different
`sp-core` versions (it implements `Keystore` trait from `sp-keystore`
with methods signatures referencing types from `sp-core 38.0.0` by using
the `sp-core 0.38.1` - unreleased yet - types, which confuses rustc).
* `sp-rpc` needs a bump too due to pulling `sp-core 38.0.0`, like
`sp-keystore`, and it is an indirect dependency of `polkadot-cli`, which
has also a direct dependency on unreleased `sp-core 38.1.0`, so again,
if we don't bump `sp-rpc` (historically it has been bumped only with
major, but I think we can go with patch on this one), `polkadot-cli`
can't compile.
* `sc-storage-monitor` is in a similar situation as
`sp-rpc`/`sp-keystore` - `polkadot-cli` depends on `sc-storage-monitor`
(which is not bumped, and has a dependency on `sp-core 38.0.0`), but it
also depends on `sp-core 38.1.0`. And yet again, something is used in
`polkadot-cli` from the two different `sp-core` versions, which confuses
rustc.

---------

Signed-off-by: Iulian Barbu <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexander Samusev <[email protected]>
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
…pes (#6010)

- Implement `ProofOfPossession` traits with default implementation.
- Implement their derive macro in a new proc-macro crate in
`pubkeycrypto` create which eventually should contains all pubkey crypto
scheme as recommended by #1975
- Derive ProofOfPossession for all pubkey crypto type beside BLS.

- [x] Implement Nugget BLS proof of possession which should certifies
that the unique secret key known to the prover is used to generate both
public keys in G1 and G2.
- [x] Implement sign Host function for BLS12-381 necessary to be able to
generate proof of possion through runtime.
- [x] Implement generation and verification of proof of possession
functions in all RuntimeApp and RuntimeAppPublic s.

---------

Co-authored-by: Andrew Burger <[email protected]>
Co-authored-by: Davide Galassi <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
alvicsam added a commit that referenced this pull request Oct 17, 2025
# Description

Adds a few crate bumps associated to PRs which missed to bump them, and
updates parity-publish version across the board to 0.10.6 (to support
rustc 1.88).

Additionally, makes it so that parity-publish-check-compile runs first
on all unreleased prdocs to bump associated crates, and only after
moving those to an `unreleased` directory, runs on the current PR's
prdoc. This is so that we first create a "local release" based on the
unreleased prdocs, and then we follow with a "patch" release based on
the previous local release, considering only the prdoc pushed with the
current PR. If the workflow fails at the end it means current PR missed
certain bumps. If we don't do the plan/apply twice we risk to miss bumps
due to all prdocs being considered (current PR's prdoc + unreleased
ones) when running parity-publish plan/apply, which might result in a
set of crate bumps which are sufficient, but once some unreleased prdocs
will be moved to a stable prodoc directory, because they will be part of
a stable release, then the ones left will not be enough from a bump
perspective (e.g. like it happened in #9320). That's why it is important
to check every PR that adds a prdoc whether it is self-sufficient from a
crates bumping perspective.

If no prdoc is provided, the parity-publish does not need to be taken
into consideration, but it should also pass nonetheless.

## Integration

N/A

## Review Notes

There seems to a be a corner case parity-publish can not easily catch.
All bumps below are a manifestation of it. More details below:

* #8714 - a major bump is necessary for `sp-wasm-interface` - context
here:
#8714 (comment)
* `sp-keystore` was bumped during 2506 in #6010 , and the relevant prdoc
got moved to stable2506 dir in #9320. This moved prdoc coexisted
alongside other unreleased prdocs, and covered a needed patch bump for
`sp-keystore`, that is not easily visible, and also required for crates
publishing IIUC:
1. `sp-io` is major bumped because its direct dependency,
`sp-state-machine`, was major bumped.
2. `sp-io` has a direct dependency on `sp-core` (minor bumped), and
`sp-keystore` (not touched, not bumped by now)
3. `sp-io` fails to compile because it pulls same types from different
`sp-core` versions (it implements `Keystore` trait from `sp-keystore`
with methods signatures referencing types from `sp-core 38.0.0` by using
the `sp-core 0.38.1` - unreleased yet - types, which confuses rustc).
* `sp-rpc` needs a bump too due to pulling `sp-core 38.0.0`, like
`sp-keystore`, and it is an indirect dependency of `polkadot-cli`, which
has also a direct dependency on unreleased `sp-core 38.1.0`, so again,
if we don't bump `sp-rpc` (historically it has been bumped only with
major, but I think we can go with patch on this one), `polkadot-cli`
can't compile.
* `sc-storage-monitor` is in a similar situation as
`sp-rpc`/`sp-keystore` - `polkadot-cli` depends on `sc-storage-monitor`
(which is not bumped, and has a dependency on `sp-core 38.0.0`), but it
also depends on `sp-core 38.1.0`. And yet again, something is used in
`polkadot-cli` from the two different `sp-core` versions, which confuses
rustc.

---------

Signed-off-by: Iulian Barbu <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexander Samusev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I5-enhancement An additional feature request. T5-host_functions This PR/Issue is related to host functions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants