Misc Tx Pool GC Rule After receiving a valid new transaction from an account: If there is an old transaction from the same sender with the same nonce, replace the old transaction if any of the conditions holds: the epoch_height of the new transaction is 200000 more than the old one the new transaction has a higher gas price the new transaction has the same gas price and a higher epoch_height If the transaction pool is full, try to garbage collect an old transaction: Try to garbage collect a transaction that has been packed (packed but not executed transactions will be inserted back to the tx pool later). This is the normal case when we receive a new transaction. If all transactions have not been packed, try to garbage a transaction that is not ready to be packed (with a non-consecutive nonce or not enough balance). If all transactions can be packed, choose a transaction (if an account has many ready transaction with consecutive nonces, only the one with the least nonce is considered here) with the least gas price. If the gas price is less than that of the newly received transaction, garbage collect this chosen old transaction. If the transaction pool is not full now, insert the new transaction. Otherwise, discard the new transaction. cfx_estimate 接口行为 参数缺省行为 当输入缺少一些域时,一些检查会被跳过。 没有指定 from 时,跳过所有和 balance 相关的检查。 没有指定 gas_price 时,忽略对交易费检查,忽略对 Sponsor Gas Upper Bound 的检查。 没有指定 nonce 时,自动填入当前正确的 nonce. (指定 nonce 时,按指定 nonce 执行,但交易不会因 nonce 失败) 没有指定 value 时,默认为 0 没有指定 data 时,默认为空 没有指定 to 时,默认为创建合约。 冗余参数 Estimate 本身是用来估计 gas 和 storage collateral, 但接口同时允许用户输入 gas 和 storage collateral. 这是一种“带着答案问问题”的请求,estimate 执行如下逻辑。 指定 gas 使用指定的 gas 进行交易执行,这是除 gas 消耗超出 15 million 上限外,唯一可能出现 OutOfGas 的情形。 如同时指定 from 和 gas_price ,会在估算交易执行时扣交易费。其余情形只会在交易执行结束后复检交易费。 指定 storage limit 估算交易执行时全程忽略传入的 storage_limit,在全部估算结束后,判断给定的 storage limit 是否足够。 💡 以上行为基本只影响报错逻辑,当没有报错时,Estimate 会忽略传入的参数,并返回估算的参数。因此,传入 gas 和 storage limit 意义不大。 其他 当 Storage 被 Sponsor 时,执行是不检查 storage_limit 的,这是 Conflux 自身的逻辑。 实现思路 在模拟执行时尽量删减逻辑检查,将逻辑检查推后至估出 gas 与 storage 消耗后。 Gas 消耗不受是否被 sponsor 影响,因此直接给足够大的 gas limit (不收交易费) 执行 Storage 消耗与是否被 sponsor 影响很大,因此跑两遍,分别是被 sponsor 和不被 sponsor. PoS 介绍 Conflux PoS Finality 文档目录