Skip to content

Commit

Permalink
feat(test): add Issue8566 testcase
Browse files Browse the repository at this point in the history
Signed-off-by: 9547 <[email protected]>
  • Loading branch information
9547 committed Jan 3, 2025
1 parent 15940fc commit 8186703
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,17 @@ alloy-node-bindings = { version = "0.9.0", default-features = false }
alloy-network-primitives = { version = "0.9.0", default-features = false }

## alloy-core
alloy-dyn-abi = "0.8.14"
alloy-json-abi = "0.8.14"
alloy-primitives = { version = "0.8.14", features = [
alloy-dyn-abi = "0.8.16"
alloy-json-abi = "0.8.16"
alloy-primitives = { version = "0.8.16", features = [
"getrandom",
"rand",
"map-foldhash",
] }
alloy-sol-macro-expander = "0.8.14"
alloy-sol-macro-input = "0.8.14"
alloy-sol-types = "0.8.14"
syn-solidity = "0.8.14"
alloy-sol-macro-expander = "0.8.16"
alloy-sol-macro-input = "0.8.16"
alloy-sol-types = "0.8.16"
syn-solidity = "0.8.16"

alloy-chains = "0.1"
alloy-rlp = "0.3"
Expand Down
3 changes: 3 additions & 0 deletions crates/forge/tests/it/repros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,6 @@ test_repro!(8971; |config| {

// https://github.com/foundry-rs/foundry/issues/8639
test_repro!(8639);

// https://github.com/foundry-rs/foundry/issues/8566
test_repro!(8566);
18 changes: 18 additions & 0 deletions testdata/default/repros/Issue8566.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import "ds-test/test.sol";
import "cheats/Vm.sol";

// https://github.com/foundry-rs/foundry/issues/8566
contract Issue8566Test is DSTest {
Vm constant vm = Vm(HEVM_ADDRESS);

function testParseJsonUint() public {
string memory json =
"{ \"1284\": { \"addRewardInfo\": { \"amount\": 74258.225772486694040708e18, \"rewardPerSec\": 0.03069536448928848133e20 } } }";

assertEq(74258225772486694040708, vm.parseJsonUint(json, ".1284.addRewardInfo.amount"));
assertEq(3069536448928848133, vm.parseJsonUint(json, ".1284.addRewardInfo.rewardPerSec"));
}
}

0 comments on commit 8186703

Please sign in to comment.