Repository navigation
D2 — a key that places orders and nothing else, and flet acts only while the venue lists it - #33
Draft
napkinstack-agent[bot] wants to merge 1 commit into
Draft
napkinstack-agent[bot] wants to merge 1 commit into
napkinstack-agent[bot] wants to merge 1 commit into
Conversation
…ile the venue lists it `copying authorise` generates a fresh agent for a member and prints what to approve on the venue's API page: the address, and the name `flet valid_until <30 days>`. `status` asks the venue — once, no retry — and says alive, not listed, or no answer, which are three different things. `forget` drops flet's copy and says in as many words that it does not revoke. Everything that would act for a member goes through `act_for`, which runs the action only if the venue's `extraAgents` lists our agent unexpired. Not listed after having been seen, or listed expired, deletes the key. Not yet approved keeps it until its own expiry. An unheard venue raises NoAnswer and changes nothing: egress denied is not a revocation. At rest: Fernet, one file per member, created 0600, written atomically. The member address is validated before it names a file. The key is kept out of the dataclass's repr, and one test runs every command path with the key known and searches stdout, stderr and every log record for it. The venue tests are the oracle for criteria 1 to 3 and they are written but NOT RUN: they need the decider's funded testnet wallet. They attempt each forbidden action as the agent and assert the member's funds and agents did not move — a refusal alone could be the agent's own empty account refusing, since a user-signed action is attributed to whoever signs it. Offline: 45 passed, 12 skipped (the venue tests). Ten hand mutants of the guard, the venue reader, the store, the key and the command: all ten killed, the last one after adding the assertion it exposed. Agent-Session: 98242fbe-7c26-467e-a3e9-e8816ec93493 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
D2 — a key that places orders and nothing else, and flet acts only while the venue lists it
Module
modules/copying— exactly one.cross-modulelabel is required, justification belowDeliverable
Deliverable: D2
What it changes
A member can now be handed a key, and nothing in flet can act on it unless the venue says it
lives.
copying authorise MEMBERgenerates a fresh agent and prints what to approve on thevenue's API page: the address and the name
flet valid_until <30 days>.copying status MEMBERasks the venue once, no retry, and says one of three differentthings: alive (per the venue), not listed or expired (flet will not act), or no answer —
exit 3, nothing done, nothing concluded.
copying forget MEMBERdrops flet's copy and says it does not revoke.act_foris the only way to act for a member: it runs the action only ifextraAgentslistsour agent unexpired. Seen once and then absent, or listed expired → the key is deleted. Not
yet approved → kept until its own expiry. Unheard venue →
NoAnswer, key kept.0600, written atomically; the member addressis validated before it names a file; the key is excluded from the dataclass's
repr.Why the venue tests read the member's funds and not only the refusal. A user-signed action
(withdrawal, transfer, approval) is attributed to whoever signs it. Signed by the agent, the
venue may refuse because the agent's own account is empty — which says nothing about the
member's. So each forbidden-action test also asserts the member's perp and spot balances and
their agent list did not move.
Oracle
Kind of oracle: unit test · integration (venue testnet, not yet run)
Hand mutants, offline suite: 10 applied, each verified applied,
__pycache__cleared betweenthem — all 10 killed. The tenth (deleting a key the venue lists expired but we never saw alive)
survived first and the assertion it exposed was added.
Review budget
criticalmodulethe tests are the deliverable — one per forbidden action by the criterion's own wording.
Splitting the code from its oracle would put untested key-handling code on
main.Contracts
Test sheet
Verifier: <to be named — a session that is not 98242fbe-7c26-467e-a3e9-e8816ec93493>
validUntilwe asked for, anduserRoleof the agent names the membertest_the_venue_lists_the_agent_with_the_expiry_we_asked_fortest_the_agent_can_place_and_cancel_an_orderwithdraw3,usdSend,spotSend,usdClassTransfer,sendAsset,approveAgent,approveBuilderFee, then each is refused, the refusal is recorded, and the member's funds and agents are unchangedtest_the_venue_refuses_the_agent[*], 7 casestest_after_revocation_the_venue_refuses_an_ordertest_after_expiry_the_venue_refuses_an_ordertest_after_revocation_flet_does_nothing+test_guard.pytest_the_key_appears_in_no_output_and_no_log_on_any_path,test_store.pyflet valid_until …, then the page accepts the name and the venue lists the expirySummary
DONE
act_forguard, and theauthorise/status/forgetcommand.commands.check,test,bootstrapdeclared;AGENTS.mdandREADME.mdupdated.VERIFIED
nstack check copying0 ·nstack test copying45 passed, 12 skipped ·nstack fitness0.extraAgentsreturns a list,userRolea role, USDC'sspot token id and BTC's
szDecimalsare what the tests assume.ASSUMED
validUntilis in milliseconds, like every other venue timestamp. S1 establishes it.flet valid_until …included — deregistersit. The docs say "a matching name" without saying whether the
valid_untilsuffix is part ofit. S4 establishes it; if it does not hold, the member's path is the API page's removal.
valid_until(S8).NOT VERIFIED
FLET_TESTNET_MAIN_KEY.convertToMultiSigUser,vaultTransferandsubAccountTransferare not attempted: the firstwould, if accepted, lock the test account; the other two need a vault or a sub-account the
test account does not have. Named here rather than silently omitted.
on a run is unknown until one runs.
RISKS
incident for every member.
statusbuilds the SDK'sInfo, which reads the venue while being constructed; any failurethere is reported as no answer, by design.
Signals to report
criticalmodules🤖 Generated with Claude Code