-
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.
* The main implementation is in cobuild.c. * The lazy reader is implemented in cobuild.c. Other changes: * Add test cases for cobuild * Update ckb-* to 0.113.0 and rust-toolchain * Update ckb-c-stdlib * Add test vectors
- Loading branch information
1 parent
41d6fed
commit 90ad8ba
Showing
35 changed files
with
9,523 additions
and
701 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import blockchain; | ||
|
||
array Hash [byte; 32]; | ||
vector String <byte>; // UTF-8 encoded | ||
option Uint32Opt (Uint32); | ||
|
||
table Action { | ||
script_info_hash: Byte32, // script info | ||
script_hash: Byte32, // script | ||
data: Bytes, // action data | ||
} | ||
|
||
vector ActionVec <Action>; | ||
|
||
table Message { | ||
actions: ActionVec, | ||
} | ||
|
||
table ScriptInfo { | ||
// The dapp name and domain the script belongs to | ||
name: String, | ||
url: String, | ||
|
||
// Script info. | ||
// schema: script action schema | ||
// message_type: the entry action type used in WitnessLayout | ||
script_hash: Byte32, | ||
schema: String, | ||
message_type: String, | ||
} | ||
|
||
vector ScriptInfoVec <ScriptInfo>; | ||
|
||
table ResolvedInputs { | ||
outputs: CellOutputVec, | ||
outputs_data: BytesVec, | ||
} | ||
|
||
table BuildingPacketV1 { | ||
message: Message, | ||
payload: Transaction, | ||
resolved_inputs: ResolvedInputs, | ||
change_output: Uint32Opt, | ||
script_infos: ScriptInfoVec, | ||
lock_actions: ActionVec, | ||
} | ||
|
||
union BuildingPacket { | ||
BuildingPacketV1, | ||
} | ||
|
||
table SighashAll { | ||
message: Message, | ||
seal: Bytes, | ||
} | ||
|
||
table SighashAllOnly { | ||
seal: Bytes, | ||
} | ||
|
||
table SealPair { | ||
script_hash: Byte32, | ||
seal: Bytes, | ||
} | ||
vector SealPairVec <SealPair>; | ||
|
||
table OtxStart { | ||
start_input_cell: Uint32, | ||
start_output_cell: Uint32, | ||
start_cell_deps: Uint32, | ||
start_header_deps: Uint32, | ||
} | ||
|
||
table Otx { | ||
input_cells: Uint32, | ||
output_cells: Uint32, | ||
cell_deps: Uint32, | ||
header_deps: Uint32, | ||
message: Message, | ||
seals: SealPairVec, | ||
} |
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,61 @@ | ||
|
||
#ifndef __BLAKE2B_DECL_ONLY_H__ | ||
#define __BLAKE2B_DECL_ONLY_H__ | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#define BLAKE2_PACKED(x) x __attribute__((packed)) | ||
|
||
enum blake2b_constant { | ||
BLAKE2B_BLOCKBYTES = 128, | ||
BLAKE2B_OUTBYTES = 64, | ||
BLAKE2B_KEYBYTES = 64, | ||
BLAKE2B_SALTBYTES = 16, | ||
BLAKE2B_PERSONALBYTES = 16 | ||
}; | ||
BLAKE2_PACKED(struct blake2b_param__ { | ||
uint8_t digest_length; /* 1 */ | ||
uint8_t key_length; /* 2 */ | ||
uint8_t fanout; /* 3 */ | ||
uint8_t depth; /* 4 */ | ||
uint32_t leaf_length; /* 8 */ | ||
uint32_t node_offset; /* 12 */ | ||
uint32_t xof_length; /* 16 */ | ||
uint8_t node_depth; /* 17 */ | ||
uint8_t inner_length; /* 18 */ | ||
uint8_t reserved[14]; /* 32 */ | ||
uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */ | ||
uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */ | ||
}); | ||
|
||
typedef struct blake2b_param__ blake2b_param; | ||
|
||
typedef struct blake2b_state__ { | ||
uint64_t h[8]; | ||
uint64_t t[2]; | ||
uint64_t f[2]; | ||
uint8_t buf[BLAKE2B_BLOCKBYTES]; | ||
size_t buflen; | ||
size_t outlen; | ||
uint8_t last_node; | ||
} blake2b_state; | ||
|
||
/* Streaming API */ | ||
int ckb_blake2b_init(blake2b_state *S, size_t outlen); | ||
int blake2b_init(blake2b_state *S, size_t outlen); | ||
int blake2b_init_key(blake2b_state *S, size_t outlen, const void *key, | ||
size_t keylen); | ||
int blake2b_update(blake2b_state *S, const void *in, size_t inlen); | ||
int blake2b_final(blake2b_state *S, void *out, size_t outlen); | ||
/* Simple API */ | ||
int blake2b(void *out, size_t outlen, const void *in, size_t inlen, | ||
const void *key, size_t keylen); | ||
|
||
/* This is simply an alias for blake2b */ | ||
int blake2(void *out, size_t outlen, const void *in, size_t inlen, | ||
const void *key, size_t keylen); | ||
|
||
int blake2b_init_param(blake2b_state *S, const blake2b_param *P); | ||
|
||
#endif |
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
Oops, something went wrong.