Merge pull request #3167 from nspcc-dev/autogen-warn

smartcontract: add `DO NOT EDIT` warning to autogenerated files
This commit is contained in:
Roman Khimov 2023-10-18 21:35:20 +03:00 committed by GitHub
commit 04d778612e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 38 additions and 2 deletions

View file

@ -176,6 +176,8 @@ func Blocks() []*alias.Block {
bs, err := os.ReadFile(outPath) bs, err := os.ReadFile(outPath)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, `// Package testcontract contains wrappers for testcontract contract. require.Equal(t, `// Package testcontract contains wrappers for testcontract contract.
//
// Code generated by neo-go contract generate-wrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]; DO NOT EDIT.
package testcontract package testcontract
import ( import (

View file

@ -46,7 +46,7 @@ var generateWrapperCmd = cli.Command{
var generateRPCWrapperCmd = cli.Command{ var generateRPCWrapperCmd = cli.Command{
Name: "generate-rpcwrapper", Name: "generate-rpcwrapper",
Usage: "generate RPC wrapper to use for data reads", Usage: "generate RPC wrapper to use for data reads",
UsageText: "neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]", UsageText: "neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]",
Action: contractGenerateRPCWrapper, Action: contractGenerateRPCWrapper,
Flags: generatorFlags, Flags: generatorFlags,
} }

View file

@ -152,6 +152,8 @@ callflags:
})) }))
const expected = `// Package wrapper contains wrappers for MyContract contract. const expected = `// Package wrapper contains wrappers for MyContract contract.
//
// Code generated by neo-go contract generate-wrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]; DO NOT EDIT.
package wrapper package wrapper
import ( import (
@ -266,6 +268,8 @@ func TestGenerateValidPackageName(t *testing.T) {
data, err := os.ReadFile(outFile) data, err := os.ReadFile(outFile)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, `// Package myspacecontract contains wrappers for My space contract contract. require.Equal(t, `// Package myspacecontract contains wrappers for My space contract contract.
//
// Code generated by neo-go contract generate-wrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]; DO NOT EDIT.
package myspacecontract package myspacecontract
import ( import (
@ -290,6 +294,8 @@ func Get() int {
data, err = os.ReadFile(outFile) data, err = os.ReadFile(outFile)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, `// Package myspacecontract contains RPC wrappers for My space contract contract. require.Equal(t, `// Package myspacecontract contains RPC wrappers for My space contract contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package myspacecontract package myspacecontract
import ( import (

View file

@ -1,4 +1,6 @@
// Package gastoken contains RPC wrappers for GasToken contract. // Package gastoken contains RPC wrappers for GasToken contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package gastoken package gastoken
import ( import (

View file

@ -1,4 +1,6 @@
// Package nameservice contains RPC wrappers for NameService contract. // Package nameservice contains RPC wrappers for NameService contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package nameservice package nameservice
import ( import (

View file

@ -1,4 +1,6 @@
// Package nextoken contains RPC wrappers for NEX Token contract. // Package nextoken contains RPC wrappers for NEX Token contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package nextoken package nextoken
import ( import (

View file

@ -1,4 +1,6 @@
// Package nonnepxxcontractwithiterators contains RPC wrappers for Non-NEPXX contract with iterators contract. // Package nonnepxxcontractwithiterators contains RPC wrappers for Non-NEPXX contract with iterators contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package nonnepxxcontractwithiterators package nonnepxxcontractwithiterators
import ( import (

View file

@ -1,4 +1,6 @@
// Package structs contains RPC wrappers for Notifications contract. // Package structs contains RPC wrappers for Notifications contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package structs package structs
import ( import (

View file

@ -1,4 +1,6 @@
// Package structs contains RPC wrappers for Notifications contract. // Package structs contains RPC wrappers for Notifications contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package structs package structs
import ( import (

View file

@ -1,4 +1,6 @@
// Package structs contains RPC wrappers for Notifications contract. // Package structs contains RPC wrappers for Notifications contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package structs package structs
import ( import (

View file

@ -1,4 +1,6 @@
// Package structs contains RPC wrappers for Types contract. // Package structs contains RPC wrappers for Types contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package structs package structs
import ( import (

View file

@ -1,4 +1,6 @@
// Package structs contains RPC wrappers for Types contract. // Package structs contains RPC wrappers for Types contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package structs package structs
import ( import (

View file

@ -1,4 +1,6 @@
// Package types contains RPC wrappers for Types contract. // Package types contains RPC wrappers for Types contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package types package types
import ( import (

View file

@ -1,4 +1,6 @@
// Package types contains RPC wrappers for Types contract. // Package types contains RPC wrappers for Types contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package types package types
import ( import (

View file

@ -1,4 +1,6 @@
// Package verify contains RPC wrappers for verify contract. // Package verify contains RPC wrappers for verify contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package verify package verify
import ( import (

View file

@ -34,6 +34,8 @@ func {{.Name}}({{range $index, $arg := .Arguments -}}
} }
{{- end -}} {{- end -}}
// Package {{.PackageName}} contains wrappers for {{.ContractName}} contract. // Package {{.PackageName}} contains wrappers for {{.ContractName}} contract.
//
// Code generated by neo-go contract generate-wrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]; DO NOT EDIT.
package {{.PackageName}} package {{.PackageName}}
import ( import (

View file

@ -113,6 +113,8 @@ func (c *Contract) {{.Name}}Unsigned({{range $index, $arg := .Arguments -}}
{{end}}` {{end}}`
bindingDefinition = `// Package {{.PackageName}} contains RPC wrappers for {{.ContractName}} contract. bindingDefinition = `// Package {{.PackageName}} contains RPC wrappers for {{.ContractName}} contract.
//
// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
package {{.PackageName}} package {{.PackageName}}
import ( import (

View file

@ -75,7 +75,7 @@ const (
// to see how to verify proofs via the Verifier contract: // to see how to verify proofs via the Verifier contract:
// https://github.com/nspcc-dev/neo-go/tree/master/examples/zkp/cubic_circuit. // https://github.com/nspcc-dev/neo-go/tree/master/examples/zkp/cubic_circuit.
// //
// This contract is automatically generated. // Code generated by neo-go zkpbinding.GenerateVerifier; DO NOT EDIT.
package main package main
import ( import (