Skip to content

Commit

Permalink
Merge pull request #308 from SorellaLabs/feat/sdk-connections
Browse files Browse the repository at this point in the history
bump alloy + reth/some sdk related stuff
  • Loading branch information
jnoorchashm37 authored Dec 20, 2024
2 parents bd1ca15 + f56b55e commit ae56afe
Show file tree
Hide file tree
Showing 37 changed files with 2,307 additions and 1,840 deletions.
3,484 changes: 1,861 additions & 1,623 deletions Cargo.lock

Large diffs are not rendered by default.

126 changes: 63 additions & 63 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ futures-util = "0.3.29"
bitmaps = "3.2.1"

# revm
revm = { version = "14.0.3", features = [
revm = { version = "18.0.0", features = [
"std",
"secp256k1",
"optional_balance_check",
Expand All @@ -86,44 +86,44 @@ revm = { version = "14.0.3", features = [


# reth
reth = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-db = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-discv4 = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-db = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-discv4 = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-rlp = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0", features = [
"alloc",
] }
reth-errors = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-node-types = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-codecs = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-ecies = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
#reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-blockchain-tree = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-beacon-consensus = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-metrics = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-network = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-network-api = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-libmdbx = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-eth-wire = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-tokio-util = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-node-types = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-codecs = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-ecies = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
#reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-blockchain-tree = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-beacon-consensus = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-metrics = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-network = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-network-api = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-libmdbx = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-eth-wire = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-tokio-util = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }

# alloy
alloy = { version = "0.4.2", features = [
alloy = { version = "0.7.3", features = [
"rlp",
"full",
# "eip712",
Expand All @@ -141,42 +141,42 @@ alloy = { version = "0.4.2", features = [
"contract",
] }
alloy-chains = "0.1.32"
alloy-primitives = "0.8.7"
alloy-sol-macro = "0.8.0"
alloy-dyn-abi = "0.8.0"
alloy-sol-types = "0.8.0"
alloy-rlp = "0.3.4"
alloy-primitives = "0.8.11"
alloy-sol-macro = "0.8.11"
alloy-dyn-abi = "0.8.11"
alloy-sol-types = "0.8.11"
alloy-rlp = "0.3.10"
alloy-rlp-derive = "0.3.8"
alloy-trie = "0.6"
alloy-rpc-types = { version = "0.4.2", default-features = false, features = [
alloy-trie = "0.7"
alloy-rpc-types = { version = "0.7.3", default-features = false, features = [
"eth",
] }
alloy-rpc-types-anvil = { version = "0.4.2", default-features = false }
alloy-rpc-types-beacon = { version = "0.4.2", default-features = false }
alloy-rpc-types-admin = { version = "0.4.2", default-features = false }
alloy-rpc-types-txpool = { version = "0.4.2", default-features = false }
alloy-serde = { version = "0.4.2", default-features = false }
alloy-rpc-types-engine = { version = "0.4.2", default-features = false }
alloy-rpc-types-eth = { version = "0.4.2", default-features = false }
alloy-genesis = { version = "0.4.2", default-features = false }
alloy-node-bindings = { version = "0.4.2", default-features = false }
alloy-provider = { version = "0.4.2", default-features = false, features = [
alloy-rpc-types-anvil = { version = "0.7.3", default-features = false }
alloy-rpc-types-beacon = { version = "0.7.3", default-features = false }
alloy-rpc-types-admin = { version = "0.7.3", default-features = false }
alloy-rpc-types-txpool = { version = "0.7.3", default-features = false }
alloy-serde = { version = "0.7.3", default-features = false }
alloy-rpc-types-engine = { version = "0.7.3", default-features = false }
alloy-rpc-types-eth = { version = "0.7.3", default-features = false }
alloy-genesis = { version = "0.7.3", default-features = false }
alloy-node-bindings = { version = "0.7.3", default-features = false }
alloy-provider = { version = "0.7.3", default-features = false, features = [
"reqwest",
] }
alloy-eips = { version = "0.4.2", default-features = false }
alloy-signer = { version = "0.4.2", default-features = false }
alloy-signer-local = { version = "0.4.2", default-features = false }
alloy-network = { version = "0.4.2", default-features = false }
alloy-consensus = { version = "0.4.2", default-features = false }
alloy-transport = { version = "0.4.2" }
alloy-transport-http = { version = "0.4.2", features = [
alloy-eips = { version = "0.7.3", default-features = false }
alloy-signer = { version = "0.7.3", default-features = false }
alloy-signer-local = { version = "0.7.3", default-features = false }
alloy-network = { version = "0.7.3", default-features = false }
alloy-consensus = { version = "0.7.3", default-features = false }
alloy-transport = { version = "0.7.3" }
alloy-transport-http = { version = "0.7.3", features = [
"reqwest-rustls-tls",
], default-features = false }
alloy-transport-ws = { version = "0.4.2", default-features = false }
alloy-transport-ipc = { version = "0.4.2", default-features = false }
alloy-pubsub = { version = "0.4.2", default-features = false }
alloy-json-rpc = { version = "0.4.2", default-features = false }
alloy-rpc-client = { version = "0.4.2", default-features = false }
alloy-transport-ws = { version = "0.7.3", default-features = false }
alloy-transport-ipc = { version = "0.7.3", default-features = false }
alloy-pubsub = { version = "0.7.3", default-features = false }
alloy-json-rpc = { version = "0.7.3", default-features = false }
alloy-rpc-client = { version = "0.7.3", default-features = false }


# Uniswap math helpers
Expand Down
20 changes: 16 additions & 4 deletions bin/angstrom/src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ use order_pool::{order_storage::OrderStorage, PoolConfig, PoolManagerUpdate};
use reth::{
api::NodeAddOns,
builder::FullNodeComponents,
chainspec::ChainSpec,
primitives::EthPrimitives,
providers::{BlockNumReader, CanonStateSubscriptions},
tasks::TaskExecutor
};
use reth_metrics::common::mpsc::{UnboundedMeteredReceiver, UnboundedMeteredSender};
use reth_node_builder::FullNode;
use reth_node_builder::{node::FullNodeTypes, rpc::RethRpcAddOns, FullNode, NodeTypes};
use reth_provider::BlockReader;
use tokio::sync::mpsc::{
channel, unbounded_channel, Receiver, Sender, UnboundedReceiver, UnboundedSender
};
Expand Down Expand Up @@ -137,14 +140,23 @@ pub fn initialize_strom_handles() -> StromHandles {
}
}

pub async fn initialize_strom_components<Node: FullNodeComponents, AddOns: NodeAddOns<Node>>(
pub async fn initialize_strom_components<Node, AddOns>(
config: AngstromConfig,
signer: AngstromSigner,
mut handles: StromHandles,
network_builder: StromNetworkBuilder,
node: FullNode<Node, AddOns>,
executor: &TaskExecutor
) {
) where
Node: FullNodeComponents
+ FullNodeTypes<Types: NodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives>>,
Node::Provider: BlockReader<
Block = reth::primitives::Block,
Receipt = reth::primitives::Receipt,
Header = reth::primitives::Header
>,
AddOns: NodeAddOns<Node> + RethRpcAddOns<Node>
{
let node_config = NodeConfig::load_from_config(Some(config.node_config)).unwrap();
let node_address = signer.address();

Expand All @@ -155,7 +167,7 @@ pub async fn initialize_strom_components<Node: FullNodeComponents, AddOns: NodeA

let querying_provider: Arc<_> = ProviderBuilder::<_, _, Ethereum>::default()
.with_recommended_fillers()
.on_builtin(node.rpc_server_handles.rpc.http_url().unwrap().as_str())
.on_builtin(node.rpc_server_handle().http_url().unwrap().as_str())
.await
.unwrap()
.into();
Expand Down
2 changes: 1 addition & 1 deletion bin/angstrom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn run() -> eyre::Result<()> {
.components_builder()
.network(AngstromNetworkBuilder::new(protocol_handle))
)
.with_add_ons::<EthereumAddOns>(Default::default())
.with_add_ons::<EthereumAddOns<_>>(Default::default())
.extend_rpc_modules(move |rpc_context| {
let order_api = OrderApi::new(pool.clone(), executor_clone, validation_client);
rpc_context.modules.merge_configured(order_api.into_rpc())?;
Expand Down
7 changes: 2 additions & 5 deletions bin/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ reth-blockchain-tree.workspace = true
reth-beacon-consensus.workspace = true
reth-tokio-util.workspace = true
reth-ecies.workspace = true
reth-discv4 = { workspace = true, features = [
"test-utils",
] }
reth-dns-discovery = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-discv4 = { workspace = true, features = ["test-utils"] }
reth-dns-discovery = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-primitives = { workspace = true, features = ["test-utils"] }
reth-network = { workspace = true, features = ["test-utils"] }
reth-metrics.workspace = true
Expand Down Expand Up @@ -97,7 +95,6 @@ jemalloc = ["dep:tikv-jemallocator"]
jemalloc-prof = ["jemalloc", "tikv-jemallocator?/profiling"]



[[bin]]
name = "testnet"
path = "src/main.rs"
64 changes: 49 additions & 15 deletions contracts/src/periphery/ControllerV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ contract ControllerV1 is Ownable2Step {
event NewControllerAccepted(address indexed newController);

event PoolConfigured(
address indexed asset0, address indexed asset1, uint16 tickSpacing, uint24 feeInE6
address indexed asset0,
address indexed asset1,
uint16 tickSpacing,
uint24 feeInE6
);

event PoolRemoved(
address indexed asset0, address indexed asset1, int24 tickSpacing, uint24 feeInE6
address indexed asset0,
address indexed asset1,
int24 tickSpacing,
uint24 feeInE6
);

event NodeAdded(address indexed node);
Expand All @@ -59,11 +65,16 @@ contract ControllerV1 is Ownable2Step {

mapping(StoreKey key => Pool) public pools;

constructor(IAngstromAuth angstrom, address initialOwner) Ownable(initialOwner) {
constructor(
IAngstromAuth angstrom,
address initialOwner
) Ownable(initialOwner) {
ANGSTROM = angstrom;
}

function getAllPools(StoreKey[] calldata storeKeys) external view returns (Pool[] memory) {
function getAllPools(
StoreKey[] calldata storeKeys
) external view returns (Pool[] memory) {
Pool[] memory allPools = new Pool[](storeKeys.length);

for (uint256 i = 0; i < storeKeys.length; i++) {
Expand All @@ -73,6 +84,16 @@ contract ControllerV1 is Ownable2Step {
return allPools;
}

function addPoolToMap(address asset0, address asset1) external {
_checkOwner();
if (asset0 > asset1) (asset0, asset1) = (asset1, asset0);
StoreKey key = PoolConfigStoreLib.keyFromAssetsUnchecked(
asset0,
asset1
);
pools[key] = Pool(asset0, asset1);
}

function setNewController(address newController) public {
_checkOwner();
setController = newController;
Expand All @@ -86,12 +107,18 @@ contract ControllerV1 is Ownable2Step {
ANGSTROM.setController(msg.sender);
}

function configurePool(address asset0, address asset1, uint16 tickSpacing, uint24 feeInE6)
external
{
function configurePool(
address asset0,
address asset1,
uint16 tickSpacing,
uint24 feeInE6
) external {
_checkOwner();
if (asset0 > asset1) (asset0, asset1) = (asset1, asset0);
StoreKey key = PoolConfigStoreLib.keyFromAssetsUnchecked(asset0, asset1);
StoreKey key = PoolConfigStoreLib.keyFromAssetsUnchecked(
asset0,
asset1
);
pools[key] = Pool(asset0, asset1);
emit PoolConfigured(asset0, asset1, tickSpacing, feeInE6);
ANGSTROM.configurePool(asset0, asset1, tickSpacing, feeInE6);
Expand All @@ -101,15 +128,22 @@ contract ControllerV1 is Ownable2Step {
_checkOwner();

if (asset0 > asset1) (asset0, asset1) = (asset1, asset0);
StoreKey key = PoolConfigStoreLib.keyFromAssetsUnchecked(asset0, asset1);
StoreKey key = PoolConfigStoreLib.keyFromAssetsUnchecked(
asset0,
asset1
);
address configStore = _configStore();
uint256 poolIndex = 0;

int24 tickSpacing;
uint24 feeInE6;

while (true) {
ConfigEntry entry = _getAndCheckStoreEntry(configStore, poolIndex, key);
ConfigEntry entry = _getAndCheckStoreEntry(
configStore,
poolIndex,
key
);
if (entry.matchingStoreKey(asset0, asset1)) {
tickSpacing = entry.tickSpacing();
feeInE6 = entry.feeInE6();
Expand Down Expand Up @@ -173,11 +207,11 @@ contract ControllerV1 is Ownable2Step {
}
}

function _getAndCheckStoreEntry(address configStore, uint256 index, StoreKey key)
internal
view
returns (ConfigEntry entry)
{
function _getAndCheckStoreEntry(
address configStore,
uint256 index,
StoreKey key
) internal view returns (ConfigEntry entry) {
uint256 offset = STORE_HEADER_SIZE + index * ENTRY_SIZE;
assembly ("memory-safe") {
extcodecopy(configStore, 0x00, offset, ENTRY_SIZE)
Expand Down
10 changes: 5 additions & 5 deletions crates/angstrom-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ reth-network-peers.workspace = true
reth-node-builder.workspace = true
reth.workspace = true

reth-network-p2p = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-net-banlist = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-tokio-util = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-network-p2p = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-net-banlist = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-tokio-util = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }
reth-discv4.workspace = true
reth-dns-discovery = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-dns-discovery = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4", tag = "v1.1.4" }

alloy.workspace = true
alloy-chains.workspace = true
Expand Down
Loading

0 comments on commit ae56afe

Please sign in to comment.