Skip to content

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

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

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
@hugomrdias

Copy link
Copy Markdown
Member

Thanks for digging into this! Before we reintroduce client-side account stripping, can you check which Lotus version your foc-devnet instance is running (e.g. via web3_clientVersion)?

Lotus shipped a fix for eth_call / eth_estimateGas from non-existent and contract from addresses in v1.36.2 (July 27, 2026) via filecoin-project/lotus#13724, and Forest ported the same fix (ChainSafe/forest#7394 / ChainSafe/forest#7435 / ChainSafe/forest#7541).

Verification on default public RPCs

Testing eth_call (multicall3.aggregate3) with a random unfunded from address (0 balance, never seen on-chain) currently succeeds across all default Mainnet and Calibration endpoints:

Network Endpoint web3_clientVersion eth_call w/ unfunded from
Mainnet Glif 1.39.1+mainnet OK
Mainnet Ankr 1.39.1+mainnet OK
Mainnet dRPC Geth/v10.0.0/drpc OK
Calibration Glif forest/0.40.0 OK
Calibration Ankr 1.39.0+calibnet OK
Calibration dRPC Geth/v10.0.0/drpc OK

Why this likely reproduced on foc-devnet

The exact error string resolve address t410f…: actor not found only comes from Lotus ≤ v1.36.1 (in v1.36.2+, chain/stmgr/call.go intercepts ErrActorNotFound as ErrSenderValidationFailed and node/impl/eth/gas.go retries via ApplyOnStateWithGasSkipSenderValidation with an ephemeral placeholder actor).

FilOzone/foc-devnet bumped Lotus to v1.36.2 on Aug 3, 2026 (#165) and is currently on v1.39.1 (#233), so it looks like your local foc-devnet may be running a stale checkout or cached pre-v1.36.2 Lotus Docker image.

On up-to-date nodes (Lotus ≥ v1.36.2 / Forest ≥ 0.40.0), syncExpirations works without stripping the account — though omitting from would still avoid Lotus taking the two-pass fallback path on unfunded keys, and protect against stale self-hosted Lotus ≤ v1.36.1 nodes (where getExpirations still swallows 'actor not found' and returns zeros). Let's confirm your foc-devnet Lotus version first so we know whether this is just a stale local node or if we actually want the SDK-side workaround back.

@JAG-UK

JAG-UK commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

can you check which Lotus version your foc-devnet instance is running (e.g. via web3_clientVersion)?

Thanks, I'd missed the subtle behaviour of clean and was on a stale config (which amazingly worked for everything else!) - updated to latest devnet defaults and all good, this is not needed. Closing.

@JAG-UK JAG-UK closed this Nov 24, 2026
@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting review to 🎉 Done in FOC Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

2 participants