Commit graph

12 commits

Author SHA1 Message Date
Ahmad Kaouk
b737bc03ba
refactor: remove BSP and MSP operator sets (#323) 2025-11-28 14:01:28 +01:00
Ahmad Kaouk
470f5fc916
feat: update eigenlayer contracts to v1.8.0 (#270)
## Summary
- sync `contracts/lib/eigenlayer-contracts` to tag
`v1.8.0-testnet-final` and refresh `EIGENLAYER.md` with the new commit
reference
- update local/test deployment flows to deploy the upstream
`EigenStrategy`, feed it into `AllocationManager`/`StrategyManager`, and
adopt the revised `EigenPod` constructor
- drop the obsolete `AllocationManagerMock` stub and replace its usage
with targeted `vm.mockCall` stubs that return `slashOperator` share data
- adjust slasher unit tests to match the new ABI so DataHaven stays
aligned with EigenLayer 1.8 semantics

## Testing
- forge build
- forge test
2025-11-04 16:30:18 +01:00
Steve Degosserie
387c056912
fix: Resolve Foundry build errors and apply code formatting (#241)
## Summary

Fixes the CI build failure in the `task-ts-build` workflow caused by
Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's
context-specific import remappings.

## Problem

The Snowbridge submodule uses context-specific remappings (prefixed with
`:`) for its dependencies:
- `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts
- `lib/snowbridge/contracts/:prb/math/` → PRB Math library

Foundry v1.4.2's Solar linter doesn't understand these context-specific
remappings and fails with errors like:
```
error: file openzeppelin/utils/cryptography/MerkleProof.sol not found
error: file prb/math/src/UD60x18.sol not found
```

## Solution

Added global remappings that the linter can understand:
```toml
"openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/",
"prb/math/=lib/snowbridge/contracts/lib/prb-math/",
```

### Why This Works
- The linter can now resolve `openzeppelin/` and `prb/math/` imports
globally
- These global remappings take **lower precedence** than
context-specific ones during compilation
- The compiler still uses the context-specific remappings (with `:`)
when compiling Snowbridge contracts
- The linter uses the global remappings when checking all files

## Changes

### Commit 1: Add global remappings
- `contracts/foundry.toml`: Added 2 global remapping entries

### Commit 2: Apply forge fmt
- Applied automatic formatting via `forge fmt` to ensure code style
consistency
- Multi-line formatting for long import statements and function
signatures
- No functional changes - purely formatting updates

## Testing

 Local build succeeds with `forge build`
 No Snowbridge import resolution errors
 `forge fmt --check` passes with no formatting issues
 Only linting notes/warnings remain (not errors)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-20 11:20:59 +03:00
undercover-cactus
838103da4f
refactor: remove duplicate definition of _buildValidatorSet (#122)
The function `_buildValidatorSet` was defined twice. We move it in a new
utils lib.
2025-07-25 13:45:15 +02:00
Gonza Montiel
e9fc4f271f
Fix: 🏗️ Message encoding / decoding (#113)
## Summary of changes
- We decided to remove the topics and nonce from the massage encoding
since we don't use them (original commit:
ee2a3f2fd4).
- Besides, we already have a nonce at the Snowbridge message level
f4ab5c2b2e/operator/primitives/snowbridge/inbound-queue/src/v2/message.rs (L105)

- I had to recreate the static test for _encoding_ (happens in
[DataHavenSnowbridgeMessages.sol](d12d40634f/contracts/src/libraries/DataHavenSnowbridgeMessages.sol)
) / _decoding_ (happens in
[operator/primitives/bridge/src/lib.rs)](f9f9cc65fe/operator/primitives/bridge/src/lib.rs).
Now it matches the current structure. The idea is that now we can test
that we don't break the decoding in followup refactoring.
- Fixes a problem with EigenLayer validator addresses. In all our
contracts we were using `bytes32` to refer to a Solochain validator
address. But on our Substrate change we actually expect AccountId20, so
only 20 bytes. This was causing the decoding to fail.
- I opted for the minimal change that would be to take the right-most 20
bytes to send that to our chain. But we might want aswell to limit our
EigenLayer contracts to be only 20 bytes long. @ahmadkaouk showcase this
[here](92a34c273c)
- Adds a bash script to run the static test. The test will compile the
contracts, run the encoding test, compile the operator, and run the
decoding test. This saves a huge amount of time since we don't need to
run the full e2e setup. The way of running it is the following:
```bash
cd operator/test/scripts
./test_message_encoding.sh
```
- As a consequence of this PR, the execution relayer now works properly.

EDIT:

> [!IMPORTANT]
**We decided to use 20-byte addresses in our contracts**. So what is
stated above is not valid anymore.

The change implies that the mapping from Ethereum addresses to bytes32
addresses now it's a mapping as follows:


dd3ba99ac0/contracts/src/DataHavenServiceManager.sol (L51-L52)

I've updated helper functions, tests, etc to be compliant with this
change. The execution relayer and beefy relayer look stable now.

---------

Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
2025-07-16 07:38:58 +00:00
Facundo Farall
3fa11e8f91
chore: ⬆️ Update contract dependencies as submodules (#48) 2025-04-21 17:46:58 -03:00
Facundo Farall
5baa789f52
feat: Relay Validators operator set through Snowbridge (#39)
In this PR:
1. Implement application-specific functionalities in the
`DataHavenServiceManager` contract:
    1. Registering of 3 operator sets: Validators, BSPs and MSPs.
    2. Allowlisted sign up of operators.
    3. Integration with Snowbridge to send message of new validator set.
2. Basic testing of the above functionalities.
3. Tests now use less mocked contracts (especially from EigenLayer).
4. Refactor of `SignUpOperator` script, which now supports the three
kinds of Operator sets.
2025-04-16 15:49:35 +00:00
Facundo Farall
7e0f043d7f
feat: Add script to sign up operator to AVS (#37) 2025-04-11 20:54:20 -03:00
Facundo Farall
75e39ff98f
feat(contracts): 🚀 Implement deployment scripts for all contracts (#28)
In this PR:
1. Implement deployment script for all contracts involved. This includes
    1. EigenLayer core contracts.
    2. Snowbridge contracts.
    3. Our custom contracts to interact with both protocols.
4. Update README to document functionalities of `contracts` directory.

Future work:
1. Deployment of EigenLayer contracts should be conditional, as we
wouldn't deploy them in testnet or mainnet, but we would do it in an
internal stagenet.
5. Cleaning up unused smart contracts.
2025-04-03 14:06:32 -03:00
Facundo Farall
8e05572222
feat(contracts): Snowbridge and AVS contracts integration (#26)
This PR:
1. Adds some missing functionalities to connect the Snowbridge contracts
to the RewardsRegistry contract, through an Agent.
2. Adds a test suite for this integration, with a happy and unhappy
path. The former being with a valid and honest update of rewards, which
then a validator uses to claim them. The latter with a malicious message
that tries to update the rewards root, but it's not allowed.
2025-04-02 14:31:51 -03:00
Tobi Demeco
d8d792874c
feat: initial slasher implementation (#10)
This PR:
- Sets up the slasher infrastructure with the base functionality
required (in `ISlasher.sol`, `SlasherBase.sol` and
`SlasherBaseStorage.sol`) and adds the tests for it (in
`SlasherBase.t.sol`).
- Adds an implementation of a more complex slasher (in
`IVetoableSlasher.sol` and `VetoableSlasher.sol`) and tests for it (in
`VetoableSlasher.t.sol`).
- Modifies the `ServiceManagerBase` contract to use the new
`VetoableSlasher` contract to manage slashing.
- Updates mocks and tests to reflect the newly added functionality.

---------

Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-03-27 15:20:15 +00:00
Facundo Farall
a78cb3ce41
feat: 🏗️ Setup basic AVS contract (#4)
* forge install: eigenlayer-contracts

v1.1.1

* fix: 🗑️ Cleanup dependencies from init

* forge install: forge-std

v1.9.6

* forge install: openzeppelin-contracts

v5.2.0

* forge install: openzeppelin-contracts-upgradeable

v5.2.0

* chore: 🙈 Ignore IDE directories

* chore: 🏗️ Modify config in `foundry.toml` based on EigenLayer's example

* feat: 🚧 Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware

* feat: 🚧 Naive implementation of missing functions replacing AVSDirectory for AllocationManager

* docs: 📝 Add first draft of contracts diagram

* refactor: 🔥 Remove unnecessary functions and refactor most important ones to the top

* docs: 📝 Update contracts diagram

* docs: 📝 Update contracts diagram

* feat:  Implement basic mocked Service Manager

* test: 🚧 Cleanup and start testing setup for mock ServiceManagerBase

* test: 🤡 Add mocks to setup tests

* test: 🤡 Add deployment of RewardsCoordinator

* test:  Deploy EigenLayer mocked contracts in test

* revert:  Remove proglematic submodules

* revert:  Remove forge-std dependency

* forge install: forge-std

v1.9.6

* forge install: openzeppelin-contracts

v5.2.0

* forge install: openzeppelin-contracts-upgradeable

v5.2.0

* forge install: eigenlayer-contracts

v1.3.0

* revert:  Remove faulty dependency

* forge install: eigenlayer-contracts

v1.3.0

* revert:  remove added dependency

* forge install: eigenlayer-contracts

v1.3.0

* revert:  Remove openzeppelin dependencies from root project

* test: 🚧 Make test run after dependency mayhem

* test:  Add passing createOperatorSets test with empty params

* style: 🎨 Apply forge fmt
2025-03-11 17:16:16 -03:00