Skip to content

Commit

Permalink
Voyager v2 (#2661)
Browse files Browse the repository at this point in the history
# Plugins and Modules

## Changes

- unique errors for connection and client state verification in
ibc-solidity connection handshake verification
- more attributes on generated prost types for `cometbft-rpc`
- more canonical types in `unionlabs` for generated prost types
- the great untyping:
- `beacon-api-client` is now fully generic over chain spec and does not
take a generic for chain spec
- `unionlabs::ics24::Path` is no longer generic, using only concrete
types
- `unionlabs::ics24::IbcPath` is no longer generic, using only concrete
types
- IbcPath::Value for client and consensus state paths are now just
opaque bytes
- `unionlabs::event::IbcEvent` is no longer generic, using only concrete
types
- all of the IBC `Msg*` are no longer generic, using only concrete types
- added `Unbounded*` versions of all of the types in
`unionlabs::ethereum::beacon` that are generic over ChainSpec, for use
in `beacon-api-client`
    - open to better naming here
- `unionlabs::QueryHeight` is no longer generic, using only the concrete
type `Height`
- removed a bunch of old commented out code
- queue_msg:
- removed `OpEvent`/`QueueMessage::Event` (no longer useful with the new
architecture)
- added new `RawAny` type, since some cosmos types use a dynamic list of
`Any` values and as such they must be type-erased
- cleaned up `unionlabs::ethereum::beacon` to follow the structure of
the rest of the crate (one module/file per type)
- `#[model]` now derives `Eq`
- a lot of other stuff I'm too lazy to write out

## Closes

- #1813 (no longer relevant)

## Non-code refactors

- normalize comments in rust code (mostly affected generated code)

---

`chain-utils` is a bit of a mess right now, this crate will be
drastically refactored in the coming weeks. i recommend just kinda not
looking at it too hard
  • Loading branch information
benluelo authored Sep 17, 2024
2 parents 3095592 + 61b5224 commit 0ddbf5a
Show file tree
Hide file tree
Showing 363 changed files with 29,548 additions and 28,028 deletions.
9,511 changes: 5,490 additions & 4,021 deletions Cargo.lock

Large diffs are not rendered by default.

122 changes: 75 additions & 47 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ members = [

"hubble",

"lib/aptos-rpc",
"lib/beacon-api",
"lib/block-message",
"lib/chain-utils",
"lib/cometbft-rpc",

"lib/chain-utils",
"lib/gnark-key-parser",
"lib/gnark-mimc",
"lib/ibc-vm-rs",
Expand All @@ -32,7 +33,6 @@ members = [
"lib/poseidon-rs",
"lib/queue-msg",
"lib/queue-msg-macro",
"lib/relay-message",
"lib/scroll-api",
"lib/scroll-codec",
"lib/scroll-rpc",
Expand All @@ -41,13 +41,13 @@ members = [
"lib/ssz/tests-generator",
"lib/ssz-derive",
"lib/unionlabs",
"lib/voyager-message",
"lib/zktrie-rs",
"lib/voyager-message",

"lib/near/near-ibc",
"lib/near/near-light-client",
"lib/near/dummy-ibc-app",
"lib/near/near-ibc-tests",
# "lib/near/near-ibc-tests",

"lib/arbitrum-verifier",
"lib/cometbls-groth16-verifier",
Expand All @@ -68,14 +68,35 @@ members = [
"tools/devnet-utils",
"tools/parse-wasm-client-type",
"tools/tidy",
"tools/move-bindgen",
"lib/move-bindgen-derive",

"ucli",
"unionvisor",

"voyager",
"voyager/modules/chain/cosmos-sdk",
"voyager/modules/chain/ethereum",
"voyager/modules/chain/movement",

"voyager/modules/client/cometbls",
"voyager/modules/client/ethereum",

"voyager/modules/consensus/cometbls",
"voyager/modules/consensus/ethereum",

"voyager/modules/transaction/cosmos-sdk",
"voyager/modules/transaction/ethereum",
"voyager/modules/transaction/aptos",

"voyager/plugins/packet-filter",
"voyager/plugins/transaction-batch",

"drip",
"light-clients/movement/ics08-movement",
"lib/aptos-verifier",

"lib/reconnecting-jsonrpc-ws-client",
]

[workspace.package]
Expand All @@ -91,45 +112,45 @@ lto = "thin"
opt-level = 3

[workspace.dependencies]
aptos-verifier = { path = "lib/aptos-verifier", default-features = false }
arbitrum-verifier = { path = "lib/arbitrum-verifier", default-features = false }
beacon-api = { path = "lib/beacon-api", default-features = false }
block-message = { path = "lib/block-message", default-features = false }
chain-utils = { path = "lib/chain-utils", default-features = false }
cometbft-rpc = { path = "lib/cometbft-rpc", default-features = false }
cometbls-groth16-verifier = { path = "lib/cometbls-groth16-verifier", default-features = false }
contracts = { path = "generated/rust/contracts", default-features = false }
ethereum-light-client = { path = "light-clients/ethereum-light-client", default-features = false }
ethereum-verifier = { path = "lib/ethereum-verifier", default-features = false }
evm-in-cosmos-light-client = { path = "light-clients/evm-in-cosmos-light-client", default-features = false }
gnark-key-parser = { path = "lib/gnark-key-parser", default-features = false }
gnark-mimc = { path = "lib/gnark-mimc", default-features = false }
ibc-vm-rs = { path = "lib/ibc-vm-rs", default-features = false }
ics008-wasm-client = { path = "lib/ics-008-wasm-client", default-features = false }
ics23 = { path = "lib/ics23", default-features = false }
linea-verifier = { path = "lib/linea-verifier", default-features = false }
linea-zktrie = { path = "lib/linea-zktrie", default-features = false }
macros = { path = "lib/macros", default-features = false }
pg-queue = { path = "lib/pg-queue", default-features = false }
poseidon-rs = { path = "lib/poseidon-rs", default-features = false }
protos = { path = "generated/rust/protos", default-features = false }
queue-msg = { path = "lib/queue-msg", default-features = false }
queue-msg-macro = { path = "lib/queue-msg-macro", default-features = false }
relay-message = { path = "lib/relay-message", default-features = false }
scroll-api = { path = "lib/scroll-api", default-features = false }
scroll-codec = { path = "lib/scroll-codec", default-features = false }
scroll-rpc = { path = "lib/scroll-rpc", default-features = false }
scroll-verifier = { path = "lib/scroll-verifier", default-features = false }
serde-utils = { path = "lib/serde-utils", default-features = false }
ssz = { path = "lib/ssz", default-features = false }
ssz-derive = { path = "lib/ssz-derive", default-features = false }
tendermint-light-client = { path = "light-clients/tendermint-light-client", default-features = false }
tendermint-verifier = { path = "lib/tendermint-verifier", default-features = false }
token-factory-api = { path = "cosmwasm/token-factory-api", default-features = false }
ucs01-relay-api = { path = "cosmwasm/ucs01-relay-api", default-features = false }
unionlabs = { path = "lib/unionlabs", default-features = false }
voyager-message = { path = "lib/voyager-message", default-features = false }
zktrie = { path = "lib/zktrie-rs", default-features = false }
aptos-verifier = { path = "lib/aptos-verifier", default-features = false }
arbitrum-verifier = { path = "lib/arbitrum-verifier", default-features = false }
beacon-api = { path = "lib/beacon-api", default-features = false }
chain-utils = { path = "lib/chain-utils", default-features = false }
cometbft-rpc = { path = "lib/cometbft-rpc", default-features = false }
cometbls-groth16-verifier = { path = "lib/cometbls-groth16-verifier", default-features = false }
contracts = { path = "generated/rust/contracts", default-features = false }
ethereum-light-client = { path = "light-clients/ethereum-light-client", default-features = false }
ethereum-verifier = { path = "lib/ethereum-verifier", default-features = false }
gnark-key-parser = { path = "lib/gnark-key-parser", default-features = false }
gnark-mimc = { path = "lib/gnark-mimc", default-features = false }
ibc-vm-rs = { path = "lib/ibc-vm-rs", default-features = false }
ics008-wasm-client = { path = "lib/ics-008-wasm-client", default-features = false }
ics23 = { path = "lib/ics23", default-features = false }
linea-verifier = { path = "lib/linea-verifier", default-features = false }
linea-zktrie = { path = "lib/linea-zktrie", default-features = false }
macros = { path = "lib/macros", default-features = false }
move-bindgen = { path = "tools/move-bindgen", default-features = false }
move-bindgen-derive = { path = "lib/move-bindgen-derive", default-features = false }
pg-queue = { path = "lib/pg-queue", default-features = false }
poseidon-rs = { path = "lib/poseidon-rs", default-features = false }
protos = { path = "generated/rust/protos", default-features = false }
queue-msg = { path = "lib/queue-msg", default-features = false }
queue-msg-macro = { path = "lib/queue-msg-macro", default-features = false }
reconnecting-jsonrpc-ws-client = { path = "lib/reconnecting-jsonrpc-ws-client", default-features = false }
scroll-api = { path = "lib/scroll-api", default-features = false }
scroll-codec = { path = "lib/scroll-codec", default-features = false }
scroll-rpc = { path = "lib/scroll-rpc", default-features = false }
scroll-verifier = { path = "lib/scroll-verifier", default-features = false }
serde-utils = { path = "lib/serde-utils", default-features = false }
ssz = { path = "lib/ssz", default-features = false }
ssz-derive = { path = "lib/ssz-derive", default-features = false }
tendermint-light-client = { path = "light-clients/tendermint-light-client", default-features = false }
tendermint-verifier = { path = "lib/tendermint-verifier", default-features = false }
token-factory-api = { path = "cosmwasm/token-factory-api", default-features = false }
ucs01-relay-api = { path = "cosmwasm/ucs01-relay-api", default-features = false }
unionlabs = { path = "lib/unionlabs", default-features = false }
voyager-message = { path = "lib/voyager-message", default-features = false }
zktrie = { path = "lib/zktrie-rs", default-features = false }

# external dependencies
milagro_bls = { git = "https://github.com/Snowfork/milagro_bls", rev = "bc2b5b5e8d48b7e2e1bfaa56dc2d93e13cb32095", default-features = false }
Expand All @@ -143,9 +164,10 @@ ethers-contract-abigen = { git = "https://github.com/unionlabs/ethers-rs", branc
ethers-contract-derive = { git = "https://github.com/unionlabs/ethers-rs", branch = "ethers-core-wasm", default-features = false }
ethers-core = { git = "https://github.com/unionlabs/ethers-rs", branch = "ethers-core-wasm", default-features = false }

near-workspaces = { git = "https://github.com/unionlabs/near-workspaces-rs-union", branch = "near-ibc", default-features = false }

arbitrary = { version = "1.3.0", default-features = false }
# https://github.com/aptos-labs/aptos-core/pull/12636
aptos-crypto = { git = "https://github.com/unionlabs/aptos-core" }
aptos-rest-client = { git = "https://github.com/unionlabs/aptos-core" }
aptos-types = { git = "https://github.com/unionlabs/aptos-core" }
axum = { version = "0.6.20", default-features = false }
base64 = { version = "0.21", default-features = false }
bip32 = { version = "0.5.0", default-features = false }
Expand All @@ -171,7 +193,9 @@ futures = { version = "0.3.28", default-features = false }
go-parse-duration = { version = "0.1.1", default-features = false }
hex = { version = "0.4.3", default-features = false }
hex-literal = { version = "0.4.1", default-features = false }
jsonrpsee = { version = "0.24.2", default-features = false }
lazy_static = { version = "1.4.0", default-features = false }
move-core-types = { git = "https://github.com/unionlabs/aptos-core" }
near-contract-standards = { version = "5.1.0", default-features = false }
near-sdk = { version = "5.1.0", default-features = false }
near-sdk-contract-tools = { version = "3.0.2", default-features = false }
Expand Down Expand Up @@ -205,3 +229,7 @@ typenum = { version = "1.17.0", default-features = false }
[patch."crates-io"]
arbitrary = { git = "https://github.com/unionlabs/arbitrary" }
# parity-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" }

# https://aptos.dev/en/build/sdks/rust-sdk
merlin = { git = "https://github.com/aptos-labs/merlin" }
x25519-dalek = { git = "https://github.com/aptos-labs/x25519-dalek", branch = "zeroize_v1" }
12 changes: 11 additions & 1 deletion cosmwasm/ucs01-relay-api/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,20 @@ mod tests {
#[test]
fn serde_parses_memo() {
// let memo = "\"balls\": \"string\"";
let memo = "{\"forward\": {\"receiver\": \"[eth_addr]\",\"port\": \"[union-eth port]\",\"channel\": \"[union-eth channel]\",\"timeout\": \"1000000\",\"retries\": 0}}";
let memo = r#"{"forward": {"receiver": "[eth_addr]","port": "[union-eth port]","channel": "[union-eth channel]","timeout": "1000000","retries": 0}}"#;

let parsed = serde_json_wasm::from_str::<Memo>(memo).expect("works");

dbg!(parsed);
}

#[test]
fn serde_parses_memo_without_port_as_none() {
// let memo = "\"balls\": \"string\"";
let memo = r#"{"forward":{"channel":"channel-201","receiver":"2C96e52fCE14BAa13868CA8182f8A7903e4e76E0"}}"#;

let parsed = serde_json_wasm::from_str::<Memo>(memo).expect("works");

assert_eq!(parsed, Memo::None {})
}
}
2 changes: 1 addition & 1 deletion cosmwasm/ucs01-relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sha2 = { workspace = true }
thiserror = { workspace = true }
token-factory-api = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, default-features = false, features = ["fmt", "ansi"] }
tracing-subscriber = { workspace = true }
ucs01-relay-api = { workspace = true }
unionlabs = { workspace = true }

Expand Down
6 changes: 3 additions & 3 deletions cosmwasm/ucs01-relay/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ use crate::{
state::{ChannelInfo, PfmRefundPacketKey, CHANNEL_INFO, IN_FLIGHT_PFM_PACKETS},
};

#[cfg(test)]
mod tests;

fn to_response<T>(
IbcReceiveResponse {
acknowledgement,
Expand Down Expand Up @@ -309,6 +312,3 @@ pub fn ibc_packet_timeout(
}),
}
}

#[cfg(test)]
mod tests;
1 change: 1 addition & 0 deletions cosmwasm/ucs01-relay/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,7 @@ impl<'a> TransferProtocol for Ucs01Protocol<'a> {
}

#[cfg(test)]
#[allow(deprecated)] // TODO: Remove usage of mock_info
mod tests {
use cosmwasm_std::{
testing::{message_info, mock_dependencies, mock_env},
Expand Down
10 changes: 5 additions & 5 deletions devnet-compose/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
edition.workspace = true
license-file.workspace = true
name = "devnet-compose"
repository.workspace = true
version = "0.1.0"
edition = { workspace = true }
license-file = { workspace = true }
name = "devnet-compose"
repository = { workspace = true }
version = "0.1.0"

[dependencies]
cliclack = "0.2.5"
Expand Down
13 changes: 13 additions & 0 deletions dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ anypb
anys
appchain
appchains
appetito
appmodule
appparams
aptos
Expand Down Expand Up @@ -306,6 +307,7 @@ bankkeeper
banktypes
bartio
baseapp
batchable
beacond
beacondata
beatae
Expand Down Expand Up @@ -353,6 +355,7 @@ brainer
builtins
bumpp
bunx
buon
byteorder
bytevec
cachix
Expand Down Expand Up @@ -794,6 +797,7 @@ misbehaviour
misbehiavor
mktemp
mmxyqu
moka
mollitia
monitonically
monniker
Expand Down Expand Up @@ -853,6 +857,7 @@ nums
numtide
observablehq
oceanlewis
octas
ofetch
offchain
omit
Expand Down Expand Up @@ -925,6 +930,7 @@ preimages
preprocessors
prerender
prerendered
prettyplease
prevote
prevotes
println
Expand Down Expand Up @@ -984,6 +990,7 @@ redelegating
redelegation
redelegations
reencode
reencoded
reentrancy
reexcute
reexecute
Expand Down Expand Up @@ -1069,6 +1076,7 @@ slurpfile
smallvec
snapshotter
snapshottypes
soketto
solomachine
sonner
spearbit
Expand Down Expand Up @@ -1228,6 +1236,7 @@ unbonded
unbonding
uncompr
uncons
unconstructable
undelegate
undelegations
unergonomic
Expand Down Expand Up @@ -1259,6 +1268,7 @@ unloadable
unmarshal
unmarshalling
unopinionated
unparse
unplugin
unprefixed
unsetting
Expand Down Expand Up @@ -1345,13 +1355,16 @@ xprv
xqxp
xsmfxu
yamlfmt
yoinked
ypyp
yqyp
yzmmzyfhxg
zellij
zerion
zeroize
zerolog
zetachain
zkevm
zkgm
zkps
zktrie
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ We recommend running Voyager on a machine co-located with your chain's RPC nodes
},
"voyager": {
"num_workers": 4,
"laddr": "0.0.0.0:65534",
"laddr": "0.0.0.0:7717",
"queue": {
"type": "pg-queue",
"database_url": "postgres://user:password@127.0.0.1:5432/default",
Expand Down
Loading

0 comments on commit 0ddbf5a

Please sign in to comment.