Documentation
¶
Overview ¶
Package rpcverify is the REAL, network-backed ChainVerifier used by CI (and any out-of-process validator) to prove a manifest's assets exist on the TARGET net before a deploy. It is kept out of the registry package proper so the consensus-path registry carries no JSON-RPC / EVM-client dependency; only the offline validator links it.
For an ERC-20 it confirms: the C-Chain's eth_chainId matches the manifest's declared EVMChainID, the contract has code (eth_getCode length > 0), and a static decimals() call returns a value (which the registry then cross-checks against the manifest's declared decimals). For EVM_NATIVE it confirms the chainID. UTXO verification is delegated to the X-Chain avm.getAssetDescription endpoint.
Index ¶
- type Verifier
- func (v *Verifier) ConfirmCChain(networkID uint32, evmChainID uint64, cChainID ids.ID) error
- func (v *Verifier) VerifyERC20(_ uint32, _ ids.ID, addr []byte) (uint8, error)
- func (v *Verifier) VerifyEVMNative(_ uint32, _ ids.ID) (uint8, error)
- func (v *Verifier) VerifyUTXOAsset(_ uint32, _ ids.ID, assetID ids.ID) (uint8, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier proves assets real against a live network: a C-Chain EVM RPC (for EVM_NATIVE/ERC20) and a P-Chain + X-Chain API base (for the C-Chain consensus-id confirm and UTXO asset descriptions).
func New ¶
New dials the C-Chain EVM RPC and records the node API base for P/X queries. evmRPC is the full C-Chain RPC URL (…/ext/bc/C/rpc); apiBase is the node root (…) used to reach /ext/P and /ext/bc/X. nativeDecimals is the C-Chain native coin's decimals (18 for LUX).
func (*Verifier) ConfirmCChain ¶
ConfirmCChain implements registry.CChainConfirmer: it confirms the live C-Chain's eth_chainId equals the manifest's EVMChainID and the live C-Chain consensus id equals the manifest's CChainID (queried from the P-Chain). A mismatch on either means the validator is pointed at the wrong network — the manifest must NOT be admitted.
func (*Verifier) VerifyERC20 ¶
VerifyERC20 confirms a contract has code at addr and returns its decimals().
func (*Verifier) VerifyEVMNative ¶
VerifyEVMNative confirms the C-Chain is reachable (chainID readable) and returns the native decimals. (The chainID equality is enforced once in ConfirmCChain.)