-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from kadena-io/jose/spvsupport
SPV support for Core
- Loading branch information
Showing
9 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Pact.Core.SPV | ||
( ContProof(..) | ||
, SPVSupport(..) | ||
, noSPVSupport)where | ||
|
||
import Data.Text(Text) | ||
import Data.ByteString(ByteString) | ||
import GHC.Generics | ||
import Control.DeepSeq | ||
|
||
import Pact.Core.DefPacts.Types | ||
import Pact.Core.PactValue | ||
|
||
newtype ContProof = ContProof { _contProof :: ByteString } | ||
deriving (Eq, Ord, Show, Generic) | ||
|
||
|
||
instance NFData ContProof | ||
|
||
-- | Backend for SPV support | ||
data SPVSupport = SPVSupport | ||
{ _spvSupport :: !(Text -> (ObjectData PactValue) -> IO (Either Text (ObjectData PactValue))) | ||
-- ^ Attempt to verify an SPV proof of a given type, | ||
-- given a payload object. On success, returns the | ||
-- specific data represented by the proof. | ||
, _spvVerifyContinuation :: !(ContProof -> IO (Either Text DefPactExec)) | ||
-- ^ Attempt to verify an SPV proof of a continuation given | ||
-- a continuation payload object bytestring. On success, returns | ||
-- the 'PactExec' associated with the proof. | ||
} deriving (Generic) | ||
|
||
instance NFData SPVSupport | ||
|
||
noSPVSupport :: SPVSupport | ||
noSPVSupport = SPVSupport spv vcon | ||
where | ||
spv = \_ _ -> return $ Left "SPV verification not supported" | ||
vcon = \_ -> return $ Left "Cross-chain continuations not supported" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters