diff --git a/scripts/bytecode-diff/cmd/root.go b/scripts/bytecode-diff/cmd/root.go index cc4380db6..03d92d94a 100644 --- a/scripts/bytecode-diff/cmd/root.go +++ b/scripts/bytecode-diff/cmd/root.go @@ -285,6 +285,12 @@ func executeEnvrionmentDiff( originFacets := make(map[string][]utils.Facet) for diamondName, diamondAddress := range originDiamonds { + if verbose { + log.Info(). + Str("diamondName", fmt.Sprintf("%s", diamondName)). + Str("diamondAddress", diamondAddress). + Msg("Origin Diamond Address") + } facets, err := utils.ReadAllFacets(clients[originEnvironment], diamondAddress, baseConfig.BasescanAPIKey) if err != nil { log.Error().Err(err).Msgf("Error reading all facets for origin diamond %s", diamondName) diff --git a/scripts/bytecode-diff/utils/ethereum.go b/scripts/bytecode-diff/utils/ethereum.go index 4e5b772c5..41d762a7c 100644 --- a/scripts/bytecode-diff/utils/ethereum.go +++ b/scripts/bytecode-diff/utils/ethereum.go @@ -19,7 +19,7 @@ import ( type Facet struct { FacetAddress common.Address Selectors [][4]byte `json:",omitempty"` - SelectorsHex []string ` abi:"-"` + SelectorsHex []string `abi:"-"` ContractName string `json:",omitempty"` BytecodeHash string `json:",omitempty"` } @@ -132,7 +132,10 @@ func ReadAllFacets(client *ethclient.Client, contractAddress string, basescanAPI } func CreateEthereumClients( - baseRpcUrl, baseSepoliaRpcUrl, originEnvironment, targetEnvironment string, + baseRpcUrl string, + baseSepoliaRpcUrl string, + originEnvironment string, + targetEnvironment string, verbose bool, ) (map[string]*ethclient.Client, error) { clients := make(map[string]*ethclient.Client) @@ -187,6 +190,10 @@ func GetContractNameFromBasescan(baseURL, address, apiKey string) (string, error } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("Basescan API returned non-200 status code: %d", resp.StatusCode) + } + body, err := io.ReadAll(resp.Body) if err != nil { return "", fmt.Errorf("failed to read response body: %w", err)