Skip to content

Commit

Permalink
Merge pull request #62 from Permissionless-Software-Foundation/ct-uns…
Browse files Browse the repository at this point in the history
…table

Adding contribution guidelines
  • Loading branch information
christroutner authored Oct 6, 2023
2 parents bb4f8ca + ec07438 commit 34b4ec2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

This code repository welcomes code contributions from other developers, but any submissions must satisfy the following constraints:

## Tests
Because thie code is *infrastructure* that runs the SLP token economy, 100% unit test coverage must be maintained. Any code submissions must include unit tests, and any submissions must not decrease the overall percentage of code coverage.

## Code Reviews
The GitHub repository has a branch protection rules on the `master` branch to prevent pull requests from being merged without a code review. Any developer who has landed a PR on a PSF code repository can review submissions.

## Index Regression
Prior to merging a PR, it's a good idea to run the indexer from SLP genesis to the current chain tip, to ensure that changes do not cause a regression error.

# Questions
If you have any questions or need guidence, reach on on the [Telegram channel](https://t.me/psf_slp).
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ npm install
## License

[GPLv2](./LICENSE.md)

## Contributing

Contribution are welcome! Check out the [Contribution guide](./CONTRIBUTING.md) for guidence on contributing to this repository.
17 changes: 17 additions & 0 deletions src/adapters/slp-indexer/lib/dag.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class DAG {
// console.log(`Large DAG detected: ${JSON.stringify(txidAry, null, 2)}`)
console.log(`Large DAG detected: ${txidAry.length} txs`)

// Dev note 10/6/23: This code path was created to handle a corner case,
// but it may no longer be necessary. This code is in place to detect
// the corner case and create mock data for unit tests. If this code
// path is no longer needed, it will be removed.
console.log('4 Stopping indexer to gather test data.')
process.exit(0)
}
Expand Down Expand Up @@ -140,6 +144,10 @@ class DAG {
// have already been considered. This is in hope that it will speed
// up validation, which became much slower after taking the code out.
} else if (parentTx.isValidSlp === false && txidAry.length > 30) {
// Dev note 10/6/23: This code path was created to handle a corner case,
// but it may no longer be necessary. This code is in place to detect
// the corner case and create mock data for unit tests. If this code
// path is no longer needed, it will be removed.
console.log('parentTx: ', parentTx)
console.log('1 Stopping indexer to gather test data.')
process.exit(0)
Expand Down Expand Up @@ -167,6 +175,10 @@ class DAG {
const isNFT = parentTx.tokenType !== 1
const groupTokenOnVin0 = parentTx.vin[0].tokenQty > 0
if (isNFT && !groupTokenOnVin0) {
// Dev note 10/6/23: This code path was created to handle a corner case,
// but it may no longer be necessary. This code is in place to detect
// the corner case and create mock data for unit tests. If this code
// path is no longer needed, it will be removed.
console.log('isNFT: ', isNFT)
console.log('groupTokenOnVin0: ', groupTokenOnVin0)
console.log('2 Stopping indexer to gather test data.')
Expand Down Expand Up @@ -203,6 +215,11 @@ class DAG {
const DAG_CUTOFF = 300
if (parentTx.isSlpTx && txidAry.length > DAG_CUTOFF && parentTx.isValidSlp) {
console.log(`-->Large DAG cut-off at ${DAG_CUTOFF} transactions. Assumed valid.`)

// Dev note 10/6/23: This code path was created to handle a corner case,
// but it may no longer be necessary. This code is in place to detect
// the corner case and create mock data for unit tests. If this code
// path is no longer needed, it will be removed.
console.log('3 Stopping indexer to gather test data.')
process.exit(0)

Expand Down
4 changes: 4 additions & 0 deletions src/adapters/slp-indexer/lib/filter-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ class FilterBlock {
if (!result) {
console.log(`deleteBurnedUtxos() errored on on txid ${txid}. Coinbase?`)

// Dev note 10/6/23: This code path was created to handle a corner case,
// but it may no longer be necessary. This code is in place to detect
// the corner case and create mock data for unit tests. If this code
// path is no longer needed, it will be removed.
console.log('Exiting to capture test data.')
process.exit(0)
}
Expand Down

0 comments on commit 34b4ec2

Please sign in to comment.