Documentation ¶
Index ¶
- Constants
- func BinarySearch(top, bottom *big.Int, test func(amount *big.Int) bool) *big.Int
- func CalculateLatestBlockHeader(env Environment, blockNumberInput int) (err error)
- func ConfirmCodeAt(ctx context.Context, client *ethclient.Client, addr common.Address, ...)
- func ConfirmContractDeployed(context context.Context, client *ethclient.Client, ...) (address common.Address)
- func ConfirmTXMined(context context.Context, client *ethclient.Client, ...) (receipt *types.Receipt)
- func ContractExplorerLink(chainID int64, contractAddress common.Address) string
- func DeployLinkEthFeed(e Environment, linkAddress string, weiPerUnitLink *big.Int) common.Address
- func DeployLinkToken(e Environment) common.Address
- func ExplorerLink(chainID int64, txHash common.Hash) string
- func FundNode(e Environment, address string, fundingAmount *big.Int)
- func FundNodes(e Environment, transmitters []string, fundingAmount *big.Int)
- func GetIbftExtraClean(extra []byte) (cleanedExtra []byte, err error)
- func GetPolygonEdgeRLPHeader(jsonRPCClient *rpc.Client, blockNum *big.Int) (rlpHeader []byte, hash string, err error)
- func GetRlpHeaders(env Environment, blockNumbers []*big.Int, getParentBlocks bool) (headers [][]byte, hashes []string, err error)
- func IsArbitrumChainID(chainID int64) bool
- func IsAvaxNetwork(chainID int64) bool
- func IsAvaxSubnet(chainID int64) bool
- func IsPolygonEdgeNetwork(chainID int64) bool
- func MarshalRLPWith(arena *fastrlp.Arena, h *PolygonEdgeHeader) (*fastrlp.Value, error)
- func PanicErr(err error)
- func ParseAddressSlice(arg string) (ret []common.Address)
- func ParseArgs(flagSet *flag.FlagSet, args []string, requiredArgs ...string)
- func ParseBigIntSlice(arg string) (ret []*big.Int)
- func ParseHashSlice(arg string) (ret []common.Hash)
- func ParseHexSlice(arg string) (ret [][]byte)
- func ParseIntSlice(arg string) (ret []int)
- func TenderlySimLink(simID string) string
- func UpkeepLink(chainID int64, upkeepID *big.Int) string
- type AvaBlockNonce
- type AvaBloom
- type AvaHeader
- type AvaSubnetHeader
- type Environment
- type ExtraData
- type Nonce
- type PolygonEdgeHeader
Constants ¶
const ( ArbitrumGoerliChainID int64 = 421613 ArbitrumOneChainID int64 = 42161 ArbitrumSepoliaChainID int64 = 421614 )
const ( // BloomByteLength represents the number of bytes used in a header log bloom. BloomByteLength = 256 // BloomBitLength represents the number of bits used in a header log bloom. BloomBitLength = 8 * BloomByteLength )
Variables ¶
This section is empty.
Functions ¶
func BinarySearch ¶
binarySearch finds the highest value within the range bottom-top at which the test function is true.
func CalculateLatestBlockHeader ¶
func CalculateLatestBlockHeader(env Environment, blockNumberInput int) (err error)
func ConfirmCodeAt ¶
func ConfirmContractDeployed ¶
func ConfirmContractDeployed(context context.Context, client *ethclient.Client, transaction *types.Transaction, chainID int64) (address common.Address)
ConfirmContractDeployed confirms that the given contract deployment transaction completed and prints useful execution information.
func ConfirmTXMined ¶
func ConfirmTXMined(context context.Context, client *ethclient.Client, transaction *types.Transaction, chainID int64, txInfo ...string) (receipt *types.Receipt)
ConfirmTXMined confirms that the given transaction is mined and prints useful execution information.
func ContractExplorerLink ¶
ContractExplorerLink creates a block explorer link for the given contract address. If the chain ID is unrecognized the address is returned as-is.
func DeployLinkEthFeed ¶
func DeployLinkToken ¶
func DeployLinkToken(e Environment) common.Address
func ExplorerLink ¶
ExplorerLink creates a block explorer link for the given transaction hash. If the chain ID is unrecognized, the hash is returned as-is.
func GetIbftExtraClean ¶
Remove blockHeader.ExtraData.Committed without unpacking ExtraData into its full fledged type, which needs the full import of the package github.com/0xPolygon/polygon-edge. polygon-edge is a node implementation, and not a client. Adding polygon-edge as a dependency caused a lot of issues with conflicting dependency version with other libraries in this repo and some methods being referenced from older versions.
func GetPolygonEdgeRLPHeader ¶
func GetRlpHeaders ¶
func GetRlpHeaders(env Environment, blockNumbers []*big.Int, getParentBlocks bool) (headers [][]byte, hashes []string, err error)
GetRlpHeaders gets RLP encoded headers of a list of block numbers Makes RPC network call eth_getBlockByNumber to blockchain RPC node to fetch header info
func IsArbitrumChainID ¶
IsArbitrumChainID returns true if and only if the given chain ID corresponds to an Arbitrum chain (testnet or mainnet).
func IsAvaxNetwork ¶
IsAvaxNetwork returns true if the given chain ID corresponds to an avalanche network.
func IsAvaxSubnet ¶
IsAvaxSubnet returns true if the given chain ID corresponds to an avalanche subnet.
func IsPolygonEdgeNetwork ¶
IsPolygonEdgeNetwork returns true if the given chain ID corresponds to an Pologyon Edge network.
func MarshalRLPWith ¶
MarshalRLPWith marshals the header to RLP with a specific fastrlp.Arena Adding polygon-edge as a dependency caused a lot of issues with conflicting dependency version with other libraries in this repo and some methods being referenced from older versions Reference: https://github.com/0xPolygon/polygon-edge/blob/develop/types/rlp_marshal.go#L73C50-L73C53
func ParseAddressSlice ¶
ParseAddressSlice parses the given comma-separated string of addresses into a slice of common.Address objects.
func ParseBigIntSlice ¶
ParseBigIntSlice parses the given comma-separated string of integers into a slice of *big.Int objects.
func ParseHashSlice ¶
ParseHashSlice parses the given comma-separated string of hashes into a slice of common.Hash objects.
func ParseHexSlice ¶
func ParseIntSlice ¶
ParseIntSlice parses the given comma-separated string of integers into a slice of int.
func TenderlySimLink ¶
Types ¶
type AvaBlockNonce ¶
type AvaBlockNonce [8]byte
A AvaBlockNonce is a 64-bit hash which proves (combined with the mix-hash) that a sufficient amount of computation has been carried out on a block.
func EncodeNonce ¶
func EncodeNonce(i uint64) AvaBlockNonce
EncodeNonce converts the given integer to a block nonce.
func (AvaBlockNonce) MarshalText ¶
func (n AvaBlockNonce) MarshalText() ([]byte, error)
MarshalText encodes n as a hex string with 0x prefix.
func (AvaBlockNonce) Uint64 ¶
func (n AvaBlockNonce) Uint64() uint64
Uint64 returns the integer value of a block nonce.
func (*AvaBlockNonce) UnmarshalText ¶
func (n *AvaBlockNonce) UnmarshalText(input []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type AvaBloom ¶
type AvaBloom [BloomByteLength]byte
AvaBloom represents a 2048 bit bloom filter.
func (AvaBloom) Big ¶
Big converts b to a big integer. Note: Converting a bloom filter to a big.Int and then calling GetBytes does not return the same bytes, since big.Int will trim leading zeroes
func (AvaBloom) MarshalText ¶
MarshalText encodes b as a hex string with 0x prefix.
func (*AvaBloom) SetBytes ¶
SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.
func (*AvaBloom) UnmarshalText ¶
UnmarshalText b as a hex string with 0x prefix.
type AvaHeader ¶
type AvaHeader struct { ParentHash common.Hash `json:"parentHash" gencodec:"required"` UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` Coinbase common.Address `json:"miner" gencodec:"required"` Root common.Hash `json:"stateRoot" gencodec:"required"` TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` Bloom AvaBloom `json:"logsBloom" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Time uint64 `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` MixDigest common.Hash `json:"mixHash"` Nonce AvaBlockNonce `json:"nonce"` ExtDataHash common.Hash `json:"extDataHash" gencodec:"required"` // BaseFee was added by EIP-1559 and is ignored in legacy headers. BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"` // ExtDataGasUsed was added by Apricot Phase 4 and is ignored in legacy // headers. // // It is not a uint64 like GasLimit or GasUsed because it is not possible to // correctly encode this field optionally with uint64. ExtDataGasUsed *big.Int `json:"extDataGasUsed" rlp:"optional"` // BlockGasCost was added by Apricot Phase 4 and is ignored in legacy // headers. BlockGasCost *big.Int `json:"blockGasCost" rlp:"optional"` }
AvaHeader is a copy of github.com/ava-labs/coreth/core/types.Header to avoid importing the whole module.
func (*AvaHeader) UnmarshalJSON ¶
type AvaSubnetHeader ¶
type AvaSubnetHeader struct { ParentHash common.Hash `json:"parentHash" gencodec:"required"` UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` Coinbase common.Address `json:"miner" gencodec:"required"` Root common.Hash `json:"stateRoot" gencodec:"required"` TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` Bloom AvaBloom `json:"logsBloom" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Time uint64 `json:"timestamp" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` MixDigest common.Hash `json:"mixHash"` Nonce AvaBlockNonce `json:"nonce"` BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"` BlockGasCost *big.Int `json:"blockGasCost" rlp:"optional"` }
AvaSubnetHeader is a copy of github.com/ava-labs/subnet-evm/core/types.Header to avoid importing the whole module.
func (*AvaSubnetHeader) Hash ¶
func (h *AvaSubnetHeader) Hash() common.Hash
func (*AvaSubnetHeader) UnmarshalJSON ¶
func (h *AvaSubnetHeader) UnmarshalJSON(input []byte) error
type Environment ¶
type Environment struct { Owner *bind.TransactOpts Ec *ethclient.Client Jc *rpc.Client ChainID int64 }
func SetupEnv ¶
func SetupEnv(overrideNonce bool) Environment
SetupEnv returns an Environment object populated from environment variables. If overrideNonce is set to true, the nonce will be set to what is returned by NonceAt (rather than the typical PendingNonceAt).
type Nonce ¶
type Nonce [8]byte
func (Nonce) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Nonce) UnmarshalJSON ¶
UnmarshalJSON parses a nonce in hex syntax.
type PolygonEdgeHeader ¶
type PolygonEdgeHeader struct { ParentHash common.Hash `json:"parentHash" gencodec:"required"` Sha3Uncles common.Hash `json:"sha3Uncles" gencodec:"required"` Miner common.Address `json:"miner"` StateRoot common.Hash `json:"stateRoot" gencodec:"required"` TxRoot common.Hash `json:"transactionsRoot" gencodec:"required"` ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"` LogsBloom types.Bloom `json:"logsBloom" gencodec:"required"` Difficulty hexutil.Uint64 `json:"difficulty" gencodec:"required"` Number hexutil.Uint64 `json:"number" gencodec:"required"` GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"` GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"` Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"` ExtraData ExtraData `json:"extraData" gencodec:"required"` MixHash common.Hash `json:"mixHash"` Nonce Nonce `json:"nonce"` Hash common.Hash `json:"hash"` // baseFeePerGas is the response format from go-ethereum. Polygon-Edge // seems to have fixed this in this commit: // https://github.com/0xPolygon/polygon-edge/commit/e859acf7e7f0286ceeecce022b978c8fdb57d71b // But node operators dont seem to have updated their polygon-edge client // version and still send baseFee instead of baseFeePerGas. // BaseFee was added by EIP-1559 and is ignored in legacy headers. BaseFee hexutil.Uint64 `json:"baseFeePerGas"` BaseFeeAlt hexutil.Uint64 `json:"baseFee,omitempty"` }
Header represents a block header in the Ethereum blockchain.