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

chore: updates for live testnet deployment #52

Merged
merged 16 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
387 changes: 205 additions & 182 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ structopt = "0.3.26"
tokio = { version = "1.39", default-features = false, features = ["full"] }
tokio-retry = "0.3.0"
tracing-subscriber = { version = "0.3", features = ["parking_lot", "env-filter"] }
thiserror = "2.0.3"
eigensdk = { version = "0.1.0", features = ["full", "utils", "types"] }
alloy-primitives = "0.7.2"
alloy-provider = { version = "0.1", default-features = false, features = ["reqwest", "ws"] }
alloy-sol-types = "0.7.2"
alloy-signer-local = "0.1"
alloy-signer = "0.1"
alloy-contract = "0.1"
lock_api = "0.4.12"
parking_lot = "0.12.3"
Expand Down
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ fn main() {
"./contracts/lib/forge-std",
"./contracts",
];

blueprint_build_utils::build_contracts(contract_dirs);
}
3 changes: 2 additions & 1 deletion contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.20"
solc_version = "0.8.20"
via_ir = true
46 changes: 46 additions & 0 deletions contracts/script/InitializeContracts.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import {Script} from "forge-std/Script.sol";
import {TangleServiceManager} from "../src/TangleServiceManager.sol";
import {ECDSAStakeRegistry} from "../src/ECDSAStakeRegistry.sol";
import {StrategyParams, Quorum} from "../src/ECDSAStakeRegistryStorage.sol";
import {IStrategy} from "../src/interfaces/vendored/IStrategy.sol";

contract InitializeContracts is Script {
function setUp() public {}

function run() public {
// Load private key from environment
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

address tangleServiceManagerAddr = 0x5aBc6138DD384a1b059f1fcBaD73E03c31170C14;
address ecdsaStakeRegistryAddr = 0x131b803Bece581281A2E33d7E693DfA70aB85D06;

// Initialize TangleServiceManager
TangleServiceManager tangleServiceManager = TangleServiceManager(tangleServiceManagerAddr);
tangleServiceManager.initialize(msg.sender);

// Initialize ECDSAStakeRegistry
ECDSAStakeRegistry ecdsaStakeRegistry = ECDSAStakeRegistry(ecdsaStakeRegistryAddr);

// Create a quorum configuration with the WETH strategy
IStrategy[] memory strategies = new IStrategy[](1);
uint96[] memory weights = new uint96[](1);

// WETH Strategy on Holesky
strategies[0] = IStrategy(0x80528D6e9A2BAbFc766965E0E26d5aB08D9CFaF9);
weights[0] = 10000; // 100% weight

StrategyParams[] memory strategyParams = new StrategyParams[](1);
strategyParams[0] = StrategyParams(strategies[0], weights[0]);

Quorum memory quorum = Quorum(strategyParams);

// Initialize with a 50% threshold (5000 basis points)
ecdsaStakeRegistry.initialize(tangleServiceManagerAddr, 5000, quorum);

vm.stopBroadcast();
}
}
37 changes: 0 additions & 37 deletions contracts/src/HyperlaneDispatcher.sol

This file was deleted.

36 changes: 0 additions & 36 deletions contracts/src/TangleHyperlaneReceiver.sol

This file was deleted.

17 changes: 8 additions & 9 deletions contracts/src/TangleServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import {IAVSDirectory} from "./interfaces/vendored/IAVSDirectory.sol";
import {ISlasher} from "./interfaces/vendored/ISlasher.sol";
import {ECDSAServiceManagerBase} from "./ECDSAServiceManagerBase.sol";
import {IRemoteChallenger} from "./interfaces/IRemoteChallenger.sol";
import {HyperlaneDispatcher} from "./HyperlaneDispatcher.sol";

contract TangleServiceManager is ECDSAServiceManagerBase, HyperlaneDispatcher {
contract TangleServiceManager is ECDSAServiceManagerBase {
// ============ Libraries ============

using EnumerableMapEnrollment for EnumerableMapEnrollment.AddressToEnrollmentMap;
Expand Down Expand Up @@ -69,12 +68,14 @@ contract TangleServiceManager is ECDSAServiceManagerBase, HyperlaneDispatcher {
constructor(
address _avsDirectory,
address _stakeRegistry,
address _paymentCoordinator,
address _delegationManager,
address _mailbox
address _delegationManager
)
ECDSAServiceManagerBase(_avsDirectory, _stakeRegistry, _paymentCoordinator, _delegationManager)
HyperlaneDispatcher(_mailbox)
ECDSAServiceManagerBase(
_avsDirectory,
_stakeRegistry,
address(0), // payment coordinator is not used
_delegationManager
)
{}

/**
Expand Down Expand Up @@ -255,7 +256,5 @@ contract TangleServiceManager is ECDSAServiceManagerBase, HyperlaneDispatcher {
operatorKeys[msg.sender] = OperatorKeys({validatorKeys: _validatorKeys, accountKey: _accountKey});

emit OperatorKeysSet(msg.sender, _validatorKeys, _accountKey);

this._dispatchToTangle(msg.sender, _validatorKeys, _accountKey);
}
}
2 changes: 1 addition & 1 deletion contracts/src/test/TestTangleServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract TestTangleServiceManager is TangleServiceManager {
address _paymentCoordinator,
address _delegationManager,
address _mailbox
) TangleServiceManager(_avsDirectory, _stakeRegistry, _paymentCoordinator, _delegationManager, _mailbox) {}
) TangleServiceManager(_avsDirectory, _stakeRegistry, _delegationManager) {}

function mockSetUnenrolled(address operator, address challenger) external {
enrolledChallengers[operator].set(address(challenger), Enrollment(EnrollmentStatus.UNENROLLED, 0));
Expand Down
53 changes: 53 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use thiserror::Error;

/// Represents errors that can occur in the Tangle AVS
#[derive(Debug, Error)]
pub enum Error {
#[error("EigenLayer registration error: {0}")]
EigenLayerRegistrationError(String),

#[error("Tangle registration error: {0}")]
TangleRegistrationError(String),

#[error("Signer error: {0}")]
SignerError(String),

#[error("Transaction error: {0}")]
TransactionError(String),

#[error("Other error: {0}")]
OtherError(String),

#[error("Invalid URL error: {0}")]
InvalidUrl(String),

#[error("HTTP request error: {0}")]
HttpRequestError(String),

#[error("JSON error: {0}")]
JsonError(String),

#[error("Invalid session key length")]
SessionKeyError,

#[error("Environment variable error: {0}")]
EnvironmentVariableError(String),

#[error("Job error: {0}")]
JobError(String),

#[error("Command error: {0}")]
CommandError(String),

#[error("UTF-8 conversion error: {0}")]
Utf8Error(String),

#[error("IO error: {0}")]
IoError(String),
}

impl From<String> for Error {
fn from(s: String) -> Self {
Error::OtherError(s)
}
}
Loading
Loading