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

add unlinter comment line

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