Skip to content

Commit 75dc7b7

Browse files
authored
Merge pull request #545 from LF-Decentralized-Trust-labs/zeto-lock
Zeto lock support
2 parents f163c0c + ddc3472 commit 75dc7b7

File tree

103 files changed

+8096
-4784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+8096
-4784
lines changed

build.gradle

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -209,44 +209,30 @@ task copyZetoZKPFiles(type: Copy) {
209209
include 'anon_enc_batch-vkey.json'
210210
include 'anon_enc_batch_js/anon_enc_batch.wasm'
211211
// anon_nullifier
212-
include 'anon_nullifier.zkey'
213-
include 'anon_nullifier-vkey.json'
214-
include 'anon_nullifier_js/anon_nullifier.wasm'
215-
include 'anon_nullifier_batch.zkey'
216-
include 'anon_nullifier_batch-vkey.json'
217-
include 'anon_nullifier_batch_js/anon_nullifier_batch.wasm'
212+
include 'anon_nullifier_transfer.zkey'
213+
include 'anon_nullifier_transfer-vkey.json'
214+
include 'anon_nullifier_transfer_js/anon_nullifier_transfer.wasm'
215+
include 'anon_nullifier_transfer_batch.zkey'
216+
include 'anon_nullifier_transfer_batch-vkey.json'
217+
include 'anon_nullifier_transfer_batch_js/anon_nullifier_transfer_batch.wasm'
218218
// deposit
219-
include 'check_hashes_value.zkey'
220-
include 'check_hashes_value-vkey.json'
221-
include 'check_hashes_value_js/check_hashes_value.wasm'
219+
include 'deposit.zkey'
220+
include 'deposit-vkey.json'
221+
include 'deposit_js/deposit.wasm'
222222
// withdraw
223-
include 'check_inputs_outputs_value.zkey'
224-
include 'check_inputs_outputs_value-vkey.json'
225-
include 'check_inputs_outputs_value_js/check_inputs_outputs_value.wasm'
226-
include 'check_inputs_outputs_value_batch.zkey'
227-
include 'check_inputs_outputs_value_batch-vkey.json'
228-
include 'check_inputs_outputs_value_batch_js/check_inputs_outputs_value_batch.wasm'
223+
include 'withdraw.zkey'
224+
include 'withdraw-vkey.json'
225+
include 'withdraw_js/withdraw.wasm'
226+
include 'withdraw_batch.zkey'
227+
include 'withdraw_batch-vkey.json'
228+
include 'withdraw_batch_js/withdraw_batch.wasm'
229229
// withdraw_nullifier
230-
include 'check_nullifiers_value.zkey'
231-
include 'check_nullifiers_value-vkey.json'
232-
include 'check_nullifiers_value_js/check_nullifiers_value.wasm'
233-
include 'check_nullifiers_value_batch.zkey'
234-
include 'check_nullifiers_value_batch-vkey.json'
235-
include 'check_nullifiers_value_batch_js/check_nullifiers_value_batch.wasm'
236-
// check_utxos_owner
237-
include 'check_utxos_owner.zkey'
238-
include 'check_utxos_owner-vkey.json'
239-
include 'check_utxos_owner_js/check_utxos_owner.wasm'
240-
include 'check_utxos_owner_batch.zkey'
241-
include 'check_utxos_owner_batch-vkey.json'
242-
include 'check_utxos_owner_batch_js/check_utxos_owner_batch.wasm'
243-
// check_nullifiers_owner
244-
include 'check_nullifiers_owner.zkey'
245-
include 'check_nullifiers_owner-vkey.json'
246-
include 'check_nullifiers_owner_js/check_nullifiers_owner.wasm'
247-
include 'check_nullifiers_owner_batch.zkey'
248-
include 'check_nullifiers_owner_batch-vkey.json'
249-
include 'check_nullifiers_owner_batch_js/check_nullifiers_owner_batch.wasm'
230+
include 'withdraw_nullifier.zkey'
231+
include 'withdraw_nullifier-vkey.json'
232+
include 'withdraw_nullifier_js/withdraw_nullifier.wasm'
233+
include 'withdraw_nullifier_batch.zkey'
234+
include 'withdraw_nullifier_batch-vkey.json'
235+
include 'withdraw_nullifier_batch_js/withdraw_nullifier_batch.wasm'
250236
}
251237
into zetoZkpDir
252238

core/go/internal/identityresolver/identityresolver_test.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,64 @@ package identityresolver
33
import (
44
"context"
55
"testing"
6+
"time"
67

78
"github.com/kaleido-io/paladin/config/pkg/pldconf"
9+
"github.com/kaleido-io/paladin/core/mocks/componentmocks"
10+
"github.com/kaleido-io/paladin/toolkit/pkg/algorithms"
11+
"github.com/kaleido-io/paladin/toolkit/pkg/cache"
12+
"github.com/kaleido-io/paladin/toolkit/pkg/pldapi"
13+
"github.com/kaleido-io/paladin/toolkit/pkg/verifiers"
814
"github.com/stretchr/testify/assert"
15+
"github.com/stretchr/testify/mock"
916
)
1017

18+
func TestResolveVerifier(t *testing.T) {
19+
r := &identityResolver{}
20+
_, err := r.ResolveVerifier(context.Background(), "something$bad", "bad algorithm", "bad type")
21+
assert.ErrorContains(t, err, "PD020006: Locator string something$bad is invalid")
22+
23+
capacity := 100
24+
config := &pldconf.CacheConfig{Capacity: &capacity}
25+
r = &identityResolver{
26+
nodeName: "testnode",
27+
verifierCache: cache.NewCache[string, string](config, config),
28+
keyManager: componentmocks.NewKeyManager(t),
29+
}
30+
waitChan := make(chan time.Time)
31+
resolvedKey := &pldapi.KeyMappingAndVerifier{
32+
Verifier: &pldapi.KeyVerifier{
33+
Verifier: "0x1234567890abcdef",
34+
Type: "ETH_ADDRESS",
35+
},
36+
}
37+
r.keyManager.(*componentmocks.KeyManager).On("ResolveKeyNewDatabaseTX", mock.Anything, mock.Anything, mock.Anything, mock.Anything).WaitUntil(waitChan).Return(resolvedKey, nil)
38+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
39+
defer func() {
40+
cancel()
41+
close(waitChan)
42+
}()
43+
44+
done := make(chan bool)
45+
go func() {
46+
_, err := r.ResolveVerifier(ctx, "something@testnode", algorithms.Curve_SECP256K1, verifiers.ETH_ADDRESS)
47+
assert.ErrorContains(t, err, "PD010301: Context canceled")
48+
done <- true
49+
}()
50+
<-done
51+
}
52+
53+
func TestResolveVerifierAsync(t *testing.T) {
54+
r := &identityResolver{}
55+
resolved := func(ctx context.Context, verifier string) {
56+
t.Logf("Resolved verifier: %s", verifier)
57+
}
58+
errhandler := func(ctx context.Context, err error) {
59+
assert.ErrorContains(t, err, "PD020006: Locator string something$bad is invalid")
60+
}
61+
r.ResolveVerifierAsync(context.Background(), "something$bad", "bad algorithm", "bad type", resolved, errhandler)
62+
}
63+
1164
func TestNewIdentityResolver(t *testing.T) {
1265
capacity := 100
1366
ctx := context.Background()

domains/integration-test/build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ configurations {
4545
canBeConsumed = false
4646
canBeResolved = true
4747
}
48+
poseidonArtifacts {
49+
canBeConsumed = false
50+
canBeResolved = true
51+
}
4852
}
4953

5054
dependencies {
@@ -54,6 +58,7 @@ dependencies {
5458
notoGo project(path: ":domains:noto", configuration: "goSource")
5559
zetoGo project(path: ":domains:zeto", configuration: "goSource")
5660
zetoArtifacts project(path: ":domains:zeto", configuration: "zetoArtifacts")
61+
poseidonArtifacts project(path: ":domains:zeto", configuration: "poseidonArtifacts")
5762
}
5863

5964
task copySolidity(type: Copy) {
@@ -75,6 +80,12 @@ task copySolidity(type: Copy) {
7580
exclude '**/*.dbg.json'
7681
}
7782

83+
inputs.files(configurations.poseidonArtifacts)
84+
from fileTree(configurations.poseidonArtifacts.asPath) {
85+
include '**/Poseidon2.json'
86+
include '**/Poseidon3.json'
87+
}
88+
7889
into 'helpers/abis'
7990

8091
// Flatten all paths into the destination folder
@@ -98,7 +109,7 @@ task test(type: Exec, dependsOn: [":core:go:makeMocks"]) {
98109
args '-v'
99110
args '-cover'
100111
args '-covermode=atomic'
101-
args '-timeout=120s'
112+
args '-timeout=480s'
102113
args "-test.gocoverdir=${projectDir}/coverage"
103114

104115
dependsOn ':testinfra:startTestInfra'

0 commit comments

Comments
 (0)