Repository navigation
Conversation
|
This PR targeted I retargeted it to |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Legatus audit: Changes requested (commit 8a2e44d)
Validation: 1,032 unit tests passed, 1 skipped. Full |
|
Legatus audit: Approved (commit cea441c) No blocking findings. The validator-creation bypass is fixed and covered by a regression test. Both mock types are rejected on hosted Studio; local creation still works. Validation: 1,033 unit tests passed, 1 skipped, with a clean rerun after an initial shutdown segmentation fault. Full |
|
/run-e2e all |
…d studio Fixes DXP-666 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
create_validator was the only validator-mutating endpoint without the hosted guard, letting callers register mocked validators in the shared registry and bypass the eth_sendRawTransaction sim_config check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cea441c to
0f5d19f
Compare
|
Legatus audit: Approved (commit 0f5d19f) No blocking findings. The rebased guard rejects mocked transaction validators before admission side effects, and validator creation remains protected. Validation: 1,903 unit tests passed, 7 skipped. Full |
|
/run-e2e all |
|
E2E status was updated. Follow the current E2E and merge checks on this PR. Detailed diagnostics are available internally. |
|
Legatus audit: Approved (commit 0f5d19f) No blocking findings. The head and diff are unchanged from the previous review. Fresh validation: 1,903 unit tests passed, 7 skipped. Full |
|
/run-e2e all |
|
E2E status was updated. Follow the current E2E and merge checks on this PR. Detailed diagnostics are available internally. |
danieljrc888
left a comment
There was a problem hiding this comment.
Reviewed at 0f5d19f. The guard is correct for what it detects and is low risk, but it does not deliver the outcome the ticket names (no persisted transaction on a hosted Studio executed by validators the sender controls).
1. The check is a denylist of two keys; the sender still controls the validators
_sim_config_has_mocked_validators (backend/protocol_rpc/endpoints.py) only looks for mock_response / mock_web_response in plugin_config. A sim_config.validators entry that supplies its own config, plugin and plugin_config is still accepted: the worker builds a virtual validator from it (backend/consensus/worker.py, the LLMProvider(...) branch when all three are present) and validate_provider accepts it. The transaction is persisted and executed by a provider configuration chosen by the sender, which is the same result as a mock through a different field.
Fix: on hosted, turn this into an allowlist for persisted transactions. Either reject any sim_config.validators entry that carries explicit config / plugin / plugin_config (so only get_default_provider_for(provider, model) is reachable), or reject sim_config.validators entirely on hosted and keep only genvm_datetime. Add tests for the custom provider case, not only for the two mock keys.
2. Smaller
- False positive: a validator with a mock key but
config/pluginnull is rejected although the worker would ignore itsplugin_configand fall back to the default provider. An allowlist removes this case. - The description says this PR adds the hosted guard on
sim_createValidator. That guard is already in the base (it came with #1801); the second commit only adds a test for it. Please correct the description. - The red "E2E Tests" run is not caused by this PR (the plan job crashed while resolving the matrix, nothing was built), and it ran against the old base before the retarget. It needs a rerun on
v0.124-dev.
Fixes DXP-666
What
eth_sendRawTransaction(send_raw_transactioninbackend/protocol_rpc/endpoints.py). WhenVITE_IS_HOSTED=true, it rejects anysim_configwhose validators have a non-emptyplugin_config.mock_responseorplugin_config.mock_web_response. The error isJSONRPCError(-32000, "Mocked validators are not allowed in hosted studio").@check_forbidden_method_in_hosted_studiotocreate_validator(sim_createValidator). It was the only validator-changing endpoint without this guard, so on hosted anyone could add a mocked validator to the shared registry. Transactions withoutsim_configwould then run on that validator and pass the new check. It now has the same guard asupdate_validator,create_random_validators,delete_validatorand the others.Why
On hosted studio, the endpoints that create or update validators and providers already go through
check_forbidden_method_in_hosted_studio. One path was still open:eth_sendRawTransactionacceptssim_config.validators. The worker uses those validators to run the persisted transaction (backend/consensus/worker.py, thesim_config.validatorssnapshot), andvalidators.Managerforwards their mock entries to GenVM as host data. So anyone could put a transaction on the shared hosted chain that was executed with made-up LLM or web responses.This replaces the closed #1320 with a narrower fix. That PR blocked
sim_configon hosted entirely; this one blocks only mocked validators.Assumptions
gen_call/sim_callwith mockedsim_configvalidators still work on hosted. They are read-only simulations that don't change shared state, and SDK/gltest mocking relies on them.sim_configstays allowed on hosted, for example custom real validators orgenvm_datetime. Only mocks are rejected, unlike fix: dont allow sim_config param in eth_sendRawTransaction endpoint #1320, which blocked allsim_config.validators.Manageruses to forward mocks: a key that is present and non-empty. An empty{}mock is a no-op, so it is allowed.sim_createValidatoris blocked entirely on hosted without an admin key, not only when the validator has mocks. This matches its sibling endpoints and the hosted frontend, which already hides validator editing (canUpdateValidatorsinfrontend/src/hooks/useConfig.ts). WithADMIN_API_KEYset, the endpoint now requiresadmin_key, like its siblings.VITE_IS_HOSTED == "true"convention. The error code is -32000, the same as fix: dont allow sim_config param in eth_sendRawTransaction endpoint #1320. HavingADMIN_API_KEYdoes not bypass the guard.Testing done
tests/unit/test_send_raw_transaction_hosted_mocks.py(15 cases): detection of LLM and web mocks, malformed input, rejection on hosted, and normal flow for non-hosted, unmocked and no-sim_configrequests, plus a regression test that hostedcreate_validatorwithmock_responseis rejected before any account or registry write.pytest tests/unit -n autoon Python 3.12 withbackend/requirements.txt: 1033 passed, 1 skipped.ruff checkandblack24.4.2 pass.🤖 Generated with Claude Code
Summary by CodeRabbit