Commit 970f40a2 authored by vipwzw's avatar vipwzw

auto ci

parent 1578dafa
......@@ -5,9 +5,10 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
"math/big"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/types"
"math/big"
)
func CiphertextAdd(ciphertext1, ciphertext2 string) (string, error) {
......@@ -62,7 +63,6 @@ func CiphertextAddBytes(cipherbytes1, cipherbytes2 []byte) ([]byte, error) {
data2 := make([]byte, len(cipherbytes2)-nlen2-2)
copy(data2, cipherbytes2[2+nlen2:])
cipher1 := new(big.Int).SetBytes(data1)
cipher2 := new(big.Int).SetBytes(data2)
......@@ -84,4 +84,4 @@ func bytesToInt(cipherbytes []byte) int {
var data int16
binary.Read(bytebuff, binary.BigEndian, &data)
return int(data)
}
\ No newline at end of file
}
package paillier
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCiphertextAdd(t *testing.T) {
......
......@@ -10,9 +10,10 @@ import (
"crypto/elliptic"
"errors"
"fmt"
"math/big"
"github.com/33cn/chain33/types"
pkt "github.com/33cn/plugin/plugin/dapp/cert/types"
"math/big"
"github.com/33cn/chain33/common/crypto"
"github.com/tjfoc/gmsm/sm2"
......
......@@ -270,6 +270,7 @@ func (auth *Authority) GetSnFromByte(signature *types.Signature) ([]byte, error)
return auth.validator.GetCertSnFromSignature(signature.Signature)
}
// ToHistoryCertStore 历史数据转成store可存储的历史数据
func (certdata *HistoryCertData) ToHistoryCertStore(store *types.HistoryCertStore) {
if store == nil {
......
......@@ -432,4 +432,4 @@ func (validator *ecdsaValidator) GetCertSnFromSignature(signature []byte) ([]byt
}
return cert.SerialNumber.Bytes(), nil
}
\ No newline at end of file
}
......@@ -367,4 +367,4 @@ func (validator *gmValidator) GetCertSnFromSignature(signature []byte) ([]byte,
}
return cert.SerialNumber.Bytes(), nil
}
\ No newline at end of file
}
......@@ -11,9 +11,10 @@ import (
"crypto/x509"
"encoding/hex"
"encoding/pem"
"github.com/33cn/chain33/types"
"math/big"
"github.com/33cn/chain33/types"
"fmt"
sm2_util "github.com/33cn/chain33/system/crypto/sm2"
......
......@@ -2,6 +2,9 @@ package executor
import (
"fmt"
"testing"
"time"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/client"
apimock "github.com/33cn/chain33/client/mocks"
......@@ -21,8 +24,6 @@ import (
pkt "github.com/33cn/plugin/plugin/dapp/collateralize/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"testing"
"time"
)
type execEnv struct {
......@@ -43,18 +44,18 @@ var (
Nodes = [][]byte{
[]byte("1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"),
}
total = 100 * types.Coin
total = 100 * types.Coin
USERNAME = "User"
SIGNTYPE = ct.AuthSM2
transfer1 = &ct.CertAction{Value: &ct.CertAction_Normal{Normal:&ct.CertNormal{Key: "", Value: nil}}, Ty: ct.CertActionNormal}
tx1 = &types.Transaction{Execer: []byte("cert"), Payload: types.Encode(transfer1), Fee: 100000000, Expire: 0, To: dapp.ExecAddress("cert")}
transfer1 = &ct.CertAction{Value: &ct.CertAction_Normal{Normal: &ct.CertNormal{Key: "", Value: nil}}, Ty: ct.CertActionNormal}
tx1 = &types.Transaction{Execer: []byte("cert"), Payload: types.Encode(transfer1), Fee: 100000000, Expire: 0, To: dapp.ExecAddress("cert")}
transfer2 = &ct.CertAction{Value: &ct.CertAction_New{New:&ct.CertNew{Key: "", Value: nil}}, Ty: ct.CertActionNew}
tx2 = &types.Transaction{Execer: []byte("cert"), Payload: types.Encode(transfer2), Fee: 100000000, Expire: 0, To: dapp.ExecAddress("cert")}
transfer2 = &ct.CertAction{Value: &ct.CertAction_New{New: &ct.CertNew{Key: "", Value: nil}}, Ty: ct.CertActionNew}
tx2 = &types.Transaction{Execer: []byte("cert"), Payload: types.Encode(transfer2), Fee: 100000000, Expire: 0, To: dapp.ExecAddress("cert")}
transfer3 = &ct.CertAction{Value: &ct.CertAction_Update{Update:&ct.CertUpdate{Key: "", Value: nil}}, Ty: ct.CertActionUpdate}
tx3 = &types.Transaction{Execer: []byte("cert"), Payload: types.Encode(transfer3), Fee: 100000000, Expire: 0, To: dapp.ExecAddress("cert")}
transfer3 = &ct.CertAction{Value: &ct.CertAction_Update{Update: &ct.CertUpdate{Key: "", Value: nil}}, Ty: ct.CertActionUpdate}
tx3 = &types.Transaction{Execer: []byte("cert"), Payload: types.Encode(transfer3), Fee: 100000000, Expire: 0, To: dapp.ExecAddress("cert")}
)
func manageKeySet(key string, value string, db dbm.KV) {
......@@ -224,4 +225,3 @@ func TestCert(t *testing.T) {
assert.NotNil(t, set)
util.SaveKVList(env.ldb, set.KV)
}
......@@ -92,4 +92,4 @@ func (c *Cert) Query_CertValidSNByAddr(req *ct.ReqQueryValidCertSN) (types.Messa
}
return &ct.RepQueryValidCertSN{Sn: sn}, nil
}
\ No newline at end of file
}
......@@ -5,8 +5,9 @@ package types
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
......@@ -527,7 +528,9 @@ func init() {
proto.RegisterType((*RepQueryValidCertSN)(nil), "types.RepQueryValidCertSN")
}
func init() { proto.RegisterFile("cert.proto", fileDescriptor_a142e29cbef9b1cf) }
func init() {
proto.RegisterFile("cert.proto", fileDescriptor_a142e29cbef9b1cf)
}
var fileDescriptor_a142e29cbef9b1cf = []byte{
// 380 bytes of a gzipped FileDescriptorProto
......
......@@ -39,4 +39,4 @@ func (s *storage) Exec_EncryptShareStorage(payload *storagetypes.EncryptShareNot
func (s *storage) Exec_EncryptAdd(payload *storagetypes.EncryptNotaryAdd, tx *types.Transaction, index int) (*types.Receipt, error) {
action := newStorageAction(s, tx, index)
return action.EncryptAdd(payload)
}
\ No newline at end of file
}
......@@ -2,6 +2,7 @@ package executor
import (
"fmt"
"github.com/33cn/plugin/plugin/crypto/paillier"
"github.com/33cn/chain33/client"
......@@ -213,11 +214,11 @@ func (s *StorageAction) EncryptAdd(payload *ety.EncryptNotaryAdd) (*types.Receip
store.GetEncryptStorage().EncryptContent = res
newStore := &ety.EncryptNotaryStorage{
ContentHash: store.GetEncryptStorage().ContentHash,
EncryptContent: res,
Nonce: store.GetEncryptStorage().Nonce,
Key: store.GetEncryptStorage().Key,
Value: store.GetEncryptStorage().Value,
ContentHash: store.GetEncryptStorage().ContentHash,
EncryptContent: res,
Nonce: store.GetEncryptStorage().Nonce,
Key: store.GetEncryptStorage().Key,
Value: store.GetEncryptStorage().Value,
}
if cfg.IsDappFork(s.height, ety.StorageX, ety.ForkStorageLocalDB) {
......
......@@ -4,9 +4,12 @@
package types
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
......@@ -881,7 +884,9 @@ func init() {
proto.RegisterType((*ReceiptStorage)(nil), "types.ReceiptStorage")
}
func init() { proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb) }
func init() {
proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb)
}
var fileDescriptor_0d2c4ccf1453ffdb = []byte{
// 528 bytes of a gzipped FileDescriptorProto
......@@ -919,3 +924,45 @@ var fileDescriptor_0d2c4ccf1453ffdb = []byte{
0x4e, 0xc0, 0xa3, 0x2c, 0x66, 0xeb, 0xe6, 0xaf, 0x60, 0xee, 0x80, 0x8d, 0xde, 0xeb, 0x91, 0xfa,
0x1e, 0x3e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x66, 0xc3, 0x4e, 0x48, 0x20, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// StorageClient is the client API for Storage service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type StorageClient interface {
}
type storageClient struct {
cc grpc.ClientConnInterface
}
func NewStorageClient(cc grpc.ClientConnInterface) StorageClient {
return &storageClient{cc}
}
// StorageServer is the server API for Storage service.
type StorageServer interface {
}
// UnimplementedStorageServer can be embedded to have forward compatible implementations.
type UnimplementedStorageServer struct {
}
func RegisterStorageServer(s *grpc.Server, srv StorageServer) {
s.RegisterService(&_Storage_serviceDesc, srv)
}
var _Storage_serviceDesc = grpc.ServiceDesc{
ServiceName: "types.storage",
HandlerType: (*StorageServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{},
Metadata: "storage.proto",
}
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