From 7b3c3796fbc47bfbc3dadfb4b5eaa30e8cbbc6ab Mon Sep 17 00:00:00 2001 From: Dylan Moreland Date: Fri, 19 Jan 2024 11:16:47 -0500 Subject: [PATCH] Revert some messaging changes just to get tests rolling --- connector/web3/web3.go | 7 ++++--- connector/web3/web3_test.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/connector/web3/web3.go b/connector/web3/web3.go index 78025da9a3..64d8b66aa0 100644 --- a/connector/web3/web3.go +++ b/connector/web3/web3.go @@ -2,6 +2,7 @@ package web3 import ( + "errors" "fmt" "github.com/dexidp/dex/connector" @@ -103,9 +104,9 @@ func (c *web3Connector) VerifyERC1271Signature(contractAddress common.Address, h } if c.ethClient == nil { - c.logger.Errorf("Eth client was not initialized successfully %v", err) - return identity, fmt.Errorf("error occurred completing authentication, please try again %w", err) + return identity, errors.New("can't attempt to validate signature, no Ethereum client available") } + var msgHash [32]byte copy(msgHash[:], hash) @@ -120,7 +121,7 @@ func (c *web3Connector) VerifyERC1271Signature(contractAddress common.Address, h result, err := ct.IsValidSignature(nil, msgHash, signature) if err != nil { - return identity, fmt.Errorf("error calling isValidSignature on contract: %w", err) + return identity, fmt.Errorf("error occurred completing login %w", err) } if result != erc1271magicValue { diff --git a/connector/web3/web3_test.go b/connector/web3/web3_test.go index 0c0085e7bd..1549a486a2 100644 --- a/connector/web3/web3_test.go +++ b/connector/web3/web3_test.go @@ -4,6 +4,9 @@ import ( "crypto/ecdsa" "errors" "fmt" + "math/big" + "testing" + "github.com/dexidp/dex/connector" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -14,8 +17,6 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" - "math/big" - "testing" ) type BkTest struct { @@ -260,7 +261,7 @@ func TestBlockchainBackend(t *testing.T) { msgHash: emptyByte, signedMessage: hexutil.Encode(emptyByte), shouldErr: true, - err: errors.New("error occurred completing authentication, please try again"), + err: errors.New("no Ethereum client available"), } }, }