Skip to content

Commit 2e0616f

Browse files
committed
Merge branch 'master' of github.com:across-protocol/contracts into faisal/add-missing-script
2 parents 0625b2f + 9f31ae4 commit 2e0616f

File tree

14 files changed

+146
-39
lines changed

14 files changed

+146
-39
lines changed

.github/actions/setup-node-if-needed/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ runs:
1515
id: check-node
1616
shell: bash
1717
run: |
18-
if command -v node >/dev/null 2>&1; then
18+
if node --version 2>/dev/null | grep -q "v${{ inputs.node_version }}"; then
1919
echo "installed=true" >> "$GITHUB_OUTPUT"
2020
else
2121
echo "installed=false" >> "$GITHUB_OUTPUT"

.github/workflows/pr.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- "master"
77
env:
8-
NODE_VERSION: 20
8+
NODE_VERSION: 22.18
99
jobs:
1010
# Multiple jobs depend on having EVM and SVM artifacts available, so we upload them first in separate jobs.
1111
upload-svm-artifacts:
@@ -144,6 +144,16 @@ jobs:
144144
with:
145145
verify_version: 0.4.3
146146
node_version: ${{ env.NODE_VERSION }}
147+
- name: Check which paths changed
148+
uses: dorny/paths-filter@v3
149+
id: filter
150+
with:
151+
filters: |
152+
svm:
153+
- 'programs/**'
154+
- 'scripts/svm/**'
155+
- 'src/svm/**'
156+
- 'test/svm/**'
147157
- name: Download SVM artifacts
148158
uses: actions/download-artifact@v4
149159
with:
@@ -165,6 +175,7 @@ jobs:
165175
if: steps.verified-test-build-cache.outputs.cache-hit != 'true'
166176
run: tar -cf svm-verified-test-binaries.tar target/deploy
167177
- name: Test verified SVM build
178+
if: steps.filter.outputs.svm == 'true'
168179
run: anchor test --skip-build
169180
build-ts:
170181
name: Build TypeScript

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
permissions:
1616
contents: write
1717
env:
18-
NODE_VERSION: "20.x"
18+
NODE_VERSION: 22.18
1919
EVM_ARTIFACTS_PATHS: |
2020
artifacts
2121
cache

contracts/AcrossEventEmitter.sol

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
/**
5+
* @title AcrossEventEmitter
6+
* @notice A simple contract that emits events with bytes encoded metadata
7+
*/
8+
contract AcrossEventEmitter {
9+
/**
10+
* @notice Emitted when metadata is stored
11+
* @param data The metadata bytes emitted
12+
*/
13+
event MetadataEmitted(bytes data);
14+
15+
/**
16+
* @notice Emits metadata as an event
17+
* @param data The bytes data to emit
18+
*/
19+
function emitData(bytes calldata data) external {
20+
require(data.length > 0, "Data cannot be empty");
21+
emit MetadataEmitted(data);
22+
}
23+
}

deploy/111_deploy_universal_spokepool.ts

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import { DeployFunction } from "hardhat-deploy/types";
22
import { HardhatRuntimeEnvironment } from "hardhat/types";
33
import { deployNewProxy, getSpokePoolDeploymentInfo } from "../utils/utils.hre";
4-
import { FILL_DEADLINE_BUFFER, L2_ADDRESS_MAP, QUOTE_TIME_BUFFER, USDC, ZERO_ADDRESS } from "./consts";
4+
import {
5+
EXPECTED_SAFE_ADDRESS,
6+
FILL_DEADLINE_BUFFER,
7+
L2_ADDRESS_MAP,
8+
QUOTE_TIME_BUFFER,
9+
USDC,
10+
ZERO_ADDRESS,
11+
} from "./consts";
512
import { CHAIN_IDs, PRODUCTION_NETWORKS, TOKEN_SYMBOLS_MAP } from "../utils/constants";
6-
import { getOftEid, toWei } from "../utils/utils";
13+
import { getOftEid, toWei, predictedSafe } from "../utils/utils";
14+
import { getNodeUrl } from "../utils";
715
import { getDeployedAddress } from "../src/DeploymentUtils";
16+
import "@nomiclabs/hardhat-ethers";
17+
import Safe from "@safe-global/protocol-kit";
818

919
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1020
const { hubPool, hubChainId, spokeChainId } = await getSpokePoolDeploymentInfo(hre);
@@ -53,7 +63,38 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5363
// target address of the spoke pool. This is because the HubPool does not pass in the chainId when calling
5464
// relayMessage() on the Adapter. Therefore, if Universal SpokePools share the same address,
5565
// then a message designed to be sent to one chain could be sent to another's SpokePool.
56-
await deployNewProxy("Universal_SpokePool", constructorArgs, initArgs);
66+
const { proxyAddress } = await deployNewProxy("Universal_SpokePool", constructorArgs, initArgs);
67+
68+
if (!proxyAddress) {
69+
return;
70+
}
71+
72+
const nodeUrl = getNodeUrl(spokeChainId);
73+
74+
const protocolKit = await Safe.init({
75+
provider: nodeUrl,
76+
predictedSafe,
77+
});
78+
79+
const existingProtocolKit = await protocolKit.connect({
80+
safeAddress: EXPECTED_SAFE_ADDRESS,
81+
});
82+
const isDeployed = await existingProtocolKit.isSafeDeployed();
83+
84+
if (!isDeployed) {
85+
throw new Error("Expected Safe address is not deployed, please deploy it first");
86+
}
87+
88+
const factory = await hre.ethers.getContractFactory("Universal_SpokePool");
89+
const contract = factory.attach(proxyAddress);
90+
91+
const owner = await contract.owner();
92+
if (owner !== EXPECTED_SAFE_ADDRESS) {
93+
await (await contract.transferOwnership(EXPECTED_SAFE_ADDRESS)).wait();
94+
console.log("Transferred ownership to Expected Safe address:", await contract.owner());
95+
} else {
96+
console.log("Expected Safe address is already the owner of the Universal SpokePool");
97+
}
5798
};
5899
module.exports = func;
59100
func.tags = ["UniversalSpokePool"];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { DeployFunction } from "hardhat-deploy/types";
2+
import { HardhatRuntimeEnvironment } from "hardhat/types";
3+
4+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5+
const { deployer } = await hre.getNamedAccounts();
6+
const instance = await hre.deployments.deploy("AcrossEventEmitter", {
7+
from: deployer,
8+
log: true,
9+
skipIfAlreadyDeployed: true,
10+
});
11+
await hre.run("verify:verify", { address: instance.address });
12+
};
13+
14+
module.exports = func;
15+
func.tags = ["AcrossEventEmitter"];

deploy/consts.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ export const ZK_L1_GAS_TO_L2_GAS_PER_PUBDATA_LIMIT = 800;
2222
export const ZK_L2_GAS_LIMIT = 2000000;
2323
export const ZK_MAX_GASPRICE = "10000000000000"; // 10k gwei
2424

25+
// Expected Safe address for Universal SpokePool
26+
export const EXPECTED_SAFE_ADDRESS = "0x0Fc8E2BB9bEd4FDb51a0d36f2415c4C7F9e75F6e";
27+
export const EXPECTED_SAFE_OWNERS = [
28+
"0x868CF19464e17F76D6419ACC802B122c22D2FD34",
29+
"0xcc400c09ecBAC3e0033e4587BdFAABB26223e37d",
30+
"0x837219D7a9C666F5542c4559Bf17D7B804E5c5fe",
31+
"0x1d933Fd71FF07E69f066d50B39a7C34EB3b69F05",
32+
"0x996267d7d1B7f5046543feDe2c2Db473Ed4f65e9",
33+
];
34+
2535
export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string } } = {
2636
[CHAIN_IDs.MAINNET]: {
2737
finder: "0x40f941E48A552bF496B154Af6bf55725f18D77c3",

foundry.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"lib/forge-std": {
33
"tag": {
4-
"name": "v1.10.0",
5-
"rev": "8bbcf6e3f8f62f419e5429a0bd89331c85c37824"
4+
"name": "v1.11.0",
5+
"rev": "8e40513d678f392f398620b3ef2b418648b33e89"
66
}
77
}
88
}

hardhat.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ const config: HardhatUserConfig = {
309309
browserURL: "https://explorer.redstone.xyz",
310310
},
311311
},
312+
{
313+
network: "plasma",
314+
chainId: 9745,
315+
urls: {
316+
apiURL: "https://api.routescan.io/v2/network/mainnet/evm/9745/etherscan",
317+
browserURL: "https://plasmascan.to",
318+
},
319+
},
312320
{
313321
network: "soneium",
314322
chainId: CHAIN_IDs.SONEIUM,

0 commit comments

Comments
 (0)