1
1
import { program } from 'command' ;
2
2
import { getCLProofVerifierContract } from 'contracts' ;
3
3
4
- import { createPDGProof } from 'utils/index.js' ;
4
+ import { createPDGProof , getFirstValidatorGIndex } from 'utils/index.js' ;
5
5
6
6
const predepositGuarantee = program
7
7
. command ( 'pdg' )
8
8
. description ( 'predeposit guarantee contract' ) ;
9
9
10
10
predepositGuarantee
11
- . command ( 'create-proof' )
12
- . description ( 'create predeposit proof' )
11
+ . command ( 'create-proof-and-check' )
12
+ . description (
13
+ 'create predeposit proof by validator index and check by test contract' ,
14
+ )
13
15
. argument ( '<validator-index>' , 'validator index' )
14
16
. action ( async ( validatorIndex : bigint ) => {
15
17
const clProofVerifierContract = getCLProofVerifierContract ( ) ;
@@ -18,7 +20,6 @@ predepositGuarantee
18
20
const { proof, pubkey, childBlockTimestamp, withdrawalCredentials } =
19
21
packageProof ;
20
22
21
- // verification by test contract
22
23
await clProofVerifierContract . read . TEST_validatePubKeyWCProof ( [
23
24
{ proof, pubkey, validatorIndex, childBlockTimestamp } ,
24
25
withdrawalCredentials ,
@@ -37,3 +38,34 @@ predepositGuarantee
37
38
console . info ( '------------------------------------------------' ) ;
38
39
console . info ( '-----------------------end-----------------------' ) ;
39
40
} ) ;
41
+
42
+ predepositGuarantee
43
+ . command ( 'create-proof' )
44
+ . description ( 'create predeposit proof by validator index' )
45
+ . argument ( '<validator-index>' , 'validator index' )
46
+ . action ( async ( validatorIndex : bigint ) => {
47
+ const packageProof = await createPDGProof ( Number ( validatorIndex ) ) ;
48
+ const { proof, pubkey, childBlockTimestamp, withdrawalCredentials } =
49
+ packageProof ;
50
+
51
+ console . info ( '-----------------proof verified-----------------' ) ;
52
+ console . info ( '------------------------------------------------' ) ;
53
+ console . info ( '----------------------proof----------------------' ) ;
54
+ console . info ( proof ) ;
55
+ console . info ( '---------------------pubkey---------------------' ) ;
56
+ console . table ( pubkey ) ;
57
+ console . info ( '---------------childBlockTimestamp---------------' ) ;
58
+ console . table ( childBlockTimestamp ) ;
59
+ console . info ( '--------------withdrawalCredentials--------------' ) ;
60
+ console . table ( withdrawalCredentials ) ;
61
+ console . info ( '------------------------------------------------' ) ;
62
+ console . info ( '-----------------------end-----------------------' ) ;
63
+ } ) ;
64
+
65
+ predepositGuarantee
66
+ . command ( 'fv-gindex' )
67
+ . argument ( '<forks...>' , 'fork name' )
68
+ . description ( 'get first validator gindex' )
69
+ . action ( async ( forks : string [ ] ) => {
70
+ getFirstValidatorGIndex ( forks ) ;
71
+ } ) ;
0 commit comments