Coverage Summary for Class: BN128Multiplication (co.rsk.pcc.altBN128)

Class Class, % Method, % Line, %
BN128Multiplication 0% (0/1) 0% (0/3) 0% (0/4)


1 /* 2  * This file is part of RskJ 3  * Copyright (C) 2019 RSK Labs Ltd. 4  * 5  * This program is free software: you can redistribute it and/or modify 6  * it under the terms of the GNU Lesser General Public License as published by 7  * the Free Software Foundation, either version 3 of the License, or 8  * (at your option) any later version. 9  * 10  * This program is distributed in the hope that it will be useful, 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13  * GNU Lesser General Public License for more details. 14  * 15  * You should have received a copy of the GNU Lesser General Public License 16  * along with this program. If not, see <http://www.gnu.org/licenses/>. 17  */ 18  19 package co.rsk.pcc.altBN128; 20  21 import co.rsk.pcc.altBN128.impls.AbstractAltBN128; 22 import org.ethereum.config.blockchain.upgrades.ActivationConfig; 23 import org.ethereum.vm.GasCost; 24  25 /** 26  * Computes multiplication of scalar value on a point belonging to Barreto–Naehrig curve. 27  * See {@link BN128Fp} for details<br/> 28  * <br/> 29  * 30  * input data[]:<br/> 31  * point encoded as (x, y) is followed by scalar s, where x, y and s are 32-byte left-padded integers,<br/> 32  * if input is shorter than expected, it's assumed to be right-padded with zero bytes<br/> 33  * <br/> 34  * 35  * output:<br/> 36  * resulting point (x', y'), where x and y encoded as 32-byte left-padded integers<br/> 37  * 38  */ 39  40 /** 41  * @author Sebastian Sicardi 42  * @since 10.09.2019 43  */ 44 public class BN128Multiplication extends BN128PrecompiledContract { 45  46  public BN128Multiplication(ActivationConfig.ForBlock activations, AbstractAltBN128 altBN128) { 47  super(activations, altBN128); 48  } 49  50  @Override 51  public long getGasForData(byte[] data) { 52  return GasCost.toGas(6000); 53  } 54  55  @Override 56  protected int concreteExecute(byte[] data) { 57  return altBN128Lib.mul(data, data.length); 58  } 59 }