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

Faucet has a chain listener #2410

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

christos-h
Copy link
Contributor

Motivation

We would like the faucet to listen for notifications from the admin change, especially for reconfigurations so that it can automatically update epoch.

Proposal

Add a chain listener to the faucet service. This will work with #2303 so that the faucet only listens for messages from the admin chain.

@ma2bd ma2bd linked an issue Aug 27, 2024 that may be closed by this pull request
@christos-h christos-h force-pushed the faucet-subscriber-2 branch 3 times, most recently from 42e5b5f to 71aea89 Compare September 17, 2024 16:03
CLI.md Outdated
@@ -100,7 +100,7 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
* `--recv-timeout-ms <RECV_TIMEOUT>` — Timeout for receiving responses (milliseconds)

Default value: `4000`
* `--max-pending-message-bundles <MAX_PENDING_MESSAGE_BUNDLES>` — The maximum number of incoming message bundles to include in a block proposal
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an accidental regression?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good catch. I think I may need a rebase.

Copy link
Contributor

Choose a reason for hiding this comment

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

@christos-h: You can run:

cargo run --locked --bin linera help-markdown > CLI.md

(That will probably just revert the file, but it makes sure it's in sync with the code.)

CLI.md Outdated Show resolved Hide resolved
CLI.md Outdated Show resolved Hide resolved
Comment on lines +80 to +96
let faucet_client = net.make_client().await;
faucet_client.wallet_init(&[], FaucetOption::None).await?;

let faucet_chain = client
.open_and_assign(&faucet_client, Amount::from_tokens(1_000u128))
.await?;

let mut faucet_service = faucet_client
.run_faucet(None, faucet_chain, Amount::from_tokens(2))
.await?;

faucet_service.ensure_is_running()?;

let faucet = faucet_service.instance();

assert_eq!(faucet.current_validators().await?.len(), 4);

Copy link
Contributor

Choose a reason for hiding this comment

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

The reconfiguration test is already extremely complicated. Does it have to be part of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to add another test and increase CI time. Not sure there is a correct answer here.

linera-client/src/unit_tests/chain_listener.rs Outdated Show resolved Hide resolved

pub async fn from_clients(chains: impl IntoIterator<Item = ChainClient<P, S>>) -> Self {
let chain_clients = Self(Default::default());
for chain_client in chains.into_iter() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for chain_client in chains.into_iter() {
for chain_client in chains {

@@ -81,6 +81,14 @@ pub trait ClientContext {
&mut self,
client: &ChainClient<Self::ValidatorNodeProvider, Self::Storage>,
) -> Result<(), Error>;

fn clients(&self) -> Vec<ChainClient<Self::ValidatorNodeProvider, Self::Storage>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe make_clients, to make it clearer that this isn't a (cheap) getter.

CLI.md Outdated
@@ -100,7 +100,7 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
* `--recv-timeout-ms <RECV_TIMEOUT>` — Timeout for receiving responses (milliseconds)

Default value: `4000`
* `--max-pending-message-bundles <MAX_PENDING_MESSAGE_BUNDLES>` — The maximum number of incoming message bundles to include in a block proposal
Copy link
Contributor

Choose a reason for hiding this comment

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

@christos-h: You can run:

cargo run --locked --bin linera help-markdown > CLI.md

(That will probably just revert the file, but it makes sure it's in sync with the code.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the faucet handle incoming messages from the admin chain.
5 participants