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

multi: rebase bcc onto staging #2

Merged
merged 5 commits into from
May 9, 2018
Merged

Conversation

tuxcanfly
Copy link
Member

Rebased, fixed merg conflicts.

@tuxcanfly
Copy link
Member Author

OK, ready for review.

@tuxcanfly tuxcanfly requested review from nodech and bucko13 May 2, 2018 11:24
@@ -59,7 +59,7 @@ class ChainDB {
this.logger.info('Opening ChainDB...');

await this.db.open();
await this.db.verify(layout.V.build(), 'chain', 5);
await this.db.verify(layout.V.build(), 'chain', 0x80 | 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this change for?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's a flag for the chain type, so as to not confuse between forks.

@@ -142,7 +142,7 @@ exports.USER_AGENT = `/bcoin:${pkg.version}/`;
* @default
*/

exports.MAX_MESSAGE = 4 * 1000 * 1000;
exports.MAX_MESSAGE = 8 * 1000 * 1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we account for the next hard fork to 32MB, surely we're not just going to manually change this at the exact right time?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, we need to do that in next hard fork PR.

@@ -458,7 +458,7 @@ class Block extends AbstractBlock {

// Count legacy sigops (do not count scripthash or witness).
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably want to update the comment too

Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

Going to leave this as it is harmless atm. Will note to revisit later.

edit: #4

@@ -506,40 +470,6 @@ class MTX extends TX {

// Witness program.
if (prev.isProgram()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we keeping this check for the testnet? For cash mainnet this should never be true right?

Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

There's probably a lot of code that can be ripped out. Will revisit later.

edit: #5


/**
* Maximum block weight (consensus).
* @const {Number}
* @default
*/

exports.MAX_BLOCK_WEIGHT = 4000000;
exports.MAX_BLOCK_WEIGHT = 4000000 * 8;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we even have block weight anymore? Is this just in case we miss a weight check somewhere?

Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

It might help with the merges to keep code similar.

edit: #4

* @default
*/

exports.MAX_FORK_BLOCK_SIZE = 8000000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about the upcoming fork here and below in terms of preparing for the hard fork.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, TBD.

@@ -346,7 +346,9 @@ exports.flags = {
VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM: 1 << 12,
VERIFY_MINIMALIF: 1 << 13,
VERIFY_NULLFAIL: 1 << 14,
VERIFY_WITNESS_PUBKEYTYPE: 1 << 15
VERIFY_WITNESS_PUBKEYTYPE: 1 << 15,
VERIFY_MAST: 1 << 16,
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a MAST flag in cash?

Copy link
Member

@nodech nodech May 9, 2018

Choose a reason for hiding this comment

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

nope, it is not.. This number is used as SCRIPT_ENABLE_REPLAY_PROTECTION.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

const mtp = await this.getMedianTime(prev);
if (mtp >= consensus.UAHF_TIME) {
state.flags = Script.flags.VERIFY_STRICTENC;
state.flags = Script.flags.VERIFY_SIGHASH_FORKID;
Copy link
Member

Choose a reason for hiding this comment

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

these need to be |= instead of =.

Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

This is coming from the rebase. We can check this later.

edit: #6

@@ -3096,40 +3095,27 @@ class Script {
throw new ScriptError('SIG_PUSHONLY');
}

if (flags & Script.flags.VERIFY_SIGHASH_FORKID)
Copy link
Member

@nodech nodech May 9, 2018

Choose a reason for hiding this comment

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

We might not need the check in Deployments this enables STRICTENC as well. : )

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably best to keep it.

Copy link
Member Author

@tuxcanfly tuxcanfly left a comment

Choose a reason for hiding this comment

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

LGTM, OK.

const mtp = await this.getMedianTime(prev);
if (mtp >= consensus.UAHF_TIME) {
state.flags = Script.flags.VERIFY_STRICTENC;
state.flags = Script.flags.VERIFY_SIGHASH_FORKID;
Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

This is coming from the rebase. We can check this later.

edit: #6

@@ -59,7 +59,7 @@ class ChainDB {
this.logger.info('Opening ChainDB...');

await this.db.open();
await this.db.verify(layout.V.build(), 'chain', 5);
await this.db.verify(layout.V.build(), 'chain', 0x80 | 5);
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's a flag for the chain type, so as to not confuse between forks.

@@ -142,7 +142,7 @@ exports.USER_AGENT = `/bcoin:${pkg.version}/`;
* @default
*/

exports.MAX_MESSAGE = 4 * 1000 * 1000;
exports.MAX_MESSAGE = 8 * 1000 * 1000;
Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, we need to do that in next hard fork PR.

@@ -458,7 +458,7 @@ class Block extends AbstractBlock {

// Count legacy sigops (do not count scripthash or witness).
Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

Going to leave this as it is harmless atm. Will note to revisit later.

edit: #4

@@ -506,40 +470,6 @@ class MTX extends TX {

// Witness program.
if (prev.isProgram()) {
Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

There's probably a lot of code that can be ripped out. Will revisit later.

edit: #5

* @default
*/

exports.MAX_FORK_BLOCK_SIZE = 8000000;
Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, TBD.


/**
* Maximum block weight (consensus).
* @const {Number}
* @default
*/

exports.MAX_BLOCK_WEIGHT = 4000000;
exports.MAX_BLOCK_WEIGHT = 4000000 * 8;
Copy link
Member Author

@tuxcanfly tuxcanfly May 9, 2018

Choose a reason for hiding this comment

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

It might help with the merges to keep code similar.

edit: #4

@@ -346,7 +346,9 @@ exports.flags = {
VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM: 1 << 12,
VERIFY_MINIMALIF: 1 << 13,
VERIFY_NULLFAIL: 1 << 14,
VERIFY_WITNESS_PUBKEYTYPE: 1 << 15
VERIFY_WITNESS_PUBKEYTYPE: 1 << 15,
VERIFY_MAST: 1 << 16,
Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@@ -3096,40 +3095,27 @@ class Script {
throw new ScriptError('SIG_PUSHONLY');
}

if (flags & Script.flags.VERIFY_SIGHASH_FORKID)
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably best to keep it.

@tuxcanfly tuxcanfly merged commit 62b6224 into bcoin-org:staging May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants