diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index 20d1b3adf1..e2c34487a6 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -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{}, @@ -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) +} diff --git a/core/vm/testdata/precompiles/libplanetWithdrawalTransactionHashing.json b/core/vm/testdata/precompiles/libplanetWithdrawalTransactionHashing.json new file mode 100644 index 0000000000..ee1c0281c6 --- /dev/null +++ b/core/vm/testdata/precompiles/libplanetWithdrawalTransactionHashing.json @@ -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 + } +] \ No newline at end of file