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:
ci_builder_image:
type: string
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:
type: string
default: default
......@@ -1323,7 +1326,7 @@ jobs:
op-service-rethdb-tests:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
- image: <<pipeline.parameters.ci_builder_rust_image>>
steps:
- checkout
- check-changed:
......@@ -1651,6 +1654,9 @@ workflows:
requires:
- go-mod-download
- pnpm-monorepo
- op-service-rethdb-tests:
requires:
- go-mod-download
- op-program-compat:
requires:
- op-program-tests
......@@ -1674,6 +1680,7 @@ workflows:
- op-program-tests
- op-program-compat
- op-service-tests
- op-service-rethdb-tests
- op-e2e-HTTP-tests
- op-e2e-fault-proof-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"]
[dependencies]
# reth
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" }
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" }
reth-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" }
reth-blockchain-tree = { 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 = "e0c220e" }
reth-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
reth-blockchain-tree = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
# misc
serde = "1.0.190"
serde_json = "1.0.107"
anyhow = "1.0.75"
serde = "1.0.197"
serde_json = "1.0.114"
anyhow = "1.0.80"
[dev-dependencies]
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "b58bfe6" }
alloy-rlp = "0.3.3"
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "e0c220e" }
alloy-rlp = "0.3.4"
......@@ -3,7 +3,7 @@
use anyhow::{anyhow, Result};
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::{
BlockHashOrNumber, Receipt, TransactionKind, TransactionMeta, TransactionSigned, MAINNET, U128,
U256, U64,
......@@ -66,7 +66,8 @@ pub(crate) unsafe fn read_receipts_inner(
}
.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());
// Create a read-only BlockChainProvider
......@@ -159,6 +160,9 @@ fn build_transaction_receipt_with_block_receipts(
// EIP-4844 fields
blob_gas_price: None,
blob_gas_used: None,
// Other:
other: Default::default(),
};
match tx.transaction.kind() {
......@@ -199,7 +203,7 @@ fn build_transaction_receipt_with_block_receipts(
mod test {
use super::*;
use alloy_rlp::Decodable;
use reth_db::database::Database;
use reth_db::{database::Database, mdbx::DatabaseArguments};
use reth_primitives::{
address, b256, bloom, hex, Address, Block, Bytes, ReceiptWithBloom, Receipts,
SealedBlockWithSenders, U8,
......@@ -235,11 +239,12 @@ mod test {
#[inline]
fn open_receipts_testdata_db() -> Result<()> {
if File::open("testdata/db").is_ok() {
return Ok(())
return Ok(());
}
// 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());
// Grab the dummy block and receipts
......@@ -260,13 +265,15 @@ mod test {
.ok_or(anyhow!("Failed to recover signers"))?;
// 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 }],
BundleStateWithReceipts::new(
BundleState::default(),
Receipts::from_block_receipt(receipts),
block_number,
),
Default::default(),
Default::default(),
None,
)?;
pr.commit()?;
......
......@@ -77,14 +77,17 @@ type RethDBReceiptsFetcher struct {
// into NewRethDBReceiptsFetcher.
}
var _ ReceiptsProvider = (*RethDBReceiptsFetcher)(nil)
func NewRethDBReceiptsFetcher(dbPath string) *RethDBReceiptsFetcher {
return &RethDBReceiptsFetcher{
dbPath: dbPath,
}
}
func (f *RethDBReceiptsFetcher) FetchReceipts(ctx context.Context, block eth.BlockID, txHashes []common.Hash) (types.Receipts, error) {
return FetchRethReceipts(f.dbPath, &block.Hash)
func (f *RethDBReceiptsFetcher) FetchReceipts(ctx context.Context, block eth.BlockInfo, txHashes []common.Hash) (types.Receipts, error) {
hash := block.Hash()
return FetchRethReceipts(f.dbPath, &hash)
}
func NewCachingRethDBReceiptsFetcher(dbPath string, m caching.Metrics, cacheSize int) *CachingReceiptsProvider {
......
......@@ -6,7 +6,7 @@ DOCKER_REPO=$1
GIT_TAG=$2
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
echo "image name could not be parsed from git tag '$GIT_TAG'"
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