Skip to content

Commit

Permalink
Fix conflicts by resolving Registry to 7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ltyu committed Jan 23, 2025
2 parents 87097ac + 9048e2b commit cdba5a2
Show file tree
Hide file tree
Showing 88 changed files with 3,270 additions and 700 deletions.
5 changes: 0 additions & 5 deletions .changeset/many-llamas-count.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/proud-waves-camp.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/quick-walls-deny.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/thirty-apricots-eat.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/weak-dingos-thank.md

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ jobs:
# Other commands
- relay
# Warp Commands
- warp-init
- warp-read
- warp-apply
- warp-check
- warp-deploy
- warp-init
- warp-read
- warp-send
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .registryrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
80023dd9e9fadd4aa9fd868b5e7ad76dc3082494
2b3f78f7692b6b62e0f85023a29ecc2b2ab85008
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ COPY solidity ./solidity

RUN yarn build

# Baked-in registry version
# keep for back-compat until we update all usage of the monorepo image (e.g. key-funder)
ENV REGISTRY_URI="/hyperlane-registry"
ARG REGISTRY_COMMIT="main"
RUN git clone https://github.com/hyperlane-xyz/hyperlane-registry.git "$REGISTRY_URI" \
&& cd "$REGISTRY_URI" \
&& git fetch origin "$REGISTRY_COMMIT" \
&& git checkout "$REGISTRY_COMMIT"

# Add entrypoint script that allows overriding the registry commit
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]
18 changes: 18 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -e

# Set default registry URI, same as Dockerfile
REGISTRY_URI="/hyperlane-registry"

# Only update registry if REGISTRY_COMMIT is set
if [ -n "$REGISTRY_COMMIT" ]; then
echo "Updating Hyperlane registry to commit: ${REGISTRY_COMMIT}"
OLDPWD=$(pwd)
cd "$REGISTRY_URI"
git fetch origin "$REGISTRY_COMMIT"
git checkout "$REGISTRY_COMMIT"
cd "$OLDPWD"
fi

# Execute the main container command
exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;

manager
.create_index(
Index::create()
Expand All @@ -47,7 +46,17 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;

manager
.create_index(
Index::create()
.table(Cursor::Table)
.name("cursor_domain_height_idx")
.col(Cursor::Domain)
.col(Cursor::Height)
.index_type(IndexType::BTree)
.to_owned(),
)
.await?;
Ok(())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,29 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
.table(DeliveredMessage::Table)
.name("delivered_message_domain_destination_mailbox_idx")
.col(DeliveredMessage::Domain)
.col(DeliveredMessage::DestinationMailbox)
.index_type(IndexType::BTree)
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
.table(DeliveredMessage::Table)
.name("delivered_message_domain_destination_mailbox_sequence_idx")
.col(DeliveredMessage::Domain)
.col(DeliveredMessage::DestinationMailbox)
.col(DeliveredMessage::Sequence)
.index_type(IndexType::BTree)
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,28 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;

manager
.create_index(
Index::create()
.table(GasPayment::Table)
.name("gas_payment_domain_id_idx")
.col(GasPayment::Domain)
.col(GasPayment::Id)
.index_type(IndexType::BTree)
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
.table(GasPayment::Table)
.name("gas_payment_origin_id_idx")
.col(GasPayment::Origin)
.col(GasPayment::Id)
.index_type(IndexType::BTree)
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
Expand All @@ -99,7 +120,6 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;

manager
.get_connection()
.execute_unprepared(&format!(
Expand All @@ -124,7 +144,6 @@ impl MigrationTrait for Migration {
tgp_gas_amount = TotalGasPayment::TotalGasAmount.to_string(),
))
.await?;

Ok(())
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"base": {
"hex": "0x00000000000000000000000054624ca8abea68645b3b39211f90b804d53db680",
"base58": "1111111111112BBkkpUZNJgdH8DEmyDxFt74d4bH"
"hex": "0x000000000000000000000000cc9ece816641c8350db06af375811107b1aa0b9d",
"base58": "1111111111113rLmoQoXh3C1oA8mu6848RKQbnN8"
},
"solanamainnet": {
"hex": "0x2efbd8ff6417a50dbcedc18bab4235d4a2aac61af89214ac59545d30e0f86991",
"base58": "4AQVPTCAeLswnjksQdutxUDuxEJxUBwoWmVimGuPtGSt"
"hex": "0xd87c4b79368eea606390118e5e9bfdb4f720d214f8d2fc45745d00e31562f6ed",
"base58": "Fa4zQJCH7id5KL1eFJt2mHyFpUNfCCSkHgtMrLvrRJBN"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "collateral",
"decimals": 18,
"token": "0xb22a793a81ff5b6ad37f40d5fe1e0ac4184d52f3",
"foreignDeployment": "0x54624CA8ABEa68645b3B39211F90B804D53dB680"
"foreignDeployment": "0xcc9EcE816641c8350Db06af375811107B1Aa0b9d"
},
"solanamainnet": {
"type": "synthetic",
Expand Down
7 changes: 7 additions & 0 deletions solidity/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ docs
flattened/
buildArtifact.json
fixtures/
# ZKSync
artifacts-zk
cache-zk
core-utils/zksync/artifacts/output
.zksolc-libraries-cache/
typechain-types/
typechain/
17 changes: 17 additions & 0 deletions solidity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# @hyperlane-xyz/core

## 5.10.0

### Minor Changes

- db8c09011: Add ZKSync support and restructure build artifacts:

- Add ZKSync compilation support
- Restructure typechain directory location to core-utils/typechain
- Add ZKSync-specific artifact generation and exports
- Update build process to handle both standard and ZKSync artifacts
- Add new exports for ZKSync build artifacts and contract types

### Patch Changes

- 11cf66c5e: Export empty zksync buildArtifact to satisfy package.json exports
- @hyperlane-xyz/utils@8.3.0

## 5.9.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/PackageVersioned.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pragma solidity >=0.6.11;
**/
abstract contract PackageVersioned {
// GENERATED CODE - DO NOT EDIT
string public constant PACKAGE_VERSION = "5.9.2";
string public constant PACKAGE_VERSION = "5.10.0";
}
2 changes: 1 addition & 1 deletion solidity/contracts/token/HypERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract HypERC20 is ERC20Upgradeable, TokenRouter {
_MailboxClient_initialize(_hook, _interchainSecurityModule, _owner);
}

function decimals() public view override returns (uint8) {
function decimals() public view virtual override returns (uint8) {
return _decimals;
}

Expand Down
2 changes: 2 additions & 0 deletions solidity/core-utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './typechain/index.js';
export * from './zksync/index.js';
1 change: 1 addition & 0 deletions solidity/core-utils/zksync/buildArtifact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const buildArtifact: any = {};
103 changes: 103 additions & 0 deletions solidity/core-utils/zksync/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { promises as fsPromises } from 'fs';
import path, { join } from 'path';
import { fileURLToPath } from 'url';

/**
* @dev Represents a ZkSync artifact.
*/
export type ZKSyncArtifact = {
contractName: string;
sourceName: string;
abi: any;
bytecode: string;
deployedBytecode: string;
factoryDeps?: Record<string, string>;
};

/**
* @dev A mapping of artifact names to their corresponding ZkSync artifacts.
*/
export type ArtifactMap = {
[key: string]: ZKSyncArtifact;
};

// Get the resolved path to the current file
const currentFilePath = fileURLToPath(import.meta.url);
const currentDirectory = path.dirname(currentFilePath);

/**
* @dev Reads artifact files from the specified directory.
* @param directory The directory to read artifact files from.
* @return An array of artifact file names that end with '.json'.
*/
async function getArtifactFiles(directory: string): Promise<string[]> {
return fsPromises
.readdir(directory)
.then((files) => files.filter((file) => file.endsWith('.json')));
}

/**
* @dev Exports the list of artifact names without the .json extension.
* @return An array of artifact names without the .json extension.
*/
export async function getZKSyncArtifactNames(): Promise<string[]> {
return getArtifactFiles(join(currentDirectory, 'artifacts')).then((files) =>
files.map((file) => file.replace('.json', '')),
);
}

/**
* @dev Checks if a ZkSync artifact exists by its name.
* @param name The name of the artifact to check.
* @return True if the artifact exists, false otherwise.
*/
export async function artifactExists(name: string): Promise<boolean> {
const artifactNames = await getZKSyncArtifactNames();
return artifactNames.includes(name);
}

/**
* @dev Loads a ZkSync artifact by its name.
* @param name The name of the artifact to load.
* @return The loaded ZKSyncArtifact or undefined if it cannot be loaded.
*/
export async function loadZKSyncArtifact(
name: string,
): Promise<ZKSyncArtifact | undefined> {
try {
const artifactPath = join(currentDirectory, 'artifacts', `${name}.json`);
const artifactContent = await fsPromises.readFile(artifactPath, 'utf-8');
return JSON.parse(artifactContent);
} catch (error) {
console.error(`Error loading artifact: ${name}`, error);
return undefined;
}
}

/**
* @dev Loads all ZkSync artifacts into a map.
* @return A map of artifact names to their corresponding ZkSync artifacts.
*/
export async function loadAllZKSyncArtifacts(): Promise<ArtifactMap> {
const zkSyncArtifactMap: ArtifactMap = {};
const zksyncArtifactNames = await getZKSyncArtifactNames();
for (const artifactName of zksyncArtifactNames) {
const artifact = await loadZKSyncArtifact(artifactName);
if (artifact) {
zkSyncArtifactMap[artifactName] = artifact;
}
}

return zkSyncArtifactMap;
}

/**
* @dev Retrieves a specific ZkSync artifact by its file name.
* @param name The name of the artifact to retrieve.
* @return The loaded ZkSyncArtifact or undefined if it cannot be loaded.
*/
export async function getZKSyncArtifactByName(
name: string,
): Promise<ZKSyncArtifact | undefined> {
return loadZKSyncArtifact(name);
}
Loading

0 comments on commit cdba5a2

Please sign in to comment.