test_data

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: AGPL-3.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BlockNumber             = big.NewInt(rand.Int63())
	BlockHash               = "0xfa40fbe2d98d98b3363a778d52f2bcd29d6790b9b3f3cab2b167fd12d3550f73"
	CodeHash                = common.Hex2Bytes("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
	NewNonceValue           = rand.Uint64()
	NewBalanceValue         = rand.Int63()
	ContractRoot            = common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
	StoragePath             = common.HexToHash("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").Bytes()
	StorageKey              = common.HexToHash("0000000000000000000000000000000000000000000000000000000000000001").Bytes()
	SmallStorageValue       = common.Hex2Bytes("03")
	SmallStorageValueRlp, _ = rlp.EncodeToBytes(SmallStorageValue)

	LargeStorageValue       = common.Hex2Bytes("00191b53778c567b14b50ba0000")
	LargeStorageValueRlp, _ = rlp.EncodeToBytes(LargeStorageValue)

	EmptyStorage        = make([]filters.StorageDiff, 0)
	StorageWithBadValue = filters.StorageDiff{
		Key:   StorageKey,
		Value: []byte{0, 1, 2},
	}

	ContractLeafKey = crypto.Keccak256Hash(contractAddress[:])

	AnotherContractLeafKey = crypto.Keccak256Hash(anotherContractAddress[:])

	AccountValueBytes, _ = rlp.EncodeToBytes(testAccount)

	UpdatedAccountDiffs = []filters.AccountDiff{testAccountDiff1, testAccountDiff2, testAccountDiff3}

	MockStateDiff = filters.StateDiff{
		BlockNumber:     BlockNumber,
		BlockHash:       common.HexToHash(BlockHash),
		UpdatedAccounts: UpdatedAccountDiffs,
	}
	MockStateDiffBytes, _ = rlp.EncodeToBytes(MockStateDiff)

	MockStatediffPayload = filters.Payload{
		StateDiffRlp: MockStateDiffBytes,
	}

	StateDiffWithBadStorageValue = filters.StateDiff{
		BlockNumber:     BlockNumber,
		BlockHash:       common.HexToHash(BlockHash),
		UpdatedAccounts: []filters.AccountDiff{testAccountDiffWithBadStorageValue},
	}
)
View Source
var GenericTestConfig = event.TransformerConfig{
	TransformerName:     "generic-test-transformer",
	ContractAddresses:   []string{FakeAddress().Hex()},
	ContractAbi:         randomString(100),
	Topic:               topic0,
	StartingBlockNumber: startingBlockNumber,
	EndingBlockNumber:   startingBlockNumber + 1,
}
View Source
var GenericTestLog = func() types.Log {
	return types.Log{
		Address:     FakeAddress(),
		Topics:      []common.Hash{common.HexToHash(topic0), FakeHash()},
		Data:        hexutil.MustDecode(FakeHash().Hex()),
		BlockNumber: uint64(startingBlockNumber),
		TxHash:      FakeHash(),
		TxIndex:     uint(rand.Int31()),
		BlockHash:   FakeHash(),
		Index:       uint(rand.Int31()),
	}
}

Functions

func CreateMatchingTx added in v0.1.0

func CreateMatchingTx(log types.Log, headerID int64, headerRepo datastore.HeaderRepository)

func CreateTestLog added in v0.0.10

func CreateTestLog(headerID int64, db *postgres.DB) core.EventLog

Create an event log to reference in an event, returning inserted event log

func ExpectCheckedHeadersInThisSchema added in v0.1.0

func ExpectCheckedHeadersInThisSchema(db *postgres.DB, schema string)

/ ExpectCheckedHeadersInThisSchema is provided so that / plugins can easily validate that they have the necessary checked_headers / table in their schema for the execute process. / / Use like so in your tests: / var _ = Describe("Your Schema", func() { / BeforeEach(func() { / test_config.CleanTestDB(db) / }) / / It("has a proper checked headers setup in the schema", func() { / test_data.ExpectCheckedHeadersInThisSchema(db, "yourschemaname") / }) / })

func FakeAddress added in v0.1.0

func FakeAddress() common.Address

func FakeHash added in v0.1.0

func FakeHash() common.Hash

Types

This section is empty.

Jump to

Keyboard shortcuts

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