From 4abb7596663805553902fe65b6900d6364b91979 Mon Sep 17 00:00:00 2001 From: Matheus Junior Date: Mon, 1 Jan 2024 16:49:41 -0300 Subject: [PATCH] refactor pkgs --- beacon_constants.go | 2 +- main.go => cmd/main.go | 7 ++++--- eigen_pod_proofs.go | 2 +- generate_balance_update_proof.go | 2 +- generate_validator_proof.go | 2 +- generate_withdrawal_fields_proof.go | 2 +- merkle_util_test.go | 2 +- merkle_utils.go | 2 +- proof_utils.go | 2 +- proofs.go | 2 +- prove_validator.go | 2 +- prove_withdrawal.go | 2 +- utils.go | 2 +- 13 files changed, 16 insertions(+), 15 deletions(-) rename main.go => cmd/main.go (75%) diff --git a/beacon_constants.go b/beacon_constants.go index 05fda39a..f3c7fe1a 100644 --- a/beacon_constants.go +++ b/beacon_constants.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs const slotsPerHistoricalRoot = uint64(8192) diff --git a/main.go b/cmd/main.go similarity index 75% rename from main.go rename to cmd/main.go index dc33655f..4b1a413a 100644 --- a/main.go +++ b/cmd/main.go @@ -3,6 +3,7 @@ package main import ( "flag" + eigenpodproofs "github.com/Layr-Labs/eigenpod-proofs-generation" "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) @@ -42,13 +43,13 @@ func main() { // Handling commands based on the 'command' flag switch *command { case "ValidatorFieldsProof": - GenerateValidatorFieldsProof(*oracleBlockHeaderFile, *stateFile, *validatorIndex, *chainID, *outputFile) + eigenpodproofs.GenerateValidatorFieldsProof(*oracleBlockHeaderFile, *stateFile, *validatorIndex, *chainID, *outputFile) case "WithdrawalFieldsProof": - GenerateWithdrawalFieldsProof(*oracleBlockHeaderFile, *stateFile, *historicalSummaryStateFile, *blockHeaderFile, *blockBodyFile, *validatorIndex, *withdrawalIndex, *historicalSummariesIndex, *blockHeaderIndex, *chainID, *outputFile) + eigenpodproofs.GenerateWithdrawalFieldsProof(*oracleBlockHeaderFile, *stateFile, *historicalSummaryStateFile, *blockHeaderFile, *blockBodyFile, *validatorIndex, *withdrawalIndex, *historicalSummariesIndex, *blockHeaderIndex, *chainID, *outputFile) case "BalanceUpdateProof": - GenerateBalanceUpdateProof(*oracleBlockHeaderFile, *stateFile, *validatorIndex, *chainID, *outputFile) + eigenpodproofs.GenerateBalanceUpdateProof(*oracleBlockHeaderFile, *stateFile, *validatorIndex, *chainID, *outputFile) default: log.Debug().Str("Unknown command:", *command) diff --git a/eigen_pod_proofs.go b/eigen_pod_proofs.go index 7cf57bc6..49eb2880 100644 --- a/eigen_pod_proofs.go +++ b/eigen_pod_proofs.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "encoding/json" diff --git a/generate_balance_update_proof.go b/generate_balance_update_proof.go index 19233754..0995eb94 100644 --- a/generate_balance_update_proof.go +++ b/generate_balance_update_proof.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "encoding/hex" diff --git a/generate_validator_proof.go b/generate_validator_proof.go index 03d32c24..5885df5b 100644 --- a/generate_validator_proof.go +++ b/generate_validator_proof.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "encoding/hex" diff --git a/generate_withdrawal_fields_proof.go b/generate_withdrawal_fields_proof.go index 7742c53a..c914df2d 100644 --- a/generate_withdrawal_fields_proof.go +++ b/generate_withdrawal_fields_proof.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "encoding/hex" diff --git a/merkle_util_test.go b/merkle_util_test.go index 212b8b9c..21f2569b 100644 --- a/merkle_util_test.go +++ b/merkle_util_test.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "encoding/binary" diff --git a/merkle_utils.go b/merkle_utils.go index 0f9ac12d..7486e1c1 100644 --- a/merkle_utils.go +++ b/merkle_utils.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs //Adapted from https://github.com/ferranbt/fastssz/blob/main/tree.go import ( diff --git a/proof_utils.go b/proof_utils.go index 9b809780..3d1918f9 100644 --- a/proof_utils.go +++ b/proof_utils.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "encoding/hex" diff --git a/proofs.go b/proofs.go index 0f99a32e..f4633c7a 100644 --- a/proofs.go +++ b/proofs.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "fmt" diff --git a/prove_validator.go b/prove_validator.go index 4cf7149c..0f750d58 100644 --- a/prove_validator.go +++ b/prove_validator.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "math/big" diff --git a/prove_withdrawal.go b/prove_withdrawal.go index bf5c9d27..2f8d3773 100644 --- a/prove_withdrawal.go +++ b/prove_withdrawal.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "errors" diff --git a/utils.go b/utils.go index 7c89f914..bd3885c6 100644 --- a/utils.go +++ b/utils.go @@ -1,4 +1,4 @@ -package main +package eigenpodproofs import ( "encoding/json"