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

Feat: data bus #247

Open
wants to merge 28 commits into
base: prerelease-3.1.0
Choose a base branch
from
Open

Feat: data bus #247

wants to merge 28 commits into from

Conversation

eddort
Copy link
Member

@eddort eddort commented Sep 21, 2024

No description provided.

@eddort eddort marked this pull request as ready for review September 26, 2024 10:58
src/common/config/in-memory-configuration.ts Outdated Show resolved Hide resolved
src/common/prometheus/prometheus.provider.ts Outdated Show resolved Hide resolved
scripts/convert-abi.js Outdated Show resolved Hide resolved
Comment on lines 18 to 19
DATA_BUS_ADDRESS: 'DATA_BUS_ADDRESS',
DATA_BUS_PROVIDER_URL: 'DATA_BUS_PROVIDER_URL',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we support multiply chains?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only support this functionality on the depositor side, it aggregates messages from different data sources

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding this on council daemons side as well. It could be multiply rpc for one chain, or for different. Since the API is the same and we can deploy the contract with the same address on different chains this kind of fallback seems easy enough to implement.

src/common/config/in-memory-configuration.ts Outdated Show resolved Hide resolved
src/contracts/data-bus/dsm-message-sender.client.ts Outdated Show resolved Hide resolved
src/contracts/data-bus/utils/mutex.ts Show resolved Hide resolved
src/common/config/in-memory-configuration.ts Outdated Show resolved Hide resolved
Comment on lines +362 to +366
this.lastPingBlock = blockData.blockNumber;
await this.guardianMessageService.pingMessageBroker(
stakingModulesData.map(({ stakingModuleId }) => stakingModuleId),
blockData,
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to make sure that pings succeeded before updating the lastPingBlock?

Comment on lines +59 to +74
let dieTimer: NodeJS.Timeout | null = null;

const startDieTimer = (lastBlock: number) => {
if (dieTimer) clearTimeout(dieTimer);

dieTimer = setTimeout(async () => {
const logger = await getLogger();
const error = new OnBlockError(
'There were no new blocks for a long time',
lastBlock,
);

logger.error(error);
process.exit(1);
}, MAX_TIME_WITHOUT_NEW_BLOCKS_MS);
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be a bit cleaner if dieTimer and startDieTimer were the property and method of the class. Would also make tests easier to write because we can spy on the timer.

await this.mutex.lock();
await this.dataBusClient.sendMessage(eventName, outputMessage);
} finally {
await this.mutex.unlock();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unlock isn't async

Suggested change
await this.mutex.unlock();
this.mutex.unlock();

*/
public subscribeToEVMChainUpdates() {
const provider = this.provider;
this.provider.clone();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This clones the provider and ?

Comment on lines +16 to +18
const AppSchema = z.object({
version: z.string(),
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the DataBus spec also includes name field
image

import { TransactionResponse } from '@ethersproject/abstract-provider';
import { DATA_BUS_REQUEST_TIMEOUT } from './data-bus.constants';

export class DataBusClient {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the order of messages being sent important? What if they are reordered?

Comment on lines +31 to +38
async sendTransaction(eventId: string, dataBytes: string) {
const tx: TransactionResponse = await this.dataBus.sendMessage(
eventId,
dataBytes,
);
await tx.wait();
return tx;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we manually increase priority fee (up to certain limit relative to current base fee) during high network activity?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do we need a retry mechanism?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we resend lost messages after a chain reorg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants