-
Notifications
You must be signed in to change notification settings - Fork 124
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# These default values work for devnet deployment only | ||
|
||
AGGREGATOR_ECDSA_PRIV_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 | ||
CHALLENGER_ECDSA_PRIV_KEY=0x5de4111afa1a4b94908f83103eb1f17 | ||
|
||
CHAINID=31337 | ||
# Make sure to update this if the strategy address changes | ||
# check in contracts/script/output/${CHAINID}/credible_squaring_avs_deployment_output.json | ||
STRATEGY_ADDRESS=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,14 @@ | |
|
||
Basic repo demoing a simple AVS middleware with full eigenlayer integration. See this [video walkthrough](https://www.loom.com/share/50314b3ec0f34e2ba386d45724602d76?sid=9d68d8cb-d2d5-4123-bd06-776de2076de0). | ||
|
||
## Set environment variables | ||
|
||
``` | ||
cp .env.template .env | ||
cp contracts/.env.template contracts/.env | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
The .env templates provide default values for devnet development, you should modify them for testnet deployment. | ||
|
||
## Dependencies | ||
|
||
You will need [foundry](https://book.getfoundry.sh/getting-started/installation) and [zap-pretty](https://github.com/maoueh/zap-pretty) and docker to run the examples below. | ||
|
@@ -19,6 +27,7 @@ You will also need to [install docker](https://docs.docker.com/get-docker/), and | |
make build-contracts | ||
``` | ||
|
||
|
||
## Running via make | ||
|
||
This simple session illustrates the basic flow of the AVS. The makefile commands are hardcoded for a single operator, but it's however easy to create new operator config files, and start more operators manually (see the actual commands that the makefile calls). | ||
|
@@ -114,4 +123,4 @@ When running on anvil, a typical log for the operator is | |
[2024-04-09 18:25:10.679 PDT] INFO (logging/zap_logger.go:49) Signed task response header accepted by aggregator. {"reply":false} | ||
``` | ||
|
||
The error `task 2 not initialized or already completed` is expected behavior. This is because the aggregator needs to setup its data structures before it can accept responses. But on a local anvil setup, the operator had time to receive the websocket event for the new task, square the number, sign the response, and send it to the aggregator process before the aggregator has finalized its setup. Hence, the operator retries sending the response 2 seconds later and it is accepted. | ||
The error `task 2 not initialized or already completed` is expected behavior. This is because the aggregator needs to setup its data structures before it can accept responses. But on a local anvil setup, the operator had time to receive the websocket event for the new task, square the number, sign the response, and send it to the aggregator process before the aggregator has finalized its setup. Hence, the operator retries sending the response 2 seconds later and it is accepted. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
AGGREGATOR_ADDR=0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 | ||
TASK_GENERATOR_ADDR=0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Th constructor-args are not necessary |
||||||
contract IncredibleSquaringDeployer is Script, Utils { | ||||||
// DEPLOYMENT CONSTANTS | ||||||
uint256 public constant QUORUM_THRESHOLD_PERCENTAGE = 100; | ||||||
uint32 public constant TASK_RESPONSE_WINDOW_BLOCK = 30; | ||||||
uint32 public constant TASK_DURATION_BLOCKS = 0; | ||||||
// TODO: right now hardcoding these (this address is anvil's default address 9) | ||||||
address public constant AGGREGATOR_ADDR = | ||||||
0xa0Ee7A142d267C1f36714E4a8F75612F20a79720; | ||||||
address public constant TASK_GENERATOR_ADDR = | ||||||
0xa0Ee7A142d267C1f36714E4a8F75612F20a79720; | ||||||
|
||||||
// ERC20 and Strategy: we need to deploy this erc20, create a strategy for it, and whitelist this strategy in the strategymanager | ||||||
|
||||||
ERC20Mock public erc20Mock; | ||||||
|
@@ -73,7 +67,12 @@ contract IncredibleSquaringDeployer is Script, Utils { | |||||
IIncredibleSquaringTaskManager | ||||||
public incredibleSquaringTaskManagerImplementation; | ||||||
|
||||||
address public aggregatorAddr; | ||||||
address public taskGeneratorAddr; | ||||||
|
||||||
function run() external { | ||||||
aggregatorAddr = vm.envAddress("AGGREGATOR_ADDR"); | ||||||
taskGeneratorAddr = vm.envAddress("TASK_GENERATOR_ADDR"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fetching of the environment variables should go in a setUp() function There was a problem hiding this comment. Choose a reason for hiding this commentThe 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");
} There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||||||
// Eigenlayer contracts | ||||||
string memory eigenlayerDeployedContracts = readOutput( | ||||||
"eigenlayer_deployment_output" | ||||||
|
@@ -387,8 +386,8 @@ contract IncredibleSquaringDeployer is Script, Utils { | |||||
incredibleSquaringTaskManager.initialize.selector, | ||||||
incredibleSquaringPauserReg, | ||||||
incredibleSquaringCommunityMultisig, | ||||||
AGGREGATOR_ADDR, | ||||||
TASK_GENERATOR_ADDR | ||||||
aggregatorAddr, | ||||||
taskGeneratorAddr | ||||||
) | ||||||
); | ||||||
|
||||||
|
There was a problem hiding this comment.
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