Add persistent gas metering, multi-script selection, and setup/CLI improvements#10
Open
SandraOrtiz-wq wants to merge 4 commits into
Open
Add persistent gas metering, multi-script selection, and setup/CLI improvements#10SandraOrtiz-wq wants to merge 4 commits into
SandraOrtiz-wq wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
src/core/gas_meter.pythat records per-script_idcalls,errors, andbytes_out, supports daily UTC reset, and selects the least-used/healthiest script.DomainFronter(src/relay/domain_fronter.py) to persist counts on each recorded execution, log a compact gas summary every 30s, detect daily resets, warn and auto-switch when a script reaches 90% quota, and fall back when all scripts are exhausted.DomainFronter.GasMeterusage to CLImain.pywith--list-scriptsand--reset-gasflags to view or reset per-script counters, preserving backward-compatiblescript_idhandling.setup.py) to accept multiple script IDs, probe provided script endpoints, optionally configure an exit node (VPS/Cloudflare Worker), toggle relay-chain and features, and write an idempotentconfig.jsonwith a backup.src/core/adaptive_transport/engine.pythat temporarily blocks route switching when runtime metrics indicate high variance/loss.tests/test_gas_meter.pyforGasMeterbehavior andtests/test_adaptive_loss_pause.pyfor the adaptive loss-pause logic.Testing
PYTHONPATH=src pytest -q tests/test_gas_meter.py tests/test_adaptive_loss_pause.pyand all tests passed (2 passed).pytestinvocation withoutPYTHONPATH=srcfailed during collection due to import-path setup, which was resolved by running tests withPYTHONPATH=srcas shown above.GasMeter.record_call/get_usage/select_best_scriptand the adaptive engine's loss-pause triggering and behaved as expected.Codex Task