Publish block data to external services via webhooks #1444
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
This PR adds a
DataPublisher
utility class to the nightfall client, that is used to publish L2 block data to external services via webhook. This is enabled via the environment variableCALL_WEBHOOK_ON_CONFIRMATION
. The url of the webhook is configurable via the environment variableWEBHOOK_PATH
.The
DataPublisher
supports multiple destinations(webhook for now, could be different transport mechanisms in future like grpc or socket), including multiple webhook destinations for fallback/backup.The
PayloadSigner
class abstracts away the optional signing of the payload using HMAC. The signing key(secret) is configurable via the environment variableWEBHOOK_SIGNING_KEY
.The
RetryHandler
class abstracts away the retry mechanism with exponential backoff strategy that is configurable via environment variablesCALL_WEBHOOK_MAX_RETRIES
andCALL_WEBHOOK_INITIAL_BACKOFF
.Does this close any currently open issues?
No
What commands can I run to test the change?
docker-compose.dev.yml
: