testutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Client     *ethclient.Client
	EthNodeUri string
	Monitor    *monitor.ReorgMonitor
)
View Source
var Test3xD1 = TestCase{

	BlockInfo: []string{
		"0x08f13bc74d040c09f016f4d6c72e18ee7972ba422eb5892cc08db77bc48d424e",
		"0x113670b2acecc4caf68d9a35aad106c660579b3e9bcf84ef1062dafe1ece08ba",
		"0x9432199eb1260194528fc52f4dd91e3550930866fe8704cebcc278e3e395324f",
		"0xe4bfe2f25cdf38c6f414af6d8111eb5342bb96bf748b3dd0bba589bec8d4bcfe",
		"0xbcaa3acbe8d75305de50ed394ef923c5e45f0628f232faa8b09bb327c7fadb9e",
	},
}
View Source
var TestD1and2 = TestCase{

	BlockInfo: []string{
		"0xe65a0163ecd829aed890efd0885b00c7c88610defc1db6b55854eb773dd9857e",
		"0xd314532682ec5277331b857a68bf2203b520a4fd1c85be75b0329658f1966b02",
		"0xa85ff8ec76adcaa80a4f8c793352af06f43fc5fee67f1961d992882284807c51",
		"0xa97ccc03e86e385dc4b9bc03aee9976ad989baff1117babfa47a5aef87e86803",
		"0xf30f024df797147ff61b06a74f0c569e7840a1b4d9758316e38bbbd908b37eb8",
	},
}
View Source
var TestD3 = TestCase{

	BlockInfo: []string{
		"0xd690a9bb26d27d665768f67b8839ea6571a1e10c95ad69e38dac16d9686f5d9f",
		"0xc24323315f3735017026f754b3f6ee1bca3cdbb8e3f6b2476dd09aec4e40cb38",
		"0x1eba1d62712b43067cb8f913e682190eabf2dd020a4e954fdd4460a6099f09a7",
	},
}
View Source
var TestX = TestCase{
	BlockInfo: []string{
		"13123066",
		"13123067",
		"13123068",
		"13123069",
		"13123070",
	},
}
View Source
var Test_12969887_12969889_d3_b6 = TestCase{
	BlockInfo: []string{
		"12969885",
		"0xae396e35c045b8603de015e182ce1349c579c68bb00396bfb8a7b5946a4fa87c",
		"0xdca194ddb314c1c4e3de10ccfcb88bf9183a78118a393e1b3860e5eb10dd7c6c",
		"12969891",
	},
	ExpectedResult: ReorgTestResult{StartBlock: 12969887, EndBlock: 12969889, Depth: 3, NumBlocks: 6, NumReplacedBlocks: 3},
}
View Source
var Test_12991732_12991733_d2_b4 = TestCase{
	BlockInfo: []string{
		"12991730",
		"0xc5d7c2d6da0a4dba574ca6b7697b5850477d646fdb067b20d908060b0d5651c7",
		"0x61d0546aba46a166c185c584673e5afe911673e22ca75a754f165454b161e72a",
		"12991736",
	},
	ExpectedResult: ReorgTestResult{StartBlock: 12991732, EndBlock: 12991733, Depth: 2, NumBlocks: 4, NumReplacedBlocks: 2},
}
View Source
var Test_12996750_12996750_d1_b3_twouncles = TestCase{
	Name:           "2 uncles",
	BlockInfo:      []string{"12996749", "12996751"},
	ExpectedResult: ReorgTestResult{StartBlock: 12996750, EndBlock: 12996750, Depth: 1, NumBlocks: 3, NumReplacedBlocks: 2},
}
View Source
var Test_12996760_12996760_d1_b2 = TestCase{
	Name:           "1 uncle",
	BlockInfo:      []string{"12996760", "12996763"},
	ExpectedResult: ReorgTestResult{StartBlock: 12996760, EndBlock: 12996760, Depth: 1, NumBlocks: 2, NumReplacedBlocks: 1},
}
View Source
var Test_13017535_13017536_d2_b5 = TestCase{
	BlockInfo: []string{
		"0xd633f8b768ae1e6975eb0fbd8f5d7ef7b06151a9106a23c17b0ee1b4f74a9bed",
		"0xab672fe4e5ca25f44d8cf5c8be556a155d976ddc27a21e069172b3dda7335dad",
		"0xd24bb816d9416fe504dea1d2480e560f31d59a50035cd967142cbb118782a015",
		"0xfa5314344ed60908988e30524fbcdf4b1fef23a050339368c53c96c5461c956b",
		"0x990e488c4eebcb83d17c739311b639c41c200c3906093b6d80ed10d2a75c503b",
		"0xdc9a6e449e959ca888da7365d529ac9e05d98d9f7e88adc0e5016da13cef10b7",
		"0x3e0e26323edfe6728a4ded45716c138b9e85df50342eea4059f2354ac2937d08",
		"0xebf21cef1a406e30bb7b4d482591ca82e444f779efcb76ce67d09c2f548b4c82",
		"0xb22ff4c5759adb7e14da8644d2dfdef98bb0e43f3d548cdcdbb0c7fa78675413",
	},
	ExpectedResult: ReorgTestResult{StartBlock: 13017535, EndBlock: 13017536, Depth: 2, NumBlocks: 5, NumReplacedBlocks: 3},
}
View Source
var Test_13018369_13018370_d2_b4 = TestCase{
	BlockInfo: []string{
		"0xae416859b2ae32ac70dee15d3b164d81f27c5990312b72419bd0d15c856911bc",
		"0x9282169b84cde985685d6157438ef5a4ff7fa83a895ff31a4893c9400e87b0c9",
		"0xd9fb42a0296ebb85924366ada87d5acf8eae2069c408111c52c585b48bbb0ec0",
		"0xf06bf47c3332361f93cc24c45954949755fa4474631bdfeaa176b48929a56663",
		"0x94e290ab3ddaea782b826ea66094c429db1aeb632f80fe7fd003faad9e0a2001",
		"0x15d97a6e60b229e143e20bd1a810c3568f13b59a7c9a1f1098928e17389c355d",
		"0x6a5706073f58b14949fbb47c9107c480fbb34f9b96c72b34385ae3d06de489b6",
		"0x6b501f2591c5f16398497cf71ea7fcc845029847a39f90ebc01f76408a3c665f",
		"0xcfba4b54e919631d3b678ab82c9f22bc0cfc4e26341825088a447830d46a7ba1",
	},
	ExpectedResult: ReorgTestResult{StartBlock: 13018369, EndBlock: 13018370, Depth: 2, NumBlocks: 4, NumReplacedBlocks: 2},
}
View Source
var Test_13033424_13033425_d2_b5 = TestCase{
	BlockInfo: []string{
		"13033421",
		"0x29af3e566af450ec7443b1857944a7c266aed19707f348e24657bc4abc32ec9f",
		"0x42087d1b5230fd48172c19d301691aa0866d62739b00804e21ad9668a30fa461",
		"0x5996b0838dbd0d23458664633d1f7beef77be74a69abafdd588825b01ab1f15a",

		"0x448b1495889c0a1759e83d08b5550b14c7992b6dd84b0eda84414bbd62675337",
		"0x5c4aaa79df3c48f53282340c1893a4547d4d42c4ca3af5376dba34646832925d",
		"0xd608ccc185b058eae7c12547712244c38ddd98e515e8ba1df7e0af29b468bd3c",
		"0xb63bb5b0ee3bffb39c6afec9e7569150c9a9b170aba84f5a34c960ffb27046e4",
	},
	ExpectedResult: ReorgTestResult{StartBlock: 13033424, EndBlock: 13033425, Depth: 2, NumBlocks: 5, NumReplacedBlocks: 3},
}
View Source
var Test_Tmp = TestCase{
	Name:           "uncletest",
	BlockInfo:      []string{"13090277", "13090279"},
	ExpectedResult: ReorgTestResult{StartBlock: 13090277, EndBlock: 13090279, Depth: 1, NumBlocks: 3, NumReplacedBlocks: 2},
}

Functions

func Assert

func Assert(condition bool, errorMsg string)

func BlocksForStrings

func BlocksForStrings(blockStrings []string) (ret []*types.Block)

func Check

func Check(f string, got, want interface{}) error

func ConnectClient

func ConnectClient(uri string) (client *ethclient.Client, err error)

func GetBlockByHashStr

func GetBlockByHashStr(hashStr string) *types.Block

func GetBlockByNumber

func GetBlockByNumber(number int64) *types.Block

func Pcheck

func Pcheck(f string, got, want interface{})

func ReorgCheckAndPrint

func ReorgCheckAndPrint()

func ResetMon

func ResetMon()

Types

type ReorgTestResult

type ReorgTestResult struct {
	MustBeLive        bool
	StartBlock        uint64
	EndBlock          uint64
	Depth             int
	NumBlocks         int
	NumReplacedBlocks int
}

type TestCase

type TestCase struct {
	Name           string
	BlockInfo      []string
	ExpectedResult ReorgTestResult
}

Jump to

Keyboard shortcuts

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