Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Jan 13, 2025
1 parent 7e08db7 commit a289a56
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
12 changes: 10 additions & 2 deletions contracts/test/IntegrationTestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,11 @@ contract IntegrationTestBase is Test, TestParams, TestRegistry, TestSubnetActor,
weights[1] = 100;
weights[2] = 100;

TopdownCheckpoint memory finality = TopdownCheckpoint({height: block.number, blockHash: bytes32(0), effectsCommitment: new bytes(0)});
TopdownCheckpoint memory finality = TopdownCheckpoint({
height: block.number,
blockHash: bytes32(0),
effectsCommitment: new bytes(0)
});

vm.prank(FilAddress.SYSTEM_ACTOR);
gatewayDiamond.topDownFinalizer().commitTopdownCheckpoint(finality);
Expand Down Expand Up @@ -829,7 +833,11 @@ contract IntegrationTestBase is Test, TestParams, TestRegistry, TestSubnetActor,
weights[0] = weight;

vm.deal(validator, 1);
TopdownCheckpoint memory finality = TopdownCheckpoint({height: block.number, blockHash: bytes32(0), effectsCommitment: new bytes(0)});
TopdownCheckpoint memory finality = TopdownCheckpoint({
height: block.number,
blockHash: bytes32(0),
effectsCommitment: new bytes(0)
});
// uint64 n = gatewayDiamond.getter().getLastConfigurationNumber() + 1;

vm.startPrank(FilAddress.SYSTEM_ACTOR);
Expand Down
17 changes: 14 additions & 3 deletions contracts/test/integration/GatewayDiamond.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,11 @@ contract GatewayActorDiamondTest is Test, IntegrationTestBase, SubnetWithNativeT
vm.prank(caller);
vm.expectRevert(NotSystemActor.selector);

TopdownCheckpoint memory finality = TopdownCheckpoint({height: block.number, blockHash: bytes32(0), effectsCommitment: new bytes(0)});
TopdownCheckpoint memory finality = TopdownCheckpoint({
height: block.number,
blockHash: bytes32(0),
effectsCommitment: new bytes(0)
});

gatewayDiamond.topDownFinalizer().commitTopdownCheckpoint(finality);
}
Expand Down Expand Up @@ -1048,14 +1052,21 @@ contract GatewayActorDiamondTest is Test, IntegrationTestBase, SubnetWithNativeT
// not the same as init committed parent finality height
vm.roll(10);

TopdownCheckpoint memory finality = TopdownCheckpoint({height: block.number, blockHash: bytes32(0), effectsCommitment: new bytes(0)});
TopdownCheckpoint memory finality = TopdownCheckpoint({
height: block.number,
blockHash: bytes32(0),
effectsCommitment: new bytes(0)
});

gatewayDiamond.topDownFinalizer().commitTopdownCheckpoint(finality);
TopdownCheckpoint memory committedFinality = gatewayDiamond.getter().getTopdownCheckpoint(block.number);

require(committedFinality.height == finality.height, "heights are not equal");
require(committedFinality.blockHash == finality.blockHash, "blockHash is not equal");
require(gatewayDiamond.getter().getLatestTopdownCheckpoint().height == block.number, "finality height not equal");
require(
gatewayDiamond.getter().getLatestTopdownCheckpoint().height == block.number,
"finality height not equal"
);

vm.stopPrank();
}
Expand Down
6 changes: 5 additions & 1 deletion contracts/test/integration/MultiSubnet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,11 @@ contract MultiSubnetTest is Test, IntegrationTestBase {

function commitTopdownCheckpoint(address gateway) internal {
vm.roll(10);
TopdownCheckpoint memory finality = TopdownCheckpoint({height: block.number, blockHash: bytes32(0), effectsCommitment: new bytes(0)});
TopdownCheckpoint memory finality = TopdownCheckpoint({
height: block.number,
blockHash: bytes32(0),
effectsCommitment: new bytes(0)
});

TopDownFinalityFacet gwTopDownFinalityFacet = TopDownFinalityFacet(address(gateway));

Expand Down
2 changes: 1 addition & 1 deletion fendermint/vm/message/golden/chain/ipc_top_down.cbor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a163497063a16b546f70446f776e45786563a26463657274a2677061796c6f6164a36d706172656e745f6865696768741bffffffffffffffff6b706172656e745f6861736885189f183918f9188b18357763756d756c61746976655f656666656374735f636f6d6d8801183a186018a7184e182f181c183a6a7369676e61747572657381f66765666665637473828080
a163497063a16b546f70446f776e45786563a26463657274a2677061796c6f6164a374706172656e745f7375626e65745f6865696768741bb71f35f7c2df1f1c72706172656e745f7375626e65745f68617368890418a918771891187c187a1872187118927763756d756c61746976655f656666656374735f636f6d6d8118bd6a7369676e61747572657381f66765666665637473828080
2 changes: 1 addition & 1 deletion fendermint/vm/message/golden/chain/ipc_top_down.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Ipc(TopDownExec(TopdownProposal { cert: ECDSACertificate { payload: Observation { parent_height: 18446744073709551615, parent_hash: [159, 57, 249, 139, 53], cumulative_effects_comm: [1, 58, 96, 167, 78, 47, 28, 58] }, signatures: [None] }, effects: ([], []) }))
Ipc(TopDownExec(TopdownProposal { cert: ECDSACertificate { payload: Observation { parent_subnet_height: 13195324771461439260, parent_subnet_hash: [4, 169, 119, 145, 124, 122, 114, 113, 146], cumulative_effects_comm: [189] }, signatures: [None] }, effects: ([], []) }))
3 changes: 2 additions & 1 deletion fendermint/vm/topdown/src/vote/tally.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ impl<S: VoteStore> VoteTally<S> {
}

if self.votes.has_voted(&parent_height, &validator)? {
tracing::warn!(
tracing::error!(
parent_height,
validator = validator.to_string(),
"equivocation by validator"
);
return Err(Error::Equivocation);
}

self.votes.store_vote(parent_height, vote)?;
Expand Down

0 comments on commit a289a56

Please sign in to comment.