Commit 726dd197 authored by Karl Floersch's avatar Karl Floersch

Add gas burn to enqueue

parent 68f886ec
......@@ -17,6 +17,13 @@ import { OVM_BaseQueue } from "./OVM_BaseQueue.sol";
*/
contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueue, Lib_AddressResolver {
/*********************************
* Contract Variables: Constants *
********************************/
uint constant public L2_GAS_DISCOUNT_DIVISOR = 10;
/*******************************************
* Contract Variables: Contract References *
*******************************************/
......@@ -58,6 +65,14 @@ contract OVM_L1ToL2TransactionQueue is iOVM_L1ToL2TransactionQueue, OVM_BaseQueu
override
public
{
require(_gasLimit >= 20000, "Gas limit too low.");
uint gasToBurn = _gasLimit / L2_GAS_DISCOUNT_DIVISOR;
uint startingGas = gasleft();
uint i;
while(startingGas - gasleft() > gasToBurn) {
i++; // TODO: Replace this dumb work with minting gas token.
}
Lib_OVMCodec.QueueElement memory element = Lib_OVMCodec.QueueElement({
timestamp: block.timestamp,
batchRoot: keccak256(abi.encodePacked(
......
......@@ -31,7 +31,7 @@ const makeQueueElements = (count: number): any => {
return [...Array(count)].map((el, idx) => {
return {
target: NON_ZERO_ADDRESS,
gasLimit: idx,
gasLimit: (idx + 1) * 20000,
data: DUMMY_BYTES32[0],
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment