vm: move RET and SYSCALL opcodes

This commit is contained in:
Evgenii Stratonikov 2020-05-07 13:23:05 +03:00
parent d3f1ccd518
commit f9f3192b48
21 changed files with 117 additions and 116 deletions

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "ASW1VhcukJRrukCXRipY4BE9d9zy4mAYsR",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b680a906ad4",
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "ASW1VhcukJRrukCXRipY4BE9d9zy4mAYsR",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b680a906ad4",
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",
@ -44,11 +44,11 @@
"isDefault": false
},
{
"address": "ANg3mmstMr7qtY8TgdKM777WSLKCNFbawM",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "AUhsL7QeeomkuzxZexPTa11xNXrbsBrGVc",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "110c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2110b683073b3bb",
"script": "110c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2110b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "Aaidx8VxYVjpD6knF8toWG7WquQjQFWcZB",
"key": "6PYMZM16cgdQ9GH5ejEPFqehuZ3Lp16W4fW7LyoBdUuVyeMeom7z8wP5QV",
"address": "AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF",
"key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q",
"label": "",
"contract": {
"script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b680a906ad4",
"script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYMZM16cgdQ9GH5ejEPFqehuZ3Lp16W4fW7LyoBdUuVyeMeom7z8wP5QV",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "Ae6y4Jx6rjwGu6Vtf6y1piTN3dnhCs6Gp4",
"key": "6PYSeHjvJFBn4FVccKHtaq2Hrvqa3aj9EDq5XSnWszvagRyxRmmRijqV6r",
"address": "AbrcCqhFRvewc3Xg2FZMY4nFaNM78kiNGv",
"key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy",
"label": "",
"contract": {
"script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b680a906ad4",
"script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYSeHjvJFBn4FVccKHtaq2Hrvqa3aj9EDq5XSnWszvagRyxRmmRijqV6r",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "ANysJU18KPh6jBBcrGby9bPAHxFmAeL1q3",
"key": "6PYNWeXTgyP88XsqDLUdjnCNHypSD8wYLURE78226LU9gYNiSGL1grjFC9",
"address": "APw5jfiLG2VpvTzMhCKvfmWdGfWfTmNC7x",
"key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM",
"label": "",
"contract": {
"script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b680a906ad4",
"script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYNWeXTgyP88XsqDLUdjnCNHypSD8wYLURE78226LU9gYNiSGL1grjFC9",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "ASW1VhcukJRrukCXRipY4BE9d9zy4mAYsR",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b680a906ad4",
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "Aaidx8VxYVjpD6knF8toWG7WquQjQFWcZB",
"key": "6PYMZM16cgdQ9GH5ejEPFqehuZ3Lp16W4fW7LyoBdUuVyeMeom7z8wP5QV",
"address": "AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF",
"key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q",
"label": "",
"contract": {
"script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b680a906ad4",
"script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYMZM16cgdQ9GH5ejEPFqehuZ3Lp16W4fW7LyoBdUuVyeMeom7z8wP5QV",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "Ae6y4Jx6rjwGu6Vtf6y1piTN3dnhCs6Gp4",
"key": "6PYSeHjvJFBn4FVccKHtaq2Hrvqa3aj9EDq5XSnWszvagRyxRmmRijqV6r",
"address": "AbrcCqhFRvewc3Xg2FZMY4nFaNM78kiNGv",
"key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy",
"label": "",
"contract": {
"script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b680a906ad4",
"script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYSeHjvJFBn4FVccKHtaq2Hrvqa3aj9EDq5XSnWszvagRyxRmmRijqV6r",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYUdV8YSMWxmJ6rjaUHBp8GazLwLCB5J69yy2Afgpjovescorhc5zS4Zy",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "ANysJU18KPh6jBBcrGby9bPAHxFmAeL1q3",
"key": "6PYNWeXTgyP88XsqDLUdjnCNHypSD8wYLURE78226LU9gYNiSGL1grjFC9",
"address": "APw5jfiLG2VpvTzMhCKvfmWdGfWfTmNC7x",
"key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM",
"label": "",
"contract": {
"script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b680a906ad4",
"script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYNWeXTgyP88XsqDLUdjnCNHypSD8wYLURE78226LU9gYNiSGL1grjFC9",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYVsJVu8LVaAUHi5hEpWVpWpdy9bWRk1x3RSp7ijCVkCoqyk9NjZT9NhM",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -20,14 +20,14 @@ func TestGenesisBlockMainNet(t *testing.T) {
// have been changed. Consequently, hash of the genesis block has been changed.
// Update expected genesis block hash for better times.
// Old hash is "d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"
expect := "8eb36fe47f07a795a1783a9f066603db66c5b76cf878650b1e137c114f46c0cc"
expect := "56bb42c251ea2b216c5ee8306e94fe040613bc626a3813aa32fe07e7607b3a1a"
assert.Equal(t, expect, block.Hash().StringLE())
}
func TestGetConsensusAddressMainNet(t *testing.T) {
var (
consensusAddr = "APtiVEdLi5GEmQ8CL5RcCE7BNcsPsxeXh7"
consensusScript = "590c459950f1d83e67ee11fcef202a6ebb8b1a77"
consensusAddr = "ASEhJHr51ZMQUqmUbPC5uiuJwwvedwC48F"
consensusScript = "72c3d9b3bbf776698694cd2c73fa597a10c31294"
)
cfg, err := config.Load("../../config", config.ModeMainNet)

View file

@ -89,7 +89,7 @@ func TestPubkeyToAddress(t *testing.T) {
pubKey, err := NewPublicKeyFromString("031ee4e73a17d8f76dc02532e2620bcb12425b33c0c9f9694cc2caa8226b68cad4")
require.NoError(t, err)
actual := pubKey.Address()
expected := "AbjmXh5RXBMvzYcv7LCmUgrX4sWk1QBJMK"
expected := "AJhhwPRwjUmQhEmwPBrq4CVTMRq7u4S4in"
require.Equal(t, expected, actual)
}

View file

@ -14,28 +14,28 @@ type Ktype struct {
// Arr contains a set of known keys in Ktype format.
var Arr = []Ktype{
{
Address: "AZdm8Dt15QFTrYkMYRrZsTmpx4jbeLtPFj",
Address: "AHF4z1wiN9EabrS4eZK9JngmmRYxkfNbLA",
PrivateKey: "7d128a6d096f0c14c3a25a2b0c41cf79661bfcb4a8cc95aaaea28bde4d732344",
PublicKey: "02028a99826edc0c97d18e22b6932373d908d323aa7f92656a77ec26e8861699ef",
Wif: "L1QqQJnpBwbsPGAuutuzPTac8piqvbR1HRjrY5qHup48TBCBFe4g",
Passphrase: "city of zion",
EncryptedWif: "6PYRQrhDFP6hM7Pb4cqJ7T1Erh1XabLDEs42fENU4Htvsdgt6SmShDbCLR",
EncryptedWif: "6PYV843ZXHHRKhHbTTKqBxGXbYm8ZvpcZdmcMasZe2n8scuPBBkmdDZk1J",
},
{
Address: "AHPNXvNiGGx43DBTEs9j1z9CjYSSC11jpe",
Address: "AM41GdiGK6eFJ7PZhd6yxsvFVWnsh9xUfg",
PrivateKey: "9ab7e154840daca3a2efadaf0df93cd3a5b51768c632f5433f86909d9b994a69",
PublicKey: "031d8e1630ce640966967bc6d95223d21f44304133003140c3b52004dc981349c9",
Wif: "L2QTooFoDFyRFTxmtiVHt5CfsXfVnexdbENGDkkrrgTTryiLsPMG",
Passphrase: "我的密码",
EncryptedWif: "6PYKuvXj1Yq9ZjsVNVyNrAHVHrAqg6BLxUoTdpZX5NFkG5Akq79dPYYm7c",
EncryptedWif: "6PYWUjTHVYg1iYVAR5B3E6BqbrcsYPVnHzpdHcjSE1emEYN9vqCGHtBBcx",
},
{
Address: "AGo5guykksq8uRxfWyC8dAnTMoz62yUWcn",
Address: "AP75QGPdWJceuMCVBiz1GN9Tj3XeU2uerB",
PrivateKey: "3edee7036b8fd9cef91de47386b191dd76db2888a553e7736bb02808932a915b",
PublicKey: "02232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa",
Wif: "KyKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG",
Passphrase: "MyL33tP@33w0rd",
EncryptedWif: "6PYQUTBmYbWZukmBTuvTkbjSmz7m5XkEzsyJBk32ZhvC7AbVUpArb1yeMv",
EncryptedWif: "6PYKssa8ZJE6LKvZ7TYomhwSs8jSvDuiPFcBwDVyeyYbgaXxRwtvKjYTe7",
},
{
Address: "xdf4UGKevVrMR1j3UkPsuoYKSC4ocoAkKx",
@ -43,7 +43,7 @@ var Arr = []Ktype{
PublicKey: "zz232ce8d2e2063dce0451131851d47421bfc4fc1da4db116fca5302c0756462fa",
Wif: "zzKvWLZsNwBJx5j9nurHYRwhYfdQUu9tTEDsLCUHDbYBL8cHxMiG",
Passphrase: "zzL33tP@33w0rd",
EncryptedWif: "6PYQUTBmYbWZukmBTuvTkbjSmz7m5XkEzsyJBk32ZhvC7AbVUpArb1yeMv",
EncryptedWif: "6PYKssa8ZJE6LKvZ7TYomhwSs8jSvDuiPFcBwDVyeyYbgaXxRwtvKjYTe7",
Invalid: true,
},
}

View file

@ -48,18 +48,18 @@ type rpcTestCase struct {
check func(t *testing.T, e *executor, result interface{})
}
const testContractHash = "2077e1382aab3983aa342e68f7bbc94e69f204b9"
const testContractHash = "a4bea0d56fad00a972135d54b381516205d78484"
var rpcTestCases = map[string][]rpcTestCase{
"getapplicationlog": {
{
name: "positive",
params: `["16c26d67f06770a5b0cda4b1c5ccc28d12c0197c7239a7fe30c2eb523b58f54d"]`,
params: `["caccb0e0465d87970190c90094e3fb54dbbcfa3e48683bd9a54b1fb834118d87"]`,
result: func(e *executor) interface{} { return &result.ApplicationLog{} },
check: func(t *testing.T, e *executor, acc interface{}) {
res, ok := acc.(*result.ApplicationLog)
require.True(t, ok)
expectedTxHash, err := util.Uint256DecodeStringLE("16c26d67f06770a5b0cda4b1c5ccc28d12c0197c7239a7fe30c2eb523b58f54d")
expectedTxHash, err := util.Uint256DecodeStringLE("caccb0e0465d87970190c90094e3fb54dbbcfa3e48683bd9a54b1fb834118d87")
require.NoError(t, err)
assert.Equal(t, expectedTxHash, res.TxHash)
assert.Equal(t, 1, len(res.Executions))
@ -473,7 +473,7 @@ var rpcTestCases = map[string][]rpcTestCase{
params: `["` + testchain.MultisigAddress() + `"]`,
result: func(*executor) interface{} {
// hash of the issueTx
h, _ := util.Uint256DecodeStringBE("99bd2bb2791887ddd3f64dac70ac15339956c76e7c306a1202372ff24fe30635")
h, _ := util.Uint256DecodeStringBE("3b76c9b726ffa9074a69441bf946c4c70b83474b3cf522ea3ba9dcd71c1a3db8")
amount := util.Fixed8FromInt64(1 * 8) // (endHeight - startHeight) * genAmount[0]
return &result.ClaimableInfo{
Spents: []result.Claimable{
@ -532,7 +532,7 @@ var rpcTestCases = map[string][]rpcTestCase{
"gettransactionheight": {
{
name: "positive",
params: `["1f08a32642a43e3f06b3b9a9355ed274c52de85a886841a2aef7edd94d1dc3f6"]`,
params: `["a05ea6d90b761ec5430f29d25036fdad04efe731b6a5906f4fd1e19048dee0f2"]`,
result: func(e *executor) interface{} {
h := 1
return &h
@ -744,7 +744,7 @@ var rpcTestCases = map[string][]rpcTestCase{
"sendrawtransaction": {
{
name: "positive",
params: `["80000b00000075a94799633ed955dd85a8af314a5b435ab51903b0040000000001e53e6c239e3d8441f623ea7b48cdea60c6ae0426a8bac04296002babfeafe5a4010001dcb7e70846bb5a6828205b81b579562f0e2c15f7b3badd68d485b035882fc17d0030d3dec386230075a94799633ed955dd85a8af314a5b435ab5190301420c408378eb6bdba1f14540cf2920a4d49c52327f617dc861a21d1c085346aaae2abd410e28dc6a03471a78e71246696a591b9677a71144dfba557d1c781c8c97e350290c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b680a906ad4"]`,
params: `["80000b000000316e851039019d39dfc2c37d6c3fee19fd580987b0040000000001241a237db30af3b33d29518288e0c9b542475733f78f4c6d7416cba89c1f1a67010001dcb7e70846bb5a6828205b81b579562f0e2c15f7b3badd68d485b035882fc17d0030d3dec3862300316e851039019d39dfc2c37d6c3fee19fd58098701420c40c3c3fedb73e36a8e78bae80ba07c20b34f5af6bba36dccbe0cdc7d4e1237f85eec36e63cb762e1e6ce031a6c752e1ce19a3994d15191a6b75f1a02ede7f9d117290c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4"]`,
result: func(e *executor) interface{} {
v := true
return &v

Binary file not shown.

Binary file not shown.

View file

@ -70,6 +70,9 @@ const (
ASSERT Opcode = 0x38
THROW Opcode = 0x3A
RET Opcode = 0x40
SYSCALL Opcode = 0x41
// Stack
DEPTH Opcode = 0x43
DROP Opcode = 0x45
@ -88,9 +91,7 @@ const (
REVERSE4 Opcode = 0x54
REVERSEN Opcode = 0x55
RET Opcode = 0x66
APPCALL Opcode = 0x67
SYSCALL Opcode = 0x68
TAILCALL Opcode = 0x69
// Old stack opcodes

View file

@ -62,6 +62,8 @@ func _() {
_ = x[ABORT-55]
_ = x[ASSERT-56]
_ = x[THROW-58]
_ = x[RET-64]
_ = x[SYSCALL-65]
_ = x[DEPTH-67]
_ = x[DROP-69]
_ = x[NIP-70]
@ -78,9 +80,7 @@ func _() {
_ = x[REVERSE3-83]
_ = x[REVERSE4-84]
_ = x[REVERSEN-85]
_ = x[RET-102]
_ = x[APPCALL-103]
_ = x[SYSCALL-104]
_ = x[TAILCALL-105]
_ = x[DUPFROMALTSTACK-106]
_ = x[TOALTSTACK-107]
@ -143,7 +143,7 @@ func _() {
_ = x[CONVERT-219]
}
const _Opcode_name = "PUSHINT8PUSHINT16PUSHINT32PUSHINT64PUSHINT128PUSHINT256PUSHNULLPUSHDATA1PUSHDATA2PUSHDATA4PUSHM1PUSH0PUSH1PUSH2PUSH3PUSH4PUSH5PUSH6PUSH7PUSH8PUSH9PUSH10PUSH11PUSH12PUSH13PUSH14PUSH15PUSH16NOPJMPJMPLJMPIFJMPIFLJMPIFNOTJMPIFNOTLJMPEQJMPEQLJMPNEJMPNELJMPGTJMPGTLJMPGEJMPGELJMPLTJMPLTLJMPLEJMPLELCALLCALLLABORTASSERTTHROWDEPTHDROPNIPXDROPCLEARDUPOVERPICKTUCKSWAPOLDPUSH1ROLLREVERSE3REVERSE4REVERSENRETAPPCALLSYSCALLTAILCALLDUPFROMALTSTACKTOALTSTACKFROMALTSTACKCATSUBSTRLEFTRIGHTINVERTANDORXOREQUALNOTEQUALSIGNABSNEGATEINCDECADDSUBMULDIVMODSHLSHRNOTBOOLANDBOOLORNZNUMEQUALNUMNOTEQUALLTLTEGTGTEMINMAXWITHINPACKUNPACKNEWARRAY0NEWARRAYNEWARRAYTNEWSTRUCT0NEWSTRUCTNEWMAPSIZEHASKEYKEYSVALUESPICKITEMAPPENDSETITEMREVERSEITEMSREMOVECLEARITEMSISNULLISTYPECONVERT"
const _Opcode_name = "PUSHINT8PUSHINT16PUSHINT32PUSHINT64PUSHINT128PUSHINT256PUSHNULLPUSHDATA1PUSHDATA2PUSHDATA4PUSHM1PUSH0PUSH1PUSH2PUSH3PUSH4PUSH5PUSH6PUSH7PUSH8PUSH9PUSH10PUSH11PUSH12PUSH13PUSH14PUSH15PUSH16NOPJMPJMPLJMPIFJMPIFLJMPIFNOTJMPIFNOTLJMPEQJMPEQLJMPNEJMPNELJMPGTJMPGTLJMPGEJMPGELJMPLTJMPLTLJMPLEJMPLELCALLCALLLABORTASSERTTHROWRETSYSCALLDEPTHDROPNIPXDROPCLEARDUPOVERPICKTUCKSWAPOLDPUSH1ROLLREVERSE3REVERSE4REVERSENAPPCALLTAILCALLDUPFROMALTSTACKTOALTSTACKFROMALTSTACKCATSUBSTRLEFTRIGHTINVERTANDORXOREQUALNOTEQUALSIGNABSNEGATEINCDECADDSUBMULDIVMODSHLSHRNOTBOOLANDBOOLORNZNUMEQUALNUMNOTEQUALLTLTEGTGTEMINMAXWITHINPACKUNPACKNEWARRAY0NEWARRAYNEWARRAYTNEWSTRUCT0NEWSTRUCTNEWMAPSIZEHASKEYKEYSVALUESPICKITEMAPPENDSETITEMREVERSEITEMSREMOVECLEARITEMSISNULLISTYPECONVERT"
var _Opcode_map = map[Opcode]string{
0: _Opcode_name[0:8],
@ -198,24 +198,24 @@ var _Opcode_map = map[Opcode]string{
55: _Opcode_name[301:306],
56: _Opcode_name[306:312],
58: _Opcode_name[312:317],
67: _Opcode_name[317:322],
69: _Opcode_name[322:326],
70: _Opcode_name[326:329],
72: _Opcode_name[329:334],
73: _Opcode_name[334:339],
74: _Opcode_name[339:342],
75: _Opcode_name[342:346],
77: _Opcode_name[346:350],
78: _Opcode_name[350:354],
80: _Opcode_name[354:358],
81: _Opcode_name[358:366],
82: _Opcode_name[366:370],
83: _Opcode_name[370:378],
84: _Opcode_name[378:386],
85: _Opcode_name[386:394],
102: _Opcode_name[394:397],
103: _Opcode_name[397:404],
104: _Opcode_name[404:411],
64: _Opcode_name[317:320],
65: _Opcode_name[320:327],
67: _Opcode_name[327:332],
69: _Opcode_name[332:336],
70: _Opcode_name[336:339],
72: _Opcode_name[339:344],
73: _Opcode_name[344:349],
74: _Opcode_name[349:352],
75: _Opcode_name[352:356],
77: _Opcode_name[356:360],
78: _Opcode_name[360:364],
80: _Opcode_name[364:368],
81: _Opcode_name[368:376],
82: _Opcode_name[376:380],
83: _Opcode_name[380:388],
84: _Opcode_name[388:396],
85: _Opcode_name[396:404],
103: _Opcode_name[404:411],
105: _Opcode_name[411:419],
106: _Opcode_name[419:434],
107: _Opcode_name[434:444],

View file

@ -113,13 +113,13 @@ func TestAccount_ConvertMultisig(t *testing.T) {
t.Run("1/1 multisig", func(t *testing.T) {
pubs := convertPubs(t, hexs[:1])
require.NoError(t, a.ConvertMultisig(1, pubs))
require.Equal(t, "ANg3mmstMr7qtY8TgdKM777WSLKCNFbawM", a.Address)
require.Equal(t, "AUhsL7QeeomkuzxZexPTa11xNXrbsBrGVc", a.Address)
})
t.Run("3/4 multisig", func(t *testing.T) {
pubs := convertPubs(t, hexs)
require.NoError(t, a.ConvertMultisig(3, pubs))
require.Equal(t, "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy", a.Address)
require.Equal(t, "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL", a.Address)
})
}

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "ASW1VhcukJRrukCXRipY4BE9d9zy4mAYsR",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b680a906ad4",
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",

View file

@ -2,11 +2,11 @@
"version": "1.0",
"accounts": [
{
"address": "ASW1VhcukJRrukCXRipY4BE9d9zy4mAYsR",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b680a906ad4",
"script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4",
"parameters": [
{
"name": "parameter0",
@ -19,11 +19,11 @@
"isDefault": false
},
{
"address": "Ad1wDxzcRiRSryvJobNV211Tv7UUiziPXy",
"key": "6PYNTeMkEZ1Q2MCqkPMgvC2kvRzH6f1sz4Sj9cGcLG4iYb43yQcpThAeap",
"address": "AXSvJVzydxXuL9da4GVwK25zdesCrVKkHL",
"key": "6PYMnbn4qBT8v156ii3nijRo2hQD1YHWkFXN7NKCrAZRzJDU1ych1sh2Wj",
"label": "",
"contract": {
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b683073b3bb",
"script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb",
"parameters": [
{
"name": "parameter0",
@ -44,11 +44,11 @@
"isDefault": false
},
{
"address": "Aaidx8VxYVjpD6knF8toWG7WquQjQFWcZB",
"key": "6PYMZM16cgdQ9GH5ejEPFqehuZ3Lp16W4fW7LyoBdUuVyeMeom7z8wP5QV",
"address": "AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF",
"key": "6PYLZTVkK3RoPU8PSAUPHfnu4Py2JcJfeT92FS77DDakRRLcrNu2uCY46Q",
"label": "",
"contract": {
"script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b680a906ad4",
"script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4",
"parameters": [
{
"name": "parameter0",

View file

@ -181,14 +181,14 @@ func TestWalletGetChangeAddress(t *testing.T) {
require.NoError(t, err)
sh := w1.GetChangeAddress()
// No default address, the first one is used.
expected, err := address.StringToUint160("ASW1VhcukJRrukCXRipY4BE9d9zy4mAYsR")
expected, err := address.StringToUint160("ALHF9wsXZVEuCGgmDA6ZNsCLtrb4A1g4yG")
require.NoError(t, err)
require.Equal(t, expected, sh)
w2, err := NewWalletFromFile("testdata/wallet2.json")
require.NoError(t, err)
sh = w2.GetChangeAddress()
// Default address.
expected, err = address.StringToUint160("Aaidx8VxYVjpD6knF8toWG7WquQjQFWcZB")
expected, err = address.StringToUint160("AJjSSuKdC88zWvXnZQbEfL21cm74pGJhsF")
require.NoError(t, err)
require.Equal(t, expected, sh)
}