From a4f164920ecc4f5b5f569b5a3dff128908c21835 Mon Sep 17 00:00:00 2001 From: Thiago Coimbra Lemos Date: Fri, 27 Jan 2023 10:55:12 -0300 Subject: [PATCH] remove dependency of iden3 package from jrpc (#1596) --- jsonrpc/endpoints_web3.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jsonrpc/endpoints_web3.go b/jsonrpc/endpoints_web3.go index 64f1a64a03..4440be4452 100644 --- a/jsonrpc/endpoints_web3.go +++ b/jsonrpc/endpoints_web3.go @@ -3,7 +3,7 @@ package jsonrpc import ( "math/big" - "github.com/iden3/go-iden3-crypto/keccak256" + "golang.org/x/crypto/sha3" ) // Web3Endpoints contains implementations for the "web3" RPC endpoints @@ -18,5 +18,8 @@ func (e *Web3Endpoints) ClientVersion() (interface{}, rpcError) { // Sha3 returns the keccak256 hash of the given data. func (e *Web3Endpoints) Sha3(data argBig) (interface{}, rpcError) { b := (*big.Int)(&data) - return argBytes(keccak256.Hash(b.Bytes())), nil + hash := sha3.NewLegacyKeccak256() + hash.Write(b.Bytes()) //nolint:errcheck,gosec + keccak256Hash := hash.Sum(nil) + return argBytes(keccak256Hash), nil }