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

feat: slashing commands #205

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

shrimalmadhur
Copy link
Collaborator

Fixes # .

What Changed?

operatorAddress: gethcommon.HexToAddress(operatorAddress),
signerConfig: signerConfig,
delegationManagerAddress: gethcommon.HexToAddress(delegationManagerAddress),
allocationDelay: uint32(allocationDelayInt),

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an integer with architecture-dependent bit size from
strconv.Atoi
to a lower bit size type uint32 without an upper bound check.

Copilot Autofix AI 27 days ago

To fix the problem, we need to ensure that the integer value parsed from the string is within the bounds of uint32 before performing the conversion. This can be done by using strconv.ParseUint with a specified bit size of 32, which directly parses the string into a uint32 value, or by manually checking the bounds after parsing with strconv.Atoi.

The best way to fix this without changing existing functionality is to use strconv.ParseUint with a bit size of 32. This ensures that the parsed value is within the bounds of uint32 and avoids the need for additional bounds checking.

Suggested changeset 1
pkg/operator/allocations/initializedelay.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/pkg/operator/allocations/initializedelay.go b/pkg/operator/allocations/initializedelay.go
--- a/pkg/operator/allocations/initializedelay.go
+++ b/pkg/operator/allocations/initializedelay.go
@@ -159,5 +159,5 @@
 	allocationDelayString := c.Args().First()
-	allocationDelayInt, err := strconv.Atoi(allocationDelayString)
+	allocationDelayUint, err := strconv.ParseUint(allocationDelayString, 10, 32)
 	if err != nil {
-		return nil, eigenSdkUtils.WrapError("failed to convert allocation delay to int", err)
+		return nil, eigenSdkUtils.WrapError("failed to convert allocation delay to uint32", err)
 	}
@@ -204,3 +204,3 @@
 		delegationManagerAddress: gethcommon.HexToAddress(delegationManagerAddress),
-		allocationDelay:          uint32(allocationDelayInt),
+		allocationDelay:          uint32(allocationDelayUint),
 	}, nil
EOF
@@ -159,5 +159,5 @@
allocationDelayString := c.Args().First()
allocationDelayInt, err := strconv.Atoi(allocationDelayString)
allocationDelayUint, err := strconv.ParseUint(allocationDelayString, 10, 32)
if err != nil {
return nil, eigenSdkUtils.WrapError("failed to convert allocation delay to int", err)
return nil, eigenSdkUtils.WrapError("failed to convert allocation delay to uint32", err)
}
@@ -204,3 +204,3 @@
delegationManagerAddress: gethcommon.HexToAddress(delegationManagerAddress),
allocationDelay: uint32(allocationDelayInt),
allocationDelay: uint32(allocationDelayUint),
}, nil
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@shrimalmadhur shrimalmadhur force-pushed the madhur/slashing-allocations branch 3 times, most recently from c9de4de to dd1bfee Compare September 19, 2024 17:18
feat: add working cmds

remove unrelated changes

remove unrelated changes

unsigned tx

add some tests

comment

add readme

more allocations

basic show command

update with latest contracts

add more code

add more code

working slashing

%age and comments

update with latest contracts

Update show.go (#226)

updated to latest AM

updated to latest AM

updated to latest AM
@shrimalmadhur shrimalmadhur added this to the v1.0.0 milestone Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant