From 6c1434be9aa02ad41513002006f6c053202304b1 Mon Sep 17 00:00:00 2001 From: afkbyte Date: Mon, 23 Dec 2024 18:37:16 -0500 Subject: [PATCH] updated tests --- chainio/clients/elcontracts/writer_test.go | 19 +++++++++++++++---- types/operator_test.go | 16 ++++++++-------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/chainio/clients/elcontracts/writer_test.go b/chainio/clients/elcontracts/writer_test.go index 0f07b259..955381de 100644 --- a/chainio/clients/elcontracts/writer_test.go +++ b/chainio/clients/elcontracts/writer_test.go @@ -71,7 +71,7 @@ func TestRegisterOperator(t *testing.T) { types.Operator{ Address: fundedAccount, DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "https://madhur-test-public.s3.us-east-2.amazonaws.com/metadata.json", } @@ -98,7 +98,7 @@ func TestRegisterOperator(t *testing.T) { types.Operator{ Address: operatorAddress, DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "https://madhur-test-public.s3.us-east-2.amazonaws.com/metadata.json", } @@ -119,7 +119,7 @@ func TestChainWriter(t *testing.T) { operatorModified := types.Operator{ Address: walletModifiedAddress.Hex(), DelegationApproverAddress: walletModifiedAddress.Hex(), - StakerOptOutWindowBlocks: 101, + AllocationDelay: 101, MetadataUrl: "eigensdk-go", } @@ -129,7 +129,18 @@ func TestChainWriter(t *testing.T) { }) t.Run("update metadata URI", func(t *testing.T) { - receipt, err := clients.ElChainWriter.UpdateMetadataURI(context.Background(), "https://0.0.0.0", true) + walletModified, err := crypto.HexToECDSA("2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6") + assert.NoError(t, err) + walletModifiedAddress := crypto.PubkeyToAddress(walletModified.PublicKey) + + operator := types.Operator{ + Address: walletModifiedAddress.Hex(), + DelegationApproverAddress: walletModifiedAddress.Hex(), + AllocationDelay: 101, + MetadataUrl: "eigensdk-go", + } + + receipt, err := clients.ElChainWriter.UpdateMetadataURI(context.Background(), operator, "https://0.0.0.0", true) assert.NoError(t, err) assert.True(t, receipt.Status == 1) }) diff --git a/types/operator_test.go b/types/operator_test.go index 45604354..b081e02a 100644 --- a/types/operator_test.go +++ b/types/operator_test.go @@ -23,7 +23,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142", DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "https://madhur-test-public.s3.us-east-2.amazonaws.com/metadata.json", }, wantErr: false, @@ -33,7 +33,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142", DelegationApproverAddress: ZeroAddress, - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "https://madhur-test-public.s3.us-east-2.amazonaws.com/metadata.json", }, wantErr: false, @@ -43,7 +43,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142", DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "", }, wantErr: true, @@ -54,7 +54,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142", DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "http://localhost:8080/metadata.json", }, wantErr: true, @@ -65,7 +65,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142", DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "http://127.0.0.1:8080/metadata.json", }, wantErr: true, @@ -76,7 +76,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142", DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "https://example.com/metadata.json", }, wantErr: true, @@ -90,7 +90,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xa", DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "https://example.com/metadata.json", }, wantErr: true, @@ -101,7 +101,7 @@ func TestOperatorValidate(t *testing.T) { operator: Operator{ Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142", DelegationApproverAddress: "0x12", - StakerOptOutWindowBlocks: 100, + AllocationDelay: 100, MetadataUrl: "https://example.com/metadata.json", }, wantErr: true,