Commit 4a56354e authored by clabby's avatar clabby Committed by GitHub

feat(ci): Re introduce `rethdb-reader` CI tests (#9692)

* Add `rethdb-reader` tests back into CI

* Fix `RethDBReceiptsFetcher` interface

* update

* Update dependencies

* `ci-builder-rust` w/ `clang` + `lld`
parent 25b01cb2
...@@ -4,6 +4,9 @@ parameters: ...@@ -4,6 +4,9 @@ parameters:
ci_builder_image: ci_builder_image:
type: string type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.43.0 default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.43.0
ci_builder_rust_image:
type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder-rust:latest
base_image: base_image:
type: string type: string
default: default default: default
...@@ -1323,7 +1326,7 @@ jobs: ...@@ -1323,7 +1326,7 @@ jobs:
op-service-rethdb-tests: op-service-rethdb-tests:
docker: docker:
- image: <<pipeline.parameters.ci_builder_image>> - image: <<pipeline.parameters.ci_builder_rust_image>>
steps: steps:
- checkout - checkout
- check-changed: - check-changed:
...@@ -1651,6 +1654,9 @@ workflows: ...@@ -1651,6 +1654,9 @@ workflows:
requires: requires:
- go-mod-download - go-mod-download
- pnpm-monorepo - pnpm-monorepo
- op-service-rethdb-tests:
requires:
- go-mod-download
- op-program-compat: - op-program-compat:
requires: requires:
- op-program-tests - op-program-tests
...@@ -1674,6 +1680,7 @@ workflows: ...@@ -1674,6 +1680,7 @@ workflows:
- op-program-tests - op-program-tests
- op-program-compat - op-program-compat
- op-service-tests - op-service-tests
- op-service-rethdb-tests
- op-e2e-HTTP-tests - op-e2e-HTTP-tests
- op-e2e-fault-proof-tests - op-e2e-fault-proof-tests
- op-e2e-action-tests - op-e2e-action-tests
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,17 +10,17 @@ crate-type = ["cdylib"] ...@@ -10,17 +10,17 @@ crate-type = ["cdylib"]
[dependencies] [dependencies]
# reth # reth
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" } reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" } reth-provider = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
reth-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" } reth-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" } reth-rpc-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
reth-blockchain-tree = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" } reth-blockchain-tree = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
# misc # misc
serde = "1.0.190" serde = "1.0.197"
serde_json = "1.0.107" serde_json = "1.0.114"
anyhow = "1.0.75" anyhow = "1.0.80"
[dev-dependencies] [dev-dependencies]
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" } reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
alloy-rlp = "0.3.3" alloy-rlp = "0.3.4"
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use reth_blockchain_tree::noop::NoopBlockchainTree; use reth_blockchain_tree::noop::NoopBlockchainTree;
use reth_db::open_db_read_only; use reth_db::{mdbx::DatabaseArguments, open_db_read_only};
use reth_primitives::{ use reth_primitives::{
BlockHashOrNumber, Receipt, TransactionKind, TransactionMeta, TransactionSigned, MAINNET, U128, BlockHashOrNumber, Receipt, TransactionKind, TransactionMeta, TransactionSigned, MAINNET, U128,
U256, U64, U256, U64,
...@@ -66,7 +66,8 @@ pub(crate) unsafe fn read_receipts_inner( ...@@ -66,7 +66,8 @@ pub(crate) unsafe fn read_receipts_inner(
} }
.to_str()?; .to_str()?;
let db = open_db_read_only(Path::new(db_path_str), None).map_err(|e| anyhow!(e))?; let db = open_db_read_only(Path::new(db_path_str), DatabaseArguments::default())
.map_err(|e| anyhow!(e))?;
let factory = ProviderFactory::new(db, MAINNET.clone()); let factory = ProviderFactory::new(db, MAINNET.clone());
// Create a read-only BlockChainProvider // Create a read-only BlockChainProvider
...@@ -159,6 +160,9 @@ fn build_transaction_receipt_with_block_receipts( ...@@ -159,6 +160,9 @@ fn build_transaction_receipt_with_block_receipts(
// EIP-4844 fields // EIP-4844 fields
blob_gas_price: None, blob_gas_price: None,
blob_gas_used: None, blob_gas_used: None,
// Other:
other: Default::default(),
}; };
match tx.transaction.kind() { match tx.transaction.kind() {
...@@ -199,7 +203,7 @@ fn build_transaction_receipt_with_block_receipts( ...@@ -199,7 +203,7 @@ fn build_transaction_receipt_with_block_receipts(
mod test { mod test {
use super::*; use super::*;
use alloy_rlp::Decodable; use alloy_rlp::Decodable;
use reth_db::database::Database; use reth_db::{database::Database, mdbx::DatabaseArguments};
use reth_primitives::{ use reth_primitives::{
address, b256, bloom, hex, Address, Block, Bytes, ReceiptWithBloom, Receipts, address, b256, bloom, hex, Address, Block, Bytes, ReceiptWithBloom, Receipts,
SealedBlockWithSenders, U8, SealedBlockWithSenders, U8,
...@@ -235,11 +239,12 @@ mod test { ...@@ -235,11 +239,12 @@ mod test {
#[inline] #[inline]
fn open_receipts_testdata_db() -> Result<()> { fn open_receipts_testdata_db() -> Result<()> {
if File::open("testdata/db").is_ok() { if File::open("testdata/db").is_ok() {
return Ok(()) return Ok(());
} }
// Open a RW handle to the MDBX database // Open a RW handle to the MDBX database
let db = reth_db::init_db(Path::new("testdata/db"), None).map_err(|e| anyhow!(e))?; let db = reth_db::init_db(Path::new("testdata/db"), DatabaseArguments::default())
.map_err(|e| anyhow!(e))?;
let pr = DatabaseProvider::new_rw(db.tx_mut()?, MAINNET.clone()); let pr = DatabaseProvider::new_rw(db.tx_mut()?, MAINNET.clone());
// Grab the dummy block and receipts // Grab the dummy block and receipts
...@@ -260,13 +265,15 @@ mod test { ...@@ -260,13 +265,15 @@ mod test {
.ok_or(anyhow!("Failed to recover signers"))?; .ok_or(anyhow!("Failed to recover signers"))?;
// Commit the bundle state to the database // Commit the bundle state to the database
pr.append_blocks_with_bundle_state( pr.append_blocks_with_state(
vec![SealedBlockWithSenders { block: block.seal_slow(), senders }], vec![SealedBlockWithSenders { block: block.seal_slow(), senders }],
BundleStateWithReceipts::new( BundleStateWithReceipts::new(
BundleState::default(), BundleState::default(),
Receipts::from_block_receipt(receipts), Receipts::from_block_receipt(receipts),
block_number, block_number,
), ),
Default::default(),
Default::default(),
None, None,
)?; )?;
pr.commit()?; pr.commit()?;
......
...@@ -77,14 +77,17 @@ type RethDBReceiptsFetcher struct { ...@@ -77,14 +77,17 @@ type RethDBReceiptsFetcher struct {
// into NewRethDBReceiptsFetcher. // into NewRethDBReceiptsFetcher.
} }
var _ ReceiptsProvider = (*RethDBReceiptsFetcher)(nil)
func NewRethDBReceiptsFetcher(dbPath string) *RethDBReceiptsFetcher { func NewRethDBReceiptsFetcher(dbPath string) *RethDBReceiptsFetcher {
return &RethDBReceiptsFetcher{ return &RethDBReceiptsFetcher{
dbPath: dbPath, dbPath: dbPath,
} }
} }
func (f *RethDBReceiptsFetcher) FetchReceipts(ctx context.Context, block eth.BlockID, txHashes []common.Hash) (types.Receipts, error) { func (f *RethDBReceiptsFetcher) FetchReceipts(ctx context.Context, block eth.BlockInfo, txHashes []common.Hash) (types.Receipts, error) {
return FetchRethReceipts(f.dbPath, &block.Hash) hash := block.Hash()
return FetchRethReceipts(f.dbPath, &hash)
} }
func NewCachingRethDBReceiptsFetcher(dbPath string, m caching.Metrics, cacheSize int) *CachingReceiptsProvider { func NewCachingRethDBReceiptsFetcher(dbPath string, m caching.Metrics, cacheSize int) *CachingReceiptsProvider {
......
...@@ -6,7 +6,7 @@ DOCKER_REPO=$1 ...@@ -6,7 +6,7 @@ DOCKER_REPO=$1
GIT_TAG=$2 GIT_TAG=$2
GIT_SHA=$3 GIT_SHA=$3
IMAGE_NAME=$(echo "$GIT_TAG" | grep -Eow '^(ci-builder|chain-mon|proxyd|indexer|ufm-[a-z0-9\-]*|op-[a-z0-9\-]*)' || true) IMAGE_NAME=$(echo "$GIT_TAG" | grep -Eow '^(ci-builder(-rust)?|chain-mon|proxyd|indexer|ufm-[a-z0-9\-]*|op-[a-z0-9\-]*)' || true)
if [ -z "$IMAGE_NAME" ]; then if [ -z "$IMAGE_NAME" ]; then
echo "image name could not be parsed from git tag '$GIT_TAG'" echo "image name could not be parsed from git tag '$GIT_TAG'"
exit 1 exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment