Commit graph

203 commits

Author SHA1 Message Date
Jorge Timón
2de576525b
2WP: QA: Introduce -con_parent_chain_signblockscript
This allows other elements chains as parent chains for pegs, for testing purposes

for now it also assumes that the parent chain has CT/CA tx format,
which is orthogonal to the parent chain having pow or signed blocks

It would be nice to also test bitcoin-like chains with signed blocks
instead of pow by adding another parameter -con_parent_chain_has_CT or
similar and decouple the logic

Introduce -con_parent_pegged_asset option to check the asset in the
peg-in txs from the parent chains.

CT: Introduce GetAmountFromParentChainPegin for CT txs
RPC: Adapt rpcwallet to initial -con_parent_chain_has_pow
Introduce CheckProofGeneric
Introduce pow::CheckProofParent
2018-08-16 19:29:23 +02:00
Jorge Timón
38dc2e71b6
Chainparams: Introduce -con_has_parent_chain option 2018-07-21 22:53:15 +02:00
Jorge Timón
8682ddec8e
Remove unused line giving a warning 2018-07-11 01:25:16 +02:00
Gregory Sanders
146a95724e
Merge #370: Refactor: Validation: Make parts of IsValidPeginWitness templated
a20986b 2WP: Refactor out GetAmountFromParentChainPegin (Jorge Timón)
2be9cae Refactor: Validation: Make parts of IsValidPeginWitness templated (Jorge Timón)
2018-06-25 20:28:34 -04:00
Jorge Timón
a20986b40d
2WP: Refactor out GetAmountFromParentChainPegin 2018-06-14 19:27:29 +02:00
Jorge Timón
2be9cae539
Refactor: Validation: Make parts of IsValidPeginWitness templated
this should not change behavior
2018-06-14 19:27:25 +02:00
nkostoulas
1136ad3a96 Change initial issuance output to 1 2018-06-14 09:46:10 +01:00
Tim Ruffing
6f80bcedfe Remove redundant checks of size of range proof and surjection proof
The checks are redudant because too large range proofs and surjection
proofs will be rejected by libsecp256k1. Furthermore, the checks are not
precise, and they are anyway not present in other similar code locations.
2018-06-03 15:57:24 +02:00
Tim Ruffing
7ad4d950a4 Reject issuances with explicit values but non-empty range proofs 2018-06-03 15:57:24 +02:00
Gregory Sanders
884005be37
Merge #335: Fix range/surjection proof caching
4815bc6 simplify and speedup surjection proof caching (Gregory Sanders)
9572165 simplify rangeproof validation caching (Gregory Sanders)
92871c6 Actually cache range and surjection proofs (Gregory Sanders)
2018-05-30 10:35:12 -04:00
Gregory Sanders
1381c68e1b
Merge #359: Rework control flow in VerifyAmount()
05602ed Improve comments for VerifyAmount() (Tim Ruffing)
42b62ac Ensure that input witness is present before accessing range proofs (Tim Ruffing)
670229e Use new helper function to verify issuance of re-issuance tokens (Tim Ruffing)
d7abf18 Extract helper function from VerifyAmount() (Tim Ruffing)
e183868 Forbid explicit issuance of 0 asset units (Tim Ruffing)
bef2760 Assert return value of secp256k1_pedersen_commit() for issuances (Tim Ruffing)
46f2416 Remove old testing code (Tim Ruffing)
2018-05-29 13:19:23 -04:00
Tim Ruffing
b2a729c4a5 Remove overflow checks for explicit input amounts
This removes checks from the pre-asset era that reject amounts on the
input side of a transaction if these amounts overflow. The checks are
superficial because VerifyAmounts() already rejects input amounts that
could potentially overflow.

One of the removed checks is wrong because it rejects legitimate
transactions that spend more than MAX_MONEY asset units altogether,
even if those units belong to different assets. For example, a
transaction spending MAX_MONEY units of an asset "apple" and MAX_MONEY
units of an asset "orange" was previously rejected because the code
literally added apples and oranges in this case.
2018-05-25 18:51:48 +02:00
Tim Ruffing
05602edf6f Improve comments for VerifyAmount() 2018-05-24 22:17:51 +02:00
Tim Ruffing
42b62ac285 Ensure that input witness is present before accessing range proofs 2018-05-24 22:17:51 +02:00
Tim Ruffing
670229e060 Use new helper function to verify issuance of re-issuance tokens
This forbids the explicit issuance of 0 re-issuance tokens (like for the issuance of
normal assets. The proper way to issue no re-issuance tokens is to use a
null commitment for the amount.
2018-05-24 22:17:51 +02:00
Tim Ruffing
d7abf1870a Extract helper function from VerifyAmount() 2018-05-24 22:17:51 +02:00
Tim Ruffing
e183868516 Forbid explicit issuance of 0 asset units
The proper way to issue 0 units of an asset is a null commitment but not
an explicit commitment to 0.

This commit eliminates the issue that some checks in the verification of
the issuance of re-issuance tokes were skipped when issuing 0 asset units
explicitly. This commit also simplifies the control flow of the relevant
code locations.
2018-05-24 22:17:51 +02:00
Tim Ruffing
bef2760352 Assert return value of secp256k1_pedersen_commit() for issuances
secp256k1_pedersen_commit() is expected to succeed because the value and
the blinding factor are both 0.
2018-05-24 22:09:41 +02:00
Gregory Sanders
4815bc62cd simplify and speedup surjection proof caching 2018-04-25 10:47:16 -04:00
Gregory Sanders
d77df82196 parameterize the mandatory coinbase 2018-04-02 13:40:49 -07:00
Gregory Sanders
b628d91894 make peginconfirmationdepth a chain param 2018-03-28 12:47:25 -04:00
Gregory Sanders
e348f8248e simplify non-depth peg-in validity checking 2018-03-28 10:01:14 -04:00
Gregory Sanders
2d1a092ff2 fix segfault when block from disk has pegin failure 2018-03-26 12:18:57 -04:00
Gregory Sanders
fa34426ab1 remove witnessEnabled standardness logic 2018-03-13 12:20:24 -04:00
Gregory Sanders
d74234b422 commit genesis block transactions to txindex 2018-01-23 09:11:59 -05:00
Gregory Sanders
2ccbf87b04 skip balance checks when assumevalid is active 2017-12-11 11:00:55 -05:00
Gregory Sanders
7c7e23b898 HF: peg-in outputs in parent chain are p2sh-pw2sh 2017-11-07 17:34:12 -05:00
Gregory Sanders
da6960ddb7 validation variables changed to not assume witness program for pegin 2017-11-06 10:54:51 -05:00
Gregory Sanders
2940c4e0ea remove tabs from IsValidPegin 2017-11-06 10:54:51 -05:00
Gregory Sanders
7dc4f9d442 remove CNumScript from pegin witness logic 2017-11-06 10:54:51 -05:00
Gregory Sanders
abafbacd82 change rpc test witness_program to claim_script 2017-11-06 10:54:51 -05:00
Gregory Sanders
851a30b266 Don't restrict pegin witness to 'witness program' definition 2017-11-06 10:54:51 -05:00
Gregory Sanders
13c3dad52f de-dupe calculate_contract code 2017-11-06 10:54:51 -05:00
Gregory Sanders
4aad513939 Add unit tests for peg-in authorization 2017-11-06 10:54:51 -05:00
Gregory Sanders
ff5e9cd74d mempool and policy support for peg-in inputs 2017-11-06 10:54:50 -05:00
Gregory Sanders
6bad4e9d75 add blocks that have pegins rejected to the reconsider queue 2017-11-06 10:54:50 -05:00
Gregory Sanders
0b9c5eb0e0 begin consensus support for peg-ins 2017-11-06 10:54:50 -05:00
Gregory Sanders
34d7cd072f add pegin witness validation and extraction helper functions 2017-11-06 10:13:28 -05:00
Gregory Sanders
9a9ac25ee1 genesis block has actual fee issuance in regtest 2017-11-06 09:51:52 -05:00
Gregory Sanders
65ed777e6e remove legacy peg-in/withdrawlocks 2017-11-06 09:51:45 -05:00
Jorge Timón
a730159690
p2p: Remove opt-in part of RBF 2017-10-01 00:56:15 +02:00
Jorge Timón
e17e0b81b6
Remove -mempoolreplacement option 2017-09-23 09:27:17 +02:00
Gregory Sanders
9a0ff5c7f6
Merge #221: CSurjectionCheck copies vector instead of swapping
87c1fc2 CSurjectionCheck copies vector instead of swapping (Gregory Sanders)
2017-09-22 11:34:45 -04:00
Gregory Sanders
87c1fc29af CSurjectionCheck copies vector instead of swapping 2017-09-22 11:03:35 -04:00
Gregory Sanders
224f7b83be remove asserts from verifyamounts, test commitment types 2017-09-21 10:14:34 -04:00
Arvid Norberg
d8a18ef34f fix incorrect bounds check to wit.vtxinwit access in ContextualCheckBlock 2017-09-08 00:02:24 +02:00
Gregory Sanders
ae1f058433 Only use chainparams to access BITCOINID as pegged_asset 2017-08-24 14:30:35 -04:00
Gregory Sanders
cf9efd84fc Merge pull request #220 from instagibbs/revertcheck
Revert ownership of CCheck to QueueCheck, return ScriptError
2017-08-03 10:02:31 +09:00
Gregory Sanders
9823c8889c Allow mempool withdrawlocks to be grabbed by clients during pegin 2017-07-25 18:55:15 -04:00
Gregory Sanders
29b1f21c77 Free relay reserved entirely for withdrawlock spends, not rate limited 2017-07-19 10:31:09 -04:00