Skip to content

Commit b55e66d

Browse files
committed
ops: fix merge
2 parents 8a1db83 + 573ba7a commit b55e66d

File tree

3 files changed

+42
-31
lines changed

3 files changed

+42
-31
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
[0.4.1]
8+
[0.4.2]
99

1010
### Changed
1111

12+
- `submitReward` accepts integer rewards [PR#42](https://github.com/gensyn-ai/rl-swarm-contracts/pull/42)
13+
14+
[0.4.1]
15+
1216
### Fixed
1317

1418
- `submitReward` checks provided stageNumber to be current or past [PR#41](https://github.com/gensyn-ai/rl-swarm-contracts/pull/41)

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ This repository contains the smart contracts for the RL Swarm project, focusing
88

99
If you want to interact with the contract, use the `SwarmCoordinatorProxy`.
1010

11+
- v0.4.2
12+
- Small:
13+
- [SwarmCoordinatorProxy](https://gensyn-testnet.explorer.alchemy.com/address/0x69C6e1D608ec64885E7b185d39b04B491a71768C)
14+
- [SwarmCoordinator Implementation](https://gensyn-testnet.explorer.alchemy.com/address/)
15+
- Big:
16+
- [SwarmCoordinatorProxy](https://gensyn-testnet.explorer.alchemy.com/address/0x6947c6E196a48B77eFa9331EC1E3e45f3Ee5Fd58)
17+
- [SwarmCoordinator Implementation](https://gensyn-testnet.explorer.alchemy.com/address/)
1118
- v0.4.1
1219
- Small:
1320
- [SwarmCoordinatorProxy](https://gensyn-testnet.explorer.alchemy.com/address/0x69C6e1D608ec64885E7b185d39b04B491a71768C)

test/SwarmCoordinator.t.sol

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ contract SwarmCoordinatorTest is Test {
10971097
}
10981098

10991099
function test_Anyone_CanSubmitReward_Successfully() public {
1100-
uint256 reward = 100;
1100+
int256 reward = 100;
11011101
string memory peerId1 = "QmPeer1";
11021102

11031103
vm.startPrank(_user1);
@@ -1112,18 +1112,18 @@ contract SwarmCoordinatorTest is Test {
11121112
// Verify reward was recorded
11131113
address[] memory accounts = new address[](1);
11141114
accounts[0] = _user1;
1115-
uint256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1115+
int256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
11161116
string[] memory peerIds = new string[](1);
11171117
peerIds[0] = peerId1;
1118-
uint256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
1118+
int256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
11191119
assertEq(rewards[0], reward);
11201120
assertEq(totalRewards[0], reward);
11211121
assertTrue(swarmCoordinator.hasSubmittedRoundStageReward(0, 0, _user1));
11221122
}
11231123

11241124
function test_Nobody_CanSubmitReward_TwiceInSameRoundAndStage_Fails() public {
1125-
uint256 reward1 = 100;
1126-
uint256 reward2 = 200;
1125+
int256 reward1 = 100;
1126+
int256 reward2 = 200;
11271127
string memory peerId1 = "QmPeer1";
11281128

11291129
// First submission
@@ -1138,7 +1138,7 @@ contract SwarmCoordinatorTest is Test {
11381138
}
11391139

11401140
function test_Nobody_CanSubmitReward_InFutureStage_Fails() public {
1141-
uint256 reward1 = 100;
1141+
int256 reward1 = 100;
11421142
string memory peerId1 = "QmPeer1";
11431143

11441144
// Make sure we're in stage 0
@@ -1153,8 +1153,8 @@ contract SwarmCoordinatorTest is Test {
11531153
}
11541154

11551155
function test_Anyone_CanSubmitReward_InDifferentStages_Successfully() public {
1156-
uint256 reward1 = 100;
1157-
uint256 reward2 = 200;
1156+
int256 reward1 = 100;
1157+
int256 reward2 = 200;
11581158

11591159
string memory peerId1 = "QmPeer1";
11601160

@@ -1185,19 +1185,19 @@ contract SwarmCoordinatorTest is Test {
11851185
// Verify rewards were recorded correctly
11861186
address[] memory accounts = new address[](1);
11871187
accounts[0] = _user1;
1188-
uint256[] memory rewards0 = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1189-
uint256[] memory rewards1 = swarmCoordinator.getRoundStageReward(0, 1, accounts);
1188+
int256[] memory rewards0 = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1189+
int256[] memory rewards1 = swarmCoordinator.getRoundStageReward(0, 1, accounts);
11901190
string[] memory peerIds = new string[](1);
11911191
peerIds[0] = peerId1;
1192-
uint256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
1192+
int256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
11931193
assertEq(rewards0[0], reward1);
11941194
assertEq(rewards1[0], reward2);
11951195
assertEq(totalRewards[0], reward1 + reward2);
11961196
}
11971197

11981198
function test_Anyone_CanSubmitReward_InDifferentRounds_Successfully() public {
1199-
uint256 reward1 = 100;
1200-
uint256 reward2 = 200;
1199+
int256 reward1 = 100;
1200+
int256 reward2 = 200;
12011201
string memory peerId1 = "QmPeer1";
12021202

12031203
// Submit reward in round 0
@@ -1224,19 +1224,19 @@ contract SwarmCoordinatorTest is Test {
12241224
// Verify rewards were recorded correctly
12251225
address[] memory accounts = new address[](1);
12261226
accounts[0] = _user1;
1227-
uint256[] memory rewards0 = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1228-
uint256[] memory rewards1 = swarmCoordinator.getRoundStageReward(1, 0, accounts);
1227+
int256[] memory rewards0 = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1228+
int256[] memory rewards1 = swarmCoordinator.getRoundStageReward(1, 0, accounts);
12291229
string[] memory peerIds = new string[](1);
12301230
peerIds[0] = peerId1;
1231-
uint256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
1231+
int256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
12321232
assertEq(rewards0[0], reward1);
12331233
assertEq(rewards1[0], reward2);
12341234
assertEq(totalRewards[0], reward1 + reward2);
12351235
}
12361236

12371237
function test_Anyone_CanSubmitReward_ForPastRound_Successfully() public {
1238-
uint256 reward1 = 100;
1239-
uint256 reward2 = 200;
1238+
int256 reward1 = 100;
1239+
int256 reward2 = 200;
12401240

12411241
string memory peerId1 = "QmPeer1";
12421242
string memory peerId2 = "QmPeer2";
@@ -1260,13 +1260,13 @@ contract SwarmCoordinatorTest is Test {
12601260
address[] memory accounts = new address[](2);
12611261
accounts[0] = _user1;
12621262
accounts[1] = _user2;
1263-
uint256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1263+
int256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
12641264
assertEq(rewards[0], reward1);
12651265
assertEq(rewards[1], reward2);
12661266
}
12671267

12681268
function test_Nobody_CanSubmitRewards_ForDifferentPeer_Fails() public {
1269-
uint256 reward1 = 100;
1269+
int256 reward1 = 100;
12701270

12711271
string memory peerId1 = "QmPeer1";
12721272
string memory peerId2 = "QmPeer2";
@@ -1283,9 +1283,9 @@ contract SwarmCoordinatorTest is Test {
12831283
}
12841284

12851285
function test_GetRoundStageReward_MultipleAddresses_Successfully() public {
1286-
uint256 reward1 = 100;
1287-
uint256 reward2 = 200;
1288-
uint256 reward3 = 300;
1286+
int256 reward1 = 100;
1287+
int256 reward2 = 200;
1288+
int256 reward3 = 300;
12891289

12901290
string memory peerId1 = "QmPeer1";
12911291
string memory peerId2 = "QmPeer2";
@@ -1312,7 +1312,7 @@ contract SwarmCoordinatorTest is Test {
13121312
accounts[0] = _user1;
13131313
accounts[1] = _user2;
13141314
accounts[2] = _user3;
1315-
uint256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1315+
int256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
13161316

13171317
// Verify the rewards
13181318
assertEq(rewards.length, 3);
@@ -1323,14 +1323,14 @@ contract SwarmCoordinatorTest is Test {
13231323

13241324
function test_GetRoundStageReward_EmptyArray_Successfully() public view {
13251325
address[] memory accounts = new address[](0);
1326-
uint256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
1326+
int256[] memory rewards = swarmCoordinator.getRoundStageReward(0, 0, accounts);
13271327
assertEq(rewards.length, 0);
13281328
}
13291329

13301330
function test_GetTotalRewards_MultipleAddresses_Successfully() public {
1331-
uint256 reward1 = 100;
1332-
uint256 reward2 = 200;
1333-
uint256 reward3 = 300;
1331+
int256 reward1 = 100;
1332+
int256 reward2 = 200;
1333+
int256 reward3 = 300;
13341334

13351335
string memory peerId1 = "QmPeer1";
13361336
string memory peerId2 = "QmPeer2";
@@ -1357,7 +1357,7 @@ contract SwarmCoordinatorTest is Test {
13571357
peerIds[0] = peerId1;
13581358
peerIds[1] = peerId2;
13591359
peerIds[2] = peerId3;
1360-
uint256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
1360+
int256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
13611361

13621362
// Verify the total rewards
13631363
assertEq(totalRewards.length, 3);
@@ -1368,7 +1368,7 @@ contract SwarmCoordinatorTest is Test {
13681368

13691369
function test_GetTotalRewards_EmptyArray_Successfully() public view {
13701370
string[] memory peerIds = new string[](0);
1371-
uint256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
1371+
int256[] memory totalRewards = swarmCoordinator.getTotalRewards(peerIds);
13721372
assertEq(totalRewards.length, 0);
13731373
}
13741374
}

0 commit comments

Comments
 (0)