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

Moved Contract Call Event Before Contract Update #105

Merged
4 commits merged into from
Sep 20, 2023
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
28 changes: 14 additions & 14 deletions backend/Application/Aggregates/Contract/ContractAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,22 +278,8 @@ await repository
));
break;
case ContractUpdated contractUpdated:
await repository
.AddAsync(new ContractEvent(
blockHeight,
transactionHash,
transactionIndex,
eventIndex,
contractUpdated.ContractAddress,
sender,
contractUpdated,
source,
blockSlotTime
));
if (contractUpdated.Instigator is ContractAddress contractInstigator)
{
// Possible a contract has called itself.
eventIndex += 1;
await repository
.AddAsync(new ContractEvent(
blockHeight,
Expand All @@ -308,7 +294,21 @@ await repository
source,
blockSlotTime
));
// Possible a contract has called itself.
eventIndex += 1;
}
await repository
.AddAsync(new ContractEvent(
blockHeight,
transactionHash,
transactionIndex,
eventIndex,
contractUpdated.ContractAddress,
sender,
contractUpdated,
source,
blockSlotTime
));
break;
case ContractUpgraded contractUpgraded:
await repository
Expand Down
3 changes: 1 addition & 2 deletions backend/Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<Version>1.7.0</Version>
<Version>1.7.1</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ConcordiumNetSdk" Version="4.0.1" />
<PackageReference Include="Dapper" Version="2.0.123" />
Expand Down
9 changes: 4 additions & 5 deletions backend/Tests/Aggregates/Contract/ContractAggregateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,12 @@ await ContractAggregate.StoreEvent(

// Assert
contractEvents.Count.Should().Be(2);
var updateEvent = contractEvents[0];
updateEvent.Event.Should().BeOfType<ContractUpdated>();
updateEvent.ContractAddressIndex.Should().Be(from);

var transferEvent = contractEvents[1];
var transferEvent = contractEvents[0];
transferEvent.Event.Should().BeOfType<ContractCall>();
transferEvent.ContractAddressIndex.Should().Be(to);
var updateEvent = contractEvents[1];
updateEvent.Event.Should().BeOfType<ContractUpdated>();
updateEvent.ContractAddressIndex.Should().Be(from);
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ccscan-frontend",
"description": "CCDScan frontend",
"version": "1.5.0",
"version": "1.5.1",
"engine": "16",
"type": "module",
"private": true,
Expand Down