-
Notifications
You must be signed in to change notification settings - Fork 279
feat(crypto): Switch block id to full SHA256 #2156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
fce548c
feat(crypto): Switch block id to full SHA256
vasild 8758d01
Merge remote-tracking branch 'ArkEcosystem/core/2.3' into blockid
vasild 3915086
fix(crypto): Use block height to query milestones, not id
vasild cb22138
feat(crypto): Handle previous block id wrt idFullSha256
vasild ecc9262
Merge remote-tracking branch 'ArkEcosystem/core/2.3' into blockid
vasild a01409a
Merge remote-tracking branch 'ArkEcosystem/core/2.3' into blockid
vasild 9ed5b22
test(core-forger): adjust sampleBlock
vasild b5e93bf
test(core-p2p): adjust fixture and validation schemas
vasild 6df24fc
test(core-debugger-cli): Adjust block fixture
vasild 71a8730
Merge remote-tracking branch 'ArkEcosystem/core/2.3' into blockid
vasild 26743af
Merge remote-tracking branch 'ArkEcosystem/core/2.3' into blockid
vasild 8b480c5
feat(crypto): Strengthen the block id check
vasild 2008688
Merge remote-tracking branch 'ArkEcosystem/core/2.3' into blockid
vasild 75d8952
Revert fixtures changes, new tests to be added for the new block id
vasild 6bac1a8
fix(crypto): Accept old/partial hex block id
vasild 4b08c95
feat(crypto): increase the height for activating full SHA256 block ids
vasild 15556e3
Merge remote-tracking branch 'ArkEcosystem/core/2.3' into blockid
vasild 20af8c5
test(crypto): fix and extend blockId validation test
vasild c53015b
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild 71753d4
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild 70386da
test(core-forger): Don't use devnet config from unit tests
vasild dddcb6e
feat(crypto): Lower devnet block.idFullSha256 milestone
vasild 84f3710
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild bb7b357
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild 2466311
Try to tweak the fixture block
vasild fee99c3
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild db19ae1
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild 613c639
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild 5fdc05c
test(core-tester-cli): adjust block fixture
vasild 0cd7177
test(core-forger): adjust block fixture
vasild ab2a493
test(crypto): adjust block fixtures
vasild 5b278e4
misc(crypto): adjust height to switch to full sha256 block ids
vasild 4f6edad
fix(crypto): Properly handle the first block with full sha256 id
vasild d58350e
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild 595ca11
Merge branch 'develop' into blockid
spkjp ec1d5f1
Merge remote-tracking branch 'ArkEcosystem/core/develop' into blockid
vasild a8b4085
misc(crypto): Lower devnet milestone for full sha256 block id
vasild f744941
misc(crypto): Introduce custom error class for prev block id mismatch
vasild 306463e
chore(crypto): rename a variable for readability
vasild d91fdf0
chore(crypto): Rename schema keyword for clarity
vasild File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| import { models } from "@arkecosystem/crypto"; | ||
|
|
||
| export const sampleBlock = new models.Block({ | ||
| id: "4398082439836560423", | ||
| id: "7686497416922799951", | ||
| version: 0, | ||
| timestamp: 35751416, | ||
| height: 3342573, | ||
| previousBlock: "14909996519459393858", | ||
| timestamp: 62225384, | ||
| height: 1760011, | ||
| previousBlock: "1111111111111111111", | ||
| numberOfTransactions: 0, | ||
| totalAmount: 0, | ||
| totalFee: 0, | ||
| reward: 200000000, | ||
| payloadLength: 0, | ||
| payloadHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | ||
| generatorPublicKey: "03806036bc1bb470144184b10f815431c580ae2b806d5fd0ba2118dca823c5c4a6", | ||
| generatorPublicKey: "03287bfebba4c7881a0509717e71b34b63f31e40021c321f89ae04f84be6d6ac37", | ||
| blockSignature: | ||
| // tslint:disable-next-line:max-line-length | ||
| "3045022100d0ad616575b1039b89ae22bb8efbce80dd14f52d193ef7a1d0a76fab0253aa4f02206a347bb5d4dc372e5a7ad3f16ae44409d9190fbd8138e9b4e99f83ca3236f91d", | ||
| "304402205b5da8a3cfb28398baaa50e299d735226c4455bdfdf5cb650afb53b0f22a93c60220572c4a4652edcd1bb85720884a7b0732add4dd50e7a0984325807770c99939bd", | ||
| }); |
200 changes: 93 additions & 107 deletions
200
__tests__/integration/core-tester-cli/__fixtures__/block.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
11 changes: 11 additions & 0 deletions
11
packages/core-api/src/versions/2/shared/schemas/block-id.ts
This file contains hidden or 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,11 @@ | ||
| import * as Joi from "joi"; | ||
|
|
||
| export const blockId = Joi.alternatives().try( | ||
| Joi.string() | ||
| .min(1) | ||
| .max(20) | ||
| .regex(/^[0-9]+$/, "decimal non-negative integer"), | ||
| Joi.string() | ||
| .length(64) | ||
| .hex(), | ||
| ); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -51,5 +51,11 @@ | |
| { | ||
| "height": 1750000, | ||
| "vendorFieldLength": 255 | ||
| }, | ||
| { | ||
| "height": 1840000, | ||
| "block": { | ||
| "idFullSha256": true | ||
| } | ||
| } | ||
| ] | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -39,5 +39,11 @@ | |
| { | ||
| "height": 8000000, | ||
| "vendorFieldLength": 255 | ||
| }, | ||
| { | ||
| "height": 8050000, | ||
| "block": { | ||
| "idFullSha256": true | ||
| } | ||
| } | ||
| ] | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -32,5 +32,11 @@ | |
| { | ||
| "height": 100000, | ||
| "vendorFieldLength": 255 | ||
| }, | ||
| { | ||
| "height": 1000000000, | ||
| "block": { | ||
| "idFullSha256": true | ||
| } | ||
| } | ||
| ] | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -32,5 +32,11 @@ | |
| { | ||
| "height": 100000, | ||
| "vendorFieldLength": 255 | ||
| }, | ||
| { | ||
| "height": 4000000, | ||
| "block": { | ||
| "idFullSha256": true | ||
| } | ||
| } | ||
| ] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.