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

Fetching PrivateKey from Environnement and Execute onchain transaction. #55

Merged
merged 2 commits into from
Sep 2, 2024

Conversation

Ethnical
Copy link
Collaborator

@Ethnical Ethnical commented Sep 1, 2024

Description

This PR allows to fetch the private-key from the env directly and remove the hardcoded dummy privatekey from the codebase.
This will make sure that the private key fetch is with the correct format.

Using the environnement variable PSPEXECUTOR_MON_PRIVATE_KEY like below:

export PSPEXECUTOR_MON_PRIVATE_KEY=2a871[....]3dff6d409c # removed the `0x` for better clarity but this one can be kept. 

I also increase the robustness of the HTTP method /api/psp_execution to make sure only the exact amount of args are strictly necessary also added a protection again to large payload size (> 1MB) that was missing (added some tests accordingly).

e50b58fcdb7f1d7059096b58b92fff2b9387bc2821831b2f88d0c63cc70b0b65

Tests
I have refactor and added some tests like:

  • TestCheckAndReturnPrivateKey(): tests the CheckAndReturnPrivateKey() function to ensure that it returns the correct private key or error for an incorrect private key provided.

I have refactors also some previous tests to follow the current standard with expectErr instead of wants.

PASS
ok      github.com/ethereum-optimism/monitorism/op-defender/psp_executor        0.391s

@Ethnical Ethnical added the enhancement New feature or request label Sep 1, 2024
@Ethnical Ethnical changed the title WIP: Fetching PrivateKey from Environnement and Execute onchain transaction. Fetching PrivateKey from Environnement and Execute onchain transaction. Sep 2, 2024
@Ethnical Ethnical marked this pull request as ready for review September 2, 2024 10:15
@Ethnical Ethnical requested a review from a team as a code owner September 2, 2024 10:15
Copy link
Contributor

@raffaele-oplabs raffaele-oplabs left a comment

Choose a reason for hiding this comment

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

LGTM

@Ethnical Ethnical merged commit e7c02ec into main Sep 2, 2024
5 checks passed
@Ethnical Ethnical deleted the ethni/add-fetch-key-from-env branch September 2, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants