Many blockchain protocols must write to the chain on a deadline. A threshold wallet has to post key-share refreshes each epoch, or an attacker who slowly compromises devices wins. A storage provider has to post proofs that it still holds the data. The price of each write is set by a public auction for block space, and that price can jump by large factors for reasons unrelated to the protocol. Operators therefore face a recurring decision: submit now, or wait for fees to fall and risk missing the deadline. The obvious fix is to learn a submission policy from historical fee data. But a single fee history works like a simulator that has only ever rendered one world. A policy trained on it can memorize incidental regularities, such as "spikes clear within a few hours," and then fail when the market changes its behavior.
We propose to treat historical fee replay explicitly as a sim-to-real problem. The source domain is past fee trajectories. The target domain is a future market regime that the policy has not seen. We borrow the most successful idea from sensor sim-to-real transfer: instead of making training data cleaner, learn to corrupt it in realistic ways. Concretely, we train a trajectory-perturbation model with two goals. It should maximize the scheduling policy's cost, and a discriminator should still be unable to tell the perturbed trajectories from real held-out fee windows. The deliverable is this training-data generator, not one particular policy. We evaluate it by how much of the cross-regime performance gap it closes for both a two-parameter threshold rule and a deep reinforcement learning policy.
Core Claim
Fee-timing policies tuned on replayed history lose substantial performance when the fee regime shifts. A natural and fully observable instance of such a shift is Ethereum's London fork, which introduced EIP-1559. Realism-constrained adversarial augmentation of fee histories closes more of that gap than three simpler options: training on more history, random perturbation, and unconstrained worst-case training. The claim is falsifiable at two levels. First, the gap might be negligible, in which case the sim-to-real framing is unnecessary. Second, a well-tuned threshold rule on plain replay might match everything, in which case learning adds nothing. Both outcomes would be reported as results.
Grounding in Prior Work
Several papers document the problem itself. Refresh When You Wake Up builds proactive threshold wallets and notes that gas spikes make periodic refreshes prohibitive, which pushes operators to skip them. Towards Privacy-assured and Lightweight On-chain Auditing of Decentralized Storage makes its audit cost constant in gas units, but observes that the gas price still makes operating margins unpredictable. Cost Fairness for Blockchain-Based Two-Party Exchange Protocols shows that deployment gas is lost outright when a counterparty stalls. None of these papers proposes a way to time submissions.
Two lines of work constrain the design. Empirical Analysis of EIP-1559 shows that the fork reduced within-block fee variance and cut median waiting time from 16.9 s to 10.4 s. It did not suppress day-scale fee levels, and it shifted miner revenue toward extractable value. Together these results say that the fork changed the character of the fee process rather than removing its volatility, which is exactly what makes it a good domain split. V-Gas and the solc estimator address how many gas units a call consumes, not what each unit costs. We take gas units as known and model only price.
The testnet-gap papers motivate the framing but pose a weaker version of the question. Biometric Template Storage With Blockchain finds that Ropsten cost models fail on mainnet. FRESCO evaluates on a congestion-free Ganache emulator and says so explicitly. In both cases the "simulator" lacks a fee market entirely, so any fee model would beat it. Our harder claim is that even real mainnet history is a biased simulator of the future market.
The method draws on the sim-to-real literature. Adversarially Masking Synthetic to Mimic Real learns Gumbel-Softmax dropout masks that corrupt clean synthetic LiDAR until it resembles real scans. This raises SynLiDAR→SemanticKITTI segmentation accuracy (mean intersection-over-union) from 15.2% to 22.8%, against an oracle of 55.5%. We adopt both its "corrupt the source" idea and its oracle-gap reporting. Unsupervised Pixel-Level Domain Adaptation with GANs supplies the pairing of an adversarial realism critic with a task loss, which we transplant from images to time series. Driving in the Matrix shows that synthetic diversity at scale can beat real data on a new domain (KITTI Hard: 0.4207 vs 0.3566 mean average precision), which supports augmentation over collecting more real data. The scheduling side reuses the setup of Cost Optimization for Serverless Edge Computing with Budget Constraints using DRL, where PPO and DQN agents come within 3% of an exact integer-programming solver. That work assumes fixed unit prices and never tests transfer, and relaxing both assumptions is the point of this proposal.
Research Program
The task. A protocol must land one transaction of known gas size within a window of $H$ blocks. At each block the policy observes recent fee history and blocks remaining, then chooses to wait or submit at the current price. Missing the deadline incurs a penalty $M$. The penalty stands in for a skipped key refresh or a failed audit, and we sweep it from lenient to severe. We report mean cost, the average cost over the worst 5% of windows (conditional value-at-risk), and the deadline-miss rate. The price series comes from the Google BigQuery Ethereum dataset: the median gas price paid per block before the fork, and the base fee per gas after it. Inclusion is modeled as guaranteed when the bid is at least the price. This deliberately ignores tip competition, and we state that as a limitation.
The perturbation model. The generator $g$ takes a real fee window $x$ and applies a learned monotone time-warp plus multiplicative log-level shifts. This lets it stretch or compress spikes, shift their onsets, and splice regime segments, while keeping the local shape of real fee movements. A discriminator $D$ is trained to separate $g(x)$ from real windows drawn from the source period. The objective is
$$\min_{\pi}\ \max_{g}\ \mathbb{E}_{x}\big[C(\pi, g(x))\big] \;-\; \lambda\, \mathbb{E}_{x}\big[\log\big(1 - D(g(x))\big)\big],$$
where $\pi$ is the submission policy, $C$ is fee paid plus $M$ times the miss indicator, and $\lambda$ sets how strongly the perturbations must look real. As $\lambda \to 0$ the objective reduces to plain worst-case training. With a large $\lambda$ and no cost term, it reduces to GAN data generation. Both limits serve as ablations. Policies are trained by alternating updates, and the policy class is either a two-parameter threshold rule (submit when price falls below a quantile of recent history, or when fewer than $k$ blocks remain) or a PPO agent.
The domain splits. The primary split trains on the months before the London fork and tests on the months after it. Price semantics differ across this split, so levels are normalized to recent history, and the test measures whether the policy learned timing structure rather than absolute prices. The secondary split uses only post-fork data, training on an earlier period and testing on a later one. The oracle for each split is the same policy class trained on the target period itself. The gap-closure fraction is (method − source-only) / (oracle − source-only), in the style of ASM.
Baselines
The naive reference is submit-immediately, which pays whatever the price is when the window opens and never misses a deadline. Beside it we run submit-at-deadline, which captures any average downward drift in fees but eats every spike. Any method must beat both on mean cost at matched miss rate, or it is useless.
The strongest simple competitor is the quantile-threshold rule, tuned by grid search on plain historical replay. It is transparent, cheap, and plausibly near-optimal for a one-shot deadline problem. The strongest learned competitor is PPO trained on plain replay with random window start points, following the agent design of Chen et al.. That paper reports costs within a factor of 1.03 of the Midaco integer-programming solver, but on a different task with fixed prices. We found no reported result on Lacuna for deadline-constrained submission timing on Ethereum fee traces, so we will compute an offline hindsight-optimal lower bound on each test window as the absolute reference.
The parametric domain-randomization baseline trains on replay with random time-stretching and level scaling drawn from hand-set ranges. The ablations are the $\lambda \to 0$ unconstrained adversary and a GAN-only generator with no adversarial cost term. Together they isolate whether the gain comes from targeting the policy's weaknesses, from realism, or from their combination.
For fairness, every method sees the same source windows, the same policy classes, the same number of environment steps, and the same budget of 30 hyperparameter configurations, all selected on a source-period validation split. Beating the field means a higher gap-closure fraction on worst-5% cost at a miss rate no higher than the best baseline's, for both policy classes, with bootstrap confidence intervals over test windows.
Why not just…?
Why not just train on all available mainnet history? Real data is abundant here, unlike in robotics, and this is the most serious objection. But "all history" at deployment time still excludes the future regime, and the EIP-1559 study shows that regimes do change qualitatively. The secondary split tests this directly: we compare adding more real source months against adding augmented trajectories while holding the number of training steps fixed. If extra real months close the gap equally well, the augmentation has no value, and we will say so.
Why not just use a tuned threshold rule? It may well be enough. That is why we train the threshold rule itself on the augmented data rather than pitting only neural policies against it. If augmentation shifts the rule's tuned parameters and those parameters transfer better across the fork, the contribution holds even with the simplest policy.
Why not just forecast the fee and optimize against the forecast? Forecast-then-plan inherits the same source-period bias, because a forecaster fitted before the fork learns pre-fork spike dynamics. We include a forecasting variant (a quantile forecaster followed by a threshold) trained on plain replay and on augmented replay. The question is again which training data transfers, not which policy architecture.
Why not just randomize the fees? Hand-set randomization is the standard sim-to-real move. The ASM results suggest that learned, targeted corruption beats uninformed corruption. Whether that holds for fee time series is exactly what the domain-randomization comparison settles.
Decisive Checks
The first check is whether the gap exists at all. If source-only policies reach within noise of the oracle on the London split, the project stops. The second is the shortcut probe: we stratify test windows by spike duration and flag strata whose durations never appeared in the source period. The proposal predicts that plain-replay policies degrade specifically in those strata, and that the augmented policies degrade less. The third is realism: a separate classifier trained after the fact should fail to distinguish generated from real windows. Otherwise the gains could come from training on implausible worlds, which would make them an artifact rather than robustness. The fourth is a sweep of the penalty $M$. Robustness should matter most when misses are expensive, which is exactly the proactive-refresh setting that motivates the work.
References
- Refresh When You Wake Up: Proactive Threshold Wallets with Offline Devices
- Towards Privacy-assured and Lightweight On-chain Auditing of Decentralized Storage
- Cost Fairness for Blockchain-Based Two-Party Exchange Protocols
- Empirical Analysis of EIP-1559: Transaction Fees, Waiting Times, and Consensus Security
- V-Gas: Generating High Gas Consumption Inputs to Avoid Out-of-Gas Vulnerability
- Biometric Template Storage With Blockchain: A First Look Into Cost and Performance Tradeoffs
- FRESCO: Fast and Reliable Edge Offloading With Reputation-Based Hybrid Smart Contracts
- Adversarially Masking Synthetic to Mimic Real: Adaptive Noise Injection for Point Cloud Segmentation Adaptation
- Unsupervised Pixel-Level Domain Adaptation with Generative Adversarial Networks
- Driving in the Matrix: Can virtual worlds replace human-generated annotations for real world tasks?
- Cost Optimization for Serverless Edge Computing with Budget Constraints Using Deep Reinforcement Learning