Skip to content

Commit

Permalink
feat(type): block header structure changes
Browse files Browse the repository at this point in the history
remove the seal field from the block header structure, instead, add a nonce field in the block
header structure

BREAKING CHANGE: block header structure changes
  • Loading branch information
Keith-CY committed Aug 24, 2019
1 parent 617487e commit ce48faf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 51 deletions.
5 changes: 1 addition & 4 deletions packages/ckb-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ ckb => await core.rpc.getBlock('0x89de946313839a8a77749b6218d4d7ab3513910c5ed860
hash:
'0x89de946313839a8a77749b6218d4d7ab3513910c5ed86040e5f38efd41e566d7',
number: 6905,
seal:
{ nonce: '17168453808346374945',
proof:
'0x6c040000e00d0000380f0000c22100002f2900001d2b0000c32b0000fc2c0000743f00008d4600000c480000e46c0000' },
nonce: '17168453808346374945',
timestamp: '1557653980138',
version: 0 },
uncles: [],
Expand Down
40 changes: 8 additions & 32 deletions packages/ckb-sdk-rpc/__tests__/formatters/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,7 @@
"number": "1024",
"parent_hash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactions_root": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b",
"uncles_count": "0",
Expand All @@ -291,10 +288,7 @@
"number": "1024",
"parentHash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87",
"proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactionsRoot": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b",
"unclesCount": "0",
Expand All @@ -321,10 +315,7 @@
"number": "1024",
"parent_hash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactions_root": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b",
"uncles_count": "0",
Expand Down Expand Up @@ -375,10 +366,7 @@
"number": "1024",
"parentHash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87",
"proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactionsRoot": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b",
"unclesCount": "0",
Expand Down Expand Up @@ -431,10 +419,7 @@
"number": "1024",
"parent_hash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactions_root": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b",
"uncles_count": "0",
Expand All @@ -453,10 +438,7 @@
"number": "1024",
"parentHash": "0x5eae6dfdac4b3099619a131975fd0be6da3c099eeaae8261182627a53548fc87",
"proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactionsRoot": "0x64a872caca3c7b671b64897230e88dec8800b594347d192661908a87f7fbcb9b",
"unclesCount": "0",
Expand Down Expand Up @@ -844,10 +826,7 @@
"number": "1024",
"parent_hash": "0x3533d5f0882a60d3b25b7dd57002a5d9eb591e89a98231e8abc5bf48f7ee0592",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactions_root": "0x81389ffabda2d1658c75a81e390a82b335d4cb849b2269d134b042fea9cb9513",
"uncles_count": "0",
Expand All @@ -863,10 +842,7 @@
"number": "1024",
"parentHash": "0x3533d5f0882a60d3b25b7dd57002a5d9eb591e89a98231e8abc5bf48f7ee0592",
"proposalsHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": {
"nonce": "0",
"proof": "0x"
},
"nonce": "0",
"timestamp": "1557311767",
"transactionsRoot": "0x81389ffabda2d1658c75a81e390a82b335d4cb849b2269d134b042fea9cb9513",
"unclesCount": "0",
Expand Down
4 changes: 1 addition & 3 deletions packages/ckb-sdk-rpc/types/CKB_RPC/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ declare module CKB_RPC {
}
export type LiveCellsByLockHash = LiveCellByLockHash[]

export type Seal = CKBComponents.Seal

export interface Header {
dao: DAO
difficulty: Difficulty
Expand All @@ -113,7 +111,7 @@ declare module CKB_RPC {
number: BlockNumber
parent_hash: Hash256
proposals_hash: Hash256
seal: Seal
nonce: CKBComponents.Nonce
timestamp: Timestamp
transactions_root: Hash256
uncles_count: Count
Expand Down
14 changes: 2 additions & 12 deletions packages/ckb-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,6 @@ declare namespace CKBComponents {

export type TransactionsByLockHash = TransactionByLockHash[]

/**
* @typedef @Seal
* @property nonce
* @property proof
*/
export interface Seal {
nonce: Nonce
proof: Uint8Array
}

/**
* @typedef BlockHeader, header of a block
* @property dao
Expand All @@ -193,7 +183,7 @@ declare namespace CKBComponents {
* @property number
* @property parentHash
* @property proposalsHash
* @property seal
* @property nonce
* @property timestamp
* @property transactionsRoot
* @property unclesCount
Expand All @@ -209,7 +199,7 @@ declare namespace CKBComponents {
number: BlockNumber
parentHash: Hash256
proposalsHash: Hash256
seal: Seal
nonce: Nonce
timestamp: Timestamp
transactionsRoot: Hash256
unclesCount: Count
Expand Down

0 comments on commit ce48faf

Please sign in to comment.