Merge pull request #2443 from nspcc-dev/interops
core: support System.Runtime.GetAddressVersion
This commit is contained in:
commit
2c5fbd57fb
30 changed files with 70 additions and 39 deletions
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/engine
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/events
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/iterator
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/nft
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -3,7 +3,7 @@ module github.com/nspcc-dev/neo-go/examples/nft-nd-nns
|
|||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/nspcc-dev/neo-go v0.98.3-pre.0.20220405074910-7b5ff25a40a9
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
github.com/nspcc-dev/neo-go v0.98.3-pre.0.20220421162730-3463d7292fb9
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
github.com/stretchr/testify v1.7.0
|
||||
)
|
||||
|
|
|
@ -169,6 +169,7 @@ github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA
|
|||
github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20210721160347-1b03241391ac/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20220414131237-e497bbf7868e/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20210915112629-e1b6cce73d02/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 h1:n4ZaFCKt1pQJd7PXoMJabZWK9ejjbLOVrkl/lOUmshg=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U=
|
||||
|
@ -176,10 +177,10 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y=
|
|||
github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU=
|
||||
github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg=
|
||||
github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM=
|
||||
github.com/nspcc-dev/neo-go v0.98.3-pre.0.20220405074910-7b5ff25a40a9 h1:vZhVfrRRghbu+EbSvnCJLMnB68ndGQEhami7Yf28IWA=
|
||||
github.com/nspcc-dev/neo-go v0.98.3-pre.0.20220405074910-7b5ff25a40a9/go.mod h1:CrxyjB/HEDbnU8yaWICPxowKxv5voeh6KLNxF413+ko=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go v0.98.3-pre.0.20220421162730-3463d7292fb9 h1:hflyJ+EnjaLPXtpxM4Wibqo4ppnfXCjf4kBUzxvp/MU=
|
||||
github.com/nspcc-dev/neo-go v0.98.3-pre.0.20220421162730-3463d7292fb9/go.mod h1:LGZ16CRv4Nfh7KTt99CH/bhjOlTPQPbJcICJ4onP4Ds=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1 h1:SVqc523pZsSaS9vnPS1mm3VV6b6xY0gvdA0uYJ/GWZQ=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/nft-nd
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/oracle
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/runtime
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/storage
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/timer
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
|
@ -2,4 +2,4 @@ module github.com/nspcc-dev/neo-go/examples/token
|
|||
|
||||
go 1.16
|
||||
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
|
|
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
|||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/nspcc-dev/dbft v0.0.0-20220414131237-e497bbf7868e
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659
|
||||
github.com/nspcc-dev/rfc6979 v0.2.0
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible
|
||||
|
|
4
go.sum
4
go.sum
|
@ -183,8 +183,8 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y=
|
|||
github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU=
|
||||
github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg=
|
||||
github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e h1:LmVuj/p99qS2gDyogAkVpurdUMGRdiJBFe7bhTDI3wY=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220405074652-16f952270c1e/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c h1:D0iDtGEnFbld/tllTbv3ah4BQPPaItTs/Y8Li5zrEOw=
|
||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220421162616-d942940a826c/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1 h1:SVqc523pZsSaS9vnPS1mm3VV6b6xY0gvdA0uYJ/GWZQ=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
|
|
|
@ -71,6 +71,7 @@ func TestSyscallExecution(t *testing.T) {
|
|||
"runtime.BurnGas": {interopnames.SystemRuntimeBurnGas, []string{"1"}, true},
|
||||
"runtime.CheckWitness": {interopnames.SystemRuntimeCheckWitness, []string{b}, false},
|
||||
"runtime.GasLeft": {interopnames.SystemRuntimeGasLeft, nil, false},
|
||||
"runtime.GetAddressVersion": {interopnames.SystemRuntimeGetAddressVersion, nil, false},
|
||||
"runtime.GetCallingScriptHash": {interopnames.SystemRuntimeGetCallingScriptHash, nil, false},
|
||||
"runtime.GetEntryScriptHash": {interopnames.SystemRuntimeGetEntryScriptHash, nil, false},
|
||||
"runtime.GetExecutingScriptHash": {interopnames.SystemRuntimeGetExecutingScriptHash, nil, false},
|
||||
|
|
|
@ -16,6 +16,7 @@ const (
|
|||
SystemRuntimeBurnGas = "System.Runtime.BurnGas"
|
||||
SystemRuntimeCheckWitness = "System.Runtime.CheckWitness"
|
||||
SystemRuntimeGasLeft = "System.Runtime.GasLeft"
|
||||
SystemRuntimeGetAddressVersion = "System.Runtime.GetAddressVersion"
|
||||
SystemRuntimeGetCallingScriptHash = "System.Runtime.GetCallingScriptHash"
|
||||
SystemRuntimeGetEntryScriptHash = "System.Runtime.GetEntryScriptHash"
|
||||
SystemRuntimeGetExecutingScriptHash = "System.Runtime.GetExecutingScriptHash"
|
||||
|
@ -51,6 +52,7 @@ var names = []string{
|
|||
SystemRuntimeBurnGas,
|
||||
SystemRuntimeCheckWitness,
|
||||
SystemRuntimeGasLeft,
|
||||
SystemRuntimeGetAddressVersion,
|
||||
SystemRuntimeGetCallingScriptHash,
|
||||
SystemRuntimeGetEntryScriptHash,
|
||||
SystemRuntimeGetExecutingScriptHash,
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
|
@ -72,6 +73,12 @@ func GetInvocationCounter(ic *interop.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetAddressVersion returns the address version of the current protocol.
|
||||
func GetAddressVersion(ic *interop.Context) error {
|
||||
ic.VM.Estack().PushItem(stackitem.NewBigInteger(big.NewInt(int64(address.NEO3Prefix))))
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetNetwork returns chain network number.
|
||||
func GetNetwork(ic *interop.Context) error {
|
||||
m := ic.Chain.GetConfig().Magic
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"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/encoding/address"
|
||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neotest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neotest/chain"
|
||||
|
@ -207,6 +208,16 @@ func TestSystemRuntimeGetNetwork(t *testing.T) {
|
|||
e.InvokeScriptCheckHALT(t, w.Bytes(), []neotest.Signer{acc}, stackitem.NewBigInteger(big.NewInt(int64(bc.GetConfig().Magic))))
|
||||
}
|
||||
|
||||
func TestSystemRuntimeGetAddressVersion(t *testing.T) {
|
||||
bc, acc := chain.NewSingle(t)
|
||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||
w := io.NewBufBinWriter()
|
||||
|
||||
emit.Syscall(w.BinWriter, interopnames.SystemRuntimeGetAddressVersion)
|
||||
require.NoError(t, w.Err)
|
||||
e.InvokeScriptCheckHALT(t, w.Bytes(), []neotest.Signer{acc}, stackitem.NewBigInteger(big.NewInt(int64(address.NEO3Prefix))))
|
||||
}
|
||||
|
||||
func TestSystemRuntimeBurnGas(t *testing.T) {
|
||||
bc, acc := chain.NewSingle(t)
|
||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||
|
|
|
@ -46,6 +46,7 @@ var systemInterops = []interop.Function{
|
|||
{Name: interopnames.SystemRuntimeCheckWitness, Func: runtime.CheckWitness, Price: 1 << 10,
|
||||
RequiredFlags: callflag.NoneFlag, ParamCount: 1},
|
||||
{Name: interopnames.SystemRuntimeGasLeft, Func: runtime.GasLeft, Price: 1 << 4},
|
||||
{Name: interopnames.SystemRuntimeGetAddressVersion, Func: runtime.GetAddressVersion, Price: 1 << 3},
|
||||
{Name: interopnames.SystemRuntimeGetCallingScriptHash, Func: runtime.GetCallingScriptHash, Price: 1 << 4},
|
||||
{Name: interopnames.SystemRuntimeGetEntryScriptHash, Func: runtime.GetEntryScriptHash, Price: 1 << 4},
|
||||
{Name: interopnames.SystemRuntimeGetExecutingScriptHash, Func: runtime.GetExecutingScriptHash, Price: 1 << 4},
|
||||
|
|
|
@ -46,6 +46,14 @@ func Notify(name string, args ...interface{}) {
|
|||
neogointernal.Syscall2NoReturn("System.Runtime.Notify", name, args)
|
||||
}
|
||||
|
||||
// GetAddressVersion returns the address version of the current protocol. The
|
||||
// address version represents the byte used to prepend to Neo addresses when
|
||||
// encoding them. The default value for Neo3 is 53 (0x35). This function uses
|
||||
// `System.Runtime.GetAddressVersion` syscall.
|
||||
func GetAddressVersion() int {
|
||||
return neogointernal.Syscall0("System.Runtime.GetAddressVersion").(int)
|
||||
}
|
||||
|
||||
// GetNetwork returns network magic number. This function uses
|
||||
// `System.Runtime.GetNetwork` syscall.
|
||||
func GetNetwork() int {
|
||||
|
|
Loading…
Reference in a new issue