Skip to content

Commit

Permalink
CI scripts linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-sekara committed Oct 22, 2024
1 parent 62939c3 commit 82d4f31
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
1 change: 1 addition & 0 deletions core/scripts/ccip/applications/ethsenderreceiver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
senderABI = abihelpers.MustParseABI(ether_sender_receiver.EtherSenderReceiverABI)
)

// nolint
func main() {
switch os.Args[1] {
case "inject-eth-liquidity":
Expand Down
8 changes: 4 additions & 4 deletions core/scripts/ccip/ccip-revert-reason/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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_<chain_id>)")
Expand All @@ -28,7 +28,7 @@ func main() {

flag.Parse()

if *errorCodeString == "" && (*chainId == 0 || *txHash == "" || *txRequester == "") {
if *errorCodeString == "" && (*chainID == 0 || *txHash == "" || *txRequester == "") {
flag.Usage()
return
}
Expand All @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions core/scripts/ccip/debugreceiver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

type ccipAny struct {
SourceChainId *big.Int
SourceChainID *big.Int
Sender []byte
Data []byte
Tokens []common.Address
Expand Down Expand Up @@ -87,7 +87,7 @@ func main() {
log[0].Data)
panicErr(err)
send := encodedMsg[0].(struct {
SourceChainId *big.Int `json:"sourceChainId"`
SourceChainID *big.Int `json:"sourceChainId"`
SequenceNumber uint64 `json:"sequenceNumber"`
Sender common.Address `json:"sender"`
Receiver common.Address `json:"receiver"`
Expand All @@ -106,7 +106,7 @@ func main() {
{"internalType":"address[]","name":"tokens","type":"address[]"},
{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],
"internalType":"structCCIP.Any2EVMMessage","name":"message","type":"tuple"}]`,
ccipAny{send.SourceChainId, sender, send.Data, send.Tokens, send.Amounts})
ccipAny{send.SourceChainID, sender, send.Data, send.Tokens, send.Amounts})
panicErr(err)
a, err := dest.CallContract(context.Background(), ethereum.CallMsg{
From: common.HexToAddress("0x2b7ab40413da5077e168546ea376920591aee8e7"), // offramp router
Expand Down
19 changes: 10 additions & 9 deletions core/scripts/ccip/liquiditymanager/multienv/multienv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -35,6 +35,7 @@ type Env struct {
WSURLs map[uint64]string
}

// nolint
func New(websocket bool, overrideNonce bool) Env {
env := Env{
Transactors: make(map[uint64]*bind.TransactOpts),
Expand Down Expand Up @@ -65,7 +66,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
Expand All @@ -74,7 +75,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
Expand All @@ -83,7 +84,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 {
Expand Down
2 changes: 2 additions & 0 deletions core/scripts/ccip/liquiditymanager/opstack/finalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
FinalizationActionFinalizeWithdrawal uint8 = 1
)

// nolint
func FinalizeL1(
env multienv.Env,
l1ChainID,
Expand Down Expand Up @@ -55,6 +56,7 @@ func FinalizeL1(
helpers.ConfirmTXMined(context.Background(), env.Clients[l1ChainID], tx, int64(l1ChainID), "FinalizeWithdrawalTransaction")
}

// nolint
func FinalizeWithdrawalViaRebalancer(
env multienv.Env,
l1ChainID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
encoderABI = abihelpers.MustParseABI(optimism_l1_bridge_adapter_encoder.OptimismL1BridgeAdapterEncoderMetaData.ABI)
)

// nolint
func ProveWithdrawal(
env multienv.Env,
l1ChainID,
Expand Down
6 changes: 3 additions & 3 deletions core/scripts/ccip/revert-reason/handler/reason.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 82d4f31

Please sign in to comment.