From 6bb3ae075c35f968a5b1bd62d580ded94350fba9 Mon Sep 17 00:00:00 2001 From: benluelo Date: Thu, 30 Jan 2025 19:45:17 +0000 Subject: [PATCH 1/3] feat(voyager): preliminary 0g support and a bit of cleanup --- .../modules/consensus/cometbls/src/main.rs | 3 -- .../modules/consensus/tendermint/src/main.rs | 3 -- .../plugins/transaction/ethereum/Cargo.toml | 2 +- .../plugins/transaction/ethereum/src/main.rs | 35 ++++++++++++++----- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/voyager/modules/consensus/cometbls/src/main.rs b/voyager/modules/consensus/cometbls/src/main.rs index f39c40a130..f1bc241ac8 100644 --- a/voyager/modules/consensus/cometbls/src/main.rs +++ b/voyager/modules/consensus/cometbls/src/main.rs @@ -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, } @@ -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>, } @@ -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()) diff --git a/voyager/modules/consensus/tendermint/src/main.rs b/voyager/modules/consensus/tendermint/src/main.rs index 6bd21b33f1..b77025dc42 100644 --- a/voyager/modules/consensus/tendermint/src/main.rs +++ b/voyager/modules/consensus/tendermint/src/main.rs @@ -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 { @@ -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, }) } } diff --git a/voyager/plugins/transaction/ethereum/Cargo.toml b/voyager/plugins/transaction/ethereum/Cargo.toml index 125f54864a..e76b5ea50b 100644 --- a/voyager/plugins/transaction/ethereum/Cargo.toml +++ b/voyager/plugins/transaction/ethereum/Cargo.toml @@ -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"] } diff --git a/voyager/plugins/transaction/ethereum/src/main.rs b/voyager/plugins/transaction/ethereum/src/main.rs index dbb00dd72a..748209e43c 100644 --- a/voyager/plugins/transaction/ethereum/src/main.rs +++ b/voyager/plugins/transaction/ethereum/src/main.rs @@ -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}, @@ -58,11 +58,14 @@ pub struct Module { pub ibc_handler_address: H160, pub multicall_address: H160, - pub provider: RootProvider, + pub provider: RootProvider, pub keyring: ConcurrentKeyring>, pub max_gas_price: Option, + + pub fixed_gas_price: Option, + pub legacy: bool, } @@ -83,6 +86,10 @@ pub struct Config { #[serde(default)] pub max_gas_price: Option, + /// Temporary fix for 0g until they fix their eth_feeHistory endpoint + #[serde(default)] + pub fixed_gas_price: Option, + #[serde(default)] pub legacy: bool, } @@ -95,7 +102,10 @@ impl Plugin for Module { type Cmd = DefaultCmd; async fn new(config: Self::Config) -> Result { - let provider = ProviderBuilder::new().on_builtin(&config.rpc_url).await?; + let provider = ProviderBuilder::new() + .network::() + .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()); @@ -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, }) } @@ -276,6 +287,7 @@ impl Module { ibc_messages: Vec, ) -> Result<(), TxSubmitError> { let signer = ProviderBuilder::new() + .network::() .with_recommended_fillers() // .filler(::default()) // .filler(ChainIdFiller::default()) @@ -313,12 +325,12 @@ impl Module { .map(|x| (x.0.clone(), x.0.name())) .collect::>(); - 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(), ); @@ -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 = ::from(*ok.tx_hash()); @@ -347,6 +363,7 @@ impl Module { let result = MulticallResult::decode_log_data( receipt + .inner .inner .logs() .last() @@ -430,11 +447,11 @@ impl Module { } #[allow(clippy::type_complexity)] -fn process_msgs>( - ibc_handler: &ibc_solidity::Ibc::IbcInstance, +fn process_msgs>( + ibc_handler: &ibc_solidity::Ibc::IbcInstance, msgs: Vec, relayer: H160, -) -> RpcResult)>> { +) -> RpcResult)>> { trace!(?msgs); msgs.clone() From 0f1a6733f8a8e97de7e7486d1cec0911addf0565 Mon Sep 17 00:00:00 2001 From: benluelo Date: Thu, 30 Jan 2025 19:45:50 +0000 Subject: [PATCH 2/3] feat(evm): add 0g testnet to deployable chains --- evm/evm.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/evm/evm.nix b/evm/evm.nix index c62faaad57..b828482977 100644 --- a/evm/evm.nix +++ b/evm/evm.nix @@ -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"; @@ -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" From a59e06f3425fc8349ac2c3bd38cf983dbd8e8297 Mon Sep 17 00:00:00 2001 From: benluelo Date: Thu, 30 Jan 2025 19:46:15 +0000 Subject: [PATCH 3/3] feat(deployments): add 0g deployment info --- docs/src/content/docs/protocol/deployments.mdx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/src/content/docs/protocol/deployments.mdx b/docs/src/content/docs/protocol/deployments.mdx index bd5ca16292..5612da113f 100644 --- a/docs/src/content/docs/protocol/deployments.mdx +++ b/docs/src/content/docs/protocol/deployments.mdx @@ -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).