diff --git a/Blockchain/Sources/Blockchain/RuntimeProtocols/Accumulation.swift b/Blockchain/Sources/Blockchain/RuntimeProtocols/Accumulation.swift index 37f93a0a..a97acfc3 100644 --- a/Blockchain/Sources/Blockchain/RuntimeProtocols/Accumulation.swift +++ b/Blockchain/Sources/Blockchain/RuntimeProtocols/Accumulation.swift @@ -575,7 +575,7 @@ extension Accumulation { for (service, _) in accumulateOutput.gasUsed { if accumulateStats[service] != nil { continue } - let digests = accumulated.compactMap(\.digests).flatMap { $0 } + let digests = accumulated.compactMap(\.digests).flatMap(\.self) let num = digests.filter { $0.serviceIndex == service }.count if num == 0 { continue } diff --git a/Database/Sources/RocksDBSwift/Store.swift b/Database/Sources/RocksDBSwift/Store.swift index 1d4355f5..7b2bcc44 100644 --- a/Database/Sources/RocksDBSwift/Store.swift +++ b/Database/Sources/RocksDBSwift/Store.swift @@ -42,7 +42,7 @@ public final class Store: Sendable { public func exists(key: Coder.Key) throws -> Bool { let encodedKey = try coder.encode(key: key) - // it seems like + // it seems like there is no way to check if a key exists so we just try to get it return try db.get(column: column, key: encodedKey) != nil } diff --git a/Node/Sources/Node/ChainSpec.swift b/Node/Sources/Node/ChainSpec.swift index 03044ad9..03822dea 100644 --- a/Node/Sources/Node/ChainSpec.swift +++ b/Node/Sources/Node/ChainSpec.swift @@ -57,7 +57,10 @@ public struct ChainSpec: Codable, Equatable { public func getState() throws -> [Data31: Data] { var output: [Data31: Data] = [:] for (key, value) in genesisState { - try output[Data31(fromHexString: key).unwrap()] = value + guard let dataKey = Data31(fromHexString: key) else { + throw GenesisError.invalidFormat("Invalid genesisState key format: \(key) (not valid hex)") + } + output[dataKey] = value } return output } diff --git a/Tools/Sources/CTools/ctools.h b/Tools/Sources/CTools/ctools.h index 44a2806f..564edac3 100644 --- a/Tools/Sources/CTools/ctools.h +++ b/Tools/Sources/CTools/ctools.h @@ -1,3 +1,5 @@ +#pragma once + #include /** @@ -13,5 +15,4 @@ */ int emitAddExample(void *codePtr); - int ctools_shm_open(const char *name, int oflag, mode_t mode); diff --git a/Tools/Sources/Tools/Tools.swift b/Tools/Sources/Tools/Tools.swift index 5238cd9e..e8678437 100644 --- a/Tools/Sources/Tools/Tools.swift +++ b/Tools/Sources/Tools/Tools.swift @@ -4,7 +4,7 @@ import TracingUtils import Utils @main -struct Boka: AsyncParsableCommand { +struct Tools: AsyncParsableCommand { static let configuration = CommandConfiguration( abstract: "Boka Tools", version: "0.0.1",