Skip to content

Commit

Permalink
minor fixes, use single txmgr, add testnet keys op setup
Browse files Browse the repository at this point in the history
  • Loading branch information
vanderian committed Apr 9, 2024
1 parent 206fcf4 commit 6056687
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 47 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ SKIP_WASM_BUILD=1

ETH_RPC_URL=http://localhost:8545
ETH_WS_URL=ws://localhost:8545
SUBSTRATE_RPC_URL=wss://kusama-archive.mangata.online:443
SUBSTRATE_RPC_URL=wss://collator-02-ws-rollup-testnet.mangata.online:443
AVS_RPC_URL=http://localhost:8090
AVS_SERVER_IP_PORT_ADDRESS=localhost:8090

CHAIN_ID=31337
AVS_REGISTRY_COORDINATOR_ADDR=0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9
TESTNET=true
AVS_REGISTRY_COORDINATOR_ADDR=0x851356ae760d987E095750cCeb3bC6014560891C

AVS_KICK_PERIOD=5
AVS_UPDATE_STAKE_PERIOD=10
Expand Down Expand Up @@ -66,17 +65,19 @@ start-avs-aggregator: ##
--ecdsa-key-file tests/keys/aggregator.ecdsa.key.json \
2>&1 | zap-pretty

# start-operator: ##
# RUST_LOG=avs_finalizer=debug cargo run --manifest-path=avs-finalizer/Cargo.toml -- \
# --bls-key-file tests/keys/test.bls.key.json \
# --ecdsa-key-file tests/keys/test.ecdsa.key.json

start-avs-finalizer: ##
RUST_LOG=avs_finalizer=debug cargo run --manifest-path=avs-finalizer/Cargo.toml -- \
--ecdsa-ephemeral-key \
--bls-ephemeral-key \
--testnet \
--stake 100

start-avs-finalizer-testkeys: ##
RUST_LOG=avs_finalizer=debug cargo run --manifest-path=avs-finalizer/Cargo.toml -- \
--ecdsa-key-file tests/keys/test.ecdsa.key.json \
--bls-key-file tests/keys/test.bls.key.json \
--opt-in-at-startup

start-blockscout: ## starts blockscout
cd ops/blockscout-docker-compose && docker-compose up -d

Expand Down
2 changes: 1 addition & 1 deletion avs-aggregator/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
- CHAIN_ID=31337
- AVS_SERVER_IP_PORT_ADDRESS=0.0.0.0:8090
- AVS_BLOCK_VALIDATION_PERIOD=${AVS_BLOCK_VALIDATION_PERIOD:-5}
- AVS_REGISTRY_COORDINATOR_ADDR=0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9
- AVS_REGISTRY_COORDINATOR_ADDR=0x851356ae760d987E095750cCeb3bC6014560891C
- ECDSA_KEY_JSON={"address":"a0ee7a142d267c1f36714e4a8f75612f20a79720","crypto":{"cipher":"aes-128-ctr","ciphertext":"b0f6f8e3ba33f0b382b080de6661d827181de480f1a4f94bc20d66cb3d585907","cipherparams":{"iv":"4e3f9a8ca6ef8d1cd408e8aaae3c22d2"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"c8f9f8cc03913e09cee7e1fd68732fac327576203ab277d740270f1dea82ee7e"},"mac":"353d65850b20d5fdb90ca2385c52e5b57662cb1d906fd58143f20a7720723cf6"},"id":"d3036cc7-d068-4f2f-9667-60aaca660e61","version":3}
- TESTNET=true
- ECDSA_EPHEMERAL_KEY=true
Expand Down
12 changes: 1 addition & 11 deletions avs-aggregator/core/chainio/eth_rpc.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package chainio

import (
"errors"

"github.com/Layr-Labs/eigensdk-go/chainio/clients"
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
"github.com/Layr-Labs/eigensdk-go/chainio/clients/wallet"
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr"
sdklogging "github.com/Layr-Labs/eigensdk-go/logging"
"github.com/Layr-Labs/eigensdk-go/signerv2"
"github.com/Layr-Labs/eigensdk-go/types"

"github.com/ethereum/go-ethereum/common"
)
Expand Down Expand Up @@ -64,12 +59,7 @@ func NewEthRpc(
return nil, err
}

pkWallet, err := wallet.NewPrivateKeyWallet(clients.EthHttpClient, signer, address, logger)
if err != nil {
return nil, types.WrapError(errors.New("Failed to create transaction sender"), err)
}
txMgr := txmgr.NewSimpleTxManager(pkWallet, clients.EthHttpClient, logger, address)
avsWriter, err := NewAvsWriter(txMgr, registryAddr, clients.EthHttpClient, logger)
avsWriter, err := NewAvsWriter(clients.TxMgr, registryAddr, clients.EthHttpClient, logger)
if err != nil {
logger.Error("Cannot create AvsWriter", "err", err)
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion avs-aggregator/core/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
Name: "avs-block-validation-period",
Usage: "Period of block finalization per block produced on mangata",
Required: false,
Value: 2,
Value: 4,
EnvVar: "AVS_BLOCK_VALIDATION_PERIOD",
}
AvsKickPeriodFlag = cli.IntFlag{
Expand Down
2 changes: 1 addition & 1 deletion avs-eigensdk-go
2 changes: 1 addition & 1 deletion avs-finalizer/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- CHAIN_ID=31337
- SUBSTRATE_RPC_URL=${SUBSTRATE_RPC_URL:-ws://collator-01:9944}
- AVS_RPC_URL=${AVS_RPC_URL:-http://avs-aggregator:8090}
- AVS_REGISTRY_COORDINATOR_ADDR=0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9
- AVS_REGISTRY_COORDINATOR_ADDR=0x851356ae760d987E095750cCeb3bC6014560891C
- TESTNET=true
- ECDSA_EPHEMERAL_KEY=true
- BLS_EPHEMERAL_KEY=true
Expand Down
2 changes: 1 addition & 1 deletion avs-finalizer/src/chainio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) async fn setup_deposits(
) -> eyre::Result<()> {
let provider: Provider<Http> = MW::try_from(eth_rpc_url)?;
let anvil = LocalWallet::from_str(
"0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
)?
.with_chain_id(Chain::AnvilHardhat as u64);
let op_address = operator.address();
Expand Down
4 changes: 2 additions & 2 deletions avs-finalizer/tests/DockerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class DockerUtils{
CHAIN_ID:"31337" ,
SUBSTRATE_RPC_URL:"ws://0.0.0.0:9946" ,
AVS_RPC_URL:"http://0.0.0.0:8090" ,
AVS_REGISTRY_COORDINATOR_ADDR:"0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9" ,
AVS_REGISTRY_COORDINATOR_ADDR:"0x851356ae760d987E095750cCeb3bC6014560891C" ,
TESTNET:"true",
STAKE:"32",
}
Expand All @@ -71,7 +71,7 @@ export class DockerUtils{
CHAIN_ID:"31337" ,
SUBSTRATE_RPC_URL:"wss://kusama-archive.mangata.online:443" ,
AVS_RPC_URL:"http://0.0.0.0:8090" ,
AVS_REGISTRY_COORDINATOR_ADDR:"0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9" ,
AVS_REGISTRY_COORDINATOR_ADDR:"0x851356ae760d987E095750cCeb3bC6014560891C" ,
TESTNET:"true",
STAKE:"90",
}
Expand Down
2 changes: 1 addition & 1 deletion avs-finalizer/tests/avs.finalizer.optout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
// @ts-ignore
import registryCoordinator from "./abis/RegistryCoordinator.json";
import {waitForOperatorDeRegistered, waitForOperatorRegistered} from "./operatorUtilities";
const registryCoordinatorAddress = '0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9'
const registryCoordinatorAddress = '0x851356ae760d987E095750cCeb3bC6014560891C'


jest.setTimeout(1500000);
Expand Down
2 changes: 1 addition & 1 deletion avs-finalizer/tests/operatorUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import registryCoordinator from "./abis/RegistryCoordinator.json";
// @ts-ignore
import finalizerTaskManager from "./abis/FinalizerTaskManager.json";
import {DockerUtils} from "./DockerUtils";
export const registryCoordinatorAddress = '0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9'
export const registryCoordinatorAddress = '0x851356ae760d987E095750cCeb3bC6014560891C'
export const taskManagerAddress = "0x9E545E3C0baAB3E08CdfD552C960A1050f373042";

export async function waitForOperatorRegistered(publicClient: PublicClient) {
Expand Down
19 changes: 19 additions & 0 deletions contracts/script/0_AnvilSetup.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";

import "@eigenlayer/contracts/permissions/PauserRegistry.sol";
import "@eigenlayer/contracts/core/StrategyManager.sol";
import "@eigenlayer/contracts/core/DelegationManager.sol";
import {StrategyBaseTVLLimits} from "@eigenlayer/contracts/strategies/StrategyBaseTVLLimits.sol";

import "../src/ERC20Mock.sol";
Expand Down Expand Up @@ -32,6 +33,8 @@ contract AnvilSetup is Script, Utils, Test {
string memory eigenlayerDeployedContracts = readInput(_EIGEN_DEPLOYMENT_PATH);
StrategyManager strategyManager =
StrategyManager(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.strategyManager"));
DelegationManager delegation =
DelegationManager(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.delegationManager"));

ProxyAdmin eigenLayerProxyAdmin =
ProxyAdmin(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.eigenLayerProxyAdmin"));
Expand All @@ -51,6 +54,10 @@ contract AnvilSetup is Script, Utils, Test {
require(configChainId == _CHAIN_ID, "You are on the wrong chain for this config, only Anvil 31337 allowed");
require(configChainId == currentChainId, "You are on the wrong chain for this config");

// tests/keys/test.ecdsa.key.json
uint256 operatorPrivateKey = vm.parseUint("0x113d0ef74250eab659fd828e62a33ca72fcb22948897b2ed66b1fa695a8b9313");
address operatorAddress = vm.addr(operatorPrivateKey);

vm.startBroadcast();

erc20Mock = new ERC20Mock();
Expand All @@ -77,7 +84,19 @@ contract AnvilSetup is Script, Utils, Test {
strats[0] = erc20MockStrategy;
strategyManager.addStrategiesToDepositWhitelist(strats, thirdPartyTransfersForbidden);

erc20Mock.mint(operatorAddress, 100);
operatorAddress.call{value: 100 ether}("");

vm.stopBroadcast();

// setup deposit for tests/keys/test.ecdsa.key.json
vm.startBroadcast(operatorPrivateKey);
erc20Mock.approve(address(strategyManager), 100);
strategyManager.depositIntoStrategy(erc20MockStrategy, erc20Mock, 100);
IDelegationManager.OperatorDetails memory op = IDelegationManager.OperatorDetails(operatorAddress, address(0), 0);
delegation.registerAsOperator(op, "");
vm.stopBroadcast();

_writeOutput();
}

Expand Down
30 changes: 15 additions & 15 deletions contracts/script/output/31337/avs_deployment_output.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"addresses": {
"avsPauseReg": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
"avsProxyAdmin": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
"blsApkRegistry": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
"blsApkRegistryImplementation": "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
"indexRegistry": "0x851356ae760d987E095750cCeb3bC6014560891C",
"indexRegistryImplementation": "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
"registryCoordinator": "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
"registryCoordinatorImplementation": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf",
"serviceManager": "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
"serviceManagerImplementation": "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00",
"stakeRegistry": "0xf5059a5D33d5853360D16C683c16e67980206f36",
"stakeRegistryImplementation": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
"taksManagerImplementation": "0x809d550fca64d94Bd9F66E60752A544199cfAC3D",
"taskManager": "0x9E545E3C0baAB3E08CdfD552C960A1050f373042"
"avsPauseReg": "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
"avsProxyAdmin": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
"blsApkRegistry": "0xf5059a5D33d5853360D16C683c16e67980206f36",
"blsApkRegistryImplementation": "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
"indexRegistry": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
"indexRegistryImplementation": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf",
"registryCoordinator": "0x851356ae760d987E095750cCeb3bC6014560891C",
"registryCoordinatorImplementation": "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00",
"serviceManager": "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
"serviceManagerImplementation": "0x809d550fca64d94Bd9F66E60752A544199cfAC3D",
"stakeRegistry": "0x998abeb3E57409262aE5b751f60747921B33613E",
"stakeRegistryImplementation": "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
"taksManagerImplementation": "0x1291Be112d480055DaFd8a610b7d1e203891C274",
"taskManager": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8"
},
"chainInfo": {
"chainId": 31337,
"deploymentBlock": 15
"deploymentBlock": 22
},
"permissions": {
"aggregator": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
Expand Down
2 changes: 1 addition & 1 deletion contracts/script/output/31337/strategy_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
},
"chainInfo": {
"chainId": 31337,
"deploymentBlock": 11
"deploymentBlock": 13
}
}
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,7 @@ github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c=
github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY=
github.com/prysmaticlabs/gohashtree v0.0.1-alpha.0.20220714111606-acbb2962fb48/go.mod h1:4pWaT30XoEx1j8KNJf3TV+E3mQkaufn7mf+jRNb/Fuk=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
Expand Down
2 changes: 1 addition & 1 deletion ops/helmfiles/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
SUBSTRATE_RPC_URL: wss://kusama-archive.mangata.online:443
# contracts
CHAIN_ID: '"31337"'
AVS_REGISTRY_COORDINATOR_ADDR: 0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9
AVS_REGISTRY_COORDINATOR_ADDR: 0x851356ae760d987E095750cCeb3bC6014560891C
# AVS
AVS_SERVER_IP_PORT_ADDRESS: 0.0.0.0:8090
AVS_BLOCK_VALIDATION_PERIOD: '"5"'
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/integration/eigenlayer-deployed-anvil-state.json

Large diffs are not rendered by default.

0 comments on commit 6056687

Please sign in to comment.