Skip to content

Commit

Permalink
Merge branch 'main' into erik/add-get-miniblock-header
Browse files Browse the repository at this point in the history
  • Loading branch information
erikolsson authored Jan 13, 2025
2 parents 5bc25c9 + fe84066 commit df52efb
Show file tree
Hide file tree
Showing 53 changed files with 446 additions and 342 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ jobs:
--name river_postgres_container
steps:
- uses: taiki-e/install-action@just

- name: Cancel previous runs
if: github.event_name != 'schedule'
uses: styfle/[email protected]
Expand Down Expand Up @@ -682,11 +684,8 @@ jobs:
run: ./scripts/register-ca.sh
working-directory: core

- name: Build MLS libs
run: ./scripts/build-mls.sh

- name: Run node tests
run: CGO_LDFLAGS="./libmls_lib.a -ldl" go test -race -timeout 24m -v -parallel 1 -count 1 -p 8 ./...
run: just test-all -race -timeout 24m -parallel 1 -count 1 -p 8
working-directory: core

XChain_Integration:
Expand Down
20 changes: 10 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.ts"],
"args": ["run", "${file}", "--config", "vitest.config.ts"],
"console": "integratedTerminal",
},
{
"name": "Vitest: current file in 'packages/encryption/'",
"type": "node",
"request": "launch",
"env": { "NODE_ENV": "development" },
"env": { "NODE_ENV": "development", "DEBUG": "csb:*,test:*",},
"program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
"cwd": "${workspaceFolder}/packages/encryption",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.ts"],
"args": ["run", "${file}", "--config", "vitest.config.ts"],
"console": "integratedTerminal",
},
{
Expand All @@ -49,7 +49,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.ts"],
"args": ["run", "${file}", "--config", "vitest.config.ts"],
"console": "integratedTerminal",
},
{
Expand All @@ -62,7 +62,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.multi_ne.ts"],
"args": ["run", "${file}", "--config", "vitest.config.multi_ne.ts"],
"console": "integratedTerminal",
},
{
Expand All @@ -75,7 +75,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.ts"],
"args": ["run", "${file}", "--config", "vitest.config.ts"],
"console": "integratedTerminal",
},
{
Expand All @@ -88,7 +88,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.multi_legacy.ts"],
"args": ["run", "${file}", "--config", "vitest.config.multi_legacy.ts"],
"console": "integratedTerminal",
},
{
Expand All @@ -101,7 +101,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.entitlements.ts"],
"args": ["run", "${file}", "--config", "vitest.config.entitlements.ts"],
"console": "integratedTerminal",
},
{
Expand All @@ -117,7 +117,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.ts"],
"args": ["run", "${file}", "--config", "vitest.config.ts"],
"console": "integratedTerminal",
},
{
Expand All @@ -130,7 +130,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"smartStep": true,
"args": ["run", "${fileBasename}", "--config", "vitest.config.unit.ts"],
"args": ["run", "${file}", "--config", "vitest.config.unit.ts"],
"console": "integratedTerminal",
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"address": "0x1A01452AdE93E9907Baf0817c9835e89616975BF"
"address": "0xa9DdAFf98EF46850a7e75376D456c0EF45ae5C9a"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"address": "0x2186e9D5d8b1177b07AD06CeA14f695F8fb0d0b1"
"address": "0x4Dd0B63cB55A988BDc28e3a39Bc42E7E34e9C4eA"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"address": "0xabB6A0f9Bd6Bc985456Bf49821dD16192E141B27"
"address": "0xb2A948Ea103882c527Dc27a4f0581E5FCCCDC645"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"address": "0x7B809Fe671efef51BaAaDf6F0A8C9FD84ce5b608"
"address": "0x3466893bDedb3c158F91D2efEe6cD927Cd765e03"
}
12 changes: 7 additions & 5 deletions contracts/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ update:; forge update

build:; forge build

test :; forge test --ffi --nmc Fork
test :; forge test --ffi --nmc Fork --fuzz-runs 4096

fork-test :; forge test --ffi --mc Fork

Expand Down Expand Up @@ -68,13 +68,15 @@ deploy-any :;
@echo "Running $(contract) on remote network"
@SAVE_DEPLOYMENTS=1 $(if $(context),DEPLOYMENT_CONTEXT=$(context)) \
forge script scripts/deployments/${type}/${contract}.s.sol:${contract} \
--ffi --rpc-url ${rpc} --private-key ${private_key} --broadcast --verify
--ffi --rpc-url ${rpc} $(if $(private_key),--private-key ${private_key},$(if $(account),--account ${account})) \
--broadcast --verify

deploy-any-blockscout :;
@echo "Running $(contract) on remote network"
@SAVE_DEPLOYMENTS=1 $(if $(context),DEPLOYMENT_CONTEXT=$(context)) \
forge script scripts/deployments/${type}/${contract}.s.sol:${contract} \
--ffi --rpc-url ${rpc} --private-key ${private_key} --broadcast --verify --verifier=blockscout --verifier-url=${verifier}
--ffi --rpc-url ${rpc} $(if $(private_key),--private-key ${private_key},$(if $(account),--account ${account})) \
--broadcast --verify --verifier=blockscout --verifier-url=${verifier}

deploy-any-explicit :;
@echo "Running $(contract) on remote network"
Expand Down Expand Up @@ -205,7 +207,7 @@ deploy-ledger-base-sepolia :;
@$(MAKE) resume-any-ledger rpc=base_sepolia hd_path=${HD_PATH} sender=${SENDER_ADDRESS} verifier=${BASESCAN_SEPOLIA_URL} etherscan=${BASESCAN_API_KEY}

deploy-base-sepolia :;
@$(MAKE) deploy-any-blockscout rpc=base_sepolia private_key=${TESTNET_PRIVATE_KEY} verifier=${BLOCKSCOUT_SEPOLIA_URL}
@$(MAKE) deploy-any-blockscout rpc=base_sepolia private_key=${TESTNET_PRIVATE_KEY} verifier=${BLOCKSCOUT_SEPOLIA_URL} etherscan=${BLOCKSCOUT_SEPOLIA_API_KEY}
@$(MAKE) resume-any rpc=base_sepolia private_key=${TESTNET_PRIVATE_KEY} verifier=${BASESCAN_SEPOLIA_URL} etherscan=${BASESCAN_API_KEY}

interact-base-sepolia :;
Expand Down Expand Up @@ -293,7 +295,7 @@ deploy-alpha-sepolia :;
@$(MAKE) deploy-any context=alpha rpc=sepolia private_key=${TESTNET_PRIVATE_KEY}

deploy-alpha-base-sepolia :;
@$(MAKE) deploy-any-blockscout context=alpha rpc=base_sepolia private_key=${TESTNET_PRIVATE_KEY} verifier=${BLOCKSCOUT_SEPOLIA_URL}
@$(MAKE) deploy-any-blockscout context=alpha rpc=base_sepolia private_key=${TESTNET_PRIVATE_KEY} verifier=${BLOCKSCOUT_SEPOLIA_URL} etherscan=${BLOCKSCOUT_SEPOLIA_API_KEY}
@$(MAKE) resume-any rpc=base_sepolia private_key=${TESTNET_PRIVATE_KEY} verifier=${BASESCAN_SEPOLIA_URL} etherscan=${BASESCAN_API_KEY}

interact-alpha-base-sepolia :;
Expand Down
7 changes: 4 additions & 3 deletions contracts/test/base/registry/NodeOperator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ contract NodeOperatorFacetTest is

modifier givenCallerHasBridgedTokens(address caller, uint256 amount) {
vm.assume(caller != address(0));
vm.assume(amount >= stakeRequirement && amount <= stakeRequirement * 10);
amount = bound(amount, stakeRequirement, stakeRequirement * 10);

vm.prank(bridge);
riverFacet.mint(caller, amount);
_;
Expand Down Expand Up @@ -433,7 +434,7 @@ contract NodeOperatorFacetTest is
address randomOperator,
uint256 rate
) external givenOperatorIsRegistered(randomOperator) {
vm.assume(rate > 0 && rate < 100);
rate = bound(rate, 0, 10000);

vm.prank(randomOperator);
vm.expectEmit(address(nodeOperator));
Expand All @@ -448,8 +449,8 @@ contract NodeOperatorFacetTest is
uint256 rate
) external {
vm.assume(randomOperator != address(0));
vm.assume(rate > 0 && rate < 100);
vm.assume(!nodeOperator.isOperator(randomOperator));
rate = bound(rate, 0, 10000);

vm.expectRevert(NodeOperator__NotRegistered.selector);
vm.prank(randomOperator);
Expand Down
26 changes: 13 additions & 13 deletions contracts/test/base/registry/RewardsDistribution.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ contract RewardsDistributionTest is
uint16 totalUsers,
uint8 totalOperators
) public {
vm.assume(totalUsers < 100);
vm.assume(totalOperators > 0 && totalOperators < 10);
vm.assume(distributionAmount < 1000000000 * 1e18);
totalUsers = uint16(bound(totalUsers, 1, 99));
totalOperators = uint8(bound(totalOperators, 1, 9));
distributionAmount = bound(distributionAmount, 1, 999999999 * 1e18);

uint256[] memory amountsPerUser = _createAmountsPerUser(totalUsers);
uint256[] memory commissionsPerOperator = _createCommissionsPerOperator(
Expand Down Expand Up @@ -498,9 +498,9 @@ contract RewardsDistributionTest is
uint16 totalUsers,
uint8 totalOperators
) public {
vm.assume(totalUsers < 100);
vm.assume(totalOperators > 0 && totalOperators < 10);
vm.assume(distributionAmount < 1000000000 * 1e18);
totalUsers = uint16(bound(totalUsers, 1, 99));
totalOperators = uint8(bound(totalOperators, 1, 9));
distributionAmount = bound(distributionAmount, 1, 999999999 * 1e18);

uint256[] memory amountsPerUser = _createAmountsPerUser(totalUsers);
uint256[] memory commissionsPerOperator = _createCommissionsPerOperator(
Expand Down Expand Up @@ -550,10 +550,10 @@ contract RewardsDistributionTest is
uint8 totalOperators,
uint8 totalSpaces
) public {
vm.assume(totalUsers < 50);
vm.assume(totalOperators > 0 && totalOperators < 10);
vm.assume(distributionAmount < 1000000000 * 1e18);
vm.assume(totalSpaces > 0 && totalSpaces < 10);
totalUsers = uint16(bound(totalUsers, 1, 49));
totalOperators = uint8(bound(totalOperators, 1, 9));
totalSpaces = uint8(bound(totalSpaces, 1, 9));
distributionAmount = bound(distributionAmount, 1, 999999999 * 1e18);

uint256[] memory amountsPerUser = _createAmountsPerUser(totalUsers);
uint256[] memory commissionsPerOperator = _createCommissionsPerOperator(
Expand Down Expand Up @@ -619,9 +619,9 @@ contract RewardsDistributionTest is
) public {
cleanupData();

vm.assume(totalUsers < 100);
vm.assume(totalOperators > 0 && totalOperators < 10);
vm.assume(distributionAmount < 1000000000 * 1e18);
totalUsers = uint16(bound(totalUsers, 1, 99));
totalOperators = uint8(bound(totalOperators, 1, 9));
distributionAmount = bound(distributionAmount, 1, 999999999 * 1e18);

uint256[] memory amountsPerUser = _createAmountsPerUser(totalUsers);
uint256[] memory commissionsPerOperator = _createCommissionsPerOperator(
Expand Down
5 changes: 2 additions & 3 deletions contracts/test/crosschain/EntitlementGated.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ contract EntitlementGatedTest is
uint256[] memory roleIds = new uint256[](1);
roleIds[0] = 0;

address[] memory nodes = entitlementChecker.getRandomNodes(5);

for (uint256 i; i < nodes.length; ++i) {
uint256 nodeCount = nodes.length;
for (uint256 i; i < nodeCount; ++i) {
vm.assume(node != nodes[i]);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/test/factory/partner/PartnerRegistrySetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract PartnerRegistrySetup is IPartnerRegistryBase, BaseSetup {
}

modifier givenPartnerIsRegistered(Partner memory partner) {
vm.assume(partner.fee <= MAX_PARTNER_FEE);
partner.fee = bound(partner.fee, 0, MAX_PARTNER_FEE);
vm.assume(partner.recipient != address(0));
vm.deal(partner.account, REGISTRY_FEE);

Expand Down
4 changes: 2 additions & 2 deletions contracts/test/factory/partner/registerPartner.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract PartnerRegistry_registerPartner is PartnerRegistrySetup {
function test_revertWhen_registerPartner_registryFeeNotPaid(
Partner memory partner
) external {
vm.assume(partner.fee <= MAX_PARTNER_FEE);
partner.fee = bound(partner.fee, 0, MAX_PARTNER_FEE);
vm.deal(partner.account, REGISTRY_FEE);

vm.prank(partner.account);
Expand All @@ -40,7 +40,7 @@ contract PartnerRegistry_registerPartner is PartnerRegistrySetup {
function test_revertWhen_registerPartner_invalidPartnerFee(
Partner memory partner
) external {
vm.assume(partner.fee > MAX_PARTNER_FEE);
partner.fee = bound(partner.fee, MAX_PARTNER_FEE + 1, type(uint256).max);

vm.deal(partner.account, REGISTRY_FEE);
vm.prank(partner.account);
Expand Down
12 changes: 10 additions & 2 deletions contracts/test/factory/partner/updatePartner.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ contract PartnerRegistry_updatePartner is PartnerRegistrySetup {
Partner memory updatedPartner
) external givenPartnerIsRegistered(partner) {
vm.assume(updatedPartner.recipient != address(0));
vm.assume(updatedPartner.fee <= partnerRegistry.maxPartnerFee());
updatedPartner.fee = bound(
updatedPartner.fee,
0,
partnerRegistry.maxPartnerFee()
);

updatedPartner.account = partner.account;

Expand Down Expand Up @@ -62,7 +66,11 @@ contract PartnerRegistry_updatePartner is PartnerRegistrySetup {
Partner memory unregisteredPartner
) external {
vm.assume(unregisteredPartner.recipient != address(0));
vm.assume(unregisteredPartner.fee <= partnerRegistry.maxPartnerFee());
unregisteredPartner.fee = bound(
unregisteredPartner.fee,
0,
partnerRegistry.maxPartnerFee()
);

vm.prank(unregisteredPartner.account);
vm.expectRevert(
Expand Down
Loading

0 comments on commit df52efb

Please sign in to comment.