Skip to content

Migrate native bridge from ethers to alloy#24575

Merged
dlukegordon merged 7 commits intomainfrom
lukegordon/br-191-migrate-from-ethers-to-alloy
Jan 7, 2026
Merged

Migrate native bridge from ethers to alloy#24575
dlukegordon merged 7 commits intomainfrom
lukegordon/br-191-migrate-from-ethers-to-alloy

Conversation

@dlukegordon
Copy link
Copy Markdown
Contributor

@dlukegordon dlukegordon commented Dec 10, 2025

Description

Migrated all use of the ethers rust library to alloy.

Linear issue.

Helpful documentation: https://alloy.rs/migrating-from-ethers/reference/

Test plan

Ran tests with cargo test locally as well as CI tests.

We may need to do more extensive testing, will consult with Bridger and Brandon.

@dlukegordon dlukegordon marked this pull request as draft December 10, 2025 01:59
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 10, 2025 01:59 — with GitHub Actions Inactive
@vercel
Copy link
Copy Markdown

vercel bot commented Dec 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
sui-docs Ready Ready Preview, Comment Jan 7, 2026 9:31pm
2 Skipped Deployments
Project Deployment Review Updated (UTC)
multisig-toolkit Ignored Ignored Preview Jan 7, 2026 9:31pm
sui-kiosk Ignored Ignored Preview Jan 7, 2026 9:31pm

@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 3943e33 to 1cb2053 Compare December 10, 2025 02:04
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 10, 2025 02:04 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 1cb2053 to e5616e6 Compare December 10, 2025 17:49
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 10, 2025 17:49 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from e5616e6 to 05dd692 Compare December 10, 2025 21:45
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 10, 2025 21:45 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 05dd692 to 0555986 Compare December 11, 2025 00:27
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 11, 2025 00:27 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 0555986 to 1845423 Compare December 11, 2025 01:22
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 11, 2025 01:22 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 1845423 to 2fe67c5 Compare December 11, 2025 02:14
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 11, 2025 02:14 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 2fe67c5 to 0f0fc5a Compare December 11, 2025 17:21
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 11, 2025 17:21 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 0f0fc5a to abd25d5 Compare December 11, 2025 21:39
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 11, 2025 21:39 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from abd25d5 to 77b569e Compare December 11, 2025 22:05
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 11, 2025 22:05 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 7891162 to 3c480fd Compare December 12, 2025 08:48
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 12, 2025 08:48 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 3c480fd to b7cb31a Compare December 12, 2025 22:27
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 12, 2025 22:27 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from b7cb31a to 80c2467 Compare December 12, 2025 22:27
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 12, 2025 22:27 — with GitHub Actions Inactive
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 12, 2025 23:56 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from a532d55 to 43ae3c9 Compare December 13, 2025 00:12
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 13, 2025 00:12 — with GitHub Actions Inactive
@dlukegordon dlukegordon force-pushed the lukegordon/br-191-migrate-from-ethers-to-alloy branch from 43ae3c9 to 52232f1 Compare December 14, 2025 19:53
@dlukegordon dlukegordon temporarily deployed to sui-typescript-aws-kms-test-env December 14, 2025 19:53 — with GitHub Actions Inactive
#[derive(DBMapUtils)]
pub struct BridgeOrchestratorTables {
/// pending BridgeActions that orchestrator received but not yet executed
pub(crate) pending_actions: DBMap<BridgeActionDigest, BridgeAction>,
/// module identifier to the last processed EventID
pub(crate) sui_syncer_cursors: DBMap<Identifier, EventID>,
/// contract address to the last processed block
pub(crate) eth_syncer_cursors: DBMap<ethers::types::Address, u64>,
pub(crate) eth_syncer_cursors: DBMap<alloy::primitives::Address, u64>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This may cause an issue, can you double check that ethers::types::Address and alloy::primitives::Address have an identical serialized format? Since this is a key, specifically with the bincode serialization format.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this test to check

    #[tokio::test]
    async fn test_address_serialization() {
        let alloy_address =
            alloy::primitives::Address::from_str("0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1")
                .unwrap();
        let ethers_address =
            ethers::types::Address::from_str("0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1").unwrap();
        let alloy_serialized = bincode::serialize(&alloy_address).unwrap();
        let ethers_serialized = bincode::serialize(&ethers_address).unwrap();
        assert_eq!(alloy_serialized, ethers_serialized);
    }

Unfortunately they do not match

assertion `left == right` failed
  left: [20, 0, 0, 0, 0, 0, 0, 0, 144, 248, 191, 106, 71, 159, 50, 14, 173, 7, 68, 17, 164, 176, 231, 148, 78, 168, 201, 193]
 right: [42, 0, 0, 0, 0, 0, 0, 0, 48, 120, 57, 48, 102, 56, 98, 102, 54, 97, 52, 55, 57, 102, 51, 50, 48, 101, 97, 100, 48, 55, 52, 52, 49, 49, 97, 52, 98, 48, 101, 55, 57, 52, 52, 101, 97, 56, 99, 57, 99, 49]

It looks like alloy serializes the address as 20 bytes (the raw address bytes) and ethers serializes the address as 42 bytes (the hex string representation starting with "0x").

I could potentially write a wrapper struct with custom serialization to preserve backwards compatibility. How does that sound?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yep that is exactly what would be needed here, until we decided we want to do a db migration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Copy link
Copy Markdown
Contributor

@bmwill bmwill left a comment

Choose a reason for hiding this comment

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

Approving so that we can get this landed.

@Bridgerz next week (post 1.63 release) lets roll this out to one of mysten's nodes to see if it behaves well or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants