diff --git a/crypto/ed25519.go b/crypto/ed25519.go index deccaba..057f036 100644 --- a/crypto/ed25519.go +++ b/crypto/ed25519.go @@ -184,7 +184,7 @@ type Ed25519PublicKey struct { // Implements: // - [VerifyingKey] func (key *Ed25519PublicKey) Verify(msg []byte, sig Signature) bool { - switch sig.(type) { + switch sig := sig.(type) { case *Ed25519Signature: return ed25519.Verify(key.Inner, msg, sig.Bytes()) default: diff --git a/crypto/multiEd25519.go b/crypto/multiEd25519.go index 7481d54..9af8c7c 100644 --- a/crypto/multiEd25519.go +++ b/crypto/multiEd25519.go @@ -34,9 +34,8 @@ type MultiEd25519PublicKey struct { // Implements: // - [VerifyingKey] func (key *MultiEd25519PublicKey) Verify(msg []byte, signature Signature) bool { - switch signature.(type) { + switch sig := signature.(type) { case *MultiEd25519Signature: - sig := signature.(*MultiEd25519Signature) verified := uint8(0) // TODO: Verify with bitmap, and check that this works properly for i, pubKey := range key.PubKeys { diff --git a/crypto/multiKey.go b/crypto/multiKey.go index 69658c8..5074720 100644 --- a/crypto/multiKey.go +++ b/crypto/multiKey.go @@ -30,9 +30,8 @@ type MultiKey struct { // Implements: // - [VerifyingKey] func (key *MultiKey) Verify(msg []byte, signature Signature) bool { - switch signature.(type) { + switch sig := signature.(type) { case *MultiKeySignature: - sig := signature.(*MultiKeySignature) verified := uint8(0) for i, pub := range key.PubKeys { if pub.Verify(msg, sig.Signatures[i]) { diff --git a/crypto/secp256k1.go b/crypto/secp256k1.go index 2304dd8..9a03b2b 100644 --- a/crypto/secp256k1.go +++ b/crypto/secp256k1.go @@ -148,13 +148,11 @@ type Secp256k1PublicKey struct { // Implements: // - [VerifyingKey] func (key *Secp256k1PublicKey) Verify(msg []byte, sig Signature) bool { - switch sig.(type) { + switch sig := sig.(type) { case *Secp256k1Signature: - typedSig := sig.(*Secp256k1Signature) - // Verification requires to pass the SHA-256 hash of the message msg = util.Sha3256Hash([][]byte{msg}) - return ethCrypto.VerifySignature(key.Bytes(), msg, typedSig.Bytes()) + return ethCrypto.VerifySignature(key.Bytes(), msg, sig.Bytes()) default: return false } diff --git a/crypto/singleKey.go b/crypto/singleKey.go index f9b053d..aa8f287 100644 --- a/crypto/singleKey.go +++ b/crypto/singleKey.go @@ -134,10 +134,9 @@ func ToAnyPublicKey(key VerifyingKey) (*AnyPublicKey, error) { // Implements: // - [VerifyingKey] func (key *AnyPublicKey) Verify(msg []byte, sig Signature) bool { - switch sig.(type) { + switch sig := sig.(type) { case *AnySignature: - anySig := sig.(*AnySignature) - return key.PubKey.Verify(msg, anySig.Signature) + return key.PubKey.Verify(msg, sig.Signature) default: return false } diff --git a/transactionSubmission.go b/transactionSubmission.go index e009463..706ab94 100644 --- a/transactionSubmission.go +++ b/transactionSubmission.go @@ -141,12 +141,11 @@ func (rc *NodeClient) BuildSignAndSubmitTransactions( buildOptions ...any, ) { singleSigner := func(rawTxn RawTransactionImpl) (*SignedTransaction, error) { - switch rawTxn.(type) { + switch rawTxn := rawTxn.(type) { case *RawTransaction: - return rawTxn.(*RawTransaction).SignedTransaction(sender) + return rawTxn.SignedTransaction(sender) case *RawTransactionWithData: - rawTxnWithData := rawTxn.(*RawTransactionWithData) - switch rawTxnWithData.Variant { + switch rawTxn.Variant { case MultiAgentRawTransactionWithDataVariant: return nil, fmt.Errorf("multi agent not supported, please provide a signer function") case MultiAgentWithFeePayerRawTransactionWithDataVariant: