mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Add methods for ZKInputs IntermStates generation
- Add L1Tx TxCompressedData method - Add PoolL2Tx TxCompressedDataV2 method - Update ProcessTxs logic - Add ZKInputs Intermediate States & Fee parameters calculation
This commit is contained in:
@@ -49,6 +49,22 @@ func TestNewL1CoordinatorTx(t *testing.T) {
|
||||
assert.Equal(t, "0x01000000000000cafe005800", l1Tx.TxID.String())
|
||||
}
|
||||
|
||||
func TestL1TxCompressedData(t *testing.T) {
|
||||
tx := L1Tx{
|
||||
FromIdx: 2,
|
||||
ToIdx: 3,
|
||||
Amount: big.NewInt(4),
|
||||
TokenID: 5,
|
||||
}
|
||||
txCompressedData, err := tx.TxCompressedData()
|
||||
assert.Nil(t, err)
|
||||
|
||||
// test vector value generated from javascript implementation
|
||||
expectedStr := "7307597389635308713748674793997299267460566876160"
|
||||
assert.Equal(t, expectedStr, txCompressedData.String())
|
||||
assert.Equal(t, "050004000000000003000000000002000100000000", hex.EncodeToString(txCompressedData.Bytes()))
|
||||
}
|
||||
|
||||
func TestL1userTxByteParsers(t *testing.T) {
|
||||
var pkComp babyjub.PublicKeyComp
|
||||
pkCompL := []byte("0x56ca90f80d7c374ae7485e9bcc47d4ac399460948da6aeeb899311097925a72c")
|
||||
|
||||
Reference in New Issue
Block a user