-
Notifications
You must be signed in to change notification settings - Fork 44
Feat: implement signature publisher decorators in signer #2468
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
base: main
Are you sure you want to change the base?
Feat: implement signature publisher decorators in signer #2468
Conversation
1d4e2d3
to
d62bf6b
Compare
91119b5
to
324823e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@@ -259,3 +259,6 @@ Here is a list of the available parameters: | |||
| `transactions_import_block_chunk_size` | - | - | `TRANSACTIONS_IMPORT_BLOCK_CHUNK_SIZE` | Chunk size for importing transactions, combined with transaction pruning it reduces the storage footprint of the signer by reducing the number of transactions stored on disk at any given time. | `1500` | - | - | | |||
| `cardano_transactions_block_streamer_max_roll_forwards_per_poll` | - | - | `CARDANO_TRANSACTIONS_BLOCK_STREAMER_MAX_ROLL_FORWARDS_PER_POLL` | The maximum number of roll forwards during a poll of the block streamer when importing transactions. | `1000` | - | - | | |||
| `preloading_refresh_interval_in_seconds` | `--preloading-refresh-interval-in-seconds` | - | `PRELOADING_REFRESH_INTERVAL_IN_SECONDS` | The preloading refresh interval in seconds. | `7200` | - | - | | |||
| `signature_publisher_retry_attempts` | `--signature-publisher-retry-attempts` | - | `SIGNATURE_PUBLISHER_RETRY_ATTEMPTS` | Number of retry attempts when publishing the signature. | `3` | - | - | | |||
| `signature_publisher_retry_delay_ms` | `--signature-publisher-retry-delay-ms` | - | `SIGNATURE_PUBLISHER_RETRY_DELAY_MS` | Delay (in milliseconds) between two retry attempts when publishing the signature. | `2000` | - | - | | |||
| `signature_publisher_delay_ms` | `--signature-publisher-delay-ms` | - | `SIGNATURE_PUBLISHER_DELAY_MS` | Delay (in milliseconds) between two separate signature publishers being called. | `10000` | - | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is not specific enough, it would be more clear like this:
| `signature_publisher_delay_ms` | `--signature-publisher-delay-ms` | - | `SIGNATURE_PUBLISHER_DELAY_MS` | Delay (in milliseconds) between two separate signature publishers being called. | `10000` | - | - | | |
| `signature_publisher_delayer_delay_ms` | `--signature-publisher-delayer-delay-ms` | - | `SIGNATURE_PUBLISHER_DELAY_MS` | Delay (in milliseconds) between two separate publications done by the delayer signature publisher. | `10000` | - | - | |
@@ -121,6 +121,15 @@ pub struct Configuration { | |||
|
|||
/// Preloading refresh interval in seconds | |||
pub preloading_refresh_interval_in_seconds: u64, | |||
|
|||
/// Number of retry attempts when publishing the signature | |||
pub signature_publisher_retry_attempts: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is enough?
pub signature_publisher_retry_attempts: usize, | |
pub signature_publisher_retry_attempts: u8, |
@@ -386,7 +387,30 @@ impl<'a> DependenciesBuilder<'a> { | |||
self.root_logger(), | |||
)); | |||
|
|||
let signature_publisher: Arc<dyn SignaturePublisher> = aggregator_client.clone(); | |||
let signature_publisher = { | |||
// Temporary no-op publisher used to prepare the delayer for a future DMQ-based diffusion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Temporary no-op publisher used to prepare the delayer for a future DMQ-based diffusion. | |
// Temporary no-op publisher before a DMQ-based implementation is available. |
|
||
use super::SignaturePublisher; | ||
|
||
/// A decorator of [SignaturePublisher] that delays the publishing of signatures to a second publisher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// A decorator of [SignaturePublisher] that delays the publishing of signatures to a second publisher | |
/// A decorator of [SignaturePublisher] that publishes right away on a first publisher and with a delay on the second publisher. |
.publish(signed_entity_type, signature, protocol_message) | ||
.await | ||
{ | ||
warn!(self.logger, "Failed to publish signature: {e}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warn!(self.logger, "Failed to publish signature: {e}"); | |
error!(self.logger, "Delayer failed to publish first signature: {e}"); |
|
||
tokio::time::sleep(self.delay_between_publish).await; | ||
|
||
self.second_publisher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can also add an error log here?
/// It is useful to prepare the coexistence phase of the DMQ and HTTP implementations, | ||
/// with the introduction of delay logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming Upload
should be replaced by Publish
or similar in this module
…tion for DMQ/HTTP coexistence
…isherRetrier` and `SignaturePublisherDelayer`
…h the new parameters
324823e
to
2b40cb3
Compare
Content
This PR includes the implementation of signature publisher decorators in the signer node, introducing a
retrier
publisher and adelayer
publisher to facilitate future integration with a DMQ-based diffusion mechanism.Additionally, signature publisher parameters have been made configurable to support execution in both end-to-end test and production environments. The default values are:
SIGNATURE_PUBLISHER_RETRY_ATTEMPTS
: 3 attemptsSIGNATURE_PUBLISHER_RETRY_DELAY_MS
: 2,000 millisecondsSIGNATURE_PUBLISHER_DELAY_MS
: 10,000 millisecondsPre-submit checklist
Issue(s)
Closes #2461