Documentation
¶
Index ¶
- Constants
- func BuildMockDirectAction(t *testing.T, opType op.Type, opCommand op.Command, messageRaw any) *types.Action
- func BuildMockInstructionAction(t *testing.T, opType op.Type, opCommand op.Command, originalMessage []byte, ...) *types.Action
- func BuildMockPaymentOriginalMessage(t *testing.T, mockWallet common.Hash, teeID common.Address, keyID uint64, ...) []byte
- func BuildMultiSignedPolicy(t *testing.T, policyBytes []byte, voterPrivKeys []*ecdsa.PrivateKey) types.MultiSignedPolicy
- func CreateMockWallet(t *testing.T, iSndD node.IdentifierSignerAndDecrypter, ps *policy.Storage, ...) wallet.ITeeWalletKeyManagerKeyExistence
- func GenerateAndSetInitialPolicy(t *testing.T, ps *ppolicy.Storage, numVoters int, randSeed int64, ...) (*commonpolicy.SigningPolicy, []common.Address, []*ecdsa.PrivateKey)
- func GenerateRandomKeys(t *testing.T, numVoters int) ([]common.Address, []*ecdsa.PrivateKey, map[common.Address]*ecdsa.PublicKey)
- func GenerateRandomPolicyData(t *testing.T, rewardEpochID uint32, voters []common.Address, seed int64) *commonpolicy.SigningPolicy
- func GenerateRandomValidPolicyAndSigners(t *testing.T, epochId uint32, randSeed int64, numVoters int) (*commonpolicy.SigningPolicy, []common.Address, []*ecdsa.PrivateKey, ...)
- func MockSignServerResult(t *testing.T, signPort int, actionResponseChan chan *types.ActionResult)
- func Setup(t *testing.T) (*node.Node, *policy.Storage, *wallets.Storage)
- type DummyExtensionServer
Constants ¶
const TotalWeight = 1<<16 - 1
Variables ¶
This section is empty.
Functions ¶
func BuildMockDirectAction ¶
func BuildMockDirectAction(t *testing.T, opType op.Type, opCommand op.Command, messageRaw any) *types.Action
BuildMockDirectAction fabricates a direct action with a random ID for tests.
func BuildMockInstructionAction ¶
func BuildMockInstructionAction( t *testing.T, opType op.Type, opCommand op.Command, originalMessage []byte, privKeys []*ecdsa.PrivateKey, teeID common.Address, rewardEpochID uint32, additionalFixedMessageRaw any, variableMessages [][]byte, cosigners []common.Address, cosignersThreshold uint64, submissionTag types.SubmissionTag, timestamp uint64, ) *types.Action
BuildMockInstructionAction assembles an instruction action with the provided signing keys and payload for use in tests.
func BuildMockPaymentOriginalMessage ¶
func BuildMockPaymentOriginalMessage( t *testing.T, mockWallet common.Hash, teeID common.Address, keyID uint64, amount int64, maxFee int64, feeSchedule []byte, sender, receiver string, ) []byte
BuildMockPaymentOriginalMessage constructs a payment instruction payload for use in tests.
func BuildMultiSignedPolicy ¶
func BuildMultiSignedPolicy(t *testing.T, policyBytes []byte, voterPrivKeys []*ecdsa.PrivateKey) types.MultiSignedPolicy
BuildMultiSignedPolicy signs the provided policy bytes with all given voter keys and returns the multisigned wrapper.
func CreateMockWallet ¶
func CreateMockWallet( t *testing.T, iSndD node.IdentifierSignerAndDecrypter, ps *policy.Storage, ws *wallets.Storage, walletID common.Hash, keyID uint64, rewardEpochID uint32, adminPrivKeys, cosignerPrivKeys []*ecdsa.PrivateKey, ) wallet.ITeeWalletKeyManagerKeyExistence
CreateMockWallet provisions a wallet in storage via the key generate instruction and returns its existence proof, for tests purposes.
func GenerateAndSetInitialPolicy ¶
func GenerateAndSetInitialPolicy(t *testing.T, ps *ppolicy.Storage, numVoters int, randSeed int64, epochID uint32) (*commonpolicy.SigningPolicy, []common.Address, []*ecdsa.PrivateKey)
GenerateAndSetInitialPolicy creates a mock policy, stores it in the provided storage, and returns the policy with its voters and keys.
func GenerateRandomKeys ¶
func GenerateRandomKeys(t *testing.T, numVoters int) ([]common.Address, []*ecdsa.PrivateKey, map[common.Address]*ecdsa.PublicKey)
GenerateRandomKeys creates a deterministic set of voters and key material for test policies.
func GenerateRandomPolicyData ¶
func GenerateRandomPolicyData(t *testing.T, rewardEpochID uint32, voters []common.Address, seed int64) *commonpolicy.SigningPolicy
GenerateRandomPolicyData constructs a pseudo-random signing policy based on the provided voters and seed.
func GenerateRandomValidPolicyAndSigners ¶
func GenerateRandomValidPolicyAndSigners(t *testing.T, epochId uint32, randSeed int64, numVoters int) (*commonpolicy.SigningPolicy, []common.Address, []*ecdsa.PrivateKey, []types.PublicKey)
GenerateRandomValidPolicyAndSigners produces a random policy alongside matching voter identities for tests.
func MockSignServerResult ¶
func MockSignServerResult(t *testing.T, signPort int, actionResponseChan chan *types.ActionResult)
Types ¶
type DummyExtensionServer ¶
type DummyExtensionServer struct {
// contains filtered or unexported fields
}
func NewDummyExtensionServer ¶
func NewDummyExtensionServer(port, signPort int) *DummyExtensionServer
NewDummyExtensionServer spins up a mock signing server that exercises the TEE-node interface for local development.
func (*DummyExtensionServer) Close ¶
func (d *DummyExtensionServer) Close() error
Close shuts down the dummy extension server.
func (*DummyExtensionServer) Serve ¶
func (d *DummyExtensionServer) Serve() error
Serve starts the dummy extension HTTP server.