Initial commit
This commit is contained in:
commit
13303c336d
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 Status Research & Development GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Status Research & Development GmbH
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,58 @@
|
|||
# Description
|
||||
|
||||
This role configures the [Lido Validator Ejector](https://github.com/lidofinance/validator-ejector)
|
||||
|
||||
This is a daemon which monitors [`ValidatorsExitBusOracle`](https://github.com/lidofinance/lido-dao/blob/feature/shapella-upgrade/contracts/0.8.9/oracle/ValidatorsExitBusOracle.sol) events on a target network and broadcasts pre-generated validator exit messages when necessary (as users of the LIDO protocol request withdrawals).
|
||||
|
||||
On start-up, it loads exit messages from a specified folder in form of individual `.json` files and validates their format, structure and signature. Then, it fetches log events from the most recent `ejector_blocks_preload` blocks, checks whether any exits should be performed immediately and then enteres a polling loop that checks for new events every `ejector_blocks_loop` blocks.
|
||||
|
||||
For further details, please refer to the [`Validator Ejector` Documentation](https://hackmd.io/@lido/BJvy7eWln).
|
||||
|
||||
## Role Implementation Details
|
||||
|
||||
The software runs as a docker container from [`lidofinance/validator-ejector`](https://hub.docker.com/r/lidofinance/validator-ejector).
|
||||
|
||||
Docker compose file template is in [templates/docker-compose.yml.j2](./templates/docker-compose.yml.j2).
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Options are configured via environment variables. They are defined at [defaults/main.yml](./defaults/main.yml).
|
||||
|
||||
> **Warning:** You cannot use `ejector_validator_exit_webhook` or the `ejector_messages_location` at the same time. Only one of the two variables must be set
|
||||
|
||||
| Variable | Required | Description |
|
||||
| -------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ejector_execution_node | Yes | Ethereum Execution Node endpoint |
|
||||
| ejector_consensus_node | Yes | Ethereum Consensus Node endpoint |
|
||||
| ejector_locator_address | Yes | Address of the Locator contract [Goerli](https://docs.lido.fi/deployed-contracts/goerli/) / [Mainnet](https://docs.lido.fi/deployed-contracts/) |
|
||||
| ejector_staking_module_id | Yes | Staking Module ID for which operator ID is set, currently only one exists - ([NodeOperatorsRegistry](https://github.com/lidofinance/lido-dao#contracts)) with id `1` |
|
||||
| ejector_operator_id | Yes | Operator ID in the Node Operators registry, easiest to get from Operators UI: [Goerli](https://operators.testnet.fi)/[Mainnet](https://operators.lido.fi) |
|
||||
| ejector_messages_location | No | Local folder or external storage bucket url to load json exit message files from. Required if you are using exit messages mode |
|
||||
| ejector_validator_exit_webhook | No | POST validator info to an endpoint instead of sending out an exit message in order to initiate an exit. Required if you are using webhook mode |
|
||||
| ejector_oracle_addresses_allowlist | Yes | Allowed Oracle addresses to accept transactions from [Goerli](https://testnet.testnet.fi/#/lido-testnet-prater/0x24d8451bc07e7af4ba94f69acdd9ad3c6579d9fb/) / [Mainnet](https://mainnet.lido.fi/#/lido-dao/0x442af784a788a5bd6f42a01ebe9f287a871243fb/) |
|
||||
| ejector_messages_password | No | Password to decrypt encrypted exit messages with. Needed only if the exit messages are encrypted |
|
||||
| ejector_messages_password_file | No | Path to a file with password inside to decrypt exit messages with. Needed only if you have encrypted exit messages. If used, MESSAGES_PASSWORD (not MESSAGES_PASSWORD_FILE) needs to be added to LOGGER_SECRETS in order to be sanitized |
|
||||
| ejector_blocks_preload | No | Amount of blocks to load events from on start. Increase if daemon was not running for some time. Defaults to a week of blocks |
|
||||
| ejector_blocks_loop | No | Amount of blocks to load events from on every poll. Defaults to 3 hours of blocks |
|
||||
| ejector_job_interval | No | Time interval in milliseconds to run checks. Defaults to time of 1 epoch |
|
||||
| ejector_http_port | No | Port to serve metrics and health check on |
|
||||
| ejector_run_metrics | No | Enable metrics endpoint |
|
||||
| ejector_run_health_check | No | Enable health check endpoint |
|
||||
| ejector_logger_level | No | Severity level from which to start showing errors eg info will hide debug messages |
|
||||
| ejector_logger_format | No | Simple or JSON log output: simple/json |
|
||||
| ejector_logger_secrets | No | JSON string array of either env var keys to sanitize in logs or exact values |
|
||||
| ejector_dry_run | No | Run the service without actually sending out exit messages |
|
||||
|
||||
Messages can also be loaded from remote storages: AWS S3 and Google Cloud Storage.
|
||||
|
||||
Simply set a url with an appropriate protocol in `ejector_messages_location`:
|
||||
|
||||
- `s3://` for S3
|
||||
- `gs://` for GCS
|
||||
|
||||
## Requirements
|
||||
|
||||
Hardware
|
||||
|
||||
- 2-core CPU
|
||||
- 1GB RAM
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
|
||||
ejector_service_name: 'ejector'
|
||||
ejector_service_path: '/docker/{{ ejector_service_name}}'
|
||||
ejector_compose_file: '{{ ejector_service_path }}/docker-compose.yml'
|
||||
|
||||
|
||||
# container
|
||||
ejector_version: '1.2.0'
|
||||
ejector_cont_image: 'lidofinance/validator-ejector:{{ ejector_version }}'
|
||||
ejector_cont_name: '{{ ejector_service_name }}'
|
||||
# ejector_cont_vol: '{{ ejector_service_path }}/app'
|
||||
|
||||
#app variables
|
||||
ejector_execution_node: http://1.2.3.4:8545
|
||||
ejector_consensus_node: http://1.2.3.4:5051
|
||||
ejector_locator_address: '0x1eDf09b5023DC86737b59dE68a8130De878984f5'
|
||||
ejector_staking_module_id: 1
|
||||
ejector_operator_id: 123
|
||||
|
||||
# BEWARE!
|
||||
# You cannot use `ejector_validator_exit_webhook` or the `ejector_messages_location`
|
||||
# at the same time. Only one of the two variables must be set
|
||||
ejector_messages_location: 'messages'
|
||||
ejector_messages_password: 'password'
|
||||
ejector_messages_password_file: ''
|
||||
|
||||
# BEWARE!
|
||||
# You cannot use `ejector_validator_exit_webhook` or the `ejector_messages_location`
|
||||
# at the same time. Only one of the two variables must be set
|
||||
ejector_validator_exit_webhook: ''
|
||||
|
||||
ejector_oracle_addresses_allowlist: []
|
||||
|
||||
ejector_blocks_preload: 50000 # 7 days of blocks
|
||||
ejector_blocks_loop: 900
|
||||
ejector_job_interval: 384000
|
||||
|
||||
ejector_http_port: 8989
|
||||
ejector_run_metrics: false
|
||||
ejector_run_health_check: true
|
||||
|
||||
ejector_logger_level: 'info'
|
||||
ejector_logger_format: 'simple'
|
||||
ejector_logger_secrets: []
|
||||
|
||||
ejector_dry_run: true
|
||||
|
||||
# general container management
|
||||
compose_recreate: 'smart'
|
||||
compose_state: 'present'
|
||||
compose_restart: false
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
galaxy_info:
|
||||
author:
|
||||
- Zahary Karadjov <zahary@status.im>
|
||||
- Kiran Roy <kiran@status.im>
|
||||
- Jakub Sokołowski <jakub@status.im>
|
||||
description: Deploy and setup Lido Validator Ejector
|
||||
company: Status Research & Development GmbH
|
||||
license: MIT
|
||||
min_ansible_version: 1.19
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- xenial
|
||||
dependencies:
|
||||
- name: consul-service
|
||||
src: git+git@github.com:status-im/infra-role-consul-service.git
|
||||
scm: git
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: EJECTOR | Create compose file directory
|
||||
file:
|
||||
path: '{{ ejector_service_path }}'
|
||||
state: directory
|
||||
owner: 'dockremap'
|
||||
group: 'docker'
|
||||
recurse: true
|
||||
# - name: EJECTOR | Create container directory
|
||||
# file:
|
||||
# path: '{{ ejector_cont_vol }}'
|
||||
# state: directory
|
||||
# owner: 'dockremap'
|
||||
# group: 'docker'
|
||||
# recurse: true
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Create Consul service definition
|
||||
include_role: name=consul-service
|
||||
vars:
|
||||
consul_config_name: '{{ ejector_service_name }}-health'
|
||||
consul_services:
|
||||
- name: '{{ ejector_service_name }}-health'
|
||||
tags: []
|
||||
checks:
|
||||
- id: '{{ ejector_service_name }}-health'
|
||||
name: 'Lido Validator Ejector health'
|
||||
type: 'http'
|
||||
http: 'http://localhost:{{ ejector_http_port }}/health'
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
- name: EJECTOR | Create compose file
|
||||
template:
|
||||
src: 'docker-compose.yml.j2'
|
||||
dest: '{{ ejector_compose_file }}'
|
||||
owner: 'dockremap'
|
||||
group: 'docker'
|
||||
mode: 0644
|
||||
|
||||
- name: EJECTOR | Create container
|
||||
docker_compose:
|
||||
project_src: '{{ ejector_service_path }}'
|
||||
pull: true
|
||||
state: '{{ compose_state }}'
|
||||
restarted: '{{ compose_restart }}'
|
||||
recreate: '{{ compose_recreate }}'
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- import_tasks: config.yml
|
||||
- import_tasks: container.yml
|
||||
- import_tasks: consul.yml
|
|
@ -0,0 +1,31 @@
|
|||
version: '3.7'
|
||||
services:
|
||||
app:
|
||||
image: lidofinance/validator-ejector:{{ ejector_version }}
|
||||
container_name: validator-ejector
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- EXECUTION_NODE={{ejector_execution_node}}
|
||||
- CONSENSUS_NODE={{ejector_consensus_node}}
|
||||
- LOCATOR_ADDRESS={{ejector_locator_address}}
|
||||
- STAKING_MODULE_ID={{ejector_staking_module_id}}
|
||||
- OPERATOR_ID={{ejector_operator_id}}
|
||||
- MESSAGES_LOCATION={{ejector_messages_location}}
|
||||
- MESSAGES_PASSWORD={{ejector_messages_password}}
|
||||
- MESSAGES_PASSWORD_FILE={{ejector_messages_password_file}}~
|
||||
- VALIDATOR_EXIT_WEBHOOK={{ejector_validator_exit_webhook}}
|
||||
- ORACLE_ADDRESSES_ALLOWLIST={{ejector_oracle_addresses_allowlist}}
|
||||
- BLOCKS_PRELOAD={{ejector_blocks_preload}}
|
||||
- BLOCKS_LOOP={{ ejector_blocks_loop }}
|
||||
- JOB_INTERVAL={{ ejector_job_interval }}
|
||||
- HTTP_PORT={{ejector_http_port}}
|
||||
- RUN_METRICS={{ejector_run_metrics}}
|
||||
- RUN_HEALTH_CHECK={{ejector_run_health_check}}
|
||||
- LOGGER_LEVEL={{ejector_logger_level}}
|
||||
- LOGGER_FORMAT={{ejector_logger_format}}
|
||||
- LOGGER_SECRETS={{ejector_logger_secrets}}
|
||||
- DRY_RUN={{ejector_dry_run}}
|
||||
ports:
|
||||
- '{{ejector_http_port}}:{{ejector_http_port}}'
|
||||
volumes:
|
||||
- ./messages:/app/messages
|
Loading…
Reference in New Issue