Skip to content

Commit

Permalink
Use NDC for VerifyWithdrawalCredentials and StartCheckpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
loki-sama committed Aug 9, 2024
1 parent 3707416 commit 4e87278
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
15 changes: 14 additions & 1 deletion cli/core/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,22 @@ func StartCheckpoint(ctx context.Context, eigenpodAddress string, ownerPrivateKe
return 0, fmt.Errorf("failed to reach eigenpod: %w", err)
}

// Retrieve the EigenPod owner (NDC) address
eigenPodOwner, err := eigenPod.PodOwner(nil)

if err != nil {
return 0, fmt.Errorf("failed to get EigenPod owner (NDC): %w", err)
}

// Create a new NodeDelegator instance (it has same StartCheckpoint fn)
ndc, err := onchain.NewEigenPod(eigenPodOwner, eth)
if err != nil {
return 0, fmt.Errorf("failed to create NodeDelegator instance: %w", err)
}

revertIfNoBalance := !forceCheckpoint

txn, err := eigenPod.StartCheckpoint(ownerAccount.TransactionOptions, revertIfNoBalance)
txn, err := ndc.StartCheckpoint(ownerAccount.TransactionOptions, revertIfNoBalance)
if err != nil {
if !forceCheckpoint {
return 0, fmt.Errorf("failed to start checkpoint (try running again with `--force`): %w", err)
Expand Down
16 changes: 15 additions & 1 deletion cli/core/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,21 @@ func SubmitValidatorProof(ctx context.Context, owner, eigenpodAddress string, ch

func SubmitValidatorProofChunk(ctx context.Context, ownerAccount *Owner, eigenPod *onchain.EigenPod, chainId *big.Int, eth *ethclient.Client, indices []*big.Int, validatorFields [][][32]byte, stateRootProofs *eigenpodproofs.StateRootProof, validatorFieldsProofs [][]byte, oracleBeaconTimesetamp uint64) (*types.Transaction, error) {
color.Green("submitting onchain...")
txn, err := eigenPod.VerifyWithdrawalCredentials(

// Retrieve the EigenPod owner (NDC) address
eigenPodOwner, err := eigenPod.PodOwner(nil)

if err != nil {
return nil, fmt.Errorf("failed to get EigenPod owner (NDC): %w", err)
}

// Create a new NodeDelegator instance (it has same VerifyWithdrawalCredentials fn)
ndc, err := onchain.NewEigenPod(eigenPodOwner, eth)
if err != nil {
return nil, fmt.Errorf("failed to create NodeDelegator instance: %w", err)
}

txn, err := ndc.VerifyWithdrawalCredentials(
ownerAccount.TransactionOptions,
oracleBeaconTimesetamp,
onchain.BeaconChainProofsStateRootProof{
Expand Down

0 comments on commit 4e87278

Please sign in to comment.