From 8e74b6a3859ec90b4f1249cd4c51927578bd5818 Mon Sep 17 00:00:00 2001 From: Mateusz Sekara Date: Tue, 22 Oct 2024 15:43:38 +0200 Subject: [PATCH] CI scripts linter fixes --- core/scripts/ccip/ccip-revert-reason/main.go | 8 ++++---- core/scripts/ccip/debugreceiver/main.go | 2 +- .../ccip/liquiditymanager/multienv/multienv.go | 18 +++++++++--------- .../ccip/revert-reason/handler/reason.go | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/scripts/ccip/ccip-revert-reason/main.go b/core/scripts/ccip/ccip-revert-reason/main.go index d8504a04800..e357086306e 100644 --- a/core/scripts/ccip/ccip-revert-reason/main.go +++ b/core/scripts/ccip/ccip-revert-reason/main.go @@ -13,7 +13,7 @@ import ( var ( errorCodeString = flag.String("errorCode", "", "Error code string (e.g. 0x08c379a0)") - chainId = flag.Uint64("chainId", 0, "Chain ID for the transaction (e.g. 420)") + chainID = flag.Uint64("chainId", 0, "Chain ID for the transaction (e.g. 420)") txHash = flag.String("txHash", "", "Transaction hash (e.g. 0x97be8559164442595aba46b5f849c23257905b78e72ee43d9b998b28eee78b84)") txRequester = flag.String("txRequester", "", "Transaction requester address (e.g. 0xe88ff73814fb891bb0e149f5578796fa41f20242)") rpcURL = flag.String("rpcURL", "", "RPC URL for the chain (can also be set in env var RPC_)") @@ -28,7 +28,7 @@ func main() { flag.Parse() - if *errorCodeString == "" && (*chainId == 0 || *txHash == "" || *txRequester == "") { + if *errorCodeString == "" && (*chainID == 0 || *txHash == "" || *txRequester == "") { flag.Usage() return } @@ -53,8 +53,8 @@ func getErrorString() (string, error) { } if *rpcURL == "" { - fmt.Printf("RPC URL not provided, looking for RPC_%d env var\n", *chainId) - envRPC := secrets.GetRPC(*chainId) + fmt.Printf("RPC URL not provided, looking for RPC_%d env var\n", *chainID) + envRPC := secrets.GetRPC(*chainID) rpcURL = &envRPC } diff --git a/core/scripts/ccip/debugreceiver/main.go b/core/scripts/ccip/debugreceiver/main.go index 5ea60845155..b9606995245 100644 --- a/core/scripts/ccip/debugreceiver/main.go +++ b/core/scripts/ccip/debugreceiver/main.go @@ -15,7 +15,7 @@ import ( ) type ccipAny struct { - SourceChainId *big.Int + SourceChainID *big.Int Sender []byte Data []byte Tokens []common.Address diff --git a/core/scripts/ccip/liquiditymanager/multienv/multienv.go b/core/scripts/ccip/liquiditymanager/multienv/multienv.go index a1981775052..bab56480615 100644 --- a/core/scripts/ccip/liquiditymanager/multienv/multienv.go +++ b/core/scripts/ccip/liquiditymanager/multienv/multienv.go @@ -19,12 +19,12 @@ import ( // Environment variables used to configure // the environment for the rebalancer const ( - // OWNER_KEY is the private key used to deploy contracts and send funds to the rebalancer nodes - OWNER_KEY = "OWNER_KEY" - // RPC_ is the prefix for the environment variable that contains the RPC URL for a chain - RPC_ = "RPC_" - // WS_ is the prefix for the environment variable that contains the WebSocket URL for a chain - WS_ = "WS_" + // OwnerKey is the private key used to deploy contracts and send funds to the rebalancer nodes + OwnerKey = "OWNER_KEY" + // RpcPrefix is the prefix for the environment variable that contains the RPC URL for a chain + RpcPrefix = "RPC_" + // WebSocketPerfix is the prefix for the environment variable that contains the WebSocket URL for a chain + WebSocketPerfix = "WS_" ) type Env struct { @@ -65,7 +65,7 @@ func New(websocket bool, overrideNonce bool) Env { } func GetRPC(chainID uint64) (string, error) { - envVariable := RPC_ + strconv.FormatUint(chainID, 10) + envVariable := RpcPrefix + strconv.FormatUint(chainID, 10) rpc := os.Getenv(envVariable) if rpc != "" { return rpc, nil @@ -74,7 +74,7 @@ func GetRPC(chainID uint64) (string, error) { } func GetWS(chainID uint64) (string, error) { - envVariable := WS_ + strconv.FormatUint(chainID, 10) + envVariable := WebSocketPerfix + strconv.FormatUint(chainID, 10) ws := os.Getenv(envVariable) if ws != "" { return ws, nil @@ -83,7 +83,7 @@ func GetWS(chainID uint64) (string, error) { } func GetTransactor(chainID *big.Int) *bind.TransactOpts { - ownerKey := os.Getenv(OWNER_KEY) + ownerKey := os.Getenv(OwnerKey) if ownerKey != "" { b, err := hex.DecodeString(ownerKey) if err != nil { diff --git a/core/scripts/ccip/revert-reason/handler/reason.go b/core/scripts/ccip/revert-reason/handler/reason.go index 7256b858561..d705774b762 100644 --- a/core/scripts/ccip/revert-reason/handler/reason.go +++ b/core/scripts/ccip/revert-reason/handler/reason.go @@ -44,13 +44,13 @@ func (h *BaseHandler) RevertReasonFromErrorCodeString(errorCodeString string) (s func (h *BaseHandler) RevertReasonFromTx(txHash string) (string, error) { // Need a node URL // NOTE: this node needs to run in archive mode - ethUrl := h.cfg.NodeURL - if ethUrl == "" { + ethURL := h.cfg.NodeURL + if ethURL == "" { panicErr(errors.New("you must define ETH_NODE env variable")) } requester := h.cfg.FromAddress - ec, err := ethclient.Dial(ethUrl) + ec, err := ethclient.Dial(ethURL) panicErr(err) errorString, _ := GetErrorForTx(ec, txHash, requester)