Skip to content

Commit

Permalink
Update testcase deps Version (#1)
Browse files Browse the repository at this point in the history
* Add generate_signing_message_hash

* Update ckb-* to 0.113.0

* Remove debug_utils
  • Loading branch information
joii2020 authored Jan 16, 2024
1 parent cd0a0e2 commit 7c8adac
Show file tree
Hide file tree
Showing 18 changed files with 10,502 additions and 634 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ fmt:

mol:
make omni_lock_mol
make cobuild_mol

c/xudt_rce_mol.h: c/xudt_rce.mol
${MOLC} --language c --schema-file $< > $@
Expand All @@ -88,6 +89,10 @@ build/omni_lock: build/omni_lock.o build/cobuild.o
cp $@ $@.debug
$(OBJCOPY) --strip-debug --strip-all $@

cobuild_mol:
${MOLC} --language rust --schema-file schemas/blockchain.mol > tests/omni_lock_rust/src/schemas/blockchain.rs
${MOLC} --language rust --schema-file schemas/basic.mol > tests/omni_lock_rust/src/schemas/basic.rs

clean:
rm -rf build/secp256k1_data_info_20210801.h build/dump_secp256k1_data_20210801
rm -rf build/secp256k1_data_20210801
Expand Down
78 changes: 78 additions & 0 deletions schemas/basic.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
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 {
seal: Bytes,
message: Message,
}

table SighashAllOnly {
seal: Bytes,
}

// TODO: under construction
table OtxStart {
start_input_cell: Uint32,
start_output_cell: Uint32,
start_cell_deps: Uint32,
start_header_deps: Uint32,
}

// TODO: under construction
table Otx {
lock: Bytes,
input_cells: Uint32,
output_cells: Uint32,
cell_deps: Uint32,
header_deps: Uint32,
message: Message,
}
119 changes: 119 additions & 0 deletions schemas/blockchain.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@

/* Basic Types */

// The `UintN` is used to store a `N` bits unsigned integer
// as a byte array in little endian.
array Uint32 [byte; 4];
array Uint64 [byte; 8];
array Uint128 [byte; 16];
array Byte32 [byte; 32];
array Uint256 [byte; 32];

vector Bytes <byte>;
option BytesOpt (Bytes);
vector BytesOptVec <BytesOpt>;
vector BytesVec <Bytes>;
vector Byte32Vec <Byte32>;

/* Types for Chain */

option ScriptOpt (Script);

array ProposalShortId [byte; 10];

vector UncleBlockVec <UncleBlock>;
vector TransactionVec <Transaction>;
vector ProposalShortIdVec <ProposalShortId>;
vector CellDepVec <CellDep>;
vector CellInputVec <CellInput>;
vector CellOutputVec <CellOutput>;

table Script {
code_hash: Byte32,
hash_type: byte,
args: Bytes,
}

struct OutPoint {
tx_hash: Byte32,
index: Uint32,
}

struct CellInput {
since: Uint64,
previous_output: OutPoint,
}

table CellOutput {
capacity: Uint64,
lock: Script,
type_: ScriptOpt,
}

struct CellDep {
out_point: OutPoint,
dep_type: byte,
}

table RawTransaction {
version: Uint32,
cell_deps: CellDepVec,
header_deps: Byte32Vec,
inputs: CellInputVec,
outputs: CellOutputVec,
outputs_data: BytesVec,
}

table Transaction {
raw: RawTransaction,
witnesses: BytesVec,
}

struct RawHeader {
version: Uint32,
compact_target: Uint32,
timestamp: Uint64,
number: Uint64,
epoch: Uint64,
parent_hash: Byte32,
transactions_root: Byte32,
proposals_hash: Byte32,
extra_hash: Byte32,
dao: Byte32,
}

struct Header {
raw: RawHeader,
nonce: Uint128,
}

table UncleBlock {
header: Header,
proposals: ProposalShortIdVec,
}

table Block {
header: Header,
uncles: UncleBlockVec,
transactions: TransactionVec,
proposals: ProposalShortIdVec,
}

table BlockV1 {
header: Header,
uncles: UncleBlockVec,
transactions: TransactionVec,
proposals: ProposalShortIdVec,
extension: Bytes,
}

table CellbaseWitness {
lock: Script,
message: Bytes,
}

table WitnessArgs {
lock: BytesOpt, // Lock args
input_type: BytesOpt, // Type args for input
output_type: BytesOpt, // Type args for output
}
Loading

0 comments on commit 7c8adac

Please sign in to comment.