Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) BlockDelaySecs(ctx context.Context) (uint64, error)
- func (c *Client) EthChainID(ctx context.Context) (uint64, error)
- func (c *Client) FetchBlock(ctx context.Context, k cid.Cid) (*types.BlockHeader, error)
- func (c *Client) FetchGenesis(ctx context.Context) (cid.Cid, error)
- func (c *Client) FetchHead(ctx context.Context) (*Head, error)
- func (c *Client) FetchTipsetByHeight(ctx context.Context, h abi.ChainEpoch) (*Head, error)
- func (c *Client) Get(ctx context.Context, k cid.Cid) ([]byte, error)
- func (c *Client) HeadEpoch(ctx context.Context) (abi.ChainEpoch, error)
- func (c *Client) MpoolPush(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)
- func (c *Client) StateActorCodeCIDs(ctx context.Context, networkVersion uint64) (map[string]cid.Cid, error)
- func (c *Client) StateNetworkName(ctx context.Context) (string, error)
- func (c *Client) StateNetworkVersion(ctx context.Context) (uint64, error)
- func (c *Client) TipsetCIDsByHeight(ctx context.Context, h abi.ChainEpoch) ([]cid.Cid, error)
- type Head
Constants ¶
const DefaultURL = "https://api.node.glif.io/rpc/v1"
DefaultURL is the canonical Glif node RPC.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Glif JSON-RPC client. Goroutine-safe.
func (*Client) BlockDelaySecs ¶
BlockDelaySecs queries Filecoin.Version and returns the BlockDelay field (block cadence in seconds). Mainnet = 30, calibration = 30, curio-fork docker devnet = 4. Devnet setups may customize this via the `//go:build 2k` variant, so we bind it at devnet-init time.
func (*Client) EthChainID ¶
EthChainID queries eth_chainId and returns the decimal chain identifier. The devnet-init path uses this to bind the devnet's EIP-155 chain ID into the Lantern config so `eth_chainId` + `net_version` on the daemon return the same value clients pass to `docker compose up` (Curio's devnet defaults to 31415926 / 0x1df5e76).
func (*Client) FetchBlock ¶
FetchBlock fetches a single BlockHeader by CID. We use ChainReadObj (which returns the raw CBOR bytes) and decode locally. This avoids the JSON serialisation roundtrip in ChainGetBlock and is byte-stable.
func (*Client) FetchGenesis ¶
FetchGenesis queries Filecoin.ChainGetGenesis and returns block 0's CID. The devnet-init path uses this to bind the local devnet's genesis into the Lantern config so /fil/hello/1.0.0 identifies the correct chain.
func (*Client) FetchTipsetByHeight ¶
FetchTipsetByHeight queries Filecoin.ChainGetTipSetByHeight at the given epoch, returning the block CIDs and (parent-state-root, parent-weight) of the first block in the tipset. Caller is responsible for fetching each block CID via Get(...) and verifying.
func (*Client) MpoolPush ¶
MpoolPush pushes a signed message via the upstream lotus RPC's Filecoin.MpoolPush method. Used by devnet mode (`--network devnet`) as the send-path sink for the local mpool: a single-node docker devnet can't form a gossipsub mesh, so the pubsub topic never propagates. The devnet's lotus accepts signed messages directly via this JSON-RPC method and does its own inclusion.
Trust posture: unchanged from #122. Devnet is single-source by design (operator owns the devnet). This method is NOT used on mainnet/ calibration; the gossipsub publisher path continues to be the only producer of network traffic there.
func (*Client) StateActorCodeCIDs ¶
func (c *Client) StateActorCodeCIDs(ctx context.Context, networkVersion uint64) (map[string]cid.Cid, error)
StateActorCodeCIDs queries Filecoin.StateActorCodeCIDs for the given network version and returns the actor-name -> code-CID map. A custom devnet (debug-compiled builtin-actors) ships code CIDs that are in no released bundle; recording them lets Lantern's actor registry decode devnet state that would otherwise be "unknown code CID".
func (*Client) StateNetworkName ¶
StateNetworkName queries Filecoin.StateNetworkName so a Lantern client pointed at an unknown network (devnet, forkline, ...) can discover the wire-name string libp2p protocols expect (gossipsub topics, DHT prefix).
func (*Client) StateNetworkVersion ¶
StateNetworkVersion queries Filecoin.StateNetworkVersion at the current head and returns the network version. The devnet-init path records it so the daemon can map the devnet's actor code CIDs to the right go-state- types actor-version decoders.
func (*Client) TipsetCIDsByHeight ¶
TipsetCIDsByHeight satisfies header/store.RPCSource.
type Head ¶
type Head struct {
Epoch abi.ChainEpoch
TipSetKey types.TipSetKey
StateRoot cid.Cid
ParentWeight big.Int
ParentMessageReceipts cid.Cid
}
Head returns the current tipset's (epoch, key, stateRoot, parentWeight). The shape mirrors Lotus' api.TipSet so we can build a Lantern TrustedRoot from it.