Documentation
¶
Index ¶
- Constants
- func CheckFlags()
- func MakeDeposit()
- func OpenChannel()
- func QueryDeposit()
- func QueryPeerOsps()
- func RegisterStream()
- func SendToken()
- type Processor
- func (p *Processor) ConfigXnet()
- func (p *Processor) ConfirmSettle()
- func (p *Processor) ConfirmWithdraw()
- func (p *Processor) DeleteBridgeRouting()
- func (p *Processor) DeleteNetBridge()
- func (p *Processor) DeleteNetToken()
- func (p *Processor) DeregisterRouter()
- func (p *Processor) IntendSettle()
- func (p *Processor) IntendWithdraw()
- func (p *Processor) NativeWrapDeposit()
- func (p *Processor) NativeWrapWithdraw()
- func (p *Processor) RegisterRouter()
- func (p *Processor) SetBridgeRouting()
- func (p *Processor) SetNetBridge()
- func (p *Processor) SetNetId()
- func (p *Processor) SetNetToken()
- func (p *Processor) Setup(db, ospkey, disputer bool)
- func (p *Processor) ViewAppOnChain()
- func (p *Processor) ViewChannel()
- func (p *Processor) ViewChannelOnChain()
- func (p *Processor) ViewDeposit()
- func (p *Processor) ViewPay()
- func (p *Processor) ViewPayOnChain()
- func (p *Processor) ViewRoute()
- func (p *Processor) ViewTxOnChain()
- func (p *Processor) ViewXnet()
- func (p *Processor) ViewXnetPay()
- type XnetConfig
Constants ¶
const (
DaySeconds = 86400
)
Variables ¶
This section is empty.
Functions ¶
func CheckFlags ¶
func CheckFlags()
func MakeDeposit ¶
func MakeDeposit()
func OpenChannel ¶
func OpenChannel()
func QueryDeposit ¶
func QueryDeposit()
func QueryPeerOsps ¶
func QueryPeerOsps()
func RegisterStream ¶
func RegisterStream()
Types ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func (*Processor) ConfigXnet ¶
func (p *Processor) ConfigXnet()
func (*Processor) ConfirmSettle ¶
func (p *Processor) ConfirmSettle()
func (*Processor) ConfirmWithdraw ¶
func (p *Processor) ConfirmWithdraw()
func (*Processor) DeleteBridgeRouting ¶
func (p *Processor) DeleteBridgeRouting()
func (*Processor) DeleteNetBridge ¶
func (p *Processor) DeleteNetBridge()
func (*Processor) DeleteNetToken ¶
func (p *Processor) DeleteNetToken()
func (*Processor) DeregisterRouter ¶
func (p *Processor) DeregisterRouter()
func (*Processor) IntendSettle ¶
func (p *Processor) IntendSettle()
func (*Processor) IntendWithdraw ¶
func (p *Processor) IntendWithdraw()
func (*Processor) NativeWrapDeposit ¶ added in v1.3.0
func (p *Processor) NativeWrapDeposit()
NativeWrapDeposit wraps native (e.g., ETH) into the chain's canonical wrapped-native (WETH-style) contract under the OSP's own balance, then approves CelerLedger to transferFrom that wrapped balance — the funding-flow shape CelerLedger expects when the OSP is the non-msgValueReceiver peer of an open-channel call.
func (*Processor) NativeWrapWithdraw ¶ added in v1.3.0
func (p *Processor) NativeWrapWithdraw()
NativeWrapWithdraw unwraps the OSP's wrapped-native balance back to native.
func (*Processor) RegisterRouter ¶
func (p *Processor) RegisterRouter()
func (*Processor) SetBridgeRouting ¶
func (p *Processor) SetBridgeRouting()
func (*Processor) SetNetBridge ¶
func (p *Processor) SetNetBridge()
func (*Processor) SetNetToken ¶
func (p *Processor) SetNetToken()
func (*Processor) ViewAppOnChain ¶
func (p *Processor) ViewAppOnChain()
func (*Processor) ViewChannel ¶
func (p *Processor) ViewChannel()
func (*Processor) ViewChannelOnChain ¶
func (p *Processor) ViewChannelOnChain()
func (*Processor) ViewDeposit ¶
func (p *Processor) ViewDeposit()
func (*Processor) ViewPayOnChain ¶
func (p *Processor) ViewPayOnChain()
func (*Processor) ViewTxOnChain ¶
func (p *Processor) ViewTxOnChain()
func (*Processor) ViewXnetPay ¶
func (p *Processor) ViewXnetPay()
type XnetConfig ¶
type XnetConfig struct {
NetId uint64 `json:"net_id"` // local net id
NetBridge map[string]uint64 `json:"net_bridge"` // bridgeAddr -> bridgeNetId
BridgeRouting map[uint64]string `json:"bridge_routing"` // destNetId -> nextHopBridgeAddr
NetToken map[string]map[uint64]string `json:"net_token"` // localTokenAddr -> map(remoteNetId -> remoteTokenAddr)
}
XnetConfig is the operator-supplied cross-net routing configuration.
A "net" is identified by (chainId, CelerLedger): the CelerLedger's constructor binds NativeWrap (the chain's WETH-style wrapped-native contract), PayRegistry, and CelerWallet, and the PayResolver feeding that PayRegistry (with its bound VirtResolver) is uniquely determined per deployment, so the full contract set is derivable from the ledger. Two OSPs sharing a netId must boot against the same CelerLedger address on the same chain; otherwise channels and signed messages won't validate across them.
netId is intentionally separate from `block.chainid` for two reasons:
- A contract-set redeployment on the same chain (upgrades, hard-fork- style migrations) is a new net even though chainId is unchanged — the new PayResolver enforces `pay.payResolver == address(this)` and the new Ledger enforces `initializer.ledger_address == address(this)`, so signed messages don't cross over. A bridge pair operated by the same business entity can carry pays across the migration window without users having to coordinate the upgrade.
- Test harnesses can simulate cross-net routing on a single geth instance by deploying multiple contract sets and labelling them as distinct nets.
On-chain replay protection lives in the contracts: chainId and ledger_address are signed into PaymentChannelInitializer; chainId is signed into ConditionalPay; payResolver is bound on every pay. netId only drives off-chain forwarding decisions.
Bridge OSPs at a net boundary are operated as a trust unit (typically by the same business entity). The cross-bridge link is a direct gRPC stream between the two bridge processes, not a payment channel — there's no shared on-chain state between bridges, and reconciliation between them is off-protocol.
func ParseXnetConfig ¶
func ParseXnetConfig(path string) (*XnetConfig, error)