core: rename Neo.Crypto.CheckMultisig to Neo.Crypto.CheckMultisigWithECDsaSecp256r1
Part of #918
This commit is contained in:
parent
17233e1d8e
commit
5326fc587a
21 changed files with 41 additions and 40 deletions
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
@ -44,11 +44,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NYqxsNMHxDg3T19APYP27mBZFfauC4zngR",
|
"address": "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK",
|
||||||
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEQtBMHOzuw==",
|
"script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEQtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
|
"key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
|
"key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
|
"key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
4
pkg/consensus/testdata/wallet1.json
vendored
4
pkg/consensus/testdata/wallet1.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
4
pkg/consensus/testdata/wallet2.json
vendored
4
pkg/consensus/testdata/wallet2.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
|
"key": "6PYKEHagXJ3mDLdga1FoyTGRtPdJgPz6Gb8sjEFwZvRu7ncD9PVZfHtMzL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
4
pkg/consensus/testdata/wallet3.json
vendored
4
pkg/consensus/testdata/wallet3.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
|
"key": "6PYLjn1Zw3RQmP3CkDxoZvYtMpu7ZUdjHnvu7wPuohUcXWCMh9vY661R8A",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
4
pkg/consensus/testdata/wallet4.json
vendored
4
pkg/consensus/testdata/wallet4.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
|
"key": "6PYLbYYg9jUgzJQpKhpvNExa2UEgtp4356XPg56pHuCpE7gQmj84ESNjYW",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -30,8 +30,9 @@ func ECDSASecp256r1Verify(ic *interop.Context, v *vm.VM) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ECDSACheckMultisig checks multiple ECDSA signatures at once.
|
// ECDSASecp256r1CheckMultisig checks multiple ECDSA signatures at once using
|
||||||
func ECDSACheckMultisig(ic *interop.Context, v *vm.VM) error {
|
// Secp256r1 elliptic curve.
|
||||||
|
func ECDSASecp256r1CheckMultisig(ic *interop.Context, v *vm.VM) error {
|
||||||
msg := getMessage(ic, v.Estack().Pop().Item())
|
msg := getMessage(ic, v.Estack().Pop().Item())
|
||||||
hashToCheck := hash.Sha256(msg).BytesBE()
|
hashToCheck := hash.Sha256(msg).BytesBE()
|
||||||
pkeys, err := v.Estack().PopSigElements()
|
pkeys, err := v.Estack().PopSigElements()
|
||||||
|
|
|
@ -57,7 +57,7 @@ func subSlice(arr []stackitem.Item, indices []int) []stackitem.Item {
|
||||||
func initCHECKMULTISIGVM(t *testing.T, n int, ik, is []int) *vm.VM {
|
func initCHECKMULTISIGVM(t *testing.T, n int, ik, is []int) *vm.VM {
|
||||||
buf := make([]byte, 5)
|
buf := make([]byte, 5)
|
||||||
buf[0] = byte(opcode.SYSCALL)
|
buf[0] = byte(opcode.SYSCALL)
|
||||||
binary.LittleEndian.PutUint32(buf[1:], ecdsaCheckMultisigID)
|
binary.LittleEndian.PutUint32(buf[1:], ecdsaSecp256r1CheckMultisigID)
|
||||||
|
|
||||||
v := vm.New()
|
v := vm.New()
|
||||||
v.GasLimit = -1
|
v.GasLimit = -1
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ecdsaSecp256r1VerifyID = emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
|
ecdsaSecp256r1VerifyID = emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
|
||||||
ecdsaCheckMultisigID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig"))
|
ecdsaSecp256r1CheckMultisigID = emit.InteropNameToID([]byte("Neo.Crypto.CheckMultisigWithECDsaSecp256r1"))
|
||||||
sha256ID = emit.InteropNameToID([]byte("Neo.Crypto.SHA256"))
|
sha256ID = emit.InteropNameToID([]byte("Neo.Crypto.SHA256"))
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetInterop returns interop getter for crypto-related stuff.
|
// GetInterop returns interop getter for crypto-related stuff.
|
||||||
|
@ -22,10 +22,10 @@ func GetInterop(ic *interop.Context) func(uint32) *vm.InteropFuncPrice {
|
||||||
return ECDSASecp256r1Verify(ic, v)
|
return ECDSASecp256r1Verify(ic, v)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
case ecdsaCheckMultisigID:
|
case ecdsaSecp256r1CheckMultisigID:
|
||||||
return &vm.InteropFuncPrice{
|
return &vm.InteropFuncPrice{
|
||||||
Func: func(v *vm.VM) error {
|
Func: func(v *vm.VM) error {
|
||||||
return ECDSACheckMultisig(ic, v)
|
return ECDSASecp256r1CheckMultisig(ic, v)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
case sha256ID:
|
case sha256ID:
|
||||||
|
|
|
@ -139,7 +139,7 @@ var systemInterops = []interop.Function{
|
||||||
|
|
||||||
var neoInterops = []interop.Function{
|
var neoInterops = []interop.Function{
|
||||||
{Name: "Neo.Crypto.VerifyWithECDsaSecp256r1", Func: crypto.ECDSASecp256r1Verify, Price: crypto.ECDSAVerifyPrice},
|
{Name: "Neo.Crypto.VerifyWithECDsaSecp256r1", Func: crypto.ECDSASecp256r1Verify, Price: crypto.ECDSAVerifyPrice},
|
||||||
{Name: "Neo.Crypto.ECDsaCheckMultiSig", Func: crypto.ECDSACheckMultisig, Price: 0},
|
{Name: "Neo.Crypto.CheckMultisigWithECDsaSecp256r1", Func: crypto.ECDSASecp256r1CheckMultisig, Price: 0},
|
||||||
{Name: "Neo.Crypto.SHA256", Func: crypto.Sha256, Price: 1000000},
|
{Name: "Neo.Crypto.SHA256", Func: crypto.Sha256, Price: 1000000},
|
||||||
{Name: "Neo.Native.Deploy", Func: native.Deploy, Price: 0,
|
{Name: "Neo.Native.Deploy", Func: native.Deploy, Price: 0,
|
||||||
AllowedTriggers: trigger.Application, RequiredFlags: smartcontract.AllowModifyStates},
|
AllowedTriggers: trigger.Application, RequiredFlags: smartcontract.AllowModifyStates},
|
||||||
|
|
|
@ -21,14 +21,14 @@ func TestGenesisBlockMainNet(t *testing.T) {
|
||||||
// have been changed. Consequently, hash of the genesis block has been changed.
|
// have been changed. Consequently, hash of the genesis block has been changed.
|
||||||
// Update expected genesis block hash for better times.
|
// Update expected genesis block hash for better times.
|
||||||
// Old hash is "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
|
// Old hash is "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
|
||||||
expect := "dba446947a90b2862ef050703b44828ad8b02d11978f8ef59bd3e1c97aabf6e5"
|
expect := "94e61af2441145cc251752707a58107850328a48bb095fd175ca2f8513ab5676"
|
||||||
assert.Equal(t, expect, block.Hash().StringLE())
|
assert.Equal(t, expect, block.Hash().StringLE())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetConsensusAddressMainNet(t *testing.T) {
|
func TestGetConsensusAddressMainNet(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
consensusAddr = "NWNnqYniJyFh1qx5KyBeTV4uq5ewvNrAuD"
|
consensusAddr = "NiVihDFvZacZhujTWkBhRz32UDuNRp416f"
|
||||||
consensusScript = "72c3d9b3bbf776698694cd2c73fa597a10c31294"
|
consensusScript = "f7b4d00143932f3b6243cfc06cb4a68f22c739e2"
|
||||||
)
|
)
|
||||||
|
|
||||||
cfg, err := config.Load("../../config", netmode.MainNet)
|
cfg, err := config.Load("../../config", netmode.MainNet)
|
||||||
|
|
BIN
pkg/rpc/server/testdata/testblocks.acc
vendored
BIN
pkg/rpc/server/testdata/testblocks.acc
vendored
Binary file not shown.
|
@ -30,7 +30,7 @@ func CreateMultiSigRedeemScript(m int, publicKeys keys.PublicKeys) ([]byte, erro
|
||||||
}
|
}
|
||||||
emit.Int(buf.BinWriter, int64(len(publicKeys)))
|
emit.Int(buf.BinWriter, int64(len(publicKeys)))
|
||||||
emit.Opcode(buf.BinWriter, opcode.PUSHNULL)
|
emit.Opcode(buf.BinWriter, opcode.PUSHNULL)
|
||||||
emit.Syscall(buf.BinWriter, "Neo.Crypto.ECDsaCheckMultiSig")
|
emit.Syscall(buf.BinWriter, "Neo.Crypto.CheckMultisigWithECDsaSecp256r1")
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,5 +34,5 @@ func TestCreateMultiSigRedeemScript(t *testing.T) {
|
||||||
assert.Equal(t, opcode.PUSH3, opcode.Opcode(br.ReadB()))
|
assert.Equal(t, opcode.PUSH3, opcode.Opcode(br.ReadB()))
|
||||||
assert.Equal(t, opcode.PUSHNULL, opcode.Opcode(br.ReadB()))
|
assert.Equal(t, opcode.PUSHNULL, opcode.Opcode(br.ReadB()))
|
||||||
assert.Equal(t, opcode.SYSCALL, opcode.Opcode(br.ReadB()))
|
assert.Equal(t, opcode.SYSCALL, opcode.Opcode(br.ReadB()))
|
||||||
assert.Equal(t, emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig")), br.ReadU32LE())
|
assert.Equal(t, emit.InteropNameToID([]byte("Neo.Crypto.CheckMultisigWithECDsaSecp256r1")), br.ReadU32LE())
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
verifyInteropID = emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
|
verifyInteropID = emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
|
||||||
multisigInteropID = emit.InteropNameToID([]byte("Neo.Crypto.ECDsaCheckMultiSig"))
|
multisigInteropID = emit.InteropNameToID([]byte("Neo.Crypto.CheckMultisigWithECDsaSecp256r1"))
|
||||||
)
|
)
|
||||||
|
|
||||||
func getNumOfThingsFromInstr(instr opcode.Opcode, param []byte) (int, bool) {
|
func getNumOfThingsFromInstr(instr opcode.Opcode, param []byte) (int, bool) {
|
||||||
|
|
|
@ -113,13 +113,13 @@ func TestAccount_ConvertMultisig(t *testing.T) {
|
||||||
t.Run("1/1 multisig", func(t *testing.T) {
|
t.Run("1/1 multisig", func(t *testing.T) {
|
||||||
pubs := convertPubs(t, hexs[:1])
|
pubs := convertPubs(t, hexs[:1])
|
||||||
require.NoError(t, a.ConvertMultisig(1, pubs))
|
require.NoError(t, a.ConvertMultisig(1, pubs))
|
||||||
require.Equal(t, "NYqxsNMHxDg3T19APYP27mBZFfauC4zngR", a.Address)
|
require.Equal(t, "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK", a.Address)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("3/4 multisig", func(t *testing.T) {
|
t.Run("3/4 multisig", func(t *testing.T) {
|
||||||
pubs := convertPubs(t, hexs)
|
pubs := convertPubs(t, hexs)
|
||||||
require.NoError(t, a.ConvertMultisig(3, pubs))
|
require.NoError(t, a.ConvertMultisig(3, pubs))
|
||||||
require.Equal(t, "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2", a.Address)
|
require.Equal(t, "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY", a.Address)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
pkg/wallet/testdata/wallet1.json
vendored
4
pkg/wallet/testdata/wallet1.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
4
pkg/wallet/testdata/wallet2.json
vendored
4
pkg/wallet/testdata/wallet2.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isDefault": false
|
"isDefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "Nbb1qkwcwNSBs9pAnrVVrnFbWnbWBk91U2",
|
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
||||||
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
"key": "6PYN7LvaWqBNw7Xb7a52LSbPnP91kyuzYi3HncGvQwQoYAY2W8DncTgpux",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
Loading…
Reference in a new issue