Skip to content
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

ci: change runner for e2e tests #525

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9958ec8
ci: change runner for e2e tests
Jul 9, 2024
6ab15a7
ci: add lit assets pull
Jul 9, 2024
310a77f
ref: change lit-assets checkout dir
Jul 9, 2024
c831214
ref: change repo format
Jul 9, 2024
ade8b64
ref: add submodule flag
Jul 9, 2024
c89a023
ref: add condition to build step
Jul 9, 2024
16b096c
ref: flag sub modules as false
Jul 9, 2024
70b1ac7
dev: wip testnig LA checkout step isolated
Jul 10, 2024
8f637d9
ci: change run target
Jul 10, 2024
a60c5a6
ci: test service
Jul 10, 2024
bc3464b
ci: fix yaml
Jul 10, 2024
ad44f03
ci: add credentials to container pull
Jul 10, 2024
14e1bc1
ci: change from service to steps for docker standup
Jul 10, 2024
42eb4f8
ci: fix pull cmd
Jul 10, 2024
397fe78
ci: add login step
Jul 10, 2024
950f9f0
ci: add registry url to login
Jul 10, 2024
55323ad
ref: fix docker pull cmd
Jul 10, 2024
7afac47
ci: add container to run cmd
Jul 10, 2024
4fda0c6
ref: use full container name in run cmd
Jul 10, 2024
da7e506
ci: liist dirs in checkout
Jul 10, 2024
38b1497
ci: change sparse checkout params
Jul 10, 2024
823361c
ci: add steps back after container resolve
Jul 10, 2024
6425bdd
Merge branch 'master' into feature/lit-3506-create-docker-image-for-r…
Jul 10, 2024
a7c9011
ci: add docker detached flag to run cmd
Jul 10, 2024
267083e
Merge branch 'feature/lit-3506-create-docker-image-for-running-shiva-…
Jul 10, 2024
93df4ed
ci: change manager url
Jul 10, 2024
5ae7e35
ci: ad node debug net flag for connection deugging
Jul 10, 2024
e7783d1
ci: check if docker container is running
Jul 10, 2024
a412e46
ci: change env url to localhost
Jul 11, 2024
a91887f
ref: change node-fetch package version
Jul 11, 2024
090d924
ref: force lock node-fetch package
Jul 11, 2024
43563d1
dev: try agent override for fetch call
Jul 11, 2024
6df0fd9
ref: change nodejs version to 19 from 20
Jul 11, 2024
6f8391f
ci: change node version
Jul 11, 2024
bf441ba
ci: remove http from url
Jul 11, 2024
06e3983
ref: ad back proto and add IP to port forward
Jul 11, 2024
4f25217
change IP for shiva url
Jul 11, 2024
ba53c07
ref: add retry to testnet lookup for docker testnig
Jul 11, 2024
f7ca1ea
ci: add log output to job
Jul 12, 2024
94a086f
ci: remove net debug
Jul 12, 2024
8217316
ref: up retry count for testing
Jul 12, 2024
380a945
change node count for default node config file
Jul 12, 2024
6864da8
ci: updates based on local testing
Jul 12, 2024
b7ec2f5
ci: remove IP from port forward
Jul 15, 2024
f51e63d
ci: switch LA branch for debugging
Jul 15, 2024
de89670
ci: debug with latest commit hash
Jul 15, 2024
e7a5a1f
ci: test datil-dev-binaries
Jul 16, 2024
38404a6
ref(wip): tweaks for compatibility with container
Jul 17, 2024
30fa075
ci: change to force ci run
Jul 17, 2024
214cc9b
ci: force ci runs on branch
Jul 17, 2024
a2e4fad
ref: Remove import
Jul 17, 2024
5e286fa
ci: reduce tests for debugging
Jul 17, 2024
5f3ff06
ci: migrate to wrap runner for perf test
Jul 17, 2024
f18a31e
dev: change to V2 route for execute js
Jul 17, 2024
3e08910
ci: change runner for job test
Jul 17, 2024
140d8df
ci: change runner back
Jul 17, 2024
8a03e5b
ref: run single test for debugging
Jul 18, 2024
8976976
ci: add rpc url to env
Jul 18, 2024
810e0b8
Merge branch 'master' of github.com:LIT-Protocol/js-sdk into feature/…
Jul 30, 2024
3993b50
ref: update ci env
Jul 30, 2024
db88258
change branch in LA pull step
Jul 30, 2024
4139c55
ref: update archive hash
Jul 30, 2024
9a40d2f
ref: fix var access
Jul 30, 2024
9c796a3
ref: remove code from bad merge
Jul 30, 2024
63dfc77
ref: fix manifest resolving
Jul 30, 2024
3303258
ref: remove max price from session
Jul 30, 2024
777f6ab
ref: test decryption in ci
Jul 30, 2024
8dfd99f
ci: revert endpoint change and change ci test
Jul 30, 2024
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
20 changes: 18 additions & 2 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
NETWORK=cayenne
#Tinny ENV Vars
MAX_ATTEMTPS=3
NETWORK=localchain
DEBUG=true
MAX_ATTEMPTS=3
WAIT_FOR_KEY_INTERVAL=3000
TIME_TO_RELEASE_KEY=10000
RUN_IN_BAND=true
RUN_IN_BAND_INTERVAL=5000
NO_SETUP=false
USE_SHIVA=true
NETWORK_CONFIG=./networkContext.json
TEST_TIMEOUT=45000

#Shiva Client ENV Vars
STOP_TESTNET=false
TESTNET_MANAGER_URL=http://0.0.0.0:8000
USE_LIT_BINARIES=true
LIT_NODE_BINARY_PATH=/usr/bin/lit_node
LIT_ACTION_BINARY_PATH=/usr/bin/lit_actions
67 changes: 41 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,64 @@ on:
push:
branches:
- master
- feature/**
pull_request:
branches:
- master
- staging/**
- feat/**
- feature/**
jobs:
master:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install project dependencies
run: yarn --frozen-lockfile
- uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'master'
- name: Build
run: yarn build:dev
- name: Run Unit tests
run: yarn tools --test --unit
e2e-connection:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
NETWORK: datil-dev
NETWORK: localchain
DEBUG: true
MAX_ATTEMPTS: 3
CHUNK_SIZE: 9
USE_SHIVA: true
STOP_TESTNET: true
TESTNET_MANAGER_URL: http://0.0.0.0:8000
USE_LIT_BINARIES: true
LIT_NODE_BINARY_PATH: /usr/bin/lit_node
LIT_ACTION_BINARY_PATH: /usr/bin/lit_actions
LIT_RPC_URL: http://127.0.0.1:8545
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout Lit Actions
uses: actions/checkout@v4
id: checkout
with:
fetch-depth: 0
repository: LIT-Protocol/lit-assets
ref: datil-cherrypick-shiva-changes
token: ${{secrets.GH_PAT}}
path: ${{ github.workspace }}/lit-assets/
submodules: false
sparse-checkout: |
blockchain
rust/lit-node
- name: Check LA dir
run: ls -la ${{github.workspace}}/lit-assets
- name: Install LA Blockchain Dependencies
run: npm i
working-directory: ${{github.workspace}}/lit-assets/blockchain/contracts
- name: Docker login
id: login
run: docker login ghcr.io/ -u ${{secrets.GH_USER}} --password ${{secrets.GH_PAT}}
- name: Pull Shiva Container
id: shiva-pull
run: docker pull ghcr.io/lit-protocol/shiva:latest
- name: Run Shiva Container
id: shiva-runner
run: docker run -d -m 12g -p 8000:8000 -p 8545:8545 -p 7470:7470 -p 7471:7471 -p 7472:7472 -p 7473:7473 -p 7474:7474 -p 7475:7475 -v ${{github.workspace}}/lit-assets:/data -e GH_PAT=${{secrets.GH_PAT}} -e HASH="b5cfe7489275dbed5e9098818d0bd441c8918903" -e IPFS_API_KEY=${{secrets.IPFS_API_KEY}} --name shiva ghcr.io/lit-protocol/shiva:latest
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
node-version: '18'
- name: Install project dependencies
run: yarn install
- name: Build packages
Expand All @@ -58,4 +70,7 @@ jobs:
run: cp .env.ci .env
- name: Run End to End Tests
if: steps.build.outputs.exit_code == 0
run: yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning,testUseEoaSessionSigsToPkpSign,testUsePkpSessionSigsToExecuteJsSigning,testUsePkpSessionSigsToPkpSign,testUseValidLitActionCodeGeneratedSessionSigsToPkpSign,testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning,testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs,testEthAuthSigToEncryptDecryptString,testExecuteJsSignAndCombineEcdsa,testExecutJsDecryptAndCombine,testExecuteJsBroadcastAndCollect --exclude=Parallel
run: docker ps -a && yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning
- name: Get Container Logs
if: always()
run: docker logs shiva
24 changes: 0 additions & 24 deletions .github/workflows/lint.yml

This file was deleted.

29 changes: 24 additions & 5 deletions local-tests/setup/shiva-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { LitContractResolverContext } from '@lit-protocol/types';
import {
LitContractContext,
LitContractResolverContext,
} from '@lit-protocol/types';
import { ethers } from 'ethers';
import {
TestNetCreateRequest,
Expand Down Expand Up @@ -89,6 +92,7 @@ export class TestnetClient {
const contractResolverAbi: string = testNetConfig.contractResolverAbi;
const contractResolverAddress =
testNetConfig.contractAddresses[`contractResolver`];

const networkContext = {
abi: JSON.parse(contractResolverAbi),
resolverAddress: contractResolverAddress,
Expand All @@ -97,6 +101,7 @@ export class TestnetClient {
),
environment: 0, // test deployment uses env value 0 in test common
};

return networkContext;
}

Expand Down Expand Up @@ -135,7 +140,10 @@ export class TestnetClient {
this._id
);

return _processTestnetResponse<boolean>(res);
let testnetInfoRes = await _processTestnetResponse<TestNetInfo>(res);
this._info = testnetInfoRes.body;

return testnetInfoRes;
}

/**
Expand Down Expand Up @@ -209,9 +217,20 @@ export class ShivaClient {
async startTestnetManager(
createReq?: TestNetCreateRequest
): Promise<TestnetClient> {
const existingTestnetResp = await fetch(
this.processEnvs.TESTNET_MANAGER_URL + '/test/get/testnets'
);
let existingTestnetResp = undefined;
let retryCount = 0;
while (!existingTestnetResp && retryCount < 200) {
try {
existingTestnetResp = await fetch(
this.processEnvs.TESTNET_MANAGER_URL + '/test/get/testnets',
);
} catch (e) {
console.error('error while fetching testnets: ', e);
retryCount += 1;
await new Promise((res) => setTimeout(res, 1000));
}
}

const existingTestnets: string[] = await existingTestnetResp.json();
if (existingTestnets.length > 0) {
this._clients.set(
Expand Down
3 changes: 3 additions & 0 deletions local-tests/setup/tinny-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { LitContracts } from '@lit-protocol/contracts-sdk';
import {
AuthSig,
CosmosAuthSig,
LIT_NETWORKS_KEYS,
LitContractContext,
LitContractResolverContext,
SolanaAuthSig,
Expand Down Expand Up @@ -458,7 +459,9 @@ export class TinnyEnvironment {
if (this.network === LIT_TESTNET.LOCALCHAIN) {
const networkContext =
this?.testnet?.ContractContext ?? this._contractContext;

this.contractsClient = new LitContracts({
network: this.network as LIT_NETWORKS_KEYS,
signer: wallet,
debug: this.processEnvs.DEBUG,
rpc: this.rpc,
Expand Down
2 changes: 2 additions & 0 deletions local-tests/setup/tinny-person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LitContracts } from '@lit-protocol/contracts-sdk';
import {
AuthMethod,
BaseSiweMessage,
LIT_NETWORKS_KEYS,
LitContractContext,
} from '@lit-protocol/types';
import { ethers } from 'ethers';
Expand Down Expand Up @@ -124,6 +125,7 @@ export class TinnyPerson {
if (this.envConfig.network === LIT_TESTNET.LOCALCHAIN) {
const networkContext = this.envConfig.contractContext;
this.contractsClient = new LitContracts({
network: this.envConfig.network as LIT_NETWORKS_KEYS,
signer: this.wallet,
debug: this.envConfig.processEnvs.DEBUG,
rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"jest": "27.5.1",
"lerna": "^5.4.3",
"live-server": "^1.2.2",
"node-fetch": "^2.6.1",
"node-fetch": "2.6.13",
"node-localstorage": "^3.0.5",
"nx": "17.3.0",
"path": "^0.12.7",
Expand Down
51 changes: 7 additions & 44 deletions packages/contracts-sdk/src/lib/contracts-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,19 +421,6 @@ export class LitContracts {
// ----- autogen:init:start -----
// Generated at 2023-11-07T01:50:52.460Z

this.allowlistContract = {
read: new ethers.Contract(
addresses.Allowlist.address,
addresses.Allowlist.abi as any,
this.provider
) as unknown as allowlistContract.Allowlist & allowlistContract.Allowlist,
write: new ethers.Contract(
addresses.Allowlist.address,
addresses.Allowlist.abi as any,
this.signer
) as unknown as allowlistContract.Allowlist & allowlistContract.Allowlist,
};

this.litTokenContract = {
read: new ethers.Contract(
addresses.LITToken.address,
Expand All @@ -447,21 +434,6 @@ export class LitContracts {
) as unknown as litTokenContract.LITToken & litTokenContract.LITToken,
};

this.multisenderContract = {
read: new ethers.Contract(
addresses.Multisender.address,
addresses.Multisender.abi as any,
this.provider
) as unknown as multisenderContract.Multisender &
multisenderContract.Multisender,
write: new ethers.Contract(
addresses.Multisender.address,
addresses.Multisender.abi as any,
this.signer
) as unknown as multisenderContract.Multisender &
multisenderContract.Multisender,
};

this.pkpHelperContract = {
read: new ethers.Contract(
addresses.PKPHelper.address,
Expand All @@ -488,21 +460,6 @@ export class LitContracts {
) as unknown as pkpNftContract.PKPNFT & pkpNftContract.PKPNFT,
};

this.pkpNftMetadataContract = {
read: new ethers.Contract(
addresses.PKPNFTMetadata.address,
addresses.PKPNFTMetadata.abi as any,
this.provider
) as unknown as pkpNftMetadataContract.PKPNFTMetadata &
pkpNftMetadataContract.PKPNFTMetadata,
write: new ethers.Contract(
addresses.PKPNFTMetadata.address,
addresses.PKPNFTMetadata.abi as any,
this.signer
) as unknown as pkpNftMetadataContract.PKPNFTMetadata &
pkpNftMetadataContract.PKPNFTMetadata,
};

this.pkpPermissionsContract = {
read: new ethers.Contract(
addresses.PKPPermissions.address,
Expand Down Expand Up @@ -767,6 +724,11 @@ export class LitContracts {
})
);

LitContracts.logger.debug(
'built contract context',
contractContext['PKPNFT']
);

return contractContext;
}

Expand Down Expand Up @@ -899,6 +861,7 @@ export class LitContracts {
rpcUrl
);

LitContracts.logger.debug('rpc url', rpcUrl);
// Fetch contract data
const [activeValidators, currentValidatorsCount, kickedValidators] =
await Promise.all([
Expand Down Expand Up @@ -1613,7 +1576,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope
try {
mintCost = await this.pkpNftContract.read.mintCost();
} catch (e) {
throw new Error('Could not get mint cost');
throw e;
}

let sentTx;
Expand Down
15 changes: 12 additions & 3 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@
"importHelpers": true,
"target": "ES2020",
"module": "ES2020",
"lib": ["ES2020", "dom", "ES2021.String"],
"lib": [
"ES2020",
"dom",
"ES2021.String"
],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"paths": {
"@lit-protocol/*": ["packages/*/src"]
"@lit-protocol/*": [
"packages/*/src"
]
}
},
"exclude": ["node_modules", "tmp"]
"exclude": [
"node_modules",
"tmp"
]
}
Loading