Skip to content

feat: implement KeyManager API #1246

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

Merged
merged 29 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
013fec2
feat: add keystore API phoenix endpoint
avilagaston9 Jul 31, 2024
6f74cd6
feat: add GET /keystores endpoint
avilagaston9 Aug 1, 2024
72cbba9
fix: update port flag
avilagaston9 Aug 1, 2024
deaddee
feat: add post method
avilagaston9 Aug 6, 2024
2ebe636
Merge branch 'main' into keystore-api
avilagaston9 Aug 6, 2024
4ecf6db
refactor: save keystores into validators
avilagaston9 Aug 7, 2024
b597427
feat: add delete endpoint
avilagaston9 Aug 7, 2024
52003fb
fix: delete/add endpoints
avilagaston9 Aug 7, 2024
c45cc56
fix: try fix ci
avilagaston9 Aug 7, 2024
31edacb
fix: test
avilagaston9 Aug 8, 2024
f0f3524
refactor: enhace readability
avilagaston9 Aug 8, 2024
d786dd6
Merge branch 'main' into keystore-api
avilagaston9 Aug 8, 2024
b49b168
fix: use other validators slot when adding a new validator
avilagaston9 Aug 9, 2024
2d2e77d
refactor: restore pruning
avilagaston9 Aug 9, 2024
206dee6
Update README.md
avilagaston9 Aug 9, 2024
bee3af1
refactor: nit changes
avilagaston9 Aug 9, 2024
112b984
Merge branch 'main' into keystore-api
avilagaston9 Aug 9, 2024
01a7371
doc: add doc to the controller functions
avilagaston9 Aug 10, 2024
6056eaa
overrides repeated credentials
avilagaston9 Aug 10, 2024
d3b1d20
fix: try fix dializer
avilagaston9 Aug 11, 2024
51b80a1
refactor: use pubkey instead of pk for readability
avilagaston9 Aug 12, 2024
9f62d43
refactor: remove unnecesary call in Libp2pPort
avilagaston9 Aug 12, 2024
b96a2e9
refactor: handle malformed pubkeys
avilagaston9 Aug 12, 2024
e248742
fix: dialyzer
avilagaston9 Aug 12, 2024
d3d2eb2
refactor: restore network params
avilagaston9 Aug 12, 2024
c0478ab
fix: update handle_tick and handle_head params
avilagaston9 Aug 12, 2024
9ba0925
refactor: remove tuple in Validator.new()
avilagaston9 Aug 12, 2024
691374f
refactor: enforce the Keystore struct in Libp2pPort.add_validator
avilagaston9 Aug 12, 2024
e72ea94
fix: fetch_validator_index uses pubkeys instead of privkeys
avilagaston9 Aug 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ Some public endpoints can be found in [eth-clients.github.io/checkpoint-sync-end
> The data retrieved from the URL is stored in the DB once the node is initiated (i.e. the iex prompt shows).
> Once this happens, following runs of `make iex` will start the node using that data.

### Beacon API
### APIs
#### Beacon API

You can start the application with the Beacon API on the default port `4000` running:
```shell
Expand All @@ -100,7 +101,27 @@ make start
You can also specify a port with the "--beacon-api-port" flag:

```shell
iex -S mix run -- --beacon-api --beacon-api-port <your_port_here>
iex -S mix run -- --beacon-api-port <your_port_here>
```
> [!WARNING]
> In case checkpoint-sync is needed, following the instructions above will end immediately with an error (see [Checkpoint Sync](#checkpoint-sync)).
>

#### Key-Manager API

Implemented following the [Ethereum specification](https://ethereum.github.io/keymanager-APIs/#/).

You can start the application with the key manager API on the default port `5000` running:

```shell
iex -S mix run -- --validator-api
```


You can also specify a port with the "--validator-api-port" flag:

```shell
iex -S mix run -- --validator-api-port <your_port_here>
```
> [!WARNING]
> In case checkpoint-sync is needed, following the instructions above will end immediately with an error (see [Checkpoint Sync](#checkpoint-sync)).
Expand Down Expand Up @@ -250,6 +271,7 @@ participants:
use_separate_vc: false
count: 1
cl_max_mem: 4096
keymanager_enabled: true
```

### Kurtosis Execution and Make tasks
Expand Down
14 changes: 14 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ switches = [
log_file: :string,
beacon_api: :boolean,
beacon_api_port: :integer,
validator_api: :boolean,
validator_api_port: :integer,
listen_address: [:string, :keep],
discovery_port: :integer,
boot_nodes: :string,
Expand Down Expand Up @@ -47,6 +49,8 @@ metrics_port = Keyword.get(args, :metrics_port, nil)
enable_metrics = Keyword.get(args, :metrics, not is_nil(metrics_port))
beacon_api_port = Keyword.get(args, :beacon_api_port, nil)
enable_beacon_api = Keyword.get(args, :beacon_api, not is_nil(beacon_api_port))
validator_api_port = Keyword.get(args, :validator_api_port, nil)
enable_validator_api = Keyword.get(args, :validator_api, not is_nil(validator_api_port))
listen_addresses = Keyword.get_values(args, :listen_address)
discovery_port = Keyword.get(args, :discovery_port, 9000)
cli_bootnodes = Keyword.get(args, :boot_nodes, "")
Expand Down Expand Up @@ -153,6 +157,16 @@ config :lambda_ethereum_consensus, BeaconApi.Endpoint,
layout: false
]

# KeyStore API
config :lambda_ethereum_consensus, KeyStoreApi.Endpoint,
server: enable_validator_api,
http: [port: validator_api_port || 5000],
url: [host: "localhost"],
render_errors: [
formats: [json: KeyStoreApi.ErrorJSON],
layout: false
]

# Validator setup

if (keystore_dir != nil and keystore_pass_dir == nil) or
Expand Down
Loading
Loading