Skip to content

Ref/remove execute with retry #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion local-tests/tests/testExecuteJsSignAndCombineEcdsa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const testExecuteJsSignAndCombineEcdsa = async (
throw new Error('invalid signature returned from lit action');
}

if (!sig.v) {
if (sig.v === undefined) {
throw new Error('invalid signature returned from lit action');
}
console.log('✅ testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs');
Expand Down
2 changes: 1 addition & 1 deletion packages/access-control-conditions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"tags": [
"universal"
],
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/auth-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"tags": [
"browser"
],
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/auth-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"crypto": false,
"stream": false
},
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/bls-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"buildOptions": {
"genReact": false
},
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"tags": [
"universal"
],
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/contracts-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"tags": [
"universal"
],
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lit-protocol/core",
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"type": "commonjs",
"license": "MIT",
"homepage": "https://github.com/Lit-Protocol/js-sdk",
Expand Down
61 changes: 20 additions & 41 deletions packages/core/src/lib/lit-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
StakingStates,
version,
LIT_ENDPOINT,
CAYENNE_URL,
} from '@lit-protocol/constants';
import { LitContracts } from '@lit-protocol/contracts-sdk';
import {
Expand All @@ -34,8 +33,6 @@ import {
} from '@lit-protocol/crypto';
import {
bootstrapLogManager,
executeWithRetry,
getIpAddress,
isBrowser,
isNode,
log,
Expand Down Expand Up @@ -96,7 +93,6 @@ export type LitNodeClientConfigWithDefaults = Required<
| 'checkNodeAttestation'
| 'litNetwork'
| 'minNodeCount'
| 'retryTolerance'
| 'rpcUrl'
>
> &
Expand All @@ -116,11 +112,6 @@ export class LitCore {
litNetwork: 'cayenne', // Default to cayenne network. will be replaced by custom config.
minNodeCount: 2, // Default value, should be replaced
bootstrapUrls: [], // Default value, should be replaced
retryTolerance: {
timeout: 31_000,
maxRetryCount: 3,
interval: 100,
},
rpcUrl: null,
};
connectedNodes = new Set<string>();
Expand Down Expand Up @@ -909,42 +900,29 @@ export class LitCore {
params: HandshakeWithNode,
requestId: string
): Promise<NodeCommandServerKeysResponse> => {
const res = await executeWithRetry<NodeCommandServerKeysResponse>(
async () => {
// -- get properties from params
const { url } = params;

// -- create url with path
const urlWithPath = composeLitUrl({
url,
endpoint: LIT_ENDPOINT.HANDSHAKE,
});
// -- get properties from params
const { url } = params;

log(`handshakeWithNode ${urlWithPath}`);
// -- create url with path
const urlWithPath = composeLitUrl({
url,
endpoint: LIT_ENDPOINT.HANDSHAKE,
});

const data = {
clientPublicKey: 'test',
challenge: params.challenge,
};
log(`handshakeWithNode ${urlWithPath}`);

return await this.sendCommandToNode({
url: urlWithPath,
data,
requestId,
}).catch((err: NodeErrorV3) => {
return err;
});
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(_error: any, _requestId: string, isFinal: boolean) => {
if (!isFinal) {
logError('an error occurred, attempting to retry');
}
},
this.config.retryTolerance
);
const data = {
clientPublicKey: 'test',
challenge: params.challenge,
};

return res as NodeCommandServerKeysResponse;
return await this.sendCommandToNode({
url: urlWithPath,
data,
requestId,
}).catch((err: NodeErrorV3) => {
return err;
});
};

private async fetchCurrentEpochNumber() {
Expand Down Expand Up @@ -1004,6 +982,7 @@ export class LitCore {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
'X-Lit-SDK-Version': version,
'X-Lit-SDK-Type': 'Typescript',
'X-Request-Id': 'lit_' + requestId,
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"tags": [
"universal"
],
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/ecdsa-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"tags": [
"universal"
],
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/encryption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"crypto": false,
"stream": false
},
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/lit-auth-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lit-protocol/lit-auth-client",
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"type": "commonjs",
"license": "MIT",
"homepage": "https://github.com/Lit-Protocol/js-sdk",
Expand Down
2 changes: 1 addition & 1 deletion packages/lit-node-client-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"tags": [
"nodejs"
],
"version": "6.0.0-tslib-test",
"version": "6.0.1",
"main": "./dist/src/index.js",
"typings": "./dist/src/index.d.ts"
}
Loading
Loading