native: extend CryptoLib's verifyWithECDsa with hasher parameter
Replace native CryptoLib's verifyWithECDsa `curve` parameter by `curveHash` parameter which is a enum over supported pairs of named curves and hash functions. Even though this change is a compatible extension of the protocol, it changes the genesis state due to parameter renaming. But we're going to resync chain in 3.7 release anyway, so it's not a big deal. Also, we need to check mainnet and testnet compatibility in case if anyone has ever called verifyWithECDsa with 24 or 25 `curve` value. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
7995229f6b
commit
34eef47a18
7 changed files with 119 additions and 75 deletions
|
@ -74,8 +74,10 @@ func TestRoleManagementRole(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCryptoLibNamedCurve(t *testing.T) {
|
||||
require.EqualValues(t, native.Secp256k1, crypto.Secp256k1)
|
||||
require.EqualValues(t, native.Secp256r1, crypto.Secp256r1)
|
||||
require.EqualValues(t, native.Secp256k1Sha256, crypto.Secp256k1Sha256)
|
||||
require.EqualValues(t, native.Secp256r1Sha256, crypto.Secp256r1Sha256)
|
||||
require.EqualValues(t, native.Secp256k1Keccak256, crypto.Secp256k1Keccak256)
|
||||
require.EqualValues(t, native.Secp256r1Keccak256, crypto.Secp256r1Keccak256)
|
||||
}
|
||||
|
||||
func TestOracleContractValues(t *testing.T) {
|
||||
|
@ -233,7 +235,7 @@ func TestNativeHelpersCompile(t *testing.T) {
|
|||
{"sha256", []string{"[]byte{1, 2, 3}"}},
|
||||
{"ripemd160", []string{"[]byte{1, 2, 3}"}},
|
||||
{"murmur32", []string{"[]byte{1, 2, 3}", "123"}},
|
||||
{"verifyWithECDsa", []string{"[]byte{1, 2, 3}", pub, sig, "crypto.Secp256k1"}},
|
||||
{"verifyWithECDsa", []string{"[]byte{1, 2, 3}", pub, sig, "crypto.Secp256k1Sha256"}},
|
||||
{"bls12381Serialize", []string{"crypto.Bls12381Point{}"}},
|
||||
{"bls12381Deserialize", []string{"[]byte{1, 2, 3}"}},
|
||||
{"bls12381Equal", []string{"crypto.Bls12381Point{}", "crypto.Bls12381Point{}"}},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue