Commit ce0df3b4 authored by harrylee's avatar harrylee Committed by 33cn

add unlinter comment line

parent 8b6c1218
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
// //
// BLAKE2X is a construction to compute hash values larger than 64 bytes. It // BLAKE2X is a construction to compute hash values larger than 64 bytes. It
// can produce hash values between 0 and 4 GiB. // can produce hash values between 0 and 4 GiB.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import ( import (
...@@ -302,18 +304,18 @@ func appendUint64(b []byte, x uint64) []byte { ...@@ -302,18 +304,18 @@ func appendUint64(b []byte, x uint64) []byte {
return append(b, a[:]...) return append(b, a[:]...)
} }
//func appendUint32(b []byte, x uint32) []byte { func appendUint32(b []byte, x uint32) []byte {
// var a [4]byte var a [4]byte
// binary.BigEndian.PutUint32(a[:], x) binary.BigEndian.PutUint32(a[:], x)
// return append(b, a[:]...) return append(b, a[:]...)
//} }
func consumeUint64(b []byte) ([]byte, uint64) { func consumeUint64(b []byte) ([]byte, uint64) {
x := binary.BigEndian.Uint64(b) x := binary.BigEndian.Uint64(b)
return b[8:], x return b[8:], x
} }
//func consumeUint32(b []byte) ([]byte, uint32) { func consumeUint32(b []byte) ([]byte, uint32) {
// x := binary.BigEndian.Uint32(b) x := binary.BigEndian.Uint32(b)
// return b[4:], x return b[4:], x
//} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// +build go1.7,amd64,!gccgo,!appengine // +build go1.7,amd64,!gccgo,!appengine
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import "golang.org/x/sys/cpu" import "golang.org/x/sys/cpu"
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// +build !go1.7,amd64,!gccgo,!appengine // +build !go1.7,amd64,!gccgo,!appengine
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import "golang.org/x/sys/cpu" import "golang.org/x/sys/cpu"
......
// +build gofuzz // +build gofuzz
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import ( import (
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import ( import (
"encoding/binary"
"math/bits" "math/bits"
) )
...@@ -24,23 +26,23 @@ var precomputed = [10][16]byte{ ...@@ -24,23 +26,23 @@ var precomputed = [10][16]byte{
{10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0}, {10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0},
} }
//func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) { func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
// var m [16]uint64 var m [16]uint64
// c0, c1 := c[0], c[1] c0, c1 := c[0], c[1]
//
// for i := 0; i < len(blocks); { for i := 0; i < len(blocks); {
// c0 += BlockSize c0 += BlockSize
// if c0 < BlockSize { if c0 < BlockSize {
// c1++ c1++
// } }
// for j := range m { for j := range m {
// m[j] = binary.LittleEndian.Uint64(blocks[i:]) m[j] = binary.LittleEndian.Uint64(blocks[i:])
// i += 8 i += 8
// } }
// fGeneric(h, &m, c0, c1, flag, 12) fGeneric(h, &m, c0, c1, flag, 12)
// } }
// c[0], c[1] = c0, c1 c[0], c[1] = c0, c1
//} }
func fGeneric(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) { func fGeneric(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) {
v0, v1, v2, v3, v4, v5, v6, v7 := h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7] v0, v1, v2, v3, v4, v5, v6, v7 := h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7]
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// +build !amd64 appengine gccgo // +build !amd64 appengine gccgo
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
func f(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) { func f(h *[8]uint64, m *[16]uint64, c0, c1 uint64, flag uint64, rounds uint64) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import ( import (
...@@ -14,13 +15,13 @@ import ( ...@@ -14,13 +15,13 @@ import (
"testing" "testing"
) )
//func fromHex(s string) []byte { func fromHex(s string) []byte {
// b, err := hex.DecodeString(s) b, err := hex.DecodeString(s)
// if err != nil { if err != nil {
// panic(err) panic(err)
// } }
// return b return b
//} }
func TestHashes(t *testing.T) { func TestHashes(t *testing.T) {
defer func(sse4, avx, avx2 bool) { defer func(sse4, avx, avx2 bool) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import ( import (
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// +build go1.9 // +build go1.9
//nolint:unparam // 忽视本文件所有golangci-linter检查
package blake2b package blake2b
import ( import (
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
// +build amd64,blsasm amd64,blsadx // +build amd64,blsasm amd64,blsadx
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
// +build !amd64 !blsasm,!blsadx // +build !amd64 !blsasm,!blsadx
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
// +build amd64,blsadx // +build amd64,blsadx
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
// enableADX is true if the ADX/BMI2 instruction set was requested for the BLS // enableADX is true if the ADX/BMI2 instruction set was requested for the BLS
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
// +build amd64,blsasm // +build amd64,blsasm
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
// enableADX is true if the ADX/BMI2 instruction set was requested for the BLS // enableADX is true if the ADX/BMI2 instruction set was requested for the BLS
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
/* /*
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
...@@ -37,8 +38,7 @@ func (e *E) Set(e2 *E) *E { ...@@ -37,8 +38,7 @@ func (e *E) Set(e2 *E) *E {
// One sets a new target group element to one // One sets a new target group element to one
func (e *E) One() *E { func (e *E) One() *E {
e = new(fe12).one() e = new(fe12).one()
var e1 *E = e return e
return e1
} }
// IsOne returns true if given element equals to one // IsOne returns true if given element equals to one
...@@ -69,11 +69,10 @@ func (g *GT) FromBytes(in []byte) (*E, error) { ...@@ -69,11 +69,10 @@ func (g *GT) FromBytes(in []byte) (*E, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
var e1 *E = e if !g.IsValid(e) {
if !g.IsValid(e1) { return e, errors.New("invalid element")
return e1, errors.New("invalid element")
} }
return e1, nil return e, nil
} }
// ToBytes serializes target group element. // ToBytes serializes target group element.
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
// isogenyMapG1 applies 11-isogeny map for BLS12-381 G1 defined at draft-irtf-cfrg-hash-to-curve-06. // isogenyMapG1 applies 11-isogeny map for BLS12-381 G1 defined at draft-irtf-cfrg-hash-to-curve-06.
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
type pair struct { type pair struct {
...@@ -272,9 +273,8 @@ func (e *Engine) Check() bool { ...@@ -272,9 +273,8 @@ func (e *Engine) Check() bool {
// Result computes pairing and returns target group element as result. // Result computes pairing and returns target group element as result.
func (e *Engine) Result() *E { func (e *Engine) Result() *E {
r := e.calculate() r := e.calculate()
var r1 *E = r
e.Reset() e.Reset()
return r1 return r
} }
// GT returns target group instance. // GT returns target group instance.
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
// swuMapG1 is implementation of Simplified Shallue-van de Woestijne-Ulas Method // swuMapG1 is implementation of Simplified Shallue-van de Woestijne-Ulas Method
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bls12381 package bls12381
import ( import (
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
// +build amd64 arm64 // +build amd64 arm64
// Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. // Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// +build gofuzz // +build gofuzz
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
// +build !amd64,!arm64 // +build !amd64,!arm64
// Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. // Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import bn256 "github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common/crypto/bn256/google" import bn256 "github.com/33cn/plugin/plugin/dapp/evm/executor/vm/common/crypto/bn256/google"
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
// Barreto-Naehrig curve as described in // Barreto-Naehrig curve as described in
// http://cryptojedi.org/papers/dclxvi-20100714.pdf. Its output is compatible // http://cryptojedi.org/papers/dclxvi-20100714.pdf. Its output is compatible
// with the implementation described in that paper. // with the implementation described in that paper.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
// For details of the algorithms used, see "Multiplication and Squaring on // For details of the algorithms used, see "Multiplication and Squaring on
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
// For details of the algorithms used, see "Multiplication and Squaring on // For details of the algorithms used, see "Multiplication and Squaring on
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
// For details of the algorithms used, see "Multiplication and Squaring on // For details of the algorithms used, see "Multiplication and Squaring on
......
// +build amd64,!generic arm64,!generic // +build amd64,!generic arm64,!generic
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import "golang.org/x/sys/cpu"
// This file contains forward declarations for the architecture-specific // This file contains forward declarations for the architecture-specific
// assembly implementations of these functions, provided that they exist. // assembly implementations of these functions, provided that they exist.
//nolint:varcheck //nolint:varcheck
//var hasBMI2 = cpu.X86.HasBMI2 var hasBMI2 = cpu.X86.HasBMI2
// go:noescape // go:noescape
func gfpNeg(c, a *gfP) func gfpNeg(c, a *gfP)
......
// +build !amd64,!arm64 generic // +build !amd64,!arm64 generic
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
func gfpCarry(a *gfP, head uint64) { func gfpCarry(a *gfP, head uint64) {
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
func lineFunctionAdd(r, p *twistPoint, q *curvePoint, r2 *gfP2) (a, b, c *gfP2, rOut *twistPoint) { func lineFunctionAdd(r, p *twistPoint, q *curvePoint, r2 *gfP2) (a, b, c *gfP2, rOut *twistPoint) {
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// (This package previously claimed to operate at a 128-bit security level. // (This package previously claimed to operate at a 128-bit security level.
// However, recent improvements in attacks mean that is no longer true. See // However, recent improvements in attacks mean that is no longer true. See
// https://moderncrypto.org/mail-archive/curves/2016/000740.html.) // https://moderncrypto.org/mail-archive/curves/2016/000740.html.)
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
// For details of the algorithms used, see "Multiplication and Squaring on // For details of the algorithms used, see "Multiplication and Squaring on
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
// For details of the algorithms used, see "Multiplication and Squaring on // For details of the algorithms used, see "Multiplication and Squaring on
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
// For details of the algorithms used, see "Multiplication and Squaring on // For details of the algorithms used, see "Multiplication and Squaring on
......
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
func lineFunctionAdd(r, p *twistPoint, q *curvePoint, r2 *gfP2, pool *bnPool) (a, b, c *gfP2, rOut *twistPoint) { func lineFunctionAdd(r, p *twistPoint, q *curvePoint, r2 *gfP2, pool *bnPool) (a, b, c *gfP2, rOut *twistPoint) {
......
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package bn256 package bn256
import ( import (
......
...@@ -18,7 +18,7 @@ const ( ...@@ -18,7 +18,7 @@ const (
// Hash160Length Hash160格式的地址长度 // Hash160Length Hash160格式的地址长度
Hash160Length = 20 Hash160Length = 20
// AddressLength 地址长度
AddressLength = 20 AddressLength = 20
) )
...@@ -51,7 +51,7 @@ func BigToHash(b *big.Int) Hash { ...@@ -51,7 +51,7 @@ func BigToHash(b *big.Int) Hash {
return Hash(common.BytesToHash(b.Bytes())) return Hash(common.BytesToHash(b.Bytes()))
} }
// uinitToHash // Uint256ToHash 大数转化为哈希
func Uint256ToHash(u *uint256.Int) Hash { func Uint256ToHash(u *uint256.Int) Hash {
return Hash(common.BytesToHash(u.Bytes())) return Hash(common.BytesToHash(u.Bytes()))
} }
......
...@@ -11,7 +11,7 @@ type ( ...@@ -11,7 +11,7 @@ type (
MemorySizeFunc func(*Stack) (size uint64, overflow bool) MemorySizeFunc func(*Stack) (size uint64, overflow bool)
) )
// MemorySha3 sha3计算所需内存大小 //MemorySha3 sha3计算所需内存大小
func MemorySha3(stack *Stack) (uint64, bool) { func MemorySha3(stack *Stack) (uint64, bool) {
return calcMemSize64(stack.Back(0), stack.Back(1)) return calcMemSize64(stack.Back(0), stack.Back(1))
} }
......
...@@ -26,7 +26,7 @@ type Stack struct { ...@@ -26,7 +26,7 @@ type Stack struct {
func NewStack() *Stack { func NewStack() *Stack {
return stackPool.Get().(*Stack) return stackPool.Get().(*Stack)
} }
// Returnstack 把用完的stack还给stackpool
func Returnstack(s *Stack) { func Returnstack(s *Stack) {
s.data = s.data[:0] s.data = s.data[:0]
stackPool.Put(s) stackPool.Put(s)
...@@ -108,6 +108,7 @@ var rStackPool = sync.Pool{ ...@@ -108,6 +108,7 @@ var rStackPool = sync.Pool{
}, },
} }
// ReturnStack 返回栈对象
type ReturnStack struct { type ReturnStack struct {
data []uint32 data []uint32
} }
...@@ -123,11 +124,12 @@ func ReturnRStack(rs *ReturnStack) { ...@@ -123,11 +124,12 @@ func ReturnRStack(rs *ReturnStack) {
rStackPool.Put(rs) rStackPool.Put(rs)
} }
// Push 压栈
func (st *ReturnStack) Push(d uint32) { func (st *ReturnStack) Push(d uint32) {
st.data = append(st.data, d) st.data = append(st.data, d)
} }
// Pop A uint32 is sufficient as for code below 4.2G // Pop A uint32 is sufficient as for code below 4.2G
func (st *ReturnStack) Pop() (ret uint32) { func (st *ReturnStack) Pop() (ret uint32) {
ret = st.data[len(st.data)-1] ret = st.data[len(st.data)-1]
st.data = st.data[:len(st.data)-1] st.data = st.data[:len(st.data)-1]
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package model package model
const ( const (
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package model package model
import "errors" import "errors"
...@@ -41,12 +42,12 @@ var ( ...@@ -41,12 +42,12 @@ var (
// ErrNoCoinsAccount no coins account in executor! // ErrNoCoinsAccount no coins account in executor!
ErrNoCoinsAccount = errors.New("no coins account in executor") ErrNoCoinsAccount = errors.New("no coins account in executor")
// ErrReturnStackExceeded // ErrReturnStackExceeded return stack limit reached
ErrReturnStackExceeded = errors.New("return stack limit reached") ErrReturnStackExceeded = errors.New("return stack limit reached")
// ErrInvalidSubroutineEntry // ErrInvalidSubroutineEntry invalid subroutine entry
ErrInvalidSubroutineEntry = errors.New("invalid subroutine entry") ErrInvalidSubroutineEntry = errors.New("invalid subroutine entry")
// ErrInvalidJump // ErrInvalidJump invalid jump destination
ErrInvalidJump = errors.New("invalid jump destination") ErrInvalidJump = errors.New("invalid jump destination")
// ErrInvalidRetsub // ErrInvalidRetsub invalid retsub
ErrInvalidRetsub = errors.New("invalid retsub") ErrInvalidRetsub = errors.New("invalid retsub")
) )
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//nolint:unparam // 忽视本文件所有golangci-linter检查
package params package params
import "math/big" import "math/big"
......
...@@ -355,9 +355,9 @@ const ( ...@@ -355,9 +355,9 @@ const (
JUMPDEST JUMPDEST
// BEGINSUB OP // BEGINSUB OP
BEGINSUB BEGINSUB
// RETURNSUB op
RETURNSUB RETURNSUB
// JUMPSUB op
JUMPSUB JUMPSUB
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment