Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unboxing issue causing errors in acceptance tests #10375

Merged
merged 4 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@
}

public static com.hedera.hapi.node.base.AccountID toAccountId(final Long id) {
if (id == null) {
return null;

Check warning on line 166 in hedera-mirror-web3/src/main/java/com/hedera/services/utils/EntityIdUtils.java

View check run for this annotation

Codecov / codecov/patch

hedera-mirror-web3/src/main/java/com/hedera/services/utils/EntityIdUtils.java#L166

Added line #L166 was not covered by tests
}
final var decodedEntityId = EntityId.of(id);

return toAccountId(decodedEntityId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,37 @@ void associateToken(final Boolean single) throws Exception {
verifyOpcodeTracerCall(functionCall.encodeFunctionCall(), contract);
}

@ParameterizedTest
@ValueSource(booleans = {true, false})
void associateTokenWithNullAutoRenew(final Boolean single) throws Exception {
// Given
final var notAssociatedAccount = accountEntityPersistCustomizable(e -> e.type(EntityType.ACCOUNT)
.balance(DEFAULT_ACCOUNT_BALANCE)
.autoRenewAccountId(null)
.alias(null)
.evmAddress(null));

final var tokenEntity = tokenEntityPersist();

domainBuilder
.token()
.customize(t -> t.tokenId(tokenEntity.getId()).type(TokenTypeEnum.FUNGIBLE_COMMON))
.persist();

final var contract = testWeb3jService.deploy(ModificationPrecompileTestContract::deploy);

// When
final var functionCall = single
? contract.call_associateTokenExternal(
getAddressFromEntity(notAssociatedAccount), getAddressFromEntity(tokenEntity))
: contract.call_associateTokensExternal(
getAddressFromEntity(notAssociatedAccount), List.of(getAddressFromEntity(tokenEntity)));

// Then
verifyEthCallAndEstimateGas(functionCall, contract, ZERO_VALUE);
verifyOpcodeTracerCall(functionCall.encodeFunctionCall(), contract);
}

@Test
void associateTokenHRC() throws Exception {
// Given
Expand Down
Loading