Skip to content

fix(core): sync session key expirations without the key as sender - #1160

Open
JAG-UK wants to merge 1 commit into
FilOzone:masterfrom
JAG-UK:fix/session-key-expirations-unused-key
Open

JAG-UK wants to merge 1 commit into
FilOzone:masterfrom
JAG-UK:fix/session-key-expirations-unused-key

Conversation

@JAG-UK

@JAG-UK JAG-UK commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

A freshly authorized session key reads as never granted, so Synapse refuses it, until the key has held FIL.

Cause

  • SessionKey.syncExpirations calls getExpirations with the session key's own client. viem sends a client's account as from on eth_call.
  • Lotus rejects an eth_call from an address with no actor: resolve address t410f…: actor not found. A new session key has never held FIL, so it has none.
  • getExpirations treats actor not found as "nothing granted" and returns zeros.

#645 fixed this by stripping the account inside getExpirations. #909 moved read clients to the caller ("drop obsolete account-stripping tests"), but the session key still passes its account client, so the bug came back. It's in synapse-core 0.10.2 and current master.

Fix

syncExpirations builds an accountless client on the session key's own transport (custom({ request }), as #645 did) and reads through it. The actions keep #909's contract: callers pass the client they want.

Testing

  • New test in authorization-expiry.test.ts: syncExpirations sends no eth_call with a from. It fails without the fix.
  • pnpm turbo build lint and synapse-core's test:node (1181 tests) pass.
  • On foc-devnet (Lotus), a session key just authorized in the console and never funded:
    • before the fix, syncExpirations gives 0 for every permission, and filecoin-pin add fails with "never granted";
    • after it, it gives the real expiry for CreateDataSet and AddPieces;
    • a raw eth_call to authorizationExpiry answers with no from and with from set to the owner, and gives actor not found with from set to the session key.

🤖 Generated with Claude Code

SessionKey.syncExpirations read through the session key's own client, so
viem sent the session key as `from` on the eth_call. Lotus rejects a call
from an address with no actor ("actor not found"), which is what a session
key that has never held FIL is, and getExpirations reads that error as
nothing granted. A freshly authorized key therefore reported every scope as
never granted, and Synapse refused it.

FilOzone#645 fixed this inside getExpirations; FilOzone#909 moved read clients to the
caller and dropped that, so the session key now builds an accountless read
client on its own transport for the sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JAG-UK
JAG-UK requested a review from hugomrdias as a code owner November 20, 2026 21:40
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Nov 20, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

filecoin-encryption-envelope

npm i https://pkg.pr.new/filecoin-encryption-envelope@1160

@filoz/keysmith

npm i https://pkg.pr.new/@filoz/keysmith@1160

@filoz/synapse-core

npm i https://pkg.pr.new/@filoz/synapse-core@1160

@filoz/synapse-react

npm i https://pkg.pr.new/@filoz/synapse-react@1160

@filoz/synapse-sdk

npm i https://pkg.pr.new/@filoz/synapse-sdk@1160

commit: 685fcb2

@FilOzzy FilOzzy moved this from 📌 Triage to 🔎 Awaiting review in FOC Nov 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 Awaiting review

Development

Successfully merging this pull request may close these issues.

1 participant