Skip to content

Commit

Permalink
p-836 Update vc correctness (#2969)
Browse files Browse the repository at this point in the history
* add  lit-vc-correctness-test

* update credential json

* test: tokenholdingamount

* fix yml

* fix one more

* add cron task

* update cron

* fix DOCKER_TAG

* fix GITHUB_EVENT_NAME

* rename

* hardcode endpoint

* adding endpoint

* adding dps

* rename

* adding @litentry/chaindata

* fix chain

* fix comments

* fix env

* fix one more

* fix jobs
  • Loading branch information
0xverin authored Sep 1, 2024
1 parent 6beb690 commit 76e1bb4
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,32 @@ on:
workflow_dispatch:
inputs:
docker-tag:
description: "client tag(e.g. p1.2.0-9701-w0.0.1-101)"
description: "an existing docker tag (e.g. v0.9.18)"
required: true
default: "latest"
schedule:
- cron: '0 12 * * 3,6' # Run every Wednesday and Saturday at 12:00 UTC
env:
DOCKER_TAG: ${{ github.event.inputs.docker-tag || 'latest' }}

jobs:
test-data-provider:
test-vc-correctness:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set ENV
run: |
# extracting parachain version and worker version from release tag
echo "PARACHAIN_TAG=$(echo ${{inputs.docker-tag}} | cut -d'-' -f1 | sed 's/p/v/')" >> $GITHUB_ENV
echo "WORKER_TAG=$(echo ${{inputs.docker-tag}} | cut -d'-' -f3 | sed 's/w/v/')" >> $GITHUB_ENV
- name: Pull litentry image optionally
run: |
docker pull parity/polkadot
docker pull litentry/identity-worker:$WORKER_TAG
docker pull litentry/identity-cli:$WORKER_TAG
docker pull litentry/litentry-parachain:$PARACHAIN_TAG
docker pull litentry/identity-worker:$DOCKER_TAG
docker pull litentry/identity-cli:$DOCKER_TAG
docker pull litentry/litentry-parachain:$DOCKER_TAG
- name: Re-tag docker image
run: |
docker tag litentry/identity-worker:$WORKER_TAG litentry/identity-worker:latest
docker tag litentry/identity-cli:$WORKER_TAG litentry/identity-cli:latest
docker tag litentry/litentry-parachain:$PARACHAIN_TAG litentry/litentry-parachain:latest
docker tag litentry/identity-worker:$DOCKER_TAG litentry/identity-worker:latest
docker tag litentry/identity-cli:$DOCKER_TAG litentry/identity-cli:latest
docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest
- run: docker images --all

Expand All @@ -46,15 +45,15 @@ jobs:
cd tee-worker/docker
docker compose -f litentry-parachain.build.yml build
- name: Run data-provider-test
- name: Run vc correctness tests
run: |
cd tee-worker/docker
docker compose -f docker-compose.yml -f lit-data-provider-test.yml up --no-build --exit-code-from lit-data-provider-test lit-data-provider-test
docker compose -f docker-compose.yml -f lit-vc-correctness-test.yml up --no-build --exit-code-from lit-vc-correctness-test lit-vc-correctness-test
- name: Stop docker containers
run: |
cd tee-worker/docker
docker compose -f docker-compose.yml -f lit-data-provider-test.yml stop
docker compose -f docker-compose.yml -f lit-vc-correctness-test.yml stop
- name: Collect Docker Logs
continue-on-error: true
Expand All @@ -68,6 +67,6 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-lit-data-provider-test
name: logs-lit-vc-correctness-test
path: logs
if-no-files-found: ignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
lit-data-provider-test:
lit-vc-correctness-test:
image: litentry/identity-cli:latest
container_name: litentry-data-provider-test
container_name: litentry-vc-correctness-test
volumes:
- ../ts-tests:/ts-tests
- ../client-api:/client-api
Expand All @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh data-provider.test.ts 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh vc_correctness.test.ts 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"payload": {
"Basic": {
"name": "BAB token holder",
"chain": "Bsc"
"chain": ["Bsc"]
}
}
},
Expand All @@ -27,7 +27,7 @@
"payload": {
"Basic": {
"name": "Uniswap V2/V3 user",
"chain": "Ethereum"
"chain": ["Ethereum"]
}
}
},
Expand All @@ -40,10 +40,10 @@
{
"id": "dot-holder",
"name": "DOT Holding Time",
"description": "The length of time a user continues to hold DOT token (threshold DOT > 5)",
"description": "The length of time a user continues to hold DOT token (threshold DOT > 1)",
"assertion": {
"id": "A7",
"payload": "5"
"payload": "1"
},
"dataProvider": "achainable",
"network": "polkadot",
Expand Down Expand Up @@ -102,7 +102,7 @@
"payload": {
"ClassOfYear": {
"name": "Account created between {dates}",
"chain": "Ethereum"
"chain": ["Ethereum"]
}
}
},
Expand Down Expand Up @@ -233,19 +233,5 @@
"mockDid": "litentry:substrate:0xc0103c4b56ce752d05b16a88260e3a9e2c44306602a74c5edd1cd4ff56356f7c",
"mockWeb3Network": "litentry,polkadot",
"expectedCredentialValue": true
},
{
"id": "token-holding-amount-btcs",
"name": "BTCS Holding Time",
"description": "The number of BTCS tokens you hold > 0",
"assertion": {
"id": "Brc20AmountHolder",
"payload": []
},
"dataProvider": "achainable",
"network": "litentry",
"mockDid": "litentry:bitcoin:0x02dbb0aff6e115284ac2ac5795e299588dae74474ad4bd0e580e92163e80837da8",
"mockWeb3Network": "BitcoinP2tr",
"expectedCredentialValue": null
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"id": "token-holding-amount-btc",
"name": "Bitcoin Holding Amount",
"description": "The number of bitcoin tokens you hold > 0",
"assertion": {
"id": "TokenHoldingAmount",
"payload": "BTC"
},
"dataProvider": "blockchaininfo",
"network": "bitcoin",
"mockDid": "litentry:bitcoin:0x03041ee39c741c35eb55078220dceb477a1e3b1b129977e0b37db6624772b5bda8",
"mockWeb3Network": "BitcoinP2wpkh",
"expectedCredentialValue": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"id": "token-holding-amount-btcs",
"name": "BTCS Holding Amount",
"description": "The number of BTCS tokens you hold > 0",
"assertion": {
"id": "Brc20AmountHolder",
"payload": []
},
"dataProvider": "geniidata",
"network": "bitcoin",
"mockDid": "litentry:bitcoin:0x0202eb94e79b526f80b9029672f03d7c721da64c99fe742545423cbcc70851727f",
"mockWeb3Network": "BitcoinP2wpkh",
"expectedCredentialValue": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,31 @@ import discordJson from './discord.json' assert { type: 'json' };
import litentryJson from './litentry.json' assert { type: 'json' };
import twitterJson from './twitter.json' assert { type: 'json' };
import oneblockJson from './oneblock.json' assert { type: 'json' };
import geniidataJson from './geniidata.json' assert { type: 'json' };
import moralisJson from './moralis.json' assert { type: 'json' };
import blockchaininfoJson from './blockchaininfo.json' assert { type: 'json' };
export const vip3 = vip3Json as unknown as CredentialDefinition[];
export const achainable = achainableJson as unknown as CredentialDefinition[];
export const nodereal = noderealJson as unknown as CredentialDefinition[];
export const discord = discordJson as unknown as CredentialDefinition[];
export const litentry = litentryJson as unknown as CredentialDefinition[];
export const twitter = twitterJson as unknown as CredentialDefinition[];
export const oneblock = oneblockJson as unknown as CredentialDefinition[];
export const credentialsJson = [...vip3, ...achainable, ...nodereal, ...litentry, ...twitter, ...oneblock, ...discord];
export const geniidata = geniidataJson as unknown as CredentialDefinition[];
export const moralis = moralisJson as unknown as CredentialDefinition[];
export const blockchaininfo = blockchaininfoJson as unknown as CredentialDefinition[];
export const credentialsJson = [
...nodereal,
...geniidata,
...moralis,
...achainable,
...litentry,
...twitter,
...oneblock,
...discord,
...vip3,
...blockchaininfo,
];

export interface CredentialDefinition {
id: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"id": "token-holding-amount-sol",
"name": "SOL Holding Amount",
"description": "The number of SOL tokens you hold > 0",
"assertion": {
"id": "TokenHoldingAmount",
"payload": "SOL"
},
"dataProvider": "moralis",
"network": "solana",
"mockDid": "litentry:solana:09b36de0a9862cdbfe3eb023959e97e816e17d846a5762b3c1bfe7b75490c23b",
"mockWeb3Network": "solana",
"expectedCredentialValue": true
}
]
Loading

0 comments on commit 76e1bb4

Please sign in to comment.