v2

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "gravity"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey is the module name router key
	RouterKey = ModuleName

	// QuerierRoute to be used for querierer msgs
	QuerierRoute = ModuleName
)

Variables

View Source
var (
	// EthAddressByValidatorKey indexes cosmos validator account addresses
	// i.e. gravity1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm
	// [0x1248a4405201cc3a00ab515ce9c4dd47]
	EthAddressByValidatorKey = HashString("EthAddressValidatorKey")

	// ValidatorByEthAddressKey indexes ethereum addresses
	// i.e. 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B
	// [0xbfe41763f372108317ed982a4cd1b4a8]
	ValidatorByEthAddressKey = HashString("ValidatorByEthAddressKey")

	// ValsetRequestKey indexes valset requests by nonce
	// [0xa318dca6c74494c2fac1841c9e2454fe]
	ValsetRequestKey = HashString("ValsetRequestKey")

	// ValsetConfirmKey indexes valset confirmations by nonce and the validator account address
	// i.e gravity1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm
	// [0x2f522701d7f28af84632f8228fbe1750]
	ValsetConfirmKey = HashString("ValsetConfirmKey")

	// OracleClaimKey Claim details by nonce and validator address
	// i.e. gravityvaloper1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm
	// A claim is named more intuitively than an Attestation, it is literally
	// a validator making a claim to have seen something happen. Claims are
	// attached to attestations which can be thought of as 'the event' that
	// will eventually be executed.
	// [0x15968a4f1cb06e26ab155d6e59eccc85]
	OracleClaimKey = HashString("OracleClaimKey")

	// OracleAttestationKey attestation details by nonce and validator address
	// i.e. gravityvaloper1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm
	// An attestation can be thought of as the 'event to be executed' while
	// the Claims are an individual validator saying that they saw an event
	// occur the Attestation is 'the event' that multiple claims vote on and
	// eventually executes
	// [0x0bfa165ff4ef558b3d0b62ea4d4a46c5]
	OracleAttestationKey = HashString("OracleAttestationKey")

	// OutgoingTXPoolKey indexes the last nonce for the outgoing tx pool
	// [0x44f7816ec23d990ee39d9ed4609bbd4d]
	OutgoingTXPoolKey = HashString("OutgoingTXPoolKey")

	// OutgoingTXBatchKey indexes outgoing tx batches under a nonce and token address
	// [0x54e2db44755d8865b1ff4227402e204f]
	OutgoingTXBatchKey = HashString("OutgoingTXBatchKey")

	// BatchConfirmKey indexes validator confirmations by token contract address
	// [0x75b935a854d50880236724b9c4822daf]
	BatchConfirmKey = HashString("BatchConfirmKey")

	// LastEventNonceByValidatorKey indexes lateset event nonce by validator
	// [0xeefcb999cc3d7b80b052b55106a6ba5e]
	LastEventNonceByValidatorKey = HashString("LastEventNonceByValidatorKey")

	// LastObservedEventNonceKey indexes the latest event nonce
	// [0xa34e56ab6fab9ee91e82ba216bfeb759]
	LastObservedEventNonceKey = HashString("LastObservedEventNonceKey")

	// SequenceKeyPrefix indexes different txids
	// [0x33887862fa4fba9c592d6fb84d8dd755]
	SequenceKeyPrefix = HashString("SequenceKeyPrefix")

	// KeyLastTXPoolID indexes the lastTxPoolID
	// [0xfd87a616141bfbd26fd2938d6e1cf099]
	KeyLastTXPoolID = HashString("SequenceKeyPrefix" + "lastTxPoolId")

	// KeyLastOutgoingBatchID indexes the lastBatchID
	// [0x4f9c42e30316353cb1e0ed74200abbbb]
	KeyLastOutgoingBatchID = HashString("SequenceKeyPrefix" + "lastBatchId")

	// KeyOrchestratorAddress indexes the validator keys for an orchestrator
	// [0x391e8708521fb085676169e8fb232cda]
	KeyOrchestratorAddress = HashString("KeyOrchestratorAddress")

	// KeyOutgoingLogicCall indexes the outgoing logic calls
	// [0x98dfff23346c13a1747fbbed5b23d248]
	KeyOutgoingLogicCall = HashString("KeyOutgoingLogicCall")

	// KeyOutgoingLogicConfirm indexes the outgoing logic confirms
	// [0xd244ded2fa29e95a7719ec40696221e4]
	KeyOutgoingLogicConfirm = HashString("KeyOutgoingLogicConfirm")

	// LastObservedEthereumBlockHeightKey indexes the latest Ethereum block height
	// [0x83a283a6c3390f1526250df45e9ef8c6]
	LastObservedEthereumBlockHeightKey = HashString("LastObservedEthereumBlockHeightKey")

	// DenomToERC20Key prefixes the index of Cosmos originated asset denoms to ERC20s
	// [0x19fb4f512868744eea13f3eac3672c12]
	DenomToERC20Key = HashString("DenomToERC20Key")

	// ERC20ToDenomKey prefixes the index of Cosmos originated assets ERC20s to denoms
	// [0x877b20a916c830ad4db23d22f7b2cde0]
	ERC20ToDenomKey = HashString("ERC20ToDenomKey")

	// LastSlashedValsetNonce indexes the latest slashed valset nonce
	// [0x3adee74534260faaea6ac8e31826b09e]
	LastSlashedValsetNonce = HashString("LastSlashedValsetNonce")

	// LatestValsetNonce indexes the latest valset nonce
	// [0xba0fa05da166611b656bac7739a6e7d3]
	LatestValsetNonce = HashString("LatestValsetNonce")

	// LastSlashedBatchBlock indexes the latest slashed batch block height
	// [0xcbaedf5dd1e068d9e2223281f693358c]
	LastSlashedBatchBlock = HashString("LastSlashedBatchBlock")

	// LastSlashedLogicCallBlock indexes the latest slashed logic call block height
	// [0x3df72087ae3f58d49c6d0b1737c8da0c]
	LastSlashedLogicCallBlock = HashString("LastSlashedLogicCallBlock")

	// LastUnBondingBlockHeight indexes the last validator unbonding block height
	// [0x06a6b30651341e80276e0d2e19449250]
	LastUnBondingBlockHeight = HashString("LastUnBondingBlockHeight")

	// LastObservedValsetNonceKey indexes the latest observed valset nonce
	// HERE THERE BE DRAGONS, do not use this value as an up to date validator set
	// on Ethereum it will always lag significantly and may be totally wrong at some
	// times.
	// [0x2418e9d990ce88e9b844b0bb723d4d7a]
	LastObservedValsetKey = HashString("LastObservedValsetKey")

	// PastEthSignatureCheckpointKey indexes eth signature checkpoints that have existed
	// [0x1cbe0be407a979331b98e599eeedd09f]
	PastEthSignatureCheckpointKey = HashString("PastEthSignatureCheckpointKey")
)

Functions

func AppendBytes

func AppendBytes(args ...[]byte) []byte

func GetAttestationKey

func GetAttestationKey(eventNonce uint64, claimHash []byte) []byte

GetAttestationKey returns the following key format prefix nonce claim-details-hash [0x0][0 0 0 0 0 0 0 1][fd1af8cec6c67fcf156f1b61fdf91ebc04d05484d007436e75342fc05bbff35a] An attestation is an event multiple people are voting on, this function needs the claim details because each Attestation is aggregating all claims of a specific event, lets say validator X and validator y where making different claims about the same event nonce Note that the claim hash does NOT include the claimer address and only identifies an event

func GetBatchConfirmKey

func GetBatchConfirmKey(tokenContract types.EthAddress, batchNonce uint64, validator sdk.AccAddress) []byte

GetBatchConfirmKey returns the following key format prefix eth-contract-address BatchNonce Validator-address [0x0 ][0xc783df8a850f42e7F7e57013759C285caa701eB6][0 0 0 0 0 0 0 1][gravityvaloper1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm] TODO this should be a sdk.ValAddress

func GetBatchConfirmNonceContractPrefix

func GetBatchConfirmNonceContractPrefix(tokenContract types.EthAddress, batchNonce uint64) []byte

GetBatchConfirmNonceContractPrefix returns prefix eth-contract-address BatchNonce [0x0][0xc783df8a850f42e7F7e57013759C285caa701eB6][0 0 0 0 0 0 0 1]

func GetDenomToERC20Key

func GetDenomToERC20Key(denom string) []byte

func GetERC20ToDenomKey

func GetERC20ToDenomKey(erc20 types.EthAddress) []byte

func GetEthAddressByValidatorKey

func GetEthAddressByValidatorKey(validator sdk.ValAddress) []byte

GetEthAddressByValidatorKey returns the following key format prefix cosmos-validator [0x0][gravityvaloper1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm]

func GetLastEventNonceByValidatorKey

func GetLastEventNonceByValidatorKey(validator sdk.ValAddress) []byte

GetLastEventNonceByValidatorKey indexes lateset event nonce by validator GetLastEventNonceByValidatorKey returns the following key format prefix cosmos-validator [0x0][gravity1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm]

func GetLogicConfirmKey

func GetLogicConfirmKey(invalidationId []byte, invalidationNonce uint64, validator sdk.AccAddress) []byte

func GetLogicConfirmNonceInvalidationIdPrefix

func GetLogicConfirmNonceInvalidationIdPrefix(invalidationId []byte, invalidationNonce uint64) []byte

func GetOrchestratorAddressKey

func GetOrchestratorAddressKey(orc sdk.AccAddress) []byte

GetOrchestratorAddressKey returns the following key format prefix orchestrator address [0x0][gravity1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm]

func GetOutgoingLogicCallKey

func GetOutgoingLogicCallKey(invalidationId []byte, invalidationNonce uint64) []byte

func GetOutgoingTxBatchContractPrefix

func GetOutgoingTxBatchContractPrefix(tokenContract types.EthAddress) []byte

GetOutgoingTxBatchContractPrefix returns the following format prefix eth-contract-address [0x0][0xc783df8a850f42e7F7e57013759C285caa701eB6]

func GetOutgoingTxBatchKey

func GetOutgoingTxBatchKey(tokenContract types.EthAddress, nonce uint64) []byte

GetOutgoingTxBatchKey returns the following key format prefix eth-contract-address nonce [0x0][0xc783df8a850f42e7F7e57013759C285caa701eB6][0 0 0 0 0 0 0 1]

func GetOutgoingTxPoolContractPrefix

func GetOutgoingTxPoolContractPrefix(contractAddress types.EthAddress) []byte

GetOutgoingTxPoolContractPrefix returns prefix feeContract [0x0][0xc783df8a850f42e7F7e57013759C285caa701eB6] This prefix is used for iterating over unbatched transactions for a given contract

func GetOutgoingTxPoolKey

func GetOutgoingTxPoolKey(fee types.InternalERC20Token, id uint64) []byte

GetOutgoingTxPoolKey returns the following key format prefix feeContract feeAmount id [0x0][0xc783df8a850f42e7F7e57013759C285caa701eB6][1000000000][0 0 0 0 0 0 0 1]

func GetPastEthSignatureCheckpointKey

func GetPastEthSignatureCheckpointKey(checkpoint []byte) []byte

GetPastEthSignatureCheckpointKey returns the following key format prefix checkpoint [0x0][ checkpoint bytes ]

func GetValidatorByEthAddressKey

func GetValidatorByEthAddressKey(ethAddress types.EthAddress) []byte

GetValidatorByEthAddressKey returns the following key format prefix cosmos-validator [0x0][0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B]

func GetValsetConfirmKey

func GetValsetConfirmKey(nonce uint64, validator sdk.AccAddress) []byte

GetValsetConfirmKey returns the following key format prefix nonce validator-address [0x0][0 0 0 0 0 0 0 1][gravity1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm] MARK finish-batches: this is where the key is created in the old (presumed working) code

func GetValsetConfirmNoncePrefix

func GetValsetConfirmNoncePrefix(nonce uint64) []byte

GetValsetConfirmNoncePrefix returns the following format prefix nonce [0x0][0 0 0 0 0 0 0 1]

func GetValsetKey

func GetValsetKey(nonce uint64) []byte

GetValsetKey returns the following key format prefix nonce [0x0][0 0 0 0 0 0 0 1]

func HashString

func HashString(input string) []byte

Hashing string using cryptographic MD5 function returns 128bit(16byte) value

func MigrateStore

func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error

MigrateStore performs in-place store migrations from v1 to v2. The migration includes:

- Change all Cosmos orginated ERC20 mappings from (HEX) string to bytes. - Change all validator Ethereum keys from (HEX) string to bytes.

func UInt64Bytes

func UInt64Bytes(n uint64) []byte

UInt64Bytes uses the SDK byte marshaling to encode a uint64

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL