Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
970f40a2
Commit
970f40a2
authored
Oct 26, 2020
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
1578dafa
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
84 additions
and
34 deletions
+84
-34
paillier.go
plugin/crypto/paillier/paillier.go
+3
-4
paillier_test.go
plugin/crypto/paillier/paillier_test.go
+2
-1
sm2.go
plugin/crypto/sm2/sm2.go
+2
-1
authority.go
plugin/dapp/cert/authority/authority.go
+1
-0
ecdsaimpl.go
plugin/dapp/cert/authority/core/ecdsaimpl.go
+1
-2
gmimpl.go
plugin/dapp/cert/authority/core/gmimpl.go
+1
-2
keys.go
plugin/dapp/cert/authority/utils/keys.go
+2
-1
cert_test.go
plugin/dapp/cert/executor/cert_test.go
+10
-10
exec.go
plugin/dapp/cert/executor/exec.go
+1
-2
cert.pb.go
plugin/dapp/cert/types/cert.pb.go
+5
-2
exec.go
plugin/dapp/storage/executor/exec.go
+1
-2
storagedb.go
plugin/dapp/storage/executor/storagedb.go
+6
-5
storage.pb.go
plugin/dapp/storage/types/storage.pb.go
+49
-2
No files found.
plugin/crypto/paillier/paillier.go
View file @
970f40a2
...
...
@@ -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
}
plugin/crypto/paillier/paillier_test.go
View file @
970f40a2
package
paillier
import
(
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func
TestCiphertextAdd
(
t
*
testing
.
T
)
{
...
...
plugin/crypto/sm2/sm2.go
View file @
970f40a2
...
...
@@ -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"
...
...
plugin/dapp/cert/authority/authority.go
View file @
970f40a2
...
...
@@ -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
{
...
...
plugin/dapp/cert/authority/core/ecdsaimpl.go
View file @
970f40a2
...
...
@@ -432,4 +432,4 @@ func (validator *ecdsaValidator) GetCertSnFromSignature(signature []byte) ([]byt
}
return
cert
.
SerialNumber
.
Bytes
(),
nil
}
\ No newline at end of file
}
plugin/dapp/cert/authority/core/gmimpl.go
View file @
970f40a2
...
...
@@ -367,4 +367,4 @@ func (validator *gmValidator) GetCertSnFromSignature(signature []byte) ([]byte,
}
return
cert
.
SerialNumber
.
Bytes
(),
nil
}
\ No newline at end of file
}
plugin/dapp/cert/authority/utils/keys.go
View file @
970f40a2
...
...
@@ -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"
...
...
plugin/dapp/cert/executor/cert_test.go
View file @
970f40a2
...
...
@@ -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
)
}
plugin/dapp/cert/executor/exec.go
View file @
970f40a2
...
...
@@ -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
}
plugin/dapp/cert/types/cert.pb.go
View file @
970f40a2
...
...
@@ -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
...
...
plugin/dapp/storage/executor/exec.go
View file @
970f40a2
...
...
@@ -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
}
plugin/dapp/storage/executor/storagedb.go
View file @
970f40a2
...
...
@@ -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
)
{
...
...
plugin/dapp/storage/types/storage.pb.go
View file @
970f40a2
...
...
@@ -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"
,
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment