fix for latest commit with better name
This commit is contained in:
parent
a659787a8f
commit
ffef5a8bb9
|
@ -59,7 +59,7 @@ public class DataWord implements Comparable<DataWord> {
|
||||||
public byte[] getNoLeadZeroesData() {
|
public byte[] getNoLeadZeroesData() {
|
||||||
return ByteUtil.stripLeadingZeroes(data);
|
return ByteUtil.stripLeadingZeroes(data);
|
||||||
}
|
}
|
||||||
public byte[] getAddress() {
|
public byte[] getLast20Bytes() {
|
||||||
return Arrays.copyOfRange(data, 12, data.length);
|
return Arrays.copyOfRange(data, 12, data.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class Program {
|
||||||
|
|
||||||
this.invokeData = invokeData;
|
this.invokeData = invokeData;
|
||||||
this.ops = ops;
|
this.ops = ops;
|
||||||
this.programAddress = invokeData.getOwnerAddress().getAddress();
|
this.programAddress = invokeData.getOwnerAddress().getLast20Bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getCurrentOp() {
|
public byte getCurrentOp() {
|
||||||
|
@ -217,11 +217,11 @@ public class Program {
|
||||||
DataWord balance = getBalance(this.getOwnerAddress());
|
DataWord balance = getBalance(this.getOwnerAddress());
|
||||||
// 1) pass full endowment to the obtainer
|
// 1) pass full endowment to the obtainer
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
logger.info("Transfer to: [ {} ] heritage: [ {} ]", Hex.toHexString(obtainer.getAddress())
|
logger.info("Transfer to: [ {} ] heritage: [ {} ]", Hex.toHexString(obtainer.getLast20Bytes())
|
||||||
, balance.longValue());
|
, balance.longValue());
|
||||||
|
|
||||||
this.result.getRepository().addBalance(obtainer.getAddress(), balance.value());
|
this.result.getRepository().addBalance(obtainer.getLast20Bytes(), balance.value());
|
||||||
this.result.getRepository().addBalance(this.getOwnerAddress().getAddress(), balance.value().negate());
|
this.result.getRepository().addBalance(this.getOwnerAddress().getLast20Bytes(), balance.value().negate());
|
||||||
|
|
||||||
// 2) mark the account as for delete
|
// 2) mark the account as for delete
|
||||||
result.addDeleteAccount(this.getOwnerAddress());
|
result.addDeleteAccount(this.getOwnerAddress());
|
||||||
|
@ -237,7 +237,7 @@ public class Program {
|
||||||
// [1] FETCH THE CODE FROM THE MEMORY
|
// [1] FETCH THE CODE FROM THE MEMORY
|
||||||
ByteBuffer programCode = memoryChunk(memStart, memSize);
|
ByteBuffer programCode = memoryChunk(memStart, memSize);
|
||||||
|
|
||||||
byte[] senderAddress = this.getOwnerAddress().getAddress();
|
byte[] senderAddress = this.getOwnerAddress().getLast20Bytes();
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
logger.info("creating a new contract inside contract run: [{}]", Hex.toHexString(senderAddress));
|
logger.info("creating a new contract inside contract run: [{}]", Hex.toHexString(senderAddress));
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ public class Program {
|
||||||
|
|
||||||
// [2] CREATE THE CONTRACT ADDRESS
|
// [2] CREATE THE CONTRACT ADDRESS
|
||||||
byte[] nonce = result.getRepository().getNonce(senderAddress).toByteArray();
|
byte[] nonce = result.getRepository().getNonce(senderAddress).toByteArray();
|
||||||
byte[] newAddress = HashUtil.calcNewAddr(this.getOwnerAddress().getAddress(), nonce);
|
byte[] newAddress = HashUtil.calcNewAddr(this.getOwnerAddress().getLast20Bytes(), nonce);
|
||||||
result.getRepository().createAccount(newAddress);
|
result.getRepository().createAccount(newAddress);
|
||||||
|
|
||||||
// [3] UPDATE THE NONCE
|
// [3] UPDATE THE NONCE
|
||||||
|
@ -303,7 +303,7 @@ public class Program {
|
||||||
if (logger.isInfoEnabled()){
|
if (logger.isInfoEnabled()){
|
||||||
|
|
||||||
logger.info("The remain gas refunded, account: [ {} ], gas: [ {} ] ",
|
logger.info("The remain gas refunded, account: [ {} ], gas: [ {} ] ",
|
||||||
Hex.toHexString(this.getOwnerAddress().getAddress()),
|
Hex.toHexString(this.getOwnerAddress().getLast20Bytes()),
|
||||||
refundGas);
|
refundGas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ public class Program {
|
||||||
ByteBuffer data = memoryChunk(inDataOffs, inDataSize);
|
ByteBuffer data = memoryChunk(inDataOffs, inDataSize);
|
||||||
|
|
||||||
// FETCH THE SAVED STORAGE
|
// FETCH THE SAVED STORAGE
|
||||||
byte[] toAddress = toAddressDW.getAddress();
|
byte[] toAddress = toAddressDW.getLast20Bytes();
|
||||||
|
|
||||||
// FETCH THE CODE
|
// FETCH THE CODE
|
||||||
byte[] programCode = this.result.getRepository().getCode(toAddress);
|
byte[] programCode = this.result.getRepository().getCode(toAddress);
|
||||||
|
@ -336,7 +336,7 @@ public class Program {
|
||||||
logger.info("calling for existing contract: address={}",
|
logger.info("calling for existing contract: address={}",
|
||||||
Hex.toHexString(toAddress));
|
Hex.toHexString(toAddress));
|
||||||
|
|
||||||
byte[] senderAddress = this.getOwnerAddress().getAddress();
|
byte[] senderAddress = this.getOwnerAddress().getLast20Bytes();
|
||||||
|
|
||||||
// 2.1 PERFORM THE GAS VALUE TX
|
// 2.1 PERFORM THE GAS VALUE TX
|
||||||
// (THIS STAGE IS NOT REVERTED BY ANY EXCEPTION)
|
// (THIS STAGE IS NOT REVERTED BY ANY EXCEPTION)
|
||||||
|
@ -362,7 +362,7 @@ public class Program {
|
||||||
stackPushOne();
|
stackPushOne();
|
||||||
|
|
||||||
this.getResult().addCallCreate(data.array(),
|
this.getResult().addCallCreate(data.array(),
|
||||||
toAddressDW.getAddress(),
|
toAddressDW.getLast20Bytes(),
|
||||||
gas.getNoLeadZeroesData(), endowmentValue.getNoLeadZeroesData());
|
gas.getNoLeadZeroesData(), endowmentValue.getNoLeadZeroesData());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -469,7 +469,7 @@ public class Program {
|
||||||
public DataWord getBalance(DataWord address) {
|
public DataWord getBalance(DataWord address) {
|
||||||
if (invokeData == null) return new DataWord( new byte[0]);
|
if (invokeData == null) return new DataWord( new byte[0]);
|
||||||
|
|
||||||
BigInteger balance = result.getRepository().getBalance(address.getAddress());
|
BigInteger balance = result.getRepository().getBalance(address.getLast20Bytes());
|
||||||
DataWord balanceData = new DataWord(balance.toByteArray());
|
DataWord balanceData = new DataWord(balance.toByteArray());
|
||||||
|
|
||||||
return balanceData;
|
return balanceData;
|
||||||
|
|
Loading…
Reference in New Issue