Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2cd49fc
optimize encoding for u64
xunilrj Sep 26, 2025
590a02d
fix std
xunilrj Sep 26, 2025
ba24770
update tests
xunilrj Sep 26, 2025
ccb9700
filter array-repeat tests, so it is not affected by encoding changes
xunilrj Sep 26, 2025
225d120
update tests
xunilrj Sep 26, 2025
b4527bc
improve snapshot tests
xunilrj Sep 26, 2025
69edd98
update tests
xunilrj Sep 26, 2025
4787054
optimize decoding
xunilrj Sep 26, 2025
e3f4b4d
optimize decoding
xunilrj Sep 26, 2025
d3a5907
optimize decoding
xunilrj Sep 26, 2025
c56533b
fixing CI issues
xunilrj Sep 27, 2025
74cb625
clippy and fmt issues
xunilrj Sep 27, 2025
758593a
fixing CI issues
xunilrj Sep 27, 2025
3c63aec
fix test
xunilrj Sep 27, 2025
bf8eac4
update tests
xunilrj Sep 29, 2025
e21a88a
update tests
xunilrj Sep 29, 2025
c33dde8
update tests
xunilrj Sep 29, 2025
1ddc43d
update tests
xunilrj Sep 29, 2025
d8bffaa
fix string arrays __size_of
xunilrj Oct 1, 2025
43c9b21
PR adjustments
xunilrj Oct 1, 2025
4e8be21
optimization for custom structs
xunilrj Oct 2, 2025
bb7b392
more tests
xunilrj Oct 2, 2025
11a1a91
removing println
xunilrj Oct 2, 2025
162ff91
update tests
xunilrj Oct 2, 2025
0bd41ce
contract entry optimizations
xunilrj Oct 2, 2025
dd641ab
improve contract calls
xunilrj Oct 2, 2025
1e7e792
improve contract calls
xunilrj Oct 3, 2025
5431a74
update tests
xunilrj Oct 3, 2025
c46bb0d
clippy and fmt
xunilrj Oct 3, 2025
ca4d8a3
update tests
xunilrj Oct 3, 2025
268c3b9
update tests
xunilrj Oct 3, 2025
6fe6bea
update tests
xunilrj Oct 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions forc-plugins/forc-client/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ async fn test_simple_deploy() {
node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"91c435d6cdb720db92097958163bc43dbc5c4acfbb3d98025039addb9e2da8bb",
"dd22b0b99b6928aeda38620b918c072de1b5569073dbdb19dcfb7e239f041bb8",
)
.unwrap(),
proxy: None,
Expand Down Expand Up @@ -421,7 +421,7 @@ async fn test_deploy_submit_only() {
node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"91c435d6cdb720db92097958163bc43dbc5c4acfbb3d98025039addb9e2da8bb",
"dd22b0b99b6928aeda38620b918c072de1b5569073dbdb19dcfb7e239f041bb8",
)
.unwrap(),
proxy: None,
Expand Down Expand Up @@ -468,12 +468,12 @@ async fn test_deploy_fresh_proxy() {
node.kill().unwrap();
let impl_contract = DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"91c435d6cdb720db92097958163bc43dbc5c4acfbb3d98025039addb9e2da8bb",
"dd22b0b99b6928aeda38620b918c072de1b5569073dbdb19dcfb7e239f041bb8",
)
.unwrap(),
proxy: Some(
ContractId::from_str(
"212c0edca7ddbb762d93a2446083d94df2db059d1f41ad49807223e8249669e5",
"f85d42433e3f3fd7afa34b52356ee73110b3919ff1904d77def4f7ad5e8d430f",
)
.unwrap(),
),
Expand Down
8 changes: 4 additions & 4 deletions forc/tests/cli_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ fn test_forc_test_raw_logs() -> Result<(), rexpect::error::Error> {
// Assert that the output is correct
process.exp_string(" test test_log_4")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12408,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11224,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12408,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11312,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;

process.process.exit()?;
Ok(())
Expand All @@ -77,12 +77,12 @@ fn test_forc_test_both_logs() -> Result<(), rexpect::error::Error> {
process.exp_string("decoded log values:")?;
process.exp_string("4, log rb: 1515152261580153489")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12408,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11224,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?;
process.exp_string("decoded log values:")?;
process.exp_string("2, log rb: 1515152261580153489")?;
process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12408,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":11312,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.process.exit()?;
Ok(())
}
21 changes: 21 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ benchmark-tests:
collect-gas-usage:
cargo r -p test --release -- --verbose --forc-test-only | ./scripts/compare-gas-usage/extract-gas-usage.sh

[group('benchmark')]
[linux]
compare-gas-usage branchBefore branchAfter:
#! /bin/bash
CHANGES=$(git status --porcelain | wc -l)
if [ "$CHANGES" != "0" ]; then
echo -e "git is not clean. Aborting."
exit
fi
AFTEROUT=$(sed "s/\//-/g" <<< "{{branchAfter}}")
AFTEROUT="target/gas-$AFTEROUT.txt"
git checkout {{branchAfter}}
cargo r -p test --release -- --verbose --forc-test-only | tee /dev/tty | ./scripts/compare-gas-usage/extract-gas-usage.sh > "$AFTEROUT"

BEFOREOUT=$(sed "s/\//-/g" <<< "{{branchBefore}}")
BEFOREOUT="target/gas-$BEFOREOUT.txt"
git checkout {{branchBefore}}
cargo r -p test --release -- --verbose --forc-test-only | tee /dev/tty | ./scripts/compare-gas-usage/extract-gas-usage.sh > "$BEFOREOUT"

scripts/compare-gas-usage/generate-diff.sh "$BEFOREOUT" "$AFTEROUT"

[group('build')]
build-prism:
cd ./scripts/prism && ./build.sh
Expand Down
3 changes: 3 additions & 0 deletions sway-ast/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub enum Intrinsic {
EncodeBufferEmpty, // let buffer: (raw_ptr, u64, u64) = __encode_buffer_empty()
EncodeBufferAppend, // let buffer: (raw_ptr, u64, u64) = __encode_buffer_append(buffer, primitive data type)
EncodeBufferAsRawSlice, // let slice: raw_slice = __encode_buffer_as_raw_slice(buffer)
EncodeMemcopy, // let is_memcopy: bool = __encode_memcopy::<T>()
Slice, // let ref_to_slice = __slice::<T: array or ref_to_slice>(item: T, inclusive_start_index, exclusive_end_index)
ElemAt, // let elem: &T = __elem_at::<T: array or ref_to_slice>(item: T, index)
Transmute, // let dst: B = __transmute::<A, B>(src)
Expand Down Expand Up @@ -90,6 +91,7 @@ impl fmt::Display for Intrinsic {
Intrinsic::EncodeBufferEmpty => "encode_buffer_empty",
Intrinsic::EncodeBufferAppend => "encode_buffer_append",
Intrinsic::EncodeBufferAsRawSlice => "encode_buffer_as_raw_slice",
Intrinsic::EncodeMemcopy => "encode_memcopy",
Intrinsic::Slice => "slice",
Intrinsic::ElemAt => "elem_at",
Intrinsic::Transmute => "transmute",
Expand Down Expand Up @@ -142,6 +144,7 @@ impl Intrinsic {
"__encode_buffer_empty" => EncodeBufferEmpty,
"__encode_buffer_append" => EncodeBufferAppend,
"__encode_buffer_as_raw_slice" => EncodeBufferAsRawSlice,
"__encode_memcopy" => EncodeMemcopy,
"__slice" => Slice,
"__elem_at" => ElemAt,
"__transmute" => Transmute,
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/build_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl BuildTarget {
pub const CFG: &'static [&'static str] = &["evm", "fuel"];
}

#[derive(Default, Clone, Copy)]
#[derive(Debug, Default, Clone, Copy)]
pub enum DbgGeneration {
Full,
#[default]
Expand Down
7 changes: 7 additions & 0 deletions sway-core/src/ir_generation/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,13 @@ fn const_eval_intrinsic(
};
Ok(Some(Constant::unique(lookup.context, c)))
}
Intrinsic::EncodeMemcopy => {
let constant = ConstantContent {
ty: Type::get_bool(lookup.context),
value: ConstantValue::Bool(false),
};
Ok(Some(Constant::unique(lookup.context, constant)))
}
Intrinsic::Slice => {
let start = args[1]
.get_content(lookup.context)
Expand Down
Loading
Loading