Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afkbyte committed Dec 23, 2024
1 parent 5b7789c commit 6c1434b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
19 changes: 15 additions & 4 deletions chainio/clients/elcontracts/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

Expand All @@ -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",
}

Expand All @@ -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",
}

Expand All @@ -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)
})
Expand Down
16 changes: 8 additions & 8 deletions types/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -43,7 +43,7 @@ func TestOperatorValidate(t *testing.T) {
operator: Operator{
Address: "0xd5e099c71b797516c10ed0f0d895f429c2781142",
DelegationApproverAddress: "0xd5e099c71b797516c10ed0f0d895f429c2781142",
StakerOptOutWindowBlocks: 100,
AllocationDelay: 100,
MetadataUrl: "",
},
wantErr: true,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 6c1434b

Please sign in to comment.