![](/img/trans.png)
[英]What is the Connection URL to connect to ethereum kovan to connect with my smart contract
[英]What is the max size of a smart contract on the RSK network?
RSK 是否有已編譯智能合約的最大大小? 如果是這樣,可以部署的字節碼的最大大小是多少?
是的,最大大小為24567
,即 ~24KB。
這在Constants#getMaxContractSize()
定義
public static int getMaxContractSize() {
return 0x6000;
}
合約部署期間的特定邏輯在TransactionExecutor#createContract()
使用此值
private void createContract() {
int createdContractSize = getLength(program.getResult().getHReturn());
long returnDataGasValue = GasCost.multiply(GasCost.CREATE_DATA, createdContractSize);
if (mEndGas < returnDataGasValue) {
program.setRuntimeFailure(
Program.ExceptionHelper.notEnoughSpendingGas(
program,
"No gas to return just created contract",
returnDataGasValue));
result = program.getResult();
result.setHReturn(EMPTY_BYTE_ARRAY);
} else if (createdContractSize > Constants.getMaxContractSize()) {
program.setRuntimeFailure(
Program.ExceptionHelper.tooLargeContractSize(
program,
Constants.getMaxContractSize(),
createdContractSize));
result = program.getResult();
result.setHReturn(EMPTY_BYTE_ARRAY);
} else {
mEndGas = GasCost.subtract(mEndGas, returnDataGasValue);
program.spendGas(returnDataGasValue, "CONTRACT DATA COST");
cacheTrack.saveCode(tx.getContractAddress(), result.getHReturn());
}
}
與您的問題相關的上述函數的部分是需要滿足條件(createdContractSize > Constants.getMaxContractSize())
,否則會引發異常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.