Skip to content
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

Implement Schnorr Checksig / CheckDatasig Modifications to the Scripting System #134

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
01a847f
pkg: updated deps
jonajosejg Apr 23, 2019
23b69fd
script: Schnorr Flag / Segwit Recovery Flag Values added, along with …
jonajosejg Apr 23, 2019
7477cea
chain: MTP Activation For GreatWallActivation Hard-Fork added
jonajosejg Apr 23, 2019
0ca7dad
script: OP_CHECKSIG / OP_CHECKDATASIG opcodes modified w / Schnorr, E…
jonajosejg Apr 23, 2019
021337b
script-tests: Schnorr / Segwit-Recovery test data added
jonajosejg Apr 23, 2019
44416a4
script: Segwit-Recovery checks added to the Script Verification function
jonajosejg Apr 23, 2019
eb9ca7d
script: Segwit Recovery Flag Check fix
jonajosejg Apr 26, 2019
a222163
script: minor camelcase function naming
jonajosejg Apr 26, 2019
026c799
pkg: bcrypto update
jonajosejg Apr 30, 2019
707c609
script: minor
jonajosejg Apr 30, 2019
0e965af
script: minor
jonajosejg May 8, 2019
d30aa38
mempool: Schnorr Flag check added in transaction verification
jonajosejg May 12, 2019
bb35692
mempool: minor
jonajosejg May 14, 2019
fc361aa
script: remove compressed_pub_key flag from TX Standarness
jonajosejg May 15, 2019
560914f
script: SIG_PUSH_ONLY flags added to Standardness checks
jonajosejg May 15, 2019
4552f3e
protocol: May 15th Activation Checkpoint added
jonajosejg May 16, 2019
2622b63
changelog: May 15th Hard-Fork changes
jonajosejg May 16, 2019
1c312be
networks: revert back to previous lastCheckpoint
jonajosejg May 16, 2019
145b6d0
protocol: minimum chainwork updates to main / testnet
jonajosejg May 16, 2019
d83ff82
net: protocol messages increased to 2MB
jonajosejg May 16, 2019
40ed007
net: updated seeds
jonajosejg May 17, 2019
7eac0f6
script-test: minimal witness program check added
jonajosejg May 17, 2019
383a93d
protocol-test: Remove InvItem limit against previous Protocol MAX_MES…
jonajosejg May 17, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Bcash Release Notes & Changelog

## v1.2.0

This release includes:
- May 15th upgrade
- Implement Schnorr Signatures on both OP_CHECKSIG, OP_CHECKDATASIG Opcodes.
- Implement Segwit Script Recovery Mechanism.
- Remove VERIFY_COMPRESSED_PUBKEY from Script Standardness Checks.
- Update bcrypto
- bug fixes

## v1.1.0

This release includes:
- Nov 15 upgrade
- Nov 15 upgrade
- Implement and enforce canonical transaction order.
- Add OP_CHECKDATASIG and OP_CHECKDATASIGVERIFY.
- Enforce minimum transaction size of 100 bytes.
Expand Down
19 changes: 19 additions & 0 deletions lib/blockchain/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ class Chain extends AsyncEmitter {
state.flags |= Script.flags.VERIFY_CLEANSTACK;
}

if (mtp >= this.network.block.greatWallActivationTime) {
state.greatWallActivation = true;
state.flags |= Script.flags.VERIFY_SEGWIT_RECOVERY;
state.flags |= Script.flags.VERIFY_SCHNORR;
}

return state;
}

Expand Down Expand Up @@ -589,6 +595,9 @@ class Chain extends AsyncEmitter {

if (!this.state.hasMagneticAnomaly() && state.hasMagneticAnomaly())
this.logger.warning('Magnetic Anomaly has been activated.');

if (!this.state.hasGreatWallActivation() && state.hasGreatWallActivation())
this.logger.warning('Great Wall has been activated.');
this.state = state;
}

Expand Down Expand Up @@ -2929,6 +2938,7 @@ class DeploymentState {
this.bip34 = false;
this.daa = false;
this.magneticAnomaly = false;
this.greatWallActivation = false;
}

/**
Expand Down Expand Up @@ -3012,6 +3022,15 @@ class DeploymentState {
return this.magneticAnomaly;
}

/**
* Test whether great wall activation is active.
* @returns {Boolean}
*/

hasGreatWallActivation() {
return this.greatWallActivation;
}

/**
* Get max block size
* @returns {Number}
Expand Down
11 changes: 10 additions & 1 deletion lib/mempool/mempool.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,14 +1020,23 @@ class Mempool extends EventEmitter {
return;

if (flags & Script.flags.ONLY_STANDARD_VERIFY_FLAGS) {
flags &= ~Script.flags.ONLY_STANDARD_VERIFY_FLAGS;
flags &= ~Script.flags.ONLY_STANDARD_VERIFY_FLAGS
| Script.flags.VERIFY_SEGWIT_RECOVERY;

if (await tx.verifyAsync(view, flags, this.workers)) {
throw new VerifyError(tx,
'nonstandard',
'non-mandatory-script-verify-flag',
0);
}

if (await tx.verifyAsync(view,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle this stuff can be take out now that the upgrade has happened.

flags ^ Script.flags.VERIFY_SCHNORR, this.workers)) {
throw new VerifyError(tx,
'invalid',
'upgrade-conditional-script-failure',
0);
}
}

throw new VerifyError(tx,
Expand Down
4 changes: 2 additions & 2 deletions lib/net/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ exports.REQUIRED_SERVICES = 0
exports.USER_AGENT = `/bcash:${pkg.version}/`;

/**
* Max message size (~4mb with segwit, formerly 2mb)
* Max message size (2MB)
* @const {Number}
* @default
*/

exports.MAX_MESSAGE = 1 * 1000 * 1000;
exports.MAX_MESSAGE = 2 * 1024 * 1024;

/**
* Amount of time to ban misbheaving peers.
Expand Down
Loading