Skip to content

Commit

Permalink
Remove ceramic consumer code (#5182)
Browse files Browse the repository at this point in the history
* remove ceramic service

* remove more code

* remvoe test
  • Loading branch information
mattcasey authored Feb 18, 2025
1 parent 4447d63 commit f0d81b4
Show file tree
Hide file tree
Showing 36 changed files with 19 additions and 3,054 deletions.
4 changes: 0 additions & 4 deletions .ebstalk.apps.env/cron.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,3 @@ MAILGUN_SIGNING_KEY="{{pull:secretsmanager:/io.cv.app/prd/mailgun:SecretString:m

# Secrets for issuing credentials
CREDENTIAL_WALLET_KEY="{{pull:secretsmanager:/io.cv.app/prd/credentials:SecretString:credential_wallet_key}}"
CERAMIC_GRAPHQL_SERVER="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_graphql_server}}"
CERAMIC_HOST="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_host}}"
CERAMIC_SEED="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_seed}}"
CERAMIC_DID="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_did}}"
4 changes: 0 additions & 4 deletions .ebstalk.apps.env/webapp.env
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ XPS_API_TOKEN="{{pull:secretsmanager:/io.cv.app/prd/summon:SecretString:api_key}
#FORCE_SUBDOMAINS="{{pull:secretsmanager:/io.cv.app/prd/subdomains:SecretString:force_subdomains}}"
AWS_ELB_LISTENER_ARN="{{pull:secretsmanager:/io.cv.app/prd/aws:SecretString:elb_listener_arn}}"
CREDENTIAL_WALLET_KEY="{{pull:secretsmanager:/io.cv.app/prd/credentials:SecretString:credential_wallet_key}}"
CERAMIC_GRAPHQL_SERVER="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_graphql_server}}"
CERAMIC_HOST="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_host}}"
CERAMIC_SEED="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_seed}}"
CERAMIC_DID="{{pull:secretsmanager:/io.cv.app/prd/ceramic:SecretString:ceramic_did}}"
RECOVERY_CODE_SECRET_KEY="{{pull:secretsmanager:/io.cv.app/prd/recovery-code-secret-key:SecretString:recovery_code_secret_key}}"
GITCOIN_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/gitcoin:SecretString:gitcoin_api_key}}"
FARCASTER_ACCOUNT_SEED_PHRASE="{{pull:secretsmanager:/io.cv.app/prd/farcaster:SecretString:account_seed_phrase}}"
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/destroy_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
clean-up:
if: |
(github.event.action == 'unlabeled' && startsWith(github.event.label.name, ':rocket: deploy')) ||
(github.event.action == 'closed' && (contains(github.event.pull_request.labels.*.name, ':rocket: deploy') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-ceramic') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-sunnyawards') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-farcaster') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-cron') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-waitlist') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-websockets')))
(github.event.action == 'closed' && (contains(github.event.pull_request.labels.*.name, ':rocket: deploy') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-sunnyawards') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-farcaster') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-cron') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-waitlist') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-websockets')))
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
stage_name_suffix="${{ github.event.number }}-${{ env.GITHUB_HEAD_REF_SLUG }}"
for app in ceramic cron farcaster sunnyawards waitlist webapp websockets; do
for app in cron farcaster sunnyawards waitlist webapp websockets; do
# sanitize and trim string so that it can be used as a valid subdomain. Includes removing hyphens at the start and end of the name
stage_name=`echo "stg-${app}-${stage_name_suffix}" | sed -E -e 's/[^a-zA-Z0-9-]+//g' -e 's/(.{40}).*/\1/' -e 's/^-/0/' -e 's/-$/0/'`
Expand All @@ -57,12 +57,6 @@ jobs:
done
- name: Delete Ceramic Github deployment
uses: strumwolf/delete-deployment-environment@v3
with:
token: ${{ steps.get-token.outputs.token }}
environment: ${{ steps.destroy_aws_stack.outputs.ceramic_env }}

- name: Delete Cron Github deployment
uses: strumwolf/delete-deployment-environment@v3
with:
Expand Down
4 changes: 0 additions & 4 deletions apps/cron/src/cron.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { log } from '@charmverse/core/log';
import { createOffchainCredentialsForExternalProjects } from '@root/lib/credentials/createOffchainCredentialsForExternalProjects';
import { relay } from '@root/lib/websockets/relay';
import cron from 'node-cron';
import { Server } from 'socket.io';
Expand Down Expand Up @@ -71,9 +70,6 @@ cron.schedule('0 1 * * *', updateMixpanelProfilesTask);
// Sync summon space roles every day at midnight
cron.schedule('0 0 * * *', syncSummonSpacesRoles);

// Create external eas credentials for Gitcoin and Questbook every day at midnight
cron.schedule('0 0 * * *', createOffchainCredentialsForExternalProjects);

// Refresh docusign credentials every 6 hours
cron.schedule('0 */6 * * *', refreshDocusignOAuthTask);
// Sync op reviews every 15 minutes - remove by July 2024
Expand Down
8 changes: 0 additions & 8 deletions apps/cron/src/tasks/updateVotesStatus/updateVoteStatus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { prisma } from '@charmverse/core/prisma-client';
import { issueOffchainProposalCredentialsIfNecessary } from '@root/lib/credentials/issueOffchainProposalCredentialsIfNecessary';
import { getVotesByState } from '@root/lib/votes/getVotesByState';
import { VOTE_STATUS } from '@root/lib/votes/interfaces';
import { publishProposalEvent } from '@root/lib/webhookPublisher/publishEvent';
Expand Down Expand Up @@ -93,13 +92,6 @@ const updateVoteStatus = async () => {
})
]);

for (const passedEval of passedEvaluations) {
await issueOffchainProposalCredentialsIfNecessary({
event: 'proposal_approved',
proposalId: passedEval.proposalId
});
}

return votesPassedDeadline.length;
};

Expand Down
3 changes: 1 addition & 2 deletions charmClient/apis/credentialsApi.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as http from '@root/adapters/http';

import type { CharmVerseCredentialInput } from 'lib/credentials/attestOffchain';
import type { EASAttestationFromApi } from 'lib/credentials/external/getOnchainCredentials';
import type { GnosisSafeTransactionToIndex } from 'lib/credentials/indexGnosisSafeCredentialTransaction';
import type { ProposalCredentialsToIndex } from 'lib/credentials/indexOnChainProposalCredential';
Expand All @@ -9,7 +8,7 @@ import type { CreateCredentialTemplateInput, CredentialTemplateUpdate } from 'li

export class CredentialsApi {
// TODO Test endpoint for generating a credential - remove later
attest(data: CharmVerseCredentialInput): Promise<EASAttestationFromApi> {
attest(data: any): Promise<EASAttestationFromApi> {
return http.POST(`/api/credentials`, data);
}

Expand Down
3 changes: 0 additions & 3 deletions config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ export const appSubdomain = 'app';
export const credentialsWalletPrivateKey = process.env.CREDENTIAL_WALLET_KEY;
export const awsS3Bucket = process.env.S3_UPLOAD_BUCKET as string;

// Ceramic Node
export const graphQlServerEndpoint = process.env.CERAMIC_GRAPHQL_SERVER as string;

// Github
export const githubPrivateKey = process.env.GITHUB_APP_PRIVATE_KEY as string;
export const githubAppId = Number(process.env.GITHUB_APP_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,49 +673,4 @@ describe('generateCredentialInputsForProposal', () => {

expect(resultAfterIssuedCredentialSaved).toHaveLength(0);
});

it('should return credentials that were only issued offchain but not yet onchain', async () => {
const userWallet = randomETHWalletAddress().toLowerCase();
const generated = await testUtilsUser.generateUserAndSpace({ wallet: userWallet });
const user = generated.user;

const space = await prisma.space.update({
where: {
id: generated.space.id
},
data: {
useOnchainCredentials: true
}
});

const credentialTemplate = await testUtilsCredentials.generateCredentialTemplate({
spaceId: space.id,
credentialEvents: ['proposal_approved'],
schemaType: 'reward'
});

const proposal = await testUtilsProposals.generateProposal({
spaceId: space.id,
userId: user.id,
authors: [user.id],
proposalStatus: 'published',
selectedCredentialTemplateIds: [credentialTemplate.id],
evaluationInputs: [{ evaluationType: 'feedback', result: 'pass', permissions: [], reviewers: [] }]
});

const result = await findSpaceIssuableProposalCredentials({ spaceId: space.id });
expect(result.length).toBe(1);

// Simulate having issued this credential already
await testUtilsCredentials.generateIssuedOffchainCredential({
credentialEvent: 'proposal_approved',
credentialTemplateId: credentialTemplate.id,
proposalId: proposal.id,
userId: user.id
});

const resultAfterIssuedCredentialSaved = await findSpaceIssuableProposalCredentials({ spaceId: space.id });

expect(resultAfterIssuedCredentialSaved).toHaveLength(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -425,40 +425,4 @@ describe('findSpaceIssuableRewardCredentials', () => {

expect(resultAfterIssuedCredentialSaved).toHaveLength(0);
});

it('should return credentials that were only issued offchain but not yet onchain', async () => {
const userWallet = randomETHWalletAddress().toLowerCase();
const { space, user } = await testUtilsUser.generateUserAndSpace({ wallet: userWallet });

const credentialTemplate = await testUtilsCredentials.generateCredentialTemplate({
spaceId: space.id,
credentialEvents: ['reward_submission_approved'],
schemaType: 'reward'
});

const reward = await generateBountyWithSingleApplication({
bountyCap: null,
applicationStatus: 'complete',
spaceId: space.id,
userId: user.id,
selectedCredentialTemplateIds: [credentialTemplate.id]
});

const rewardApplication = reward.applications[0];

const result = await findSpaceIssuableRewardCredentials({ spaceId: space.id });
expect(result.length).toBe(1);

// Simulate having issued this credential already
await testUtilsCredentials.generateIssuedOffchainCredential({
credentialEvent: 'reward_submission_approved',
credentialTemplateId: credentialTemplate.id,
rewardApplicationId: rewardApplication.id,
userId: user.id
});

const resultAfterIssuedCredentialSaved = await findSpaceIssuableRewardCredentials({ spaceId: space.id });

expect(resultAfterIssuedCredentialSaved.length).toBe(1);
});
});
Loading

0 comments on commit f0d81b4

Please sign in to comment.