Commit 4aacef46 authored by clabby's avatar clabby

:broom:

parent 7d603267
...@@ -156,6 +156,7 @@ func (n *OpNode) initL1(ctx context.Context, cfg *Config) error { ...@@ -156,6 +156,7 @@ func (n *OpNode) initL1(ctx context.Context, cfg *Config) error {
return fmt.Errorf("failed to get L1 RPC client: %w", err) return fmt.Errorf("failed to get L1 RPC client: %w", err)
} }
// Set the RethDB path in the EthClientConfig, if there is one configured.
rpcCfg.EthClientConfig.RethDBPath = cfg.RethDBPath rpcCfg.EthClientConfig.RethDBPath = cfg.RethDBPath
n.l1Source, err = sources.NewL1Client( n.l1Source, err = sources.NewL1Client(
......
...@@ -138,7 +138,8 @@ pub extern "C" fn free_string(string: *mut c_char) { ...@@ -138,7 +138,8 @@ pub extern "C" fn free_string(string: *mut c_char) {
} }
} }
pub(crate) fn build_transaction_receipt_with_block_receipts( #[inline(always)]
fn build_transaction_receipt_with_block_receipts(
tx: TransactionSigned, tx: TransactionSigned,
meta: TransactionMeta, meta: TransactionMeta,
receipt: Receipt, receipt: Receipt,
......
...@@ -52,7 +52,9 @@ func FetchRethReceipts(dbPath string, blockHash *common.Hash) (types.Receipts, e ...@@ -52,7 +52,9 @@ func FetchRethReceipts(dbPath string, blockHash *common.Hash) (types.Receipts, e
// Convert the returned JSON string to Go string and parse it // Convert the returned JSON string to Go string and parse it
receiptsJSON := C.GoStringN(receiptsResult.data, C.int(receiptsResult.data_len)) receiptsJSON := C.GoStringN(receiptsResult.data, C.int(receiptsResult.data_len))
var receipts types.Receipts var receipts types.Receipts
json.Unmarshal([]byte(receiptsJSON), &receipts) if err := json.Unmarshal([]byte(receiptsJSON), &receipts); err != nil {
return nil, err
}
// Free the memory allocated by the C code // Free the memory allocated by the C code
C.free_string(receiptsResult.data) C.free_string(receiptsResult.data)
......
package sources
import (
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
)
func TestRethReceiptsLoad(t *testing.T) {
t.Skip("Skipping test that requires a local L1 Goerli Reth DB")
t.Parallel()
// block = https://goerli.etherscan.io/block/994113
blockHash := common.HexToHash("0x6f6f00553e4f74262a9812927afd11c341730c5c9210824fe172367457adb5f6")
res, err := FetchRethReceipts("/path/to/goerli-db", &blockHash)
require.NoError(t, err, "Failed to fetch receipts from Reth DB")
require.Len(t, res, 2, "Expected 2 receipts to be returned")
require.Equal(t, res[0].Type, 0)
require.Equal(t, res[0].CumulativeGasUsed, uint64(93_787))
require.Equal(t, res[0].Status, uint64(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