Skip to content

Commit

Permalink
only use dvn version 2 in metadata-tools (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanL0 authored Jan 15, 2025
1 parent 7487ced commit fa73cc4
Show file tree
Hide file tree
Showing 4 changed files with 399 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/honest-hats-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@layerzerolabs/metadata-tools": minor
---

only use dvn version 2 in metadata-tools
2 changes: 1 addition & 1 deletion packages/metadata-tools/src/config-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function DVNsToAddresses(dvns: string[], chainKey: string, metadata: IMet

let i = 0
for (const [dvnAddress, dvnDetails] of metadataDVNs) {
if (dvnDetails.canonicalName === dvn && !dvnDetails.lzReadCompatible) {
if (dvnDetails.canonicalName === dvn && !dvnDetails.lzReadCompatible && dvnDetails.version === 2) {
if (dvnDetails.deprecated) {
console.log(`Warning: DVN "${dvn}" is deprecated.`)
}
Expand Down
8 changes: 8 additions & 0 deletions packages/metadata-tools/test/config-metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { DVNsToAddresses, translatePathwayToConfig } from '@/config-metadata'
import { IMetadata } from '@/types'

import fujiMetadata from './data/fuji.json'
import polygonMainnetMetadata from './data/polygon-mainnet.json'
import solanaMainnetMetadata from './data/solana-mainnet.json'
import solanaTestnetMetadata from './data/solana-testnet.json'

describe('config-metadata', () => {
const metadata: IMetadata = {
fuji: fujiMetadata,
solana: solanaMainnetMetadata,
polygon: polygonMainnetMetadata,
'solana-testnet': solanaTestnetMetadata,
}

Expand Down Expand Up @@ -104,5 +106,11 @@ describe('config-metadata', () => {
`Duplicate DVN name found: "LayerZero Labs".`
)
})

it('correctly takes into account the version of the DVN', () => {
expect(DVNsToAddresses(['Polyhedra'], 'polygon', metadata)).toStrictEqual([
'0x8ddf05f9a5c488b4973897e278b58895bf87cb24',
])
})
})
})
Loading

0 comments on commit fa73cc4

Please sign in to comment.