Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linea_chain_integration #273

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
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
18 changes: 14 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
components: rustfmt, clippy

- name: Install dprint
run: cargo install --locked dprint
run: cargo install dprint --locked --version 0.47.1

- name: Dprint check
run: dprint check
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
needs: [rustfmt]
strategy:
matrix:
crate: [rosetta-server-astar, rosetta-server-ethereum, rosetta-server-polkadot, rosetta-client, rosetta-testing-arbitrum, rosetta-testing-binance, rosetta-testing-avalanche, rosetta-testing-base,]
crate: [rosetta-server-astar, rosetta-server-ethereum, rosetta-server-polkadot, rosetta-client, rosetta-testing-arbitrum, rosetta-testing-binance, rosetta-testing-avalanche, rosetta-testing-base, rosetta-testing-linea, ]
name: ${{ matrix.crate }}
runs-on: self-hosted
steps:
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
if: ${{matrix.crate == 'rosetta-testing-avalanche'}}
run: |
docker pull analoglabs/avalanche-cli
docker run -v MY_LOCAL_CLI_DIR:/root/.avalanche-cli/ analoglabs/avalanche-cli blockchain create localnew --evm --evm-token SUB --genesis ./genesis.json --teleporter=false --vm-version v0.6.9
docker run -v MY_LOCAL_CLI_DIR:/root/.avalanche-cli/ analoglabs/avalanche-cli blockchain create localnew --evm --evm-token SUB --genesis ./genesis.json --teleporter=false --vm-version v0.6.9 | echo "Yes"
docker run -d -v MY_LOCAL_CLI_DIR:/root/.avalanche-cli/ -p 9650:9650 --entrypoint bash analoglabs/avalanche-cli -c "/avalanche blockchain deploy localnew --local;tail -f /dev/null"

- name: Setup BSC node
Expand All @@ -127,6 +127,14 @@ jobs:
docker pull manojanalog/bsc_for_analog
docker run -d -p 8545:8545 -p 8546:8546 manojanalog/bsc_for_analog:latest geth --datadir ./datadir --unlock 0x5e5C830f97292a3C6Bfea464D3ad4CE631e6Fbc5 --allow-insecure-unlock --http --http.addr 0.0.0.0 --http.port 8545 --http.api personal,db,eth,net,web3 --mine --miner.etherbase 0x5e5C830f97292a3C6Bfea464D3ad4CE631e6Fbc5 --ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.api personal,db,eth,net,web3 --rpc.allow-unprotected-txs --password password.txt

- name: Setup Linea-monorepo node
if: ${{ matrix.crate == 'rosetta-testing-linea' }}
run: |
git clone https://github.com/Consensys/linea-monorepo.git
cd linea-monorepo
make pnpm-install
make fresh-start-all

- name: test (${{ matrix.crate }})
run: cargo test --locked -p ${{ matrix.crate }}

Expand Down Expand Up @@ -161,6 +169,7 @@ jobs:
--exclude rosetta-server-astar \
--exclude rosetta-testing-avalanche \
--exclude rosetta-testing-binance \
--exclude rosetta-testing-linea \
--exclude rosetta-server-ethereum \
--exclude rosetta-testing-base \
--exclude rosetta-server-polkadot \
Expand Down Expand Up @@ -189,6 +198,7 @@ jobs:
--exclude rosetta-server-astar \
--exclude rosetta-testing-avalanche \
--exclude rosetta-testing-binance \
--exclude rosetta-testing-linea \
--exclude rosetta-server-ethereum \
--exclude rosetta-testing-base \
--exclude rosetta-server-polkadot \
Expand Down
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ members = [
"chains/avalanche",
"chains/rosetta-chain-testing",
"chains/base",
"chains/linea",
]
resolver = "2"

Expand Down
20 changes: 20 additions & 0 deletions chains/ethereum/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,21 @@ pub fn base_config(network: &str) -> anyhow::Result<BlockchainConfig> {
Ok(evm_config("avalanche", network, "AVAX", bip44_id, is_dev))
}

/// Retrieve the [`BlockchainConfig`] from the provided base `network`
///
/// # Errors
/// Returns `Err` if the network is not supported
pub fn linea_config(network: &str) -> anyhow::Result<BlockchainConfig> {
// All available networks are listed here:
let (network, bip44_id, is_dev) = match network {
"dev" => ("dev", 1, true),
"sepolia" => ("sepolia", 59141, true),
"mainnet" => ("mainnet", 59144, false),
_ => anyhow::bail!("unsupported network: {}", network),
};
Ok(evm_config("linea", network, "ETH", bip44_id, is_dev))
}

/// Retrieve the [`BlockchainConfig`] from the provided ethereum `network`
///
/// # Errors
Expand Down Expand Up @@ -320,6 +335,11 @@ pub fn config(network: &str) -> anyhow::Result<BlockchainConfig> {
"base" => return base_config("mainnet"),
"base-sepolia" => return base_config("fuji"),

// Base
"linea-local" => return linea_config("dev"),
"linea" => return linea_config("mainnet"),
"linea-sepolia" => return linea_config("basu"),

network => return astar_config(network),
};

Expand Down
1 change: 1 addition & 0 deletions chains/ethereum/server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl MaybeWsEthereumClient {
"binance" => rosetta_config_ethereum::binance_config(network)?,
"avalanche" => rosetta_config_ethereum::avalanche_config(network)?,
"base" => rosetta_config_ethereum::base_config(network)?,
"linea" => rosetta_config_ethereum::linea_config(network)?,
blockchain => anyhow::bail!("unsupported blockchain: {blockchain}"),
};
Self::from_config(config, addr, private_key).await
Expand Down
21 changes: 21 additions & 0 deletions chains/linea/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "rosetta-testing-linea"
version = "0.1.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/analog-labs/chain-connectors"
description = "linea rosetta test."

[dependencies]
alloy-sol-types = { version = "0.8" }
anyhow = "1.0"
ethers = { version = "2.0", default-features = true, features = ["abigen", "rustls", "ws"] }
ethers-solc = "2.0"
hex-literal = "0.4"
rosetta-chain-testing = { path = "../rosetta-chain-testing" }
rosetta-client.workspace = true
rosetta-config-ethereum.workspace = true
rosetta-core.workspace = true
rosetta-server-ethereum.workspace = true
sha3 = "0.10"
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
Loading
Loading