-
Notifications
You must be signed in to change notification settings - Fork 68
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
Conversation
OK, ready for review. |
@@ -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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 =
.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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. : )
There was a problem hiding this comment.
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.
There was a problem hiding this 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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
Rebased, fixed merg conflicts.