Open Jiuhong-casperlabs opened 1 year ago
Delegation has the same error java.nio.BufferOverflowException
. Here is the code
package com.jh;
import java.io.File;
import java.io.InputStream;
import com.casper.sdk.helper.CasperValidatorHelper;
import com.casper.sdk.model.deploy.Deploy;
import com.casper.sdk.model.deploy.DeployResult;
import com.casper.sdk.model.key.PublicKey;
import com.casper.sdk.service.CasperService;
import com.syntifi.crypto.key.Ed25519PrivateKey;
import java.math.BigInteger;
public class TestDelegate {
public static void main(String args[]) {
Ed25519PrivateKey from = new Ed25519PrivateKey();
try {
// from
File f = new File("/home/jh/keys/test1/secret_key.pem");
String frompath = f.getPath();
from.readPrivateKey(frompath);
// validator public key
PublicKey validator = PublicKey
.fromTaggedHexString("0109b48a169e6163078a07b6248f330133236c6e390fe915813c187c3f268c213e");
// delegator public key
PublicKey delegator = PublicKey
.fromTaggedHexString("0193b3800386aefe11648150f6779158f2c7e1233c8e9b423338eb71b93ae6c5a9");
// wasm file
String filePath = "wasm/contract.wasm";
InputStream contractwasmIn = HowToUtils.getWasmIn(filePath);
System.out.println("contractwasmIn=>" + contractwasmIn);
byte[] wasmBytes = HowToUtils.readWasm(contractwasmIn);
// build deploy
Deploy deploy = CasperValidatorHelper.createValidatorDelegation(from, wasmBytes,
BigInteger.valueOf(2500000000L), validator, delegator, "casper-test");
// send deploy
final CasperService casperService = CasperService.usingPeer("94.130.10.55",
7777);
DeployResult deployResult = casperService.putDeploy(deploy);
// deploy hash
System.out.println(deployResult.getDeployHash());
} catch (Exception e) {
System.out.println("err");
System.out.println(e);
}
}
}
Hello,
When installing contract I have
java.nio.BufferOverflowException
issue while it worked fine on previous version. Can you add a such example please?Thank you.