Skip to content

Commit

Permalink
update eigensdk
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur committed Oct 24, 2024
1 parent 3839e40 commit f79888f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Layr-Labs/eigenlayer-contracts v0.3.2-mainnet-rewards
github.com/Layr-Labs/eigenlayer-rewards-proofs v0.2.12
github.com/Layr-Labs/eigenpod-proofs-generation v0.0.14-stable.0.20240730152248-5c11a259293e
github.com/Layr-Labs/eigensdk-go v0.1.12-0.20241018155539-679b1c56366a
github.com/Layr-Labs/eigensdk-go v0.1.13-0.20241023023134-a285de543731
github.com/blang/semver/v4 v4.0.0
github.com/consensys/gnark-crypto v0.12.1
github.com/ethereum/go-ethereum v1.14.5
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/Layr-Labs/eigenlayer-rewards-proofs v0.2.12 h1:G5Q1SnLmFbEjhOkky3vIHk
github.com/Layr-Labs/eigenlayer-rewards-proofs v0.2.12/go.mod h1:OlJd1QjqEW53wfWG/lJyPCGvrXwWVEjPQsP4TV+gttQ=
github.com/Layr-Labs/eigenpod-proofs-generation v0.0.14-stable.0.20240730152248-5c11a259293e h1:DvW0/kWHV9mZsbH2KOjEHKTSIONNPUj6X05FJvUohy4=
github.com/Layr-Labs/eigenpod-proofs-generation v0.0.14-stable.0.20240730152248-5c11a259293e/go.mod h1:T7tYN8bTdca2pkMnz9G2+ZwXYWw5gWqQUIu4KLgC/vM=
github.com/Layr-Labs/eigensdk-go v0.1.12-0.20241018155539-679b1c56366a h1:/zU/lLtvpDHvhfDX2cEYYLern3UEoHX9KiBkrkunBG4=
github.com/Layr-Labs/eigensdk-go v0.1.12-0.20241018155539-679b1c56366a/go.mod h1:39gZE9jybgmpncEruNnY2G8OCHT0/3bOegQWYTbszd0=
github.com/Layr-Labs/eigensdk-go v0.1.13-0.20241023023134-a285de543731 h1:8F/wlaQoZG1+BcuP9cWhqKNbYgw4CphZFwp8SjMkW9A=
github.com/Layr-Labs/eigensdk-go v0.1.13-0.20241023023134-a285de543731/go.mod h1:aYdNURUhaqeYOS+Cq12TfSdPbjFfiLaHkxPdR4Exq/s=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8=
Expand Down Expand Up @@ -134,8 +134,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE=
github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v25.0.6+incompatible h1:5cPwbwriIcsua2REJe8HqQV+6WlWc1byg2QSXzBxBGg=
github.com/docker/docker v25.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
Expand Down
4 changes: 2 additions & 2 deletions pkg/operator/allocations/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"

"github.com/Layr-Labs/eigensdk-go/chainio/clients/elcontracts"
contractIAllocationManager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAllocationManager"
allocationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/AllocationManager"
"github.com/Layr-Labs/eigensdk-go/logging"
eigenSdkUtils "github.com/Layr-Labs/eigensdk-go/utils"

Expand Down Expand Up @@ -272,7 +272,7 @@ func getSharesFromMagnitude(totalScaledShare *big.Int, magnitude uint64) (*big.I
return shares, percentageSharesFloat
}

func getUniqueKey(strategyAddress gethcommon.Address, opSet contractIAllocationManager.OperatorSet) string {
func getUniqueKey(strategyAddress gethcommon.Address, opSet allocationmanager.OperatorSet) string {
return fmt.Sprintf("%s-%s-%d", strategyAddress.String(), opSet.Avs.String(), opSet.OperatorSetId)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/operator/allocations/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (

"github.com/Layr-Labs/eigenlayer-cli/pkg/types"

contractIAllocationManager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAllocationManager"
allocationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/AllocationManager"

gethcommon "github.com/ethereum/go-ethereum/common"
)

type BulkModifyAllocations struct {
Allocations []contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation
Allocations []allocationmanager.IAllocationManagerTypesMagnitudeAllocation
AllocatableMagnitudes map[gethcommon.Address]uint64
}

Expand Down
22 changes: 11 additions & 11 deletions pkg/operator/allocations/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"

"github.com/Layr-Labs/eigensdk-go/chainio/clients/elcontracts"
contractIAllocationManager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAllocationManager"
allocationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/AllocationManager"
"github.com/Layr-Labs/eigensdk-go/logging"
eigenSdkUtils "github.com/Layr-Labs/eigensdk-go/utils"

Expand Down Expand Up @@ -200,7 +200,7 @@ func generateAllocationsParams(
config *updateConfig,
logger logging.Logger,
) (*BulkModifyAllocations, error) {
allocations := make([]contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation, 0)
allocations := make([]allocationmanager.IAllocationManagerTypesMagnitudeAllocation, 0)
var allocatableMagnitudes map[gethcommon.Address]uint64

var err error
Expand All @@ -226,10 +226,10 @@ func generateAllocationsParams(
logger.Debugf("Bips to allocate: %d", config.bipsToAllocate)
magnitudeToUpdate := calculateMagnitudeToUpdate(magnitude[0], config.bipsToAllocate)
logger.Debugf("Magnitude to update: %d", magnitudeToUpdate)
malloc := contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation{
malloc := allocationmanager.IAllocationManagerTypesMagnitudeAllocation{
Strategy: config.strategyAddress,
ExpectedMaxMagnitude: magnitude[0],
OperatorSets: []contractIAllocationManager.OperatorSet{
OperatorSets: []allocationmanager.OperatorSet{
{
Avs: config.avsAddress,
OperatorSetId: config.operatorSetId,
Expand All @@ -255,7 +255,7 @@ func computeAllocations(
filePath string,
operatorAddress gethcommon.Address,
elReader elChainReader,
) ([]contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation, map[gethcommon.Address]uint64, error) {
) ([]allocationmanager.IAllocationManagerTypesMagnitudeAllocation, map[gethcommon.Address]uint64, error) {
allocations, err := parseAllocationsCSV(filePath)
if err != nil {
return nil, nil, eigenSdkUtils.WrapError("failed to parse allocations csv", err)
Expand Down Expand Up @@ -385,19 +385,19 @@ func parseAllocationsCSV(filePath string) ([]allocation, error) {
func convertAllocationsToMagnitudeAllocations(
allocations []allocation,
strategyTotalMagnitudes map[gethcommon.Address]uint64,
) []contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation {
magnitudeAllocations := make([]contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation, 0)
operatorSetsPerStragyMap := make(map[gethcommon.Address][]contractIAllocationManager.OperatorSet)
) []allocationmanager.IAllocationManagerTypesMagnitudeAllocation {
magnitudeAllocations := make([]allocationmanager.IAllocationManagerTypesMagnitudeAllocation, 0)
operatorSetsPerStragyMap := make(map[gethcommon.Address][]allocationmanager.OperatorSet)
magnitudeAllocationsPerStrategyMap := make(map[gethcommon.Address][]uint64)
for _, a := range allocations {
totalMag := strategyTotalMagnitudes[a.StrategyAddress]
magnitudeToUpdate := calculateMagnitudeToUpdate(totalMag, a.Bips)

operatorSets, ok := operatorSetsPerStragyMap[a.StrategyAddress]
if !ok {
operatorSets = make([]contractIAllocationManager.OperatorSet, 0)
operatorSets = make([]allocationmanager.OperatorSet, 0)
}
operatorSets = append(operatorSets, contractIAllocationManager.OperatorSet{
operatorSets = append(operatorSets, allocationmanager.OperatorSet{
Avs: a.AvsAddress,
OperatorSetId: a.OperatorSetId,
})
Expand All @@ -411,7 +411,7 @@ func convertAllocationsToMagnitudeAllocations(
for strategy, operatorSets := range operatorSetsPerStragyMap {
magnitudeAllocations = append(
magnitudeAllocations,
contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation{
allocationmanager.IAllocationManagerTypesMagnitudeAllocation{
Strategy: strategy,
ExpectedMaxMagnitude: strategyTotalMagnitudes[strategy],
OperatorSets: operatorSets,
Expand Down
14 changes: 7 additions & 7 deletions pkg/operator/allocations/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/Layr-Labs/eigenlayer-cli/pkg/internal/testutils"

contractIAllocationManager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAllocationManager"
allocationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/AllocationManager"
"github.com/Layr-Labs/eigensdk-go/logging"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down Expand Up @@ -98,11 +98,11 @@ func TestGenerateAllocationsParams(t *testing.T) {
},
expectError: false,
expectedAllocations: &BulkModifyAllocations{
Allocations: []contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation{
Allocations: []allocationmanager.IAllocationManagerTypesMagnitudeAllocation{
{
Strategy: gethcommon.HexToAddress(strategyAddress),
ExpectedMaxMagnitude: initialMagnitude,
OperatorSets: []contractIAllocationManager.OperatorSet{
OperatorSets: []allocationmanager.OperatorSet{
{
OperatorSetId: 1,
Avs: gethcommon.HexToAddress(avsAddress),
Expand All @@ -121,11 +121,11 @@ func TestGenerateAllocationsParams(t *testing.T) {
},
expectError: false,
expectedAllocations: &BulkModifyAllocations{
Allocations: []contractIAllocationManager.IAllocationManagerTypesMagnitudeAllocation{
Allocations: []allocationmanager.IAllocationManagerTypesMagnitudeAllocation{
{
Strategy: gethcommon.HexToAddress("0x49989b32351Eb9b8ab2d5623cF22E7F7C23e5630"),
ExpectedMaxMagnitude: initialMagnitude,
OperatorSets: []contractIAllocationManager.OperatorSet{
OperatorSets: []allocationmanager.OperatorSet{
{
OperatorSetId: 1,
Avs: gethcommon.HexToAddress("0x2222AAC0C980Cc029624b7ff55B88Bc6F63C538f"),
Expand All @@ -140,7 +140,7 @@ func TestGenerateAllocationsParams(t *testing.T) {
{
Strategy: gethcommon.HexToAddress("0x232326fE4F8C2f83E3eB2318F090557b7CD02222"),
ExpectedMaxMagnitude: initialMagnitude,
OperatorSets: []contractIAllocationManager.OperatorSet{
OperatorSets: []allocationmanager.OperatorSet{
{
OperatorSetId: 4,
Avs: gethcommon.HexToAddress("0x111116fE4F8C2f83E3eB2318F090557b7CD0BF76"),
Expand All @@ -151,7 +151,7 @@ func TestGenerateAllocationsParams(t *testing.T) {
{
Strategy: gethcommon.HexToAddress("0x545456fE4F8C2f83E3eB2318F090557b7CD04567"),
ExpectedMaxMagnitude: initialMagnitude,
OperatorSets: []contractIAllocationManager.OperatorSet{
OperatorSets: []allocationmanager.OperatorSet{
{
OperatorSetId: 5,
Avs: gethcommon.HexToAddress("0x111116fE4F8C2f83E3eB2318F090557b7CD0BF76"),
Expand Down

0 comments on commit f79888f

Please sign in to comment.