This repository has been archived by the owner on Jan 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: ChainLock Asset Lock proof (#296)
Co-authored-by: Ivan Shumkov <ivan@shumkov.ru>
- Loading branch information
Showing
54 changed files
with
2,166 additions
and
1,111 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
23 changes: 23 additions & 0 deletions
23
lib/errors/IdentityAssetLockProofOutPointIsAlreadyUsedError.js
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,23 @@ | ||
const ConsensusError = require('./ConsensusError'); | ||
|
||
class IdentityAssetLockProofOutPointIsAlreadyUsedError extends ConsensusError { | ||
/** | ||
* | ||
* @param {Buffer} outPoint | ||
*/ | ||
constructor(outPoint) { | ||
super('Asset lock proof outPoint was already used'); | ||
|
||
this.outPoint = outPoint; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {Buffer} | ||
*/ | ||
getOutPoint() { | ||
return this.outPoint; | ||
} | ||
} | ||
|
||
module.exports = IdentityAssetLockProofOutPointIsAlreadyUsedError; |
23 changes: 23 additions & 0 deletions
23
lib/errors/IdentityAssetLockProofTransactionOutPointIsAlreadyUsedError.js
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,23 @@ | ||
const ConsensusError = require('./ConsensusError'); | ||
|
||
class IdentityAssetLockProofTransactionOutPointIsAlreadyUsedError extends ConsensusError { | ||
/** | ||
* | ||
* @param {Buffer} outPoint | ||
*/ | ||
constructor(outPoint) { | ||
super('Asset lock proof transaction outPoint was already used'); | ||
|
||
this.outPoint = outPoint; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {Buffer} | ||
*/ | ||
getOutPoint() { | ||
return this.outPoint; | ||
} | ||
} | ||
|
||
module.exports = IdentityAssetLockProofTransactionOutPointIsAlreadyUsedError; |
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,23 @@ | ||
const ConsensusError = require('./ConsensusError'); | ||
|
||
class IdentityAssetLockTransactionIsNotFoundError extends ConsensusError { | ||
/** | ||
* | ||
* @param {Buffer} outPoint | ||
*/ | ||
constructor(outPoint) { | ||
super('Asset Lock transaction with specified outPoint was not found'); | ||
|
||
this.outPoint = outPoint; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {Buffer} | ||
*/ | ||
getOutPoint() { | ||
return this.outPoint; | ||
} | ||
} | ||
|
||
module.exports = IdentityAssetLockTransactionIsNotFoundError; |
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,33 @@ | ||
const ConsensusError = require('./ConsensusError'); | ||
|
||
class InvalidIdentityAssetLockProofCoreHeightError extends ConsensusError { | ||
/** | ||
* | ||
* @param {number} proofCoreChainLockedHeight | ||
* @param {number} currentCoreChainLockedHeight | ||
*/ | ||
constructor(proofCoreChainLockedHeight, currentCoreChainLockedHeight) { | ||
super(`Asset Lock proof core chain height ${proofCoreChainLockedHeight} is higher than the current consensus core height ${currentCoreChainLockedHeight}.`); | ||
|
||
this.proofCoreChainLockedHeight = proofCoreChainLockedHeight; | ||
this.currentCoreChainLockedHeight = currentCoreChainLockedHeight; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getProofCoreChainLockedHeight() { | ||
return this.proofCoreChainLockedHeight; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getCurrentCoreChainLockedHeight() { | ||
return this.currentCoreChainLockedHeight; | ||
} | ||
} | ||
|
||
module.exports = InvalidIdentityAssetLockProofCoreHeightError; |
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,33 @@ | ||
const ConsensusError = require('./ConsensusError'); | ||
|
||
class InvalidAssetLockProofTransactionHeightError extends ConsensusError { | ||
/** | ||
* | ||
* @param {number} proofCoreChainLockedHeight | ||
* @param {number} transactionHeight | ||
*/ | ||
constructor(proofCoreChainLockedHeight, transactionHeight) { | ||
super(`Core chain locked height ${proofCoreChainLockedHeight} must be higher than block ${transactionHeight || ''} with Asset Lock transaction`); | ||
|
||
this.proofCoreChainLockedHeight = proofCoreChainLockedHeight; | ||
this.transactionHeight = transactionHeight; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getProofCoreChainLockedHeight() { | ||
return this.proofCoreChainLockedHeight; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getTransactionHeight() { | ||
return this.transactionHeight; | ||
} | ||
} | ||
|
||
module.exports = InvalidAssetLockProofTransactionHeightError; |
33 changes: 33 additions & 0 deletions
33
lib/errors/InvalidIdentityAssetLockProofCoreHeightError.js
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,33 @@ | ||
const ConsensusError = require('./ConsensusError'); | ||
|
||
class InvalidIdentityAssetLockProofCoreHeightError extends ConsensusError { | ||
/** | ||
* | ||
* @param {number} proofCoreChainLockedHeight | ||
* @param {number} currentCoreChainLockedHeight | ||
*/ | ||
constructor(proofCoreChainLockedHeight, currentCoreChainLockedHeight) { | ||
super(`Asset Lock proof core height ${proofCoreChainLockedHeight} is greater than current consensus core height ${currentCoreChainLockedHeight}.`); | ||
|
||
this.proofCoreChainLockedHeight = proofCoreChainLockedHeight; | ||
this.currentCoreChainLockedHeight = currentCoreChainLockedHeight; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getProofCoreChainLockedHeight() { | ||
return this.proofCoreChainLockedHeight; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getCurrentCoreChainLockedHeight() { | ||
return this.currentCoreChainLockedHeight; | ||
} | ||
} | ||
|
||
module.exports = InvalidIdentityAssetLockProofCoreHeightError; |
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,23 @@ | ||
const ConsensusError = require('./ConsensusError'); | ||
|
||
class UnknownAssetLockProofError extends ConsensusError { | ||
/** | ||
* | ||
* @param {number} type | ||
*/ | ||
constructor(type) { | ||
super('Unknown Asset lock proof type'); | ||
|
||
this.type = type; | ||
} | ||
|
||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getType() { | ||
return this.type; | ||
} | ||
} | ||
|
||
module.exports = UnknownAssetLockProofError; |
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
Oops, something went wrong.