Skip to content

Commit

Permalink
test: add test cases for libplanetWithdrawalTransactionHashing contract
Browse files Browse the repository at this point in the history
  • Loading branch information
sircoon4 committed Aug 8, 2024
1 parent e4d3bc4 commit 7a8fb00
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/vm/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var allPrecompiles = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{0x01, 0x00}): &p256Verify{},

common.BytesToAddress([]byte{0x02, 0x00}): &libplanetVerifyProof{},
common.BytesToAddress([]byte{0x02, 0x01}): &libplanetWithdrawalTransactionHashing{},

common.BytesToAddress([]byte{0x0f, 0x0a}): &bls12381G1Add{},
common.BytesToAddress([]byte{0x0f, 0x0b}): &bls12381G1Mul{},
Expand Down Expand Up @@ -412,3 +413,6 @@ func BenchmarkPrecompiledP256Verify(bench *testing.B) {

func TestPrecompiledP256Verify(t *testing.T) { testJson("p256Verify", "100", t) }
func TestPrecompiledLibplanetVerifyProof(t *testing.T) { testJson("libplanetVerifyProof", "200", t) }
func TestPrecompiledLibplanetWithdrawalTransactionHashing(t *testing.T) {
testJson("libplanetWithdrawalTransactionHashing", "201", t)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"Input": "0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000123456789012345678901234567890123456789000000000000000000000000012345678901234567890123456789012345678900000000000000000000000000000000000000000000000000000000000000064",
"Expected": "000000000000000000000000ca6cc7863dcd3bcb4b2114dd36e8ec6f780a5d51",
"Name": "sample1",
"Gas": 3000
},
{
"Input": "000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000047e0dd0b503c153d7fb78c43cc9ac135c60dfd94000000000000000000000000ce70f2e49927d431234bfc8d439412eef3a6276b00000000000000000000000000000000000000000000000000000000000003e8",
"Expected": "000000000000000000000000e33e6894de3b612044bb98643463f6aae93ac45e",
"Name": "sample2",
"Gas": 3000
},
{
"Input": "000000000000000000000000000000000000000000000000000000024cb016ea000000000000000000000000ce70f2e49927d431234bfc8d439412eef3a6276b00000000000000000000000047e0dd0b503c153d7fb78c43cc9ac135c60dfd9400000000000000000000000000000000000000000000000000000000499602d2",
"Expected": "00000000000000000000000016624ed881af995da7f1823bfa7b856541df8704",
"Name": "sample3",
"Gas": 3000
},
{
"Input": "0000000000000000000000000000000000000000000000000000000000000061000000000000000000000000ce70f2e49927d431234bfc8d439412eef3a6276b000000000000000000000000ce70f2e49927d431234bfc8d439412eef3a6276b00000000000000000000000000000000000000000000000000000000000004d2",
"Expected": "000000000000000000000000611540622771948e27ba4c651fd36eb417777a11",
"Name": "sample4",
"Gas": 3000
}
]

0 comments on commit 7a8fb00

Please sign in to comment.