EIP-0008: New Transaction Validation with Just-In-Time Costing#11
EIP-0008: New Transaction Validation with Just-In-Time Costing#11aslesarenko wants to merge 16 commits intomasterfrom
Conversation
eip-0008.md
Outdated
|
|
||
| - All checks performed in Protocol v1 | ||
| - INPUTS contain at least one `p2pk(senderPk)` box | ||
| - current height is within `feeOut.R6` interval |
There was a problem hiding this comment.
Please note that the fee box is not a part of the protocol.
There was a problem hiding this comment.
This part of JIT costing depends on the concrete implementation of miner fees.
They are both "a part" or "not a part" of the protocol (whichever the definition of the protocol).
If some other fee protocol will be developed in future (if any), it should keep JIT costing in mind.
I consider JIT costing is more important than some abstract fee protocol flexibility.
Even if the new version of fees protocol will be added, it can always be made compatible with the needs of JIT costing.
There was a problem hiding this comment.
"All checks performed in Protocol v1" means protocol changes, right? On the definition of the protocol, see V() predicate in GKL 15.
There was a problem hiding this comment.
No, it means currently active protocol.
By this item I refer to all existing validation checks collectively.
Other items are new.
Clarified this in the text.
|
@aslesarenko I would like to propose to not to break UTXO semantics, bringing fee model (apart from storage rent component) into the protocol, vote for block intervals (which confronts with NiPoPoWs and not analyzed in a rigor way) etc. Also please note that not just miners bear validation costs but all the full-nodes propagating transactions. And current applications should stay. Thus let's discuss how to minimize changes, not to make a lot of reckless ones. |
Yes, this is the goal of doing "proposal first": discussion and clarification. To streamline the process, lets follow the following simple rules:
After collecting and clarifying the issues/questions in this way I can create the next version. |
robkorn
left a comment
There was a problem hiding this comment.
JIT costing is likely to be prohibitive to light clients which isn't great.
Please see my response above. |
|
@aslesarenko @polarker @robkorn Let me put this EIP in another perspective. In the first place, block validation (consensus-critical verification protocol) works in the same way regardless a costing procedure, if the procedure ensures that maximum time to validate a block (on commodity hardware) is defined by the cost limit per block, and also validation time is secure ( << expected block interval, so 1-2 seconds at most in case of Ergo). If costing procedure is correct (there are no mispriced instructions leading to spam attacks like Ethereum suffering from back in Autumn'2016), then there are no critical spam issues on this level, thanks to PoW making producing blocks a costly venture. Thus we should look and fix problems on other levels, namely, propagation and block assembly. In Bitcoin, a node propagating transactions is doing following steps: in the worst case, a failure happens during the last stage (signature validation). There were spam attacks against UTXO fetching stage (https://en.bitcoin.it/wiki/CVE-2013-2293). Currently, if transaction is not valid, a source peer got some penalty with a ban happening when penalty score reaching some threshold AFAIK. Similarly, in AOT-Ergo: in JIT-Ergo: However, in both cases the best spam strategy is the same: do a transaction with a cost about the limit but invalid signature. In regards with EIP-8, an attacker can use a heaviest WKC contract to avoid collateral boxes. Thus for both AOT- and JIT-Ergo, a solution is about finding a proper fee and penalization mechanism for the p2p network. Maybe also with breaking transactions into different classes (like standard and non-standard transactions in Bitcoin), but only on the mempool level. |
| The solution proposed (see [2], Lemma1) incentivizes correct execution of scripts by rational miners | ||
| under the condition that miners only accept to verify the transactions that has cost limit | ||
| bounded by `MaxTxCost = epsilon * MaxBlockCost / N` where `MaxBlockCost` is the limit on block | ||
| verification costs, `N` is the number of transactions in a block and `epsilon` is a |
There was a problem hiding this comment.
Miners could not calculate MaxTxCost when assembly a candidate block because N is not known
There was a problem hiding this comment.
MaxTxCost is fixed, same as MaxBlockCost, and can be adjusted via voting. Here epsilon is a variable which compensate for changes in N to preserve equation.
Please see the paper for rationale behind limiting per-transaction cost.
There was a problem hiding this comment.
N is the number of transactions in a block according to your definition. Blocks could have different numbers of transactions, so N is dynamic and therefore MaxTxCost. That's why I don't get it when you say MaxTxCost is fixed.
There was a problem hiding this comment.
N is known toverifiers, so it's not a problem for verifers. But N is unknown to block assemblies when building the block, so it will cause issues when preparing block candidates when txs are sorted according to reward efficiency. Let me try to give a concrete example in the following.
There was a problem hiding this comment.
Let's assume that MaxBlockCost = 100, epsilon = 1. In mempool, there are 11 txs: Tx(50), Tx(10) * 10 where the numbers inside the parenthesizes are tx costs. Let's also assume that the rewards per unit are the same for all these transactions. If the block assembler takes Tx(50) first, then there is no way for it to add other txs, because MaxTxCost will be lower than 50. The assembler could take the 10 transactions Tx(10) * 10, but this will make the assembly algorithm complicated in general. However, without MaxTxCost limit, the block assembler could simply take Tx(50), Tx(10) * 50 which is invalid in your proposal. Attackers could exploit MaxTxCost to make the MaxBlockCost underused using such kind of ideas.
There was a problem hiding this comment.
Epsilon is helper variable, which will not be used in practice. I brought it here in order to draw the parallels with the paper, but it also brings some confusion.
Epsilon is purely theoretical parameter, which is here to compensate for changes in N.
When N changes so does the epsilon, while other parameters of the equation are fixed.
There was a problem hiding this comment.
In that case, what would be the suggested values for MaxTxCost and MaxBlockCost? These values should be discussed and included in the proposal in my opinion.
There was a problem hiding this comment.
Probably yes, but they may also be voted, so I'm not sure we should put any specific value in the EIP.
eip-0008.md
Outdated
| 5) When `tx.accCost` is not predictable, which may happen when `tx` have at least one | ||
| context dependent script (i.e. at least one script have conditions on `HEIGHT`, | ||
| `CONTEXT.headers`, etc), then the sender can choose any value for `feeOut.value` and the | ||
| `costLimit` will be selected by the verifier (see [details](#maximum-transaction-cost)) |
There was a problem hiding this comment.
I think costLimit should also be able to be set by sender in this case. Only when a user does not set costLimit, the verifier will use MaxTxCost.
There was a problem hiding this comment.
@polarker Yes, if the users want they can put a value in tx.feeOut.R4, thus taking control of the tx cost limit. The MaxTxCost is only used if tx.feeOut.R4 is not present.
There was a problem hiding this comment.
the
costLimitwill be selected by the verifier
Then maybe this sentence should be improved a bit, as it gives me the impression that the costLimit is always unknown and set by the verifier.
There was a problem hiding this comment.
It is mentioned in other parts of the text, but yes, please propose your formulation.
There was a problem hiding this comment.
How about the following if I don't misunderstand the details:
When
tx.accCostis not predictable, which may happen whentxhas at least one context-dependent script (i.e. at least one script have conditions onHEIGHT,CONTEXT.headers, etc), then the sender can either 1) choose values forfeeOut.valueandcostPricebased on estimation, or 2) choose a value forfeeOut.valueand useMaxTxCostforcostPrice(see details)
| than `MaxTxCost`. The limit is computed as `costLimit = tx.feeOut.value / | ||
| tx.feeOut.R4[Long]` if the register is not empty, otherwise `costLimit = MaxTxCost`. | ||
| The value in the `R4` register is the NERG price of a unit of cost (`costPrice`). | ||
| The `MaxTxCost` parameter is described in the [section below](#maximum-transaction-cost). |
There was a problem hiding this comment.
Giving such semantics to R4 already breaks backwards compatibility for all the apps and standards using registers (mixer, EIP-4, DEX etc)
UPD:
Completely revised version:
rewardTxandchargeTxremoved thus senders are not penalized for invalid transactionscollatInputsare not required