Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

PIE-1689: Fix behaviour for absent account permissiong smart contract #1569

Merged
merged 2 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -121,7 +121,11 @@ public boolean isPermitted(final Transaction transaction) {
transactionSimulator.doesAddressExistAtHead(contractAddress);

if (contractExists.isPresent() && !contractExists.get()) {
throw new IllegalStateException("Transaction permissioning contract does not exist");
this.checkCounterPermitted.inc();
LOG.warn(
"Account permissioning smart contract not found at address {} in current head block. Any transaction will be allowed.",
contractAddress);
return true;
}

final Optional<TransactionSimulatorResult> result =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,10 @@ public void testPermissioningContractMissing() throws IOException {

verifyCountersUntouched();

assertThatThrownBy(
() -> controller.isPermitted(transactionForAccount(Address.fromHexString("0x1"))))
.isInstanceOf(IllegalStateException.class)
.hasMessage("Transaction permissioning contract does not exist");
assertThat(controller.isPermitted(transactionForAccount(Address.fromHexString("0x1"))))
.isTrue();

verifyCountersFailedCheck();
verifyCountersPermitted();
}

@Test
Expand Down