Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nspcc-dev/neo-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d012a6b5003295f5a0b91bd81f8ea6ebb63ec64f
Choose a base ref
..
head repository: nspcc-dev/neo-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3d27ef8e35453a934d0e20c969b0fd588201156f
Choose a head ref
Showing with 5,039 additions and 559 deletions.
  1. +1 −1 .gitmodules
  2. +62 −0 cli/smartcontract/testdata/rpcbindings/nft-nd/rpcbindings.out
  3. +62 −0 cli/smartcontract/testdata/rpcbindings/nft-nd/rpcbindings_dynamic_hash.out
  4. +113 −0 cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings_extended.out
  5. +113 −0 cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings_guessed.out
  6. +1,564 −17 cli/smartcontract/testdata/rpcbindings/structs/rpcbindings.out
  7. +1,564 −17 cli/smartcontract/testdata/rpcbindings/structs/rpcbindings_dynamic_hash.out
  8. +113 −0 cli/smartcontract/testdata/rpcbindings/types/rpcbindings.out
  9. +113 −0 cli/smartcontract/testdata/rpcbindings/types/rpcbindings_dynamic_hash.out
  10. +2 −0 docs/node-configuration.md
  11. +58 −1 docs/rpc.md
  12. +1 −1 examples/nft-d/nft.yml
  13. +1 −1 examples/nft-nd/nft.yml
  14. +9 −10 examples/zkp/cubic_circuit/go.mod
  15. +18 −20 examples/zkp/cubic_circuit/go.sum
  16. +1 −1 go.mod
  17. +2 −2 go.sum
  18. +18 −0 internal/fakechain/fakechain.go
  19. +2 −2 pkg/compiler/compiler.go
  20. +1 −0 pkg/config/config.go
  21. +3 −0 pkg/config/ledger_config.go
  22. +2 −0 pkg/config/protocol_config.go
  23. +2 −2 pkg/consensus/consensus.go
  24. +1 −1 pkg/consensus/consensus_test.go
  25. +6 −103 pkg/core/block/block.go
  26. +0 −41 pkg/core/block/block_test.go
  27. +28 −0 pkg/core/block/header.go
  28. +19 −0 pkg/core/blockchain.go
  29. +6 −15 pkg/core/dao/dao.go
  30. +21 −18 pkg/core/interop/context.go
  31. +13 −0 pkg/core/interop/contract/call.go
  32. +1 −1 pkg/core/native/native_gas.go
  33. +5 −1 pkg/core/native/native_neo.go
  34. +5 −2 pkg/core/native/native_nep17.go
  35. +2 −2 pkg/core/native/native_test/management_test.go
  36. +3 −1 pkg/core/native/notary.go
  37. +120 −0 pkg/core/state/contract_invocation.go
  38. +51 −0 pkg/core/state/contract_invocation_test.go
  39. +36 −6 pkg/core/state/notification_event.go
  40. +67 −1 pkg/core/statesync/module.go
  41. +66 −54 pkg/network/bqueue/queue.go
  42. +32 −11 pkg/network/bqueue/queue_test.go
  43. +75 −0 pkg/network/bqueue_adapters.go
  44. +92 −26 pkg/network/server.go
  45. +5 −2 pkg/network/state_sync.go
  46. +132 −33 pkg/services/blockfetcher/blockfetcher.go
  47. +11 −7 pkg/services/blockfetcher/blockfetcher_test.go
  48. +65 −0 pkg/services/rpcsrv/notification_comparator.go
  49. +3 −11 pkg/services/rpcsrv/server.go
  50. +4 −5 pkg/services/rpcsrv/server_test.go
  51. +0 −49 pkg/services/rpcsrv/util.go
  52. +16 −4 pkg/smartcontract/manifest/manifest.go
  53. +1 −1 pkg/smartcontract/manifest/manifest_test.go
  54. +2 −2 pkg/smartcontract/manifest/standard/comply.go
  55. +24 −0 pkg/smartcontract/manifest/standard/nep26.go
  56. +23 −0 pkg/smartcontract/manifest/standard/nep27.go
  57. +8 −38 pkg/smartcontract/manifest/standard/payable.go
  58. +221 −7 pkg/smartcontract/rpcbinding/binding.go
  59. +5 −5 pkg/smartcontract/zkpbinding/binding.go
  60. +44 −36 pkg/vm/stackitem/item.go
  61. +1 −1 pkg/vm/testdata/neo-vm
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "pkg/vm/testdata/neo-vm"]
path = pkg/vm/testdata/neo-vm
url = https://github.com/neo-project/neo-vm.git
url = https://github.com/neo-project/neo.git
branch = master
62 changes: 62 additions & 0 deletions cli/smartcontract/testdata/rpcbindings/nft-nd/rpcbindings.out
Original file line number Diff line number Diff line change
@@ -208,8 +208,15 @@ func itemToNftRoyaltyRecipientShare(item stackitem.Item, err error) (*NftRoyalty
return res, err
}

// Ensure *NftRoyaltyRecipientShare is a proper [stackitem.Convertible].
var _ = stackitem.Convertible(&NftRoyaltyRecipientShare{})

// Ensure *NftRoyaltyRecipientShare is a proper [smartcontract.Convertible].
var _ = smartcontract.Convertible(&NftRoyaltyRecipientShare{})

// FromStackItem retrieves fields of NftRoyaltyRecipientShare from the given
// [stackitem.Item] or returns an error if it's not possible to do to so.
// It implements [stackitem.Convertible] interface.
func (res *NftRoyaltyRecipientShare) FromStackItem(item stackitem.Item) error {
arr, ok := item.Value().([]stackitem.Item)
if !ok {
@@ -247,3 +254,58 @@ func (res *NftRoyaltyRecipientShare) FromStackItem(item stackitem.Item) error {

return nil
}

// ToStackItem creates [stackitem.Item] representing NftRoyaltyRecipientShare.
// It implements [stackitem.Convertible] interface.
func (res *NftRoyaltyRecipientShare) ToStackItem() (stackitem.Item, error) {
if res == nil {
return stackitem.Null{}, nil
}

var (
err error
itm stackitem.Item
items = make([]stackitem.Item, 0, 2)
)
itm, err = stackitem.NewByteArray(res.Address.BytesBE()), error(nil)
if err != nil {
return nil, fmt.Errorf("field Address: %w", err)
}
items = append(items, itm)

itm, err = (*stackitem.BigInteger)(res.Share), error(nil)
if err != nil {
return nil, fmt.Errorf("field Share: %w", err)
}
items = append(items, itm)

return stackitem.NewStruct(items), nil
}

// ToSCParameter creates [smartcontract.Parameter] representing NftRoyaltyRecipientShare.
// It implements [smartcontract.Convertible] interface so that NftRoyaltyRecipientShare
// could be used with invokers.
func (res *NftRoyaltyRecipientShare) ToSCParameter() (smartcontract.Parameter, error) {
if res == nil {
return smartcontract.Parameter{Type: smartcontract.AnyType}, nil
}

var (
err error
prm smartcontract.Parameter
prms = make([]smartcontract.Parameter, 0, 2)
)
prm, err = smartcontract.NewParameterFromValue(res.Address)
if err != nil {
return smartcontract.Parameter{}, fmt.Errorf("field Address: %w", err)
}
prms = append(prms, prm)

prm, err = smartcontract.NewParameterFromValue(res.Share)
if err != nil {
return smartcontract.Parameter{}, fmt.Errorf("field Share: %w", err)
}
prms = append(prms, prm)

return smartcontract.Parameter{Type: smartcontract.ArrayType, Value: prms}, nil
}
Original file line number Diff line number Diff line change
@@ -203,8 +203,15 @@ func itemToNftRoyaltyRecipientShare(item stackitem.Item, err error) (*NftRoyalty
return res, err
}

// Ensure *NftRoyaltyRecipientShare is a proper [stackitem.Convertible].
var _ = stackitem.Convertible(&NftRoyaltyRecipientShare{})

// Ensure *NftRoyaltyRecipientShare is a proper [smartcontract.Convertible].
var _ = smartcontract.Convertible(&NftRoyaltyRecipientShare{})

// FromStackItem retrieves fields of NftRoyaltyRecipientShare from the given
// [stackitem.Item] or returns an error if it's not possible to do to so.
// It implements [stackitem.Convertible] interface.
func (res *NftRoyaltyRecipientShare) FromStackItem(item stackitem.Item) error {
arr, ok := item.Value().([]stackitem.Item)
if !ok {
@@ -242,3 +249,58 @@ func (res *NftRoyaltyRecipientShare) FromStackItem(item stackitem.Item) error {

return nil
}

// ToStackItem creates [stackitem.Item] representing NftRoyaltyRecipientShare.
// It implements [stackitem.Convertible] interface.
func (res *NftRoyaltyRecipientShare) ToStackItem() (stackitem.Item, error) {
if res == nil {
return stackitem.Null{}, nil
}

var (
err error
itm stackitem.Item
items = make([]stackitem.Item, 0, 2)
)
itm, err = stackitem.NewByteArray(res.Address.BytesBE()), error(nil)
if err != nil {
return nil, fmt.Errorf("field Address: %w", err)
}
items = append(items, itm)

itm, err = (*stackitem.BigInteger)(res.Share), error(nil)
if err != nil {
return nil, fmt.Errorf("field Share: %w", err)
}
items = append(items, itm)

return stackitem.NewStruct(items), nil
}

// ToSCParameter creates [smartcontract.Parameter] representing NftRoyaltyRecipientShare.
// It implements [smartcontract.Convertible] interface so that NftRoyaltyRecipientShare
// could be used with invokers.
func (res *NftRoyaltyRecipientShare) ToSCParameter() (smartcontract.Parameter, error) {
if res == nil {
return smartcontract.Parameter{Type: smartcontract.AnyType}, nil
}

var (
err error
prm smartcontract.Parameter
prms = make([]smartcontract.Parameter, 0, 2)
)
prm, err = smartcontract.NewParameterFromValue(res.Address)
if err != nil {
return smartcontract.Parameter{}, fmt.Errorf("field Address: %w", err)
}
prms = append(prms, prm)

prm, err = smartcontract.NewParameterFromValue(res.Share)
if err != nil {
return smartcontract.Parameter{}, fmt.Errorf("field Share: %w", err)
}
prms = append(prms, prm)

return smartcontract.Parameter{Type: smartcontract.ArrayType, Value: prms}, nil
}
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"math/big"
@@ -200,8 +201,15 @@ func itemToCrazyStruct(item stackitem.Item, err error) (*CrazyStruct, error) {
return res, err
}

// Ensure *CrazyStruct is a proper [stackitem.Convertible].
var _ = stackitem.Convertible(&CrazyStruct{})

// Ensure *CrazyStruct is a proper [smartcontract.Convertible].
var _ = smartcontract.Convertible(&CrazyStruct{})

// FromStackItem retrieves fields of CrazyStruct from the given
// [stackitem.Item] or returns an error if it's not possible to do to so.
// It implements [stackitem.Convertible] interface.
func (res *CrazyStruct) FromStackItem(item stackitem.Item) error {
arr, ok := item.Value().([]stackitem.Item)
if !ok {
@@ -230,6 +238,61 @@ func (res *CrazyStruct) FromStackItem(item stackitem.Item) error {
return nil
}

// ToStackItem creates [stackitem.Item] representing CrazyStruct.
// It implements [stackitem.Convertible] interface.
func (res *CrazyStruct) ToStackItem() (stackitem.Item, error) {
if res == nil {
return stackitem.Null{}, nil
}

var (
err error
itm stackitem.Item
items = make([]stackitem.Item, 0, 2)
)
itm, err = (*stackitem.BigInteger)(res.I), error(nil)
if err != nil {
return nil, fmt.Errorf("field I: %w", err)
}
items = append(items, itm)

itm, err = stackitem.NewBool(res.B), error(nil)
if err != nil {
return nil, fmt.Errorf("field B: %w", err)
}
items = append(items, itm)

return stackitem.NewStruct(items), nil
}

// ToSCParameter creates [smartcontract.Parameter] representing CrazyStruct.
// It implements [smartcontract.Convertible] interface so that CrazyStruct
// could be used with invokers.
func (res *CrazyStruct) ToSCParameter() (smartcontract.Parameter, error) {
if res == nil {
return smartcontract.Parameter{Type: smartcontract.AnyType}, nil
}

var (
err error
prm smartcontract.Parameter
prms = make([]smartcontract.Parameter, 0, 2)
)
prm, err = smartcontract.NewParameterFromValue(res.I)
if err != nil {
return smartcontract.Parameter{}, fmt.Errorf("field I: %w", err)
}
prms = append(prms, prm)

prm, err = smartcontract.NewParameterFromValue(res.B)
if err != nil {
return smartcontract.Parameter{}, fmt.Errorf("field B: %w", err)
}
prms = append(prms, prm)

return smartcontract.Parameter{Type: smartcontract.ArrayType, Value: prms}, nil
}

// itemToSimpleStruct converts stack item into *SimpleStruct.
// NULL item is returned as nil pointer without error.
func itemToSimpleStruct(item stackitem.Item, err error) (*SimpleStruct, error) {
@@ -245,8 +308,15 @@ func itemToSimpleStruct(item stackitem.Item, err error) (*SimpleStruct, error) {
return res, err
}

// Ensure *SimpleStruct is a proper [stackitem.Convertible].
var _ = stackitem.Convertible(&SimpleStruct{})

// Ensure *SimpleStruct is a proper [smartcontract.Convertible].
var _ = smartcontract.Convertible(&SimpleStruct{})

// FromStackItem retrieves fields of SimpleStruct from the given
// [stackitem.Item] or returns an error if it's not possible to do to so.
// It implements [stackitem.Convertible] interface.
func (res *SimpleStruct) FromStackItem(item stackitem.Item) error {
arr, ok := item.Value().([]stackitem.Item)
if !ok {
@@ -269,6 +339,49 @@ func (res *SimpleStruct) FromStackItem(item stackitem.Item) error {
return nil
}

// ToStackItem creates [stackitem.Item] representing SimpleStruct.
// It implements [stackitem.Convertible] interface.
func (res *SimpleStruct) ToStackItem() (stackitem.Item, error) {
if res == nil {
return stackitem.Null{}, nil
}

var (
err error
itm stackitem.Item
items = make([]stackitem.Item, 0, 1)
)
itm, err = (*stackitem.BigInteger)(res.I), error(nil)
if err != nil {
return nil, fmt.Errorf("field I: %w", err)
}
items = append(items, itm)

return stackitem.NewStruct(items), nil
}

// ToSCParameter creates [smartcontract.Parameter] representing SimpleStruct.
// It implements [smartcontract.Convertible] interface so that SimpleStruct
// could be used with invokers.
func (res *SimpleStruct) ToSCParameter() (smartcontract.Parameter, error) {
if res == nil {
return smartcontract.Parameter{Type: smartcontract.AnyType}, nil
}

var (
err error
prm smartcontract.Parameter
prms = make([]smartcontract.Parameter, 0, 1)
)
prm, err = smartcontract.NewParameterFromValue(res.I)
if err != nil {
return smartcontract.Parameter{}, fmt.Errorf("field I: %w", err)
}
prms = append(prms, prm)

return smartcontract.Parameter{Type: smartcontract.ArrayType, Value: prms}, nil
}

// ComplicatedNameEventsFromApplicationLog retrieves a set of all emitted events
// with "! complicated name %$#" name from the provided [result.ApplicationLog].
func ComplicatedNameEventsFromApplicationLog(log *result.ApplicationLog) ([]*ComplicatedNameEvent, error) {
Loading