Skip to content

Commit

Permalink
test: fix nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
huyhuynh3103 committed Jan 27, 2024
1 parent 30b4d1b commit 1ad9cff
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
33 changes: 25 additions & 8 deletions test/bridge/integration/BaseIntegration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ contract BaseIntegration_Test is Base_Test {
RoninBridgeAdminUtils _roninProposalUtils;
ProposalUtils _mainchainProposalUtils;

uint256 _roninNonce = 1;
uint256 _mainchainNonce = 1;

function setUp() public virtual {
_deployGeneralConfig();

Expand Down Expand Up @@ -325,7 +322,7 @@ contract BaseIntegration_Test is Base_Test {
value: 0,
calldata_: abi.encodeCall(GlobalCoreGovernance.updateManyTargetOption, (param.targetOptions, param.targets)),
gasAmount: 500_000,
nonce: _roninNonce++
nonce: _roninBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
Expand All @@ -342,7 +339,7 @@ contract BaseIntegration_Test is Base_Test {
value: 0,
calldata_: abi.encodeCall(IHasContracts.setContract, (ContractType.BRIDGE, param.bridgeContract)),
gasAmount: 500_000,
nonce: _roninNonce++
nonce: _roninBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
Expand All @@ -362,7 +359,7 @@ contract BaseIntegration_Test is Base_Test {
value: 0,
calldata_: calldata_,
gasAmount: 500_000,
nonce: _roninNonce++
nonce: _roninBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
Expand Down Expand Up @@ -400,7 +397,7 @@ contract BaseIntegration_Test is Base_Test {
value: 0,
calldata_: abi.encodeCall(GlobalCoreGovernance.updateManyTargetOption, (param.targetOptions, param.targets)),
gasAmount: 500_000,
nonce: _mainchainNonce++
nonce: _mainchainBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
Expand All @@ -417,7 +414,27 @@ contract BaseIntegration_Test is Base_Test {
value: 0,
calldata_: abi.encodeCall(IHasContracts.setContract, (ContractType.BRIDGE, param.bridgeContract)),
gasAmount: 500_000,
nonce: _mainchainNonce++
nonce: _mainchainBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
_mainchainProposalUtils.generateSignaturesGlobal(globalProposal, _param.test.governorPKs);

vm.prank(_param.roninBridgeManager.governors[0]);
_mainchainBridgeManager.relayGlobalProposal(globalProposal, supports_, signatures);
}

{
// set callback register
bytes memory calldata_ =
abi.encodeCall(IBridgeManagerCallbackRegister.registerCallbacks, (param.callbackRegisters));
GlobalProposal.GlobalProposalDetail memory globalProposal = _mainchainProposalUtils.createGlobalProposal({
expiryTimestamp: block.timestamp + 10,
targetOption: GlobalProposal.TargetOption.BridgeManager,
value: 0,
calldata_: calldata_,
gasAmount: 500_000,
nonce: _mainchainBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ contract VoteBridgeOperator_RoninBridgeManager_Test is BaseIntegration_Test {
targetOption: GlobalProposal.TargetOption.BridgeManager,
value: 0,
calldata_: abi.encodeCall(IBridgeManager.addBridgeOperators, (_voteWeights, _addingGovernors, _addingOperators)),
gasAmount: 500_000,
nonce: _roninNonce++
gasAmount: 1_000_000,
nonce: _roninBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
Expand Down Expand Up @@ -125,7 +125,7 @@ contract VoteBridgeOperator_RoninBridgeManager_Test is BaseIntegration_Test {
value: 0,
calldata_: abi.encodeCall(IBridgeManager.addBridgeOperators, (_voteWeights, _addingGovernors, _addingOperators)),
gasAmount: 200_000 * numAddingOperators,
nonce: _roninNonce++
nonce: _roninBridgeManager.round(0) + 1
});

SignatureConsumer.Signature[] memory signatures =
Expand Down

0 comments on commit 1ad9cff

Please sign in to comment.