From 1896c1c928c1707971b3c1c940400a7a1813bca5 Mon Sep 17 00:00:00 2001 From: tclemos Date: Thu, 26 Jan 2023 10:57:21 -0300 Subject: [PATCH] remove dependency of iden3 package from jrpc --- 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 }