mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
core: refactor Neo.Crypto.CheckMultisigWithECDsaSecpr1
Rename it to Neo.Crypto.CheckMultisig and remove `message` parameter.
This commit is contained in:
parent
7126637f73
commit
9015e50847
34 changed files with 157 additions and 189 deletions
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
@ -44,11 +44,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK",
|
"address": "NNudMSGzEoktFzdYGYoNb3bzHzbmM1genF",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEQtBE43vrw==",
|
"script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEUF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYXADog3RQCwKRhqQsobwZEFopdcCJuMfPosM9pXPaDWSguKvznLdpADk",
|
"key": "6PYXADog3RQCwKRhqQsobwZEFopdcCJuMfPosM9pXPaDWSguKvznLdpADk",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYScv3Vgvdi9EkhDNvHXdvQeuaXK9gRwXDmytCswZMNpTzMLvfgR3U5dK",
|
"key": "6PYScv3Vgvdi9EkhDNvHXdvQeuaXK9gRwXDmytCswZMNpTzMLvfgR3U5dK",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYVwp1Sdg9DfTzvg42PZxgzMDf5a5FYBgT6ynKKzwmSHuhGkipoNjyW3a",
|
"key": "6PYVwp1Sdg9DfTzvg42PZxgzMDf5a5FYBgT6ynKKzwmSHuhGkipoNjyW3a",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -31,8 +31,8 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
validatorWIF = "KxyjQ8eUa4FHt3Gvioyt1Wz29cTUrE4eTqX3yFSk1YFCsPL8uNsY"
|
validatorWIF = "KxyjQ8eUa4FHt3Gvioyt1Wz29cTUrE4eTqX3yFSk1YFCsPL8uNsY"
|
||||||
validatorAddr = "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK"
|
validatorAddr = "NNudMSGzEoktFzdYGYoNb3bzHzbmM1genF"
|
||||||
multisigAddr = "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY"
|
multisigAddr = "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6"
|
||||||
|
|
||||||
validatorWallet = "testdata/wallet1_solo.json"
|
validatorWallet = "testdata/wallet1_solo.json"
|
||||||
)
|
)
|
||||||
|
|
|
@ -60,12 +60,12 @@ func TestNEP17Balance(t *testing.T) {
|
||||||
e.checkNextLine(t, "^\\s*Updated:")
|
e.checkNextLine(t, "^\\s*Updated:")
|
||||||
e.checkNextLine(t, "^\\s*$")
|
e.checkNextLine(t, "^\\s*$")
|
||||||
|
|
||||||
addr2, err := address.StringToUint160("NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY")
|
addr2, err := address.StringToUint160("NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
e.checkNextLine(t, "^Account "+address.Uint160ToString(addr2))
|
e.checkNextLine(t, "^Account "+address.Uint160ToString(addr2))
|
||||||
e.checkNextLine(t, "^\\s*$")
|
e.checkNextLine(t, "^\\s*$")
|
||||||
|
|
||||||
addr3, err := address.StringToUint160("NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK")
|
addr3, err := address.StringToUint160("NNudMSGzEoktFzdYGYoNb3bzHzbmM1genF")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
e.checkNextLine(t, "^Account "+address.Uint160ToString(addr3))
|
e.checkNextLine(t, "^Account "+address.Uint160ToString(addr3))
|
||||||
// The order of assets is undefined.
|
// The order of assets is undefined.
|
||||||
|
@ -85,7 +85,7 @@ func TestNEP17Balance(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
e.checkNextLine(t, "^\\s*$")
|
e.checkNextLine(t, "^\\s*$")
|
||||||
addr4, err := address.StringToUint160("NWTDxsHVde5qSjRkTRUAg6i8xC3JSWEC9k") // deployed verify.go contract
|
addr4, err := address.StringToUint160("NTe3yHH5zsaEGvEHTsFRpCjTef6Aod4yb6") // deployed verify.go contract
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
e.checkNextLine(t, "^Account "+address.Uint160ToString(addr4))
|
e.checkNextLine(t, "^Account "+address.Uint160ToString(addr4))
|
||||||
e.checkEOF(t)
|
e.checkEOF(t)
|
||||||
|
|
BIN
cli/testdata/chain50x2.acc
vendored
BIN
cli/testdata/chain50x2.acc
vendored
Binary file not shown.
12
cli/testdata/wallet1_solo.json
vendored
12
cli/testdata/wallet1_solo.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": true
|
"isdefault": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
@ -44,11 +44,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK",
|
"address": "NNudMSGzEoktFzdYGYoNb3bzHzbmM1genF",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEQtBE43vrw==",
|
"script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEUF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
@ -61,11 +61,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address" : "NWTDxsHVde5qSjRkTRUAg6i8xC3JSWEC9k",
|
"address" : "NTe3yHH5zsaEGvEHTsFRpCjTef6Aod4yb6",
|
||||||
"key" : "6PYSgdjUPVjo3ZJLg2CsheXnEZzyvUuSm4jCtXP6X7FT82sAQHWt2wpu5A",
|
"key" : "6PYSgdjUPVjo3ZJLg2CsheXnEZzyvUuSm4jCtXP6X7FT82sAQHWt2wpu5A",
|
||||||
"label" : "",
|
"label" : "",
|
||||||
"contract" : {
|
"contract" : {
|
||||||
"script" : "VwMAQS1RCDAhcAwUVVQtU+0PVUb61E1umZEoZwIvzl7bMHFoE87bKGnbKJdA",
|
"script" : "VwEAEdsgQFcAA0A=",
|
||||||
"deployed" : true,
|
"deployed" : true,
|
||||||
"parameters" : []
|
"parameters" : []
|
||||||
},
|
},
|
||||||
|
|
4
cli/testdata/wallets/testwallet_NEO3.json
vendored
4
cli/testdata/wallets/testwallet_NEO3.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -346,12 +346,12 @@ func TestDumpKeys(t *testing.T) {
|
||||||
e.checkNextLine(t, "NTh9TnZTstvAePEYWDGLLxidBikJE24uTo")
|
e.checkNextLine(t, "NTh9TnZTstvAePEYWDGLLxidBikJE24uTo")
|
||||||
e.checkNextLine(t, pubRegex)
|
e.checkNextLine(t, pubRegex)
|
||||||
e.checkNextLine(t, "^\\s*$")
|
e.checkNextLine(t, "^\\s*$")
|
||||||
e.checkNextLine(t, "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY")
|
e.checkNextLine(t, "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6")
|
||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
e.checkNextLine(t, pubRegex)
|
e.checkNextLine(t, pubRegex)
|
||||||
}
|
}
|
||||||
e.checkNextLine(t, "^\\s*$")
|
e.checkNextLine(t, "^\\s*$")
|
||||||
e.checkNextLine(t, "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK")
|
e.checkNextLine(t, "NNudMSGzEoktFzdYGYoNb3bzHzbmM1genF")
|
||||||
e.checkNextLine(t, pubRegex)
|
e.checkNextLine(t, pubRegex)
|
||||||
e.checkEOF(t)
|
e.checkEOF(t)
|
||||||
})
|
})
|
||||||
|
@ -363,7 +363,7 @@ func TestDumpKeys(t *testing.T) {
|
||||||
e.checkEOF(t)
|
e.checkEOF(t)
|
||||||
})
|
})
|
||||||
t.Run("3/4 multisig", func(t *testing.T) {
|
t.Run("3/4 multisig", func(t *testing.T) {
|
||||||
cmd := append(cmd, "-a", "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY")
|
cmd := append(cmd, "-a", "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6")
|
||||||
e.Run(t, cmd...)
|
e.Run(t, cmd...)
|
||||||
e.checkNextLine(t, "3 out of 4 multisig contract")
|
e.checkNextLine(t, "3 out of 4 multisig contract")
|
||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
|
@ -372,7 +372,7 @@ func TestDumpKeys(t *testing.T) {
|
||||||
e.checkEOF(t)
|
e.checkEOF(t)
|
||||||
})
|
})
|
||||||
t.Run("1/1 multisig", func(t *testing.T) {
|
t.Run("1/1 multisig", func(t *testing.T) {
|
||||||
cmd := append(cmd, "--address", "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK")
|
cmd := append(cmd, "--address", "NNudMSGzEoktFzdYGYoNb3bzHzbmM1genF")
|
||||||
e.Run(t, cmd...)
|
e.Run(t, cmd...)
|
||||||
e.checkNextLine(t, "1 out of 1 multisig contract")
|
e.checkNextLine(t, "1 out of 1 multisig contract")
|
||||||
e.checkNextLine(t, pubRegex)
|
e.checkNextLine(t, pubRegex)
|
||||||
|
|
|
@ -61,36 +61,36 @@ func TestSyscallExecution(t *testing.T) {
|
||||||
sigs := "[]interop.Signature{" + sig + "}"
|
sigs := "[]interop.Signature{" + sig + "}"
|
||||||
sctx := "storage.Context{}"
|
sctx := "storage.Context{}"
|
||||||
interops := map[string]syscallTestCase{
|
interops := map[string]syscallTestCase{
|
||||||
"contract.Call": {interopnames.SystemContractCall, []string{u160, `"m"`, "1", "3"}, false},
|
"contract.Call": {interopnames.SystemContractCall, []string{u160, `"m"`, "1", "3"}, false},
|
||||||
"contract.CreateMultisigAccount": {interopnames.SystemContractCreateMultisigAccount, []string{"1", pubs}, false},
|
"contract.CreateMultisigAccount": {interopnames.SystemContractCreateMultisigAccount, []string{"1", pubs}, false},
|
||||||
"contract.CreateStandardAccount": {interopnames.SystemContractCreateStandardAccount, []string{pub}, false},
|
"contract.CreateStandardAccount": {interopnames.SystemContractCreateStandardAccount, []string{pub}, false},
|
||||||
"contract.IsStandard": {interopnames.SystemContractIsStandard, []string{u160}, false},
|
"contract.IsStandard": {interopnames.SystemContractIsStandard, []string{u160}, false},
|
||||||
"contract.GetCallFlags": {interopnames.SystemContractGetCallFlags, nil, false},
|
"contract.GetCallFlags": {interopnames.SystemContractGetCallFlags, nil, false},
|
||||||
"iterator.Create": {interopnames.SystemIteratorCreate, []string{pubs}, false},
|
"iterator.Create": {interopnames.SystemIteratorCreate, []string{pubs}, false},
|
||||||
"iterator.Next": {interopnames.SystemIteratorNext, []string{"iterator.Iterator{}"}, false},
|
"iterator.Next": {interopnames.SystemIteratorNext, []string{"iterator.Iterator{}"}, false},
|
||||||
"iterator.Value": {interopnames.SystemIteratorValue, []string{"iterator.Iterator{}"}, false},
|
"iterator.Value": {interopnames.SystemIteratorValue, []string{"iterator.Iterator{}"}, false},
|
||||||
"runtime.CheckWitness": {interopnames.SystemRuntimeCheckWitness, []string{b}, false},
|
"runtime.CheckWitness": {interopnames.SystemRuntimeCheckWitness, []string{b}, false},
|
||||||
"runtime.GasLeft": {interopnames.SystemRuntimeGasLeft, nil, false},
|
"runtime.GasLeft": {interopnames.SystemRuntimeGasLeft, nil, false},
|
||||||
"runtime.GetCallingScriptHash": {interopnames.SystemRuntimeGetCallingScriptHash, nil, false},
|
"runtime.GetCallingScriptHash": {interopnames.SystemRuntimeGetCallingScriptHash, nil, false},
|
||||||
"runtime.GetEntryScriptHash": {interopnames.SystemRuntimeGetEntryScriptHash, nil, false},
|
"runtime.GetEntryScriptHash": {interopnames.SystemRuntimeGetEntryScriptHash, nil, false},
|
||||||
"runtime.GetExecutingScriptHash": {interopnames.SystemRuntimeGetExecutingScriptHash, nil, false},
|
"runtime.GetExecutingScriptHash": {interopnames.SystemRuntimeGetExecutingScriptHash, nil, false},
|
||||||
"runtime.GetInvocationCounter": {interopnames.SystemRuntimeGetInvocationCounter, nil, false},
|
"runtime.GetInvocationCounter": {interopnames.SystemRuntimeGetInvocationCounter, nil, false},
|
||||||
"runtime.GetNotifications": {interopnames.SystemRuntimeGetNotifications, []string{u160}, false},
|
"runtime.GetNotifications": {interopnames.SystemRuntimeGetNotifications, []string{u160}, false},
|
||||||
"runtime.GetScriptContainer": {interopnames.SystemRuntimeGetScriptContainer, nil, false},
|
"runtime.GetScriptContainer": {interopnames.SystemRuntimeGetScriptContainer, nil, false},
|
||||||
"runtime.GetTime": {interopnames.SystemRuntimeGetTime, nil, false},
|
"runtime.GetTime": {interopnames.SystemRuntimeGetTime, nil, false},
|
||||||
"runtime.GetTrigger": {interopnames.SystemRuntimeGetTrigger, nil, false},
|
"runtime.GetTrigger": {interopnames.SystemRuntimeGetTrigger, nil, false},
|
||||||
"runtime.Log": {interopnames.SystemRuntimeLog, []string{`"msg"`}, true},
|
"runtime.Log": {interopnames.SystemRuntimeLog, []string{`"msg"`}, true},
|
||||||
"runtime.Notify": {interopnames.SystemRuntimeNotify, []string{`"ev"`, "1"}, true},
|
"runtime.Notify": {interopnames.SystemRuntimeNotify, []string{`"ev"`, "1"}, true},
|
||||||
"runtime.Platform": {interopnames.SystemRuntimePlatform, nil, false},
|
"runtime.Platform": {interopnames.SystemRuntimePlatform, nil, false},
|
||||||
"storage.Delete": {interopnames.SystemStorageDelete, []string{sctx, b}, true},
|
"storage.Delete": {interopnames.SystemStorageDelete, []string{sctx, b}, true},
|
||||||
"storage.Find": {interopnames.SystemStorageFind, []string{sctx, b, "storage.None"}, false},
|
"storage.Find": {interopnames.SystemStorageFind, []string{sctx, b, "storage.None"}, false},
|
||||||
"storage.Get": {interopnames.SystemStorageGet, []string{sctx, b}, false},
|
"storage.Get": {interopnames.SystemStorageGet, []string{sctx, b}, false},
|
||||||
"storage.GetContext": {interopnames.SystemStorageGetContext, nil, false},
|
"storage.GetContext": {interopnames.SystemStorageGetContext, nil, false},
|
||||||
"storage.GetReadOnlyContext": {interopnames.SystemStorageGetReadOnlyContext, nil, false},
|
"storage.GetReadOnlyContext": {interopnames.SystemStorageGetReadOnlyContext, nil, false},
|
||||||
"storage.Put": {interopnames.SystemStoragePut, []string{sctx, b, b}, true},
|
"storage.Put": {interopnames.SystemStoragePut, []string{sctx, b, b}, true},
|
||||||
"storage.ConvertContextToReadOnly": {interopnames.SystemStorageAsReadOnly, []string{sctx}, false},
|
"storage.ConvertContextToReadOnly": {interopnames.SystemStorageAsReadOnly, []string{sctx}, false},
|
||||||
"crypto.ECDSASecp256r1CheckMultisig": {interopnames.NeoCryptoCheckMultisigWithECDsaSecp256r1, []string{b, pubs, sigs}, false},
|
"crypto.CheckMultisig": {interopnames.NeoCryptoCheckMultisig, []string{pubs, sigs}, false},
|
||||||
"crypto.CheckSig": {interopnames.NeoCryptoCheckSig, []string{pub, sig}, false},
|
"crypto.CheckSig": {interopnames.NeoCryptoCheckSig, []string{pub, sig}, false},
|
||||||
}
|
}
|
||||||
ic := &interop.Context{}
|
ic := &interop.Context{}
|
||||||
core.SpawnVM(ic) // set Functions field
|
core.SpawnVM(ic) // set Functions field
|
||||||
|
|
4
pkg/consensus/testdata/wallet1.json
vendored
4
pkg/consensus/testdata/wallet1.json
vendored
|
@ -19,11 +19,11 @@
|
||||||
"isdefault": false
|
"isdefault": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"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": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYXADog3RQCwKRhqQsobwZEFopdcCJuMfPosM9pXPaDWSguKvznLdpADk",
|
"key": "6PYXADog3RQCwKRhqQsobwZEFopdcCJuMfPosM9pXPaDWSguKvznLdpADk",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"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": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYScv3Vgvdi9EkhDNvHXdvQeuaXK9gRwXDmytCswZMNpTzMLvfgR3U5dK",
|
"key": "6PYScv3Vgvdi9EkhDNvHXdvQeuaXK9gRwXDmytCswZMNpTzMLvfgR3U5dK",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"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": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYVwp1Sdg9DfTzvg42PZxgzMDf5a5FYBgT6ynKKzwmSHuhGkipoNjyW3a",
|
"key": "6PYVwp1Sdg9DfTzvg42PZxgzMDf5a5FYBgT6ynKKzwmSHuhGkipoNjyW3a",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
|
@ -24,7 +24,7 @@ func Calculate(base int64, script []byte) (int64, int) {
|
||||||
sizeInv := 66 * m
|
sizeInv := 66 * m
|
||||||
size += io.GetVarSize(sizeInv) + sizeInv + io.GetVarSize(script)
|
size += io.GetVarSize(sizeInv) + sizeInv + io.GetVarSize(script)
|
||||||
netFee += calculateMultisig(base, m) + calculateMultisig(base, n)
|
netFee += calculateMultisig(base, m) + calculateMultisig(base, n)
|
||||||
netFee += Opcode(base, opcode.PUSHNULL) + base*ECDSAVerifyPrice*int64(n)
|
netFee += base * ECDSAVerifyPrice * int64(n)
|
||||||
} else {
|
} else {
|
||||||
// We can support more contract types in the future.
|
// We can support more contract types in the future.
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,21 +7,14 @@ import (
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/fee"
|
"github.com/nspcc-dev/neo-go/pkg/core/fee"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto"
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ECDSASecp256r1CheckMultisig checks multiple ECDSA signatures at once using
|
// ECDSASecp256r1CheckMultisig checks multiple ECDSA signatures at once using
|
||||||
// Secp256r1 elliptic curve.
|
// Secp256r1 elliptic curve.
|
||||||
func ECDSASecp256r1CheckMultisig(ic *interop.Context) error {
|
func ECDSASecp256r1CheckMultisig(ic *interop.Context) error {
|
||||||
hashToCheck, err := getMessageHash(ic, ic.VM.Estack().Pop().Item())
|
hashToCheck := ic.Container.GetSignedHash()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
pkeys, err := ic.VM.Estack().PopSigElements()
|
pkeys, err := ic.VM.Estack().PopSigElements()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("wrong parameters: %w", err)
|
return fmt.Errorf("wrong parameters: %w", err)
|
||||||
|
@ -43,22 +36,6 @@ func ECDSASecp256r1CheckMultisig(ic *interop.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMessageHash(ic *interop.Context, item stackitem.Item) (util.Uint256, error) {
|
|
||||||
var msg []byte
|
|
||||||
switch val := item.(type) {
|
|
||||||
case *stackitem.Interop:
|
|
||||||
return val.Value().(crypto.Verifiable).GetSignedHash(), nil
|
|
||||||
case stackitem.Null:
|
|
||||||
return ic.Container.GetSignedHash(), nil
|
|
||||||
default:
|
|
||||||
var err error
|
|
||||||
if msg, err = val.TryBytes(); err != nil {
|
|
||||||
return util.Uint256{}, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hash.Sha256(msg), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ECDSASecp256r1CheckSig checks ECDSA signature using Secp256r1 elliptic curve.
|
// ECDSASecp256r1CheckSig checks ECDSA signature using Secp256r1 elliptic curve.
|
||||||
func ECDSASecp256r1CheckSig(ic *interop.Context) error {
|
func ECDSASecp256r1CheckSig(ic *interop.Context) error {
|
||||||
hashToCheck := ic.Container.GetSignedHash()
|
hashToCheck := ic.Container.GetSignedHash()
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||||
|
@ -60,12 +61,15 @@ func subSlice(arr []stackitem.Item, indices []int) []stackitem.Item {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func initCheckMultisigVMNoArgs() *vm.VM {
|
func initCheckMultisigVMNoArgs(container *transaction.Transaction) *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:], ecdsaSecp256r1CheckMultisigID)
|
binary.LittleEndian.PutUint32(buf[1:], neoCryptoCheckMultisigID)
|
||||||
|
|
||||||
ic := &interop.Context{Trigger: trigger.Verification}
|
ic := &interop.Context{
|
||||||
|
Trigger: trigger.Verification,
|
||||||
|
Container: container,
|
||||||
|
}
|
||||||
Register(ic)
|
Register(ic)
|
||||||
v := ic.SpawnVM()
|
v := ic.SpawnVM()
|
||||||
v.LoadScript(buf)
|
v.LoadScript(buf)
|
||||||
|
@ -73,10 +77,13 @@ func initCheckMultisigVMNoArgs() *vm.VM {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initCHECKMULTISIGVM(t *testing.T, n int, ik, is []int) *vm.VM {
|
func initCHECKMULTISIGVM(t *testing.T, n int, ik, is []int) *vm.VM {
|
||||||
v := initCheckMultisigVMNoArgs()
|
tx := transaction.New(netmode.UnitTestNet, []byte("NEO - An Open Network For Smart Economy"), 10)
|
||||||
msg := []byte("NEO - An Open Network For Smart Economy")
|
tx.Signers = []transaction.Signer{{Account: util.Uint160{1, 2, 3}}}
|
||||||
|
tx.Scripts = []transaction.Witness{{}}
|
||||||
|
|
||||||
pubs, sigs, _, err := initCHECKMULTISIG(msg, n)
|
v := initCheckMultisigVMNoArgs(tx)
|
||||||
|
|
||||||
|
pubs, sigs, _, err := initCHECKMULTISIG(tx.GetSignedPart(), n)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
pubs = subSlice(pubs, ik)
|
pubs = subSlice(pubs, ik)
|
||||||
|
@ -84,7 +91,6 @@ func initCHECKMULTISIGVM(t *testing.T, n int, ik, is []int) *vm.VM {
|
||||||
|
|
||||||
v.Estack().PushVal(sigs)
|
v.Estack().PushVal(sigs)
|
||||||
v.Estack().PushVal(pubs)
|
v.Estack().PushVal(pubs)
|
||||||
v.Estack().PushVal(msg)
|
|
||||||
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
@ -142,26 +148,20 @@ func testCurveCHECKMULTISIGBad(t *testing.T) {
|
||||||
pubs, sigs, _, err := initCHECKMULTISIG(msg, 1)
|
pubs, sigs, _, err := initCHECKMULTISIG(msg, 1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
arr := stackitem.NewArray([]stackitem.Item{stackitem.NewArray(nil)})
|
arr := stackitem.NewArray([]stackitem.Item{stackitem.NewArray(nil)})
|
||||||
|
tx := transaction.New(netmode.UnitTestNet, []byte("NEO - An Open Network For Smart Economy"), 10)
|
||||||
|
tx.Signers = []transaction.Signer{{Account: util.Uint160{1, 2, 3}}}
|
||||||
|
tx.Scripts = []transaction.Witness{{}}
|
||||||
|
|
||||||
t.Run("invalid message type", func(t *testing.T) {
|
|
||||||
v := initCheckMultisigVMNoArgs()
|
|
||||||
v.Estack().PushVal(sigs)
|
|
||||||
v.Estack().PushVal(pubs)
|
|
||||||
v.Estack().PushVal(stackitem.NewArray(nil))
|
|
||||||
require.Error(t, v.Run())
|
|
||||||
})
|
|
||||||
t.Run("invalid public keys", func(t *testing.T) {
|
t.Run("invalid public keys", func(t *testing.T) {
|
||||||
v := initCheckMultisigVMNoArgs()
|
v := initCheckMultisigVMNoArgs(tx)
|
||||||
v.Estack().PushVal(sigs)
|
v.Estack().PushVal(sigs)
|
||||||
v.Estack().PushVal(arr)
|
v.Estack().PushVal(arr)
|
||||||
v.Estack().PushVal(msg)
|
|
||||||
require.Error(t, v.Run())
|
require.Error(t, v.Run())
|
||||||
})
|
})
|
||||||
t.Run("invalid signatures", func(t *testing.T) {
|
t.Run("invalid signatures", func(t *testing.T) {
|
||||||
v := initCheckMultisigVMNoArgs()
|
v := initCheckMultisigVMNoArgs(tx)
|
||||||
v.Estack().PushVal(arr)
|
v.Estack().PushVal(arr)
|
||||||
v.Estack().PushVal(pubs)
|
v.Estack().PushVal(pubs)
|
||||||
v.Estack().PushVal(msg)
|
|
||||||
require.Error(t, v.Run())
|
require.Error(t, v.Run())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ecdsaSecp256r1CheckMultisigID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckMultisigWithECDsaSecp256r1))
|
neoCryptoCheckMultisigID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckMultisig))
|
||||||
neoCryptoCheckSigID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckSig))
|
neoCryptoCheckSigID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckSig))
|
||||||
)
|
)
|
||||||
|
|
||||||
var cryptoInterops = []interop.Function{
|
var cryptoInterops = []interop.Function{
|
||||||
{ID: ecdsaSecp256r1CheckMultisigID, Func: ECDSASecp256r1CheckMultisig},
|
{ID: neoCryptoCheckMultisigID, Func: ECDSASecp256r1CheckMultisig},
|
||||||
{ID: neoCryptoCheckSigID, Func: ECDSASecp256r1CheckSig},
|
{ID: neoCryptoCheckSigID, Func: ECDSASecp256r1CheckSig},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,43 +2,43 @@ package interopnames
|
||||||
|
|
||||||
// Names of all used interops.
|
// Names of all used interops.
|
||||||
const (
|
const (
|
||||||
SystemCallbackCreate = "System.Callback.Create"
|
SystemCallbackCreate = "System.Callback.Create"
|
||||||
SystemCallbackCreateFromMethod = "System.Callback.CreateFromMethod"
|
SystemCallbackCreateFromMethod = "System.Callback.CreateFromMethod"
|
||||||
SystemCallbackCreateFromSyscall = "System.Callback.CreateFromSyscall"
|
SystemCallbackCreateFromSyscall = "System.Callback.CreateFromSyscall"
|
||||||
SystemCallbackInvoke = "System.Callback.Invoke"
|
SystemCallbackInvoke = "System.Callback.Invoke"
|
||||||
SystemContractCall = "System.Contract.Call"
|
SystemContractCall = "System.Contract.Call"
|
||||||
SystemContractCallNative = "System.Contract.CallNative"
|
SystemContractCallNative = "System.Contract.CallNative"
|
||||||
SystemContractCreateMultisigAccount = "System.Contract.CreateMultisigAccount"
|
SystemContractCreateMultisigAccount = "System.Contract.CreateMultisigAccount"
|
||||||
SystemContractCreateStandardAccount = "System.Contract.CreateStandardAccount"
|
SystemContractCreateStandardAccount = "System.Contract.CreateStandardAccount"
|
||||||
SystemContractIsStandard = "System.Contract.IsStandard"
|
SystemContractIsStandard = "System.Contract.IsStandard"
|
||||||
SystemContractGetCallFlags = "System.Contract.GetCallFlags"
|
SystemContractGetCallFlags = "System.Contract.GetCallFlags"
|
||||||
SystemContractNativeOnPersist = "System.Contract.NativeOnPersist"
|
SystemContractNativeOnPersist = "System.Contract.NativeOnPersist"
|
||||||
SystemContractNativePostPersist = "System.Contract.NativePostPersist"
|
SystemContractNativePostPersist = "System.Contract.NativePostPersist"
|
||||||
SystemIteratorCreate = "System.Iterator.Create"
|
SystemIteratorCreate = "System.Iterator.Create"
|
||||||
SystemIteratorNext = "System.Iterator.Next"
|
SystemIteratorNext = "System.Iterator.Next"
|
||||||
SystemIteratorValue = "System.Iterator.Value"
|
SystemIteratorValue = "System.Iterator.Value"
|
||||||
SystemRuntimeCheckWitness = "System.Runtime.CheckWitness"
|
SystemRuntimeCheckWitness = "System.Runtime.CheckWitness"
|
||||||
SystemRuntimeGasLeft = "System.Runtime.GasLeft"
|
SystemRuntimeGasLeft = "System.Runtime.GasLeft"
|
||||||
SystemRuntimeGetCallingScriptHash = "System.Runtime.GetCallingScriptHash"
|
SystemRuntimeGetCallingScriptHash = "System.Runtime.GetCallingScriptHash"
|
||||||
SystemRuntimeGetEntryScriptHash = "System.Runtime.GetEntryScriptHash"
|
SystemRuntimeGetEntryScriptHash = "System.Runtime.GetEntryScriptHash"
|
||||||
SystemRuntimeGetExecutingScriptHash = "System.Runtime.GetExecutingScriptHash"
|
SystemRuntimeGetExecutingScriptHash = "System.Runtime.GetExecutingScriptHash"
|
||||||
SystemRuntimeGetInvocationCounter = "System.Runtime.GetInvocationCounter"
|
SystemRuntimeGetInvocationCounter = "System.Runtime.GetInvocationCounter"
|
||||||
SystemRuntimeGetNotifications = "System.Runtime.GetNotifications"
|
SystemRuntimeGetNotifications = "System.Runtime.GetNotifications"
|
||||||
SystemRuntimeGetScriptContainer = "System.Runtime.GetScriptContainer"
|
SystemRuntimeGetScriptContainer = "System.Runtime.GetScriptContainer"
|
||||||
SystemRuntimeGetTime = "System.Runtime.GetTime"
|
SystemRuntimeGetTime = "System.Runtime.GetTime"
|
||||||
SystemRuntimeGetTrigger = "System.Runtime.GetTrigger"
|
SystemRuntimeGetTrigger = "System.Runtime.GetTrigger"
|
||||||
SystemRuntimeLog = "System.Runtime.Log"
|
SystemRuntimeLog = "System.Runtime.Log"
|
||||||
SystemRuntimeNotify = "System.Runtime.Notify"
|
SystemRuntimeNotify = "System.Runtime.Notify"
|
||||||
SystemRuntimePlatform = "System.Runtime.Platform"
|
SystemRuntimePlatform = "System.Runtime.Platform"
|
||||||
SystemStorageDelete = "System.Storage.Delete"
|
SystemStorageDelete = "System.Storage.Delete"
|
||||||
SystemStorageFind = "System.Storage.Find"
|
SystemStorageFind = "System.Storage.Find"
|
||||||
SystemStorageGet = "System.Storage.Get"
|
SystemStorageGet = "System.Storage.Get"
|
||||||
SystemStorageGetContext = "System.Storage.GetContext"
|
SystemStorageGetContext = "System.Storage.GetContext"
|
||||||
SystemStorageGetReadOnlyContext = "System.Storage.GetReadOnlyContext"
|
SystemStorageGetReadOnlyContext = "System.Storage.GetReadOnlyContext"
|
||||||
SystemStoragePut = "System.Storage.Put"
|
SystemStoragePut = "System.Storage.Put"
|
||||||
SystemStorageAsReadOnly = "System.Storage.AsReadOnly"
|
SystemStorageAsReadOnly = "System.Storage.AsReadOnly"
|
||||||
NeoCryptoCheckMultisigWithECDsaSecp256r1 = "Neo.Crypto.CheckMultisigWithECDsaSecp256r1"
|
NeoCryptoCheckMultisig = "Neo.Crypto.CheckMultisig"
|
||||||
NeoCryptoCheckSig = "Neo.Crypto.CheckSig"
|
NeoCryptoCheckSig = "Neo.Crypto.CheckSig"
|
||||||
)
|
)
|
||||||
|
|
||||||
var names = []string{
|
var names = []string{
|
||||||
|
@ -77,6 +77,6 @@ var names = []string{
|
||||||
SystemStorageGetReadOnlyContext,
|
SystemStorageGetReadOnlyContext,
|
||||||
SystemStoragePut,
|
SystemStoragePut,
|
||||||
SystemStorageAsReadOnly,
|
SystemStorageAsReadOnly,
|
||||||
NeoCryptoCheckMultisigWithECDsaSecp256r1,
|
NeoCryptoCheckMultisig,
|
||||||
NeoCryptoCheckSig,
|
NeoCryptoCheckSig,
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ var systemInterops = []interop.Function{
|
||||||
}
|
}
|
||||||
|
|
||||||
var neoInterops = []interop.Function{
|
var neoInterops = []interop.Function{
|
||||||
{Name: interopnames.NeoCryptoCheckMultisigWithECDsaSecp256r1, Func: crypto.ECDSASecp256r1CheckMultisig, Price: 0, ParamCount: 3},
|
{Name: interopnames.NeoCryptoCheckMultisig, Func: crypto.ECDSASecp256r1CheckMultisig, Price: 0, ParamCount: 2},
|
||||||
{Name: interopnames.NeoCryptoCheckSig, Func: crypto.ECDSASecp256r1CheckSig, Price: fee.ECDSAVerifyPrice, ParamCount: 2},
|
{Name: interopnames.NeoCryptoCheckSig, Func: crypto.ECDSASecp256r1CheckSig, Price: fee.ECDSAVerifyPrice, ParamCount: 2},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,9 +97,9 @@ func TestCreateResponseTx(t *testing.T) {
|
||||||
bc.SetOracle(orc)
|
bc.SetOracle(orc)
|
||||||
tx, err := orc.CreateResponseTx(int64(req.GasForResponse), 1, resp)
|
tx, err := orc.CreateResponseTx(int64(req.GasForResponse), 1, resp)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, 167, tx.Size())
|
assert.Equal(t, 166, tx.Size())
|
||||||
assert.Equal(t, int64(2216640), tx.NetworkFee)
|
assert.Equal(t, int64(2215610), tx.NetworkFee)
|
||||||
assert.Equal(t, int64(97783360), tx.SystemFee)
|
assert.Equal(t, int64(97784390), tx.SystemFee)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOracle_InvalidWallet(t *testing.T) {
|
func TestOracle_InvalidWallet(t *testing.T) {
|
||||||
|
|
|
@ -17,14 +17,14 @@ func TestGenesisBlockMainNet(t *testing.T) {
|
||||||
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
|
block, err := createGenesisBlock(cfg.ProtocolConfiguration)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
expect := "d71dfebcc59d42b2f3b3f0e0d6b3b77a4880276db1df92c08c7c1bac94bece35"
|
expect := "de3bfe3e328af04d48f62bd7a9c533641cc0e1fb6a7741c5119d6a6eaedc5269"
|
||||||
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 = "NiVihDFvZacZhujTWkBhRz32UDuNRp416f"
|
consensusAddr = "NSX179gdoQmF8nu34rQdL4dYAfdCQhHtQS"
|
||||||
consensusScript = "f7b4d00143932f3b6243cfc06cb4a68f22c739e2"
|
consensusScript = "4870eaa62eee7c76b76d2ae933d4c027f5f5c77d"
|
||||||
)
|
)
|
||||||
|
|
||||||
cfg, err := config.Load("../../config", netmode.MainNet)
|
cfg, err := config.Load("../../config", netmode.MainNet)
|
||||||
|
|
|
@ -8,14 +8,15 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
|
"github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ECDSASecp256r1CheckMultisig checks multiple ECDSA signatures at once. It uses
|
// CheckMultisig checks that script container (transaction) is signed by multiple
|
||||||
// `Neo.Crypto.CheckMultisigWithECDsaSecp256r1` syscall.
|
// ECDSA keys at once. It uses `Neo.Crypto.CheckMultisig` syscall.
|
||||||
func ECDSASecp256r1CheckMultisig(msg []byte, pubs []interop.PublicKey, sigs []interop.Signature) bool {
|
func CheckMultisig(pubs []interop.PublicKey, sigs []interop.Signature) bool {
|
||||||
return neogointernal.Syscall3("Neo.Crypto.CheckMultisigWithECDsaSecp256r1", msg, pubs, sigs).(bool)
|
return neogointernal.Syscall2("Neo.Crypto.CheckMultisig", pubs, sigs).(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckSig checks that sig is correct script-container's signature for a given pub
|
// CheckSig checks that sig is correct signature of the script container
|
||||||
// (serialized public key). It uses `Neo.Crypto.CheckSig` syscall.
|
// (transaction) for a given pub (serialized public key). It uses
|
||||||
|
// `Neo.Crypto.CheckSig` syscall.
|
||||||
func CheckSig(pub interop.PublicKey, sig interop.Signature) bool {
|
func CheckSig(pub interop.PublicKey, sig interop.Signature) bool {
|
||||||
return neogointernal.Syscall2("Neo.Crypto.CheckSig", pub, sig).(bool)
|
return neogointernal.Syscall2("Neo.Crypto.CheckSig", pub, sig).(bool)
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ type rpcTestCase struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const testContractHash = "1e1c3024bd955ff3baf7cb92e3b7608c7bb3712b"
|
const testContractHash = "1e1c3024bd955ff3baf7cb92e3b7608c7bb3712b"
|
||||||
const deploymentTxHash = "9b14d575ae0f45a4e2765929a28a118693428edb8143615cc2ae58d5039d1c38"
|
const deploymentTxHash = "7cf43b182dee2e8bd2c5209cd230799aeba1b5b13000db682d917c89eacd1eae"
|
||||||
const genesisBlockHash = "9e7cf6fcfc8d0d6831fac75fa895535a5f1960f45a34754b57bff4d4929635c5"
|
const genesisBlockHash = "d237e3500d8b4cf0df3fd9c4c053016afae141207a6c732303bdd91aff444ecc"
|
||||||
|
|
||||||
const verifyContractHash = "5bb4bac40e961e334ba7bd36d2496010f67e246e"
|
const verifyContractHash = "5bb4bac40e961e334ba7bd36d2496010f67e246e"
|
||||||
const verifyContractAVM = "VwMAQS1RCDAhcAwUVVQtU+0PVUb61E1umZEoZwIvzl7bMHFoE87bKGnbKJdA"
|
const verifyContractAVM = "VwMAQS1RCDAhcAwUVVQtU+0PVUb61E1umZEoZwIvzl7bMHFoE87bKGnbKJdA"
|
||||||
|
|
BIN
pkg/rpc/server/testdata/testblocks.acc
vendored
BIN
pkg/rpc/server/testdata/testblocks.acc
vendored
Binary file not shown.
|
@ -8,7 +8,6 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateMultiSigRedeemScript creates an "m out of n" type verification script
|
// CreateMultiSigRedeemScript creates an "m out of n" type verification script
|
||||||
|
@ -31,8 +30,7 @@ func CreateMultiSigRedeemScript(m int, publicKeys keys.PublicKeys) ([]byte, erro
|
||||||
emit.Bytes(buf.BinWriter, pubKey.Bytes())
|
emit.Bytes(buf.BinWriter, pubKey.Bytes())
|
||||||
}
|
}
|
||||||
emit.Int(buf.BinWriter, int64(len(publicKeys)))
|
emit.Int(buf.BinWriter, int64(len(publicKeys)))
|
||||||
emit.Opcodes(buf.BinWriter, opcode.PUSHNULL)
|
emit.Syscall(buf.BinWriter, interopnames.NeoCryptoCheckMultisig)
|
||||||
emit.Syscall(buf.BinWriter, interopnames.NeoCryptoCheckMultisigWithECDsaSecp256r1)
|
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,8 @@ 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.SYSCALL, opcode.Opcode(br.ReadB()))
|
assert.Equal(t, opcode.SYSCALL, opcode.Opcode(br.ReadB()))
|
||||||
assert.Equal(t, interopnames.ToID([]byte(interopnames.NeoCryptoCheckMultisigWithECDsaSecp256r1)), br.ReadU32LE())
|
assert.Equal(t, interopnames.ToID([]byte(interopnames.NeoCryptoCheckMultisig)), br.ReadU32LE())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateDefaultMultiSigRedeemScript(t *testing.T) {
|
func TestCreateDefaultMultiSigRedeemScript(t *testing.T) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
verifyInteropID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckSig))
|
verifyInteropID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckSig))
|
||||||
multisigInteropID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckMultisigWithECDsaSecp256r1))
|
multisigInteropID = interopnames.ToID([]byte(interopnames.NeoCryptoCheckMultisig))
|
||||||
)
|
)
|
||||||
|
|
||||||
func getNumOfThingsFromInstr(instr opcode.Opcode, param []byte) (int, bool) {
|
func getNumOfThingsFromInstr(instr opcode.Opcode, param []byte) (int, bool) {
|
||||||
|
@ -49,6 +49,9 @@ func IsMultiSigContract(script []byte) bool {
|
||||||
// from the verification script of the contract.
|
// from the verification script of the contract.
|
||||||
func ParseMultiSigContract(script []byte) (int, [][]byte, bool) {
|
func ParseMultiSigContract(script []byte) (int, [][]byte, bool) {
|
||||||
var nsigs, nkeys int
|
var nsigs, nkeys int
|
||||||
|
if len(script) < 42 {
|
||||||
|
return nsigs, nil, false
|
||||||
|
}
|
||||||
|
|
||||||
ctx := NewContext(script)
|
ctx := NewContext(script)
|
||||||
instr, param, err := ctx.Next()
|
instr, param, err := ctx.Next()
|
||||||
|
@ -87,10 +90,6 @@ func ParseMultiSigContract(script []byte) (int, [][]byte, bool) {
|
||||||
if nkeys2 != nkeys {
|
if nkeys2 != nkeys {
|
||||||
return nsigs, nil, false
|
return nsigs, nil, false
|
||||||
}
|
}
|
||||||
instr, _, err = ctx.Next()
|
|
||||||
if err != nil || instr != opcode.PUSHNULL {
|
|
||||||
return nsigs, nil, false
|
|
||||||
}
|
|
||||||
instr, param, err = ctx.Next()
|
instr, param, err = ctx.Next()
|
||||||
if err != nil || instr != opcode.SYSCALL || binary.LittleEndian.Uint32(param) != multisigInteropID {
|
if err != nil || instr != opcode.SYSCALL || binary.LittleEndian.Uint32(param) != multisigInteropID {
|
||||||
return nsigs, nil, false
|
return nsigs, nil, false
|
||||||
|
|
|
@ -102,15 +102,9 @@ func TestIsMultiSigContract(t *testing.T) {
|
||||||
assert.False(t, IsMultiSigContract(prog))
|
assert.False(t, IsMultiSigContract(prog))
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("no PUSHNULL", func(t *testing.T) {
|
|
||||||
prog := testMultisigContract(t, 2, 2)
|
|
||||||
prog[len(prog)-6] ^= 0xFF
|
|
||||||
assert.False(t, IsMultiSigContract(prog))
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("invalid keys number", func(t *testing.T) {
|
t.Run("invalid keys number", func(t *testing.T) {
|
||||||
prog := testMultisigContract(t, 2, 2)
|
prog := testMultisigContract(t, 2, 2)
|
||||||
prog[len(prog)-7] = byte(opcode.PUSH3)
|
prog[len(prog)-6] = byte(opcode.PUSH3)
|
||||||
assert.False(t, IsMultiSigContract(prog))
|
assert.False(t, IsMultiSigContract(prog))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -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, "NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK", a.Address)
|
require.Equal(t, "NNudMSGzEoktFzdYGYoNb3bzHzbmM1genF", 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, "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY", a.Address)
|
require.Equal(t, "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6", 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": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"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": "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
|
"address": "NgEisvCqr2h8wpRxQb7bVPWUZdbVCY8Uo6",
|
||||||
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
"key": "6PYL8Gnjsz4RBKX18jx5ZAQTDH7PKkZwEVjPKEkjNzCDNFE6TKZwaFLibL",
|
||||||
"label": "",
|
"label": "",
|
||||||
"contract": {
|
"contract": {
|
||||||
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBE43vrw==",
|
"script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEF7zmyl",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "parameter0",
|
"name": "parameter0",
|
||||||
|
|
Loading…
Reference in a new issue