Add Serai key confirmation to prevent rotating to an unusable key

Also updates alloy to the latest version
This commit is contained in:
Luke Parker
2024-12-08 20:42:37 -05:00
parent 8013c56195
commit 3192370484
18 changed files with 679 additions and 326 deletions

View File

@@ -7,6 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/processor/ethereum
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
edition = "2021"
publish = false
rust-version = "1.81"
[package.metadata.docs.rs]
all-features = true
@@ -19,10 +20,10 @@ workspace = true
k256 = { version = "0.13", default-features = false, features = ["std"] }
alloy-core = { version = "0.8", default-features = false }
alloy-consensus = { version = "0.3", default-features = false, features = ["std"] }
alloy-consensus = { version = "0.7", default-features = false, features = ["std"] }
alloy-rpc-types-eth = { version = "0.3", default-features = false }
alloy-rpc-types-eth = { version = "0.7", default-features = false }
alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false }
alloy-provider = { version = "0.3", default-features = false }
alloy-provider = { version = "0.7", default-features = false }
ethereum-primitives = { package = "serai-processor-ethereum-primitives", path = "../primitives", default-features = false }

View File

@@ -5,7 +5,7 @@
use k256::{elliptic_curve::sec1::ToEncodedPoint, ProjectivePoint};
use alloy_core::{
primitives::{Address, U256, Bytes, Signature, TxKind},
primitives::{Address, U256, Bytes, PrimitiveSignature, TxKind},
hex::FromHex,
};
use alloy_consensus::{SignableTransaction, TxLegacy, Signed};
@@ -46,7 +46,7 @@ pub async fn publish_tx(
let (tx, sig, _) = tx.into_parts();
let mut bytes = vec![];
tx.encode_with_signature_fields(&sig, &mut bytes);
tx.into_signed(sig).eip2718_encode(&mut bytes);
let pending_tx = provider.send_raw_transaction(&bytes).await.unwrap();
pending_tx.get_receipt().await.unwrap()
}
@@ -111,7 +111,7 @@ pub async fn send(
);
let mut bytes = vec![];
tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes);
tx.into_signed(PrimitiveSignature::from(sig)).eip2718_encode(&mut bytes);
let pending_tx = provider.send_raw_transaction(&bytes).await.unwrap();
pending_tx.get_receipt().await.unwrap()
}