Skip to content

Commit 34745ca

Browse files
authored
chore(protocol-contracts): do not enforce executor gas option for governance sender (#1307)
1 parent b29ca78 commit 34745ca

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { EndpointId } from '@layerzerolabs/lz-definitions'
2-
import { ExecutorOptionType } from '@layerzerolabs/lz-v2-utilities'
32
import { TwoWayConfig, generateConnectionsConfig } from '@layerzerolabs/metadata-tools'
4-
import { OAppEnforcedOption } from '@layerzerolabs/toolbox-hardhat'
53

64
import type { OmniPointHardhat } from '@layerzerolabs/toolbox-hardhat'
75

@@ -15,20 +13,11 @@ const zamaTestnetContract: OmniPointHardhat = {
1513
contractName: 'GovernanceOAppReceiver',
1614
}
1715

18-
// To connect all the above chains to each other, we need the following pathways:
19-
// ZamaGatewayTestnet <-> Sepolia
16+
// To connect the above chains to each other, we need the following pathway:
17+
// Sepolia -> ZamaGatewayTestnet
2018

21-
// For this example's simplicity, we will use the same enforced options values for sending to all chains
22-
// For production, you should ensure `gas` is set to the correct value through profiling the gas usage of calling GovernanceOAppReceiver._lzReceive(...) on the destination chain
19+
// We don't use enforce executor gas options here, so we should ensure `options` is set to the correct value through profiling the gas usage of calling GovernanceOAppReceiver._lzReceive(...) on the destination chain.
2320
// To learn more, read https://docs.layerzero.network/v2/concepts/applications/oapp-standard#execution-options-and-enforced-settings
24-
const EVM_ENFORCED_OPTIONS: OAppEnforcedOption[] = [
25-
{
26-
msgType: 1,
27-
optionType: ExecutorOptionType.LZ_RECEIVE,
28-
gas: 80000,
29-
value: 0,
30-
},
31-
]
3221

3322
// With the config generator, pathways declared are automatically bidirectional
3423
// i.e. if you declare A,B there's no need to declare B,A
@@ -38,16 +27,25 @@ const pathways: TwoWayConfig[] = [
3827
zamaTestnetContract, // Chain B contract
3928
// TODO: Add custom ZAMA DVN in next line?
4029
[['LayerZero Labs'], []], // [ requiredDVN[], [ optionalDVN[], threshold ] ]
41-
[15, undefined], // [A to B confirmations, B to A confirmations] // NOTE: undefined is used here because we want an uniderectional pathway
42-
[EVM_ENFORCED_OPTIONS, undefined], // Chain B enforcedOptions, Chain A enforcedOptions // NOTE: undefined is used here because we want an uniderectional pathway
30+
[15, undefined], // [A to B confirmations, B to A confirmations] // NOTE: `undefined` is used here because we want an uniderectional pathway
31+
[undefined, undefined], // NOTE: first `undefined` is because we do not enforce gas, since proposals are arbitrary calls. Instead, we will use a gas profiler to calculate the gas needed for proposal execution and adds a relative buffer on top. Second `undefined` is used here because we want an uniderectional pathway.
4332
],
4433
]
4534

4635
export default async function () {
4736
// Generate the connections config based on the pathways
4837
const connections = await generateConnectionsConfig(pathways)
4938
return {
50-
contracts: [{ contract: zamaTestnetContract, config: { owner: process.env.SAFE_PROXY_ADDRESS, delegate: process.env.SAFE_PROXY_ADDRESS } }, { contract: sepoliaContract, config: { owner: process.env.DAO_ADDRESS, delegate : process.env.DAO_ADDRESS } }],
39+
contracts: [
40+
{
41+
contract: zamaTestnetContract,
42+
config: { owner: process.env.SAFE_PROXY_ADDRESS, delegate: process.env.SAFE_PROXY_ADDRESS },
43+
},
44+
{
45+
contract: sepoliaContract,
46+
config: { owner: process.env.DAO_ADDRESS, delegate: process.env.DAO_ADDRESS },
47+
},
48+
],
5149
connections,
5250
}
5351
}

0 commit comments

Comments
 (0)