diff --git a/Package.swift b/Package.swift index cf042c1..4bb46da 100644 --- a/Package.swift +++ b/Package.swift @@ -9,7 +9,10 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "BeaconChain", - targets: ["BeaconChain"]) + targets: ["BeaconChain"]), + .executable( + name: "Node", + targets: ["Node"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -21,8 +24,14 @@ let package = Package( .target( name: "BeaconChain", dependencies: []), + .target( + name: "Node", + dependencies: ["BeaconChain"]), .testTarget( name: "BeaconChainTests", - dependencies: ["BeaconChain"]) + dependencies: ["BeaconChain"]), + .testTarget( + name: "NodeTests", + dependencies: ["Node"]) ] ) diff --git a/Sources/BeaconChain/DataStructures/Blocks/BeaconBlock.swift b/Sources/BeaconChain/DataStructures/Blocks/BeaconBlock.swift index 5ad56d9..01903cc 100644 --- a/Sources/BeaconChain/DataStructures/Blocks/BeaconBlock.swift +++ b/Sources/BeaconChain/DataStructures/Blocks/BeaconBlock.swift @@ -1,6 +1,6 @@ import Foundation -struct BeaconBlock: Equatable { +public struct BeaconBlock: Equatable { let slot: UInt64 let parentRoot: Data let stateRoot: Data diff --git a/Sources/BeaconChain/DataStructures/Transactions/Attestations/Attestation.swift b/Sources/BeaconChain/DataStructures/Transactions/Attestations/Attestation.swift index 42fe2a7..3ddf7ac 100644 --- a/Sources/BeaconChain/DataStructures/Transactions/Attestations/Attestation.swift +++ b/Sources/BeaconChain/DataStructures/Transactions/Attestations/Attestation.swift @@ -1,6 +1,6 @@ import Foundation -struct Attestation: Equatable { +public struct Attestation: Equatable { let aggregationBitfield: Data let data: AttestationData let custodyBitfield: Data diff --git a/Sources/BeaconChain/Store/Store.swift b/Sources/BeaconChain/Store/Store.swift index 199cfb5..baba99f 100644 --- a/Sources/BeaconChain/Store/Store.swift +++ b/Sources/BeaconChain/Store/Store.swift @@ -1,6 +1,6 @@ import Foundation -protocol Store { +public protocol Store { func parent(_ block: BeaconBlock) -> BeaconBlock func children(_ block: BeaconBlock) -> [BeaconBlock] diff --git a/Sources/BeaconChain/Types.swift b/Sources/BeaconChain/Types.swift index 7e02de6..e57221f 100644 --- a/Sources/BeaconChain/Types.swift +++ b/Sources/BeaconChain/Types.swift @@ -3,7 +3,7 @@ import Foundation typealias Slot = UInt64 typealias Epoch = UInt64 typealias Shard = UInt64 -typealias ValidatorIndex = UInt64 +public typealias ValidatorIndex = UInt64 typealias Gwei = UInt64 typealias Bytes32 = Data // @todo needs to be 32 fixed length data typealias BLSPubkey = Data // @todo needs to be 48 fixed length data diff --git a/Sources/Node/Store/TestStore.swift b/Sources/Node/Store/TestStore.swift new file mode 100644 index 0000000..1d0f7e4 --- /dev/null +++ b/Sources/Node/Store/TestStore.swift @@ -0,0 +1,19 @@ +import BeaconChain + +class TestStore: Store { + func parent(_ block: BeaconBlock) -> BeaconBlock { + + } + + func children(_ block: BeaconBlock) -> [BeaconBlock] { + + } + + func latestAttestation(validator: ValidatorIndex) -> Attestation { + + } + + func latestAttestationTarget(validator: ValidatorIndex) -> BeaconBlock { + + } +} diff --git a/Sources/Node/main.swift b/Sources/Node/main.swift new file mode 100644 index 0000000..fbf2875 --- /dev/null +++ b/Sources/Node/main.swift @@ -0,0 +1,2 @@ +import Foundation + diff --git a/Tests/NodeTests/XCTestManifests.swift b/Tests/NodeTests/XCTestManifests.swift new file mode 100644 index 0000000..f9ce505 --- /dev/null +++ b/Tests/NodeTests/XCTestManifests.swift @@ -0,0 +1,8 @@ +import XCTest + +#if !os(macOS) +public func allTests() -> [XCTestCaseEntry] { + return [ + ] +} +#endif