Skip to content

Commit 6062d1d

Browse files
SwenSchaeferjohannSwen
andauthored
fix: wait for photon slot to match rpc slot in confirmTx (#1019)
* confirmTxIndexed * fix --------- Co-authored-by: Swen <swen.schaeferjohann@code.berlin>
1 parent 43bcac1 commit 6062d1d

File tree

11 files changed

+90
-15
lines changed

11 files changed

+90
-15
lines changed

.github/workflows/js.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ jobs:
3636
npx nx build @lightprotocol/zk-compression-cli --skip-nx-cache
3737
3838
# Commented for breaking changes to Photon
39-
# - name: Run CLI tests
40-
# run: |
41-
# source ./scripts/devenv.sh
42-
# npx nx test @lightprotocol/zk-compression-cli
39+
- name: Run CLI tests
40+
run: |
41+
source ./scripts/devenv.sh
42+
npx nx test @lightprotocol/zk-compression-cli
4343
4444
- name: Run stateless.js tests
4545
run: |
4646
source ./scripts/devenv.sh
47-
npx nx test @lightprotocol/stateless.js
47+
npx nx test @lightprotocol/stateless.js
4848
4949
- name: Run compressed-token tests
5050
run: |

cli/src/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const LIGHT_PROVER_PROCESS_NAME = "light-prover";
2121
export const INDEXER_PROCESS_NAME = "photon";
2222
export const FORESTER_PROCESS_NAME = "forester";
2323

24-
export const PHOTON_VERSION = "0.35.0";
24+
export const PHOTON_VERSION = "0.36.0";
2525

2626
export const LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = "LIGHT_PROTOCOL_PROGRAMS_DIR";
2727
export const BASE_PATH = "../../bin/";

js/compressed-token/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"test:e2e:compress": "pnpm test-validator && vitest run tests/e2e/compress.test.ts --reporter=verbose",
4141
"test:e2e:decompress": "pnpm test-validator && vitest run tests/e2e/decompress.test.ts --reporter=verbose",
4242
"test:e2e:rpc-token-interop": "pnpm test-validator && vitest run tests/e2e/rpc-token-interop.test.ts --reporter=verbose",
43-
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/decompress.test.ts && vitest run tests/e2e/register-mint.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts",
43+
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/decompress.test.ts && vitest run tests/e2e/register-mint.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts && vitest run tests/e2e/rpc-token-interop.test.ts",
4444
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
4545
"build": "rimraf dist && pnpm pull-idl && pnpm build:bundle",
4646
"build:bundle": "rollup -c",

js/compressed-token/src/idl/light_compressed_token.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export type LightCompressedToken = {
224224
isMut: false;
225225
isSigner: false;
226226
docs: [
227+
'(different program) checked in light system program to derive',
227228
'cpi_authority_pda and check that this program is the signer of the cpi.',
228229
];
229230
},
@@ -280,6 +281,7 @@ export type LightCompressedToken = {
280281
isMut: false;
281282
isSigner: true;
282283
docs: [
284+
'Authority is verified through proof since both owner and delegate',
283285
'are included in the token data hash, which is a public input to the',
284286
'validity proof.',
285287
];
@@ -319,6 +321,7 @@ export type LightCompressedToken = {
319321
isMut: false;
320322
isSigner: false;
321323
docs: [
324+
'(different program) checked in light system program to derive',
322325
'cpi_authority_pda and check that this program is the signer of the cpi.',
323326
];
324327
},
@@ -353,6 +356,7 @@ export type LightCompressedToken = {
353356
isMut: false;
354357
isSigner: true;
355358
docs: [
359+
'Authority is verified through proof since both owner and delegate',
356360
'are included in the token data hash, which is a public input to the',
357361
'validity proof.',
358362
];
@@ -392,6 +396,7 @@ export type LightCompressedToken = {
392396
isMut: false;
393397
isSigner: false;
394398
docs: [
399+
'(different program) checked in light system program to derive',
395400
'cpi_authority_pda and check that this program is the signer of the cpi.',
396401
];
397402
},
@@ -461,6 +466,7 @@ export type LightCompressedToken = {
461466
isMut: false;
462467
isSigner: false;
463468
docs: [
469+
'(different program) checked in light system program to derive',
464470
'cpi_authority_pda and check that this program is the signer of the cpi.',
465471
];
466472
},
@@ -535,6 +541,7 @@ export type LightCompressedToken = {
535541
isMut: false;
536542
isSigner: false;
537543
docs: [
544+
'(different program) checked in light system program to derive',
538545
'cpi_authority_pda and check that this program is the signer of the cpi.',
539546
];
540547
},
@@ -575,6 +582,7 @@ export type LightCompressedToken = {
575582
isMut: false;
576583
isSigner: true;
577584
docs: [
585+
'Authority is verified through proof since both owner and delegate',
578586
'are included in the token data hash, which is a public input to the',
579587
'validity proof.',
580588
];
@@ -701,6 +709,7 @@ export type LightCompressedToken = {
701709
isMut: false;
702710
isSigner: false;
703711
docs: [
712+
'(different program) checked in light system program to derive',
704713
'cpi_authority_pda and check that this program is the signer of the cpi.',
705714
];
706715
},
@@ -1783,6 +1792,7 @@ export const IDL: LightCompressedToken = {
17831792
isMut: false,
17841793
isSigner: false,
17851794
docs: [
1795+
'(different program) checked in light system program to derive',
17861796
'cpi_authority_pda and check that this program is the signer of the cpi.',
17871797
],
17881798
},
@@ -1839,6 +1849,7 @@ export const IDL: LightCompressedToken = {
18391849
isMut: false,
18401850
isSigner: true,
18411851
docs: [
1852+
'Authority is verified through proof since both owner and delegate',
18421853
'are included in the token data hash, which is a public input to the',
18431854
'validity proof.',
18441855
],
@@ -1878,6 +1889,7 @@ export const IDL: LightCompressedToken = {
18781889
isMut: false,
18791890
isSigner: false,
18801891
docs: [
1892+
'(different program) checked in light system program to derive',
18811893
'cpi_authority_pda and check that this program is the signer of the cpi.',
18821894
],
18831895
},
@@ -1912,6 +1924,7 @@ export const IDL: LightCompressedToken = {
19121924
isMut: false,
19131925
isSigner: true,
19141926
docs: [
1927+
'Authority is verified through proof since both owner and delegate',
19151928
'are included in the token data hash, which is a public input to the',
19161929
'validity proof.',
19171930
],
@@ -1951,6 +1964,7 @@ export const IDL: LightCompressedToken = {
19511964
isMut: false,
19521965
isSigner: false,
19531966
docs: [
1967+
'(different program) checked in light system program to derive',
19541968
'cpi_authority_pda and check that this program is the signer of the cpi.',
19551969
],
19561970
},
@@ -2020,6 +2034,7 @@ export const IDL: LightCompressedToken = {
20202034
isMut: false,
20212035
isSigner: false,
20222036
docs: [
2037+
'(different program) checked in light system program to derive',
20232038
'cpi_authority_pda and check that this program is the signer of the cpi.',
20242039
],
20252040
},
@@ -2094,6 +2109,7 @@ export const IDL: LightCompressedToken = {
20942109
isMut: false,
20952110
isSigner: false,
20962111
docs: [
2112+
'(different program) checked in light system program to derive',
20972113
'cpi_authority_pda and check that this program is the signer of the cpi.',
20982114
],
20992115
},
@@ -2134,6 +2150,7 @@ export const IDL: LightCompressedToken = {
21342150
isMut: false,
21352151
isSigner: true,
21362152
docs: [
2153+
'Authority is verified through proof since both owner and delegate',
21372154
'are included in the token data hash, which is a public input to the',
21382155
'validity proof.',
21392156
],
@@ -2260,6 +2277,7 @@ export const IDL: LightCompressedToken = {
22602277
isMut: false,
22612278
isSigner: false,
22622279
docs: [
2280+
'(different program) checked in light system program to derive',
22632281
'cpi_authority_pda and check that this program is the signer of the cpi.',
22642282
],
22652283
},

js/compressed-token/tests/e2e/rpc-token-interop.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import {
1111
} from '@lightprotocol/stateless.js';
1212
import { WasmFactory } from '@lightprotocol/hasher.rs';
1313
import { createMint, mintTo, transfer } from '../../src/actions';
14+
import {
15+
PublicTransactionEvent,
16+
getParsedEvents,
17+
} from '../../../stateless.js/src';
1418

1519
const TEST_TOKEN_DECIMALS = 2;
1620

@@ -24,13 +28,14 @@ describe('rpc-interop token', () => {
2428
let mintAuthority: Keypair;
2529

2630
beforeAll(async () => {
27-
const lightWasm = await WasmFactory.getInstance();
2831
rpc = createRpc();
29-
testRpc = await getTestRpc(lightWasm);
32+
const lightWasm = await WasmFactory.getInstance();
3033
payer = await newAccountWithLamports(rpc, 1e9, 256);
3134
mintAuthority = Keypair.generate();
3235
const mintKeypair = Keypair.generate();
3336

37+
testRpc = await getTestRpc(lightWasm);
38+
3439
mint = (
3540
await createMint(
3641
rpc,
@@ -45,8 +50,8 @@ describe('rpc-interop token', () => {
4550
charlie = await newAccountWithLamports(rpc, 1e9, 256);
4651

4752
await mintTo(rpc, payer, mint, bob.publicKey, mintAuthority, bn(1000));
48-
/// TODO: replace for Rpc once 'getValidityProof' in Photon is working.
49-
await transfer(testRpc, payer, mint, bn(700), bob, charlie.publicKey);
53+
54+
await transfer(rpc, payer, mint, bn(700), bob, charlie.publicKey);
5055
});
5156

5257
it('getCompressedTokenAccountsByOwner should match', async () => {
@@ -78,6 +83,7 @@ describe('rpc-interop token', () => {
7883
charlie.publicKey,
7984
{ mint },
8085
);
86+
8187
const receiverAccountsTest =
8288
await testRpc.getCompressedTokenAccountsByOwner(charlie.publicKey, {
8389
mint,

js/stateless.js/src/idls/light_compressed_token.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export type LightCompressedToken = {
224224
isMut: false;
225225
isSigner: false;
226226
docs: [
227+
'(different program) checked in light system program to derive',
227228
'cpi_authority_pda and check that this program is the signer of the cpi.',
228229
];
229230
},
@@ -280,6 +281,7 @@ export type LightCompressedToken = {
280281
isMut: false;
281282
isSigner: true;
282283
docs: [
284+
'Authority is verified through proof since both owner and delegate',
283285
'are included in the token data hash, which is a public input to the',
284286
'validity proof.',
285287
];
@@ -319,6 +321,7 @@ export type LightCompressedToken = {
319321
isMut: false;
320322
isSigner: false;
321323
docs: [
324+
'(different program) checked in light system program to derive',
322325
'cpi_authority_pda and check that this program is the signer of the cpi.',
323326
];
324327
},
@@ -353,6 +356,7 @@ export type LightCompressedToken = {
353356
isMut: false;
354357
isSigner: true;
355358
docs: [
359+
'Authority is verified through proof since both owner and delegate',
356360
'are included in the token data hash, which is a public input to the',
357361
'validity proof.',
358362
];
@@ -392,6 +396,7 @@ export type LightCompressedToken = {
392396
isMut: false;
393397
isSigner: false;
394398
docs: [
399+
'(different program) checked in light system program to derive',
395400
'cpi_authority_pda and check that this program is the signer of the cpi.',
396401
];
397402
},
@@ -461,6 +466,7 @@ export type LightCompressedToken = {
461466
isMut: false;
462467
isSigner: false;
463468
docs: [
469+
'(different program) checked in light system program to derive',
464470
'cpi_authority_pda and check that this program is the signer of the cpi.',
465471
];
466472
},
@@ -535,6 +541,7 @@ export type LightCompressedToken = {
535541
isMut: false;
536542
isSigner: false;
537543
docs: [
544+
'(different program) checked in light system program to derive',
538545
'cpi_authority_pda and check that this program is the signer of the cpi.',
539546
];
540547
},
@@ -575,6 +582,7 @@ export type LightCompressedToken = {
575582
isMut: false;
576583
isSigner: true;
577584
docs: [
585+
'Authority is verified through proof since both owner and delegate',
578586
'are included in the token data hash, which is a public input to the',
579587
'validity proof.',
580588
];
@@ -701,6 +709,7 @@ export type LightCompressedToken = {
701709
isMut: false;
702710
isSigner: false;
703711
docs: [
712+
'(different program) checked in light system program to derive',
704713
'cpi_authority_pda and check that this program is the signer of the cpi.',
705714
];
706715
},
@@ -1783,6 +1792,7 @@ export const IDL: LightCompressedToken = {
17831792
isMut: false,
17841793
isSigner: false,
17851794
docs: [
1795+
'(different program) checked in light system program to derive',
17861796
'cpi_authority_pda and check that this program is the signer of the cpi.',
17871797
],
17881798
},
@@ -1839,6 +1849,7 @@ export const IDL: LightCompressedToken = {
18391849
isMut: false,
18401850
isSigner: true,
18411851
docs: [
1852+
'Authority is verified through proof since both owner and delegate',
18421853
'are included in the token data hash, which is a public input to the',
18431854
'validity proof.',
18441855
],
@@ -1878,6 +1889,7 @@ export const IDL: LightCompressedToken = {
18781889
isMut: false,
18791890
isSigner: false,
18801891
docs: [
1892+
'(different program) checked in light system program to derive',
18811893
'cpi_authority_pda and check that this program is the signer of the cpi.',
18821894
],
18831895
},
@@ -1912,6 +1924,7 @@ export const IDL: LightCompressedToken = {
19121924
isMut: false,
19131925
isSigner: true,
19141926
docs: [
1927+
'Authority is verified through proof since both owner and delegate',
19151928
'are included in the token data hash, which is a public input to the',
19161929
'validity proof.',
19171930
],
@@ -1951,6 +1964,7 @@ export const IDL: LightCompressedToken = {
19511964
isMut: false,
19521965
isSigner: false,
19531966
docs: [
1967+
'(different program) checked in light system program to derive',
19541968
'cpi_authority_pda and check that this program is the signer of the cpi.',
19551969
],
19561970
},
@@ -2020,6 +2034,7 @@ export const IDL: LightCompressedToken = {
20202034
isMut: false,
20212035
isSigner: false,
20222036
docs: [
2037+
'(different program) checked in light system program to derive',
20232038
'cpi_authority_pda and check that this program is the signer of the cpi.',
20242039
],
20252040
},
@@ -2094,6 +2109,7 @@ export const IDL: LightCompressedToken = {
20942109
isMut: false,
20952110
isSigner: false,
20962111
docs: [
2112+
'(different program) checked in light system program to derive',
20972113
'cpi_authority_pda and check that this program is the signer of the cpi.',
20982114
],
20992115
},
@@ -2134,6 +2150,7 @@ export const IDL: LightCompressedToken = {
21342150
isMut: false,
21352151
isSigner: true,
21362152
docs: [
2153+
'Authority is verified through proof since both owner and delegate',
21372154
'are included in the token data hash, which is a public input to the',
21382155
'validity proof.',
21392156
],
@@ -2260,6 +2277,7 @@ export const IDL: LightCompressedToken = {
22602277
isMut: false,
22612278
isSigner: false,
22622279
docs: [
2280+
'(different program) checked in light system program to derive',
22632281
'cpi_authority_pda and check that this program is the signer of the cpi.',
22642282
],
22652283
},

0 commit comments

Comments
 (0)