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

0g and some other stuff #3659

Merged
merged 3 commits into from
Jan 30, 2025
Merged
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
16 changes: 16 additions & 0 deletions docs/src/content/docs/protocol/deployments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ Deployments of `ibc-union` on EVM chains. Solidity contract sources can be found
| | Sender | [`0x153919669Edc8A5D0c8D1E4507c9CE60435A1177`](https://sepolia.etherscan.io/address/0x153919669Edc8A5D0c8D1E4507c9CE60435A1177) |
| | Multicall | [`0x6FD4bf9438fAC8C535218E79191594A879E47E96`](https://sepolia.etherscan.io/address/0x6FD4bf9438fAC8C535218E79191594A879E47E96) |

### 0g Newton (`16600`)

| Category | Name | Address |
|--------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| **core** | IBCHandler | [`0x70719A4ca2d463806863b6A86281c93b8854dDC2`](https://chainscan-newton.0g.ai/address/0x70719A4ca2d463806863b6A86281c93b8854dDC2) |
| **light-clients** | CometblsClient | [`0xA660d4D5Cbe2139f06fB0a65a62a707EB1902B0E`](https://chainscan-newton.0g.ai/address/0xA660d4D5Cbe2139f06fB0a65a62a707EB1902B0E) |
| | StateLensIcs23MptClient | [`0xE9455fA4D422D590Bb7B6CDdDaC610C47764A7E4`](https://chainscan-newton.0g.ai/address/0xE9455fA4D422D590Bb7B6CDdDaC610C47764A7E4) |
| | StateLensIcs23Ics23Client | [`0x45DE9536b822CA21B2166d0AC233c8AAC5937766`](https://chainscan-newton.0g.ai/address/0x45DE9536b822CA21B2166d0AC233c8AAC5937766) |
| **apps** | UCS00 | [`0x8eB3c61FC2ea5084B014Aa8C21578875a0b72706`](https://chainscan-newton.0g.ai/address/0x8eB3c61FC2ea5084B014Aa8C21578875a0b72706) |
| | UCS01 | [`0xCD08F1538B76917143C64b0D6d6ecBBc92942a6a`](https://chainscan-newton.0g.ai/address/0xCD08F1538B76917143C64b0D6d6ecBBc92942a6a) |
| | UCS02 | [`0xb1510Ec1Af7D176799F7506137E7be95B39F140D`](https://chainscan-newton.0g.ai/address/0xb1510Ec1Af7D176799F7506137E7be95B39F140D) |
| | UCS03 | [`0x84F074C15513F15baeA0fbEd3ec42F0Bd1fb3efa`](https://chainscan-newton.0g.ai/address/0x84F074C15513F15baeA0fbEd3ec42F0Bd1fb3efa) |
| **support** | Deployer | [`0x7311D39eF22267E463Bd8Ff65df42B0896856274`](https://chainscan-newton.0g.ai/address/0x7311D39eF22267E463Bd8Ff65df42B0896856274) |
| | Sender | [`0x153919669Edc8A5D0c8D1E4507c9CE60435A1177`](https://chainscan-newton.0g.ai/address/0x153919669Edc8A5D0c8D1E4507c9CE60435A1177) |
| | Multicall | [`0x4DAB0EF2051932FEeBF4E2f6D73635dFD096099A`](https://chainscan-newton.0g.ai/address/0x4DAB0EF2051932FEeBF4E2f6D73635dFD096099A) |

## CosmWasm

Deployments of `ibc-union` on CosmWasm (cosmos) chains. CosmWasm contract sources can be found [here](https://github.com/unionlabs/union/tree/main/cosmwasm/ibc-union).
Expand Down
9 changes: 8 additions & 1 deletion evm/evm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ _: {
private-key = ''"$1"'';
extra-args = ''--verify --verifier etherscan --etherscan-api-key "$2"'';
}
{
network = "0g-testnet";
rpc-url = "https://evmrpc-testnet.0g.ai";
private-key = ''"$1"'';
extra-args = " --legacy --batch-size=1";
# extra-args = ''--verify --verifier etherscan --etherscan-api-key "$2"'';
}
{
network = "scroll-testnet";
rpc-url = "https://sepolia-rpc.scroll.io";
Expand Down Expand Up @@ -375,7 +382,7 @@ _: {
forge script scripts/Deploy.s.sol:Deploy${kind} \
-vvvv \
--rpc-url "${rpc-url}" \
--broadcast
--broadcast ${extra-args}

popd
rm -rf "$OUT"
Expand Down
3 changes: 0 additions & 3 deletions voyager/modules/consensus/cometbls/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pub struct Module {

pub cometbft_client: cometbft_rpc::Client,
pub chain_revision: u64,
pub grpc_url: String,

pub ibc_host_contract_address: H256,
}
Expand All @@ -37,7 +36,6 @@ pub struct Module {
#[serde(deny_unknown_fields)]
pub struct Config {
pub rpc_url: String,
pub grpc_url: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ibc_host_contract_address: Option<Bech32<H256>>,
}
Expand Down Expand Up @@ -70,7 +68,6 @@ impl ConsensusModule for Module {
cometbft_client: tm_client,
chain_id: ChainId::new(chain_id),
chain_revision,
grpc_url: config.grpc_url,
ibc_host_contract_address: config
.ibc_host_contract_address
.map(|a| *a.data())
Expand Down
3 changes: 0 additions & 3 deletions voyager/modules/consensus/tendermint/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ pub struct Module {

pub cometbft_client: cometbft_rpc::Client,
pub chain_revision: u64,
pub grpc_url: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Config {
pub rpc_url: String,
pub grpc_url: String,
}

impl ConsensusModule for Module {
Expand Down Expand Up @@ -65,7 +63,6 @@ impl ConsensusModule for Module {
cometbft_client: tm_client,
chain_id: ChainId::new(chain_id),
chain_revision,
grpc_url: config.grpc_url,
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion voyager/plugins/transaction/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bip32 = { workspace = true }
chain-utils = { workspace = true }
enumorph = { workspace = true }
ibc-solidity = { workspace = true, features = ["rpc"] }
ibc-union-spec = { workspace = true, features = ["ethabi", "ibc-solidity-compat"] }
ibc-union-spec = { workspace = true, features = ["serde", "ethabi", "ibc-solidity-compat"] }
jsonrpsee = { workspace = true, features = ["macros", "server", "tracing"] }
macros = { workspace = true }
serde = { workspace = true, features = ["derive"] }
Expand Down
35 changes: 26 additions & 9 deletions voyager/plugins/transaction/ethereum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::VecDeque;

use alloy::{
contract::{Error, RawCallBuilder},
network::EthereumWallet,
network::{AnyNetwork, EthereumWallet},
providers::{PendingTransactionError, Provider, ProviderBuilder, RootProvider},
signers::local::LocalSigner,
sol_types::{SolEvent, SolInterface},
Expand Down Expand Up @@ -58,11 +58,14 @@ pub struct Module {
pub ibc_handler_address: H160,
pub multicall_address: H160,

pub provider: RootProvider<BoxTransport>,
pub provider: RootProvider<BoxTransport, AnyNetwork>,

pub keyring: ConcurrentKeyring<alloy::primitives::Address, LocalSigner<SigningKey>>,

pub max_gas_price: Option<u128>,

pub fixed_gas_price: Option<u128>,

pub legacy: bool,
}

Expand All @@ -83,6 +86,10 @@ pub struct Config {
#[serde(default)]
pub max_gas_price: Option<u128>,

/// Temporary fix for 0g until they fix their eth_feeHistory endpoint
#[serde(default)]
pub fixed_gas_price: Option<u128>,

#[serde(default)]
pub legacy: bool,
}
Expand All @@ -95,7 +102,10 @@ impl Plugin for Module {
type Cmd = DefaultCmd;

async fn new(config: Self::Config) -> Result<Self, BoxDynError> {
let provider = ProviderBuilder::new().on_builtin(&config.rpc_url).await?;
let provider = ProviderBuilder::new()
.network::<AnyNetwork>()
.on_builtin(&config.rpc_url)
.await?;

let raw_chain_id = provider.get_chain_id().await?;
let chain_id = ChainId::new(raw_chain_id.to_string());
Expand Down Expand Up @@ -131,6 +141,7 @@ impl Plugin for Module {
}),
),
max_gas_price: config.max_gas_price,
fixed_gas_price: config.fixed_gas_price,
legacy: config.legacy,
})
}
Expand Down Expand Up @@ -276,6 +287,7 @@ impl Module {
ibc_messages: Vec<Datagram>,
) -> Result<(), TxSubmitError> {
let signer = ProviderBuilder::new()
.network::<AnyNetwork>()
.with_recommended_fillers()
// .filler(<NonceFiller>::default())
// .filler(ChainIdFiller::default())
Expand Down Expand Up @@ -313,12 +325,12 @@ impl Module {
.map(|x| (x.0.clone(), x.0.name()))
.collect::<Vec<_>>();

let call = multicall.multicall(
let mut call = multicall.multicall(
msgs.into_iter()
.map(|(_, x)| Call3 {
.map(|(_, call)| Call3 {
target: self.ibc_handler_address.into(),
allowFailure: true,
callData: x.calldata().clone(),
callData: call.calldata().clone(),
})
.collect(),
);
Expand All @@ -337,6 +349,10 @@ impl Module {

info!(gas_estimate, gas_to_use, "gas estimatation successful");

if let Some(fixed_gas_price) = self.fixed_gas_price {
call = call.gas_price(fixed_gas_price);
}

match call.gas(gas_to_use).send().await {
Ok(ok) => {
let tx_hash = <H256>::from(*ok.tx_hash());
Expand All @@ -347,6 +363,7 @@ impl Module {

let result = MulticallResult::decode_log_data(
receipt
.inner
.inner
.logs()
.last()
Expand Down Expand Up @@ -430,11 +447,11 @@ impl Module {
}

#[allow(clippy::type_complexity)]
fn process_msgs<T: Transport + Clone, P: Provider<T>>(
ibc_handler: &ibc_solidity::Ibc::IbcInstance<T, P>,
fn process_msgs<T: Transport + Clone, P: Provider<T, AnyNetwork>>(
ibc_handler: &ibc_solidity::Ibc::IbcInstance<T, P, AnyNetwork>,
msgs: Vec<Datagram>,
relayer: H160,
) -> RpcResult<Vec<(Datagram, RawCallBuilder<T, &P>)>> {
) -> RpcResult<Vec<(Datagram, RawCallBuilder<T, &P, AnyNetwork>)>> {
trace!(?msgs);

msgs.clone()
Expand Down