From 18bd83e5ec422e214d2d31dfa0542b737c6324fc Mon Sep 17 00:00:00 2001 From: Hyunsoo Shin Date: Fri, 24 Jul 2026 17:47:38 +0900 Subject: [PATCH] kip-249: sync AuctionTx with the v3.0 AuctionEntryPoint Add the searcher-signed maxGasPrice field (typehash, EIP-712 types, struct, domain version 0.0.2) and its effective-gas-price ceiling check, and note that call() reverts before the backrun if less than callGasLimit gas remains. --- KIPs/kip-249.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/KIPs/kip-249.md b/KIPs/kip-249.md index 7c3eab3..a7a84de 100644 --- a/KIPs/kip-249.md +++ b/KIPs/kip-249.md @@ -118,7 +118,7 @@ def filter_tx(txs, bidTargetTxs, earlyDeadline): The auction result will be `BidDetails`. ```py -auction_type_hash = keccak256("AuctionTx(bytes32 targetTxHash,uint256 blockNumber,address sender,address to,uint256 nonce,uint256 bid,uint256 callGasLimit,bytes data)") +auction_type_hash = keccak256("AuctionTx(bytes32 targetTxHash,uint256 blockNumber,address sender,address to,uint256 nonce,uint256 bid,uint256 maxGasPrice,uint256 callGasLimit,bytes data)") ``` Please note that it’s not the transaction, but the bid. @@ -134,6 +134,7 @@ class BidDetails: call_gas_limit: bytes # The gas limit of backrun logic call_data: bytes # The call data of backrun logic bid_amount: bytes # The bid amount in Kei + max_gas_price: int # The searcher-signed ceiling on the BidTx effective gas price from_signature: bytes # ECDSA.sign the hash typed data V4 with auction_type_hash based on EIP-712 by searcher's private key. auc_signature: bytes # ECDSA.sign the from_signature based on EIP-191 by auctioneer's private key ``` @@ -144,7 +145,7 @@ The EIP-712 domain and types for the `from_signature` are as follows: # Domain domain = { "name": "KAIA_AUCTION", - "version": "0.0.1", + "version": "0.0.2", "chainId": chain_id, "verifyingContract": entrypoint_addr, } @@ -158,6 +159,7 @@ types = { {"name": "to", "type": "address"}, {"name": "nonce", "type": "uint256"}, {"name": "bid", "type": "uint256"}, + {"name": "maxGasPrice", "type": "uint256"}, {"name": "callGasLimit", "type": "uint256"}, {"name": "data", "type": "bytes"}, ] @@ -174,6 +176,7 @@ The proposer verifies the `BidDetails` in the following order. 5. The `bid.sender` must not be in the winner list of the same block number if the new bid doesn't have the same target block and hash as the previous bid. 6. The `bid.from_signature` and `bid.auc_signature` must be valid. 1. The auctioneer address will come from the AuctionEntryPoint contract. +7. The effective gas price of the BidTx must be less or equal to `bid.max_gas_price`. --- @@ -220,7 +223,7 @@ The AuctionEntrypoint is a singleton smart contract that implements a function t | :----------------------------------------------: | | The execution sequence of BidTx | -The AuctionEntryPoint will verify auctionTx and will return/revert the transaction. Since the BidTx is bundled, the propose won’t pay the gas fee if it’s reverted, otherwise it will pay the gas fee. +The AuctionEntryPoint will verify auctionTx and will return/revert the transaction. Since the BidTx is bundled, the propose won’t pay the gas fee if it’s reverted, otherwise it will pay the gas fee. The AuctionEntryPoint reverts before the backrun call if less than `callGasLimit` gas remains, so a searcher is charged only when the backrun receives the signed `callGasLimit`. ```solidity interface IAuctionEntryPoint { @@ -233,6 +236,7 @@ interface IAuctionEntryPoint { address to; uint256 nonce; uint256 bid; + uint256 maxGasPrice; uint256 callGasLimit; bytes data; bytes auctioneerSig; @@ -358,7 +362,7 @@ Once the searchers deposit the KAIA into AuctionDepositVault, the auctioneer nod The auctioneer node will implement the following json-rpc APIs for searchers. Please note that the detail of the API usage will be shared with the auctioneer implementation. - `http:///api/v1/auction/send` - - Input: `{target_tx_hash, target_tx_raw, block_num, sender, nonce, to_addr, call_gas_limit, call_data, bid_amount, from_signature}` + - Input: `{target_tx_hash, target_tx_raw, block_num, sender, nonce, to_addr, call_gas_limit, call_data, bid_amount, max_gas_price, from_signature}` - Output: {error} After receiving the bid, the auctioneer verifies the the `Bid` in the following order: @@ -374,6 +378,7 @@ After receiving the bid, the auctioneer verifies the the `Bid` in the following 8. Verify if the searcher has enough deposit balance to pay the `bidAmount` and `gasFee`. - The `gasFee` is estimated by summing up the `Bid.callGasLimit` and `GAS_BUFFER` that covers the gas fee for the `BidTx`. - The `effetiveGasPrice` is estimated from the target transaction's `maxFeePerGas` and `maxPriorityFeePerGas`. +9. Verify the `effetiveGasPrice <= Bid.maxGasPrice`. If the validation passes, the auctioneer will insert the bid into auction.