Documentation
¶
Index ¶
- Constants
- Variables
- func ActionResultSignHash(t *testing.T, innerHash []byte) []byte
- func BuildInstructionData(t *testing.T, opType op.Type, opCommand op.Command, originalMessage []byte, ...) *instruction.Data
- func BuildInstructionDataWithID(t *testing.T, instructionID common.Hash, opType op.Type, opCommand op.Command, ...) *instruction.Data
- func FetchAndVerifyActionResponse(t *testing.T, port uint, actionID common.Hash, ...) *types.ActionResponse
- func FetchAndVerifyRewardingData(t *testing.T, pc *ProxyConfig, instructionID common.Hash, opType op.Type, ...)
- func GetTeeInfo(t *testing.T, pc *ProxyConfig) *types.TeeInfoResponse
- func GetVotingStatuses(t *testing.T, pc *ProxyConfig, rewardEpochID uint32, instructionID common.Hash) *voting.Statuses
- func GetWalletInfo(t *testing.T, pc *ProxyConfig, walletID [32]byte, keyID uint64) *pkgwallets.KeyData
- func SetChainIDOnTEE(t *testing.T, port uint, chainID uint64)
- func SetProxyURLOnTEE(t *testing.T, port uint, proxyURL string)
- func SignAndSendInstruction(t *testing.T, iData *instruction.Data, privKey *ecdsa.PrivateKey, port uint) *voting.SignedReceipt
- func SignAndSendInstructions(t *testing.T, iData *instruction.Data, privKeys []*ecdsa.PrivateKey, port uint) []*voting.SignedReceipt
- func SignAndSendInstructionsWithAddVarMsgs(t *testing.T, iData *instruction.Data, ...) ([]*voting.SignedReceipt, []instruction.Data)
- func VerifyActionResponse(t *testing.T, res *types.ActionResponse, submissionTag types.SubmissionTag, ...)
- func VerifyReceipts(t *testing.T, receipts []*voting.SignedReceipt, iData *instruction.Data)
- func VerifyReceiptsForMultipleInstructions(t *testing.T, receipts []*voting.SignedReceipt, insts []instruction.Data)
- func VerifyVotingStatus(t *testing.T, statuses *voting.Statuses, ...)
- type ProxyConfig
Constants ¶
const TestChainID uint64 = 14
TestChainID is the chain ID embedded in every integration instruction and configured on the TEE via SetChainIDOnTEE. The instruction's signed hash and the TEE's expectedChainID must agree.
Variables ¶
var StorageTimeConfig = struct { CycleInternal time.Duration CycleQueueResponseWait time.Duration }{ CycleInternal: 50 * time.Millisecond, CycleQueueResponseWait: 10 * time.Second, }
var TestTimeConfig = struct { Timeout time.Duration Interval time.Duration }{ Timeout: 6000 * time.Millisecond, Interval: 50 * time.Millisecond, }
Functions ¶
func ActionResultSignHash ¶ added in v0.0.18
ActionResultSignHash recomputes the domain-separated preimage the TEE signs over an action result: signing.Payload{TEEActionResult, TestChainID, ActionResult.Hash()}.Hash(). The returned bytes are suitable for teeUtils.VerifySignature, which applies the EIP-191 text-hash prefix.
func BuildInstructionData ¶
func BuildInstructionData( t *testing.T, opType op.Type, opCommand op.Command, originalMessage []byte, timestamp uint64, additionalFixedMessageRaw any, additionalVariableMessage any, cosigners []common.Address, cosignersThreshold uint64, teeID common.Address, rewardEpochID uint32, ) *instruction.Data
func BuildInstructionDataWithID ¶
func BuildInstructionDataWithID( t *testing.T, instructionID common.Hash, opType op.Type, opCommand op.Command, originalMessage []byte, timestamp uint64, additionalFixedMessageRaw any, additionalVariableMessage any, cosigners []common.Address, cosignersThreshold uint64, teeID common.Address, rewardEpochID uint32, ) *instruction.Data
func FetchAndVerifyActionResponse ¶
func FetchAndVerifyActionResponse(t *testing.T, port uint, actionID common.Hash, submissionTag types.SubmissionTag, opType op.Type, opCommand op.Command, teeID common.Address, expectedStatus uint8) *types.ActionResponse
FetchAndVerifyActionResponse Fetches ActionResponse and verifies the signature
func FetchAndVerifyRewardingData ¶
func FetchAndVerifyRewardingData(t *testing.T, pc *ProxyConfig, instructionID common.Hash, opType op.Type, opCommand op.Command, receipts []*voting.SignedReceipt)
FetchAndVerifyRewardingData Fetches rewarding data and verifies the action response and vote sequence
func GetTeeInfo ¶
func GetTeeInfo(t *testing.T, pc *ProxyConfig) *types.TeeInfoResponse
GetTeeInfo Fetches TeeInfoResponse until TestTimeConfig.Timeout every TestTimeConfig.Interval
func GetVotingStatuses ¶
func GetVotingStatuses(t *testing.T, pc *ProxyConfig, rewardEpochID uint32, instructionID common.Hash) *voting.Statuses
GetVotingStatuses Fetches VoteStatus until TestTimeConfig.Timeout every TestTimeConfig.Interval
func GetWalletInfo ¶
func GetWalletInfo(t *testing.T, pc *ProxyConfig, walletID [32]byte, keyID uint64) *pkgwallets.KeyData
GetWalletInfo Fetches KeyData until TestTimeConfig.Timeout every TestTimeConfig.Interval
func SetChainIDOnTEE ¶ added in v0.0.18
SetChainIDOnTEE configures the TEE node's chain ID. The node refuses to process instructions until this is set, and the value must match the chain ID the actions hash their messages with.
func SignAndSendInstruction ¶
func SignAndSendInstruction(t *testing.T, iData *instruction.Data, privKey *ecdsa.PrivateKey, port uint) *voting.SignedReceipt
func SignAndSendInstructions ¶
func SignAndSendInstructions(t *testing.T, iData *instruction.Data, privKeys []*ecdsa.PrivateKey, port uint) []*voting.SignedReceipt
func SignAndSendInstructionsWithAddVarMsgs ¶
func SignAndSendInstructionsWithAddVarMsgs(t *testing.T, iData *instruction.Data, additionalVariableMessage []hexutil.Bytes, privKeys []*ecdsa.PrivateKey, port uint) ([]*voting.SignedReceipt, []instruction.Data)
func VerifyActionResponse ¶
func VerifyActionResponse(t *testing.T, res *types.ActionResponse, submissionTag types.SubmissionTag, opType op.Type, opCommand op.Command, teeID common.Address)
VerifyActionResponse Verifies the action response against expected values and checks the signature
func VerifyReceipts ¶
func VerifyReceipts(t *testing.T, receipts []*voting.SignedReceipt, iData *instruction.Data)
func VerifyReceiptsForMultipleInstructions ¶
func VerifyReceiptsForMultipleInstructions(t *testing.T, receipts []*voting.SignedReceipt, insts []instruction.Data)
Types ¶
type ProxyConfig ¶
type ProxyConfig struct {
ExtPort uint
IntPort uint
TeeID common.Address
TeePubKey *ecdsa.PublicKey
ProxyPubKey *ecdsa.PublicKey
Aq *queue.ActionQueues
Rs *result.ResultStorage
Vc *config.Voting
Pc chan policy.SigningPolicy
Ws *wallets.Service
If *info.Service
}
func RunProxy ¶
func RunProxy(t *testing.T, internalPort, externalPort uint, proxyPk *ecdsa.PrivateKey, wg *sync.WaitGroup) (*ProxyConfig, func())
RunProxy simulates behavior of internal/proxy/proxy.go - Starts internal and external proxy servers, and fetches TEE ID from TEE