Merge branch 'Pravdyvy/indexer-state-management' into Pravdyvy/bedrock-parsing-from-start-of-a-channel

This commit is contained in:
Pravdyvy 2026-02-23 16:12:43 +02:00
commit 2bad85b217
6 changed files with 18 additions and 8 deletions

View File

@ -52,7 +52,7 @@ pub enum BedrockStatus {
Finalized,
}
#[derive(Debug, BorshSerialize, BorshDeserialize, Clone)]
#[derive(Debug, Clone, BorshSerialize, BorshDeserialize)]
pub struct Block {
pub header: BlockHeader,
pub body: BlockBody,

View File

@ -99,7 +99,7 @@ pub enum TxKind {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, thiserror::Error)]
pub enum TransactionMalformationError {
#[error("Invalid signature(s)")]
#[error("Invalid signature(-s)")]
InvalidSignature,
#[error("Failed to decode transaction with hash: {tx:?}")]
FailedToDecode { tx: HashType },

View File

@ -35,6 +35,11 @@ RUN strip /indexer_service/target/release/indexer_service
# Runtime stage - minimal image
FROM debian:trixie-slim
# Install runtime dependencies
RUN apt-get update \
&& apt-get install -y gosu jq \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN useradd -m -u 1000 -s /bin/bash indexer_service_user && \
mkdir -p /indexer_service /etc/indexer_service && \

View File

@ -1,11 +1,11 @@
#!/bin/sh
# This is an entrypoint script for the sequencer_runner Docker container,
# This is an entrypoint script for the indexer_service Docker container,
# it's not meant to be executed outside of the container.
set -e
CONFIG="/etc/sequencer_runner/sequencer_config.json"
CONFIG="/etc/indexer_service/indexer_service.json"
# Check config file exists
if [ ! -f "$CONFIG" ]; then
@ -24,6 +24,6 @@ fi
# Give permissions to the data directory and switch to non-root user
if [ "$(id -u)" = "0" ]; then
mkdir -p "$HOME_DIR"
chown -R sequencer_user:sequencer_user "$HOME_DIR"
exec gosu sequencer_user "$@"
chown -R indexer_service_user:indexer_service_user "$HOME_DIR"
exec gosu indexer_service_user "$@"
fi

View File

@ -278,5 +278,9 @@ pub fn not_yet_implemented_error() -> ErrorObjectOwned {
}
fn db_error(err: anyhow::Error) -> ErrorObjectOwned {
ErrorObjectOwned::owned(-32001, "DBError".to_string(), Some(format!("{err:#?}")))
ErrorObjectOwned::owned(
ErrorCode::InternalError.code(),
"DBError".to_string(),
Some(format!("{err:#?}")),
)
}

View File

@ -99,12 +99,13 @@ impl BlockSettlementClientTrait for BlockSettlementClient {
Some(Op::ChannelInscribe(inscribe)) => (inscribe.parent, inscribe.id()),
_ => panic!("Expected ChannelInscribe op"),
};
log::info!("Posted block to Bedrock with parent id {parent_id:?} and msg id: {msg_id:?}");
self.bedrock_client
.post_transaction(tx)
.await
.context("Failed to post transaction to Bedrock")?;
log::info!("Posted block to Bedrock with parent id {parent_id:?} and msg id: {msg_id:?}");
Ok(())
}