状态

该文档列出了Peggy模块读取/写入其状态的所有数据,以键值对(KV对)的形式。

Module Params

Params是一个模块范围的配置结构,存储参数并定义Peggy模块的整体功能。每个参数的详细规范可以在Parameters部分找到。

类型
编码

[]byte{0x4}

Module params

types.Params

Protobuf encoded

Validator Info

Ethereum Address by Validator

存储由验证者账户地址索引的委托以太坊地址。

类型
编码

[]byte{0x1} + []byte(validatorAddr)

Ethereum address

common.Address

Protobuf encoded

Validator by Ethereum Address

存储由委托以太坊地址索引的验证者账户地址。

类型
编码

[]byte{0xfb} + []byte(ethAddress)

Validator address

sdk.ValAddress

Protobuf encoded

OrchestratorValidator

当验证者希望将其投票权委托给另一个密钥时,值使用协调器地址作为键进行存储。

类型
编码

[]byte{0xe8} + []byte(AccAddress)

Orchestrator address assigned by a validator

[]byte

Protobuf encoded

Valset

这是桥接的验证者集合。由Peggy模块在EndBlocker期间自动创建。 以两种方式存储,第一种是带高度,第二种是没有高度(不安全)。没有高度的方式用于测试以及状态的导出和导入。

type Valset struct {
	Nonce        uint64                               
	Members      []*BridgeValidator                   
	Height       uint64                               
	RewardAmount math.Int 
	RewardToken string
}
类型
编码

[]byte{0x2} + nonce (big endian encoded)

Validator set

types.Valset

Protobuf encoded

SlashedValsetNonce

最新的验证者集合处罚计数器。用于跟踪需要被处罚的验证者集合以及已经被处罚的验证者集合。

类型
编码

[]byte{0xf5}

Nonce

uint64

encoded via big endian

ValsetNonce

最新验证者集合的计数器。每次新的验证者集合更新时,都会更新该计数器。

类型
编码

[]byte{0xf6}

Nonce

uint64

encoded via big endian

Valset Confirmation

特定验证者集合的签名者确认。请参阅Oracle消息

类型
编码

[]byte{0x3} + (nonce + []byte(AccAddress)

Validator Confirmation

types.MsgValsetConfirm

Protobuf encoded

Batch Confirmation

特定代币批次的签名者确认。请参阅Oracle消息

类型
编码

[]byte{0xe1} + []byte(tokenContract) + nonce + []byte(AccAddress)

Validator Batch Confirmation

types.MsgConfirmBatch

Protobuf encoded

OutgoingTransferTx

用户的提取请求被汇集到Peggy交易池中,准备由批次创建者稍后批量处理。 每个提取请求都通过一个唯一的计数器进行索引,该计数器由Peggy模块在接收到提取请求时设置。

type OutgoingTransferTx struct {
	Id          uint64     
	Sender      string     
	DestAddress string     
	Erc20Token  *ERC20Token 
	Erc20Fee    *ERC20Token 
}
类型
编码

[]byte{0x7} + []byte("lastTxPoolId")

nonce of outgoing withdrawal

uint64

Big endian encoded

LastTXPoolID

每个由Injective接收到的提取请求的单调递增值。

类型
编码

[]byte{0x6} + []byte("lastTxPoolId")

Last used withdrawal ID

uint64

Big endian encoded

OutgoingTxBatch

OutgoingTxBatch表示同一代币类型的提取请求集合。在每次成功的MsgRequestBatch后创建。 以两种方式存储,第一种是带高度,第二种是没有高度(不安全)。没有高度的方式用于测试以及状态的导出和导入。目前,Peggy.sol 被硬编码为只接受单一代币类型的批次,并且仅以该代币类型支付奖励。

type OutgoingTxBatch struct {
	BatchNonce    uint64               
	BatchTimeout  uint64               
	Transactions  []*OutgoingTransferTx 
	TokenContract string                
	Block         uint64               
}
类型
编码

[]byte{0xa} + []byte(tokenContract) + nonce (big endian encoded)

A batch of outgoing transactions

types.OutgoingTxBatch

Protobuf encoded

[]byte{0xb} + block (big endian encoded)

A batch of outgoing transactions

types.OutgoingTxBatch

Protobuf encoded

LastOutgoingBatchID

每个由批次创建者在Injective上创建的批次的单调递增值。

类型
编码

[]byte{0x7} + []byte("lastBatchId")

Last used batch ID

uint64

Big endian encoded

SlashedBlockHeight

表示最新的处罚区块高度。始终只存储一个值。

类型
编码

[]byte{0xf7}

Latest height a batch slashing occurred

uint64

Big endian encoded

LastUnbondingBlockHeight

表示验证者开始从验证者集合中解除绑定的最新区块高度。用于确定处罚条件。

类型
编码

[]byte{0xf8}

Latest height at which a Validator started unbonding

uint64

Big endian encoded

TokenContract & Denom

一个来自计数链的代币标识符将来自一个合约。代币合约和代币标识符以两种方式存储。 首先,代币标识符作为键,值为代币合约。 其次,合约作为键,值为代币合约所代表的代币标识符。

类型
编码

[]byte{0xf3} + []byte(denom)

Token contract address

[]byte

stored in byte format

[]byte{0xf4} + []byte(tokenContract)

Token denom

[]byte

stored in byte format

LastObservedValset

此条目表示最后一次成功中继到以太坊的验证者集合(Valset)。在ValsetUpdatedEvent的确认在Injective上处理后进行更新。

类型
编码

[]byte{0xfa}

Last observed Valset on Ethereum

types.Valset

Protobuf encoded

LastEventNonce

这是在以太坊上最后一次观察到的事件的计数器。当调用TryAttestation()时设置此值。此存储中始终只持有一个值。

类型
编码

[]byte{0xf2}

Last observed event nonce

uint64

Big endian encoded

LastObservedEthereumHeight

这是在以太坊上最后一次观察到的事件的区块高度。此存储中始终只会存储一个值。

类型
编码

[]byte{0xf9}

Last observed Ethereum Height

uint64

Protobuf encoded

LastEventByValidator

这是来自特定验证者的最后一个观察到的以太坊事件。每次关联的协调器发送事件声明时都会更新。

type LastClaimEvent struct {
    EthereumEventNonce  uint64 
    EthereumEventHeight uint64 
}
类型
编码

[]byte{0xf1} + []byte(validator address)

Last observed event by some Validator

types.LastClaimEvent

Protobuf encoded

Attestation

确认是多个声明的汇总,随着更多的投票(声明)到来,最终被所有协调器观察到。一旦被观察到,该声明的特定逻辑将被执行。 每个确认都绑定到一个唯一的事件计数器(由Peggy合约生成),并且必须按顺序处理。这是一个正确性问题,如果事务顺序被打乱,则可能会发生交易重放攻击。

type Attestation struct {
	Observed bool       
	Votes    []string   
	Height   uint64     
	Claim    *types.Any 
}
类型
编码

[]byte{0x5} + event nonce (big endian encoded) + []byte(claimHash)

Attestation of occurred events/claims

types.Attestation

Protobuf encoded

PastEthSignatureCheckpoint

一个计算出的哈希值,表明某个验证者集合/代币批次在Injective上确实存在。此检查点也存在于Peggy合约中。在每次新的验证者集合更新和代币批次创建时都会更新。

类型
编码

[]byte{0x1b}

Last created checkpoint hash on Injective

gethcommon.Hash

store in byte format

EthereumBlacklist

已知的恶意以太坊地址列表,这些地址被禁止使用桥接。

类型
编码

[]byte{0x1c} + []byte(ethereum address)

Empty []byte slice

gethcommon.Hash

stored in byte format]

Last updated