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

refactor hardcoded variables to .env files #83

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vicentevieytes
Copy link

@vicentevieytes vicentevieytes commented Sep 11, 2024

Introduces a .env.template file in the root of the repo and another in the contracts/ in order to remove some hardcoded values from the IncredibleSquaringDeployer solidity script and from the Makefile.

Because of some errors with the foundry version, I could not test that this changes are working correctly in the devnet deployment. Leaving this PR in draft until this is solved.

@@ -31,18 +31,12 @@ import "forge-std/StdJson.sol";
import "forge-std/console.sol";

// # To deploy and verify our contract
// forge script script/CredibleSquaringDeployer.s.sol:CredibleSquaringDeployer --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvv
// forge script script/IncredibleSquaringDeployer.s.sol:IncredibleSquaringDeployer --rpc-url $RPC_URL --private-key $PRIVATE_KEY --constructor-args $AGGREGATOR_ADDR $TASK_GENERATOR_ADDR --broadcast -vvvv
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
// forge script script/IncredibleSquaringDeployer.s.sol:IncredibleSquaringDeployer --rpc-url $RPC_URL --private-key $PRIVATE_KEY --constructor-args $AGGREGATOR_ADDR $TASK_GENERATOR_ADDR --broadcast -vvvv
// forge script script/IncredibleSquaringDeployer.s.sol:IncredibleSquaringDeployer --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvv

Th constructor-args are not necessary

function run() external {
aggregatorAddr = vm.envAddress("AGGREGATOR_ADDR");
taskGeneratorAddr = vm.envAddress("TASK_GENERATOR_ADDR");
Copy link
Author

Choose a reason for hiding this comment

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

Fetching of the environment variables should go in a setUp() function

Copy link
Author

Choose a reason for hiding this comment

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

    function setUp() public virtual {
        aggregatorAddress = vm.envAddress("AGGREGATOR_ADDRESS");
        taskGeneratorAddress = vm.envAddress("TASK_GENERATOR_ADDRESS");
    }

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I agree, can we also move reading the json into the setup function and make the Eigenlayer contracts state variables of the script contract

```
cp .env.template .env
cp contracts/.env.template contracts/.env
```
Copy link
Author

Choose a reason for hiding this comment

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

This file should be copied to contracts/.env in the Makefile, so the user doesn't have to do it manually

@@ -4,13 +4,8 @@
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

AGGREGATOR_ECDSA_PRIV_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6
CHALLENGER_ECDSA_PRIV_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
include .env
Copy link
Author

Choose a reason for hiding this comment

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

This is not necessary, also, the .env file is not in the root of the repository so nothing would be included

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants