Skip to content

Commit

Permalink
supra library version check
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jan 14, 2025
1 parent facb7e4 commit e4b9bfd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions extern/supraseal/sealing/supra_seal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ static void init_ctx(size_t sector_size) {
}
}

extern "C"
int supra_version() {
return 0x100001;
}

extern "C"
void supra_seal_init(size_t sector_size, const char* config_file) {
printf("INIT called %s\n", config_file);
Expand Down
1 change: 1 addition & 0 deletions extern/supraseal/sealing/supra_seal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
extern "C" {
#endif

int supra_version();

// Optional init function.
// config_file - topology config file. Defaults to supra_config.cfg
Expand Down
3 changes: 2 additions & 1 deletion lib/proof/porep_vproof_bin_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package proof
import (
"encoding/binary"
"fmt"
"golang.org/x/xerrors"
"io"

"golang.org/x/xerrors"
)

// This file contains a bincode decoder for Commit1OutRaw.
Expand Down
10 changes: 10 additions & 0 deletions lib/supraffi/seal.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ ${SRCDIR}/../../extern/supraseal/deps/spdk-v24.05/dpdk/build/lib/librte_vhost.a
*/

const libsupra_version = 0x10_00_01

func init() {
libVer := int(C.supra_version())

if libVer != libsupra_version {
panic(fmt.Sprintf("libsupra version mismatch: %x != %x", libVer, libsupra_version))
}
}

// SupraSealInit initializes the supra seal with a sector size and optional config file.
func SupraSealInit(sectorSize uint64, configFile string) {
cConfigFile := C.CString(configFile)
Expand Down

0 comments on commit e4b9bfd

Please sign in to comment.