From 0470776bd1ca4a3316c94438a0a7d26421fde63f Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Fri, 4 Apr 2025 12:22:24 +0200 Subject: [PATCH] Bindins missing --- bindings.go | 34 ++++++++++++++++++++++++++++++++++ bindings_stub.go | 15 +++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/bindings.go b/bindings.go index 4dc67d8..9c9f335 100644 --- a/bindings.go +++ b/bindings.go @@ -607,3 +607,37 @@ func (s *Silkworm) ExecuteTxn(txCHandle unsafe.Pointer, blockNum uint64, blockHe return gasUsed, blobGasUsed, fmt.Errorf("silkworm_execute_tx error %d", status) } + +func (s *Silkworm) BlockExecStart( + txCHandle unsafe.Pointer, + blockNum uint64, + blockHeaderHash Hash, +) error { + cTx := (*C.MDBX_txn)(txCHandle) + cBlockNum := C.uint64_t(blockNum) + cBlockHeaderHash := C.CBytes(blockHeaderHash[:]) + + status := C.silkworm_block_exec_start(s.handle, cTx, cBlockNum, *(*C.struct_SilkwormBytes32)(cBlockHeaderHash)) + + if status == SILKWORM_OK { + return nil + } + + return fmt.Errorf("silkworm_block_exec_end error %d", status) +} + +func (s *Silkworm) BlockExecEnd( + txCHandle unsafe.Pointer, + memDbTxHandle unsafe.Pointer, +) error { + cTx := (*C.MDBX_txn)(txCHandle) + memDbTx := (*C.MDBX_txn)(memDbTxHandle) + + status := C.silkworm_block_exec_end(s.handle, cTx, memDbTx) + + if status == SILKWORM_OK { + return nil + } + + return fmt.Errorf("silkworm_block_exec_end error %d", status) +} diff --git a/bindings_stub.go b/bindings_stub.go index 7260262..f7775dc 100644 --- a/bindings_stub.go +++ b/bindings_stub.go @@ -170,3 +170,18 @@ func (s *Silkworm) ExecuteTxn( ) (gasUsed uint64, blobGasUsed uint64, err error) { return 0, 0, nil } + +func (s *Silkworm) BlockExecStart( + txCHandle unsafe.Pointer, + blockNum uint64, + blockHeaderHash Hash, +) error { + return nil +} + +func (s *Silkworm) BlockExecEnd( + txCHandle unsafe.Pointer, + memDbTxHandle unsafe.Pointer, +) error { + return nil +}