use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccountsAliasNotFoundActionError.
@Test
void lookupAccountsAliasNotFoundActionError() {
Entity account1 = domainBuilder.entity().get();
Entity account2 = domainBuilder.entity().customize(e -> e.alias(null)).get();
assertThrows(AliasNotFoundException.class, () -> entityIdService.lookup(AliasNotFoundAction.ERROR, getProtoAccountId(account1), getProtoAccountId(account2)));
}
use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccountAliasNoMatch.
@Test
void lookupAccountAliasNoMatch() {
Entity account = domainBuilder.entity().get();
assertThrows(AliasNotFoundException.class, () -> entityIdService.lookup(getProtoAccountId(account)));
}
use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccounts.
@Test
void lookupAccounts() {
AccountID nullAccountId = null;
AccountID accountId = AccountID.newBuilder().setAccountNum(100).build();
AccountID accountIdInvalid = AccountID.newBuilder().setRealmNum(1).build();
Entity accountDeleted = domainBuilder.entity().customize(e -> e.deleted(true)).persist();
EntityId entityId = entityIdService.lookup(nullAccountId, AccountID.getDefaultInstance(), getProtoAccountId(accountDeleted), accountIdInvalid, accountId);
assertThat(entityId).isEqualTo(EntityId.of(accountId));
}
use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.
the class EntityRepositoryTest method history.
/**
* This test verifies that the Entity domain object and table definition are in sync with the entity_history table.
*/
@Test
void history() {
Entity entity = domainBuilder.entity().persist();
jdbcOperations.update("insert into entity_history select * from entity");
List<Entity> entityHistory = jdbcOperations.query("select * from entity_history", ROW_MAPPER);
assertThat(entityRepository.findAll()).containsExactly(entity);
assertThat(entityHistory).containsExactly(entity);
}
use of com.hedera.mirror.common.domain.entity.Entity in project hedera-mirror-node by hashgraph.
the class EthereumTransactionHandler method updateAccountNonce.
private void updateAccountNonce(RecordItem recordItem, EthereumTransaction ethereumTransaction) {
var record = recordItem.getRecord();
// It should not update the nonce if it's unsuccessful and failed before EVM execution
if (!recordItem.isSuccessful() && !record.hasContractCallResult() && !record.hasContractCreateResult()) {
return;
}
var functionResult = record.hasContractCreateResult() ? record.getContractCreateResult() : record.getContractCallResult();
var senderId = EntityId.of(functionResult.getSenderId());
if (!EntityId.isEmpty(senderId)) {
Entity entity = senderId.toEntity();
entity.setEthereumNonce(ethereumTransaction.getNonce() + 1);
// Don't trigger a history row
entity.setTimestampRange(null);
entityListener.onEntity(entity);
}
}
Aggregations