-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chain Event Types Removal Finale (#3309)
* from event-types client side * move chain + network to event -> working chain activity dashboard * switch ce commands to ts-node-dev * chain + network added to event in ChainEventConsumer * save * filter out non entity creation/completion events for notifications * remove EventTypeCUD RabbitMQ types + config + pub/sub calls * remove ChainEventType model * remove chain-event-type migration * CET model removal fixes * CW remove CET migration * CW remove CET model * CET removal migrations + model update * migration fixes * migration fixes * chain subscriptions + chain-event notification settings + subscribedChains * add full chain to createSubscription route result + fix UI * turn off sourceMap, use proper tsconfig when building ce, and fixed scraper imports * add type check to CI + fix type errors * add type check to CI + fix type errors + remove format in CE repo * set allowJs: false in tsconfig so sourceMap files don't interrupt ts-node * RabbitMQ merge fixes * Make CI lint only the changes in the branch rather than everything * fix tsconfig + run prettier * merge fixes * merge fixes * discoverReconnectRange fix * consumer erc20 notification handler bug fix * load-env-var fix * Procfile fix * master merge fixes * fix chain-event notifications * fix chain-event email notifications * format * format * CE css fix * remove subscriptions count for chain-events * fix getSubscribedChains call * notification settings page fixes + remove unnecessary logs * format * delete script * migration script fix * prettier format * publishCustomRabbitMQMessage.ts improvements * prettier format * more script improvements for testing/QA * add dump file to gitignore * 8 min local * 15 seconds local * add fkey from NR to Sub * format * eslint + format + .prettierignore update * Ensure CET Removal Backwards Compatibility. (#2765) * Use CE proxy for events too. * Ensure backwards compatibility for deployment + fix link to chain. * Prettier fixes. * Remove log. * fixed type errors * fix lint * fix lint * format * small logging fix * migration log improvement * ce procfile fix * add missing index to notif table * Subscriptions pkey + not null * fix type * test improved CE queries * Procfile fix * heroku test * heroku test 2 * cleaup * redo migration * redo migration CE + network migration fix * fix order of CE migrations * logging for debugging 503 * error handling CE - 503 debugging * event route - 503 debugging * optimize event route db query * prettier --------- Co-authored-by: Jake Naviasky <jake@commonwealth.im> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Muon Shot <120686579+CowMuon@users.noreply.github.com>
- Loading branch information
1 parent
e4dc43c
commit 6632d14
Showing
80 changed files
with
1,141 additions
and
1,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
web: node --max_old_space_size=$(../../../../scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/app/Server.js | ||
subscriber1: CHAIN_SUBSCRIBER_INDEX=0 node --max_old_space_size=$(../../../../scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainSubscriber/chainSubscriber.js run-as-script | ||
subscriber2: CHAIN_SUBSCRIBER_INDEX=1 node --max_old_space_size=$(../../../../scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainSubscriber/chainSubscriber.js run-as-script | ||
subscriber3: CHAIN_SUBSCRIBER_INDEX=2 node --max_old_space_size=$(../../../../scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainSubscriber/chainSubscriber.js run-as-script | ||
consumer: node --max_old_space_size=$(../../../../scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainEventsConsumer/chainEventsConsumer.js run-as-script | ||
web: node --max_old_space_size=$(./scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/app/Server.js | ||
subscriber1: CHAIN_SUBSCRIBER_INDEX=0 node --max_old_space_size=$(./scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainSubscriber/chainSubscriber.js run-as-script | ||
subscriber2: CHAIN_SUBSCRIBER_INDEX=1 node --max_old_space_size=$(./scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainSubscriber/chainSubscriber.js run-as-script | ||
subscriber3: CHAIN_SUBSCRIBER_INDEX=2 node --max_old_space_size=$(./scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainSubscriber/chainSubscriber.js run-as-script | ||
consumer: node --max_old_space_size=$(./scripts/get-max-old-space-size.sh) packages/chain-events/build/chain-events/services/ChainEventsConsumer/chainEventsConsumer.js run-as-script | ||
release: cd packages/chain-events && npx sequelize-cli db:migrate --config services/database/sequelize.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
packages/chain-events/scripts/publishCustomRabbitMQMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import type { IEventData } from '../src/chains/aave/types'; | ||
import type { CWEvent } from '../src'; | ||
import { SupportedNetwork } from '../src'; | ||
import { publishRmqMsg } from 'common-common/src/rabbitmq/util'; | ||
import { RABBITMQ_API_URI } from '../services/config'; | ||
import { RascalExchanges, RascalRoutingKeys } from 'common-common/src/rabbitmq'; | ||
import models from 'chain-events/services/database/database'; | ||
|
||
async function main() { | ||
const ceData = { | ||
id: 10, | ||
kind: 'proposal-created', | ||
values: ['0'], | ||
targets: ['0xE710CEd57456D3A16152c32835B5FB4E72D9eA5b'], | ||
endBlock: 16203604, | ||
executor: '0x64c7d40c07EFAbec2AafdC243bF59eaF2195c6dc', | ||
ipfsHash: | ||
'0x3876d28a014bc20432dcc3549ba95710446b98431d84c7f84fde6abe1baf527f', | ||
proposer: '0xb55a948763e0d386b6dEfcD8070a522216AE42b1', | ||
strategy: '0x90Dfd35F4a0BB2d30CDf66508085e33C353475D9', | ||
calldatas: [ | ||
'0x00000000000000000000000092d6c1e31e14520e676a687f0a93788b716beff5000000000000000000000000a8541f948411b3f95d9e89e8d339a56a9ed3d00b000000000000000000000000000000000000000000002fa54641bae8aaa00000', | ||
], | ||
signatures: ['transfer(address,address,uint256)'], | ||
startBlock: 16177324, | ||
}; | ||
const chainEvent: CWEvent<IEventData> = { | ||
blockNumber: 16170754, | ||
data: <any>ceData, | ||
network: SupportedNetwork.Aave, | ||
chain: 'dydx', | ||
}; | ||
|
||
const publishJson = await publishRmqMsg( | ||
RABBITMQ_API_URI, | ||
RascalExchanges.ChainEvents, | ||
RascalRoutingKeys.ChainEvents, | ||
chainEvent | ||
); | ||
|
||
console.log(publishJson); | ||
} | ||
|
||
async function clear() { | ||
try { | ||
let eventsDeleted = 0, | ||
entitiesDeleted = 0; | ||
await models.sequelize.transaction(async (t) => { | ||
const entityId = ( | ||
await models.ChainEntity.findOne({ | ||
where: { chain: 'dydx', type_id: '10' }, | ||
transaction: t, | ||
}) | ||
)?.id; | ||
|
||
if (entityId) { | ||
eventsDeleted = await models.ChainEvent.destroy({ | ||
where: { entity_id: entityId }, | ||
transaction: t, | ||
}); | ||
|
||
entitiesDeleted = await models.ChainEntity.destroy({ | ||
where: { id: entityId }, | ||
transaction: t, | ||
}); | ||
} else { | ||
console.log('Entity does not exist.'); | ||
} | ||
}); | ||
|
||
console.log( | ||
`Events deleted: ${eventsDeleted}\nEntities deleted: ${entitiesDeleted}` | ||
); | ||
} catch (e) { | ||
console.log('Failed to clear - reverted.'); | ||
console.error(e); | ||
} | ||
|
||
process.exit(1); | ||
} | ||
|
||
if (process.argv[2] === 'clear') clear(); | ||
else main(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.