Make transactions in execution layer integration tests (#3320)

## Issue Addressed

Resolves #3159 

## Proposed Changes

Sends transactions to the EE before requesting for a payload in the `execution_integration_tests`. Made some changes to the integration tests in order to be able to sign and publish transactions to the EE:

1. `genesis.json` for both geth and nethermind was modified to include pre-funded accounts that we know private keys for 
2. Using the unauthenticated port again in order to make `eth_sendTransaction` and calls from the `personal` namespace to import keys

Also added a `fcu` call with `PayloadAttributes` before calling `getPayload` in order to give EEs sufficient time to pack transactions into the payload.
This commit is contained in:
Pawan Dhananjay
2022-07-18 01:51:36 +00:00
parent 2ed51c364d
commit da7b7a0f60
9 changed files with 541 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
use ethers_providers::{Http, Provider};
use execution_layer::DEFAULT_JWT_FILE;
use sensitive_url::SensitiveUrl;
use std::path::PathBuf;
@@ -5,6 +6,14 @@ use std::process::Child;
use tempfile::TempDir;
use unused_port::unused_tcp_port;
pub const KEYSTORE_PASSWORD: &str = "testpwd";
pub const ACCOUNT1: &str = "7b8C3a386C0eea54693fFB0DA17373ffC9228139";
pub const ACCOUNT2: &str = "dA2DD7560DB7e212B945fC72cEB54B7D8C886D77";
pub const PRIVATE_KEYS: [&str; 2] = [
"115fe42a60e5ef45f5490e599add1f03c73aeaca129c2c41451eca6cf8ff9e04",
"6a692e710077d9000be1326acbe32f777b403902ac8779b19eb1398b849c99c3",
];
/// Defined for each EE type (e.g., Geth, Nethermind, etc).
pub trait GenericExecutionEngine: Clone {
fn init_datadir() -> TempDir;
@@ -22,8 +31,10 @@ pub struct ExecutionEngine<E> {
engine: E,
#[allow(dead_code)]
datadir: TempDir,
http_port: u16,
http_auth_port: u16,
child: Child,
pub provider: Provider<Http>,
}
impl<E> Drop for ExecutionEngine<E> {
@@ -42,11 +53,15 @@ impl<E: GenericExecutionEngine> ExecutionEngine<E> {
let http_port = unused_tcp_port().unwrap();
let http_auth_port = unused_tcp_port().unwrap();
let child = E::start_client(&datadir, http_port, http_auth_port, jwt_secret_path);
let provider = Provider::<Http>::try_from(format!("http://localhost:{}", http_port))
.expect("failed to instantiate ethers provider");
Self {
engine,
datadir,
http_port,
http_auth_port,
child,
provider,
}
}
@@ -54,6 +69,10 @@ impl<E: GenericExecutionEngine> ExecutionEngine<E> {
SensitiveUrl::parse(&format!("http://127.0.0.1:{}", self.http_auth_port)).unwrap()
}
pub fn http_url(&self) -> SensitiveUrl {
SensitiveUrl::parse(&format!("http://127.0.0.1:{}", self.http_port)).unwrap()
}
pub fn datadir(&self) -> PathBuf {
self.datadir.path().to_path_buf()
}