From 8c5bfa32a3d6ebc3149385b7f32f76911fe199f3 Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Wed, 3 Jul 2024 01:07:00 +0900 Subject: [PATCH] api: personal_sign, eth_sign, kaia_sign are EIP-191 compliant --- api/api_ethereum.go | 2 +- api/api_private_account.go | 4 ++-- api/api_public_transaction_pool.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/api_ethereum.go b/api/api_ethereum.go index d2274c26e..d8a590411 100644 --- a/api/api_ethereum.go +++ b/api/api_ethereum.go @@ -1191,7 +1191,7 @@ func (api *EthereumAPI) SendRawTransaction(ctx context.Context, input hexutil.By } // Sign calculates an ECDSA signature for: -// keccack256("\x19Klaytn Signed Message:\n" + len(message) + message). +// keccack256("\x19Ethereum Signed Message:\n" + len(message) + message). // // Note, the produced signature conforms to the secp256k1 curve R, S and V values, // where the V value will be 27 or 28 for legacy reasons. diff --git a/api/api_private_account.go b/api/api_private_account.go index f0315345f..4138c39cb 100644 --- a/api/api_private_account.go +++ b/api/api_private_account.go @@ -452,7 +452,7 @@ func (s *PrivateAccountAPI) signAsFeePayer(addr common.Address, passwd string, t } // Sign calculates a Kaia ECDSA signature for: -// keccack256("\x19Klaytn Signed Message:\n" + len(message) + message)) +// keccack256("\x19Ethereum Signed Message:\n" + len(message) + message)) // // Note, the produced signature conforms to the secp256k1 curve R, S and V values, // where the V value will be 27 or 28 for legacy reasons. @@ -469,7 +469,7 @@ func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr c return nil, err } // Assemble sign the data with the wallet - signature, err := wallet.SignHashWithPassphrase(account, passwd, signHash(data)) + signature, err := wallet.SignHashWithPassphrase(account, passwd, ethSignHash(data)) if err != nil { return nil, err } diff --git a/api/api_public_transaction_pool.go b/api/api_public_transaction_pool.go index 99081ea02..4d15b0363 100644 --- a/api/api_public_transaction_pool.go +++ b/api/api_public_transaction_pool.go @@ -387,7 +387,7 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod } // Sign calculates an ECDSA signature for: -// keccack256("\x19Klaytn Signed Message:\n" + len(message) + message). +// keccack256("\x19Ethereum Signed Message:\n" + len(message) + message). // // Note, the produced signature conforms to the secp256k1 curve R, S and V values, // where the V value will be 27 or 28 for legacy reasons. @@ -404,7 +404,7 @@ func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) return nil, err } // Sign the requested hash with the wallet - signature, err := wallet.SignHash(account, signHash(data)) + signature, err := wallet.SignHash(account, ethSignHash(data)) if err == nil { signature[crypto.RecoveryIDOffset] += 27 // Transform V from 0/1 to 27/28 according to the yellow paper }