forked from TrueCloudLab/neoneo-go
native: adjust NamedCurveHash values
Use 122 and 123 respectively for Secp256k1Keccak256 and Secp256r1Keccak256, ref. https://github.com/neo-project/neo/pull/3209#issuecomment-2095798056. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
988440949b
commit
6e0926e59f
5 changed files with 13 additions and 13 deletions
|
@ -39,8 +39,8 @@ type NamedCurveHash byte
|
|||
const (
|
||||
Secp256k1Sha256 NamedCurveHash = 22
|
||||
Secp256r1Sha256 NamedCurveHash = 23
|
||||
Secp256k1Keccak256 NamedCurveHash = 24
|
||||
Secp256r1Keccak256 NamedCurveHash = 25
|
||||
Secp256k1Keccak256 NamedCurveHash = 122
|
||||
Secp256r1Keccak256 NamedCurveHash = 123
|
||||
)
|
||||
|
||||
const cryptoContractID = -3
|
||||
|
|
|
@ -199,7 +199,7 @@ func testECDSAVerify(t *testing.T, curve NamedCurveHash) {
|
|||
runCase(t, true, false, msg, priv.PublicKey().Bytes(), sign, new(big.Int).Add(big.NewInt(math.MaxInt64), big.NewInt(1)))
|
||||
})
|
||||
t.Run("unknown curve", func(t *testing.T) {
|
||||
runCase(t, true, false, msg, priv.PublicKey().Bytes(), sign, int64(123))
|
||||
runCase(t, true, false, msg, priv.PublicKey().Bytes(), sign, int64(124))
|
||||
})
|
||||
t.Run("invalid signature", func(t *testing.T) {
|
||||
s := priv.Sign(msg)
|
||||
|
|
|
@ -175,7 +175,7 @@ func buildKoblitzVerificationScript(t *testing.T, pub *keys.PublicKey) []byte {
|
|||
// READY: loaded 110 instructions
|
||||
// NEO-GO-VM 0 > ops
|
||||
// INDEX OPCODE PARAMETER
|
||||
// 0 PUSHINT8 24 (18) <<
|
||||
// 0 PUSHINT8 122 (7a) <<
|
||||
// 2 SWAP
|
||||
// 3 PUSHDATA1 02a088bfab1e4b4bede7d4624572861b401cb20c3b14e90687bd8862272a4e6166
|
||||
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
|
||||
|
@ -232,7 +232,7 @@ func buildKoblitzVerificationScriptSimpleSingleHash(t *testing.T, pub *keys.Publ
|
|||
// READY: loaded 98 instructions
|
||||
// NEO-GO-VM 0 > ops
|
||||
// INDEX OPCODE PARAMETER
|
||||
// 0 PUSHINT8 24 (18) <<
|
||||
// 0 PUSHINT8 122 (7a) <<
|
||||
// 2 SWAP
|
||||
// 3 PUSHDATA1 0363d7a48125a76cdea6e098c9f128e82920ed428e5fb4caf1d7f81c16cad0c205
|
||||
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
|
||||
|
@ -288,7 +288,7 @@ func buildKoblitzVerificationScriptSimpleSingleHashStaticMagic(t *testing.T, pub
|
|||
// READY: loaded 95 instructions
|
||||
// NEO-GO-VM 0 > ops
|
||||
// INDEX OPCODE PARAMETER
|
||||
// 0 PUSHINT8 24 (18) <<
|
||||
// 0 PUSHINT8 122 (7a) <<
|
||||
// 2 SWAP
|
||||
// 3 PUSHDATA1 0296e13080ade92a2ab722338c2a249ee8d83a14f649c68321664165f06bd110bd
|
||||
// 38 PUSHINT8 42 (2a)
|
||||
|
@ -348,7 +348,7 @@ func buildKoblitzVerificationScriptSimple(t *testing.T, pub *keys.PublicKey) []b
|
|||
// READY: loaded 136 instructions
|
||||
// NEO-GO-VM 0 > ops
|
||||
// INDEX OPCODE PARAMETER
|
||||
// 0 PUSHINT8 24 (18) <<
|
||||
// 0 PUSHINT8 122 (7a) <<
|
||||
// 2 SWAP
|
||||
// 3 PUSHDATA1 03a77f137afbb4b68d7a450aa5a28fe335f804c589a808494b4b626eb98707f37d
|
||||
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
|
||||
|
@ -449,7 +449,7 @@ func buildKoblitzVerificationScriptCompat(t *testing.T, pub *keys.PublicKey) []b
|
|||
// READY: loaded 186 instructions
|
||||
// NEO-GO-VM 0 > ops
|
||||
// INDEX OPCODE PARAMETER
|
||||
// 0 PUSHINT8 24 (18) <<
|
||||
// 0 PUSHINT8 122 (7a) <<
|
||||
// 2 SWAP
|
||||
// 3 PUSHDATA1 02627ef9c3631e3ccb8fbc4c5b6c49e38ccede5a79afb1e1b0708fbb958a7802d7
|
||||
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
|
||||
|
@ -866,7 +866,7 @@ func buildKoblitzMultisigVerificationScript(t *testing.T, m int, pubs keys.Publi
|
|||
// 193 GE
|
||||
// 194 OR
|
||||
// 195 JMPIF 261 (66/42)
|
||||
// 197 PUSHINT8 24 (18)
|
||||
// 197 PUSHINT8 122 (7a)
|
||||
// 199 LDLOC0
|
||||
// 200 LDLOC3
|
||||
// 201 PICKITEM
|
||||
|
|
|
@ -20,8 +20,8 @@ type NamedCurveHash byte
|
|||
const (
|
||||
Secp256k1Sha256 NamedCurveHash = 22
|
||||
Secp256r1Sha256 NamedCurveHash = 23
|
||||
Secp256k1Keccak256 NamedCurveHash = 24
|
||||
Secp256r1Keccak256 NamedCurveHash = 25
|
||||
Secp256k1Keccak256 NamedCurveHash = 122
|
||||
Secp256r1Keccak256 NamedCurveHash = 123
|
||||
)
|
||||
|
||||
// Sha256 calls `sha256` method of native CryptoLib contract and computes SHA256 hash of b.
|
||||
|
|
|
@ -3239,11 +3239,11 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
|
|||
checkCalc(t, tx, 2315100) // Perfectly matches FeeIsMultiSigContract() C# test.
|
||||
})
|
||||
t.Run("Koblitz custom multisignature witness", func(t *testing.T) {
|
||||
tx := "AAIAAACWP5gAAAAAAIBniwAAAAAAAgAAAAFSPSnnAijsThGazYipphHw5ljbTgEAVgsVDBQBAgMAAAAAAAAAAAAAAAAAAAAAAAwUUj0p5wIo7E4Rms2IqaYR8OZY204UwB8MCHRyYW5zZmVyDBTPduKL0AYsSkeO41VhARMZ88+k0kFifVtSAcwMQgxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxCDEA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IQOaHY3bh+3OmXuU9t72Pj62loLM7gZDgXJwnBV2zO4u1wwhAsvP18ohoYHcHBPt4wwPqAOstOhazEegr4klYmDlWpzeDCED9EsK7L0qFMP1QpBBfKMMVXPLa894ONINLRtjtBLBM6oUVwcAdW3AcXZDbigDOG7AcEHF+6DgAwAAAAABAAAAnhSNQS1RCDAQzotyEHMQdGtuuGxtuJIkQgB6aGvOaWzOahTAEAwPdmVyaWZ5V2l0aEVDRHNhDBQb9XWrEYlohBNhCjWhKIbN4LZsckFifVtSa55zbJx0IrlrbrM="
|
||||
resp := checkErrGetResult(t, calcReqExactly(t, tx), false, 0)
|
||||
res := new(result.NetworkFee)
|
||||
require.NoError(t, json.Unmarshal(resp, res))
|
||||
require.Equal(t, int64(8995470), res.Value)
|
||||
require.Equal(t, int64(8992070), res.Value)
|
||||
})
|
||||
checkContract := func(t *testing.T, verAcc util.Uint160, invoc []byte, fee int64) {
|
||||
txScript, err := smartcontract.CreateCallWithAssertScript(chain.UtilityTokenHash(), "transfer",
|
||||
|
|
Loading…
Reference in a new issue