File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package aggregator
22
33import (
44 "fmt"
5+ "strconv"
56 "time"
67
78 "github.com/AvaProtocol/EigenLayer-AVS/core/auth"
@@ -44,11 +45,24 @@ func CreateAdminKey(configPath string, opt CreateApiKeyOption) error {
4445 roles [i ] = auth .ApiRole (v )
4546 }
4647
48+ // The verifier (aggregator/auth.go::verifyAuth) requires the JWT to have an
49+ // `aud` claim containing the smart wallet chain ID. r.chainID in the
50+ // verifier is sourced from the smart wallet RPC (see rpc_server.go), not
51+ // the EigenLayer RPC, so we must use SmartWallet.ChainID here too — using
52+ // the EigenLayer chain ID would silently break cross-chain configs (e.g.
53+ // EigenLayer on Ethereum + SmartWallet on Base). config.NewConfig already
54+ // populated SmartWallet.ChainID at startup, so no extra RPC dial is needed.
55+ if nodeConfig .SmartWallet == nil || nodeConfig .SmartWallet .ChainID == 0 {
56+ return fmt .Errorf ("smart wallet chain ID not populated in config; cannot build audience claim" )
57+ }
58+ audienceChainID := strconv .FormatInt (nodeConfig .SmartWallet .ChainID , 10 )
59+
4760 claims := & auth.APIClaim {
4861 RegisteredClaims : & jwt.RegisteredClaims {
4962 ExpiresAt : jwt .NewNumericDate (time .Now ().Add (time .Hour * 24 * 365 * 10 )),
50- Issuer : "AvaProtocol" ,
63+ Issuer : auth . Issuer ,
5164 Subject : opt .Subject ,
65+ Audience : jwt.ClaimStrings {audienceChainID },
5266 },
5367 Roles : roles ,
5468 }
You can’t perform that action at this time.
0 commit comments