Skip to content

Commit

Permalink
smartcontract: fix DO NOT EDIT warning to autogenerated files
Browse files Browse the repository at this point in the history
The text must appear as the first line of a properly formatted Go //
comment, and that comment must appear before but not be attached to the
package clause and before any /* */ comment.

Closes #3254

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Dec 25, 2023
1 parent de98b39 commit 1237c71
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 44 deletions.
6 changes: 3 additions & 3 deletions cli/smartcontract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ func Blocks() []*alias.Block {

bs, err := os.ReadFile(outPath)
require.NoError(t, err)
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.
require.Equal(t, `// Code generated by neo-go contract generate-wrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]; DO NOT EDIT.
// Package testcontract contains wrappers for testcontract contract.
package testcontract
import (
Expand Down
18 changes: 9 additions & 9 deletions cli/smartcontract/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ callflags:
"--hash", h.StringLE(),
}))

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.
const expected = `// Code generated by neo-go contract generate-wrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]; DO NOT EDIT.
// Package wrapper contains wrappers for MyContract contract.
package wrapper
import (
Expand Down Expand Up @@ -267,9 +267,9 @@ func TestGenerateValidPackageName(t *testing.T) {

data, err := os.ReadFile(outFile)
require.NoError(t, err)
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.
require.Equal(t, `// Code generated by neo-go contract generate-wrapper --manifest <file.json> --out <file.go> --hash <hash> [--config <config>]; DO NOT EDIT.
// Package myspacecontract contains wrappers for My space contract contract.
package myspacecontract
import (
Expand All @@ -293,9 +293,9 @@ func Get() int {

data, err = os.ReadFile(outFile)
require.NoError(t, err)
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.
require.Equal(t, `// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
// Package myspacecontract contains RPC wrappers for My space contract contract.
package myspacecontract
import (
Expand Down
4 changes: 2 additions & 2 deletions cli/smartcontract/testdata/gas/gas.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/smartcontract/testdata/nameservice/nns.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/smartcontract/testdata/nex/nex.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/smartcontract/testdata/nonepiter/iter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 contains RPC wrappers for Notifications contract.
package structs

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 contains RPC wrappers for Notifications contract.
package structs

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 contains RPC wrappers for Notifications contract.
package structs

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 contains RPC wrappers for Types contract.
package structs

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 contains RPC wrappers for Types contract.
package structs

import (
Expand Down
4 changes: 2 additions & 2 deletions cli/smartcontract/testdata/rpcbindings/types/rpcbindings.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 contains RPC wrappers for Types contract.
package types

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 contains RPC wrappers for Types contract.
package types

import (
Expand Down
4 changes: 2 additions & 2 deletions cli/smartcontract/testdata/verifyrpc/verify.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/smartcontract/binding/generate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/smartcontract/rpcbinding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ func (c *Contract) {{.Name}}Unsigned({{range $index, $arg := .Arguments -}}
}
{{end}}`

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.
bindingDefinition = `// Code generated by neo-go contract generate-rpcwrapper --manifest <file.json> --out <file.go> [--hash <hash>] [--config <config>]; DO NOT EDIT.
// Package {{.PackageName}} contains RPC wrappers for {{.ContractName}} contract.
package {{.PackageName}}
import (
Expand Down
6 changes: 3 additions & 3 deletions pkg/smartcontract/zkpbinding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ const (
// verification contract is circuit-specific, i.e. corresponds to a specific
// single constraint system. Thus, every new circuit requires vew verification
// contract to be generated and deployed to the chain.
goVerificationTmpl = `// Package main contains verification smart contract that uses Neo BLS12-381
goVerificationTmpl = `//Code generated by neo-go zkpbinding.GenerateVerifier; DO NOT EDIT.
// Package main contains verification smart contract that uses Neo BLS12-381
// curves interoperability functionality to verify provided proof against provided
// public input. The contract contains a single 'verifyProof' method that accepts
// a proof represented as three BLS12-381 curve points and public witnesses
Expand All @@ -74,8 +76,6 @@ const (
// go.sum files required for compilation. Please, refer to the NeoGo ZKP example
// to see how to verify proofs via the Verifier contract:
// https://github.com/nspcc-dev/neo-go/tree/master/examples/zkp/cubic_circuit.
//
// Code generated by neo-go zkpbinding.GenerateVerifier; DO NOT EDIT.
package main
import (
Expand Down

0 comments on commit 1237c71

Please sign in to comment.