Skip to content

Commit

Permalink
<fix>(precompiled,executor): fix internal create write empty abi stri…
Browse files Browse the repository at this point in the history
…ng bug in 3.0.0. (FISCO-BCOS#4269)
  • Loading branch information
kyonRay authored Mar 1, 2024
1 parent 91b07dd commit f4b2cdc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions bcos-executor/src/executive/TransactionExecutive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,17 +851,31 @@ CallParameters::UniquePtr TransactionExecutive::internalCreate(
Entry entry = {};
entry.importFields({std::move(codeString)});
m_storageWrapper->setRow(codeTable, ACCOUNT_CODE, std::move(entry));
if (!callParameters->abi.empty())
if (!callParameters->abi.empty() &&
blockContext().blockVersion() != (uint32_t)protocol::BlockVersion::V3_0_VERSION)
{
Entry abiEntry = {};
abiEntry.importFields({std::move(callParameters->abi)});
m_storageWrapper->setRow(codeTable, ACCOUNT_ABI, std::move(abiEntry));
}
}

/// set link data
tool::BfsFileFactory::buildLink(
linkTable.value(), newAddress, "", blockContext().blockVersion());
if (blockContext().blockVersion() == (uint32_t)protocol::BlockVersion::V3_0_VERSION)
{
/// set link data
Entry addressEntry = {};
addressEntry.importFields({newAddress});
m_storageWrapper->setRow(tableName, FS_LINK_ADDRESS, std::move(addressEntry));
Entry typeEntry = {};
typeEntry.importFields({FS_TYPE_LINK});
m_storageWrapper->setRow(tableName, FS_KEY_TYPE, std::move(typeEntry));
}
else
{
/// set link data
tool::BfsFileFactory::buildLink(
linkTable.value(), newAddress, "", blockContext().blockVersion());
}
}
callParameters->type = CallParameters::FINISHED;
callParameters->status = (int32_t)TransactionStatus::None;
Expand Down
2 changes: 1 addition & 1 deletion bcos-tool/bcos-tool/BfsFileFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ bool BfsFileFactory::buildLink(Table& _table, const std::string& _address, const
_table.setRow(FS_LINK_ABI, std::move(abiEntry));
}

if (!name.empty())
if (!name.empty() || blockVersion == (uint32_t)protocol::BlockVersion::V3_0_VERSION)
{
Entry nameEntry;
nameEntry.importFields({name});
Expand Down

0 comments on commit f4b2cdc

Please sign in to comment.