Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: 🔑 add keyring interfaces to TestNode<C> #3934

Closed
cratelyn opened this issue Mar 4, 2024 · 1 comment
Closed

tests: 🔑 add keyring interfaces to TestNode<C> #3934

cratelyn opened this issue Mar 4, 2024 · 1 comment
Assignees
Labels
A-mock-consensus Area: Relates to the mock consensus engine
Milestone

Comments

@cratelyn
Copy link
Contributor

cratelyn commented Mar 4, 2024

see #3588. see #3902 (comment).

in order to test the staking and governance components however, we will need
to provide a keyring, so that the engine can sign blocks.

type Keyring = BTreeMap<VerificationKey, SigningKey>;

impl<C> TestNode<C> {
    pub fn keyring(&self) -> &Keyring { todo!() }
    pub fn keyring_mut(&self) -> &mut Keyring { todo!() }
}

this should be in service to tests of the staking component that:

  1. create the validator definition for the new validator, generating identity
    and consensus keys
  2. insert the consensus signing key into the engine’s keyring
  3. simulate a tx that posts that validator definition
  4. when the app reports the new validator to the consensus engine, the engine
    can look up its key in the keyring and start using it for signing blocks
@cratelyn cratelyn added the A-mock-consensus Area: Relates to the mock consensus engine label Mar 4, 2024
cratelyn added a commit that referenced this issue Mar 7, 2024
this addresses a few assorted threads from review:

https://github.com/penumbra-zone/penumbra/pull/3902/files#r1513620298
https://github.com/penumbra-zone/penumbra/pull/3902/files#r1513615058
https://github.com/penumbra-zone/penumbra/pull/3902/files#r1513613617
https://github.com/penumbra-zone/penumbra/pull/3902/files#r1513617136

see also, #3934.

this replaces the `Keys` structure, and defines a new `Keyring` type.
this is added to the builder and used by the `with_penumbra_auto_app_state`
extension, but it not yet introduced to `TestNode<C>`.
cratelyn added a commit that referenced this issue Mar 7, 2024
fixes #3816. see #3588. this also addresses part of #3934.

this provides extension facilities to the mock consensus test node
builder, which allows penumbra-app tests to define a single validator,
and subsequently retrieve it from the chain state.

see `mock_consensus_can_define_a_genesis_validator`. when run with
`--no-capture` enabled, these logs will be visible:

```
2024-02-28T23:00:43.751036Z DEBUG penumbra_stake::component::stake: adding validator identity to consensus set index, validator: penumbravalid172v76yyqwngcln2dxrs8ht0sjgswer3569yyhezgsz6aj97ecvqqyf3h9h
at crates/core/component/stake/src/component/stake.rs:533
in penumbra_stake::component::stake::staking

[...]

2024-02-28T23:00:43.776880Z  INFO penumbra_app::server::consensus: genesis state is a full configuration
at crates/core/app/src/server/consensus.rs:145

2024-02-28T23:00:43.780436Z DEBUG penumbra_app::app: finished committing state, jmt_root: RootHash("46dc0e9561f17eee61a2c13f517036d4d0a4c77c60362cb6cc165083675dcaf7")
at crates/core/app/src/app/mod.rs:592
```

logging facilities are provided so that helper warnings should be given
to users that forget to call `with_penumbra_single_validator`, or
provide an `AppState` object whose validator list would be overwritten.

the `serde_json` dependency is removed from the mock consensus library,
it is no longer used.

a warning is added to the mock consensus library to note to future
contributors that other penumbra dependencies should be avoided in that
library.

* #3588
* #3816

---------

Co-authored-by: Henry de Valence <[email protected]>
@cratelyn
Copy link
Contributor Author

#3902 added a keyring interface. #4039 removes that, in favor of directly presenting a BTreeMap.

i am going to close this. we'll work on addressing #3995 directly, rather than trying to proactively design interfaces for those tests.

@cratelyn cratelyn modified the milestones: Sprint 3, Sprint 2 Mar 18, 2024
@cratelyn cratelyn self-assigned this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mock-consensus Area: Relates to the mock consensus engine
Projects
Archived in project
Development

No branches or pull requests

1 participant