Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chunk-setconfig-l2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@layerzerolabs/protocol-devtools-evm": patch
---

Chunk setConfig into batches of 10 to avoid calldata/gas limits on L2s
22 changes: 16 additions & 6 deletions packages/protocol-devtools-evm/src/endpointv2/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ import { BlockedUln302 } from '@/uln302/blockedSdk'
const CONFIG_TYPE_EXECUTOR = 1
const CONFIG_TYPE_ULN = 2
const CONFIG_TYPE_READ_LIB_CONFIG = 1
const CONFIG_BATCH_SIZE = 10
Copy link
Contributor

@tinom9 tinom9 Feb 19, 2026

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we can mark it as a follow up PR? Trying to minimize package surfaces that I need to bump to unblock USDT0.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, this should be configurable via env vars must be the easiest way


const chunkArray = <T>(array: T[], size: number): T[][] => {
const chunks: T[][] = []
for (let i = 0; i < array.length; i += size) {
chunks.push(array.slice(i, i + size))
}
return chunks
}

/**
* EVM-specific SDK for EndpointV2 contracts
Expand Down Expand Up @@ -283,14 +292,15 @@ export class EndpointV2 extends OmniSDK implements IEndpointV2 {
async setConfig(oapp: OmniAddress, uln: OmniAddress, setConfigParam: SetConfigParam[]): Promise<OmniTransaction[]> {
this.logger.debug(`Setting config for OApp ${oapp} to ULN ${uln} with config ${printJson(setConfigParam)}`)

const data = this.contract.contract.interface.encodeFunctionData('setConfig', [oapp, uln, setConfigParam])
const chunks = chunkArray(setConfigParam, CONFIG_BATCH_SIZE)

return [
{
return chunks.map((chunk) => {
const data = this.contract.contract.interface.encodeFunctionData('setConfig', [oapp, uln, chunk])
return {
...this.createTransaction(data),
description: `Setting config for ULN ${uln} to ${printJson(setConfigParam)}`,
},
]
description: `Setting config for ULN ${uln} to ${printJson(chunk)}`,
}
})
}

async setUlnConfig(
Expand Down