Sifchain / sifnode

SifNode - The future of Defi
Other
108 stars 117 forks source link

HAL-08 use of deprecated functions #3242

Open juniuszhou opened 2 years ago

juniuszhou commented 2 years ago

Description

Deprecated Go functions were identified in the codebase. The function(s) are: • grpc.WithInsecure • package ioutil

Code Location:

Listing 14: Uses of deprecated function grpc.WithInsecure
1 355: gRpcClientConn , err := grpc . Dial (sub . SifnodeGrpc , grpc . ë WithInsecure () )
23 cmd / ebrelayer / relayer / ethereum .go
4 477: conn , err := grpc . Dial ( sub . SifnodeGrpc , grpc . WithInsecure
ë () )
56 cmd / ebrelayer / relayer / prophecyHandler .go
7 160: conn , err := grpc . Dial ( sifnodeGrpc , grpc . WithInsecure () )
Listing 15: Uses of deprecated package ioutil
1 x/ dispensation / utils / parser .go
2 26: input , err := ioutil . ReadFile ( file ) 3 44: o, err := ioutil . ReadFile ( file ) 45 x/clp / client /cli /tx.go
6 70: input , err := ioutil . ReadFile ( file ) 7 421: input , err := ioutil . ReadFile ( file ) 8 436: input , err = ioutil . ReadFile ( file ) 9 725: input , err := ioutil . ReadFile ( file )
10
11 x/clp / test / test_common .go
12 306: input , err := ioutil . ReadFile ( file )
14 x/ tokenregistry / utils / parse_denom_list .go
15 18: o, err := ioutil . ReadFile ( file )
16
17 scripts / ibc / tokenregistration / main .go
18 65: input , err := ioutil . ReadFile ( file )
19
20 x/ ethbridge / client /cli /tx.go
21 422: contents , err := ioutil . ReadFile ( file )
22
23 tools / sifgen / genesis / genesis .go
24 134: body , err := ioutil . ReadFile ( genesisPath )
25
26 cmd / ebrelayer / internal / symbol_translator / symbol_translator .go
27 28: contents , err := ioutil . ReadFile ( filename )
28
29 tools / sifgen / node / node .go
30 373: content , err := ioutil . ReadFile (n. CLI . ConfigFilePath () )
31 388: content , err := ioutil . ReadFile (n. CLI . AppFilePath () )
32
33 tools / sifgen / network / network .go
34 36: data , err := ioutil . ReadFile (fmt . Sprintf ("%s/%s. yml ", ë networkDir , file ) )
35 355: content , err := ioutil . ReadFile ( configFile )
36 388: input , err := ioutil . ReadFile ( srcFile )

Recommendation

Replace deprecated functions with up-to-date functions. The packages io or os can be used in place of ioutil. Consider using the following implementation instead of grpc.WithInsecure():

juniuszhou commented 2 years ago
  1. For ioutil package, use same method in io and os package to replace functions in ioutil.
  2. Current grpc version doesn't support WithInsecure parameter.

    3243 merged.

juniuszhou commented 2 years ago

reopen and wait for one more team mate confirm it.

juniuszhou commented 2 years ago

We can use the grpc.WithInsecure after grpc upgraded. Now we can close the issue if @smartyalgo or @Brando753 agree on it.