DIN-center / din-sc

1 stars 0 forks source link

Add Metadata to manage DIN Operations #46

Open cds-amal opened 1 day ago

cds-amal commented 1 day ago

Summary:

This PR looks at #45 and introduces updates to rpc-definitions, din-sc and din-go to support health checks, network provisioning, and provider metadata. It includes new ad-hoc testing scripts to query and verify network and provider data, allowing improved monitoring and control over network operations within the DIN registry.

Note

The following two methods were not added because I'm not sure if they need to be discoverable. We should determine that before including them in the registry. (cc: @twhay)

Key Updates:

How to Test:

  1. Compile and launch the local test environment:
    • Run the following command in your terminal:
      pnpm i && pnpm -w build:all && pnpm -w z
    • This will open zellij with three panes. The left pane runs anvil. In the upper-right pane, press enter to deploy the contracts.
  2. Switch to the bottom-right pane:
    • Press esc to activate the command line.
  3. Navigate to the din-sc directory:
    cd apps/din-sc
  4. Run the ethers.js test script:
    node scripts/test-ethers.mjs
  5. Run the web3.js test script:
    node scripts/test-web3.mjs

You should see a table output similar to this:

┌─────────┬────────────────────────┬───────────────┬────────────────────────┬──────────────────────┬────────────────────────┬───────────────┬─────────────────────┬─────────────────────────┐
│ (index) │ name                   │ isProvisioned │ healthcheckMethodName  │ healthcheckMethodBit │ healthcheckIntervalSec │ blockLagLimit │ requestAttemptCount │ maxRequestPayloadSizeKb │
├─────────┼────────────────────────┼───────────────┼────────────────────────┼──────────────────────┼────────────────────────┼───────────────┼─────────────────────┼─────────────────────────┤
│ 0       │ 'arbitrum://mainnet'   │ false         │ 'eth_blockNumber'      │ 10n                  │ 30n                    │ 5n            │ 3n                  │ 512n                    │
│ 1       │ 'avalanchec://mainnet' │ false         │ 'eth_blockNumber'      │ 6n                   │ 30n                    │ 5n            │ 3n                  │ 512n                    │
│ 2       │ 'blast://mainnet'      │ false         │ 'eth_blockNumber'      │ 2n                   │ 30n                    │ 5n            │ 3n                  │ 512n                    │
│ 3       │ 'blast://testnet'      │ false         │ 'eth_blockNumber'      │ 2n                   │ 30n                    │ 5n            │ 3n                  │ 512n                    │
│ ...     │ ...                    │ ...           │ ...                    │ ...                  │ ...                    │ ...           │ ...                 │ ...                     │
└─────────┴────────────────────────┴───────────────┴────────────────────────┴──────────────────────┴────────────────────────┴───────────────┴─────────────────────┴─────────────────────────┘
natefikru commented 10 hours ago

Looks great so far.

1 additional thing that wasn't in the requirements.

i added a din_registry level metadata value called registry_block_epoch that should be a minimum type of uint16.

This value will determine the epoch value for all proxy's, aka, each proxy sync's its registry data every 100 blocks.

natefikru commented 6 hours ago

i think the term NetworkMeta makes sense when referencing the object. but when we use the term meta by itself, it loses useful context. is it possible to update references to meta to either metaData or networkMeta